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 "static_2/notation/relations/clearsn_3.ma".
16 include "static_2/syntax/cext2.ma".
17 include "static_2/relocation/sex.ma".
19 (* CLEAR FOR LOCAL ENVIRONMENTS ON SELECTED ENTRIES *************************)
21 definition ccl: relation3 lenv bind bind ≝ λL,I1,I2. BUnit Void = I2.
23 definition scl: rtmap → relation lenv ≝ sex ccl (cext2 ceq).
26 "clear (local environment)"
27 'ClearSn f L1 L2 = (scl f L1 L2).
29 (* Basic eliminators ********************************************************)
31 lemma scl_ind (Q:rtmap→relation lenv):
33 (∀f,I,K1,K2. K1 ⊐ⓧ[f] K2 → Q f K1 K2 → Q (⫯f) (K1.ⓘ{I}) (K2.ⓘ{I})) →
34 (∀f,I,K1,K2. K1 ⊐ⓧ[f] K2 → Q f K1 K2 → Q (↑f) (K1.ⓘ{I}) (K2.ⓧ)) →
35 ∀f,L1,L2. L1 ⊐ⓧ[f] L2 → Q f L1 L2.
36 #Q #IH1 #IH2 #IH3 #f #L1 #L2 #H elim H -f -L1 -L2
38 | #f #I1 #I2 #K1 #K2 #HK #H #IH destruct /2 by/
39 | #f #I1 #I2 #K1 #K2 #HK * #I [| #V1 #V2 #H ] #IH destruct /2 by/
43 (* Basic inversion lemmas ***************************************************)
45 lemma scl_inv_atom_sn: ∀g,L2. ⋆ ⊐ⓧ[g] L2 → L2 = ⋆.
46 /2 width=4 by sex_inv_atom1/ qed-.
48 lemma scl_inv_push_sn: ∀f,I,K1,L2. K1.ⓘ{I} ⊐ⓧ[⫯f] L2 →
49 ∃∃K2. K1 ⊐ⓧ[f] K2 & L2 = K2.ⓘ{I}.
51 elim (sex_inv_push1 … H) -H #J #K2 #HK12 *
52 /2 width=3 by ex2_intro/
55 lemma scl_inv_next_sn: ∀f,I,K1,L2. K1.ⓘ{I} ⊐ⓧ[↑f] L2 →
56 ∃∃K2. K1 ⊐ⓧ[f] K2 & L2 = K2.ⓧ.
58 elim (sex_inv_next1 … H) -H
59 /2 width=3 by ex2_intro/
62 (* Advanced inversion lemmas ************************************************)
64 lemma scl_inv_bind_sn_gen: ∀g,I,K1,L2. K1.ⓘ{I} ⊐ⓧ[g] L2 →
65 ∨∨ ∃∃f,K2. K1 ⊐ⓧ[f] K2 & g = ⫯f & L2 = K2.ⓘ{I}
66 | ∃∃f,K2. K1 ⊐ⓧ[f] K2 & g = ↑f & L2 = K2.ⓧ.
68 elim (pn_split g) * #f #Hf destruct
69 [ elim (scl_inv_push_sn … H) -H
70 | elim (scl_inv_next_sn … H) -H
72 /3 width=5 by ex3_2_intro, or_intror, or_introl/
75 (* Advanced forward lemmas **************************************************)
77 lemma scl_fwd_bind_sn: ∀g,I1,K1,L2. K1.ⓘ{I1} ⊐ⓧ[g] L2 →
78 ∃∃I2,K2. K1 ⊐ⓧ[⫱g] K2 & L2 = K2.ⓘ{I2}.
80 elim (pn_split g) * #f #Hf destruct #H
81 [ elim (scl_inv_push_sn … H) -H
82 | elim (scl_inv_next_sn … H) -H
84 /2 width=4 by ex2_2_intro/
87 (* Basic properties *********************************************************)
89 lemma scl_atom: ∀f. ⋆ ⊐ⓧ[f] ⋆.
92 lemma scl_push: ∀f,K1,K2. K1 ⊐ⓧ[f] K2 → ∀I. K1.ⓘ{I} ⊐ⓧ[⫯f] K2.ⓘ{I}.
93 #f #K1 #K2 #H * /3 width=1 by sex_push, ext2_unit, ext2_pair/
96 lemma scl_next: ∀f,K1,K2. K1 ⊐ⓧ[f] K2 → ∀I. K1.ⓘ{I} ⊐ⓧ[↑f] K2.ⓧ.
97 /2 width=1 by sex_next/ qed.
99 lemma scl_eq_repl_back: ∀L1,L2. eq_repl_back … (λf. L1 ⊐ⓧ[f] L2).
100 /2 width=3 by sex_eq_repl_back/ qed-.
102 lemma scl_eq_repl_fwd: ∀L1,L2. eq_repl_fwd … (λf. L1 ⊐ⓧ[f] L2).
103 /2 width=3 by sex_eq_repl_fwd/ qed-.
105 (* Advanced properties ******************************************************)
107 lemma scl_refl: ∀f. 𝐈⦃f⦄ → reflexive … (scl f).
109 /3 width=3 by scl_eq_repl_back, scl_push, eq_push_inv_isid/