]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/grammar/tstc.ma
78a9b4987a4d5a938cbfba3ebe7de73416ad81f6
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / grammar / tstc.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_2/grammar/term_simple.ma".
16
17 (* SAME TOP TERM CONSTRUCTOR ************************************************)
18
19 inductive tstc: relation term ≝
20    | tstc_atom: ∀I. tstc (⓪{I}) (⓪{I})
21    | tstc_pair: ∀I,V1,V2,T1,T2. tstc (②{I} V1. T1) (②{I} V2. T2)
22 .
23
24 interpretation "same top constructor (term)" 'Iso T1 T2 = (tstc T1 T2).
25
26 (* Basic inversion lemmas ***************************************************)
27
28 fact tstc_inv_atom1_aux: ∀T1,T2. T1 ≃ T2 → ∀I. T1 = ⓪{I} → T2 = ⓪{I}.
29 #T1 #T2 * -T1 -T2 //
30 #J #V1 #V2 #T1 #T2 #I #H destruct
31 qed.
32
33 (* Basic_1: was: iso_gen_sort iso_gen_lref *)
34 lemma tstc_inv_atom1: ∀I,T2. ⓪{I} ≃ T2 → T2 = ⓪{I}.
35 /2 width=3/ qed-.
36
37 fact tstc_inv_pair1_aux: ∀T1,T2. T1 ≃ T2 → ∀I,W1,U1. T1 = ②{I}W1.U1 →
38                          ∃∃W2,U2. T2 = ②{I}W2. U2.
39 #T1 #T2 * -T1 -T2
40 [ #J #I #W1 #U1 #H destruct
41 | #J #V1 #V2 #T1 #T2 #I #W1 #U1 #H destruct /2 width=3/
42 ]
43 qed.
44
45 (* Basic_1: was: iso_gen_head *)
46 lemma tstc_inv_pair1: ∀I,W1,U1,T2. ②{I}W1.U1 ≃ T2 →
47                       ∃∃W2,U2. T2 = ②{I}W2. U2.
48 /2 width=5/ qed-.
49
50 fact tstc_inv_atom2_aux: ∀T1,T2. T1 ≃ T2 → ∀I. T2 = ⓪{I} → T1 = ⓪{I}.
51 #T1 #T2 * -T1 -T2 //
52 #J #V1 #V2 #T1 #T2 #I #H destruct
53 qed.
54
55 lemma tstc_inv_atom2: ∀I,T1. T1 ≃ ⓪{I} → T1 = ⓪{I}.
56 /2 width=3/ qed-.
57
58 fact tstc_inv_pair2_aux: ∀T1,T2. T1 ≃ T2 → ∀I,W2,U2. T2 = ②{I}W2.U2 →
59                          ∃∃W1,U1. T1 = ②{I}W1. U1.
60 #T1 #T2 * -T1 -T2
61 [ #J #I #W2 #U2 #H destruct
62 | #J #V1 #V2 #T1 #T2 #I #W2 #U2 #H destruct /2 width=3/
63 ]
64 qed.
65
66 lemma tstc_inv_pair2: ∀I,T1,W2,U2. T1 ≃ ②{I}W2.U2 →
67                       ∃∃W1,U1. T1 = ②{I}W1. U1.
68 /2 width=5/ qed-.
69
70 (* Basic properties *********************************************************)
71
72 (* Basic_1: was: iso_refl *)
73 lemma tstc_refl: ∀T. T ≃ T.
74 #T elim T -T //
75 qed.
76
77 lemma tstc_sym: ∀T1,T2. T1 ≃ T2 → T2 ≃ T1.
78 #T1 #T2 #H elim H -T1 -T2 //
79 qed.
80
81 lemma tstc_dec: ∀T1,T2. Decidable (T1 ≃ T2).
82 * #I1 [2: #V1 #T1 ] * #I2 [2,4: #V2 #T2 ]
83 [ elim (item2_eq_dec I1 I2) #HI12
84   [ destruct /2 width=1/
85   | @or_intror #H
86     elim (tstc_inv_pair1 … H) -H #V #T #H destruct /2 width=1/
87   ]
88 | @or_intror #H
89   lapply (tstc_inv_atom1 … H) -H #H destruct
90 | @or_intror #H
91   lapply (tstc_inv_atom2 … H) -H #H destruct
92 | elim (item0_eq_dec I1 I2) #HI12
93   [ destruct /2 width=1/
94   | @or_intror #H
95     lapply (tstc_inv_atom2 … H) -H #H destruct /2 width=1/
96   ]
97 ]
98 qed.
99
100 lemma simple_tstc_repl_dx: ∀T1,T2. T1 ≃ T2 → 𝐒⦃T1⦄ → 𝐒⦃T2⦄.
101 #T1 #T2 * -T1 -T2 //
102 #I #V1 #V2 #T1 #T2 #H
103 elim (simple_inv_pair … H) -H #J #H destruct //
104 qed. (**) (* remove from index *)
105
106 lemma simple_tstc_repl_sn: ∀T1,T2. T1 ≃ T2 → 𝐒⦃T2⦄ → 𝐒⦃T1⦄.
107 /3 width=3/ qed-.