Logic I 권태경 To do so, it should include a language to express statements, a notation to simplify expressions. Logic Mathematical Logic.

Slides:



Advertisements
Similar presentations
1. Propositions A proposition is a declarative sentence that is either true or false. Examples of propositions: The Moon is made of green cheese. Trenton.
Advertisements

Foundations of Logic Mathematical Logic is a tool for working with elaborate compound statements. It includes: A formal language for expressing them.
Syllabus Every Week: 2 Hourly Exams +Final - as noted on Syllabus
From Chapter 4 Formal Specification using Z David Lightfoot
Propositional Calculus Math Foundations of Computer Science.
Copyright © Cengage Learning. All rights reserved.
Adapted from Discrete Math
The Foundations: Logic and Proofs
Discrete Mathematics Goals of a Discrete Mathematics Learn how to think mathematically 1. Mathematical Reasoning Foundation for discussions of methods.
Logical Equivalence & Predicate Logic
2009/9 1 Logic and Proofs §1.1 Introduction §1.2 Propositional Equivalences §1.3 Predicates and Quantifiers §1.4 Nested Quantifiers §1.5~7 Methods of Proofs.
Discrete Maths 2. Propositional Logic Objective
Discrete Mathematics and Its Applications
CompSci 102 Discrete Math for Computer Science January 17, 2012 Prof. Rodger.
2009/9 1 Logic and Proofs §1.1 Introduction §1.2 Propositional Equivalences §1.3 Predicates and Quantifiers §1.4 Nested Quantifiers §1.5~7 Methods of.
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Ch.1 (Part 1): The Foundations: Logic and Proofs Introduction.
Mathematical Structures A collection of objects with operations defined on them and the accompanying properties form a mathematical structure or system.
1 Propositional Logic Rosen 5 th ed., § Foundations of Logic: Overview Propositional logic:Propositional logic: –Basic definitions. –Equivalence.
Propositional Logic Foundations of Logic: Overview Propositional logic (§ ): – Basic definitions. (§1.1) – Equivalence rules & derivations. (§1.2)
Systems Architecture I1 Propositional Calculus Objective: To provide students with the concepts and techniques from propositional calculus so that they.
CS 285- Discrete Mathematics Lecture 2. Section 1.1 Propositional Logic Propositions Conditional Statements Truth Tables of Compound Propositions Translating.
Chapter 1: The Foundations: Logic and Proofs
1.1 CompSci 102© Michael Frank Today’s topics Propositional equivalencesPropositional equivalences Predicate logicPredicate logic Reading: Sections Reading:
1 CMSC 250 Discrete Structures CMSC 250 Lecture 1.
Propositional Calculus CS 270: Mathematical Foundations of Computer Science Jeremy Johnson.
September1999 CMSC 203 / 0201 Fall 2002 Week #1 – 28/30 August 2002 Prof. Marie desJardins.
Chapter 1: The Foundations: Logic and Proofs
The Foundations: Logic and Proof, Sets, and Foundations PROPOSITIONS A proposition is a declarative sentence that is either True or False, but not the.
Section 1.1. Section Summary Propositions Connectives Negation Conjunction Disjunction Implication; contrapositive, inverse, converse Biconditional Truth.
Mathematics for Comter I Lecture 2: Logic (1) Basic definitions Logical operators Translating English sentences.
رياضيات متقطعة لعلوم الحاسب MATH 226. Text books: (Discrete Mathematics and its applications) Kenneth H. Rosen, seventh Edition, 2012, McGraw- Hill.
1 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Lecture 01: Boolean Logic Sections 1.1 and 1.2 Jarek Rossignac.
Chapter 1. Chapter Summary  Propositional Logic  The Language of Propositions (1.1)  Logical Equivalences (1.3)  Predicate Logic  The Language of.
Module #1 - Logic 2016/7/91 Module #1: Logic (Textbook: §1.1~1.4) Dr. Chih-Wei Yi Department of Computer Science National Chiao Tung University.
Propositional Logic. Logic Logic: the science of reasoning, proof, thinking or inference. Logic allows us to analyze a piece of reasoning and determine.
Discrete Structures for Computer Science Presented By: Andrew F. Conn Slides adapted from: Adam J. Lee Lecture #1: Introduction, Propositional Logic August.
Chapter 1 Propositional Logic
Logic.
2. The Logic of Compound Statements Summary
Discrete Mathematics Lecture 1 Logic of Compound Statements
CSNB 143 Discrete Mathematical Structures
CSCE 235 Introduction to Discrete Structures
CS 202, Spring 2008 Epp, sections 1.1 and 1.2
Niu Kun Discrete Mathematics Chapter 1 The Foundations: Logic and Proof, Sets, and Functions Niu Kun 离散数学.
6/20/2018 Discrete Math A word about organization: Since different courses have different lengths of lecture periods, and different instructors go at different.
6/20/2018 Arab Open University Faculty of Computer Studies M131 - Discrete Mathematics 6/20/2018.
COT 3100, Spr Applications of Discrete Structures
(CSC 102) Discrete Structures Lecture 2.
Ch.1 (Part 1): The Foundations: Logic and Proofs
Mathematics for Computing
Propositional Logic (§1.1)
The Foundations: Logic and Proofs
Principles of Computing – UFCFA3-30-1
Propositional Calculus: Boolean Algebra and Simplification
Administrivia Course Web:
Information Technology Department
Propositional Equivalence (§1.2)
CS 220: Discrete Structures and their Applications
CS201: Data Structures and Discrete Mathematics I
CSE 311 Foundations of Computing I
Discrete Mathematics and its Applications
CSE 311 Foundations of Computing I
Discrete Mathematics and Its Applications Kenneth H
Lecture 2: Propositional Equivalences
Cs Discrete Mathematics
The Foundations: Logic and Proofs
Logic Logic is a discipline that studies the principles and methods used to construct valid arguments. An argument is a related sequence of statements.
Discrete Structures Prepositional Logic 2
CS201: Data Structures and Discrete Mathematics I
The Foundations: Logic and Proofs
Presentation transcript:

Logic I 권태경

To do so, it should include a language to express statements, a notation to simplify expressions. Logic Mathematical Logic is a tool for working with complicated compound statements. It includes: A language for expressing them. A concise notation for writing them. A methodology for objectively reasoning about their truth or falsity. It is the foundation for expressing formal proofs in all branches of mathematics. First of all, what is logic or mathematical logic? It is a way to express or handle a compound statement, normally by combining multiple simple statements More importantly, it should provide the method by which We can decide whether each statement is true or false Overall, the logic makes a basis for proving some statements In every area of math

Overview Propositional logic (§ ): –Basic definitions. –Equivalence rules & derivations. Predicate logic (§ ) –Predicates. –Quantified predicate expressions. –Equivalences & derivations. At large, there are two kinds of logic depending on the form and dependency of the statement If each statement can be judged by itself, it is a proposition On the other hand, if a statement’s truth value depends on some variables, it is a predicate We will look at predicate logic later on

Propositional Logic (§1.1) What is a proposition? -Washington D.C. is the capital of USA -Toronto is the capital of Canada -1+2=3 Topic #1 – Propositional Logic A proposition is a declarative sentence that is either true or false, but not both The truth value of a proposition Should be clearly determined Let’s look at some examples.

Definition of a Proposition A proposition (p, q, r, … ) is simply a statement (i.e., a declarative sentence) with a definite meaning, having a truth value that ’ s either true (T) or false (F) (not both) Topic #1 – Propositional Logic

Propositional Logic Propositional Logic is the logic of compound statements built from simpler statements using so-called Boolean connectives. Topic #1 – Propositional Logic

Another examples But, the following are NOT propositions: “ Who ’ s there? ” (interrogative, question) “ La la la la la. ” (meaningless interjection) “ Just do it! ” (imperative, command) “ ” (expression with a non-true/false value) Topic #1 – Propositional Logic

An operator or connective combines one or more operand expressions into a larger expression. (E.g., “ + ” in numeric expressions.) Unary operators take 1 operand (e.g., −3); binary operators take 2 operands (e.g. 3  4). Propositional or Boolean operators operate on propositions or truth values instead of on numbers. Operators / Connectives Before we go further, let me introduce Some concepts of mathematical terms An operator is applied to one or more operands In logic, an operator is applied to propositions, not numbers

Some Popular Boolean Operators Formal NameNicknameAritySymbol Negation operatorNOTUnary ¬ Conjunction operatorANDBinary  Disjunction operatorORBinary  Exclusive-OR operatorXORBinary  Implication operatorIMPLIESBinary  Biconditional operatorIFFBinary↔ Let’s look at some boolean operators Arity means how many operands are Used by the operator e.g., the negation operator is a unary operator Which requires a single operand While, other five operators are binary operators

The Negation Operator The unary negation operator “¬” (NOT) transforms a proposition into its logical negation. E.g. If p = “ I have brown hair. ” then ¬ p = “ I do not have brown hair. ” Truth table for NOT: T :≡ True; F :≡ False “:≡” means “is defined as” Operand column Result column

The Conjunction Operator The binary conjunction operator “  ” (AND) combines two propositions to form their logical conjunction. E.g. If p= “ I will have salad for lunch. ” and q= “ I will have steak for dinner. ”, then p  q= “ I will have salad for lunch and I will have steak for dinner. ” Conjunction: a complex sentence in logic true if and only if each of its components is true

