2.85k likes | 2.99k Views
A Short Introduction to Logic Summer School on Proofs as Programs 2002 Eugene (Oregon). Stefano Berardi Università di Torino stefano@di.unito.it http://www.di.unito.it/~stefano.
E N D
A Short Introduction to LogicSummer School on Proofs as Programs2002 Eugene (Oregon) Stefano Berardi Università di Torino stefano@di.unito.it http://www.di.unito.it/~stefano
The text of this short course on Logic, together with the text of the next short course onRealizability, may be found in the home page of the author http://www.di.unito.it/~stefano (look for the first line in the topic TEACHING)
Plan of the course • Lesson 1.Propositional Calculus. Syntax and Semantic. Proofs (Natural Deduction style). Completeness Result. • Lesson 2. Predicate Calculus. Syntax and Semantic. Proofs (Natural Deduction style). • Lesson 3.Gödel CompletenessTheorem. Validity. Completeness. • Lesson 4. Strong Normalization. Intuitionistic Logic. Strong Normalization. Structure of Norl proofs. • Next Course: Realization Interpretation.
Reference Text • Logic and Structure. Dirk van Dalen. 1994, Springer-Verlag. Pages 215.
Using the Textbook • What we skipped: • Model theory of Classical Logic (most of §3) • Second Order Logic (§ 4) • Model theory of Intuitionistic Logic (in §5) • Roughly speaking: Lessons 1,2,3,4 correspond to sections §1, §2, §3 and 4, §5 and 6 • of Van Dalen’s textbook. • Roughly speaking (and on the long run): in these Course Notes, one slide corresponds to one page of Van Dalen’s book.
Lesson 1 Propositional Calculus Syntax Semantic Proofs Completeness
Plan of Lesson 1 • We will quickly go through Syntax and Semantic of Propositional Calculus again. • § 1.1 Syntax. The set of formulas of Propositional Calculus. • § 1.2 Semantic. Truth tables, valuations, and tautologies. • We will really start the course from here: • § 1.3 Proofs. We introduce Natural Deduction formalization of Propositional Calculus. • § 1.4 Completeness. We prove that logical rules prove exactly all “true” propositions. • Forthcoming Lesson: First Order Logic
§ 1.1 Syntax • The symbol of the language. • Propositional symbols: p0, p1, p2, … • Connectives: (and), (or), (not), (implies), (is equivalent to), (false). • Parenthesis: (, ).
§ 1.1 Syntax • The set PROP of propositions: the smallest closed under application of connectives: • PROP • pi PROP for all iN • PROP ()PROP • ,PROP (), ( ), (), () PROP
§ 1.1 Syntax • Examples: • (p0) • ((p0)) • (p0 (p1 p2)) • (p0 (p1 p2)) • Correct expressions of Propositional Logic are full of unnecessary parenthesis.
§ 1.1 Syntax • Abbreviations. Let c=, , . We write p0 c p1 c p2 c … • in the place of (p0 c (p1 c (p2 c …))) • Thus, we write p0 p1 p2, p0p1 p2, … • in the place of (p0 (p1 p2)), (p0 (p1 p2))
§ 1.1 Syntax • We omit parenthesis whenever we may restore them through operator precedence: • binds more strictly than , , and , bind more strictly than , . • Thus, we write: • p0 for ((p0)), • p0 p1 for ((p0 ) p1) • p0 p1 p2 for ((p0 p1) p2), …
§ 1.1 Syntax • Outermost symbol. The outermost symbol of , pi,, (), (), (), () • are, respectively: ,pi,, ,,,
§ 1.1 Syntax • Immediate Subformulas : • Of and pi are none • Of is • Of (), ( ), (), () are , • is a subformula of iff there is some chain =0, …, n=, each formula being some immediate subformula of the next formula. • Subformulas of =((p0 p1) p2) are: itself, (p0 p1), p0, p1, p2.
§ 1.2 Semantic • Interpreting Propositional constant and connective. • Each proposition pi may be either T (true) or F (false). • is always F (false). • , , , , are interpreted as unary or binary map (or Truth Tables), computing the truth of a statement , (), (), (), (), • given to the truth of immediate subformulas , .
§ 1.2 Semantic • Truth table of .
§ 1.2 Semantic • Truth table of .
§ 1.2 Semantic • Disjunction is taken not exclusive: if, then both , may be true.
§ 1.2 Semantic • Implication is “material”: is true also for unrelated statements , : it only depends on the truth values of , .
§ 1.2 Semantic • Equivalence is identity of truth values.
§ 1.2 Semantic • Inductive definition. Fix any set I, any map v:NI, any bI, and for any unary (binary) connective c, some unary (binary) map Tc on I. • Then there is exactly one map h:PROPI, such that: • f(pi) = v(i) I for all iN, • f() = b I • f() = T(f()) I • f( c ) = Tc(f(), f()) I for all binary connectives c
§ 1.2 Semantic • A Valuation is any map v:N{T,F}, assigning truth values to Propositional constants. • Interpreting Propositional formulas. Any valuation v may be extended by an inductive definition to some map h:PROP{T,F}, by: • mapping into b=False, • using, as Tc, the truth table of connective c= , , , , . • For all PROP, we denote h() by []v {T,F}
§ 1.2 Semantic • Let PROP. • Tautologies. is a tautology iff for all valuations v we have []v =T. • Contradictions. is a contradiction iff for all valuations v we have []v =F. • Tautology conveys our intuitive idea of being “logically true”, or “true no matter what the Propositional constants are”.
§ 1.2 Semantic • Some examples of tautologies • Double Negation Law: . • Excluded Middle: . • An easy exercise: check that is a tautology, i.e., that []v = True • for all valuations v:N{T,F}.
§ 1.3 Proofs • Formal Proofs. We introduce a notion of formal proof of a formula : Natural Deduction. • A formal proof of is a tree • whose root is labeled , • and whose children are proofs of the assumptions 1, 2, 3, … of the rule r we used to conclude .
§ 1.3 Proofs • Natural Deduction: Rules. For each logical symbol c=, , , , and each formula with outermost connective c, we give: • A set of Introduction rules for c, describing under which conditions is true; • A set of Elimination rules for c, describing what we may infer from the truth of . • Elimination rules for c are justified in term of the Introduction rules for c we chose.
§ 1.3 Proofs • Natural Deduction: the missing connectives. • We treat , , • as abbreviating (), ()(), • We do not add specific rules for the connectives , .
§ 1.3 Proofs • Natural Deduction: notations for proofs. • Let be any formula, and be any unordered (finite or infinite) list of formulas. We use the notation … • abbreviated by |- , for: • “there is a proof of whose assumptions are included in ”.
§ 1.3 Proofs • Natural Deduction: crossing assumptions. • we use the notation , … • for: “we drop zero or more assumptions equal to from the proof of ”. \
§ 1.3 Proofs • Natural Deduction: assumptions of a proof 1 2 3 … r -------------------------------- • are inductively defined as: • all assumptions of proofs of 1, 2, 3, …, minus all assumptions we “crossed”.
§ 1.3 Proofs • Identity Principle: The simplest proof is: • having 1 assumption, , and conclusion the same . • We may express it by: |-, for all • We call this proof “The Identity Principle” (from we derive ).
§ 1.3 Proofs • Rules for • Introduction rules: none ( is always false). • Elimination rules: from the truth of (a contradiction) we derive everything: ---- • If |- , then |-, for all
§ 1.3 Proofs • Rules for • Introduction rules: -------- • If |- and |- then |-
§ 1.3 Proofs • Elimination rules: -------- ------- • • If |- , then |- and |-
§ 1.3 Proofs • Rules for • Introduction rules: -------- ------- • If |- or |- , then |-
§ 1.3 Proofs \ \ • Elimination rules: … … -------------------------------------- • If |- and ,|- and , |-, then |- • We may drop any number of assumptions equal to (to ) from the first (from the second) proof of
§ 1.3 Proofs \ • Rules for Introduction rule: … -------- • If , |- , then |- • We may drop any number of assumptions equal to from the proof of .
§ 1.3 Proofs • Elimination rule: ---------------- • If |- and |-, then |- .
§ 1.3 Proofs • The only axiom not associated to a connective, nor justified by some Introduction rule, is Double Negation: …. --- • If , |- , then |- • We may drop any number of assumptions equal to from the proof of . \
§ 1.3 Proofs • Lemma (Weakening and Substitution). • If |- and p, then p|-. • If |- and , |-, then |- . • Proof. • Any proof with all free assumptions in has all free assumption in p. • Replace, in the proof of with free assumptions all in ,, all free assumptions by a proof of with all free assumptions in .
§ 1.4 Completeness • Definition (Validity). |- is valid iff for all valuations v such that v(){True}, we have v()=True (iff for no valuation v we have v(){True}, v()=False). • Validity conveys the idea “|- is true no matter what the Propositional constants are”. • Definition (Consistency). is consistent iff (|-) is false (if does not prove ). • Definition (Completeness). is complete iff for all propositions , either |- or |- .
§ 1.4 Completeness • Correctness. If |- is true in Natural Deduction, then |-is valid. • Proof. Routine. By induction over the proof of |-, considering: • one case for each introduction and elimination rule, • one for the Identity rule, • one for Excluded middle.
§ 1.4 Completeness • Completeness Theorem. If |- is valid, then then |-is derivable in Natural Deduction. • Proof. • We will pass through many Lemmas: • Lemma 1 (Consistency). If |- is not derivable, then , is consistent. • Lemma 2 (Consistent Extension). For all formulas , if is consistent, then either , or , is consistent.
§ 1.4 Completeness • Lemma 3 (Complete Consistent extension). Any consistent set may be extended to some consistent complete set ’. • Lemma 4 (Valuation Lemma). For every complete consistent consistent set there is some valuation v such that v()={True}. • Lemma 5 (2nd Valuation Lemma). For every consistent set there is some valuation v such that v(){True}.
§ 1.4 Completeness • Lemma 1 (Consistency). If |- is not derivable, then , is consistent. • Proof. We will prove the contrapositive: if , |-, then |-. This statement follows by Double Negation.
§ 1.4 Completeness • Lemma 2 (Consistent Extension). For for all formulas , if is consistent, then either , or , is consistent. • Proof. We will prove the contrapositive: if ,|- and ,|-, then |-. • From ,|- and -Intr. we deduce |-. • From |- (by 1 above), the hypothesis ,|-, and Substitution, we conclude |-.
§ 1.4 Completeness • Lemma 3 (Complete Consistent extension). Any consistent set may be extended to some consistent complete set ’ (such that for all formulas , either ’|- or ’ |- ). • Proof. Fix any numbering of formulas 0, …, n, … . Let 0, …, n, … be the sequence of sets of formulas defined by: • 0 = • n+1 = n, n, if n, n is consistent • n+1 = n, n if n, n is not consistent
§ 1.4 Completeness • Proof of Complete Consistent Extension . • (Consistency) By the Consistent Extension lemma, if n is consistent then n+1 is. Since 0 = is consistent, then all n are consistent. Thus, = nn is consistent (a proof of with assumptions in would have all assumptions in some n). • (Completeness) By construction, includes, for all formulas n, either n or n. By the Identity Principle, in the first case |-n, in the second one |-n .
§ 1.4 Completeness • Lemma 4 (Valuation Lemma). For every complete consistent set there is some valuation v such that v()={True}. • Proof. Define v()=T iff |-. We have to prove: • v() = F • v( ) = T v()=T or v()=T • v( ) = T v()=T and v()=T • v( ) = T v()=F or v()=T
§ 1.4 Completeness • v() = F because |- is false, by consistency of .