# Prolog Cookbook

1. Documenting, testing, and moduling
2. Classical Logic
1. Negation
2. Conjunction
3. Disjunction
4. Implication
5. Equivalence
3. Automata
4. Graph Traversal
5. Route Finding
6. Puzzle Solving

# Sum

By Robert Laing

In 1863 William Stanley Jevons wrote to George Boole that surely Boole’s operation of addition should be replaced by the more natural ‘inclusive or’ (or ‘union’), leading to the law X+X=X. Boole completely rejected this suggestion (it would have destroyed his system based on ordinary algebra) and broke off the correspondence.The Algebra of Logic Tradition
pqp + q
111
101
011
000

As can be seen from the above quote, that `1 + 1 = 1` in logic arithmetic caused rancour between the field’s founding fathers, and does to this day. Jevons used a rotated ÷ symbol, ⋅∣⋅, for or instead of + to sidestep the problem.

Moving from binary to any number of propositions, the existential quantification symbol ∃(p) tends to be used, as in

∃(p) = p1 + p2 + … + pn

### Laws Analogous to Arithmetic

1. The commutative law for OR: (p + q) ≡ (q + p)
2. The associative law for OR: (p + (q + r)) ≡ ((p + q) + r)
3. The distributive law of AND over OR: p(q + r) ≡ (pq + pr)
4. 0 (FALSE) is the identity for OR: p OR 0 ≡ p

### Ways in Which AND and OR Differ from Plus and Times

1. 1 is the annihilator for OR: (1 OR p) ≡ 1
2. Idempotence of OR: p + p ≡ p