tani / ob-acl2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ob-acl2

This is a library for org-babel to execute ACL2 code.

Installation

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))

Usage

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.

License

Copyright (C) 2024 TANIGUCHI Masaya

This program is licensed under the GNU General Public License version 3.

Related works

About

License:GNU General Public License v3.0


Languages

Language:Emacs Lisp 97.4%Language:Makefile 2.6%