Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
iris-coq
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
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
Maxime Dénès
iris-coq
Commits
9981b976
Commit
9981b976
authored
8 years ago
by
Robbert Krebbers
Browse files
Options
Downloads
Patches
Plain Diff
CMRA on nat with max as op.
parent
8234670f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
algebra/cmra.v
+42
-7
42 additions, 7 deletions
algebra/cmra.v
algebra/updates.v
+9
-6
9 additions, 6 deletions
algebra/updates.v
with
51 additions
and
13 deletions
algebra/cmra.v
+
42
−
7
View file @
9981b976
...
...
@@ -758,35 +758,70 @@ Section nat.
Instance
nat_validN
:
ValidN
nat
:=
λ
n
x
,
True
.
Instance
nat_pcore
:
PCore
nat
:=
λ
x
,
Some
0
.
Instance
nat_op
:
Op
nat
:=
plus
.
Definition
nat_op_plus
x
y
:
x
⋅
y
=
x
+
y
:=
eq_refl
.
Lemma
nat_included
(
x
y
:
nat
)
:
x
≼
y
↔
x
≤
y
.
Proof
.
split
.
-
intros
[
z
->
];
unfold
op
,
nat_op
;
lia
.
-
exists
(
y
-
x
)
.
by
apply
le_plus_minus
.
Qed
.
Lemma
nat_
cm
ra_mixin
:
CM
RAMixin
nat
.
Lemma
nat_ra_mixin
:
RAMixin
nat
.
Proof
.
apply
discrete_cmra_mixin
,
ra_total_mixin
;
try
by
eauto
.
apply
ra_total_mixin
;
try
by
eauto
.
-
solve_proper
.
-
intros
x
y
z
.
apply
Nat
.
add_assoc
.
-
intros
x
y
.
apply
Nat
.
add_comm
.
-
by
exists
0
.
Qed
.
Canonical
Structure
natR
:
cmraT
:=
CMRAT
nat
(
@
discrete_cofe_mixin
_
equivL
_)
nat_cmra_mixin
.
Canonical
Structure
natR
:
cmraT
:=
discreteR
nat
nat_ra_mixin
.
Instance
nat_empty
:
Empty
nat
:=
0
.
Lemma
nat_ucmra_mixin
:
UCMRAMixin
nat
.
Proof
.
split
;
apply
_
||
done
.
Qed
.
Canonical
Structure
natUR
:
ucmraT
:=
UCMRAT
nat
(
@
discrete_cofe_mixin
_
equivL
_)
nat_
cm
ra_mixin
nat_ucmra_mixin
.
discreteUR
nat
nat_ra_mixin
nat_ucmra_mixin
.
Global
Instance
nat_cmra_discrete
:
CMRADiscrete
natR
.
Proof
.
constructor
;
apply
_
||
done
.
Qed
.
Global
Instance
nat_persistent
(
x
:
())
:
Persistent
x
.
Proof
.
by
constructor
.
Qed
.
End
nat
.
Definition
mnat
:=
nat
.
Section
mnat
.
Instance
mnat_valid
:
Valid
mnat
:=
λ
x
,
True
.
Instance
mnat_validN
:
ValidN
mnat
:=
λ
n
x
,
True
.
Instance
mnat_pcore
:
PCore
mnat
:=
Some
.
Instance
mnat_op
:
Op
mnat
:=
max
.
Definition
mnat_op_max
x
y
:
x
⋅
y
=
max
x
y
:=
eq_refl
.
Lemma
mnat_included
(
x
y
:
mnat
)
:
x
≼
y
↔
x
≤
y
.
Proof
.
split
.
-
intros
[
z
->
];
unfold
op
,
mnat_op
;
lia
.
-
exists
y
.
by
symmetry
;
apply
Nat
.
max_r
.
Qed
.
Lemma
mnat_ra_mixin
:
RAMixin
mnat
.
Proof
.
apply
ra_total_mixin
;
try
by
eauto
.
-
solve_proper
.
-
solve_proper
.
-
intros
x
y
z
.
apply
Nat
.
max_assoc
.
-
intros
x
y
.
apply
Nat
.
max_comm
.
-
intros
x
.
apply
Max
.
max_idempotent
.
Qed
.
Canonical
Structure
mnatR
:
cmraT
:=
discreteR
mnat
mnat_ra_mixin
.
Instance
mnat_empty
:
Empty
mnat
:=
0
.
Lemma
mnat_ucmra_mixin
:
UCMRAMixin
mnat
.
Proof
.
split
;
apply
_
||
done
.
Qed
.
Canonical
Structure
mnatUR
:
ucmraT
:=
discreteUR
mnat
mnat_ra_mixin
mnat_ucmra_mixin
.
Global
Instance
mnat_cmra_discrete
:
CMRADiscrete
mnatR
.
Proof
.
constructor
;
apply
_
||
done
.
Qed
.
Global
Instance
mnat_persistent
(
x
:
mnat
)
:
Persistent
x
.
Proof
.
by
constructor
.
Qed
.
End
mnat
.
(** ** Product *)
Section
prod
.
Context
{
A
B
:
cmraT
}
.
...
...
This diff is collapsed.
Click to expand it.
algebra/updates.v
+
9
−
6
View file @
9981b976
...
...
@@ -241,11 +241,14 @@ Section option.
End
option
.
(** * Natural numbers *)
Lemma
nat_local_update
(
x
y
:
nat
)
mz
:
x
~l
~>
y
@
mz
.
Lemma
nat_local_update
(
x
y
:
nat
)
mz
:
x
~l
~>
y
@
mz
.
Proof
.
split
.
done
.
unfold
opM
,
op
,
dist
,
cofe_dist
,
cmra_cofeC
,
cmra_op
,
cmra_dist
,
natR
,
nat_op
,
discrete_dist
,
equiv
,
equivL
.
destruct
mz
as
[
z
|];
intros
n
[
z'
|];
lia
.
split
;
first
done
.
compute
-
[
plus
];
destruct
mz
as
[
z
|];
intros
n
[
z'
|];
lia
.
Qed
.
Lemma
mnat_local_update
(
x
y
:
mnat
)
mz
:
x
≤
y
→
x
~l
~>
y
@
mz
.
Proof
.
split
;
first
done
.
compute
-
[
max
];
destruct
mz
as
[
z
|];
intros
n
[
z'
|];
lia
.
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