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