Library zoo.language.location
Require Import stdpp.gmap.
Require Import iris.algebra.ofe.
Require Import zoo.prelude.
Require Import zoo.common.countable.
Require Import zoo.options.
#[local] Open Scope Z_scope.
Record location := Loc
{ location۰car : Z
}.
Add Printing Constructor location.
Canonical location۰O {SI : sidx} :=
leibnizO location.
Lemma locationーeqーspec l1 l2 :
l1 = l2 ↔
location۰car l1 = location۰car l2.
#[global] Instance locationーinhabited : Inhabited location :=
populate {| location۰car := 0 |}.
#[global] Instance locationーeq_dec : EqDecision location :=
ltac:(solve_decision).
#[global] Instance locationーcountable :
Countable location.
#[global] Program Instance locationーinfinite : Infinite location :=
inj_infinite (λ p, {| location۰car := p |}) (λ l, Some (location۰car l)) _.
Definition location۰add l i :=
{| location۰car := location۰car l + i |}.
Notation "l +ₗ i" := (
location۰add l i
)(at level 50,
left associativity
) : stdpp_scope.
#[global] Instance location۰addーinj₁ l :
Inj (=) (=) (location۰add l).
#[global] Instance location۰addーinj₂ i :
Inj (=) (=) (λ l, location۰add l i).
Lemma location۰addーassoc l i j :
l +ₗ i +ₗ j = l +ₗ (i + j).
Lemma location۰addー0 l :
l +ₗ 0 = l.
Definition location۰fresh (ls : gset location) :=
{| location۰car := set_fold (λ k r, (1 + location۰car k) `max` r) 1 ls |}.
Lemma location۰freshーfresh ls i :
0 ≤ i →
location۰fresh ls +ₗ i ∉ ls.
#[global] Opaque location۰fresh.
Require Import iris.algebra.ofe.
Require Import zoo.prelude.
Require Import zoo.common.countable.
Require Import zoo.options.
#[local] Open Scope Z_scope.
Record location := Loc
{ location۰car : Z
}.
Add Printing Constructor location.
Canonical location۰O {SI : sidx} :=
leibnizO location.
Lemma locationーeqーspec l1 l2 :
l1 = l2 ↔
location۰car l1 = location۰car l2.
#[global] Instance locationーinhabited : Inhabited location :=
populate {| location۰car := 0 |}.
#[global] Instance locationーeq_dec : EqDecision location :=
ltac:(solve_decision).
#[global] Instance locationーcountable :
Countable location.
#[global] Program Instance locationーinfinite : Infinite location :=
inj_infinite (λ p, {| location۰car := p |}) (λ l, Some (location۰car l)) _.
Definition location۰add l i :=
{| location۰car := location۰car l + i |}.
Notation "l +ₗ i" := (
location۰add l i
)(at level 50,
left associativity
) : stdpp_scope.
#[global] Instance location۰addーinj₁ l :
Inj (=) (=) (location۰add l).
#[global] Instance location۰addーinj₂ i :
Inj (=) (=) (λ l, location۰add l i).
Lemma location۰addーassoc l i j :
l +ₗ i +ₗ j = l +ₗ (i + j).
Lemma location۰addー0 l :
l +ₗ 0 = l.
Definition location۰fresh (ls : gset location) :=
{| location۰car := set_fold (λ k r, (1 + location۰car k) `max` r) 1 ls |}.
Lemma location۰freshーfresh ls i :
0 ≤ i →
location۰fresh ls +ₗ i ∉ ls.
#[global] Opaque location۰fresh.