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_vpush.ma".
17 (* MODEL ********************************************************************)
19 record is_model (M): Prop ≝ {
20 (* Note: equivalence: reflexivity *)
21 mr: reflexive … (sq M);
22 (* Note: equivalence: compatibility *)
23 mq: replace_2 … (sq M) (sq M) (sq M);
24 (* Note: conjunction: compatibility *)
25 mc: ∀p. compatible_3 … (co M p) (sq M) (sq M) (sq M);
26 (* Note: application: compatibility *)
27 mp: compatible_3 … (ap M) (sq M) (sq M) (sq M);
28 (* Note: interpretation: sort *)
29 ms: ∀gv,lv,s. ⟦⋆s⟧{M}[gv,lv] ≗ sv M s;
30 (* Note: interpretation: local reference *)
31 ml: ∀gv,lv,i. ⟦#i⟧{M}[gv,lv] ≗ lv i;
32 (* Note: interpretation: global reference *)
33 mg: ∀gv,lv,l. ⟦§l⟧{M}[gv,lv] ≗ gv l;
34 (* Note: interpretation: intensional binder *)
35 mi: ∀p,gv1,gv2,lv1,lv2,W,T. ⟦W⟧{M}[gv1,lv1] ≗ ⟦W⟧{M}[gv2,lv2] →
36 (∀d. ⟦T⟧{M}[gv1,⫯[0←d]lv1] ≗ ⟦T⟧{M}[gv2,⫯[0←d]lv2]) →
37 ⟦ⓛ[p]W.T⟧[gv1,lv1] ≗ ⟦ⓛ[p]W.T⟧[gv2,lv2];
38 (* Note: interpretation: abbreviation *)
39 md: ∀p,gv,lv,V,T. ⟦ⓓ[p]V.T⟧{M}[gv,lv] ≗ ⟦V⟧[gv,lv] ⊕[p] ⟦T⟧[gv,⫯[0←⟦V⟧[gv,lv]]lv];
40 (* Note: interpretation: application *)
41 ma: ∀gv,lv,V,T. ⟦ⓐV.T⟧{M}[gv,lv] ≗ ⟦V⟧[gv,lv] @ ⟦T⟧[gv,lv];
42 (* Note: interpretation: ζ-equivalence *)
43 mz: ∀d1,d2. d1 ⊕{M}[Ⓣ] d2 ≗ d2;
44 (* Note: interpretation: ϵ-equivalence *)
45 me: ∀gv,lv,W,T. ⟦ⓝW.T⟧{M}[gv,lv] ≗ ⟦T⟧[gv,lv];
46 (* Note: interpretation: β-requivalence *)
47 mb: ∀p,gv,lv,d,W,T. d @ ⟦ⓛ[p]W.T⟧{M}[gv,lv] ≗ d ⊕[p] ⟦T⟧[gv,⫯[0←d]lv];
48 (* Note: interpretation: θ-requivalence *)
49 mh: ∀p,d1,d2,d3. d1 @ (d2 ⊕{M}[p] d3) ≗ d2 ⊕[p] (d1 @ d3)
52 record is_extensional (M): Prop ≝ {
53 (* Note: interpretation: extensional abstraction *)
54 mx: ∀p,gv1,gv2,lv1,lv2,W1,W2,T1,T2. ⟦W1⟧{M}[gv1,lv1] ≗ ⟦W2⟧{M}[gv2,lv2] →
55 (∀d. ⟦T1⟧{M}[gv1,⫯[0←d]lv1] ≗ ⟦T2⟧{M}[gv2,⫯[0←d]lv2]) →
56 ⟦ⓛ[p]W1.T1⟧[gv1,lv1] ≗ ⟦ⓛ[p]W2.T2⟧[gv2,lv2]
59 record is_injective (M): Prop ≝ {
60 (* Note: conjunction: injectivity *)
61 mj: ∀d1,d3,d2,d4. d1 ⊕[Ⓕ] d2 ≗{M} d3 ⊕[Ⓕ] d4 → d2 ≗ d4
64 (* Basic properties *********************************************************)
66 lemma seq_sym (M): is_model M → symmetric … (sq M).
67 /3 width=5 by mq, mr/ qed-.
69 lemma seq_trans (M): is_model M → Transitive … (sq M).
70 /3 width=5 by mq, mr/ qed-.
72 lemma seq_canc_sn (M): is_model M → left_cancellable … (sq M).
73 /3 width=3 by seq_trans, seq_sym/ qed-.
75 lemma seq_canc_dx (M): is_model M → right_cancellable … (sq M).
76 /3 width=3 by seq_trans, seq_sym/ qed-.
78 lemma co_inv_dx (M): is_model M → is_injective M →
79 ∀p,d1,d3,d2,d4. d1⊕[p]d2 ≗{M} d3⊕[p]d4 → d2 ≗ d4.
80 #M #H1M #H2M * #d1 #d3 #d2 #d4 #Hd
81 /3 width=5 by mj, mz, mq/
84 lemma ti_lref_vpush_eq (M): is_model M →
85 ∀gv,lv,d,i. ⟦#i⟧[gv,⫯[i←d]lv] ≗{M} d.
87 @(seq_trans … HM) [2: @ml // | skip ]
88 >vpush_eq /2 width=1 by mr/
91 lemma ti_lref_vpush_gt (M): is_model M →
92 ∀gv,lv,d,i. ⟦#(↑i)⟧[gv,⫯[0←d]lv] ≗{M} ⟦#i⟧[gv,lv].
94 @(mq … HM) [4,5: @(seq_sym … HM) /2 width=2 by ml/ |1,2: skip ]
95 >vpush_gt /2 width=1 by mr/
98 (* Basic Forward lemmas *****************************************************)
100 lemma ti_fwd_mx_dx (M): is_model M → is_injective M →
101 ∀p,gv1,gv2,lv1,lv2,W1,W2,T1,T2.
102 ⟦ⓛ[p]W1.T1⟧[gv1,lv1] ≗ ⟦ⓛ[p]W2.T2⟧[gv2,lv2] →
103 ∀d. ⟦T1⟧{M}[gv1,⫯[0←d]lv1] ≗ ⟦T2⟧{M}[gv2,⫯[0←d]lv2].
104 #M #H1M #H2M #p #gv1 #gv2 #lv1 #lv2 #W1 #W2 #T1 #T2 #H12 #d
106 /4 width=5 by mb, mp, mq, mr/
109 lemma ti_fwd_abbr_dx (M): is_model M → is_injective M →
110 ∀p,gv1,gv2,lv1,lv2,V1,V2,T1,T2.
111 ⟦ⓓ[p]V1.T1⟧[gv1,lv1] ≗ ⟦ⓓ[p]V2.T2⟧[gv2,lv2] →
112 ⟦T1⟧{M}[gv1,⫯[0←⟦V1⟧[gv1,lv1]]lv1] ≗ ⟦T2⟧{M}[gv2,⫯[0←⟦V2⟧[gv2,lv2]]lv2].
113 #M #H1M #H2M #p #gv1 #gv2 #lv1 #lv2 #V1 #V2 #T1 #T2 #H12
114 @(co_inv_dx … p (⟦V1⟧[gv1,lv1]) (⟦V2⟧[gv2,lv2]))
115 /3 width=5 by md, mq/