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