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/lenv_length.ma".
17 (* POINTWISE EXTENSION OF A CONTEXT-FREE REALTION FOR TERMS *****************)
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)
25 (* Basic properties *********************************************************)
27 lemma lpx_refl: ∀R. reflexive ? R → reflexive … (lpx R).
28 #R #HR #L elim L -L // /2 width=1/
31 (* Basic inversion lemmas ***************************************************)
33 fact lpx_inv_atom1_aux: ∀R,L1,L2. lpx R L1 L2 → L1 = ⋆ → L2 = ⋆.
36 | #K1 #K2 #I #V1 #V2 #_ #_ #H destruct
40 lemma lpx_inv_atom1: ∀R,L2. lpx R (⋆) L2 → L2 = ⋆.
41 /2 width=4 by lpx_inv_atom1_aux/ qed-.
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.
46 [ #K1 #I #V1 #H destruct
47 | #K1 #K2 #I #V1 #V2 #HK12 #HV12 #L #J #W #H destruct /2 width=5/
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-.
55 fact lpx_inv_atom2_aux: ∀R,L1,L2. lpx R L1 L2 → L2 = ⋆ → L1 = ⋆.
58 | #K1 #K2 #I #V1 #V2 #_ #_ #H destruct
62 lemma lpx_inv_atom2: ∀R,L1. lpx R L1 (⋆) → L1 = ⋆.
63 /2 width=4 by lpx_inv_atom2_aux/ qed-.
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.
68 [ #K2 #I #V2 #H destruct
69 | #K1 #K2 #I #V1 #V2 #HK12 #HV12 #K #J #W #H destruct /2 width=5/
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-.
77 (* Basic forward lemmas *****************************************************)
79 lemma lpx_fwd_length: ∀R,L1,L2. lpx R L1 L2 → |L1| = |L2|.
80 #R #L1 #L2 #H elim H -L1 -L2 normalize //