1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.cs.unibo.it *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU General Public License Version 2 *)
13 (**************************************************************************)
15 include "ground/notation/relations/rat_3.ma".
16 include "ground/xoa/ex_3_2.ma".
17 include "ground/arith/pnat.ma".
18 include "ground/relocation/gr_tl.ma".
20 (* POSITIVE APPLICATION FOR GENERIC RELOCATION MAPS *************************)
23 coinductive gr_pat: relation3 gr_map pnat pnat ≝
25 | gr_pat_refl (f) (g) (j1) (j2):
26 ⫯f = g → 𝟏 = j1 → 𝟏 = j2 → gr_pat g j1 j2
28 | gr_pat_push (f) (i1) (i2):
29 gr_pat f i1 i2 → ∀g,j1,j2. ⫯f = g → ↑i1 = j1 → ↑i2 = j2 → gr_pat g j1 j2
31 | gr_pat_next (f) (i1) (i2):
32 gr_pat f i1 i2 → ∀g,j2. ↑f = g → ↑i2 = j2 → gr_pat g i1 j2
36 "relational positive application (generic relocation maps)"
37 'RAt i1 f i2 = (gr_pat f i1 i2).
40 definition H_gr_pat_div: relation4 gr_map gr_map gr_map gr_map ≝
42 ∀jf,jg,j. @❪jf,f2❫ ≘ j → @❪jg,g2❫ ≘ j →
43 ∃∃j0. @❪j0,f1❫ ≘ jf & @❪j0,g1❫ ≘ jg.
45 (* Basic inversions *********************************************************)
48 lemma gr_pat_inv_unit_push (f) (i1) (i2):
49 @❪i1,f❫ ≘ i2 → ∀g. 𝟏 = i1 → ⫯g = f → 𝟏 = i2.
50 #f #i1 #i2 * -f -i1 -i2 //
51 [ #f #i1 #i2 #_ #g #j1 #j2 #_ * #_ #x #H destruct
52 | #f #i1 #i2 #_ #g #j2 * #_ #x #_ #H elim (eq_inv_gr_push_next … H)
57 lemma gr_pat_inv_succ_push (f) (i1) (i2):
58 @❪i1,f❫ ≘ i2 → ∀g,j1. ↑j1 = i1 → ⫯g = f →
59 ∃∃j2. @❪j1,g❫ ≘ j2 & ↑j2 = i2.
60 #f #i1 #i2 * -f -i1 -i2
61 [ #f #g #j1 #j2 #_ * #_ #x #x1 #H destruct
62 | #f #i1 #i2 #Hi #g #j1 #j2 * * * #x #x1 #H #Hf >(eq_inv_gr_push_bi … Hf) -g destruct /2 width=3 by ex2_intro/
63 | #f #i1 #i2 #_ #g #j2 * #_ #x #x1 #_ #H elim (eq_inv_gr_push_next … H)
68 lemma gr_pat_inv_next (f) (i1) (i2):
69 @❪i1,f❫ ≘ i2 → ∀g. ↑g = f →
70 ∃∃j2. @❪i1,g❫ ≘ j2 & ↑j2 = i2.
71 #f #i1 #i2 * -f -i1 -i2
72 [ #f #g #j1 #j2 * #_ #_ #x #H elim (eq_inv_gr_next_push … H)
73 | #f #i1 #i2 #_ #g #j1 #j2 * #_ #_ #x #H elim (eq_inv_gr_next_push … H)
74 | #f #i1 #i2 #Hi #g #j2 * * #x #H >(eq_inv_gr_next_bi … H) -g /2 width=3 by ex2_intro/
78 (* Advanced inversions ******************************************************)
81 lemma gr_pat_inv_unit_push_succ (f) (i1) (i2):
82 @❪i1,f❫ ≘ i2 → ∀g,j2. 𝟏 = i1 → ⫯g = f → ↑j2 = i2 → ⊥.
83 #f #i1 #i2 #Hf #g #j2 #H1 #H <(gr_pat_inv_unit_push … Hf … H1 H) -f -g -i1 -i2
88 lemma gr_pat_inv_succ_push_unit (f) (i1) (i2):
89 @❪i1,f❫ ≘ i2 → ∀g,j1. ↑j1 = i1 → ⫯g = f → 𝟏 = i2 → ⊥.
90 #f #i1 #i2 #Hf #g #j1 #H1 #H elim (gr_pat_inv_succ_push … Hf … H1 H) -f -i1
91 #x2 #Hg * -i2 #H destruct
95 lemma gr_pat_inv_succ_push_succ (f) (i1) (i2):
96 @❪i1,f❫ ≘ i2 → ∀g,j1,j2. ↑j1 = i1 → ⫯g = f → ↑j2 = i2 → @❪j1,g❫ ≘ j2.
97 #f #i1 #i2 #Hf #g #j1 #j2 #H1 #H elim (gr_pat_inv_succ_push … Hf … H1 H) -f -i1
98 #x2 #Hg * -i2 #H destruct //
102 lemma gr_pat_inv_next_unit (f) (i1) (i2):
103 @❪i1,f❫ ≘ i2 → ∀g. ↑g = f → 𝟏 = i2 → ⊥.
104 #f #i1 #i2 #Hf #g #H elim (gr_pat_inv_next … Hf … H) -f
105 #x2 #Hg * -i2 #H destruct
109 lemma gr_pat_inv_next_succ (f) (i1) (i2):
110 @❪i1,f❫ ≘ i2 → ∀g,j2. ↑g = f → ↑j2 = i2 → @❪i1,g❫ ≘ j2.
111 #f #i1 #i2 #Hf #g #j2 #H elim (gr_pat_inv_next … Hf … H) -f
112 #x2 #Hg * -i2 #H destruct //
116 lemma gr_pat_inv_unit_bi (f) (i1) (i2):
117 @❪i1,f❫ ≘ i2 → 𝟏 = i1 → 𝟏 = i2 → ∃g. ⫯g = f.
118 #f elim (gr_map_split_tl … f) /2 width=2 by ex_intro/
119 #H #i1 #i2 #Hf #H1 #H2 cases (gr_pat_inv_next_unit … Hf … H H2)
123 lemma gr_pat_inv_unit_succ (f) (i1) (i2):
124 @❪i1,f❫ ≘ i2 → ∀j2. 𝟏 = i1 → ↑j2 = i2 →
125 ∃∃g. @❪i1,g❫ ≘ j2 & ↑g = f.
126 #f elim (gr_map_split_tl … f)
127 #H #i1 #i2 #Hf #j2 #H1 #H2
128 [ elim (gr_pat_inv_unit_push_succ … Hf … H1 H H2)
129 | /3 width=5 by gr_pat_inv_next_succ, ex2_intro/
134 lemma gr_pat_inv_succ_unit (f) (i1) (i2):
135 @❪i1,f❫ ≘ i2 → ∀j1. ↑j1 = i1 → 𝟏 = i2 → ⊥.
136 #f elim (gr_map_split_tl f)
137 #H #i1 #i2 #Hf #j1 #H1 #H2
138 [ elim (gr_pat_inv_succ_push_unit … Hf … H1 H H2)
139 | elim (gr_pat_inv_next_unit … Hf … H H2)
144 lemma gr_pat_inv_succ_bi (f) (i1) (i2):
145 @❪i1,f❫ ≘ i2 → ∀j1,j2. ↑j1 = i1 → ↑j2 = i2 →
146 ∨∨ ∃∃g. @❪j1,g❫ ≘ j2 & ⫯g = f
147 | ∃∃g. @❪i1,g❫ ≘ j2 & ↑g = f.
148 #f elim (gr_map_split_tl f) *
149 /4 width=7 by gr_pat_inv_next_succ, gr_pat_inv_succ_push_succ, ex2_intro, or_intror, or_introl/
152 (* Note: the following inversion lemmas must be checked *)
154 lemma gr_pat_inv_push (f) (i1) (i2):
155 @❪i1,f❫ ≘ i2 → ∀g. ⫯g = f →
156 ∨∨ ∧∧ 𝟏 = i1 & 𝟏 = i2
157 | ∃∃j1,j2. @❪j1,g❫ ≘ j2 & ↑j1 = i1 & ↑j2 = i2.
158 #f * [2: #i1 ] #i2 #Hf #g #H
159 [ elim (gr_pat_inv_succ_push … Hf … H) -f /3 width=5 by or_intror, ex3_2_intro/
160 | >(gr_pat_inv_unit_push … Hf … H) -f /3 width=1 by conj, or_introl/
165 lemma gr_pat_inv_push_unit (f) (i1) (i2):
166 @❪i1,f❫ ≘ i2 → ∀g. ⫯g = f → 𝟏 = i2 → 𝟏 = i1.
167 #f #i1 #i2 #Hf #g #H elim (gr_pat_inv_push … Hf … H) -f * //
168 #j1 #j2 #_ #_ * -i2 #H destruct
172 lemma gr_pat_inv_push_succ (f) (i1) (i2):
173 @❪i1,f❫ ≘ i2 → ∀g,j2. ⫯g = f → ↑j2 = i2 →
174 ∃∃j1. @❪j1,g❫ ≘ j2 & ↑j1 = i1.
175 #f #i1 #i2 #Hf #g #j2 #H elim (gr_pat_inv_push … Hf … H) -f *
176 [ #_ * -i2 #H destruct
177 | #x1 #x2 #Hg #H1 * -i2 #H destruct /2 width=3 by ex2_intro/
182 lemma gr_pat_inv_unit_dx (f) (i1) (i2):
183 @❪i1,f❫ ≘ i2 → 𝟏 = i2 →
184 ∃∃g. 𝟏 = i1 & ⫯g = f.
185 #f elim (gr_map_split_tl f)
187 [ /3 width=6 by gr_pat_inv_push_unit, ex2_intro/
188 | elim (gr_pat_inv_next_unit … Hf … H H2)
193 lemma gr_pat_inv_succ_dx (f) (i1) (i2):
194 @❪i1,f❫ ≘ i2 → ∀j2. ↑j2 = i2 →
195 ∨∨ ∃∃g,j1. @❪j1,g❫ ≘ j2 & ↑j1 = i1 & ⫯g = f
196 | ∃∃g. @❪i1,g❫ ≘ j2 & ↑g = f.
197 #f elim (gr_map_split_tl f)
198 #H #i1 #i2 #Hf #j2 #H2
199 [ elim (gr_pat_inv_push_succ … Hf … H H2) -i2 /3 width=5 by or_introl, ex3_2_intro/
200 | lapply (gr_pat_inv_next_succ … Hf … H H2) -i2 /3 width=3 by or_intror, ex2_intro/