forked from cobbal/semantics-recursive-real-ppl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CIU.v
159 lines (140 loc) · 3.53 KB
/
CIU.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
Require Import Coq.Program.Program.
Require Import Coq.Program.Tactics.
Require Import Coq.Classes.Morphisms.
Require Import Coq.Reals.Reals.
Require Import Coquelicot.Rbar.
Require Import Coquelicot.Lim_seq.
Require Import Coq.fourier.Fourier.
Require Import Autosubst.Autosubst.
Require Import Coq.Logic.Classical.
Require Import Coq.Logic.ClassicalDescription.
Require Import Coq.Logic.ClassicalEpsilon.
Require Import Coq.Logic.ProofIrrelevance.
Require Import Coq.omega.Omega.
Require Import Init.Wf.
Require Import Biorthogonality.Basics.
Require Import Biorthogonality.Measures.
Require Import Biorthogonality.Syntax.
Require Import Biorthogonality.OpSem.
Require Import Biorthogonality.MeasSem.
Require Import Biorthogonality.LogRel.
Require Import Biorthogonality.Compatibility.
Set Bullet Behavior "Strict Subproofs".
Open Scope nat.
(* Definition 4.1 (part 1) {def-ciu} *)
Definition CIU (e1 e2 : Expr) :=
ECLOSED e1 /\
ECLOSED e2 /\
forall K A,
KCLOSED K ->
Rbar_le (μeval_star e1 K A) (μeval_star e2 K A).
(* Definition 4.2 (part 1) {def-ciu}.
Scoping results from use of CIU, see CIU_open_scope. *)
Definition CIU_open (Γ : Env) (e1 e2 : Expr) :=
forall γ,
SUBSCOPE Γ ⊢ γ ∷ 0 ->
CIU e1.[γ] e2.[γ].
Lemma CIU_closed : forall {e1 e2},
CIU e1 e2 ->
ECLOSED e1 /\ ECLOSED e2.
Proof.
intros.
unfold CIU in H.
intuition.
Qed.
Lemma CIU_closed_l : forall {e1 e2},
CIU e1 e2 ->
ECLOSED e1.
Proof.
intros.
apply CIU_closed in H.
intuition.
Qed.
Hint Resolve CIU_closed_l.
Lemma CIU_closed_r : forall {e1 e2},
CIU e1 e2 ->
ECLOSED e2.
Proof.
intros.
apply CIU_closed in H.
intuition.
Qed.
Hint Resolve CIU_closed_r.
Lemma CIU_open_scope : forall {Γ e1 e2},
CIU_open Γ e1 e2 ->
EXP Γ ⊢ e1 /\ EXP Γ ⊢ e2.
Proof.
intros.
unfold CIU_open in H.
split;
eapply sub_implies_scope_exp;
eauto 3.
Qed.
Lemma CIU_open_scope_l : forall {Γ e1 e2},
CIU_open Γ e1 e2 ->
EXP Γ ⊢ e1.
Proof.
intros.
apply CIU_open_scope in H.
intuition.
Qed.
Hint Resolve CIU_open_scope_l.
Lemma CIU_open_scope_r : forall {Γ e1 e2},
CIU_open Γ e1 e2 ->
EXP Γ ⊢ e2.
Proof.
intros.
apply CIU_open_scope in H.
intuition.
Qed.
Hint Resolve CIU_open_scope_r.
(* Lemma 4.2 {lemma-e-subset-ciu} *)
Lemma Erel_implies_CIU : forall {Γ e1 e2},
Erel_open Γ e1 e2 ->
CIU_open Γ e1 e2.
Proof.
intros.
unfold CIU_open; intros.
unfold CIU.
split; [|split].
- apply -> sub_preserves_scope_exp; eauto.
- apply -> sub_preserves_scope_exp; eauto.
- intros.
rewrite μeval_lim_interchange.
apply Sup_seq_bounded.
intros.
eapply H; eauto.
Qed.
(* Lemma 4.3 {lemma-exprel-absorbtive} *)
Lemma Erel_comp_CIU_implies_Erel : forall {Γ e1 e2 e3},
Erel_open Γ e1 e2 ->
CIU_open Γ e2 e3 ->
Erel_open Γ e1 e3.
Proof.
intros Γ e1 e2 e3 HErel HCIU.
unfold Erel_open, Erel, Erel'.
intros n γ1 γ2 HGrel.
inversion HGrel as [Hγ1 [Hγ2 _]].
split; [|split].
- apply -> sub_preserves_scope_exp; eauto 3.
- apply -> sub_preserves_scope_exp; eauto 3.
- intros.
eapply Rbar_le_trans.
+ eapply HErel; eauto.
+ eapply HCIU; eauto.
Qed.
(* Lemma 4.4 {lemma-ciu-subset-e} *)
Lemma CIU_implies_Erel : forall {Γ e1 e2},
CIU_open Γ e1 e2 ->
Erel_open Γ e1 e2.
Proof.
intros.
eapply Erel_comp_CIU_implies_Erel; eauto.
Qed.
(* Theorem 4.5 {thm-cu-euqals-e} *)
Theorem CIU_iff_Erel : forall {Γ e1 e2},
CIU_open Γ e1 e2 <->
Erel_open Γ e1 e2.
Proof.
intuition (auto using CIU_implies_Erel, Erel_implies_CIU).
Qed.