]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/static_2/syntax/teqo.ma
update in ground_2, static_2, basic_2, apps_2, alpha_1
[helm.git] / matita / matita / contribs / lambdadelta / static_2 / syntax / teqo.ma
1 (**************************************************************************)
2 (*       ___                                                              *)
3 (*      ||M||                                                             *)
4 (*      ||A||       A project by Andrea Asperti                           *)
5 (*      ||T||                                                             *)
6 (*      ||I||       Developers:                                           *)
7 (*      ||T||         The HELM team.                                      *)
8 (*      ||A||         http://helm.cs.unibo.it                             *)
9 (*      \   /                                                             *)
10 (*       \ /        This file is distributed under the terms of the       *)
11 (*        v         GNU General Public License Version 2                  *)
12 (*                                                                        *)
13 (**************************************************************************)
14
15 include "ground_2/xoa/ex_1_2.ma".
16 include "static_2/notation/relations/topiso_2.ma".
17 include "static_2/syntax/term.ma".
18
19 (* SORT-IRRELEVANT OUTER EQUIVALENCE FOR TERMS ******************************)
20
21 (* Basic_2A1: includes: tsts_atom tsts_pair *)
22 inductive teqo: relation term ≝
23 | teqo_sort: ∀s1,s2. teqo (⋆s1) (⋆s2)
24 | teqo_lref: ∀i. teqo (#i) (#i)
25 | teqo_gref: ∀l. teqo (§l) (§l)
26 | teqo_pair: ∀I,V1,V2,T1,T2. teqo (②[I]V1.T1) (②[I]V2.T2)
27 .
28
29 interpretation
30   "sort-irrelevant outer equivalence (term)"
31   'TopIso T1 T2 = (teqo T1 T2).
32
33 (* Basic inversion lemmas ***************************************************)
34
35 fact teqo_inv_sort1_aux: ∀X,Y. X ⩳ Y → ∀s1. X = ⋆s1 →
36                          ∃s2. Y = ⋆s2.
37 #X #Y * -X -Y
38 [ #s1 #s2 #s #H destruct /2 width=2 by ex_intro/
39 | #i #s #H destruct
40 | #l #s #H destruct
41 | #I #V1 #V2 #T1 #T2 #s #H destruct
42 ]
43 qed-.
44
45 (* Basic_1: was just: iso_gen_sort *)
46 lemma teqo_inv_sort1: ∀Y,s1. ⋆s1 ⩳ Y →
47                       ∃s2. Y = ⋆s2.
48 /2 width=4 by teqo_inv_sort1_aux/ qed-.
49
50 fact teqo_inv_lref1_aux: ∀X,Y. X ⩳ Y → ∀i. X = #i → Y = #i.
51 #X #Y * -X -Y //
52 [ #s1 #s2 #j #H destruct
53 | #I #V1 #V2 #T1 #T2 #j #H destruct
54 ]
55 qed-.
56
57 (* Basic_1: was: iso_gen_lref *)
58 lemma teqo_inv_lref1: ∀Y,i. #i ⩳ Y → Y = #i.
59 /2 width=5 by teqo_inv_lref1_aux/ qed-.
60
61 fact teqo_inv_gref1_aux: ∀X,Y. X ⩳ Y → ∀l. X = §l → Y = §l.
62 #X #Y * -X -Y //
63 [ #s1 #s2 #k #H destruct
64 | #I #V1 #V2 #T1 #T2 #k #H destruct
65 ]
66 qed-.
67
68 lemma teqo_inv_gref1: ∀Y,l. §l ⩳ Y → Y = §l.
69 /2 width=5 by teqo_inv_gref1_aux/ qed-.
70
71 fact teqo_inv_pair1_aux: ∀T1,T2. T1 ⩳ T2 →
72                          ∀J,W1,U1. T1 = ②[J]W1.U1 →
73                          ∃∃W2,U2. T2 = ②[J]W2.U2.
74 #T1 #T2 * -T1 -T2
75 [ #s1 #s2 #J #W1 #U1 #H destruct
76 | #i #J #W1 #U1 #H destruct
77 | #l #J #W1 #U1 #H destruct
78 | #I #V1 #V2 #T1 #T2 #J #W1 #U1 #H destruct /2 width=3 by ex1_2_intro/
79 ]
80 qed-.
81
82 (* Basic_1: was: iso_gen_head *)
83 (* Basic_2A1: was: tsts_inv_pair1 *)
84 lemma teqo_inv_pair1: ∀J,W1,U1,T2. ②[J]W1.U1 ⩳ T2 →
85                       ∃∃W2,U2. T2 = ②[J]W2. U2.
86 /2 width=7 by teqo_inv_pair1_aux/ qed-.
87
88 fact teqo_inv_pair2_aux: ∀T1,T2. T1 ⩳ T2 →
89                          ∀J,W2,U2. T2 = ②[J]W2.U2 →
90                          ∃∃W1,U1. T1 = ②[J]W1.U1.
91 #T1 #T2 * -T1 -T2
92 [ #s1 #s2 #J #W2 #U2 #H destruct
93 | #i #J #W2 #U2 #H destruct
94 | #l #J #W2 #U2 #H destruct
95 | #I #V1 #V2 #T1 #T2 #J #W2 #U2 #H destruct /2 width=3 by ex1_2_intro/
96 ]
97 qed-.
98
99 (* Basic_2A1: was: tsts_inv_pair2 *)
100 lemma teqo_inv_pair2: ∀J,T1,W2,U2. T1 ⩳ ②[J]W2.U2 →
101                       ∃∃W1,U1. T1 = ②[J]W1.U1.
102 /2 width=7 by teqo_inv_pair2_aux/ qed-.
103
104 (* Advanced inversion lemmas ************************************************)
105
106 lemma teqo_inv_pair: ∀I1,I2,V1,V2,T1,T2. ②[I1]V1.T1 ⩳ ②[I2]V2.T2 →
107                      I1 = I2.
108 #I1 #I2 #V1 #V2 #T1 #T2 #H elim (teqo_inv_pair1 … H) -H
109 #V0 #T0 #H destruct //
110 qed-.
111
112 (* Basic properties *********************************************************)
113
114 (* Basic_1: was: iso_refl *)
115 (* Basic_2A1: was: tsts_refl *)
116 lemma teqo_refl: reflexive … teqo.
117 * //
118 * /2 width=1 by teqo_lref, teqo_gref/
119 qed.
120
121 (* Basic_2A1: was: tsts_sym *)
122 lemma teqo_sym: symmetric … teqo.
123 #T1 #T2 * -T1 -T2 /2 width=3 by teqo_sort/
124 qed-.
125
126 (* Basic_2A1: was: tsts_dec *)
127 lemma teqo_dec: ∀T1,T2. Decidable (T1 ⩳ T2).
128 * [ * #s1 | #I1 #V1 #T1 ] * [1,3,5,7: * #s2 |*: #I2 #V2 #T2 ]
129 [ /3 width=1 by teqo_sort, or_introl/
130 |2,3,13:
131   @or_intror #H
132   elim (teqo_inv_sort1 … H) -H #x #H destruct
133 |4,6,14:
134   @or_intror #H
135   lapply (teqo_inv_lref1 … H) -H #H destruct
136 |5:
137   elim (eq_nat_dec s1 s2) #Hs12 destruct /2 width=1 by or_introl/
138   @or_intror #H
139   lapply (teqo_inv_lref1 … H) -H #H destruct /2 width=1 by/
140 |7,8,15:
141   @or_intror #H
142   lapply (teqo_inv_gref1 … H) -H #H destruct
143 |9:
144   elim (eq_nat_dec s1 s2) #Hs12 destruct /2 width=1 by or_introl/
145   @or_intror #H
146   lapply (teqo_inv_gref1 … H) -H #H destruct /2 width=1 by/
147 |10,11,12:
148   @or_intror #H
149   elim (teqo_inv_pair1 … H) -H #X1 #X2 #H destruct
150 |16:
151   elim (eq_item2_dec I1 I2) #HI12 destruct
152   [ /3 width=1 by teqo_pair, or_introl/ ]
153   @or_intror #H
154   lapply (teqo_inv_pair … H) -H /2 width=1 by/
155 ]
156 qed-.
157
158 (* Basic_2A1: removed theorems 2:
159               tsts_inv_atom1 tsts_inv_atom2
160 *)