Logic
Propositional Logic
| Propositions (truth variables): | p, q, nice, etc. |
| Operators: | and (&, ×, .), or (∨, +), not (¬), => (implies, ⇒), <= (if, implied by, ⇐), <=> (iff, if and only if, ⇔) |
| e.g. | p & q ⇒ p |
Propositional logic can be manipulated by an algorithm to detect tautology (always true), contradiction (always false) or satisfiable (sometimes true sometimes false).
Predicate Logic
| Predicates (truth functions): | p(...), q(...), odd(7), parent(william,charles), etc. |
| Operators: | and (&, ×, .), or (∨, +), not (¬), => (⇒), <= (⇐), <=> (⇔ iff) |
| Quantifiers: | ∀ (forall), ∃ (there exists) |
| Logical variables: | X, Y, Child, Parent, etc. |
| Constants: | 123, charles, etc. |
| Function names: | f(), hcf(,), etc. |
| e.g. | ∀ C, P, GP, parent(C,P) and parent(P,GP) => grandParent(C,GP). |
The logic programming language Prolog is based on predicate logic.