]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2A/grammar/tsts.ma
update in lambdadelta
[helm.git] / matita / matita / contribs / lambdadelta / basic_2A / grammar / tsts.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 "basic_2A/notation/relations/topiso_2.ma".
16 include "basic_2A/grammar/term_simple.ma".
17
18 (* SAME TOP TERM STRUCTURE **************************************************)
19
20 inductive tsts: relation term ≝
21    | tsts_atom: ∀I. tsts (⓪{I}) (⓪{I})
22    | tsts_pair: ∀I,V1,V2,T1,T2. tsts (②{I}V1.T1) (②{I}V2.T2)
23 .
24
25 interpretation "same top structure (term)" 'TopIso T1 T2 = (tsts T1 T2).
26
27 (* Basic inversion lemmas ***************************************************)
28
29 fact tsts_inv_atom1_aux: ∀T1,T2. T1 ≂ T2 → ∀I. T1 = ⓪{I} → T2 = ⓪{I}.
30 #T1 #T2 * -T1 -T2 //
31 #J #V1 #V2 #T1 #T2 #I #H destruct
32 qed-.
33
34 (* Basic_1: was: iso_gen_sort iso_gen_lref *)
35 lemma tsts_inv_atom1: ∀I,T2. ⓪{I} ≂ T2 → T2 = ⓪{I}.
36 /2 width=3 by tsts_inv_atom1_aux/ qed-.
37
38 fact tsts_inv_pair1_aux: ∀T1,T2. T1 ≂ T2 → ∀I,W1,U1. T1 = ②{I}W1.U1 →
39                          ∃∃W2,U2. T2 = ②{I}W2. U2.
40 #T1 #T2 * -T1 -T2
41 [ #J #I #W1 #U1 #H destruct
42 | #J #V1 #V2 #T1 #T2 #I #W1 #U1 #H destruct /2 width=3 by ex1_2_intro/
43 ]
44 qed-.
45
46 (* Basic_1: was: iso_gen_head *)
47 lemma tsts_inv_pair1: ∀I,W1,U1,T2. ②{I}W1.U1 ≂ T2 →
48                       ∃∃W2,U2. T2 = ②{I}W2. U2.
49 /2 width=5 by tsts_inv_pair1_aux/ qed-.
50
51 fact tsts_inv_atom2_aux: ∀T1,T2. T1 ≂ T2 → ∀I. T2 = ⓪{I} → T1 = ⓪{I}.
52 #T1 #T2 * -T1 -T2 //
53 #J #V1 #V2 #T1 #T2 #I #H destruct
54 qed-.
55
56 lemma tsts_inv_atom2: ∀I,T1. T1 ≂ ⓪{I} → T1 = ⓪{I}.
57 /2 width=3 by tsts_inv_atom2_aux/ qed-.
58
59 fact tsts_inv_pair2_aux: ∀T1,T2. T1 ≂ T2 → ∀I,W2,U2. T2 = ②{I}W2.U2 →
60                          ∃∃W1,U1. T1 = ②{I}W1.U1.
61 #T1 #T2 * -T1 -T2
62 [ #J #I #W2 #U2 #H destruct
63 | #J #V1 #V2 #T1 #T2 #I #W2 #U2 #H destruct /2 width=3 by ex1_2_intro/
64 ]
65 qed-.
66
67 lemma tsts_inv_pair2: ∀I,T1,W2,U2. T1 ≂ ②{I}W2.U2 →
68                       ∃∃W1,U1. T1 = ②{I}W1.U1.
69 /2 width=5 by tsts_inv_pair2_aux/ qed-.
70
71 (* Basic properties *********************************************************)
72
73 (* Basic_1: was: iso_refl *)
74 lemma tsts_refl: reflexive … tsts.
75 #T elim T -T //
76 qed.
77
78 lemma tsts_sym: symmetric … tsts.
79 #T1 #T2 #H elim H -T1 -T2 //
80 qed-.
81
82 lemma tsts_dec: ∀T1,T2. Decidable (T1 ≂ T2).
83 * #I1 [2: #V1 #T1 ] * #I2 [2,4: #V2 #T2 ]
84 [ elim (eq_item2_dec I1 I2) #HI12
85   [ destruct /2 width=1 by tsts_pair, or_introl/
86   | @or_intror #H
87     elim (tsts_inv_pair1 … H) -H #V #T #H destruct /2 width=1 by/
88   ]
89 | @or_intror #H
90   lapply (tsts_inv_atom1 … H) -H #H destruct
91 | @or_intror #H
92   lapply (tsts_inv_atom2 … H) -H #H destruct
93 | elim (eq_item0_dec I1 I2) #HI12
94   [ destruct /2 width=1 by or_introl/
95   | @or_intror #H
96     lapply (tsts_inv_atom2 … H) -H #H destruct /2 width=1 by/
97   ]
98 ]
99 qed.
100
101 lemma simple_tsts_repl_dx: ∀T1,T2. T1 ≂ T2 → 𝐒⦃T1⦄ → 𝐒⦃T2⦄.
102 #T1 #T2 * -T1 -T2 //
103 #I #V1 #V2 #T1 #T2 #H
104 elim (simple_inv_pair … H) -H #J #H destruct //
105 qed-.
106
107 lemma simple_tsts_repl_sn: ∀T1,T2. T1 ≂ T2 → 𝐒⦃T2⦄ → 𝐒⦃T1⦄.
108 /3 width=3 by simple_tsts_repl_dx, tsts_sym/ qed-.