Iterative fibonacci example proof#245
Open
nagyors wants to merge 2 commits into
Open
Conversation
dominic-mulligan-aws
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for your contribution! Could you rebase and push again? I've just got some minor comments...
| text\<open>First, we define the mathematical Fibonacci function recursively. | ||
| Solution taken from: https://isabelle.in.tum.de/library/HOL/HOL-Number_Theory/Fib.html \<close> | ||
|
|
||
| fun fib :: "nat \<Rightarrow> nat" where |
Collaborator
There was a problem hiding this comment.
nit: can you use cartouches instead of quotation marks, and match our prevailing style?
|
|
||
| text\<open>Some basic properties of the mathematical definition\<close> | ||
|
|
||
| lemma fib_plus_2: "fib (n + 2) = fib (n + 1) + fib n" |
Collaborator
There was a problem hiding this comment.
nit: can you phrase lemmas using assumes and shows and match our prevailing style?
|
|
||
| text\<open>Lastly, prove that the iterative Fibonacci is correct with the mathematical definition.\<close> | ||
|
|
||
| definition fib_correct_contract :: \<open>64 word \<Rightarrow> ('s, nat, 'b) function_contract\<close> where |
Collaborator
There was a problem hiding this comment.
Strictly speaking this is the only contract and functional correctness proof we need...
7edac3f to
d18d99a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue #6 : Implements one of the examples suggested (iterative Fibonacci correctness proof).
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.