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 "apps_2/models/model_props.ma".
17 (* EVALUATION EQUIVALENCE **************************************************)
19 definition veq (M): relation (evaluation M) ≝
20 λv1,v2. ∀d. v1 d ≗ v2 d.
22 interpretation "evaluation equivalence (model)"
23 'RingEq M v1 v2 = (veq M v1 v2).
25 (* Basic properties *********************************************************)
27 lemma veq_refl (M): is_model M →
29 /2 width=1 by mq/ qed.
31 lemma veq_repl (M): is_model M →
32 replace_2 … (veq M) (veq M) (veq M).
33 /2 width=5 by mr/ qed-.
35 lemma veq_sym (M): is_model M → symmetric … (veq M).
36 /3 width=5 by veq_repl, veq_refl/ qed-.
38 lemma veq_trans (M): is_model M → Transitive … (veq M).
39 /3 width=5 by veq_repl, veq_refl/ qed-.
41 (* Properties with extebsional equivalence **********************************)
43 lemma ext_veq (M): is_model M →
44 ∀lv1,lv2. lv1 ≐ lv2 → lv1 ≗{M} lv2.
45 /2 width=1 by mq/ qed.
47 lemma veq_repl_exteq (M): is_model M →
48 replace_2 … (veq M) (exteq …) (exteq …).
49 /2 width=5 by mr/ qed-.
51 lemma exteq_veq_trans (M): ∀lv1,lv. lv1 ≐ lv →
52 ∀lv2. lv ≗{M} lv2 → lv1 ≗ lv2.
55 (* Properties with evaluation evaluation lift *******************************)
57 theorem vlift_swap (M): ∀i1,i2. i1 ≤ i2 →
58 ∀lv,d1,d2. ⫯[i1←d1] ⫯[i2←d2] lv ≐{?,dd M} ⫯[↑i2←d2] ⫯[i1←d1] lv.
59 #M #i1 #i2 #Hi12 #lv #d1 #d2 #j
60 elim (lt_or_eq_or_gt j i1) #Hji1 destruct
61 [ >vlift_lt // >vlift_lt /2 width=3 by lt_to_le_to_lt/
62 >vlift_lt /3 width=3 by lt_S, lt_to_le_to_lt/ >vlift_lt //
63 | >vlift_eq >vlift_lt /2 width=1 by monotonic_le_plus_l/ >vlift_eq //
64 | >vlift_gt // elim (lt_or_eq_or_gt (↓j) i2) #Hji2 destruct
65 [ >vlift_lt // >vlift_lt /2 width=1 by lt_minus_to_plus/ >vlift_gt //
66 | >vlift_eq <(lt_succ_pred … Hji1) >vlift_eq //
67 | >vlift_gt // >vlift_gt /2 width=1 by lt_minus_to_plus_r/ >vlift_gt /2 width=3 by le_to_lt_to_lt/
72 lemma vlift_comp (M): ∀i. compatible_3 … (vlift M i) (sq M) (veq M) (veq M).
73 #m #i #d1 #d2 #Hd12 #lv1 #lv2 #HLv12 #j
74 elim (lt_or_eq_or_gt j i) #Hij destruct
75 [ >vlift_lt // >vlift_lt //
76 | >vlift_eq >vlift_eq //
77 | >vlift_gt // >vlift_gt //
81 (* Properies with term interpretation ***************************************)
83 lemma ti_comp_l (M): is_model M →
84 ∀T,gv,lv1,lv2. lv1 ≗{M} lv2 →
85 ⟦T⟧[gv, lv1] ≗ ⟦T⟧[gv, lv2].
86 #M #HM #T elim T -T * [||| #p * | * ]
87 [ /4 width=3 by seq_trans, seq_sym, ms/
88 | /4 width=5 by seq_sym, ml, mr/
89 | /4 width=3 by seq_trans, seq_sym, mg/
90 | /5 width=5 by vlift_comp, seq_sym, md, mr/
91 | /5 width=1 by vlift_comp, mi, mq/
92 | /4 width=5 by seq_sym, ma, mc, mr/
93 | /4 width=5 by seq_sym, me, mr/
97 lemma ti_ext_l (M): is_model M →
98 ∀T,gv,lv1,lv2. lv1 ≐ lv2 →
99 ⟦T⟧[gv, lv1] ≗{M} ⟦T⟧[gv, lv2].
100 /3 width=1 by ti_comp_l, ext_veq/ qed.