]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambda_delta/basic_2/grammar/lenv_px.ma
fd3034456fe3a51fafb6bbd3c08b0c414c90de82
[helm.git] / matita / matita / contribs / lambda_delta / basic_2 / grammar / lenv_px.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/lenv_length.ma".
16
17 (* POINTWISE EXTENSION OF A CONTEXT-FREE REALTION FOR TERMS *****************)
18
19 inductive lpx (R:relation term): relation lenv ≝
20 | lpx_stom: lpx R (⋆) (⋆)
21 | lpx_pair: ∀K1,K2,I,V1,V2.
22             lpx R K1 K2 → R V1 V2 → lpx R (K1. ⓑ{I} V1) (K2. ⓑ{I} V2)
23 .
24
25 (* Basic properties *********************************************************)
26
27 lemma lpx_refl: ∀R. reflexive ? R → reflexive … (lpx R).
28 #R #HR #L elim L -L // /2 width=1/
29 qed.
30
31 (* Basic inversion lemmas ***************************************************)
32
33 fact lpx_inv_atom1_aux: ∀R,L1,L2. lpx R L1 L2 → L1 = ⋆ → L2 = ⋆.
34 #R #L1 #L2 * -L1 -L2
35 [ //
36 | #K1 #K2 #I #V1 #V2 #_ #_ #H destruct
37 ]
38 qed-.
39
40 lemma lpx_inv_atom1: ∀R,L2. lpx R (⋆) L2 → L2 = ⋆.
41 /2 width=4 by lpx_inv_atom1_aux/ qed-.
42
43 fact lpx_inv_pair1_aux: ∀R,L1,L2. lpx R L1 L2 → ∀K1,I,V1. L1 = K1. ⓑ{I} V1 →
44                         ∃∃K2,V2. lpx R K1 K2 & R V1 V2 & L2 = K2. ⓑ{I} V2.
45 #R #L1 #L2 * -L1 -L2
46 [ #K1 #I #V1 #H destruct
47 | #K1 #K2 #I #V1 #V2 #HK12 #HV12 #L #J #W #H destruct /2 width=5/
48 ]
49 qed-.
50
51 lemma lpx_inv_pair1: ∀R,K1,I,V1,L2. lpx R (K1. ⓑ{I} V1) L2 →
52                      ∃∃K2,V2. lpx R K1 K2 & R V1 V2 & L2 = K2. ⓑ{I} V2.
53 /2 width=3 by lpx_inv_pair1_aux/ qed-.
54
55 fact lpx_inv_atom2_aux: ∀R,L1,L2. lpx R L1 L2 → L2 = ⋆ → L1 = ⋆.
56 #R #L1 #L2 * -L1 -L2
57 [ //
58 | #K1 #K2 #I #V1 #V2 #_ #_ #H destruct
59 ]
60 qed-.
61
62 lemma lpx_inv_atom2: ∀R,L1. lpx R L1 (⋆) → L1 = ⋆.
63 /2 width=4 by lpx_inv_atom2_aux/ qed-.
64
65 fact lpx_inv_pair2_aux: ∀R,L1,L2. lpx R L1 L2 → ∀K2,I,V2. L2 = K2. ⓑ{I} V2 →
66                         ∃∃K1,V1. lpx R K1 K2 & R V1 V2 & L1 = K1. ⓑ{I} V1.
67 #R #L1 #L2 * -L1 -L2
68 [ #K2 #I #V2 #H destruct
69 | #K1 #K2 #I #V1 #V2 #HK12 #HV12 #K #J #W #H destruct /2 width=5/
70 ]
71 qed-.
72
73 lemma lpx_inv_pair2: ∀R,L1,K2,I,V2. lpx R L1 (K2. ⓑ{I} V2) →
74                      ∃∃K1,V1. lpx R K1 K2 & R V1 V2 & L1 = K1. ⓑ{I} V1.
75 /2 width=3 by lpx_inv_pair2_aux/ qed-.
76
77 (* Basic forward lemmas *****************************************************)
78
79 lemma lpx_fwd_length: ∀R,L1,L2. lpx R L1 L2 → |L1| = |L2|.
80 #R #L1 #L2 #H elim H -L1 -L2 normalize //
81 qed-.