Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Iris
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gaëtan Gilbert
Iris
Commits
6fef06cf
Commit
6fef06cf
authored
1 year ago
by
Robbert Krebbers
Browse files
Options
Downloads
Patches
Plain Diff
Rename `principal` into `to_mra` to be consistent with `agree`.
parent
247ff95f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
iris_unstable/algebra/monotone.v
+31
-31
31 additions, 31 deletions
iris_unstable/algebra/monotone.v
tests/monotone.v
+2
-2
2 additions, 2 deletions
tests/monotone.v
with
33 additions
and
33 deletions
iris_unstable/algebra/monotone.v
+
31
−
31
View file @
6fef06cf
...
...
@@ -7,12 +7,12 @@ From iris.algebra Require Import updates local_updates.
From
iris
.
prelude
Require
Import
options
.
(** Given a preorder [R] on a type [A] we construct the "monotone" resource
algebra [mra R] and an injection [
principal
: A → mra R] such that:
algebra [mra R] and an injection [
to_mra
: A → mra R] such that:
[R x y] iff [
principal x ≼ principal
y]
[R x y] iff [
to_mra x ≼ to_mra
y]
Here, [≼] is the extension order of the [mra R] resource algebra. This is
exactly what the lemma [
principal
_included] shows.
exactly what the lemma [
to_mra
_included] shows.
This resource algebra is useful for reasoning about monotonicity. See the
following paper for more details:
...
...
@@ -23,7 +23,7 @@ following paper for more details:
*)
Record
mra
{
A
}
(
R
:
relation
A
)
:=
{
mra_car
:
list
A
}
.
Definition
principal
{
A
}
{
R
:
relation
A
}
(
a
:
A
)
:
mra
R
:=
Definition
to_mra
{
A
}
{
R
:
relation
A
}
(
a
:
A
)
:
mra
R
:=
{|
mra_car
:=
[
a
]
|}
.
Global
Arguments
mra_car
{_
_}
_
.
...
...
@@ -32,14 +32,14 @@ Section mra.
Implicit
Types
a
b
:
A
.
Implicit
Types
x
y
:
mra
R
.
Local
Definition
below
(
a
:
A
)
(
x
:
mra
R
)
:=
∃
b
,
b
∈
mra_car
x
∧
R
a
b
.
Local
Definition
mra_
below
(
a
:
A
)
(
x
:
mra
R
)
:=
∃
b
,
b
∈
mra_car
x
∧
R
a
b
.
Local
Lemma
below_
principal
a
b
:
below
a
(
principal
b
)
↔
R
a
b
.
Local
Lemma
mra_
below_
to_mra
a
b
:
mra_
below
a
(
to_mra
b
)
↔
R
a
b
.
Proof
.
set_solver
.
Qed
.
(* OFE *)
Local
Instance
mra_equiv
:
Equiv
(
mra
R
)
:=
λ
x
y
,
∀
a
,
below
a
x
↔
below
a
y
.
∀
a
,
mra_
below
a
x
↔
mra_
below
a
y
.
Local
Instance
mra_equiv_equiv
:
Equivalence
mra_equiv
.
Proof
.
unfold
mra_equiv
;
split
;
intros
?;
naive_solver
.
Qed
.
...
...
@@ -90,22 +90,22 @@ Section mra.
intros
[
z
->
];
rewrite
assoc
mra_idemp
;
done
.
Qed
.
Lemma
principal
_R_op
`{
!
Transitive
R
}
a
b
:
Lemma
to_mra
_R_op
`{
!
Transitive
R
}
a
b
:
R
a
b
→
principal
a
⋅
principal
b
≡
principal
b
.
to_mra
a
⋅
to_mra
b
≡
to_mra
b
.
Proof
.
intros
Hab
c
.
set_solver
.
Qed
.
Lemma
principal
_included
`{
!
PreOrder
R
}
a
b
:
principal
a
≼
principal
b
↔
R
a
b
.
Lemma
to_mra
_included
`{
!
PreOrder
R
}
a
b
:
to_mra
a
≼
to_mra
b
↔
R
a
b
.
Proof
.
split
.
-
move
=>
[
z
Hz
]
.
specialize
(
Hz
a
)
.
set_solver
.
-
intros
?;
exists
(
principal
b
)
.
by
rewrite
principal
_R_op
.
-
intros
?;
exists
(
to_mra
b
)
.
by
rewrite
to_mra
_R_op
.
Qed
.
Lemma
mra_local_update_grow
`{
!
Transitive
R
}
a
x
b
:
R
a
b
→
(
principal
a
,
x
)
~l
~>
(
principal
b
,
principal
b
)
.
(
to_mra
a
,
x
)
~l
~>
(
to_mra
b
,
to_mra
b
)
.
Proof
.
intros
Hana
.
apply
local_update_unital_discrete
=>
z
_
Habz
.
split
;
first
done
.
intros
c
.
specialize
(
Habz
c
)
.
set_solver
.
...
...
@@ -113,11 +113,11 @@ Section mra.
Lemma
mra_local_update_get_frag
`{
!
PreOrder
R
}
a
b
:
R
b
a
→
(
principal
a
,
ε
)
~l
~>
(
principal
a
,
principal
b
)
.
(
to_mra
a
,
ε
)
~l
~>
(
to_mra
a
,
to_mra
b
)
.
Proof
.
intros
Hana
.
apply
local_update_unital_discrete
=>
z
_
.
rewrite
left_id
.
intros
<-.
split
;
first
done
.
apply
mra_included
;
by
apply
principal
_included
.
apply
mra_included
;
by
apply
to_mra
_included
.
Qed
.
End
mra
.
...
...
@@ -126,7 +126,7 @@ Global Arguments mraR {_} _.
Global
Arguments
mraUR
{_}
_
.
(** If [R] is a partial order, relative to a reflexive relation [S] on the
carrier [A], then [
principal
] is proper and injective. The theory for
carrier [A], then [
to_mra
] is proper and injective. The theory for
arbitrary relations [S] is overly general, so we do not declare the results
as instances. Below we provide instances for [S] being [=] and [≡]. *)
Section
mra_over_rel
.
...
...
@@ -134,36 +134,36 @@ Section mra_over_rel.
Implicit
Types
a
b
:
A
.
Implicit
Types
x
y
:
mra
R
.
Lemma
principal
_rel_proper
:
Lemma
to_mra
_rel_proper
:
Reflexive
S
→
Proper
(
S
==>
S
==>
iff
)
R
→
Proper
(
S
==>
(
≡@
{
mra
R
}))
(
principal
)
.
Proof
.
intros
?
HR
a1
a2
Ha
b
.
rewrite
!
below_
principal
.
by
apply
HR
.
Qed
.
Proper
(
S
==>
(
≡@
{
mra
R
}))
(
to_mra
)
.
Proof
.
intros
?
HR
a1
a2
Ha
b
.
rewrite
!
mra_
below_
to_mra
.
by
apply
HR
.
Qed
.
Lemma
principal
_rel_inj
:
Lemma
to_mra
_rel_inj
:
Reflexive
R
→
AntiSymm
S
R
→
Inj
S
(
≡@
{
mra
R
})
(
principal
)
.
Inj
S
(
≡@
{
mra
R
})
(
to_mra
)
.
Proof
.
intros
??
a
b
Hab
.
move
:
(
Hab
a
)
(
Hab
b
)
.
rewrite
!
below_
principal
.
intros
??
a
b
Hab
.
move
:
(
Hab
a
)
(
Hab
b
)
.
rewrite
!
mra_
below_
to_mra
.
intros
.
apply
(
anti_symm
R
);
naive_solver
.
Qed
.
End
mra_over_rel
.
Global
Instance
principal
_inj
{
A
}
{
R
:
relation
A
}
:
Global
Instance
to_mra
_inj
{
A
}
{
R
:
relation
A
}
:
Reflexive
R
→
AntiSymm
(
=
)
R
→
Inj
(
=
)
(
≡@
{
mra
R
})
(
principal
)
|
0
.
(* Lower cost than [
principal
_inj] *)
Proof
.
intros
.
by
apply
(
principal
_rel_inj
(
=
))
.
Qed
.
Inj
(
=
)
(
≡@
{
mra
R
})
(
to_mra
)
|
0
.
(* Lower cost than [
to_mra
_inj] *)
Proof
.
intros
.
by
apply
(
to_mra
_rel_inj
(
=
))
.
Qed
.
Global
Instance
principal
_proper
`{
Equiv
A
}
{
R
:
relation
A
}
:
Global
Instance
to_mra
_proper
`{
Equiv
A
}
{
R
:
relation
A
}
:
Reflexive
(
≡@
{
A
})
→
Proper
((
≡
)
==>
(
≡
)
==>
iff
)
R
→
Proper
((
≡
)
==>
(
≡@
{
mra
R
}))
(
principal
)
.
Proof
.
intros
.
by
apply
(
principal
_rel_proper
(
≡
))
.
Qed
.
Proper
((
≡
)
==>
(
≡@
{
mra
R
}))
(
to_mra
)
.
Proof
.
intros
.
by
apply
(
to_mra
_rel_proper
(
≡
))
.
Qed
.
Global
Instance
principal
_equiv_inj
`{
Equiv
A
}
{
R
:
relation
A
}
:
Global
Instance
to_mra
_equiv_inj
`{
Equiv
A
}
{
R
:
relation
A
}
:
Reflexive
R
→
AntiSymm
(
≡
)
R
→
Inj
(
≡
)
(
≡@
{
mra
R
})
(
principal
)
|
1
.
Proof
.
intros
.
by
apply
(
principal
_rel_inj
(
≡
))
.
Qed
.
Inj
(
≡
)
(
≡@
{
mra
R
})
(
to_mra
)
|
1
.
Proof
.
intros
.
by
apply
(
to_mra
_rel_inj
(
≡
))
.
Qed
.
This diff is collapsed.
Click to expand it.
tests/monotone.v
+
2
−
2
View file @
6fef06cf
...
...
@@ -7,10 +7,10 @@ Notation gset_mra K:= (mra (⊆@{gset K})).
(* Check if we indeed get [=], i.e., the right [Inj] instance is used. *)
Check
"mra_test_eq"
.
Lemma
mra_test_eq
X
Y
:
principal
X
≡@
{
gset_mra
nat
}
principal
Y
→
X
=
Y
.
Lemma
mra_test_eq
X
Y
:
to_mra
X
≡@
{
gset_mra
nat
}
to_mra
Y
→
X
=
Y
.
Proof
.
intros
?
%
(
inj
_)
.
Show
.
done
.
Qed
.
Notation
propset_mra
K
:=
(
mra
(
⊆@
{
propset
K
}))
.
Lemma
mra_test_equiv
X
Y
:
principal
X
≡@
{
propset_mra
nat
}
principal
Y
→
X
≡
Y
.
Lemma
mra_test_equiv
X
Y
:
to_mra
X
≡@
{
propset_mra
nat
}
to_mra
Y
→
X
≡
Y
.
Proof
.
intros
?
%
(
inj
_)
.
done
.
Qed
.
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment