]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/apps_2/models/veq.ma
update in apps_2
[helm.git] / matita / matita / contribs / lambdadelta / apps_2 / models / veq.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 "apps_2/models/model_props.ma".
16
17 (* EVALUATION EQUIVALENCE  **************************************************)
18
19 definition veq (M): relation (evaluation M) ≝
20                     λv1,v2. ∀d. v1 d ≗ v2 d.
21
22 interpretation "evaluation equivalence (model)"
23    'RingEq M v1 v2 = (veq M v1 v2).
24
25 (* Basic properties *********************************************************)
26
27 lemma veq_refl (M): is_model M →
28                     reflexive … (veq M).
29 /2 width=1 by mq/ qed.
30
31 lemma veq_repl (M): is_model M →
32                     replace_2 … (veq M) (veq M) (veq M).
33 /2 width=5 by mr/ qed-.
34
35 lemma ext_veq (M): is_model M →
36                    ∀lv1,lv2. lv1 ≐ lv2 → lv1 ≗{M} lv2.
37 /2 width=1 by mq/ qed.
38
39 lemma exteq_veq_trans (M): ∀lv1,lv. lv1 ≐ lv →
40                            ∀lv2. lv ≗{M} lv2 → lv1 ≗ lv2.
41 // qed-.
42
43 (* Properties with evaluation evaluation lift *******************************)
44
45 theorem vlift_swap (M): ∀i1,i2. i1 ≤ i2 →
46                         ∀lv,d1,d2. ⫯[i1←d1] ⫯[i2←d2] lv ≐{?,dd M} ⫯[↑i2←d2] ⫯[i1←d1] lv.
47 #M #i1 #i2 #Hi12 #lv #d1 #d2 #j
48 elim (lt_or_eq_or_gt j i1) #Hji1 destruct
49 [ >vlift_lt // >vlift_lt /2 width=3 by lt_to_le_to_lt/
50   >vlift_lt /3 width=3 by lt_S, lt_to_le_to_lt/ >vlift_lt //
51 | >vlift_eq >vlift_lt /2 width=1 by monotonic_le_plus_l/ >vlift_eq //
52 | >vlift_gt // elim (lt_or_eq_or_gt (↓j) i2) #Hji2 destruct
53   [ >vlift_lt // >vlift_lt /2 width=1 by lt_minus_to_plus/ >vlift_gt //
54   | >vlift_eq <(lt_succ_pred … Hji1) >vlift_eq //
55   | >vlift_gt // >vlift_gt /2 width=1 by lt_minus_to_plus_r/ >vlift_gt /2 width=3 by le_to_lt_to_lt/
56   ]
57 ]
58 qed-.
59
60 lemma vlift_comp (M): ∀i. compatible_3 … (vlift M i) (sq M) (veq M) (veq M).
61 #m #i #d1 #d2 #Hd12 #lv1 #lv2 #HLv12 #j
62 elim (lt_or_eq_or_gt j i) #Hij destruct
63 [ >vlift_lt // >vlift_lt //
64 | >vlift_eq >vlift_eq //
65 | >vlift_gt // >vlift_gt //
66 ]
67 qed-.
68
69 (* Properies with term interpretation ***************************************) 
70
71 lemma ti_comp_l (M): is_model M →
72                      ∀T,gv,lv1,lv2. lv1 ≗{M} lv2 →
73                      ⟦T⟧[gv, lv1] ≗ ⟦T⟧[gv, lv2].
74 #M #HM #T elim T -T * [||| #p * | * ]
75 [ /4 width=3 by seq_trans, seq_sym, ms/
76 | /4 width=5 by seq_sym, ml, mr/
77 | /4 width=3 by seq_trans, seq_sym, mg/
78 | /5 width=5 by vlift_comp, seq_sym, md, mr/
79 | /5 width=1 by vlift_comp, mi, mq/
80 | /4 width=5 by seq_sym, ma, mc, mr/
81 | /4 width=5 by seq_sym, me, mr/
82 ]
83 qed.
84
85 lemma ti_ext_l (M): is_model M →
86                     ∀T,gv,lv1,lv2. lv1 ≐ lv2 →
87                     ⟦T⟧[gv, lv1] ≗{M} ⟦T⟧[gv, lv2].
88 /3 width=1 by ti_comp_l, ext_veq/ qed.