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 "ground_2/relocation/rtmap_uni.ma".
16 include "basic_2/notation/relations/relation_3.ma".
17 include "basic_2/syntax/cext2.ma".
18 include "basic_2/relocation/lexs.ma".
20 (* GENERIC EXTENSION OF A CONTEXT-SENSITIVE REALTION FOR TERMS **************)
22 (* Basic_2A1: includes: lpx_sn_atom lpx_sn_pair *)
23 definition lex: (lenv → relation term) → relation lenv ≝
24 λR,L1,L2. ∃∃f. 𝐈⦃f⦄ & L1 ⪤*[cfull, cext2 R, f] L2.
26 interpretation "generic extension (local environment)"
27 'Relation R L1 L2 = (lex R L1 L2).
29 (* Basic properties *********************************************************)
31 lemma lex_bind: ∀R,I1,I2,K1,K2. K1 ⪤[R] K2 → cext2 R K1 I1 I2 →
32 K1.ⓘ{I1} ⪤[R] K2.ⓘ{I2}.
33 #R #I1 #I2 #K1 #K2 * #f #Hf #HK12 #HI12
34 /3 width=3 by lexs_push, isid_push, ex2_intro/
37 (* Basic_2A1: was: lpx_sn_refl *)
38 lemma lex_refl: ∀R. c_reflexive … R → reflexive … (lex R).
39 /4 width=3 by lexs_refl, ext2_refl, ex2_intro/ qed.
41 (* Advanced properties ******************************************************)
43 lemma lex_bind_refl_dx: ∀R. c_reflexive … R →
44 ∀I,K1,K2. K1 ⪤[R] K2 → K1.ⓘ{I} ⪤[R] K2.ⓘ{I}.
45 /3 width=3 by ext2_refl, lex_bind/ qed.
47 (* Basic inversion lemmas ***************************************************)
49 (* Basic_2A1: was: lpx_sn_inv_atom1: *)
50 lemma lex_inv_atom_sn: ∀R,L2. ⋆ ⪤[R] L2 → L2 = ⋆.
51 #R #L2 * #f #Hf #H >(lexs_inv_atom1 … H) -L2 //
54 lemma lex_inv_bind_sn: ∀R,I1,L2,K1. K1.ⓘ{I1} ⪤[R] L2 →
55 ∃∃I2,K2. K1 ⪤[R] K2 & cext2 R K1 I1 I2 & L2 = K2.ⓘ{I2}.
56 #R #I1 #L2 #K1 * #f #Hf #H
57 lapply (lexs_eq_repl_fwd … H (↑f) ?) -H /2 width=1 by eq_push_inv_isid/ #H
58 elim (lexs_inv_push1 … H) -H #I2 #K2 #HK12 #HI12 #H destruct
59 /3 width=5 by ex2_intro, ex3_2_intro/
62 (* Basic_2A1: was: lpx_sn_inv_atom2 *)
63 lemma lex_inv_atom_dx: ∀R,L1. L1 ⪤[R] ⋆ → L1 = ⋆.
64 #R #L1 * #f #Hf #H >(lexs_inv_atom2 … H) -L1 //
67 lemma lex_inv_bind_dx: ∀R,I2,L1,K2. L1 ⪤[R] K2.ⓘ{I2} →
68 ∃∃I1,K1. K1 ⪤[R] K2 & cext2 R K1 I1 I2 & L1 = K1.ⓘ{I1}.
69 #R #I2 #L1 #K2 * #f #Hf #H
70 lapply (lexs_eq_repl_fwd … H (↑f) ?) -H /2 width=1 by eq_push_inv_isid/ #H
71 elim (lexs_inv_push2 … H) -H #I1 #K1 #HK12 #HI12 #H destruct
72 /3 width=5 by ex3_2_intro, ex2_intro/
75 (* Advanced inversion lemmas ************************************************)
77 (* Basic_2A1: was: lpx_sn_inv_pair1 *)
78 lemma lex_inv_pair_sn: ∀R,I,L2,K1,V1. K1.ⓑ{I}V1 ⪤[R] L2 →
79 ∃∃K2,V2. K1 ⪤[R] K2 & R K1 V1 V2 & L2 = K2.ⓑ{I}V2.
81 elim (lex_inv_bind_sn … H) -H #Z2 #K2 #HK12 #HZ2 #H destruct
82 elim (ext2_inv_pair_sn … HZ2) -HZ2 #V2 #HV12 #H destruct
83 /2 width=5 by ex3_2_intro/
86 (* Basic_2A1: was: lpx_sn_inv_pair2 *)
87 lemma lex_inv_pair_dx: ∀R,I,L1,K2,V2. L1 ⪤[R] K2.ⓑ{I}V2 →
88 ∃∃K1,V1. K1 ⪤[R] K2 & R K1 V1 V2 & L1 = K1.ⓑ{I}V1.
90 elim (lex_inv_bind_dx … H) -H #Z1 #K1 #HK12 #HZ1 #H destruct
91 elim (ext2_inv_pair_dx … HZ1) -HZ1 #V1 #HV12 #H destruct
92 /2 width=5 by ex3_2_intro/
95 (* Basic_2A1: was: lpx_sn_inv_pair *)
96 lemma lex_inv_pair: ∀R,I1,I2,L1,L2,V1,V2.
97 L1.ⓑ{I1}V1 ⪤[R] L2.ⓑ{I2}V2 →
98 ∧∧ L1 ⪤[R] L2 & R L1 V1 V2 & I1 = I2.
99 #R #I1 #I2 #L1 #L2 #V1 #V2 #H elim (lex_inv_pair_sn … H) -H
100 #L0 #V0 #HL10 #HV10 #H destruct /2 width=1 by and3_intro/