Skip to content
Snippets Groups Projects
Commit 12aa1f34 authored by Jonas Kastberg's avatar Jonas Kastberg
Browse files

Merge branch 'daniel/plainly' into 'master'

Plainly

See merge request iris/actris!10
parents 76e4661d 7b1bbf2b
No related branches found
No related tags found
No related merge requests found
...@@ -23,25 +23,35 @@ Section copying. ...@@ -23,25 +23,35 @@ Section copying.
copy A <: A. copy A <: A.
Proof. by iIntros (v) "!> #H". Qed. Proof. by iIntros (v) "!> #H". Qed.
(* TODO(COPY): have A <: copy- A rule *)
(* TODO(COPY): Show derived rules about copyability of products, sums, etc. *) (* TODO(COPY): Show derived rules about copyability of products, sums, etc. *)
(* TODO(COPY): Commuting rule for μ, allowing `copy` to move outside the μ *) (* TODO(COPY): Commuting rule for μ, allowing `copy` to move outside the μ *)
(* TODO(COPY) *) Lemma lty_le_copy_minus_copy A :
Lemma coreP_desired_lemma (P : iProp Σ) : copy- (copy A) <: A.
(P -∗ P) -∗ coreP P -∗ P.
Proof. Proof.
iIntros "HP Hcore". iIntros (v) "!> #Hv".
Admitted. iDestruct (coreP_elim with "Hv") as "Hw".
iApply "Hw".
Qed.
Lemma lty_le_copy_minus A : Lemma lty_le_copy_minus A :
copyable A -∗ copy- A <: A. A <: copy- A.
Proof. iIntros "!>" (v). iApply coreP_intro. Qed.
(* TODO: Wait for this to be merged into Iris and then bump Iris version *)
Lemma actris_coreP_wand (P Q : iProp Σ) : <affine> (P -∗ Q) -∗ coreP P -∗ coreP Q.
Proof.
rewrite /coreP. iIntros "#HPQ HP" (R) "#HR #HQR". iApply ("HP" with "HR").
iIntros "!> !> HP". iApply "HQR". by iApply "HPQ".
Qed.
Lemma lty_copy_minus_mono A B :
A <: B -∗ copy- A <: copy- B.
Proof. Proof.
iIntros "#HA". iIntros (v) "!> #Hv". iIntros "#Hsub !>" (v) "#HA".
iSpecialize ("HA" $! v). iApply (actris_coreP_wand (A v)).
iApply coreP_desired_lemma. - iModIntro. iClear "HA". iModIntro. iApply "Hsub".
- iModIntro. iApply "HA". - iApply "HA".
- iApply "Hv".
Qed. Qed.
(* Copyability of types *) (* Copyability of types *)
...@@ -111,7 +121,7 @@ Section copying. ...@@ -111,7 +121,7 @@ Section copying.
(* Copyability of recursive types *) (* Copyability of recursive types *)
Lemma lty_rec_copy C `{!Contractive C} : Lemma lty_rec_copy C `{!Contractive C} :
( A, copyable A -∗ copyable (C A)) -∗ copyable (lty_rec C). ( A, copyable A -∗ copyable (C A)) -∗ copyable (lty_rec C).
Proof. Proof.
iIntros "#Hcopy". iIntros "#Hcopy".
iLöb as "IH". iLöb as "IH".
...@@ -150,7 +160,7 @@ Section copying. ...@@ -150,7 +160,7 @@ Section copying.
Qed. Qed.
Definition env_copy (Γ Γ' : gmap string (lty Σ)) : iProp Σ := Definition env_copy (Γ Γ' : gmap string (lty Σ)) : iProp Σ :=
vs, env_ltyped Γ vs -∗ env_ltyped Γ' vs. ( vs, env_ltyped Γ vs -∗ env_ltyped Γ' vs)%I.
Lemma env_copy_empty : env_copy ∅. Lemma env_copy_empty : env_copy ∅.
Proof. iIntros (vs) "!> _ !> ". by rewrite /env_ltyped. Qed. Proof. iIntros (vs) "!> _ !> ". by rewrite /env_ltyped. Qed.
......
...@@ -99,7 +99,7 @@ Section Environment. ...@@ -99,7 +99,7 @@ Section Environment.
Qed. Qed.
Definition env_split (Γ Γ1 Γ2 : gmap string (lty Σ)) : iProp Σ := Definition env_split (Γ Γ1 Γ2 : gmap string (lty Σ)) : iProp Σ :=
vs, env_ltyped Γ vs ∗-∗ (env_ltyped Γ1 vs env_ltyped Γ2 vs). ( vs, env_ltyped Γ vs ∗-∗ (env_ltyped Γ1 vs env_ltyped Γ2 vs))%I.
Lemma env_split_id_l Γ : env_split Γ Γ. Lemma env_split_id_l Γ : env_split Γ Γ.
Proof. Proof.
...@@ -161,8 +161,8 @@ End Environment. ...@@ -161,8 +161,8 @@ End Environment.
(* The semantic typing judgement *) (* The semantic typing judgement *)
Definition ltyped `{!heapG Σ} Definition ltyped `{!heapG Σ}
(Γ Γ' : gmap string (lty Σ)) (e : expr) (A : lty Σ) : iProp Σ := (Γ Γ' : gmap string (lty Σ)) (e : expr) (A : lty Σ) : iProp Σ :=
vs, env_ltyped Γ vs -∗ ( vs, env_ltyped Γ vs -∗
WP subst_map vs e {{ v, A v env_ltyped Γ' vs }}. WP subst_map vs e {{ v, A v env_ltyped Γ' vs }})%I.
Notation "Γ ⊨ e : A ⫤ Γ'" := (ltyped Γ Γ' e A) Notation "Γ ⊨ e : A ⫤ Γ'" := (ltyped Γ Γ' e A)
(at level 100, e at next level, A at level 200). (at level 100, e at next level, A at level 200).
......
...@@ -5,7 +5,7 @@ From iris.proofmode Require Import tactics. ...@@ -5,7 +5,7 @@ From iris.proofmode Require Import tactics.
From iris.heap_lang Require Import proofmode. From iris.heap_lang Require Import proofmode.
Definition lty_le {Σ} (A1 A2 : lty Σ) : iProp Σ := Definition lty_le {Σ} (A1 A2 : lty Σ) : iProp Σ :=
v, A1 v -∗ A2 v. ( v, A1 v -∗ A2 v)%I.
Arguments lty_le {_} _%lty _%lty. Arguments lty_le {_} _%lty _%lty.
Infix "<:" := lty_le (at level 70). Infix "<:" := lty_le (at level 70).
Instance: Params (@lty_le) 1 := {}. Instance: Params (@lty_le) 1 := {}.
...@@ -25,7 +25,7 @@ Instance lty_bi_le_proper {Σ} : Proper ((≡) ==> (≡) ==> (≡)) (@lty_bi_le ...@@ -25,7 +25,7 @@ Instance lty_bi_le_proper {Σ} : Proper ((≡) ==> (≡) ==> (≡)) (@lty_bi_le
Proof. solve_proper. Qed. Proof. solve_proper. Qed.
Definition lsty_le {Σ} (P1 P2 : lsty Σ) : iProp Σ := Definition lsty_le {Σ} (P1 P2 : lsty Σ) : iProp Σ :=
iProto_le P1 P2. ( iProto_le P1 P2)%I.
Arguments lsty_le {_} _%lsty _%lsty. Arguments lsty_le {_} _%lsty _%lsty.
Infix "<s:" := lsty_le (at level 70). Infix "<s:" := lsty_le (at level 70).
Instance: Params (@lsty_le) 1 := {}. Instance: Params (@lsty_le) 1 := {}.
...@@ -137,7 +137,7 @@ Section subtype. ...@@ -137,7 +137,7 @@ Section subtype.
Qed. Qed.
Lemma lty_le_rec `{Contractive C1, Contractive C2} : Lemma lty_le_rec `{Contractive C1, Contractive C2} :
( A B, (A <: B) -∗ C1 A <: C2 B) -∗ ( A B, (A <: B) -∗ C1 A <: C2 B) -∗
lty_rec C1 <: lty_rec C2. lty_rec C1 <: lty_rec C2.
Proof. Proof.
iIntros "#Hle". iIntros "#Hle".
...@@ -196,7 +196,8 @@ Section subtype. ...@@ -196,7 +196,8 @@ Section subtype.
Qed. Qed.
Lemma lsty_le_refl (S : lsty Σ) : S <s: S. Lemma lsty_le_refl (S : lsty Σ) : S <s: S.
Proof. iApply iProto_le_refl. Qed. Proof. iModIntro. iApply iProto_le_refl. Qed.
Lemma lsty_le_trans S1 S2 S3 : S1 <s: S2 -∗ S2 <s: S3 -∗ S1 <s: S3. Lemma lsty_le_trans S1 S2 S3 : S1 <s: S2 -∗ S2 <s: S3 -∗ S1 <s: S3.
Proof. iIntros "#H1 #H2 !>". by iApply iProto_le_trans. Qed. Proof. iIntros "#H1 #H2 !>". by iApply iProto_le_trans. Qed.
...@@ -462,11 +463,11 @@ Section subtype. ...@@ -462,11 +463,11 @@ Section subtype.
Qed. Qed.
Lemma lsty_le_rec `{Contractive C1, Contractive C2} : Lemma lsty_le_rec `{Contractive C1, Contractive C2} :
( S S', (S <s: S') -∗ C1 S <s: C2 S') -∗ ( S S', (S <s: S') -∗ C1 S <s: C2 S') -∗
lsty_rec C1 <s: lsty_rec C2. lsty_rec C1 <s: lsty_rec C2.
Proof. Proof.
iIntros "#Hle !>". iIntros "#Hle".
iLöb as "IH". iLöb as "IH". iModIntro.
rewrite /lsty_rec. rewrite /lsty_rec.
iEval (rewrite fixpoint_unfold). iEval (rewrite fixpoint_unfold).
iEval (rewrite (fixpoint_unfold (lsty_rec1 C2))). iEval (rewrite (fixpoint_unfold (lsty_rec1 C2))).
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment