tbh I'm not sure why #acl2 doesn't have getf. Here is my "do-loop$" loopy one. #commonLisp

ACL2 !>(forgetf :a '(:c d :a b))
B

~

(defun forgetf (key plist)
(loop$ with pl of-type list = plist
do
(cond ((null pl) (return nil))
((equal key (car pl))
(return (cadr pl)))
(t (setq pl (cddr pl))))))

When I say I'm not sure why, I know that acl2 includes optimized alist lookups or something. It would make sense not to have get, which accesses a symbol's plist slot state - but getf is just an operation on a (property) list. I guess it is annoying to have getf and then not to have setf-getf.

Allowing, this proof is vacuous, but you can check theorems about pretty normal #lisp code:

(thm
(implies
(and
(equal plist '(:a 1 :b 2))
(equal key :b)
(equal x (forgetf key plist)))
(evenp x)))
..
Time: 0.00 seconds (prove: 0.00, print: 0.00, other: 0.00)
Prover steps counted: 112

Proof succeeded.

( forgetf is an admitted function; if you call it on the values given, what it returns is evenp).

I continued this skein of thought and examples over here: https://gamerplus.org/@screwlisp/116356122689124054
screwlisp (@[email protected])

https://lispy-gopher-show.itch.io/lispmoo2/devlog/1481398/homespun-acl2-handler-bind-condition-handling #acl2 simple introduction to acl2 for the #commonLisp inclined. loop$, apply$, thms oh my. In particular, I implement a model of a simple case of the common lisp condition system that is directly compatible with both ansi common lisp and acl2. (a computational logic for applicative common lisp). #firstOrderLogic #theoremProving #programming #logic #example Technically this is in support of my lisp / moo compatibility layer but I am not going to beleaguer the tag.

G+DBN