Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
coqstdpp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
David Swasey
coqstdpp
Commits
c92654ed
Commit
c92654ed
authored
Nov 09, 2017
by
Robbert Krebbers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Define `wf_guard` in terms of Coq stdlib's `Acc_intro_generator`.
parent
b9ef84b4
Changes
1
Hide whitespace changes
Inline
Sidebyside
Showing
1 changed file
with
13 additions
and
27 deletions
+13
27
theories/relations.v
theories/relations.v
+13
27
No files found.
theories/relations.v
View file @
c92654ed
...
...
@@ 194,33 +194,8 @@ End subrel.
(** * Theorems on well founded relations *)
Notation
wf
:
=
well_founded
.
Section
wf
.
Context
`
{
R
:
relation
A
}.
Lemma
Acc_def
x
:
Acc
R
x
↔
(
∀
y
:
A
,
R
y
x
→
Acc
R
y
).
Proof
.
split
.
by
destruct
1
.
by
constructor
.
Qed
.
(** A trick by Thomas Braibant to compute with wellfounded recursions:
it lazily adds [2^n] [Acc_intro] constructors in front of a well foundedness
proof, so that the actual proof is never reached in practise. *)
Fixpoint
wf_guard
(
n
:
nat
)
(
wfR
:
wf
R
)
:
wf
R
:
=
match
n
with

0
=>
wfR

S
n
=>
λ
x
,
Acc_intro
x
(
λ
y
_
,
wf_guard
n
(
wf_guard
n
wfR
)
y
)
end
.
Lemma
wf_projected
`
(
R2
:
relation
B
)
(
f
:
A
→
B
)
:
(
∀
x
y
,
R
x
y
→
R2
(
f
x
)
(
f
y
))
→
wf
R2
→
wf
R
.
Proof
.
intros
Hf
Hwf
.
cut
(
∀
y
,
Acc
R2
y
→
∀
x
,
y
=
f
x
→
Acc
R
x
).
{
intros
aux
x
.
apply
(
aux
(
f
x
))
;
auto
.
}
induction
1
as
[
y
_
IH
].
intros
x
?.
subst
.
constructor
.
intros
.
apply
(
IH
(
f
y
))
;
auto
.
Qed
.
End
wf
.
Definition
wf_guard
`
{
R
:
relation
A
}
(
n
:
nat
)
(
wfR
:
wf
R
)
:
wf
R
:
=
Acc_intro_generator
n
wfR
.
(* Generally we do not want [wf_guard] to be expanded (neither by tactics,
nor by conversion tests in the kernel), but in some cases we do need it for
...
...
@@ 228,6 +203,17 @@ computation (that is, we cannot make it opaque). We use the [Strategy]
command to make its expanding behavior less eager. *)
Strategy
100
[
wf_guard
].
Lemma
wf_projected
`
{
R1
:
relation
A
}
`
(
R2
:
relation
B
)
(
f
:
A
→
B
)
:
(
∀
x
y
,
R1
x
y
→
R2
(
f
x
)
(
f
y
))
→
wf
R2
→
wf
R1
.
Proof
.
intros
Hf
Hwf
.
cut
(
∀
y
,
Acc
R2
y
→
∀
x
,
y
=
f
x
→
Acc
R1
x
).
{
intros
aux
x
.
apply
(
aux
(
f
x
))
;
auto
.
}
induction
1
as
[
y
_
IH
].
intros
x
?.
subst
.
constructor
.
intros
.
apply
(
IH
(
f
y
))
;
auto
.
Qed
.
Lemma
Fix_F_proper
`
{
R
:
relation
A
}
(
B
:
A
→
Type
)
(
E
:
∀
x
,
relation
(
B
x
))
(
F
:
∀
x
,
(
∀
y
,
R
y
x
→
B
y
)
→
B
x
)
(
HF
:
∀
(
x
:
A
)
(
f
g
:
∀
y
,
R
y
x
→
B
y
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment