~amiloradovsky/symbolic-dynamics

symbolic-dynamics/Patterns_US.v -rw-r--r-- 5.2 KiB View raw
5857f238Andrew Miloradovsky .build.yml: continuous integration for SourceHut 7 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
(* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * Uniform space structure on patterns, via the matching restrictions
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *)

Require Export Symbolic_Dynamics.Patterns.
Require Export Symbolic_Dynamics.Uniform.

Section Patterns_Uniform.

  Variable 𝕄 : Type.  (* the "time" domain, e.g. N^d or Z^d (d: nat) *)
  Variable 𝔸 : Set.  (* the alphabet, the space of the symbols,
                        the equality of symbols is proof-irrelevant *)

  Variable S : Symbolic_Dynamics.Families.Family (configuration 𝕄 𝔸).

  Let pj := @projT1 _ S.

  Inductive entourage_base (U: Symbolic_Dynamics.Families.Family 𝕄):
    Relation_Definitions.relation (sigT S) :=
  | entourage_base_intro: forall x y : sigT S,
      @restriction _ _ U _ always_in_full (pj x) =
      @restriction _ _ U _ always_in_full (pj y)
      -> entourage_base U x y.
  Inductive fundamental_system: Ensembles.Ensemble
                                  (Relation_Definitions.relation _) :=
  | fundamental_system_intro: forall U,
      fundamental_system (entourage_base U).

  Definition uniformity :=
    uniformity_from_fundamental_system fundamental_system.

  Lemma indeed_is_reflexive:
    is_reflexive _ uniformity.
  Proof.
    intros ? ? ?.
    destruct H.
    destruct H as [V ?].
    destruct H as [Hi Hf].
    destruct Hf.
    apply (Hi x x).
    constructor; reflexivity.
  Qed.

  Lemma indeed_is_upper_closed:
    is_upper_closed _ uniformity.
  Proof.
    intros ? ? HI ?.
    destruct H.
    destruct H.
    destruct H.
    constructor.
    exists x.
    split.
    + intros a b xab.
      apply HI.
      apply (H a b); assumption.
    + assumption.
  Qed.

  Lemma entourage_base_converse:
    forall U, entourage_base U = converse _ (entourage_base U).
  Proof.
    intros.
    apply extensionality_relations; split.
    all: intros ? ? ?.
    all: destruct H.
    1: constructor.
    2: destruct H.
    all: now constructor.
  Qed.

  Lemma indeed_is_stable_by_symmetry:
    is_stable_by_symmetry _ uniformity.
  Proof.
    intros ? ?.
    destruct H.
    destruct H.
    destruct H as [Hi Hf].
    constructor.
    exists (converse _ x).
    split.
    + intros a b cab.
      destruct cab as [? ? H].
      specialize (Hi a b H).
      constructor; assumption.
    + destruct Hf.
      rewrite <- entourage_base_converse.
      constructor.
  Qed.

  Import FunctionalExtensionality.

  Lemma intersection_of_entourage_bases_is_that_of_the_union:
    forall  U' V',
      intersection _ (entourage_base U') (entourage_base V')
      = entourage_base (Families.Union _ U' V').
  Proof.
    intros.
    apply extensionality_relations; split.
    - intros ? ? ?.
      destruct H as [? ? HU HV].
      constructor.
      apply functional_extensionality; intro.
      destruct x as [t U'V't].
      cbv.
      destruct U'V't as [t ?|t ?].
      1: destruct HU.
      2: destruct HV.
      1: assert (H'' := equal_f H (existT _ t u)); clear H.
      2: assert (H'' := equal_f H (existT _ t v)); clear H.
      all: cbv in H'' |- *.
      all: rewrite H''; reflexivity.
    - intros ? ? ?.
      destruct H.
      constructor.
      all: constructor.
      all: cbv in H |- *.
      all: apply functional_extensionality.
      1: intro u; destruct u as [t U't].
      2: intro v; destruct v as [t V't].
      1: pose (H' := equal_f H (existT _ t (Families.Union_intro_0
                                              _ _ _ _ U't))).
      2: pose (H' := equal_f H (existT _ t (Families.Union_intro_1
                                              _ _ _ _ V't))).
      all: cbv in H'.
      all: rewrite H'; reflexivity.
  Qed.

  Lemma indeed_is_stable_by_intersection:
    is_stable_by_intersection _ uniformity.
  Proof.
    intros ? ? HU HV.
    destruct HU as [U HU].
    destruct HV as [V HV].
    destruct HU as [U' HU].
    destruct HV as [V' HV].
    constructor.
    exists (intersection _ U' V').
    split.
    + intros ? ? ?.
      destruct H as [? ? HU' HV'].
      destruct HU as [HU _].
      destruct HV as [HV _].
      specialize (HU a b HU').
      specialize (HV a b HV').
      constructor. all: assumption.
    + destruct HU as [_ HfU].
      destruct HV as [_ HfV].
      destruct HfU as [U'].
      destruct HfV as [V'].
      rewrite intersection_of_entourage_bases_is_that_of_the_union.
      constructor.
  Qed.

  Lemma indeed_there_exist_square_roots:
    there_exist_square_roots _ uniformity.
  Proof.
    intros ? ?.
    unfold square_is_in.
    destruct H as [V H].
    destruct H as (V' & HIVU & HFSV).
    destruct HFSV.
    eexists.
    split.
    + constructor.
      exists (entourage_base U).
      split.
      * intros ? ? ?. apply H.
      * constructor.
    + intros ? ? ?.
      apply HIVU. clear V HIVU.
      destruct H.
      destruct H as (b & Ha & Hc).
      constructor.
      destruct Ha as [x y Hxy].
      rewrite Hxy.
      destruct Hc as [z ? Hxz].
      assumption.
  Qed.

  Lemma indeed_a_uniform_structure:
    is_uniform_structure _ uniformity.
  Proof.
    split. exact indeed_is_reflexive.
    split. exact indeed_is_upper_closed.
    split. exact indeed_is_stable_by_symmetry.
    split. exact indeed_is_stable_by_intersection.
    exact indeed_there_exist_square_roots.
  Qed.

End Patterns_Uniform.