CSI30. Chapter 1. The Foundations: Logic and Proofs Rules of inference with quantifiers Logic and bit operations Specification consistency

Similar documents
CSL105: Discrete Mathematical Structures. Ragesh Jaiswal, CSE, IIT Delhi

Section 2.4: Arguments with Quantified Statements

Note: For #10 I have written out the solutions in more detail than you would be required to give.

CPSC 121: Models of Computation. Module 6: Rewriting predicate logic statements

THE LOGIC OF QUANTIFIED STATEMENTS

Solutions to Selected Exercises

PHIL 240, Introduction to Logic, Sections Fall 2011 FINAL EXAM 14 December Name (5 points): Section (5 points):

Quantification. Using the suggested notation, symbolize the statements expressed by the following sentences.

CSE Discrete Structures

Summary of Course Coverage

Homework 1 CS 1050 A Due:

Resolution (14A) Young W. Lim 6/14/14

Chapter 1.3 Quantifiers, Predicates, and Validity. Reading: 1.3 Next Class: 1.4. Motivation

The Specification Phase

Using first order logic (Ch. 8-9)

Automated Reasoning. Natural Deduction in First-Order Logic

Using first order logic (Ch. 8-9)

What is the study of logic?

CSE 311: Foundations of Computing. Lecture 8: Predicate Logic Proofs

CSE 20 DISCRETE MATH. Fall

Propositional Calculus: Boolean Algebra and Simplification. CS 270: Mathematical Foundations of Computer Science Jeremy Johnson

Standard Boolean Forms

III SEMESTER B. A. PHILOSOPHY PHL3B04 - SYMBOLIC LOGIC AND INFORMATICS QUESTION BANK FOR INTERNAL ASSESSMENT. Multiple Choice Questions

CSE20: Discrete Mathematics

MATH 139 W12 Review 1 Checklist 1. Exam Checklist. 1. Introduction to Predicates and Quantified Statements (chapters ).

Automated Reasoning PROLOG and Automated Reasoning 13.4 Further Issues in Automated Reasoning 13.5 Epilogue and References 13.

CSE 20 DISCRETE MATH. Winter

DISCRETE MATHEMATICS

2.2 Set Operations. Introduction DEFINITION 1. EXAMPLE 1 The union of the sets {1, 3, 5} and {1, 2, 3} is the set {1, 2, 3, 5}; that is, EXAMPLE 2

Self-reproducing programs. And Introduction to logic. COS 116: 3/6/2008 Sanjeev Arora

Notes. Notes. Introduction. Notes. Propositional Functions. Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry.

University of Illinois at Chicago Department of Computer Science. Final Examination. CS 151 Mathematical Foundations of Computer Science Fall 2012

Chapter 3. Set Theory. 3.1 What is a Set?

CS Bootcamp Boolean Logic Autumn 2015 A B A B T T T T F F F T F F F F T T T T F T F T T F F F

Intermediate Logic. Natural Deduction for FOL

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Discrete Mathematics

Practice Problems: All Computer Science majors are people. Some computer science majors are logical thinkers. Some people are logical thinkers.

CS112 Friday, September 12, 2008

Propositional Calculus. Math Foundations of Computer Science

MATH 271 Summer 2016 Assignment 4 solutions

(l) Represent each of the sets A, B and C using bit strings. Then, use bit string representation and bitwise logical operations to find

Truth Trees. Truth Tree Fundamentals

CITS2211 Discrete Structures Logic

(a) (4 pts) Prove that if a and b are rational, then ab is rational. Since a and b are rational they can be written as the ratio of integers a 1

Solutions to In-Class Problems Week 1, Fri

Propositional Logic. Andreas Klappenecker

A Brief Introduction to Truth-Table Logic. Kent Slinker Pima Community College

Introductory logic and sets for Computer scientists

Automatic Reasoning (Section 8.3)

Axiom 3 Z(pos(Z) X(X intersection of Z P(X)))

Discrete Mathematics and Probability Theory Fall 2016 Seshia and Walrand Midterm 1

Today s Lecture 4/13/ WFFs/ Free and Bound Variables 9.3 Proofs for Pred. Logic (4 new implicational rules)!

7/25/2016. Example: Addition of Unsigned Bit Patterns. ECE 120: Introduction to Computing. Adding Two Non-Negative Patterns Can Overflow

Math 115 Second Midterm March 25, 2010

FUZZY BOOLEAN ALGEBRAS AND LUKASIEWICZ LOGIC. Angel Garrido

Class 8 - September 13 Indirect Truth Tables for Invalidity and Inconsistency ( 6.5)

CSE101: Design and Analysis of Algorithms. Ragesh Jaiswal, CSE, UCSD

CSC Discrete Math I, Spring Sets

Declarative Programming. 2: theoretical backgrounds

Module 6. Knowledge Representation and Logic (First Order Logic) Version 2 CSE IIT, Kharagpur

CS 380/480 Foundations of Artificial Intelligence Winter 2007 Assignment 2 Solutions to Selected Problems

Homework 1. Due Date: Wednesday 11/26/07 - at the beginning of the lecture

9/19/12. Why Study Discrete Math? What is discrete? Sets (Rosen, Chapter 2) can be described by discrete math TOPICS

Bob Brown Math 251 Calculus 1 Chapter 4, Section 4 Completed 1 CCBC Dundalk

Workbook Unit 13: Natural Deduction Proofs (IV)

Formal Predicate Calculus. Michael Meyling

Section 2.2: Introduction to the Logic of Quantified Statements

6.034 Notes: Section 10.1

Introduction to Logic Programming

Lurch: A Word Processor that Can Grade Students Proofs

Introduction & Review

THE HALTING PROBLEM. Joshua Eckroth Chautauqua Nov

The three faces of homotopy type theory. Type theory and category theory. Minicourse plan. Typing judgments. Michael Shulman.

Lee Pike. June 3, 2005

Math 2300, Section #1; 14:00-15:15 MW P-101; Daily Notes Fall, 2015

Example of a Demonstration that a Problem is NP-Complete by reduction from CNF-SAT

CS158 Section B Exam 1 Key

1.3 Primitive Recursive Predicates and Bounded Minimalization

Knowledge Representation

2SAT Andreas Klappenecker

Diagnosis through constrain propagation and dependency recording. 2 ATMS for dependency recording

LOGIC AND DISCRETE MATHEMATICS

INTLOGS17 Test 1. Prof: S Bringsjord TA: Rini Palamittam NY

Basic Foundations of Isabelle/HOL

Lecture Notes 15 Number systems and logic CSS Data Structures and Object-Oriented Programming Professor Clark F. Olson

Inf2D 12: Resolution-Based Inference

Proving Theorems with Athena

1KOd17RMoURxjn2 CSE 20 DISCRETE MATH Fall

STABILITY AND PARADOX IN ALGORITHMIC LOGIC

An Introduction to Programming and Proving in Agda (incomplete draft)

Neural Networks Lesson 9 - Fuzzy Logic

Mathematically Rigorous Software Design Review of mathematical prerequisites

Example: NFA to DFA Conversion

CSC 501 Semantics of Programming Languages

Lecture 14: Lower Bounds for Tree Resolution

IN A NUTSHELL : WHAT IS A VENN DIAGRAM?

CSC313 High Integrity Systems/CSCM13 Critical Systems. CSC313/CSCM13 Chapter 1 1/ 38

Notes on Predicate Calculus

Predicate Logic CHAPTER What This Chapter Is About

Lecture 7: January 15, 2014

Transcription:

Chapter 1. The Foundations: Logic and Proofs 1.13 Rules of inference with quantifiers Logic and bit operations Specification consistency

1.13 Rules of inference with quantifiers universal instantiation x P (x) P (c) where c is a particular member of the domain existential instantiation x P( x) P(c) for some element c we cannot select arbitrary c, it must be a c from the domain such that P(c) is true universal generalization P(c) for any arbitrary c x P( x) existential generalization P(c) for some element c x P( x) where c is from the domain

1.13 Rules of inference with quantifiers x(p ( x) Q( x)) P(a)where a is a particular element of the domain Q (a) universal Modus Ponens x(p ( x) Q( x)) Q(a)where a isa particular element of the domain P(a) universal Modus Tollens

1.13 Rules of inference with quantifiers Example 1: (invalid argument) Let H(x) be x is happy. Given the premise x H (x) we conclude H(Lola). Therefore Lola is happy. What is wrong with the argument?

1.13 Rules of inference with quantifiers Example 1: (invalid argument) Let H(x) be x is happy. Given the premise x H (x) we conclude H(Lola). Therefore Lola is happy. What is wrong with the argument? Solution: we have x H ( x) H ( Lola)

1.13 Rules of inference with quantifiers Example 1: (invalid argument) Let H(x) be x is happy. Given the premise x H (x) we conclude H(Lola). Therefore Lola is happy. What is wrong with the argument? Solution: we have x H ( x) H ( Lola) mistake: we selected arbitrary x (Lola)

1.13 Rules of inference with quantifiers Example 2: for each argument determine whether the argument is correct or incorrect and explain why. a) All students in this class understand logic. Xavier is a student in this class. Therefore, he understands logic.

1.13 Rules of inference with quantifiers Example 2: for each argument determine whether the argument is correct or incorrect and explain why. a) All students in this class understand logic. Xavier is a student in this class. Therefore, he understands logic. x U (x) U ( Xavier)

1.13 Rules of inference with quantifiers Example 2: for each argument determine whether the argument is correct or incorrect and explain why. a) All students in this class understand logic. Xavier is a student in this class. Therefore, he understands logic. 1. x U ( x) 2.U ( Xavier) premise universal instantiation from 1

1.13 Rules of inference with quantifiers Example 2: for each argument determine whether the argument is correct or incorrect and explain why. b) Every Computer Science major takes discrete math. Maria is taking discrete math. Therefore, she is a Computer Science major.

1.13 Rules of inference with quantifiers Example 2: for each argument determine whether the argument is correct or incorrect and explain why. C(x) D(x) b) Every Computer Science major takes discrete math. Maria is taking discrete math. Therefore, she is a Computer Science major. x(c (x) D( x)) D( Maria) C (Maria)

1.13 Rules of inference with quantifiers Example 2: for each argument determine whether the argument is correct or incorrect and explain why. b) Every Computer Science major takes discrete math. Maria is taking discrete math. Therefore, she is a Computer Science major. x(c (x) D(x)) D( Maria) C (Maria) argument is incorrect (fallacy of affirming the conclusion)

1.13 Rules of inference with quantifiers Example 2: for each argument determine whether the argument is correct or incorrect and explain why. c) All parrots like fruit. My pet bird is not a parrot. Therefore, he doesn't like fruit.

1.13 Rules of inference with quantifiers Example 2: for each argument determine whether the argument is correct or incorrect and explain why. P(x) F(x) c) All parrots like fruit. My pet bird is not a parrot. Therefore, he doesn't like fruit. 1. 2. x(p(x) F (x)) P(my pet) premise premise F (my pet)

1.13 Rules of inference with quantifiers Example 2: for each argument determine whether the argument is correct or incorrect and explain why. P(x) F(x) c) All parrots like fruit. My pet bird is not a parrot. Therefore, he doesn't like fruit. 1. 2. x(p(x) F (x)) P(my pet) premise premise 3. P (my pet) F (my pet) universal instantiation from 1 Cannot derive F (my pet) - fallacy of denying the hypotheses

1.13 Rules of inference with quantifiers Example 2: for each argument determine whether the argument is correct or incorrect and explain why. d) Everyone who eats granola every day is healthy. Linda is not healthy. Therefore, Linda doesn't eat granola every day.

1.13 Rules of inference with quantifiers Example 2: for each argument determine whether the argument is correct or incorrect and explain why. G(x) H(x) d) Everyone who eats granola every day is healthy. Linda is not healthy. Therefore, Linda doesn't eat granola every day. 1. x(g(x) H (x)) 2. H ( Linda) premise premise G(Linda)

1.13 Rules of inference with quantifiers Example 2: for each argument determine whether the argument is correct or incorrect and explain why. G(x) H(x) d) Everyone who eats granola every day is healthy. Linda is not healthy. Therefore, Linda doesn't eat granola every day. 1. x(g(x) H (x)) 2. H ( Linda) premise premise 3. G(Linda) H ( Linda) univ. instantiation from 1 4. G(Linda) by Modus tollens from 2 & 3

Logic and Bit Operations In computer all the information is represented with bits (binary digit). Bit is a symbol with two possible values: 0 (zero), and 1(one) bit can be used to represent truth values:1 for True, 0 for False Boolean variable is a variable with two possible values (0,1) Note: Computer operations correspond to the logical operations. AND OR XOR x y x y x y x y 0 0 0 1 1 0 1 1 19

Logic and Bit Operations In computer all the information is represented with bits (binary digit). Bit is a symbol with two possible values: 0 (zero), and 1(one) bit can be used to represent truth values:1 for True, 0 for False Boolean variable is a variable with two possible values (0,1) Note: Computer operations correspond to the logical operations. AND OR XOR x y x y x y x y 0 0 0 0 1 0 1 0 0 1 1 1 20

Logic and Bit Operations In computer all the information is represented with bits (binary digit). Bit is a symbol with two possible values: 0 (zero), and 1(one) bit can be used to represent truth values:1 for True, 0 for False Boolean variable is a variable with two possible values (0,1) Note: Computer operations correspond to the logical operations. AND OR XOR x y x y x y x y 0 0 0 0 0 1 0 1 1 0 0 1 1 1 1 1 21

Logic and Bit Operations In computer all the information is represented with bits (binary digit). Bit is a symbol with two possible values: 0 (zero), and 1(one) bit can be used to represent truth values:1 for True, 0 for False Boolean variable is a variable with two possible values (0,1) Note: Computer operations correspond to the logical operations. AND OR XOR x y x y x y x y 0 0 0 0 0 0 1 0 1 1 1 0 0 1 1 1 1 1 1 0 22

Logic and Bit Operations In computer all the information is represented with bits (binary digit). Bit is a symbol with two possible values: 0 (zero), and 1(one) bit can be used to represent truth values:1 for True, 0 for False Boolean variable is a variable with two possible values (0,1) Note: Computer operations correspond to the logical operations. AND OR XOR x y x y x y x y 0 0 0 0 0 0 1 0 1 1 1 0 0 1 1 1 1 1 1 0 a bit string is a sequence of 0's and 1's. length of a bit string is the number of bits in the string Example: 00110101110 length=11 bit string 23

Logic and Bit Operations Exercise: find the bitwise OR, AND, and XOR of the bit strings 001110101 and 110101100 (from now on we'll be splitting the bit strings into blocks of four to make them easier to read). 0 0111 0101 1 1010 1100 0 0111 0101 1 1010 1100 ----------- AND ----------- OR 0 0111 0101 1 1010 1100 ----------- XOR x y x y x y x y 0 0 0 0 0 0 1 0 1 1 1 0 0 1 1 1 1 1 1 0 24

Logic and Bit Operations Exercise: find the bitwise OR, AND, and XOR of the bit strings 001110101 and 110101100 (from now on we'll be splitting the bit strings into blocks of four to make them easier to read). 0 0111 0101 1 1010 1100 ----------- 0 0010 0100 AND 0 0111 0101 1 1010 1100 ----------- OR 0 0111 0101 1 1010 1100 ----------- XOR x y x y x y x y 0 0 0 0 0 0 1 0 1 1 1 0 0 1 1 1 1 1 1 0 25

Logic and Bit Operations Exercise: find the bitwise OR, AND, and XOR of the bit strings 001110101 and 110101100 (from now on we'll be splitting the bit strings into blocks of four to make them easier to read). 0 0111 0101 1 1010 1100 ----------- 0 0010 0100 AND 0 0111 0101 1 1010 1100 ----------- 1 1111 1101 OR 0 0111 0101 1 1010 1100 ----------- XOR x y x y x y x y 0 0 0 0 0 0 1 0 1 1 1 0 0 1 1 1 1 1 1 0 26

Logic and Bit Operations Exercise: find the bitwise OR, AND, and XOR of the bit strings 001110101 and 110101100 (from now on we'll be splitting the bit strings into blocks of four to make them easier to read). 0 0111 0101 1 1010 1100 ----------- 0 0010 0100 AND 0 0111 0101 1 1010 1100 ----------- 1 1111 1101 OR 0 0111 0101 1 1010 1100 ----------- 1 1101 1001 XOR x y x y x y x y 0 0 0 0 0 0 1 0 1 1 1 0 0 1 1 1 1 1 1 0 27

Logic and Bit Operations Exercise: Evaluate expression (0 1101 1001) (01101 00111) 0 1101 0 1101 ------ OR ------ AND ------ 1001 0 0111 x y x y x y x y 0 0 0 0 0 0 1 0 1 1 1 0 0 1 1 1 1 1 1 0 28

Logic and Bit Operations Exercise: Evaluate expression (0 1101 1001) (01101 00111) 0 1101 1001 ------ 0 1101 OR 0 1101 0 0111 ------ 0 0101 AND ------ x y x y x y x y 0 0 0 0 0 0 1 0 1 1 1 0 0 1 1 1 1 1 1 0 29

Logic and Bit Operations Exercise: Evaluate expression (0 1101 1001) (01101 00111)=0 100 0 1101 1001 ------ 0 1101 OR 0 1101 0 0111 ------ 0 0101 AND 0 1101 0 0101 ------ 0 1000 x y x y x y x y 0 0 0 0 0 0 1 0 1 1 1 0 0 1 1 1 1 1 1 0 30

System Specifications Having hardware or software specification in natural language we would like to be able to translate them into logical expressions. This will make the specification precise and unambiguous, and can be used as basis for system development. System specification is consistent if and only if it doesn't have any conflicting requirements that could be used to derive a contradiction. When specifications are not consistent, there would be no way to develop a system that satisfies all specifications. Example 1: Determine whether the system specification is consistent (i.e. not contradictory) Whenever the system software is being upgraded, users cannot access the file system. If users can access the file system, then they can save new files. If users cannot save new files, then the system software is not being upgraded 31

System Specifications System specification is consistent if and only if it doesn't have any conflicting requirements that could be used to derive a contradiction. When specifications are not consistent, there would be no way to develop a system that satisfies all specifications. Example 1: Determine whether the system specification is consistent (i.e. not contradictory) Whenever the system software is being upgraded, users cannot access the file system. If users can access the file system, then they can save new files. If users cannot save new files, then the system software is not being upgraded p: the system software is being upgraded q: users can access the file system r: users can save new files 32

System Specifications System specification is consistent if and only if it doesn't have any conflicting requirements that could be used to derive a contradiction. When specifications are not consistent, there would be no way to develop a system that satisfies all specifications. Example 1: Determine whether the system specification is consistent (i.e. not contradictory) Whenever the system software is being upgraded, users cannot access the file system. If users can access the file system, then they can save new files. If users cannot save new files, then the system software is not being upgraded p: the system software is being upgraded q: users can access the file system r: users can save new files p q q r r p 33

System Specifications System specification is consistent if and only if it doesn't have any conflicting requirements that could be used to derive a contradiction. When specifications are not consistent, there would be no way to develop a system that satisfies all specifications. Example 1: Determine whether the system specification is consistent (i.e. not contradictory) Whenever the system software is being upgraded, users cannot access the file system. If users can access the file system, then they can save new files. If users cannot save new files, then the system software is not being upgraded p: the system software is being upgraded q: users can access the file system r: users can save new files p q q r r p let's check if there exists an assignment of truth values (to p, q, and r) that makes all of these compound propositions true. 34

System Specifications Example 1: Determine whether the system specification is consistent (i.e. not contradictory) p q q r r p let's check if there exists an assignment of truth values (to p, q, and r) that makes all of these compound propositions true. If p is True, then q should be also True (otherwise the implication p q will be False). Therefore q is False. From the second implication since q is False, r may have any truth value, since it anyway leads to q r being True. So let's see the last implication: r p.: we assumed that p is True, therefore p is False, and r has to have truth value False, in which case r is True. So, if p is True, q is False and r is True, each of our compound propositions are True. Therefore, the system specification is consistent. P.S. we could also do it with a truth table do it for practice. 35

System Specifications Example 2: Determine whether the system specification is consistent. The system is in multiuser state if and only if it is operating normally. If the system is operating normally the kernel is functioning. The kernel is not functioning or the system is in interrupt mode. If the system is not in multiuser state, then it is in interrupt mode. The system is not in interrupt mode. 36

System Specifications Example 2: Determine whether the system specification is consistent. The system is in multiuser state if and only if it is operating normally. If the system is operating normally the kernel is functioning. The kernel is not functioning or the system is in interrupt mode. If the system is not in multiuser state, then it is in interrupt mode. The system is not in interrupt mode. p: the system is in multiuser state q: it is operating normally r: the kernel is functioning s: the system is in interrupt mode p q q r r s p s s same technique: let's check if there exists an assignment of truth values (to p, q, r, and s) that makes all of these compound propositions true. 37

System Specifications Example 2: Determine whether the system specification is consistent. p q q r r s p s s same technique: let's check if there exists an assignment of truth values (to p, q, r, and s) that makes all of these compound propositions true. 1) s must be True, therefore s is False 2) if s is False, then in order for implication p s to be True, p must be also False. Therefore, p is True. 3) if p is True, then in order for p q to be True, q must be True. 4) if q is True then in order for q r to be True, r also must be True. 5) if r is True, and s is False, then r s is False False, which gives us False. So, there is no assignment of truth values that makes all of the above propositions true. Hence, the system specification is inconsistent. 38