Presentation is loading. Please wait.

Presentation is loading. Please wait.

Brief Introduction to Logic. Outline Historical View Propositional Logic : Syntax Propositional Logic : Semantics Satisfiability Natural Deduction : Proofs.

Similar presentations


Presentation on theme: "Brief Introduction to Logic. Outline Historical View Propositional Logic : Syntax Propositional Logic : Semantics Satisfiability Natural Deduction : Proofs."— Presentation transcript:

1 Brief Introduction to Logic

2 Outline Historical View Propositional Logic : Syntax Propositional Logic : Semantics Satisfiability Natural Deduction : Proofs.

3 Historical view Philosophical Logic –500 BC to 19th Century Symbolic Logic –Mid to late 19th Century Mathematical Logic –Late 19 th to mid 20 th Century Logic in Computer Science

4 Philosophical Logic 500 B.C – 19th Century Logic dealt with arguments in the natural language used by humans. Example –All men are motal. –Socrates is a man –Therefore, Socrates is mortal.

5 Philosophical Logic Natural language is very ambiguous. –Eric does not believe that Mary can pass any test. –I only borrowed your car. –Tom hates Jim and he likes Mary. It led to many paradoxes. – This sentence is a lie. (The Liar s Paradox)

6 The Sophist s Paradox A Sophist is sued for his tuition by the school that educated him. He argued that he must win, since, if he loses, the school didn t educated him well enough, and doesn t deserve the money. The school argue that he must loss, since, if he win, he was educated well enough therefore should pay for it.

7 Symbolic Logic Mid to late 19th Century. Attempted to formulate logic in terms of a mathematical language Rules of inference were modeled after various laws for manipulating algebraic expressions.

8 Mathematical Logic Late 19 th to mid 20 th Century Frege proposed logic as a language for mathematics in With the rigor of this new foundation, Cantor was able to analyze the notion of infinity in ways that were previously impossible. (2 N is strictly larger than N) Russell s Paradox T = { S | S S}

9 Logic in Computer Science In computer science, we design and study systems through the use of formal languages that can themselves be interpreted by a formal system. –Boolean circuits –Programming languages –Design Validation and verification –AI, Security. Etc.

10 Logics in Computer Science Propositional Logic First Order Logic Higher Order Logic Theory of Construction Real-time Logic, Temporal Logic Process Algebras Linear Logic

11 Syntax The symbol of the language. Propositional symbols: A, B, C, … Prop: set of propositional symbols Connectives: (and), (or), (not), (implies), (is equivalent to), (false). Parenthesis: (, ).

12 Formulas Backus-Naur Form –Form := Prop | ( Form) | (Form o Form). Context-Free Grammar –Form Prop, –Form ( Form), –Form (Form o Form)

13 Formulas (2) The set of formulas, Form, is defined as the smallest set of expressions such that: 1.Prop Form 2.p Form ( p) Form 3.p,q Form (p o q) Form

14 Formulas (3) Examples: –( A) –( ( A)) –(A (B C)) –Correct expressions of Propositional Logic are full of unnecessary parenthesis.

15 Formulas (4) Abbreviations. Let o=,,. We write A o B o C o … in the place of (A o (B o (C o … ))) Thus, we write A B C, A B C, … in the place of (A (B C)), (A (B C))

16 Formulas (5) We omit parenthesis whenever we may restore them through operator precedence: binds more strictly than,, and, bind more strictly than,. Thus, we write: Afor ( ( A)), A B for (( A ) B) A B C for ((A B) C), …

17 Semantics Def) A truth assignment,, is an elements of 2 Prop (I.e., 2 Prop ). Two ways to think of truth assignment –1) X Prop –2) : Prop {0,1} Note : These notions are equivalence.

18 Philosopher s view |= p means – satisfies p or – is true of p or –p holds at or – is a model of p

19 Satisfaction Relation Def 1) |= (2 Prop x Form) – |= A if (A) =1 (or, A ) – |= p if it is not the case |= p. – |= p q if |= p and |= q – |= p q if |= p or |= q – |= p q if |= p implies |= q – |= p q if |= p iff |= q

20 Satisfaction Relation {A,B} |= A B –Iff {A,B} |= A and {A,B} |= B –Iff A {A,B} and B {A,B}

21 Electrical Engineer s view A mapping of voltages on a wire : Prop {0,1} – : {0,1} {0,1} (0) = 1 and (1) = 0 – : {0,1} 2 {0,1} (0,0)= (0,1)= (1,0)=0 and (1,1)=1 – : {0,1} 2 {0,1} (1,1)= (0,1)= (1,0)=1 and (0,0)=0

22 Semantics Def 2) –A( ) = (A) –( p)( ) = (p( )) –(p o q)( ) = o(p( ), q( )) Lemma) Let p Form and 2 Prop, then |= p iff p( ) = 1.

23 Software Engineer s view Intuition : a formula specifies a set of truth assignments. Def 3) Function Models : From 2 2 Prop –models(A) = { | (A) = 1}, A Prop –models( p) = 2 Prop – models(p) –models(p q) = models(p) models(q) –models(p q) = (2 Prop – models(p)) models(q)

24 Theorem Let p Form and 2 Prop, then the following statements are all true: –1. |= p –2. p( ) = 1 –3. models(p)

25 Relevance Lemma Let s use AP(p) to denote the set of all propositional symbols occurred in p. Let 1, 2 2 Prop, p Form. Lemma) if 1 | AP(p) = 2 | AP(p), then 1 |= p iff 2 |= p Corollary) | = p iff | AP(p) |= p

26 Algorithmic Perspective Truth Evaluation Problem –Given p Form and 2 AP(p), does |= p ? Does p( ) = 1 ? Eval(p, ): –If p A, return (A). –If p ( q), return (Eval(q, )) –If p (q o r), return o(Eval(p), Eval(q)) Eval uses polynomial time and space.

27 Extension of |= Let T 2 Prop, Form Def) T |= p if T models(p) –i.e., |= 2 2 Prop X Form Def) T |= if T models( ) –models( ) = p models(p) –I.e., |= 2 2 Prop X 2 Form

28 Extension of |= |= 2 Form x 2 Form Def) 1 |= 2 iff models( 1 ) models( 2 ) Iff for all 2 Prop if |= 1 then |= 2

29 Semantic Classification A formula p is called valid if models(p) = 2 Prop. We denote validity of the formula p by |=p A formula p is called satisfiable if models(p). A formula is not satisfiable is called unsatisfiable or contradiction.

30 Semantic Classification(II) Lemma –A formula p is valid iff p is unsatifiable –p is satisfiable iff p is not valid Lemma –p |= q iff |= (p q)

31 Satisfiability Problem Given a p, is p satisfiable? SAT(p) B:=0 for all 2 AP(p) B = B Eval(p, ) end return B NP-Complete

32 Proofs Formal Proofs. We introduce a notion of formal proof of a formula p: Natural Deduction. A formal proof of p is a tree whose root is labeled p and whose children are assumptions p 1, p 2, p 3, … of the rule r we used to conclude p.

33 Proofs Natural Deduction: Rules. For each logical symbol o=,,,, and each formula p with outermost connective o, we give: A set of Introduction rules for o, describing under which conditions p is true; A set of Elimination rules for o, describing what we may infer from the truth of p.

34 Proofs Natural Deduction: notations for proofs. Let p be any formula, and be a set of formulas. We use the notation … p abbreviated by |- p, for: there is a proof of p whose assumptions are included in.

35 Proofs Natural Deduction: assumptions of a proof p 1 p 2 p 3 … r p are inductively defined as: all assumptions of proofs of p 1, p 2, p 3, …, minus all assumptions we crossed.

36 Proofs Identity Principle: The simplest proof is: p p having 1 assumption, p, and conclusion the same p. We may express it by: |-p, for all p We call this proof The Identity Principle (from p we derive p).

37 Proofs Rules for Introduction rules: none ( is always false). Elimination rules: from the truth of (a contradiction) we derive everything: ---- p If |-, then |-p, for all p

38 Proofs Rules for Introduction rules: p q p q If |- p and |- q then |- p q

39 Proofs Elimination rules: p q p q If |- p q, then |- p and |- q

40 Proofs Rules for Introduction rule: [p] … q p q If,p |- q, then |-p q We may drop any number of assumptions equal to p from the proof of q.

41 Proofs Elimination rule: p q p q If |-p q and |-p, then |- q.

42 Proofs The only axiom not associated to a connective, nor justified by some Introduction rule, is Double Negation: [ p] …. --- p If, p|-, then |-p We may drop any number of assumptions equal to p from the proof of q.

43 Soundness |- p then |= p

44 Completeness |= p then |- p


Download ppt "Brief Introduction to Logic. Outline Historical View Propositional Logic : Syntax Propositional Logic : Semantics Satisfiability Natural Deduction : Proofs."

Similar presentations


Ads by Google