# 15-317 Constructive Logic Recitation 8: G4ip review and Prolog tutorial

Today in recitation, we reviewed some of the rules of the G4ip calculus by constructing a proof of the double-negation of Peirce's Law: ¬ ¬ (((P ⊃ Q) ⊃ P) ⊃ P). In constructing the proof, we discussed the importance of remembering choice points when we apply non-invertible rules like ⊃⊃L, although we never found ourselves needing to backtrack while proving this particular theorem. We also discussed the importance of never throwing a hypothesis away without good reason, in case it might be needed later in the proof.

After that, we played around with GNU Prolog a bit, writing the `plus` and `times` examples from class. We saw how `plus` could be used to compute subtraction, but `times` could not necessarily be used to compute (even exact) division. The intuitive reason is that `times` cannot be given an appropriate mode (i.e. specification of inputs and outputs) to be interpreted as division unless we rewrote it with a different subgoal order, in which case it could no longer be interpreted as multiplication. In both cases, the failure was to backtrack infinitely after finding one correct answer.

References:

• Plus and Times code in Prolog, with discussion of modes: plustimes.pl
(Recall that to load a file `file.pl` into Prolog, you give the query `['file.pl'].` at the `?-` prompt.)

fp@cs
Frank Pfenning