Lisp Sli
Lisp Sli
LANGUAGE IDEAS
John McCarthy, Stanford University
Berlin, 2002 June 19
diff(e, v) ← if at e then
[if e = v then 1 else 0 ]
else if car e = P LU S then P LU S . maplist(cdr e, λu.dif f
else if car e = T IM ES then P LU S . maplist(cdr e, λu
maplist(cdr e, λw. if u eq w then dif f (car u, v) else
ASPECTS OF LISP
•
(defun append (u v)
(if
(null u)
v
(cons (car u) (append (cdr u) v))))
• u ∗ v ← if n u then v else a u . [d u ∗ v] is a
functional program.
Has(passenger, reservation, s) ≡
(∃s′ < s)Occurs(M akes(passenger, reservation), s)
∧¬(∃s′′)(s < s′′ < s′ ∧ Occurs(Cancel(P assenger, reserv
• An elephant is faithful one hundred percent. A r
is a promise to let the passenger on the airplane if h
when he shows up. One kind of Elephant output stat
promise, and correct Elephant programs fulfill their p
start :
i := n;
p := 0;
loop : if i = 0 then go to done;
i := i − 1;
goto loop;
done :
Here’s what mathematicians might have written in 19
programming languages existed.
pc(0) = 0;
i(t + 1) = if pc(t) =
else if pc(t) = 4 then i(t) − 1 else i(t);
p(t + 1) = if pc(t) =
else if pc(t) = 5 then p(t) + m else p(t)
pc(t + 1) = if pc(t) =
else if pc(t) = 5 then 2 else pc(t) + 1;
The proof that ∃t.(t ≥ 0 ∧ pc(t) = 6 ∧ p(t) = mn) fo
the sentences expressing the program and the laws of a
i.e. no theory of program correctness is needed. Ho
proof ideas are essentially the same as those used to
an algolic program terminates and that the outputs
correct relation to the inputs. Amir Pnueli and Nissi
had this idea before I did, but they mistakenly aband
temporal logic.