Note that a conjunction p 1  p 2  …  p n of n propositions will have 2 n rows in its truth table. Also: ¬ and  operations together are sufficient to express any Boolean truth table! (universal) E.g. p OR q = NOT(NOT(p) AND NOT(q)) Conjunction Truth Table Operand columns

The Disjunction Operator The binary disjunction operator “  ” (OR) combines two propositions to form their logical disjunction. p= “ My car has a bad engine. ” q= “ My car has a bad carburetor. ” p  q= “ Either my car has a bad engine, or my car has a bad carburetor. ” Here, “either ~ or ~” is like “and/or” in English.

Note that p  q means that p is true, or q is true, or both are true! So, this operation is also called inclusive or, because it includes the possibility that both p and q are true. “¬” and “  ” together are also universal. Disjunction Truth Table Note difference from AND

Nested Propositional Expressions Use parentheses to group sub-expressions: “ I just saw my old friend, and either he ’ s grown or I ’ ve shrunk. ” = f  (g  s) – (f  g)  s would mean something different – f  g  s would be ambiguous By convention, “¬” takes precedence over both “  ” and “  ”. – ¬ s  f means ( ¬ s)  f, not ¬ (s  f)

A Simple Exercise Let p = “ It rained last night ”, q = “ The sprinklers came on last night, ” r = “ The lawn was wet this morning. ” Translate each of the following into English: ¬ p = r  ¬ p = ¬ r  p  q = “It didn’t rain last night.” “The lawn was wet this morning, and it didn’t rain last night.” “Either the lawn wasn’t wet this morning, or it rained last night, or the sprinklers came on last night.”

The Exclusive Or Operator The binary exclusive-or operator “  ” (XOR) combines two propositions to form their logical “ exclusive or ”. p = “ I will earn an A in this course, ” q = “ I will drop this course, ” p  q = “ I will either earn an A for this course, or I will drop it (but not both!) ”

Note that p  q means that p is true, or q is true, but not both! This operation is called exclusive or, because it excludes the possibility that both p and q are true. “¬” and “  ” together are not universal. Exclusive-Or Truth Table Note difference from OR.

Note that English “ or ” can be ambiguous regarding the “ both ” case! “ Pat is a singer or Pat is a writer. ” - “ Pat is a man or Pat is a woman. ” – Need context to disambiguate the meaning! In this class, assume that “ or ” means inclusive-or Natural Language is Ambiguous  

The Implication Operator The implication p  q states that p implies q. I.e., If p is true, then q is true; but if p is not true, then q could be either true or false. E.g., let p = “ You study hard. ” q = “ You will get a good grade. ” p  q = “ If you study hard, then you will get a good grade. ” (else, it could go either way) AntecedentConsequent

Implication Truth Table p  q is false only when p is true but q is not true. p  q does not say that p causes q! p  q does not require that p or q are ever true! E.g. “ (1=0)  pigs can fly ” is TRUE! The only False case!

Examples of Implications “ If this lecture ends, then the sun will rise tomorrow. ” True or False? “ If Tuesday is a day of the week, then I am a penguin. ” True or False? “ If 1+1=6, then Bush is president. ” True or False? “ If the moon is made of green cheese, then I am richer than Bill Gates. ” True or False?

English Phrases Meaning p  q “ p implies q ” “ if p, then q ” “ if p, q ” “ when p, q ” “ whenever p, q ” “ q if p ” “ q when p ” “ q whenever p ” “ p only if q ” “ p is sufficient for q ” “ q is necessary for p ” “ q follows from p ” “ q is implied by p ”

Converse, Inverse, Contrapositive Some terminology, for an implication p  q: Its converse is: q  p. Its inverse is: ¬ p  ¬ q. Its contrapositive: ¬ q  ¬ p. One of these three has the same meaning (same truth table) as p  q. Can you figure out which?

How do we know for sure? Proving the equivalence of p  q and its contrapositive using truth tables:

The biconditional operator The biconditional p  q states that p is true if and only if (IFF) q is true. p = “ Bush wins the 2004 election. ” q = “ Bush will be president for all of ” p  q = “ If, and only if, Bush wins the 2004 election, Bush will be president for all of ”

Biconditional Truth Table p  q means that p and q have the same truth value. Note this truth table is the exact opposite of  ’ s! –p  q means ¬ (p  q) p  q does not imply p and q are true, or cause each other.

Boolean Operations Summary We have seen 1 unary operator and 5 binary operators. Their truth tables are below.

Some Alternative Notations

Bits and Bit Operations A bit is a binary (base 2) digit: 0 or 1. Bits may be used to represent truth values. By convention: 0 represents “ false ” ; 1 represents “ true ”. Boolean algebra is like ordinary algebra except that variables stand for bits, + means “ or ”, and multiplication means “ and ”. –See chapter 10 for more details. Topic #2 – Bits

Bit Strings A Bit string of length n is an ordered series or sequence of n  0 bits. –More on sequences in §3.2. By convention, bit strings are written left to right: e.g. the first bit of “ ” is 1. When a bit string represents a base-2 number, by convention the first bit is the most significant bit. Ex =8+4+1=13. Topic #2 – Bits

Bitwise Operations Boolean operations can be extended to operate on bit strings as well as single bits. E.g.: Bit-wise OR Bit-wise AND Bit-wise XOR Topic #2 – Bits

X-or in cryptography Sender wants to send M to receiver M (Original plaintext): 1010 K (Key): 0011 M  K = 1001 (Encrypted ciphertext) 1001 transmitted Receiver already knows K K  (M  K) = 0011  1001 = 1010 original message!

End of §1.1 You have learned about: Propositions: What they are. Propositional logic operators ’ –Symbolic notations. –English equivalents. –Logical meaning. –Truth tables. Atomic vs. compound propositions. Alternative notations. Bits and bit-strings. Next section: §1.2 –Propositional equivalences. –How to prove them.

Propositional Equivalence (§1.2) Two syntactically (i.e., textually) different compound propositions may be the semantically identical (i.e., have the same meaning). We call them equivalent. In this section, we will learn –Various equivalence rules or laws. –How to prove equivalences using symbolic derivations. p  q  p  q Vs.

Logical Equivalence Compound proposition p is logically equivalent to compound proposition q, written p  q, IFF the compound proposition p  q is a tautology. Compound propositions p and q are logically equivalent to each other IFF p and q contain the same truth values as each other in all rows of their truth tables.

Ex. Prove that p  q   (  p   q). Proving Equivalence via Truth Tables F T T T T T T T T T F F F F F F F F T T

Tautologies and Contradictions A tautology is a compound proposition that is true no matter what the truth values of its atomic propositions are! Ex. p   p A contradiction is a compound proposition that is false no matter what! Ex. p   p Other compound propositions are contingencies( 사건명제 ).

Equivalence Laws - Examples Identity: p  T  p p  F  p Domination: p  T  T p  F  F Idempotent: p  p  p p  p  p Double negation:  p  p Commutative: p  q  q  p p  q  q  p Associative: (p  q)  r  p  (q  r) (p  q)  r  p  (q  r)

More Equivalence Laws Distributive: p  (q  r)  (p  q)  (p  r) p  (q  r)  (p  q)  (p  r) De Morgan ’ s:  (p  q)   p   q  (p  q)   p   q Trivial tautology/contradiction: p   p  T p   p  F

Defining Operators via Equivalences Using equivalences, we can define operators in terms of other operators. Exclusive or: p  q  (p  q)  (p  q) p  q  (p  q)  (q  p) Implies: p  q   p  q Biconditional: p  q  (p  q)  (q  p) p  q   (p  q)

An Example Problem Check using a symbolic derivation whether (p   q)  (p  r)   p  q   r. (p   q)  (p  r)  [Expand definition of  ]  (p   q)  (p  r) [Defn. of  ]   (p   q)  ((p  r)   (p  r)) [DeMorgan ’ s Law]  (  p  q)  ((p  r)   (p  r))  [associative law] cont.

Example Continued... (  p  q)  ((p  r)   (p  r))  [  commutative]  (q   p)  ((p  r)   (p  r)) [  associative]  q  (  p  ((p  r)   (p  r))) [distrib.  over  ]  q  (((  p  (p  r))  (  p   (p  r))) [assoc.]  q  (((  p  p)  r)  (  p   (p  r))) [trivial taut.]  q  ((T  r)  (  p   (p  r))) [domination]  q  (T  (  p   (p  r))) [identity]  q  (  p   (p  r))  cont.

End of Long Example q  (  p   (p  r)) [DeMorgan ’ s]  q  (  p  (  p   r)) [Assoc.]  q  ((  p   p)   r) [Idempotent]  q  (  p   r) [Assoc.]  (q   p)   r [Commut.]   p  q   r Q.E.D. (quod erat demonstrandum) (Which was to be demonstrated.)

Review: Propositional Logic (§§ ) Atomic propositions: p, q, r, … Boolean operators:       Compound propositions: s :  (p   q)  r Equivalences: p  q   (p  q) Proving equivalences using: –Truth tables. –Symbolic derivations. p  q  r …