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 "static_2/notation/relations/topiso_2.ma".
16 include "static_2/syntax/term.ma".
18 (* HEAD EQUIVALENCE FOR TERMS ***********************************************)
20 (* Basic_2A1: includes: tsts_atom tsts_pair *)
21 inductive theq: relation term ≝
22 | theq_sort: ∀s1,s2. theq (⋆s1) (⋆s2)
23 | theq_lref: ∀i. theq (#i) (#i)
24 | theq_gref: ∀l. theq (§l) (§l)
25 | theq_pair: ∀I,V1,V2,T1,T2. theq (②{I}V1.T1) (②{I}V2.T2)
28 interpretation "head equivalence (term)" 'TopIso T1 T2 = (theq T1 T2).
30 (* Basic inversion lemmas ***************************************************)
32 fact theq_inv_sort1_aux: ∀X,Y. X ⩳ Y → ∀s1. X = ⋆s1 →
35 [ #s1 #s2 #s #H destruct /2 width=2 by ex_intro/
38 | #I #V1 #V2 #T1 #T2 #s #H destruct
42 (* Basic_1: was just: iso_gen_sort *)
43 lemma theq_inv_sort1: ∀Y,s1. ⋆s1 ⩳ Y →
45 /2 width=4 by theq_inv_sort1_aux/ qed-.
47 fact theq_inv_lref1_aux: ∀X,Y. X ⩳ Y → ∀i. X = #i → Y = #i.
49 [ #s1 #s2 #j #H destruct
50 | #I #V1 #V2 #T1 #T2 #j #H destruct
54 (* Basic_1: was: iso_gen_lref *)
55 lemma theq_inv_lref1: ∀Y,i. #i ⩳ Y → Y = #i.
56 /2 width=5 by theq_inv_lref1_aux/ qed-.
58 fact theq_inv_gref1_aux: ∀X,Y. X ⩳ Y → ∀l. X = §l → Y = §l.
60 [ #s1 #s2 #k #H destruct
61 | #I #V1 #V2 #T1 #T2 #k #H destruct
65 lemma theq_inv_gref1: ∀Y,l. §l ⩳ Y → Y = §l.
66 /2 width=5 by theq_inv_gref1_aux/ qed-.
68 fact theq_inv_pair1_aux: ∀T1,T2. T1 ⩳ T2 →
69 ∀J,W1,U1. T1 = ②{J}W1.U1 →
70 ∃∃W2,U2. T2 = ②{J}W2.U2.
72 [ #s1 #s2 #J #W1 #U1 #H destruct
73 | #i #J #W1 #U1 #H destruct
74 | #l #J #W1 #U1 #H destruct
75 | #I #V1 #V2 #T1 #T2 #J #W1 #U1 #H destruct /2 width=3 by ex1_2_intro/
79 (* Basic_1: was: iso_gen_head *)
80 (* Basic_2A1: was: tsts_inv_pair1 *)
81 lemma theq_inv_pair1: ∀J,W1,U1,T2. ②{J}W1.U1 ⩳ T2 →
82 ∃∃W2,U2. T2 = ②{J}W2. U2.
83 /2 width=7 by theq_inv_pair1_aux/ qed-.
85 fact theq_inv_pair2_aux: ∀T1,T2. T1 ⩳ T2 →
86 ∀J,W2,U2. T2 = ②{J}W2.U2 →
87 ∃∃W1,U1. T1 = ②{J}W1.U1.
89 [ #s1 #s2 #J #W2 #U2 #H destruct
90 | #i #J #W2 #U2 #H destruct
91 | #l #J #W2 #U2 #H destruct
92 | #I #V1 #V2 #T1 #T2 #J #W2 #U2 #H destruct /2 width=3 by ex1_2_intro/
96 (* Basic_2A1: was: tsts_inv_pair2 *)
97 lemma theq_inv_pair2: ∀J,T1,W2,U2. T1 ⩳ ②{J}W2.U2 →
98 ∃∃W1,U1. T1 = ②{J}W1.U1.
99 /2 width=7 by theq_inv_pair2_aux/ qed-.
101 (* Advanced inversion lemmas ************************************************)
103 lemma theq_inv_pair: ∀I1,I2,V1,V2,T1,T2. ②{I1}V1.T1 ⩳ ②{I2}V2.T2 →
105 #I1 #I2 #V1 #V2 #T1 #T2 #H elim (theq_inv_pair1 … H) -H
106 #V0 #T0 #H destruct //
109 (* Basic properties *********************************************************)
111 (* Basic_1: was: iso_refl *)
112 (* Basic_2A1: was: tsts_refl *)
113 lemma theq_refl: reflexive … theq.
115 * /2 width=1 by theq_lref, theq_gref/
118 (* Basic_2A1: was: tsts_sym *)
119 lemma theq_sym: symmetric … theq.
120 #T1 #T2 * -T1 -T2 /2 width=3 by theq_sort/
123 (* Basic_2A1: was: tsts_dec *)
124 lemma theq_dec: ∀T1,T2. Decidable (T1 ⩳ T2).
125 * [ * #s1 | #I1 #V1 #T1 ] * [1,3,5,7: * #s2 |*: #I2 #V2 #T2 ]
126 [ /3 width=1 by theq_sort, or_introl/
129 elim (theq_inv_sort1 … H) -H #x #H destruct
132 lapply (theq_inv_lref1 … H) -H #H destruct
134 elim (eq_nat_dec s1 s2) #Hs12 destruct /2 width=1 by or_introl/
136 lapply (theq_inv_lref1 … H) -H #H destruct /2 width=1 by/
139 lapply (theq_inv_gref1 … H) -H #H destruct
141 elim (eq_nat_dec s1 s2) #Hs12 destruct /2 width=1 by or_introl/
143 lapply (theq_inv_gref1 … H) -H #H destruct /2 width=1 by/
146 elim (theq_inv_pair1 … H) -H #X1 #X2 #H destruct
148 elim (eq_item2_dec I1 I2) #HI12 destruct
149 [ /3 width=1 by theq_pair, or_introl/ ]
151 lapply (theq_inv_pair … H) -H /2 width=1 by/
155 (* Basic_2A1: removed theorems 2:
156 tsts_inv_atom1 tsts_inv_atom2