Commit ca162551 authored by Jacques-Henri Jourdan's avatar Jacques-Henri Jourdan
Browse files

Merge branch 'master' of gitlab.mpi-sws.org:FP/iris-coq

parents ee98243c 03fce0a3
From iris.base_logic Require Export base_logic.
From iris.algebra Require Import iprod gmap.
From iris.algebra Require cofe_solver.
Set Default Proof Using "Type*".
Set Default Proof Using "Type".
(** In this file we construct the type [iProp] of propositions of the Iris
logic. This is done by solving the following recursive domain equation:
......
From iris.base_logic.lib Require Export invariants.
From iris.algebra Require Export gmap gset coPset.
From iris.proofmode Require Import tactics.
Set Default Proof Using "Type*".
Set Default Proof Using "Type".
Import uPred.
(* Non-atomic ("thread-local") invariants. *)
......
From iris.prelude Require Export countable coPset.
From iris.algebra Require Export base.
Set Default Proof Using "Type*".
Set Default Proof Using "Type".
Definition namespace := list positive.
Instance namespace_eq_dec : EqDecision namespace := _.
......
......@@ -2,7 +2,7 @@ From iris.algebra Require Import iprod gmap.
From iris.base_logic Require Import big_op.
From iris.base_logic Require Export iprop.
From iris.proofmode Require Import classes.
Set Default Proof Using "Type*".
Set Default Proof Using "Type".
Import uPred.
(** The class [inG Σ A] expresses that the CMRA [A] is in the list of functors
......@@ -17,6 +17,36 @@ Arguments inG_id {_ _} _.
Lemma subG_inG Σ (F : gFunctor) : subG F Σ inG Σ (F (iPreProp Σ)).
Proof. move=> /(_ 0%fin) /= [j ->]. by exists j. Qed.
(** This tactic solves the usual obligations "subG ? Σ → {in,?}G ? Σ" *)
Ltac solve_inG :=
(* Get all assumptions *)
intros;
(* Unfold the top-level xΣ. We need to support this to be a function. *)
lazymatch goal with
| H : subG (?xΣ _ _ _ _) _ |- _ => try unfold xΣ in H
| H : subG (?xΣ _ _ _) _ |- _ => try unfold xΣ in H
| H : subG (?xΣ _ _) _ |- _ => try unfold xΣ in H
| H : subG (?xΣ _) _ |- _ => try unfold xΣ in H
| H : subG ?xΣ _ |- _ => try unfold xΣ in H
end;
(* Take apart subG for non-"atomic" lists *)
repeat match goal with
| H : subG (gFunctors.app _ _) _ |- _ => apply subG_inv in H; destruct H
end;
(* Try to turn singleton subG into inG; but also keep the subG for typeclass
resolution -- to keep them, we put them onto the goal. *)
repeat match goal with
| H : subG _ _ |- _ => move:(H); (apply subG_inG in H || clear H)
end;
(* Again get all assumptions *)
intros;
(* We support two kinds of goals: Things convertible to inG;
and records with inG and typeclass fields. Try to solve the
first case. *)
try done;
(* That didn't work, now we're in for the second case. *)
split; (assumption || by apply _).
(** * Definition of the connective [own] *)
Definition iRes_singleton `{i : inG Σ A} (γ : gname) (a : A) : iResUR Σ :=
iprod_singleton (inG_id i) {[ γ := cmra_transport inG_prf a ]}.
......
From iris.base_logic Require Export own.
From iris.algebra Require Import agree.
From iris.prelude Require Import gmap.
Set Default Proof Using "Type*".
Set Default Proof Using "Type".
Import uPred.
Class savedPropG (Σ : gFunctors) (F : cFunctor) :=
......@@ -10,7 +10,7 @@ Definition savedPropΣ (F : cFunctor) : gFunctors :=
#[ GFunctor (agreeRF ( F)) ].
Instance subG_savedPropΣ {Σ F} : subG (savedPropΣ F) Σ savedPropG Σ F.
Proof. apply subG_inG. Qed.
Proof. solve_inG. Qed.
Definition saved_prop_own `{savedPropG Σ F}
(γ : gname) (x : F (iProp Σ)) : iProp Σ :=
......
From iris.base_logic.lib Require Export invariants.
From iris.algebra Require Export sts.
From iris.proofmode Require Import tactics.
Set Default Proof Using "Type*".
Set Default Proof Using "Type".
Import uPred.
(** The CMRA we need. *)
......@@ -9,11 +9,11 @@ Class stsG Σ (sts : stsT) := StsG {
sts_inG :> inG Σ (stsR sts);
sts_inhabited :> Inhabited (sts.state sts);
}.
Definition stsΣ (sts : stsT) : gFunctors := #[ GFunctor (constRF (stsR sts)) ].
Definition stsΣ (sts : stsT) : gFunctors := #[ GFunctor (stsR sts) ].
Instance subG_stsΣ Σ sts :
subG (stsΣ sts) Σ Inhabited (sts.state sts) stsG Σ sts.
Proof. intros ?%subG_inG ?. by split. Qed.
Proof. solve_inG. Qed.
Section definitions.
Context `{stsG Σ sts} (γ : gname).
......
From iris.base_logic.lib Require Export invariants.
From iris.proofmode Require Import tactics.
Set Default Proof Using "Type*".
Set Default Proof Using "Type".
Definition vs `{invG Σ} (E1 E2 : coPset) (P Q : iProp Σ) : iProp Σ :=
( (P - |={E1,E2}=> Q))%I.
......
......@@ -3,7 +3,7 @@ From iris.prelude Require Export coPset.
From iris.algebra Require Import gmap auth agree gset coPset.
From iris.base_logic Require Import big_op.
From iris.proofmode Require Import tactics.
Set Default Proof Using "Type*".
Set Default Proof Using "Type".
Module invG.
Class invG (Σ : gFunctors) : Set := WsatG {
......
From iris.base_logic Require Export upred.
From iris.algebra Require Export updates.
Set Default Proof Using "Type*".
Set Default Proof Using "Type".
Local Hint Extern 1 (_ _) => etrans; [eassumption|].
Local Hint Extern 1 (_ _) => etrans; [|eassumption].
Local Hint Extern 10 (_ _) => omega.
......
From iris.base_logic Require Export base_logic.
Set Default Proof Using "Type*".
Set Default Proof Using "Type".
Import uPred.
Section adequacy.
......
From iris.prelude Require Import gmap.
From iris.base_logic Require Export base_logic big_op.
Set Default Proof Using "Type*".
Set Default Proof Using "Type".
Import uPred.
Module uPred_reflection. Section uPred_reflection.
......@@ -30,9 +30,9 @@ Module uPred_reflection. Section uPred_reflection.
rewrite /= ?right_id ?fmap_app ?big_sep_app ?IH1 ?IH2 //.
Qed.
Lemma flatten_entails Σ e1 e2 :
flatten e2 `contains` flatten e1 eval Σ e1 eval Σ e2.
flatten e2 + flatten e1 eval Σ e1 eval Σ e2.
Proof.
intros. rewrite !eval_flatten. by apply big_sep_contains, fmap_contains.
intros. rewrite !eval_flatten. by apply big_sep_submseteq, fmap_submseteq.
Qed.
Lemma flatten_equiv Σ e1 e2 :
flatten e2 flatten e1 eval Σ e1 eval Σ e2.
......
From iris.algebra Require Export cmra.
Set Default Proof Using "Type*".
Set Default Proof Using "Type".
(** The basic definition of the uPred type, its metric and functor laws.
You probably do not want to import this file. Instead, import
......
......@@ -3,7 +3,7 @@ From iris.heap_lang Require Export lifting.
From iris.algebra Require Import auth.
From iris.heap_lang Require Import proofmode notation.
From iris.proofmode Require Import tactics.
Set Default Proof Using "Type*".
Set Default Proof Using "Type".
Class heapPreG Σ := HeapPreG {
heap_preG_iris :> invPreG Σ;
......@@ -12,7 +12,7 @@ Class heapPreG Σ := HeapPreG {
Definition heapΣ : gFunctors := #[invΣ; gen_heapΣ loc val].
Instance subG_heapPreG {Σ} : subG heapΣ Σ heapPreG Σ.
Proof. intros [? ?]%subG_inv; split; apply _. Qed.
Proof. solve_inG. Qed.
Definition heap_adequacy Σ `{heapPreG Σ} e σ φ :
( `{heapG Σ}, True WP e {{ v, ⌜φ v }})
......
......@@ -2,7 +2,7 @@ From iris.program_logic Require Export ectx_language ectxi_language.
From iris.algebra Require Export ofe.
From iris.prelude Require Export strings.
From iris.prelude Require Import gmap.
Set Default Proof Using "Type*".
Set Default Proof Using "Type".
Module heap_lang.
Open Scope Z_scope.
......
......@@ -2,7 +2,7 @@ From iris.program_logic Require Export weakestpre.
From iris.heap_lang Require Export lang.
From iris.proofmode Require Import tactics.
From iris.heap_lang Require Import proofmode notation.
Set Default Proof Using "Type*".
Set Default Proof Using "Type".
Definition assert : val :=
λ: "v", if: "v" #() then #() else #0 #0. (* #0 #0 is unsafe *)
......
From iris.heap_lang Require Export notation.
Set Default Proof Using "Type*".
Set Default Proof Using "Type".
Definition newbarrier : val := λ: <>, ref #false.
Definition signal : val := λ: "x", "x" <- #true.
......
......@@ -5,10 +5,9 @@ From iris.prelude Require Import functions.
From iris.base_logic Require Import big_op lib.saved_prop lib.sts.
From iris.heap_lang Require Import proofmode.
From iris.heap_lang.lib.barrier Require Import protocol.
Set Default Proof Using "Type*".
Set Default Proof Using "Type".
(** The CMRAs/functors we need. *)
(* Not bundling heapG, as it may be shared with other users. *)
Class barrierG Σ := BarrierG {
barrier_stsG :> stsG Σ sts;
barrier_savedPropG :> savedPropG Σ idCF;
......@@ -16,7 +15,7 @@ Class barrierG Σ := BarrierG {
Definition barrierΣ : gFunctors := #[stsΣ sts; savedPropΣ idCF].
Instance subG_barrierΣ {Σ} : subG barrierΣ Σ barrierG Σ.
Proof. intros [? [? _]%subG_inv]%subG_inv. split; apply _. Qed.
Proof. solve_inG. Qed.
(** Now we come to the Iris part of the proof. *)
Section proof.
......
From iris.algebra Require Export sts.
From iris.base_logic Require Import lib.own.
From iris.prelude Require Export gmap.
Set Default Proof Using "Type*".
Set Default Proof Using "Type".
(** The STS describing the main barrier protocol. Every state has an index-set
associated with it. These indices are actually [gname], because we use them
......
......@@ -2,11 +2,12 @@ From iris.program_logic Require Export hoare.
From iris.heap_lang.lib.barrier Require Export barrier.
From iris.heap_lang.lib.barrier Require Import proof.
From iris.heap_lang Require Import proofmode.
Set Default Proof Using "Type*".
Set Default Proof Using "Type".
Import uPred.
Section spec.
Context `{!heapG Σ} `{!barrierG Σ}.
Set Default Proof Using "Type*".
Context `{!heapG Σ, !barrierG Σ}.
Lemma barrier_spec (N : namespace) :
recv send : loc iProp Σ -n> iProp Σ,
......
......@@ -4,7 +4,7 @@ From iris.heap_lang Require Export lang.
From iris.proofmode Require Import tactics.
From iris.algebra Require Import frac auth.
From iris.heap_lang Require Import proofmode notation.
Set Default Proof Using "Type*".
Set Default Proof Using "Type".
Definition newcounter : val := λ: <>, ref #0.
Definition incr : val := rec: "incr" "l" :=
......@@ -14,10 +14,10 @@ Definition read : val := λ: "l", !"l".
(** Monotone counter *)
Class mcounterG Σ := MCounterG { mcounter_inG :> inG Σ (authR mnatUR) }.
Definition mcounterΣ : gFunctors := #[GFunctor (constRF (authR mnatUR))].
Definition mcounterΣ : gFunctors := #[GFunctor (authR mnatUR)].
Instance subG_mcounterΣ {Σ} : subG mcounterΣ Σ mcounterG Σ.
Proof. intros [?%subG_inG _]%subG_inv. split; apply _. Qed.
Proof. solve_inG. Qed.
Section mono_proof.
Context `{!heapG Σ, !mcounterG Σ} (N : namespace).
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment