Part I: Propositional Calculus

Similar documents
Packet #1: Logic & Proofs. Applied Discrete Mathematics

Lecture 2. Logic Compound Statements Conditional Statements Valid & Invalid Arguments Digital Logic Circuits. Reading (Epp s textbook)

Introduction to Sets and Logic (MATH 1190)

CSC Discrete Math I, Spring Propositional Logic

Review. Propositional Logic. Propositions atomic and compound. Operators: negation, and, or, xor, implies, biconditional.

Logic. Propositional Logic: Syntax. Wffs

Examples: P: it is not the case that P. P Q: P or Q P Q: P implies Q (if P then Q) Typical formula:

Packet #2: Set Theory & Predicate Calculus. Applied Discrete Mathematics

Propositional Logic: Syntax

Logic, Sets, and Proofs

3/29/2017. Logic. Propositions and logical operations. Main concepts: propositions truth values propositional variables logical operations

Logical Operators. Conjunction Disjunction Negation Exclusive Or Implication Biconditional

Logic and Propositional Calculus

Logic and Propositional Calculus

1 The Foundation: Logic and Proofs

software design & management Gachon University Chulyun Kim

Unit I LOGIC AND PROOFS. B. Thilaka Applied Mathematics

MAT2345 Discrete Math

1 The Foundation: Logic and Proofs

Logic. Propositional Logic: Syntax

Computational Logic. Recall of First-Order Logic. Damiano Zanardini

The Logic of Compound Statements cont.

LECTURE NOTES DISCRETE MATHEMATICS. Eusebius Doedel

Logic: The Big Picture

Propositional Logic: Models and Proofs

2.2: Logical Equivalence: The Laws of Logic

Propositional Calculus

Exercises 1 - Solutions

PROPOSITIONAL CALCULUS

Foundations of Mathematics MATH 220 FALL 2017 Lecture Notes

CSE 311: Foundations of Computing. Lecture 3: Digital Circuits & Equivalence

What is Logic? Introduction to Logic. Simple Statements. Which one is statement?

Conjunction: p q is true if both p, q are true, and false if at least one of p, q is false. The truth table for conjunction is as follows.

CS 173 Lecture 2: Propositional Logic

Chapter Summary. Propositional Logic. Predicate Logic. Proofs. The Language of Propositions (1.1) Applications (1.2) Logical Equivalences (1.

Announcements CompSci 102 Discrete Math for Computer Science

Learning Goals of CS245 Logic and Computation

Section Summary. Section 1.5 9/9/2014

Propositional Logic Not Enough

Why Learning Logic? Logic. Propositional Logic. Compound Propositions

PREDICATE LOGIC. Schaum's outline chapter 4 Rosen chapter 1. September 11, ioc.pdf

Discrete Mathematics & Mathematical Reasoning Predicates, Quantifiers and Proof Techniques

2/2/2018. CS 103 Discrete Structures. Chapter 1. Propositional Logic. Chapter 1.1. Propositional Logic

Truth-Functional Logic

Section 1.2 Propositional Equivalences. A tautology is a proposition which is always true. A contradiction is a proposition which is always false.

CHAPTER 1. MATHEMATICAL LOGIC 1.1 Fundamentals of Mathematical Logic

First Order Logic (FOL) 1 znj/dm2017

Chapter 1 Elementary Logic

Unit 1. Propositional Logic Reading do all quick-checks Propositional Logic: Ch. 2.intro, 2.2, 2.3, 2.4. Review 2.9

Informal Statement Calculus

COMP 2600: Formal Methods for Software Engineeing

Lecture Notes on DISCRETE MATHEMATICS. Eusebius Doedel

Chapter 2: Switching Algebra and Logic Circuits

Propositional Logic. Jason Filippou UMCP. ason Filippou UMCP) Propositional Logic / 38

Chapter 1, Section 1.1 Propositional Logic

CS1021. Why logic? Logic about inference or argument. Start from assumptions or axioms. Make deductions according to rules of reasoning.

COMP 182 Algorithmic Thinking. Proofs. Luay Nakhleh Computer Science Rice University

Discrete Mathematical Structures. Chapter 1 The Foundation: Logic

Propositional natural deduction

EECS 1028 M: Discrete Mathematics for Engineers

Mat 243 Exam 1 Review

Discrete Mathematics and Its Applications

1.1 Language and Logic

Compound Propositions

Tautologies, Contradictions, and Contingencies

2/13/2012. Logic: Truth Tables. CS160 Rosen Chapter 1. Logic?

Logic Overview, I. and T T T T F F F T F F F F

Chapter 1, Part I: Propositional Logic. With Question/Answer Animations

KP/Worksheets: Propositional Logic, Boolean Algebra and Computer Hardware Page 1 of 8

CS2742 midterm test 2 study sheet. Boolean circuits: Predicate logic:

Math 10850, fall 2017, University of Notre Dame

LECTURE NOTES DISCRETE MATHEMATICS. Eusebius Doedel

ICS141: Discrete Mathematics for Computer Science I

Propositional Logic. Spring Propositional Logic Spring / 32

Logic and Proof. Aiichiro Nakano

Formal Logic: Quantifiers, Predicates, and Validity. CS 130 Discrete Structures

Propositional Logic: Equivalence

CS100: DISCRETE STRUCTURES. Lecture 5: Logic (Ch1)

XOR - XNOR Gates. The graphic symbol and truth table of XOR gate is shown in the figure.

Logic and Boolean algebra

Logic and Proofs. (A brief summary)

n logical not (negation) n logical or (disjunction) n logical and (conjunction) n logical exclusive or n logical implication (conditional)

Tools for reasoning: Logic. Ch. 1: Introduction to Propositional Logic Truth values, truth tables Boolean logic: Implications:

Proposi'onal Logic Not Enough

Predicate Logic: Sematics Part 1

Section 1.1: Logical Form and Logical Equivalence

Logic and Proof. On my first day of school my parents dropped me off at the wrong nursery. There I was...surrounded by trees and bushes!

HW1 graded review form? HW2 released CSE 20 DISCRETE MATH. Fall

Propositional Equivalence

Boolean Algebra. Philipp Koehn. 9 September 2016

Intro to Logic and Proofs

Logic Propositional logic; First order/predicate logic

2. The Logic of Compound Statements Summary. Aaron Tan August 2017

2. Use quantifiers to express the associative law for multiplication of real numbers.

03 Review of First-Order Logic

10/5/2012. Logic? What is logic? Propositional Logic. Propositional Logic (Rosen, Chapter ) Logic is a truth-preserving system of inference

On my first day of school my parents dropped me off at the wrong nursery. There I was...surrounded by trees and bushes! 26-Aug-2011 MA

2-4: The Use of Quantifiers

Logic and Proofs. (A brief summary)

Comp487/587 - Boolean Formulas

Transcription:

Logic

Part I: Propositional Calculus

Statements Undefined Terms True, T, #t, 1 False, F, #f, 0 Statement, Proposition Statement/Proposition -- Informal Definition Statement = anything that can meaningfully be assigned a value of True or False Propositional Calculus = Study of Statements / Propositions Examples 1 + 1 = 2 (Yes) 2 + 2 = 3 (Yes) To be or not to be (No) This sentence is false. (No) x > 5 (No)

Formulas Formula A formula is a statement with free (unquantified) variables. A statement is a formula with no free (unquantified) variables. Analogy to Scheme Statement ~ expression with type Boolean Formula ~ (Lambda ( ) Boolean expression)

Operators Examples Andp^q (pq) Or p q (p+q) Not ~p ( p or pbar) Implies p q (p q) Iff p q (p q) Observations Propositional Calculus is the Calculus of Operators. Operators have the usual informal meanings. Formal meanings are provided by Truth tables.

Truth Tables Examples p q p^q p q ~p p q p q T T T T F T T T F F T F F F F T F T T T F F F F F T T T Conventions Or is inclusive: p or q or both XOR is exclusive: p or q, but not both -- p q p q is True whenever p is False p q is False only when p is True and q is False EXAMPLES

More Operators NAND, NOR, XOR p q ~(p^q) ~(p q) p q T T F F F T F T F T F T T F T F F T T F Observations There are 16 possible boolean operators on two parameters. Every one can be written solely in terms of NAND or NOR.

Bit Operations Idea -- Replace T and F by 1 and 0 Examples -- 11011011001 -- 10101100100 AND 10001000010 OR 11111111101 XOR 01110111101

Propositions Proposition -- Recursive Definition Base Case: p, q, r,... p ^ q, p q, ~p, p q, p q Parsing The inductive definition defines a tree. Parsing provided by the tree Parentheses needed for linear -- infix notation -- (p q)^r p (q^r)

Types of Propositions Tautology a proposition that is always True all rows in the Truth Table are true p ~p Contradiction a proposition that is always False all rows in the Truth Table are false p^~p Contingency a proposition that is neither a tautology nor a contradiction some rows in the Truth Table are True and some are rows are False p q

Logical Equivalence Definition p and q are logically equivalent if all rows in their Truth Table are the same. Notation p q Example (~p) q p q (Check Truth Table) Remark p q iff p q is a tautology Applications Proofs Computer Hardware -- Circuit Design

Implications Proposition Converse Inverse Contrapositive p q q p ~p q ~q ~p Observations A proposition is equivalent to its contrapositive. -- p q ~q ~p A proposition is NOT equivalent to its converse or inverse. -- Examples -- Truth Tables

Logical Equivalences (Boolean Algebra) 1. Identity p^t p p F p 2. Domination p T T p^f F 3. Idempotence p p p p^p p 4. Double Negation ~~ p p

More Logical Equivalences (Boolean Algebra) 5. Commutative p q q p p^q q^p 6. Associative p (q r) (p q) r p^(q^r) (p^q)^r 7. Distributive p (q^r) (p q)^(p r) p^(q r) (p^q) (p^r)

De Morgan s Laws De Morgan Laws ~ (p q) = (~ p) (~ q) ~ (p q) = (~ p) (~ q) Proofs by Truth Tables. Generalizes to more operators by Induction. ~ (p 1 p n ) = (~ p 1 ) (~ p n ) ~ (p 1 p n ) = (~ p 1 ) (~ p n )

Axiomatic Approach to Propositional Calculus 3 Axioms 1. P (Q P) 2. ( P (Q R) ) ((P Q) (P R) ) 3. ( ~ P ~ Q) ((~ P Q) P ) 1 Rule of Inference Prove: P and P Q Conclude: Q 2 Metatheorems Consistency: All the Theorems of Propositional Calculus are Tautologies. Completeness: All Tautologies are Theorems of the Propositional Calculus.

Axiomatic Approach to Arithmetic Axioms of Natural Numbers 1. 1 is a Natural Number. 2. If n is a natural number, then n +1 is a natural number. 3. Every natural number m except 1 is of the form m = n +1. 4. Every nonempty subset of the natural numbers has a smallest element. 5. Axioms for addition and multiplication. 1 Rule of Inference Prove: P and P Q Conclude: Q Godel s Incompleteness Theorem All Axioms for the Natural Numbers are either Inconsistent or Incomplete. There are Formulas in Arithmetic that are True, but that cannot be Proved.

Disjunctive Normal Form Construction For each row in the truth table where F( p, q, r, ) has the value True For each column with a primitive proposition p -- Write p if p has the value T -- Write ~p if p has the value F Let F (p,q,r, ) = p q ~ r {AND the columns} -- Then F (p, q, r, ) has the value T only along this row Let F( p, q, r, ) = F 1 (p, q, r, ) F 2 ( p, q, r, ) F n (p, q, r, ) Remarks AND has only one row with T OR has value T whenever one of its parameters has value T Examples p q (p^~q) ( p^q)

