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/xoa/ex_1_2.ma".
16 include "static_2/notation/relations/tilde_2.ma".
17 include "static_2/syntax/term.ma".
19 (* SORT-IRRELEVANT OUTER EQUIVALENCE FOR TERMS ******************************)
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)
30 "sort-irrelevant outer equivalence (term)"
31 'Tilde T1 T2 = (teqo T1 T2).
33 (* Basic inversion lemmas ***************************************************)
35 fact teqo_inv_sort1_aux: ∀X,Y. X ~ Y → ∀s1. X = ⋆s1 →
38 [ #s1 #s2 #s #H destruct /2 width=2 by ex_intro/
41 | #I #V1 #V2 #T1 #T2 #s #H destruct
45 (* Basic_1: was just: iso_gen_sort *)
46 lemma teqo_inv_sort1: ∀Y,s1. ⋆s1 ~ Y →
48 /2 width=4 by teqo_inv_sort1_aux/ qed-.
50 fact teqo_inv_lref1_aux: ∀X,Y. X ~ Y → ∀i. X = #i → Y = #i.
52 [ #s1 #s2 #j #H destruct
53 | #I #V1 #V2 #T1 #T2 #j #H destruct
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-.
61 fact teqo_inv_gref1_aux: ∀X,Y. X ~ Y → ∀l. X = §l → Y = §l.
63 [ #s1 #s2 #k #H destruct
64 | #I #V1 #V2 #T1 #T2 #k #H destruct
68 lemma teqo_inv_gref1: ∀Y,l. §l ~ Y → Y = §l.
69 /2 width=5 by teqo_inv_gref1_aux/ qed-.
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.
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/
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-.
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.
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/
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-.
104 (* Advanced inversion lemmas ************************************************)
106 lemma teqo_inv_pair: ∀I1,I2,V1,V2,T1,T2. ②[I1]V1.T1 ~ ②[I2]V2.T2 →
108 #I1 #I2 #V1 #V2 #T1 #T2 #H elim (teqo_inv_pair1 … H) -H
109 #V0 #T0 #H destruct //
112 (* Basic properties *********************************************************)
114 (* Basic_1: was: iso_refl *)
115 (* Basic_2A1: was: tsts_refl *)
116 lemma teqo_refl: reflexive … teqo.
118 * /2 width=1 by teqo_lref, teqo_gref/
121 (* Basic_2A1: was: tsts_sym *)
122 lemma teqo_sym: symmetric … teqo.
123 #T1 #T2 * -T1 -T2 /2 width=3 by teqo_sort/
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/
132 elim (teqo_inv_sort1 … H) -H #x #H destruct
135 lapply (teqo_inv_lref1 … H) -H #H destruct
137 elim (eq_nat_dec s1 s2) #Hs12 destruct /2 width=1 by or_introl/
139 lapply (teqo_inv_lref1 … H) -H #H destruct /2 width=1 by/
142 lapply (teqo_inv_gref1 … H) -H #H destruct
144 elim (eq_nat_dec s1 s2) #Hs12 destruct /2 width=1 by or_introl/
146 lapply (teqo_inv_gref1 … H) -H #H destruct /2 width=1 by/
149 elim (teqo_inv_pair1 … H) -H #X1 #X2 #H destruct
151 elim (eq_item2_dec I1 I2) #HI12 destruct
152 [ /3 width=1 by teqo_pair, or_introl/ ]
154 lapply (teqo_inv_pair … H) -H /2 width=1 by/
158 (* Basic_2A1: removed theorems 2:
159 tsts_inv_atom1 tsts_inv_atom2