aboutsummaryrefslogtreecommitdiff
path: root/entries/lizard-business/fib.maude
diff options
context:
space:
mode:
authorfunemy2022-10-25 07:14:52 +0000
committerfunemy2022-10-25 07:14:52 +0000
commit998ef837b43203319397f191036a97a5adc42220 (patch)
tree920558bd60d282c663fd2da1cd4144cac1849a1d /entries/lizard-business/fib.maude
parentfdac6c60e115297a58f5b81da0c4b7f18ac758f2 (diff)
parentce7544a6db594f7d3dfad0d7dc65d01515e57ad6 (diff)
Merge branch 'main' of github.com:braxtonhall/fib
Diffstat (limited to 'entries/lizard-business/fib.maude')
-rw-r--r--entries/lizard-business/fib.maude27
1 files changed, 27 insertions, 0 deletions
diff --git a/entries/lizard-business/fib.maude b/entries/lizard-business/fib.maude
new file mode 100644
index 0000000..20bc428
--- /dev/null
+++ b/entries/lizard-business/fib.maude
@@ -0,0 +1,27 @@
+smod FIB is
+ pr LIST{Nat} .
+
+ vars M N : Nat .
+ var Ns : List{Nat} .
+
+ rl [start]: nil => 0 1 .
+ rl [next]: Ns M N => Ns M N (M + N) .
+ rl [drop] : Ns N => N .
+
+ strats fib fibgo : Nat @ List{Nat} .
+ sd fib(N) := start ; fibgo(N) .
+ sd fibgo(0) := top(drop) .
+ sd fibgo(s(N)) := top(next) ; fibgo(N) .
+endsm
+
+***(
+ Maude> srew nil using fib(10) .
+ srewrite in FIB : nil using fib(10) .
+
+ Solution 1
+ rewrites: 8330 in 12ms cpu (12ms real) (694166 rewrites/second)
+ result NzNat: 89
+
+ No more solutions.
+ rewrites: 8469 in 12ms cpu (13ms real) (705750 rewrites/second)
+)