This is a library for org-babel to execute ACL2 code.
This package is not yet available on MELPA. But you can install it from GitHub as follows:
(leaf ob-acl2
:vc (:url "https://github.com/tani/ob-acl2")
:config
(defun ob-acl2-setup ()
(add-to-list 'org-babel-load-languages '(acl2 . t))
(add-to-list 'org-src-lang-modes '("acl2" . lisp)))
(add-hook 'org-mode-hook 'ob-acl2-setup))
You can execute ACL2 code in org-mode as follows:
First, write lisp function in org-mode and evaluate it (C-c C-c
).
(defun factorial (n)
(if (zp n)
1
(* n (factorial (1- n)))))
Yaay! The function FACTORIAL is defined. Let’s prove that the factorial of a positive integer is positive. Write a theorem and evaluate it.
(defthm factorial-positive
(implies (and (integerp n) (<= 0 n))
(and (integerp (factorial n))
(< 0 (factorial n)))))
The theorem FACTORIAL-POSITIVE is proved. Now, you have a safe and sound factorial function in ACL2.
Copyright (C) 2024 TANIGUCHI Masaya
This program is licensed under the GNU General Public License version 3.
- https://github.com/tani/acl2-kernel - A jupyter kernel for ACL2