aboutsummaryrefslogtreecommitdiff
path: root/entries
diff options
context:
space:
mode:
authorBraxton Hall2022-10-25 07:25:30 +0000
committerGitHub2022-10-25 07:25:30 +0000
commit9375f87d202403e93ea4196e60de24fd9a9ea065 (patch)
tree0bf89535564d19da6e3de5e4df622be8529e0481 /entries
parenta0abfebaf87e7ebd7d32dbc0a8225c1e803aa914 (diff)
parentdbc59e338fa296efbc311ba3899994dfbee28225 (diff)
Merge pull request #41 from funemy/main
symbolic execution fib
Diffstat (limited to 'entries')
-rw-r--r--entries/funemy/symbolic/phib.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/entries/funemy/symbolic/phib.py b/entries/funemy/symbolic/phib.py
new file mode 100644
index 0000000..c6fb23e
--- /dev/null
+++ b/entries/funemy/symbolic/phib.py
@@ -0,0 +1,21 @@
+from typing import List
+
+def phib(xs: List[int]) -> bool:
+ """
+ Instructions:
+ 1. `pip install crosshair-tool`
+ 2. modify the precondition `pre` to control the length of your fib sequence
+ 3. run `crosshair check phib.py` in your terminal
+
+ pre: len(xs) >= 10
+ post: __return__ != True
+ """
+ if xs[0] != 0:
+ return False
+ if len(xs) > 1:
+ if xs[1] != 1:
+ return False
+ for i in range(2,len(xs)):
+ if xs[i] != xs[i-1] + xs[i-2]:
+ return False
+ return True