Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PROSA - Formally Proven Schedulability Analysis
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
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
RT-PROOFS
PROSA - Formally Proven Schedulability Analysis
Commits
9cc1d641
Commit
9cc1d641
authored
8 years ago
by
Felipe Cerqueira
Browse files
Options
Downloads
Patches
Plain Diff
Add new function for fixed-point iteration
parent
af370ec8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
util/fixedpoint.v
+44
-1
44 additions, 1 deletion
util/fixedpoint.v
with
44 additions
and
1 deletion
util/fixedpoint.v
+
44
−
1
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 fixed-point 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
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