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 "basic_2/grammar/term_simple.ma".
17 (* SAME HEAD TERM FORMS *****************************************************)
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)
27 interpretation "same head form (term)" 'napart T1 T2 = (tshf T1 T2).
29 (* Basic properties *********************************************************)
31 lemma tshf_sym: ∀T1,T2. T1 ≈ T2 → T2 ≈ T1.
32 #T1 #T2 #H elim H -T1 -T2 /2 width=1/
35 lemma tshf_refl2: ∀T1,T2. T1 ≈ T2 → T2 ≈ T2.
36 #T1 #T2 #H elim H -T1 -T2 // /2 width=1/
39 lemma tshf_refl1: ∀T1,T2. T1 ≈ T2 → T1 ≈ T1.
42 lemma simple_tshf_repl_dx: ∀T1,T2. T1 ≈ T2 → 𝐒⦃T1⦄ → 𝐒⦃T2⦄.
43 #T1 #T2 #H elim H -T1 -T2 //
45 elim (simple_inv_bind … H)
46 | #a #V1 #V2 #T1 #T2 #H
47 elim (simple_inv_bind … H)
49 qed. (**) (* remove from index *)
51 lemma simple_tshf_repl_sn: ∀T1,T2. T1 ≈ T2 → 𝐒⦃T2⦄ → 𝐒⦃T1⦄.
54 (* Basic inversion lemmas ***************************************************)
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).
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
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).
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.
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/
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.