Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
stdpp
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
Model registry
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
Iris
stdpp
Commits
c73f285d
Commit
c73f285d
authored
6 years ago
by
Robbert Krebbers
Browse files
Options
Downloads
Patches
Plain Diff
The symmetric and reflexive/transitive/symmetric closure.
parent
51d69170
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!53
Confluent relations
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
theories/relations.v
+49
-2
49 additions, 2 deletions
theories/relations.v
with
49 additions
and
2 deletions
theories/relations.v
+
49
−
2
View file @
c73f285d
...
...
@@ -17,6 +17,9 @@ Section definitions.
(** An element is in normal form if no further steps are possible. *)
Definition
nf
(
x
:
A
)
:=
¬
red
x
.
(** The symmetric closure. *)
Definition
sc
:
relation
A
:=
λ
x
y
,
R
x
y
∨
R
y
x
.
(** The reflexive transitive closure. *)
Inductive
rtc
:
relation
A
:=
|
rtc_refl
x
:
rtc
x
x
...
...
@@ -53,13 +56,16 @@ Section definitions.
|
ex_loop_do_step
x
y
:
R
x
y
→
ex_loop
y
→
ex_loop
x
.
End
definitions
.
(* Strongly normalizing elements *)
(** The reflexive transitive symmetric closure. *)
Definition
rtsc
{
A
}
(
R
:
relation
A
)
:=
rtc
(
sc
R
)
.
(** Strongly normalizing elements. *)
Notation
sn
R
:=
(
Acc
(
flip
R
))
.
Hint
Unfold
nf
red
:
core
.
(** * General theorems *)
Section
rtc
.
Section
closure
.
Context
`{
R
:
relation
A
}
.
Hint
Constructors
rtc
nsteps
bsteps
tc
:
core
.
...
...
@@ -78,6 +84,14 @@ Section rtc.
Global
Instance
rtc_po
:
PreOrder
(
rtc
R
)
|
10
.
Proof
.
split
.
exact
(
@
rtc_refl
A
R
)
.
exact
rtc_transitive
.
Qed
.
(* Not an instance, related to the issue described above, this sometimes makes
[setoid_rewrite] queries loop. *)
Lemma
rtc_equivalence
:
Symmetric
R
→
Equivalence
(
rtc
R
)
.
Proof
.
split
;
try
apply
_
.
intros
x
y
.
induction
1
as
[|
x1
x2
x3
];
[
done
|
trans
x2
;
eauto
]
.
Qed
.
Lemma
rtc_once
x
y
:
R
x
y
→
rtc
R
x
y
.
Proof
.
eauto
.
Qed
.
Lemma
rtc_r
x
y
z
:
rtc
R
x
y
→
R
y
z
→
rtc
R
x
z
.
...
...
@@ -105,6 +119,9 @@ Section rtc.
Lemma
rtc_inv_r
x
z
:
rtc
R
x
z
→
x
=
z
∨
∃
y
,
rtc
R
x
y
∧
R
y
z
.
Proof
.
revert
z
.
apply
rtc_ind_r
;
eauto
.
Qed
.
Lemma
rtc_nf
x
y
:
rtc
R
x
y
→
nf
R
x
→
x
=
y
.
Proof
.
destruct
1
as
[
x
|
x
y1
y2
]
.
done
.
intros
[];
eauto
.
Qed
.
Lemma
nsteps_once
x
y
:
R
x
y
→
nsteps
R
1
x
y
.
Proof
.
eauto
.
Qed
.
Lemma
nsteps_trans
n
m
x
y
z
:
...
...
@@ -171,6 +188,36 @@ Section rtc.
Lemma
tc_rtc
x
y
:
tc
R
x
y
→
rtc
R
x
y
.
Proof
.
induction
1
;
eauto
.
Qed
.
Global
Instance
sc_symmetric
:
Symmetric
(
sc
R
)
.
Proof
.
unfold
Symmetric
,
sc
.
naive_solver
.
Qed
.
Lemma
sc_lr
x
y
:
R
x
y
→
sc
R
x
y
.
Proof
.
by
left
.
Qed
.
Lemma
sc_rl
x
y
:
R
y
x
→
sc
R
x
y
.
Proof
.
by
right
.
Qed
.
End
closure
.
Section
more_closure
.
Context
`{
R
:
relation
A
}
.
Global
Instance
rtsc_equivalence
:
Equivalence
(
rtsc
R
)
|
10
.
Proof
.
apply
rtc_equivalence
,
_
.
Qed
.
Lemma
rtsc_lr
x
y
:
R
x
y
→
rtsc
R
x
y
.
Proof
.
unfold
rtsc
.
eauto
using
sc_lr
,
rtc_once
.
Qed
.
Lemma
rtsc_rl
x
y
:
R
y
x
→
rtsc
R
x
y
.
Proof
.
unfold
rtsc
.
eauto
using
sc_rl
,
rtc_once
.
Qed
.
Lemma
rtc_rtsc_rl
x
y
:
rtc
R
x
y
→
rtsc
R
x
y
.
Proof
.
induction
1
;
econstructor
;
eauto
using
sc_lr
.
Qed
.
Lemma
rtc_rtsc_lr
x
y
:
rtc
R
y
x
→
rtsc
R
x
y
.
Proof
.
intros
.
symmetry
.
eauto
using
rtc_rtsc_rl
.
Qed
.
End
more_closure
.
Section
properties
.
Context
`{
R
:
relation
A
}
.
Hint
Constructors
rtc
nsteps
bsteps
tc
:
core
.
Lemma
acc_not_ex_loop
x
:
Acc
(
flip
R
)
x
→
¬
ex_loop
R
x
.
Proof
.
unfold
not
.
induction
1
;
destruct
1
;
eauto
.
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