Prolog Cookbook

  1. Documenting, testing, and moduling
  2. Classical Logic
    1. Negation
      1. Not
      2. Difference
      3. Fill Values
      4. De Morgan's Law
    2. Conjunction
      1. And
      2. Intersection
      3. Inner Join
      4. Product
      5. Series
    3. Disjunction
      1. Or
      2. Union
      3. Outer Join
      4. Sum
      5. Parallel
    4. Implication
      1. Proofs
    5. Equivalence
  3. Automata
  4. Graph Traversal
    1. Depth First
    2. Breadth First
    3. Transitive Closures
  5. Route Finding
  6. Puzzle Solving

Proofs

The contrapositive law

(p ⇒ q) ⇔ (¬q ⇒ ¬p)

Proof by Contradiction

(¬p ⇒ 0) ⇔ p

Equivalence to Truth

(p ≡ 1) ≡ p

Deduction

(E1 AND E2 AND · · · AND Ek) ⇒ E

Modus ponens

(p AND (p ⇒ q)) ⇒ q

Resolution

((p + q)(¬p + r)) → (q + r)