Skip to content

Commit 5562479

Browse files
committed
Further cleanup
1 parent e598d8a commit 5562479

File tree

5 files changed

+111
-110
lines changed

5 files changed

+111
-110
lines changed

theories/bunch_decomp.v

Lines changed: 43 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,23 @@ Lemma bunch_decomp_complete Δ Π Δ' :
5050
bunch_decomp Δ Π Δ'.
5151
Proof. intros <-. apply bunch_decomp_complete'. Qed.
5252

53+
Lemma bunch_decomp_iff Δ Π Δ' :
54+
(fill Π Δ' = Δ) ↔ bunch_decomp Δ Π Δ'.
55+
Proof.
56+
split.
57+
- apply bunch_decomp_complete.
58+
- by symmetry; apply bunch_decomp_correct.
59+
Qed.
60+
61+
(** * Properties of bunched contexts *)
62+
(** We prove several useful properties using the inductive system defined above. *)
63+
5364
Lemma fill_is_frml Π Δ ϕ :
5465
fill Π Δ = frml ϕ →
5566
Π = [] ∧ Δ = frml ϕ.
5667
Proof.
57-
revert Δ. induction Π as [| F C IH]=>Δ; first by eauto.
58-
destruct F ; simpl ; intros H1 ;
59-
destruct (IH _ H1) as [HC HΔ] ; by simplify_eq/=.
68+
intros H%bunch_decomp_iff.
69+
inversion H; eauto.
6070
Qed.
6171

6272
Lemma bunch_decomp_app C C0 Δ Δ0 :
@@ -72,72 +82,70 @@ Proof.
7282
apply IHC. destruct F; simpl; by econstructor.
7383
Qed.
7484

75-
Lemma bunch_decomp_ctx C C' Δ ϕ :
76-
bunch_decomp (fill C Δ) C' (frml ϕ) →
77-
((∃ C0, bunch_decomp Δ C0 (frml ϕ) ∧ C' = C0 ++ C) ∨
78-
(∃ (C0 C1 : bunch → bunch_ctx),
79-
(∀ Δ Δ', fill (C0 Δ) Δ' = fill (C1 Δ') Δ) ∧
80-
(∀ Δ', fill (C1 Δ') Δ = fill C' Δ') ∧
81-
(∀ A, bunch_decomp (fill C A) (C0 A) (frml ϕ)))).
85+
Lemma bunch_decomp_ctx Π Π' Δ ϕ :
86+
bunch_decomp (fill Π Δ) Π' (frml ϕ) →
87+
((∃ Π0, bunch_decomp Δ Π0 (frml ϕ) ∧ Π' = Π0 ++ Π) ∨
88+
(∃ (Π0 Π1 : bunch → bunch_ctx),
89+
(∀ Δ Δ', fill (Π0 Δ) Δ' = fill (Π1 Δ') Δ) ∧
90+
(∀ Δ', fill (Π1 Δ') Δ = fill Π' Δ') ∧
91+
(∀ A, bunch_decomp (fill Π A) (Π0 A) (frml ϕ)))).
8292
Proof.
83-
revert Δ C'.
84-
induction C as [|F C]=>Δ C'; simpl.
93+
revert Δ Π'.
94+
induction Π as [|F Π]=>Δ Π'; simpl.
8595
{ remember (frml ϕ) as Γ1. intros Hdec.
8696
left. eexists. rewrite right_id. split; done. }
8797
simpl. intros Hdec.
88-
destruct (IHC _ _ Hdec) as [IH|IH].
89-
- destruct IH as [C0 [HC0 HC]].
98+
destruct (IHΠ _ _ Hdec) as [IH|IH].
99+
- destruct IH as [Π0 [HΠ0 HΠ]].
90100
destruct F; simpl in *.
91-
+ inversion HC0; simplify_eq/=.
101+
+ inversion HΠ0; simplify_eq/=.
92102
* left. eexists; split; eauto.
93103
rewrite -assoc //.
94104
* right.
95-
exists (λ A, (Π ++ [CtxCommaR A]) ++ C).
96-
exists (λ A, ([CtxCommaL (fill Π A)] ++ C)).
105+
exists (λ A, (Π1 ++ [CtxCommaR A]) ++ Π).
106+
exists (λ A, ([CtxCommaL (fill Π1 A)] ++ Π)).
97107
repeat split.
98-
{ intros A B. by rewrite /= -!assoc /= !fill_app. }
99-
{ intros A. by rewrite /= -!assoc /= !fill_app. }
108+
{ intros A B. by rewrite /= -!assoc /= !fill_app /=. }
109+
{ intros A. by rewrite /= -!assoc /= !fill_app /=. }
100110
{ intros A. apply bunch_decomp_app. by econstructor. }
101-
+ inversion HC0; simplify_eq/=.
111+
+ inversion HΠ0; simplify_eq/=.
102112
* right.
103-
exists (λ A, (Π ++ [CtxCommaL A]) ++ C).
104-
exists (λ A, ([CtxCommaR (fill Π A)] ++ C)).
113+
exists (λ A, (Π1 ++ [CtxCommaL A]) ++ Π).
114+
exists (λ A, ([CtxCommaR (fill Π1 A)] ++ Π)).
105115
repeat split.
106116
{ intros A B. by rewrite /= -!assoc /= !fill_app. }
107117
{ intros A. by rewrite /= -!assoc /= !fill_app. }
108118
{ intros A. apply bunch_decomp_app. by econstructor. }
109119
* left. eexists; split; eauto.
110120
rewrite -assoc //.
111-
+ inversion HC0; simplify_eq/=.
121+
+ inversion HΠ0; simplify_eq/=.
112122
* left. eexists; split; eauto.
113123
rewrite -assoc //.
114124
* right.
115-
exists (λ A, (Π ++ [CtxSemicR A]) ++ C).
116-
exists (λ A, ([CtxSemicL (fill Π A)] ++ C)).
125+
exists (λ A, (Π1 ++ [CtxSemicR A]) ++ Π).
126+
exists (λ A, ([CtxSemicL (fill Π1 A)] ++ Π)).
117127
repeat split.
118128
{ intros A B. by rewrite /= -!assoc /= !fill_app. }
119129
{ intros A. by rewrite /= -!assoc /= !fill_app. }
120130
{ intros A. apply bunch_decomp_app. by econstructor. }
121-
+ inversion HC0; simplify_eq/=.
131+
+ inversion HΠ0; simplify_eq/=.
122132
* right.
123-
exists (λ A, (Π ++ [CtxSemicL A]) ++ C).
124-
exists (λ A, ([CtxSemicR (fill Π A)] ++ C)).
133+
exists (λ A, (Π1 ++ [CtxSemicL A]) ++ Π).
134+
exists (λ A, ([CtxSemicR (fill Π1 A)] ++ Π)).
125135
repeat split.
126136
{ intros A B. by rewrite /= -!assoc /= !fill_app. }
127137
{ intros A. by rewrite /= -!assoc /= !fill_app. }
128138
{ intros A. apply bunch_decomp_app. by econstructor. }
129139
* left. eexists; split; eauto.
130140
rewrite -assoc //.
131141
- right.
132-
destruct IH as (C0 & C1 & HC0 & HC1 & HC).
133-
exists (λ A, C0 (fill_item F A)), (λ A, F::C1 A). repeat split.
134-
{ intros A B. simpl. rewrite -HC0 //. }
135-
{ intros B. rewrite -HC1 //. }
136-
intros A. apply HC.
142+
destruct IH as (Π0 & Π1 & HΠ0 & HΠ1 & ).
143+
exists (λ A, Π0 (fill_item F A)), (λ A, F::Π1 A). repeat split.
144+
{ intros A B. simpl. rewrite -HΠ0 //. }
145+
{ intros B. rewrite -HΠ1 //. }
146+
intros A. apply .
137147
Qed.
138148

139-
140-
(* facts about terms *)
141149
Lemma bterm_ctx_act_decomp `{!EqDecision V, !Countable V} (T : bterm V)
142150
(Δs : V → bunch) ϕ Π :
143151
linear_bterm T →

theories/cutelim.v

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,7 @@ Proof.
206206
by apply (HXY _).
207207
Qed.
208208

209-
Program Definition C_impl (X Y : C) := {| CPred := PB_impl' X Y |}.
210-
211-
Lemma is_heyting_impl (X Y Z : C) :
209+
Lemma has_heyting_impl (X Y Z : C) :
212210
((X : PB) ⊢@{PB_alg} (PB_impl' Y Z : PB)) ↔
213211
((X : PB) ∧ (Y : PB) ⊢@{PB_alg} (Z : PB))%I.
214212
Proof.
@@ -223,6 +221,8 @@ Proof.
223221
eexists _,_. split; eauto.
224222
Qed.
225223

224+
Program Definition C_impl (X Y : C) := {| CPred := PB_impl' X Y |}.
225+
226226
Program Definition C_alg : bi :=
227227
C_alg bunch comma formula Fint C_impl _ _ _ .
228228
Next Obligation.
@@ -232,15 +232,15 @@ Next Obligation.
232232
- intros Δ. simpl. intros H1 Δ' HX'.
233233
apply HY. apply H1. apply HX. apply HX'.
234234
Qed.
235-
Next Obligation. apply is_heyting_impl. Qed.
235+
Next Obligation. apply has_heyting_impl. Qed.
236236

237237
(** * Interpretation in [C] and Okada's lemma *)
238238
Definition C_atom (a : atom) := Fint' (ATOM a).
239239

240240
Definition inner_interp : formula → C := @formula_interp C_alg C_atom.
241241

242242
(** We verify the Okada's property *)
243-
Lemma okada (A : formula) :
243+
Lemma okada_property (A : formula) :
244244
(frml A ∈ inner_interp A)
245245
∧ (inner_interp A ⊢@{C_alg} Fint' A).
246246
Proof.
@@ -454,6 +454,19 @@ Proof.
454454
by f_equiv.
455455
Qed.
456456

457+
Lemma blinterm_C_desc' `{!EqDecision V, !Countable V}
458+
(T : bterm V) (TL : linear_bterm T)
459+
(Xs : V → C_alg) :
460+
bterm_alg_act (PROP:=C_alg) T Xs ≡ C_blinterm_interp T Xs.
461+
Proof.
462+
apply bi.equiv_entails. split.
463+
- by apply blinterm_C_desc.
464+
- apply cl_adj; first apply _.
465+
intros Δ. simpl.
466+
destruct 1 as [Δs [Hd ->]].
467+
by apply bterm_C_refl.
468+
Qed.
469+
457470
(** All the simple structural rules are valid in [C] *)
458471
Lemma C_extensions (Ts : list (bterm nat)) (T : bterm nat) :
459472
(Ts, T) ∈ M.rules → rule_valid C_alg Ts T.
@@ -493,11 +506,11 @@ Proof.
493506
(bunch_interp C_atom (fill Γ (frml ψ)) ⊢@{C_alg} formula_interp C_atom ϕ) in H2.
494507
cut (@seq_interp C_alg C_atom (fill Γ Δ) ϕ).
495508
{ simpl. intros H3.
496-
destruct (okada ϕ) as [Hϕ1 Hϕ2].
509+
destruct (okada_property ϕ) as [Hϕ1 Hϕ2].
497510
apply (Hϕ2 _). unfold inner_interp.
498511
apply H3. apply (C_collapse_inv _ [] (fill Γ Δ)). simpl.
499512
apply (bunch_interp_collapse C_alg C_atom).
500-
apply okada. }
513+
apply okada_property. }
501514
simpl. rewrite -H2.
502515
apply bunch_interp_fill_mono, H1.
503516
Qed.

theories/cutelim_s4.v

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
From Coq Require Import ssreflect.
33
From stdpp Require Import prelude.
44
From bunched.algebra Require Import bi.
5-
From bunched Require Import seqcalc_s4 seqcalc_height_s4 interp_s4.
5+
From bunched Require Import seqcalc_height_s4 seqcalc_s4 interp_s4.
66

77
(** The first algebra that we consider is a purely "combinatorial" one:
88
predicates [(bunch/≡) → Prop] *)
@@ -284,7 +284,7 @@ Module Cl.
284284
Proof.
285285
destruct X as [X Xcl]. simpl.
286286
intros HX. rewrite Xcl.
287-
intros ϕ Hϕ. eapply (Inversion.Box_L []).
287+
intros ϕ Hϕ. eapply (box_l_inv []).
288288
by apply Hϕ.
289289
Qed.
290290

@@ -334,7 +334,7 @@ Module Cl.
334334
Proof.
335335
destruct X as [X Xcl]. simpl.
336336
rewrite !Xcl. intros HX ϕ Hϕ.
337-
simpl in HX. apply Inversion.Collapse_L.
337+
simpl in HX. apply collapse_l_inv.
338338
by apply HX.
339339
Qed.
340340

@@ -416,8 +416,8 @@ Module Cl.
416416
destruct Y as [Y Yc]. simpl.
417417
rewrite Yc. intros ψ Hψ.
418418
specialize (H ((Δ' ↾ HX), (ψ ↾ Hψ))). simpl in *.
419-
apply Inversion.Impl_R in H.
420-
by apply (Inversion.Collapse_L [CtxSemicR Δ]).
419+
apply impl_r_inv in H.
420+
by apply (collapse_l_inv [CtxSemicR Δ]).
421421
Qed.
422422

423423
Definition C_emp : C := cl' PB_emp.
@@ -447,8 +447,8 @@ Module Cl.
447447
destruct Y as [Y Yc]. simpl.
448448
rewrite Yc. intros ψ Hψ.
449449
specialize (H ((Δ' ↾ HX), (ψ ↾ Hψ))). simpl in *.
450-
apply Inversion.Wand_R in H.
451-
by apply (Inversion.Collapse_L [CtxCommaR Δ]).
450+
apply wand_r_inv in H.
451+
by apply (collapse_l_inv [CtxCommaR Δ]).
452452
Qed.
453453

454454
Program Definition PB_box (X: PB) : PB :=
@@ -605,8 +605,8 @@ Module Cl.
605605
intros Δ.
606606
destruct 1 as (Δ' & HD & HX).
607607
simpl. intros D1 H1 f Hf. rewrite HD.
608-
rewrite comm. apply (Inversion.Collapse_L [CtxSemicR D1]). simpl.
609-
apply Inversion.Impl_R. apply H1.
608+
rewrite comm. apply (collapse_l_inv [CtxSemicR D1]). simpl.
609+
apply impl_r_inv. apply H1.
610610
intros D2. destruct 1 as (D2' & HD2 & HY). simpl.
611611
apply BI_Impl_R.
612612
apply (C_collapse (Fint' f) [CtxSemicR D2]). simpl.
@@ -721,15 +721,6 @@ Module Cl.
721721
+ intros HX1 Δ2 HD2.
722722
apply HY, HX1.
723723
by apply HX.
724-
(* - intros X1 X2 HX; try apply _. *)
725-
(* apply discrete_iff. *)
726-
(* { apply _. } *)
727-
(* intros Δ. apply cl_proper. *)
728-
(* apply (@bi.pure_proper PB_alg). split. *)
729-
(* { intros H1 Δ' H2. apply HX. *)
730-
(* apply H1, H2. } *)
731-
(* { intros H1 Δ' H2. apply HX. *)
732-
(* apply H1, H2. } *)
733724
- intros ψ X Hψ Δ. simpl.
734725
intros HX ϕ Hs. apply Hs.
735726
done.
@@ -783,7 +774,7 @@ Definition C_atom (a : atom) := Fint' (ATOM a).
783774
Definition inner_interp : formula → C
784775
:= formula_interp C_alg C_box C_atom.
785776

786-
Lemma pas_de_deux (A : formula) :
777+
Lemma okada_property (A : formula) :
787778
((inner_interp A) (frml A)) ∧ (inner_interp A ⊢@{C_alg} Fint' A).
788779
Proof.
789780
induction A; simpl.
@@ -887,15 +878,15 @@ Proof.
887878
simpl in H1, H2.
888879
cut (seq_interp C_alg C_box C_atom (fill Γ Δ) ϕ).
889880
{ simpl. intros H3.
890-
destruct (pas_de_deux ϕ) as [Hϕ1 Hϕ2].
881+
destruct (okada_property ϕ) as [Hϕ1 Hϕ2].
891882
apply Hϕ2. unfold inner_interp.
892883
apply H3. apply (C_collapse_inv _ [] (fill Γ Δ)). simpl.
893884
cut (formula_interp C_alg C_box C_atom (collapse (fill Γ Δ)) (frml (collapse (fill Γ Δ)))).
894885
{ apply (bunch_interp_collapse C_alg C_box C_atom). }
895-
apply pas_de_deux. }
886+
apply okada_property. }
896887
simpl. rewrite -H2.
897888
apply bunch_interp_fill_mono, H1.
898889
Qed.
899890

900-
Print Assumptions cut.
891+
(* Print Assumptions cut. *)
901892
(* ==> Closed under the global context *)

0 commit comments

Comments
 (0)