Skip to content

Commit

Permalink
Add a little example about Fibonacci to examples/misc
Browse files Browse the repository at this point in the history
  • Loading branch information
mn200 committed Jan 6, 2024
1 parent ba2cfb3 commit 9927975
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion examples/misc/Holmakefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
INCLUDES = $(dprot $(HOLDIR)/src/real) $(dprot $(HOLDIR)/src/real/analysis) $(dprot $(HOLDIR)/src/bag)
INCLUDES = $(dprot $(HOLDIR)/src/real) $(dprot $(HOLDIR)/src/real/analysis) $(dprot $(HOLDIR)/src/bag) $(dprot $(HOLDIR)/src/integer)

all: $(DEFAULT_TARGETS) euclid-OK
.PHONY: all
Expand Down
19 changes: 19 additions & 0 deletions examples/misc/fibmod3Script.sml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
open HolKernel Parse boolLib bossLib;

val _ = new_theory "fibmod3";

Definition fib_def:
fib n = if n = 0n then 1n else if n = 1 then 1 else fib (n-1) + fib (n - 2)
End

Theorem fibmod:
∀n. EVEN (fib n) ⇔ n MOD 3 = 2
Proof
recInduct fib_ind >> rw[] >>
ONCE_REWRITE_TAC [fib_def] >> rw[] >>
gs[arithmeticTheory.EVEN_ADD] >>
intLib.ARITH_TAC
QED


val _ = export_theory();

0 comments on commit 9927975

Please sign in to comment.