Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
rtproofs
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
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Sophie Quinton
rtproofs
Commits
9cc1d641
Commit
9cc1d641
authored
Aug 04, 2016
by
Felipe Cerqueira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new function for fixedpoint iteration
parent
af370ec8
Changes
1
Hide whitespace changes
Inline
Sidebyside
Showing
1 changed file
with
44 additions
and
1 deletion
+44
1
util/fixedpoint.v
util/fixedpoint.v
+44
1
No files found.
util/fixedpoint.v
View file @
9cc1d641
...
...
@@ 70,4 +70,47 @@ Section FixedPoint.
by
rewrite
addnS
;
apply
fun_mon_iter_mon_helper
.
Qed
.
End
FixedPoint
.
\ No newline at end of file
End
FixedPoint
.
(* In this section we define a fixedpoint iteration function
that stops as soon as it finds the solution. If no solution
is found, the function returns None. *)
Section
Iteration
.
Variable
T
:
eqType
.
Variable
f
:
T
>
T
.
Fixpoint
iter_fixpoint
max_steps
(
x
:
T
)
:
=
if
max_steps
is
step
.+
1
then
let
x'
:
=
f
x
in
if
x
==
x'
then
Some
x
else
iter_fixpoint
step
x'
else
None
.
Section
Lemmas
.
(* We prove that iter_fixpoint either returns either None
or Some y, where y is a fixed point. *)
Lemma
iter_fixpoint_cases
:
forall
max_steps
x0
,
iter_fixpoint
max_steps
x0
=
None
\/
exists
y
,
iter_fixpoint
max_steps
x0
=
Some
y
/\
y
=
f
y
.
Proof
.
induction
max_steps
.
{
by
ins
;
simpl
;
destruct
(
x0
==
f
x0
)
;
left
.
}
{
intros
x0
;
simpl
.
destruct
(
x0
==
f
x0
)
eqn
:
EQ1
;
first
by
right
;
exists
x0
;
split
;
last
by
apply
/
eqP
.
by
destruct
(
IHmax_steps
(
f
x0
))
as
[
NONE

FOUND
].
}
Qed
.
End
Lemmas
.
End
Iteration
.
\ No newline at end of file
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