]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/grammar/tshf.ma
- lambda_delta: programmed renaming to lambdadelta
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / grammar / tshf.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 HEAD TERM FORMS *****************************************************)
18
19 inductive tshf: relation term ≝
20    | tshf_atom: ∀I. tshf (⓪{I}) (⓪{I})
21    | tshf_abbr: ∀V1,V2,T1,T2. tshf (-ⓓV1. T1) (-ⓓV2. T2)
22    | tshf_abst: ∀a,V1,V2,T1,T2. tshf (ⓛ{a}V1. T1) (ⓛ{a}V2. T2)
23    | tshf_appl: ∀V1,V2,T1,T2. tshf T1 T2 → 𝐒⦃T1⦄ → 𝐒⦃T2⦄ →
24                 tshf (ⓐV1. T1) (ⓐV2. T2)
25 .
26
27 interpretation "same head form (term)" 'napart T1 T2 = (tshf T1 T2).
28
29 (* Basic properties *********************************************************)
30
31 lemma tshf_sym: ∀T1,T2. T1 ≈ T2 → T2 ≈ T1.
32 #T1 #T2 #H elim H -T1 -T2 /2 width=1/
33 qed.
34
35 lemma tshf_refl2: ∀T1,T2. T1 ≈ T2 → T2 ≈ T2.
36 #T1 #T2 #H elim H -T1 -T2 // /2 width=1/
37 qed.
38
39 lemma tshf_refl1: ∀T1,T2. T1 ≈ T2 → T1 ≈ T1.
40 /3 width=2/ qed.
41
42 lemma simple_tshf_repl_dx: ∀T1,T2. T1 ≈ T2 → 𝐒⦃T1⦄ → 𝐒⦃T2⦄.
43 #T1 #T2 #H elim H -T1 -T2 //
44 [ #V1 #V2 #T1 #T2 #H
45   elim (simple_inv_bind … H)
46 | #a #V1 #V2 #T1 #T2 #H
47   elim (simple_inv_bind … H)
48 ]
49 qed. (**) (* remove from index *)
50
51 lemma simple_tshf_repl_sn: ∀T1,T2. T1 ≈ T2 → 𝐒⦃T2⦄ → 𝐒⦃T1⦄.
52 /3 width=3/ qed-.
53
54 (* Basic inversion lemmas ***************************************************)
55
56 fact tshf_inv_bind1_aux: ∀T1,T2. T1 ≈ T2 → ∀a,I,W1,U1. T1 = ⓑ{a,I}W1.U1 →
57                          ∃∃W2,U2. T2 = ⓑ{a,I}W2. U2 &
58                                   (Bind2 a I = Bind2 false Abbr ∨ I = Abst).
59 #T1 #T2 * -T1 -T2
60 [ #J #a #I #W1 #U1 #H destruct
61 | #V1 #V2 #T1 #T2 #a #I #W1 #U1 #H destruct /3 width=3/
62 | #b #V1 #V2 #T1 #T2 #a #I #W1 #U1 #H destruct /3 width=3/
63 | #V1 #V2 #T1 #T2 #_ #_ #_ #a #I #W1 #U1 #H destruct
64 ]
65 qed.
66
67 lemma tshf_inv_bind1: ∀a,I,W1,U1,T2. ⓑ{a,I}W1.U1 ≈ T2 →
68                       ∃∃W2,U2. T2 = ⓑ{a,I}W2. U2 &
69                                (Bind2 a I = Bind2 false Abbr ∨ I = Abst).
70 /2 width=5/ qed-.
71
72 fact tshf_inv_flat1_aux: ∀T1,T2. T1 ≈ T2 → ∀I,W1,U1. T1 = ⓕ{I}W1.U1 →
73                          ∃∃W2,U2. U1 ≈ U2 & 𝐒⦃U1⦄ & 𝐒⦃U2⦄ &
74                                   I = Appl & T2 = ⓐW2. U2.
75 #T1 #T2 * -T1 -T2
76 [ #J #I #W1 #U1 #H destruct
77 | #V1 #V2 #T1 #T2 #I #W1 #U1 #H destruct
78 | #a #V1 #V2 #T1 #T2 #I #W1 #U1 #H destruct
79 | #V1 #V2 #T1 #T2 #HT12 #HT1 #HT2 #I #W1 #U1 #H destruct /2 width=5/
80 ]
81 qed.
82
83 lemma tshf_inv_flat1: ∀I,W1,U1,T2. ⓕ{I}W1.U1 ≈ T2 →
84                       ∃∃W2,U2. U1 ≈ U2 & 𝐒⦃U1⦄ & 𝐒⦃U2⦄ &
85                                I = Appl & T2 = ⓐW2. U2.
86 /2 width=4/ qed-.