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.heap_lang Require Export lifting notation.
From iris.base_logic.lib Require Export invariants.
Set Default Proof Using "Type*".
Set Default Proof Using "Type".
Structure lock Σ `{!heapG Σ} := Lock {
(* -- operations -- *)
......
From iris.heap_lang Require Export spawn.
From iris.heap_lang Require Import proofmode notation.
Set Default Proof Using "Type*".
Set Default Proof Using "Type".
Import uPred.
Definition parN : namespace := nroot .@ "par".
......@@ -14,6 +14,7 @@ Definition par : val :=
Notation "e1 ||| e2" := (par (Pair (λ: <>, e1) (λ: <>, e2)))%E : expr_scope.
Section proof.
Set Default Proof Using "Type*".
Context `{!heapG Σ, !spawnG Σ}.
(* Notice that this allows us to strip a later *after* the two Ψ have been
......
......@@ -4,7 +4,7 @@ From iris.heap_lang Require Export lang.
From iris.proofmode Require Import tactics.
From iris.heap_lang Require Import proofmode notation.
From iris.algebra Require Import excl.
Set Default Proof Using "Type*".
Set Default Proof Using "Type".
Definition spawn : val :=
λ: "f",
......@@ -20,10 +20,10 @@ Definition join : val :=
(** The CMRA & functor we need. *)
(* Not bundling heapG, as it may be shared with other users. *)
Class spawnG Σ := SpawnG { spawn_tokG :> inG Σ (exclR unitC) }.
Definition spawnΣ : gFunctors := #[GFunctor (constRF (exclR unitC))].
Definition spawnΣ : gFunctors := #[GFunctor (exclR unitC)].
Instance subG_spawnΣ {Σ} : subG spawnΣ Σ spawnG Σ.
Proof. intros [?%subG_inG _]%subG_inv. split; apply _. Qed.
Proof. solve_inG. Qed.
(** Now we come to the Iris part of the proof. *)
Section proof.
......
......@@ -4,7 +4,7 @@ From iris.proofmode Require Import tactics.
From iris.heap_lang Require Import proofmode notation.
From iris.algebra Require Import excl.
From iris.heap_lang.lib Require Import lock.
Set Default Proof Using "Type*".
Set Default Proof Using "Type".
Definition newlock : val := λ: <>, ref #false.
Definition try_acquire : val := λ: "l", CAS "l" #false #true.
......@@ -15,10 +15,10 @@ Definition release : val := λ: "l", "l" <- #false.
(** The CMRA we need. *)
(* Not bundling heapG, as it may be shared with other users. *)
Class lockG Σ := LockG { lock_tokG :> inG Σ (exclR unitC) }.
Definition lockΣ : gFunctors := #[GFunctor (constRF (exclR unitC))].
Definition lockΣ : gFunctors := #[GFunctor (exclR unitC)].
Instance subG_lockΣ {Σ} : subG lockΣ Σ lockG Σ.
Proof. intros [?%subG_inG _]%subG_inv. split; apply _. Qed.
Proof. solve_inG. Qed.
Section proof.
Context `{!heapG Σ, !lockG Σ} (N : namespace).
......
......@@ -4,7 +4,7 @@ From iris.proofmode Require Import tactics.
From iris.heap_lang Require Import proofmode notation.
From iris.algebra Require Import auth gset.
From iris.heap_lang.lib Require Export lock.
Set Default Proof Using "Type*".
Set Default Proof Using "Type".
Import uPred.
Definition wait_loop: val :=
......@@ -31,10 +31,10 @@ Definition release : val :=
Class tlockG Σ :=
tlock_G :> inG Σ (authR (prodUR (optionUR (exclR natC)) (gset_disjUR nat))).
Definition tlockΣ : gFunctors :=
#[ GFunctor (constRF (authR (prodUR (optionUR (exclR natC)) (gset_disjUR nat)))) ].
#[ GFunctor (authR (prodUR (optionUR (exclR natC)) (gset_disjUR nat))) ].
Instance subG_tlockΣ {Σ} : subG tlockΣ Σ tlockG Σ.
Proof. by intros ?%subG_inG. Qed.
Proof. solve_inG. Qed.
Section proof.
Context `{!heapG Σ, !tlockG Σ} (N : namespace).
......
......@@ -5,7 +5,7 @@ From iris.heap_lang Require Export lang.
From iris.heap_lang Require Import tactics.
From iris.proofmode Require Import tactics.
From iris.prelude Require Import fin_maps.
Set Default Proof Using "Type*".
Set Default Proof Using "Type".
Import uPred.
(** Basic rules for language operations. *)
......
From iris.program_logic Require Import language.
From iris.heap_lang Require Export lang tactics.
Set Default Proof Using "Type*".
Set Default Proof Using "Type".
Coercion LitInt : Z >-> base_lit.
Coercion LitBool : bool >-> base_lit.
......
......@@ -2,7 +2,7 @@ From iris.program_logic Require Export weakestpre.
From iris.proofmode Require Import coq_tactics.
From iris.proofmode Require Export tactics.
From iris.heap_lang Require Export tactics lifting.
Set Default Proof Using "Type*".
Set Default Proof Using "Type".
Import uPred.
(** wp-specific helper tactics *)
......
From iris.heap_lang Require Export lang.
Set Default Proof Using "Type*".
Set Default Proof Using "Type".
Import heap_lang.
(** We define an alternative representation of expressions in which the
......
......@@ -9,7 +9,7 @@ Global Set Automatic Coercions Import.
Global Set Asymmetric Patterns.
Global Unset Transparent Obligations.
From Coq Require Export Morphisms RelationClasses List Bool Utf8 Setoid.
Set Default Proof Using "Type*".
Set Default Proof Using "Type".
Export ListNotations.
From Coq.Program Require Export Basics Syntax.
Obligation Tactic := idtac.
......
......@@ -2,7 +2,7 @@
(* This file is distributed under the terms of the BSD license. *)
(** This file implements bsets as functions into Prop. *)
From iris.prelude Require Export prelude.
Set Default Proof Using "Type*".
Set Default Proof Using "Type".
Record bset (A : Type) : Type := mkBSet { bset_car : A bool }.
Arguments mkBSet {_} _.
......
......@@ -13,7 +13,7 @@ Since [positive]s are bitstrings, we encode [coPset]s as trees that correspond
to the decision function that map bitstrings to bools. *)
From iris.prelude Require Export collections.
From iris.prelude Require Import pmap gmap mapset.
Set Default Proof Using "Type*".
Set Default Proof Using "Type".
Local Open Scope positive_scope.
(** * The tree data structure *)
......
(* Copyright (c) 2012-2015, Robbert Krebbers. *)
(* This file is distributed under the terms of the BSD license. *)
From iris.prelude Require Export list.
Set Default Proof Using "Type*".
Set Default Proof Using "Type".
Local Open Scope positive.
Class Countable A `{EqDecision A} := {
......
......@@ -69,9 +69,9 @@ Proof.
apply Permutation_singleton. by rewrite <-(right_id () {[x]}),
elements_union_singleton, elements_empty by set_solver.
Qed.
Lemma elements_contains X Y : X Y elements X `contains` elements Y.
Lemma elements_submseteq X Y : X Y elements X + elements Y.
Proof.
intros; apply NoDup_contains; auto using NoDup_elements.
intros; apply NoDup_submseteq; auto using NoDup_elements.
intros x. rewrite !elem_of_elements; auto.
Qed.
......
......@@ -699,10 +699,10 @@ Proof.
by rewrite map_to_list_insert, map_to_list_empty by auto using lookup_empty.
Qed.
Lemma map_to_list_contains {A} (m1 m2 : M A) :
m1 m2 map_to_list m1 `contains` map_to_list m2.
Lemma map_to_list_submseteq {A} (m1 m2 : M A) :
m1 m2 map_to_list m1 + map_to_list m2.
Proof.
intros; apply NoDup_contains; auto using NoDup_map_to_list.
intros; apply NoDup_submseteq; auto using NoDup_map_to_list.
intros [i x]. rewrite !elem_of_map_to_list; eauto using lookup_weaken.
Qed.
Lemma map_to_list_fmap {A B} (f : A B) m :
......
(* Copyright (c) 2012-2015, Robbert Krebbers. *)
(* This file is distributed under the terms of the BSD license. *)
From iris.prelude Require Export countable vector.
Set Default Proof Using "Type*".
Set Default Proof Using "Type".
Class Finite A `{EqDecision A} := {
enum : list A;
......@@ -107,17 +107,17 @@ Proof.
unfold card; intros. destruct finA as [[|x ?] ??]; simpl in *; [exfalso;lia|].
constructor; exact x.
Qed.
Lemma finite_inj_contains `{finA: Finite A} `{finB: Finite B} (f: A B)
`{!Inj (=) (=) f} : f <$> enum A `contains` enum B.
Lemma finite_inj_submseteq `{finA: Finite A} `{finB: Finite B} (f: A B)
`{!Inj (=) (=) f} : f <$> enum A + enum B.
Proof.
intros. destruct finA, finB. apply NoDup_contains; auto using NoDup_fmap_2.
intros. destruct finA, finB. apply NoDup_submseteq; auto using NoDup_fmap_2.
Qed.
Lemma finite_inj_Permutation `{Finite A} `{Finite B} (f : A B)
`{!Inj (=) (=) f} : card A = card B f <$> enum A enum B.
Proof.
intros. apply contains_Permutation_length_eq.
intros. apply submseteq_Permutation_length_eq.
- by rewrite fmap_length.
- by apply finite_inj_contains.
- by apply finite_inj_submseteq.
Qed.
Lemma finite_inj_surj `{Finite A} `{Finite B} (f : A B)
`{!Inj (=) (=) f} : card A = card B Surj (=) f.
......@@ -144,7 +144,7 @@ Proof.
destruct (finite_surj A B) as (g&?); auto with lia.
destruct (surj_cancel g) as (f&?). exists f. apply cancel_inj.
- intros [f ?]. unfold card. rewrite <-(fmap_length f).
by apply contains_length, (finite_inj_contains f).
by apply submseteq_length, (finite_inj_submseteq f).
Qed.
Lemma finite_bijective A `{Finite A} B `{Finite B} :
card A = card B f : A B, Inj (=) (=) f Surj (=) f.
......@@ -181,12 +181,12 @@ Section forall_exists.
Context `{ x, Decision (P x)}.
Global Instance forall_dec: Decision ( x, P x).
Proof.
Proof using Type*.
refine (cast_if (decide (Forall P (enum A))));
abstract by rewrite <-Forall_finite.
Defined.
Global Instance exists_dec: Decision ( x, P x).
Proof.
Proof using Type*.
refine (cast_if (decide (Exists P (enum A))));
abstract by rewrite <-Exists_finite.
Defined.
......
From iris.prelude Require Export base tactics.
Set Default Proof Using "Type*".
Set Default Proof Using "Type".
Section definitions.
Context {A T : Type} `{EqDecision A}.
......
......@@ -4,7 +4,7 @@
type. The implementation is based on [Pmap]s, radix-2 search trees. *)
From iris.prelude Require Export countable fin_maps fin_map_dom.
From iris.prelude Require Import pmap mapset set.
Set Default Proof Using "Type*".
Set Default Proof Using "Type".
(** * The data structure *)
(** We pack a [Pmap] together with a proof that ensures that all keys correspond
......
(* Copyright (c) 2012-2016, Robbert Krebbers. *)
(* This file is distributed under the terms of the BSD license. *)
From iris.prelude Require Import gmap.
Set Default Proof Using "Type*".
Set Default Proof Using "Type".
Record gmultiset A `{Countable A} := GMultiSet { gmultiset_car : gmap A nat }.
Arguments GMultiSet {_ _ _} _.
Arguments gmultiset_car {_ _ _} _.
Instance gmultiset_eq_dec `{Countable A} : EqDecision (gmultiset A).
Lemma gmultiset_eq_dec `{Countable A} : EqDecision (gmultiset A).
Proof. solve_decision. Defined.
Hint Extern 1 (Decision (@eq (gmultiset _) _ _)) =>
eapply @gmultiset_eq_dec : typeclass_instances.
Program Instance gmultiset_countable `{Countable A} :
Program Definition gmultiset_countable `{Countable A} :
Countable (gmultiset A) := {|
encode X := encode (gmultiset_car X); decode p := GMultiSet <$> decode p
|}.
Next Obligation. intros A ?? [X]; simpl. by rewrite decode_encode. Qed.
Hint Extern 1 (Countable (gmultiset _)) =>
eapply @gmultiset_countable : typeclass_instances.
Section definitions.
Context `{Countable A}.
......@@ -345,14 +349,14 @@ Proof.
Qed.
(* Mononicity *)
Lemma gmultiset_elements_contains X Y : X Y elements X `contains` elements Y.
Lemma gmultiset_elements_submseteq X Y : X Y elements X + elements Y.
Proof.
intros ->%gmultiset_union_difference. rewrite gmultiset_elements_union.
by apply contains_inserts_r.
by apply submseteq_inserts_r.
Qed.
Lemma gmultiset_subseteq_size X Y : X Y size X size Y.
Proof. intros. by apply contains_length, gmultiset_elements_contains. Qed.
Proof. intros. by apply submseteq_length, gmultiset_elements_submseteq. Qed.
Lemma gmultiset_subset_size X Y : X Y size X < size Y.
Proof.
......
......@@ -5,7 +5,7 @@ using radix-2 search trees. Each hash bucket is thus indexed using an binary
integer of type [Z], and contains an unordered list without duplicates. *)
From iris.prelude Require Export fin_maps listset.
From iris.prelude Require Import zmap.
Set Default Proof Using "Type*".
Set Default Proof Using "Type".
Record hashset {A} (hash : A Z) := Hashset {
hashset_car : Zmap (list A);
......
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