Functionally Complete Definition A collection of operators are called functionally complete if every proposition is equivalent to a proposition involving only these operators. Proposition 1: The operators ~, ^, are functionally complete. Proof: Follows from Disjunctive Normal Form. Proposition 2: The operators ~, ^ are functionally complete. Proof: Follows from Proposition 1 and De Morgan s Laws. Proposition 3: The operators ~, are functionally complete. Proof: Follows from Proposition 1 and De Morgan s Laws.

Functionally Complete (continued) Proposition 4: The operator NAND is functionally complete. Proof: Homework Proposition 5: The operators NOR is functionally complete. Proof Homework. Remark Propositions 4 and 5 are important in the design of logical gates.

SAT Definition A compound statement is said to be satisfiable if there is an assignment of truth values to the variables in the statement that makes the statement True. P vs. NP Determining in general whether a compound statement is satisfiable is an NP problem. Can be verified in polynomial time, but no solution yet in polynomial time. Only exponential time algorithms exist -- try all possibilities.

Part II: Predicate Calculus

Predicates Definition A Statement with Parameters, A Formula Examples P(x), Q(x, y) x > 0, x + y = z Predicate Calculus Study of Predicates and Quantifiers

Quantifiers All -- x P(x) means for all x, P(x) is True -- xp(x) is false when there is an x for which P(x) is False -- analogous to infinite AND Exists -- xp(x) means there exists at least one x for which P(x)) is True -- xp(x) is false when P(x) is False for every x -- analogous to infinite OR Domain -- Usually there is some universal set or domain implicitly understood. -- To be more explicit, we can write x Q P(x).

Syllogism All men are mortal. xp(x) M(x) Socrates is a man. P(s) {s=constant) Therefore Socrates is mortal. M(s)

Dummy Variables Definition x is a dummy variable means that x can be replaced by y. Examples xp(x) f (x)dx (lambda(x) (+x x))

Bound and Free Examples x( P(x) ) -- x is bound to x x(x < y) -- x is bound, y is free Free and bound apply only with respect to a specific scope { ( )} -- x ( xp(x) ) y(y > x) -- different x s -- different scopes

Scope Rules 1. A name (variable) refers to the innermost definition for that name. 2. Misuse of scope = common pitfall 3. Variables with no quantifiers, depend on context! a. sin2x + cos2x = 1 -- x b. x3 2x +1 = 0 -- x 4. Official Rule a. free variables are implicitly quantified by 5. Practical Rule a. depends on context b. get clarification

Substitution Definition P(t x) means result of substituting t for x -- t = term, x = variable Example P(x) = y(y > x) -- P(t x) = y(y > t) -- P(3z 2 + 2 x) = y(y > 3z 2 + 2) Capture P(x) = y(y > x) P(y x) = y(y > y) -- illegal, common pitfall

Rules for Manipulating Predicates 1. x yp(x,y) = y xp(x,y) 2. x yp(x,y) = y xp(x,y) 3. x yp(x,y) y xp(x,y) x yp(x,y) -- x cannot depend on y y xp(x,y) -- x can depend on y {x(y)} 4. ~ xp(x) = x P(x) De Morgan s 5. ~ xp(x) = x P(x) Laws 6. x{p(x)^q(x)} = { xp(x)}^{ xq(x)} Associativity and 7. x{p(x) Q(x)} = { xp(x)} { x Q(x)} Commutativity Laws

Rules for Manipulating Predicates (continued) 8. x{p(x) Q(x)} { xp(x)} { xq(x)} And/Or { xp(x)} { xq(x)} -- different x for P and Q x{p(x) Q(x)} -- same x for P and Q 9. x{p(x)^q(x)} { xp(x)}^{ x Q(x)} Don t Commute x{p(x)^q(x)} -- same x for P and Q { xp(x)}^{ x Q(x)} -- different x for P and Q 10. If x is not free in P, then P = xp(x) P = xp(x) 11. x{p(x) Q(x)} = x{p(x) Q(x)}^ x{q(x) P(x)}

Analogies 1. AND 2. OR Note these analogies are exact over finite domains.