Review of Basic Logic
Total Page:16
File Type:pdf, Size:1020Kb
Review of Basic Logic Ben Pfaff <[email protected]> October 24, 2001 Contents 1 Notation 1 2 Tautologies 3 3 Substitution 4 4 Polarity 4 4.1 Polarity Proposition . 5 5 Removal of Quantifiers 5 5.1 Force of Quantifiers . 5 5.2 Removal of Strict Universal Force . 5 5.3 Removal of Strict Existential Force . 6 6 Unification 6 7 Deductive Tableaux 6 7.1 Simple Operations on Tableau . 6 7.2 Deductions on Tableaux . 7 7.2.1 Basic Deductions . 7 7.2.2 Resolution in Propositional Logic . 7 7.2.3 Resolution in Predicate Logic . 8 7.2.4 Equivalence . 8 7.2.5 Removal of Quantifiers . 8 1 Notation There are two textbooks on the reading list for this exam: Enderton, A Mathematical Introduction to Logic, and Manna and Waldinger, The Deductive Foundations of Computer Programming. These texts use completely different notation for logical operations. The table below summarizes the two notations. The comps mostly use Enderton’s notation, as will I. 1 Enderton Manna meaning > true logical truth ⊥ false logical untruth ¬a not a negation; logical “not” a ∧ b a and b conjunction; logical “and” a ∨ b a or b disjunction; logical “or” a → b if a then b implication; conditional if a then b else c conditional a ↔ b a ≡ b equivalence; biconditional; “if and only if” a + b exclusive disjunction; logical “xor”; equivalent to (a∧¬b)∨(b∧¬a) a ↓ b logical “nor”; equivalent to ¬(a ∨ b) a | b logical “nand”; equivalent to ¬(a ∧ b) a < b logical “less than”; equivalent to (¬a) ∧ b a > b logical “greater than”; equivalent to a ∧ (¬b) ∃x F (∃x)F existential qualifier; “there exists x such that F” ∀x F (∀x)F universal qualifier; “for all x, F” (∀∗)F universal closure: (∀x1, . , xn)F for all free variables xi in F (∃∗)F existential closure: (∃x1, . , xn)F for all free variables xi in F P t1 . tn P (t1, . , tn) application of predicate P ft1 . tn f(t1, . , tn) application of function f a ≈ b a = b equality Σ |= τ tautological implication; every truth assignment that satisfies ev- ery sentence in Σ also satisfies sentence τ; symbol |= pronounced “models” |=U τ sentence τ is true in structure U σ |= =| τ tautological equivalence; σ |= =| τ if and only if σ |= τ and τ |= σ Γ ` ϕ formula ϕ is a theorem deducible from set of formulas Γ Th K the theory of K; Th K = {σ : σ is true in every member of K} Mod Σ the class of all models of Σ; the class of all structures for the lan- guage in which every member of Σ is true Cn Σ consequences of Σ; Cn Σ = {σ :Σ |= σ} = Th Mod Σ N the set of natural numbers {0, 1, 2,... } Z the set of integers {..., −2, −1, 0, 1, 2,... } x αt α with free instances of x replaced by t The precedence of connectives and qualifiers is listed below, from highest to lowest. Associativity is to the right:(a → b → c) ↔ (a → (b → c). ¬ ∃ ∀ ∧ ∨ other connectives Definitions (from Enderton except where specified): • Propositional logic is logic involving variables, constants, logical connectives, true and false, and func- tions. Predicate logic or first-order logic adds quantifiers (∀ and ∃ and predicates. • Enderton regards ¬ and → as the fundamental connective and ∀ as the fundamental qualifier, and considers all other connectives (∧, ∨, . ) and qualifiers (∃) as abbreviations for combinations of these. • An alphabet is a set of symbols. • An expression is a finite sequence of symbols from an alphabet. It need not be in any sensible form. 2 • A term is an expression, either a single constant symbol or variable or a function that has terms as its arguments. A term must be syntactically correct. • An atomic formula is an expression that applies a predicate to a set of terms. An atomic formula must be syntactically correct. Manna calls this a proposition. • A wff or well-formed formula is an expression built up from atomic formulas by use of connective symbols and quantifiers. Manna calls this a sentence. An atomic formula is a wff. A wff must be syntactically correct. • A variable x is captured if it is qualified by ∀x, and free otherwise. Manna uses bound in place of captured. • A valid wff is one that is always true, regardless of the truth values of its free variables. A satisfiable wff is one that is true for at least one assignment of its free variables. • A sentence is a wff that has no free variables. On the other hand, Manna’s sentences are Enderton’s wffs; a closed sentence is one that has no free variables. • A structure specifies a set of things for the ∀ quantifier to refer to and meanings for functions and predicate symbols. Each structure U contains: – A nonempty set |U| called the universe of U, used as the domain for ∀. – A subset of |U|n as the domain for each n-argument predicate. – A member of |U| for each constant. – A mapping from every member of |U|n to |U| for each n-argument function. Manna refers to structures as interpretations and to a universe as a domain. • A class of structures K is an elementary class or first-order class if and only if K = Mod τ for some sentence τ. K is an elementary class in the wider sense if and only if K = Mod Σ for some set of sentences Σ. • A theory is a set of sentences closed under logical implication. A set of sentences T is a theory if and only if for every σ such that T |= σ, sigma is in T . 2 Tautologies These are useful for simplification but nonobvious at least to my eye. F, G, and H represent arbitrary wffs. • (true → G) ↔ G (false → F) ↔ true (F → true) ↔ true (F → false) ↔ ¬F • (F ↔ true) ↔ F (F ↔ false) ↔ ¬F • [(F → G) ∧ (G → H)] → (F → H) [(F ↔ G) ∧ (G ↔ H)] → (F ↔ H) • (F → G) ↔ (¬G → ¬F) (F ↔ G) ↔ (¬F ↔ ¬G) 3 • (F ∧ (G ∨ H)) ↔ ((F ∧ G) ∨ (F ∧ H)) (F ∨ (G ∧ H)) ↔ ((F ∨ G) ∧ (F ∨ H)) ((F ∨ G) → H) ↔ ((F → H) ∧ (G → H)) ((F ∧ G) → H) ↔ ((F → H) ∨ (G → H)) (F → (G ∨ H)) ↔ ((F → G) ∨ (F → H)) (F → (G ∧ H)) ↔ ((F → G) ∧ (F → H)) ((F ∧ G) → H) ↔ (F → (G → H)) • ¬(F ∨ G) ↔ (¬F ∧ ¬G) ¬(F ∧ G) ↔ (¬F ∨ ¬G) ¬(F → G) ↔ (F ∧ ¬G) ¬(F ↔ G) ↔ (F ↔ ¬G) • (F → G) ↔ (¬F ∨ G) (F ↔ G) ↔ ((F ∧ G) ∨ (¬F ∧ ¬G)) (F ↔ G) ↔ ((F → G) ∧ (G → F)) • (∀x)(∀y)F ↔ (∀y)(∀x)F (∃x)(∃y)F ↔ (∃y)(∃x)F (∃y)(∀x)F → (∀x)(∃y)F • ¬(∀x)F ↔ (∃x)¬F ¬(∃x)F ↔ (∀x)¬F • (∀x)[F ∧ G] ↔ ((∀x)F ∧ (∀x)G) (∀x)[F ∨ G] ↔ ((∀x)F ∨ (∀x)G) (∃x)[F → G] ↔ ((∀x)F → (∃x)G) • (∃x)[F ∧ G] → [(∃x)F ∧ (∃x)G] [(∀x)F ∨ (∀x)G] → (∀x)[F ∨ G] [(∃x)F → (∀x)G] → (∀x)[F → G] (∀x)[F → G] → [(∀x)F → (∀x)G] (∀x)[F ↔ G] → [(∀x)F ↔ (∀x)G] 3 Substitution If we first write F[G], and then later write F[H], the latter is the sentence obtained by replacing every occurrence of G in F[G] by H (Manna 30). G and H are not limited to single symbols; they may both be complex subsentences. The substitution is performed in one pass. If G is not present in F, then F[G] and F[H] are the same sentence. If F[G] contains subsentences of the form G1 ∧ G2 ∧ G3 ∧ · · · ∧ Gn, treat them as if they are parenthesized from the left: (··· ((G1 ∧ G2) ∧ G3) ∧ · · · ∧ Gn), and similarly for ∨. Similarly, if we we first write FhGi, and then later write FhHi, the latter is the sentence obtained by replacing zero or more occurrences of G in FhGi by H. This is called “partial substitution” (Manna 32). Multiple substitutions are available, too: first write F[G1,..., Gn], then later write F[H1,..., Hn] (Manna 33). If there is a choice of substitutions, apply the larger one: in F[P, P ∨Q], substitute for P ∨Q by preference. Multiple partial substitutions work similarly, except that there is no preference for larger substitutions. If quantifiers are involved, substitution is more complex (Manna 175). We must observe the rules for “safe substitution” in a replacement of F[G] by F[H]. First, only free instances of G are replaced. Second that, if H contains a quantifier such that substitution of G by H would capture a free variable y, we must first rename the variable y in the quantifier to a new variable y0 that does not occur in F[G] or in H. 4 Polarity The polarity of a subsentence is +, −, or (±) (Manna 41, 92, 191). The polarity of a full sentence is either + or −, depending on its context; if unspecified, assume +. Given a polarity π, −π is the opposite polarity: 4 if π is +, −π is −; if π is −, −π is +; otherwise, both π and −π are ±. Polarity are shown as superscripts in the list below, which can be used to determine the polarity of subsentences given the polarity of a full sentence: sentence polarity of subsentences [¬F]π ¬F −π [F ∨ G]π F π ∨ Gπ [F ∧ G]π F π ∧ Gπ [F → G]π F −π → Gπ [F ↔ G]π F ± ↔ G± [(∀x)F]π (∀x)F π [(∃x)F]π (∃x)F π A polarity is said to be positive if it is + or ±, negative if it is − or ±, strictly positive if it is +, or strictly negative if it is −. Given ShE+i, the notation ShF +i denotes the result of replacing zero or more strictly positive occurrences of E with F (Manna 45).