Discrete Mathematics Review

Size: px
Start display at page:

Download "Discrete Mathematics Review"

Transcription

1 CS 1813 Discrete Mathematics Discrete Mathematics Review or Yes, the Final Will Be Comprehensive 1

2 Truth Tables for Logical Operators P Q P Q False False False P Q False P Q False P Q True P Q True P True False True False True True True False True False False True True False False True True True True False True True False 2

3 Predicates and Quantifiers Predicate Parameterized collection of propositions P(x) Typically a different proposition for each x Universe of discourse Values that x may take Quantifiers x.p(x) True iff the proposition P(x) is True for every x in the universe of discourse x.p(x) True iff there is at least one x in the universe of discourse for which the proposition P(x) is True 3

4 Fig 2.1, Hall/O Donnell Discrete Mathematics with a Computer Springer, 2000 Rules of Inference Propositional Calculus 4

5 Inference Rules of Predicate Calculus Renaming Variables F(x) {x arbitrary, y not in F(x)} {R} F(y) x. F(x) {y not in F(x)} { R} y. F(y) x. F(x) {y not in F(x)} { R} y. F(y) Introducing/Eliminating Quantifiers F(x) {x arbitrary} { I} x. F(x) F(x) { I} x. F(x) { E} rule triggers discharge x. F(x) {universe is not empty} { E} F(x) x. F(x) F(x) A {x not free in A} { E} A...plus the inference rules of propositional calculus 5

6 Induction Rules of Inference P(0) n.(p(n) P(n+1)) {Ind} n.p(n) Induction n.(( m<n.p(m)) P(n)) {StrInd} n.p(n) Strong Induction t. (( s t. P(s)) P(t)) {TrInd} t.p(t) Tree Induction {P(v) B(v)} s {P(v)} {LInd} {P(v)} (while B(v) do s) {P(v) B(v)} Loop Induction s t means s is a proper subtree of t v is a set v of variables P(v) and B(v) are predicates cannot alter values in v s is a command s may alter values in v 6

7 Some Theorems in Rule Form a b { Comm} b a And Commutes a b b c { Chain} a c Implication Chain Rule a b b {modtol} a {nomiddle} a ( a) Modus Tollens Law of Excluded Middle a a { +&- } False a b { Comm} b a NeverBoth Or Commutes (a b) { ( )Comm} (b a) Not Or Commutes a b {conpos F } ( b) ( a) Contrapositive Fwd a b { F } ( a) b Implication Fwd 7

8 More Theorems in Rule Form (a b) {DeM F } ( a) ( b) DeMorgan Or Fwd (a b) {DeM F } ( a) ( b) DeMorgan And Fwd ( a) ( b) {DeM B } (a b) DeMorgan Or Bkw ( a) ( b) {DeM B } (a b) DeMorgan And Bkw a b a {disjsyll} b Disjunctive Syllogism ( a) { F } a Double Negation Fwd a { B } ( a) Double Negation Bkw 8

9 From Fig 2.1, Hall & O Donnell, Discrete Math with a Computer, Springer, 2000 Some Laws of Boolean Algebra 9

10 More Laws of Boolean Algebra From Fig 2.1, Hall & O Donnell, Discrete Math with a Computer, Springer, 2000 (a b) b = b { absorption} (a b) b = b { absorption} (a b) c = (a c) (b c) { imp} ((a b) (a c) (b c)) c { Elim} 10

11 Algebraic Laws of Predicate Calculus x not free in q ( x. P(x)) ( y. Q(y)) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( x. f(x)) = ( y. f(y)) ( x. f(x)) = ( y. f(y)) ( ) ( ) y not in f(x) { R} { R} 11

12 x, y, z :: Integer xs, ys :: [Integer] or :: [Bool] -> Bool Haskell Type Specifications -- x, y, and z have type Integer -- sequences with Integer elements -- function with one argument argument is sequence with Bool elems delivers value of type Bool (++) :: [e] -> [e] -> [e] -- generic function with two arguments args are sequences with elems of same type type is not constrained (can be any type) delivers sequence with elements of same type as those in arguments sum :: Num n => [n] -> n -- generic function with one argument argument is a sequence with elems of type n n must a type of class Num Num is a set of types with +,, operations powerset :: (Eq e, Show e) => Set e -> Set(Set e) -- generic function with one argument argument is a set with elements of type e delivers set with elements of type (Set e) type e must be both class Eq and class Show Class Eq has == operator, Show displayable 12

13 Some Algebraic Laws of Software Algebraic law of sequence construction x : [x 1, x 2,, x n ] = [x, x 1, x 2,, x n ] -- (:) Algebraic laws of concatenation [ ] ++ ys = ys -- (++).[] (x : xs) ++ ys = x : (xs ++ ys) -- (++).: What is the type of (++)? (++) :: [a] -> [a] -> [a] Algebraic laws of foldr foldr ( ) z [ ] = z foldr ( ) z (x : xs) = x (foldr ( ) z xs) What is the type of foldr? foldr :: (a -> b -> b) -> b -> [a] -> b The big or -- (foldr).[] -- (foldr).: (\/) :: Bool -> Bool -> Bool -- little or satisfies Boolean laws for or = foldr (\/) False -- big or What is the type of or? or :: [Bool] -> Bool 13

14 More Algebraic Laws of Software sum(x: xs) = x + sum xs sum[ ] = 0 Theorem: sum = foldr (+) 0 Type: sum :: Num n => [n] -> n length(x: xs) = 1 + length xs length[ ] = 0 Theorem: length = foldr onemore 0 where onemore x n = 1 + n Type: length :: [a] -> Int (sum).: (sum).[] (length).: (length).[] (x: xs) ++ ys = x: (xs ++ ys) (++).: [ ] ++ ys = ys (++).[] Theorem: xs ++ ys = foldr (:) ys xs Type: (++) :: [a] -> [a] -> [a] concat(xs: xss) = xs ++ concat xss concat[ ] = [ ] Theorem: concat = foldr (++) [ ] Type: concat :: [[a]] -> [a] (concat).: (concat).[] 14

15 Still More Algebraic Laws of Software Pattern: foldr ( ) z [x 1, x 2,, x n-1, x n ] = x 1 (x 2 (x n-1 (x n z)) ) foldr ( ) z (x: xs) = x foldr ( ) z xs (foldr).: foldr ( ) z [ ] = z (foldr).[] Type: foldr :: (a -> b -> b) -> b -> [a] -> b Pattern: map f [x 1, x 2, x n ] = [f x 1, f x 2, f x n ] map f (x : xs) = (f x) : map f xs map f [ ] = [ ] Type: map :: (a -> b) -> [a] -> [b] (map).: (map).[] Pattern: zipwith b [x 1, x 2, x n ] [y 1, y 2, y n ] = [b x 1 y 1, b x 2 y 2, b x n y n ] Note: extra elements in either sequence are dropped zipwith b (x:xs) (y:ys) = (b x y): (zipwith xs ys) (zipw).: zipwith b [ ] ys = [ ] (zipw).[]-1 zipwith b xs [ ] = [ ] (zipw).[]-2 Type: zipwith :: (a -> b -> c) -> [a] -> [b] -> [c] 15

16 {2, 3, 5, 7, 11} 2 {2, 3, 5, 7, 11} Sets explicit enumeration stylized epsilon means element of = { } stylized Greek letter phi denotes empty set {x p x} set comprehension Denotes set with elements x, where (p x) is True {f x p x} set comprehension Denotes set with elements of form (f x), where (p x) is True A B x. (x A x B) subset A = B (A B) (B A) set equality A B = {x x A x B} union S = {x A S. x A} big union A B = {x x A x B} intersection S = {x A S. x A} big intersection A B = {x x A x B} set difference A = U A complement (U = universe) P(A) = {S S A} power set A B = {(a, b) a A b B} Cartesian product 16

17 Loop Induction for verifying properties of loops Loop precondition: P(x 1, x 2, x ξ ) proved True while B(x 1, x 2, x ξ ) body of loop Loop invariant: P(x 1, x 2, x ξ ) proved True P(x 1, x 2, x ξ ) B(x 1, x 2, x ξ ) is True Loop Induction Proof by Loop Induction Prove: P(x 1, x 2, x ξ ) is true when a loop begins Prove: same P(x 1, x 2, x ξ ) is true at end of each iteration Proof may assume P(x 1, x 2, x ξ ) was true on previous iterations Conclude: P(x 1, x 2, x ξ ) is True and B(x 1, x 2, x ξ ) is False if and when the loop terminates Requirement Computing B(x 1, x 2, x ξ ) does not affect values of x 1, x 2, x ξ 17

18 sum = foldr (+) 0 as a loop Function precondition: a[1..n] defined integer sum(integer a[ ]) integer n = length(a[ ]) integer k, s s = 0 k = 0 k Loop precondition: s = a[i] i=1 while (k < n) k = k+1 s = s + a[k] Loop invariant: s = a[i] i=1 return s Loop precondition True Subscript set for is empty and empty sums are 0, by convention Loop invariant True at end of loop if True at beginning κ+1 κ a[i] = a[κ+1] + i=1 k a[i] where κ denotes top-of-loop value of k i=1 Conclude s = a[i] i=1 at return (by loop induction) But what is k at return? Loop terminates with k = n by counting-loop theorem (coming up) k 18

19 The Counting-Loop Theorem A type, c, is a counting type if c includes operations suc::c -> c and (<), (=)::c -> c -> bool (suc m) n whenever (m < n) {Note: x y means (x < y) (x = y)} (m < n) (n iterate suc m) iterate f x = x : (iterate f (f x)) Computation pattern: iterate f x = [x, f x, f(f x), f(f(f x), ] Theorem (counting loop) If k, m, n :: c, and m n, and If neither cmd1 nor cmd2 affects the values of k, m, or n Then the following loop terminates and when it does, k = n k = m while (k < n) cmd1 k = suc k cmd2 19

20 What Is a Tree? Tree a diagram or graph that branches usually from a simple stem without forming loops or polygons Merriam-Webster a type of data structure in which each element is attached to one or more elements directly beneath it Webopedia a node, together with a sequence of trees inductive definition Tree terminology subtree a node in a tree, together with its sequence of trees root the node that, with its subtrees, comprises the entire tree interior node a node with a nonempty sequence of subtrees leaf a tree with an empty sequence of subtrees branch a line connecting a node to its subtrees (in tree diagram) binary tree a tree with no nodes having more than 2 subtrees 20

21 Binary Search Tree a formal representation data SearchTree key dat = Nub Cel key dat (SearchTree key dat) (SearchTree key dat) Key goes here Node data Left subtree (smaller keys) Type parameters key, dat Example key might be Int, for example (datatype with an ordering) dat could be any type, typically a tuple s :: SearchTree Int (String, Float, [String] ) s is a SearchTree key type Int (maybe a catalog order number) dat type tuple storing a String (product description), a Float (price), and a sequence of strings (inventory records) Nub leaf constructor Cel constructor, non-empty trees Right subtree (larger keys) 21

22 Big O Notation and Computation Time Bounding the rate of growth Given: functions f and g f is big-o of g, written f = O(g), means c, s. x > s. f(x) c g(x) Computation time for deal deal (x1: (x2: xs)) = ( x1: ys, x2: zs ) where (ys, zs) = deal xs deal [x] = ( [x], [ ] ) deal [ ] = ( [ ], [ ] ) T n = time required for to compute deal[x 1, x 2, x n ] Recurrence equations T 0 = T 1 = 3 T n =T n T n 4n, n > 0 3 ops: matching, []-build, pair-build 4 ops: matching, 2 insertions, pair-build plus deal sequence that is shorter by 2 that is, T n = O(n) prove by induction 22

23 What a Relation Is as a mathematical object Relation a definition A binary relation ( ) :: A B is a subset of the Cartesian product of A (the domain) and B (the codomain) Reflexive A B = {(a, b) a A, b B} a b means (a, b) Irreflexive Symmetric ::A A, a A. a a ::A A, a A. (a, a) ::A A, a, b A. a b b a Antisymmetric Transitive ::A A, a, b A. a b b a a = b ::A A, a, b, c A. a b b c a c Closure wrt P ::A A, {S S S has property P} 23

24 Partial Order Classes of Relations :: A A, reflexive, antisymmetric, transitive Total Order :: A A, partial order a, b A. (a, b) (b, a) Well Order :: A A, total order B, B A, B. b B. a A. (b, a) Equivalence Relation :: A A reflexive, symmetric, and transitive 24

25 What It All Means Completeness in Formal Systems If a = b, then a b (a, b arbitrary WFFs) If b is true whenever a is, there is a proof of a b Notions of Consistency in Formal Systems If a b, then a = b (a, b arbitrary WFFs) No WFF a such that both a and a Predicate Logic Consistent Inference preserves tautologies Inconsistency would make all WFFs tautologies Some WFFs aren t tautologies QED (consistency) Complete There is a proof for every tautology in predicate calculus More powerful formal systems (such as arithmetic or Haskell) are not complete 25

26 100s of inputs input signals Why Bother with Proofs? software output signals > 2 100s of possibilities Key presses Mouse gestures Files Databases computation Images Sounds Files Databases Software translates input signals to output signals A program is a constructive proof of a translation But what translation? Proofs can confirm that software works correctly Testing cannot confirm software correctness Practice with proofs improves software thinking 26

27 CS 1813 Discrete Mathematics Learning Goals Apply mathematical logic to prove software properties Predicate calculus and natural deduction Boolean algebra and equational reasoning Mathematical induction Understand fundamental data structures Sets Trees Functions and relations Additional topics Graphs Counting Algorithm Complexity proofs galore! proofs galore! proofs galore! proofs galore! proofs galore! proofs galore! 27

28 End of Lecture 28

Equations of Predicate Calculus

Equations of Predicate Calculus a = { null} a = { null} a = a { identity} a = a { identity} Some Equations of a a = a { idempotent} a a = a { idempotent} Boolean lgebra a b = b a { commutative} a b = b a { commutative} (a b) c = a (b

More information

Review of Propositional Calculus

Review of Propositional Calculus CS 1813 Discrete Mathematics Review of Propositional Calculus 1 Truth Tables for Logical Operators P Q P Q P Q P Q P Q P Q P 2 Semantic Reasoning with Truth Tables Proposition (WFF): ((P Q) (( P) Q)) P

More information

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

Packet #2: Set Theory & Predicate Calculus. Applied Discrete Mathematics CSC 224/226 Notes Packet #2: Set Theory & Predicate Calculus Barnes Packet #2: Set Theory & Predicate Calculus Applied Discrete Mathematics Table of Contents Full Adder Information Page 1 Predicate Calculus

More information

Lecture 10 CS 1813 Discrete Mathematics. Quantify What? Reasoning with Predicates

Lecture 10 CS 1813 Discrete Mathematics. Quantify What? Reasoning with Predicates Lecture 10 CS 1813 Discrete Mathematics Quantify What? Reasoning with Predicates 1 More Examples with Forall the Universal Quantifier L predicate about qsort L(n) length(qsort[a 1, a 2,, a n ] ) = n Universe

More information

Propositional Logic, Predicates, and Equivalence

Propositional Logic, Predicates, and Equivalence Chapter 1 Propositional Logic, Predicates, and Equivalence A statement or a proposition is a sentence that is true (T) or false (F) but not both. The symbol denotes not, denotes and, and denotes or. If

More information

n Empty Set:, or { }, subset of all sets n Cardinality: V = {a, e, i, o, u}, so V = 5 n Subset: A B, all elements in A are in B

n Empty Set:, or { }, subset of all sets n Cardinality: V = {a, e, i, o, u}, so V = 5 n Subset: A B, all elements in A are in B Discrete Math Review Discrete Math Review (Rosen, Chapter 1.1 1.7, 5.5) TOPICS Sets and Functions Propositional and Predicate Logic Logical Operators and Truth Tables Logical Equivalences and Inference

More information

Propositional Logic. What is discrete math? Tautology, equivalence, and inference. Applications

Propositional Logic. What is discrete math? Tautology, equivalence, and inference. Applications What is discrete math? Propositional Logic The real numbers are continuous in the senses that: between any two real numbers there is a real number The integers do not share this property. In this sense

More information

Packet #1: Logic & Proofs. Applied Discrete Mathematics

Packet #1: Logic & Proofs. Applied Discrete Mathematics Packet #1: Logic & Proofs Applied Discrete Mathematics Table of Contents Course Objectives Page 2 Propositional Calculus Information Pages 3-13 Course Objectives At the conclusion of this course, you should

More information

Foundations of Mathematics MATH 220 FALL 2017 Lecture Notes

Foundations of Mathematics MATH 220 FALL 2017 Lecture Notes Foundations of Mathematics MATH 220 FALL 2017 Lecture Notes These notes form a brief summary of what has been covered during the lectures. All the definitions must be memorized and understood. Statements

More information

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska LECTURE 1 Course Web Page www3.cs.stonybrook.edu/ cse303 The webpage contains: lectures notes slides; very detailed solutions to

More information

Lecture 9 CS 1813 Discrete Mathematics. Predicate Calculus. Propositions Plus Plus

Lecture 9 CS 1813 Discrete Mathematics. Predicate Calculus. Propositions Plus Plus Lecture 9 CS 1813 Discrete Mathematics Predicate Calculus Propositions Plus Plus 1 Predicate What is a Predicate? Parameterized collection of propositions P(x) Typically a different proposition for each

More information

Automata Theory and Formal Grammars: Lecture 1

Automata Theory and Formal Grammars: Lecture 1 Automata Theory and Formal Grammars: Lecture 1 Sets, Languages, Logic Automata Theory and Formal Grammars: Lecture 1 p.1/72 Sets, Languages, Logic Today Course Overview Administrivia Sets Theory (Review?)

More information

Logic, Sets, and Proofs

Logic, Sets, and Proofs Logic, Sets, and Proofs David A. Cox and Catherine C. McGeoch Amherst College 1 Logic Logical Operators. A logical statement is a mathematical statement that can be assigned a value either true or false.

More information

Part I: Propositional Calculus

Part I: Propositional Calculus 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

More information

Set Theory. CSE 215, Foundations of Computer Science Stony Brook University

Set Theory. CSE 215, Foundations of Computer Science Stony Brook University Set Theory CSE 215, Foundations of Computer Science Stony Brook University http://www.cs.stonybrook.edu/~cse215 Set theory Abstract set theory is one of the foundations of mathematical thought Most mathematical

More information

Mathematical Preliminaries. Sipser pages 1-28

Mathematical Preliminaries. Sipser pages 1-28 Mathematical Preliminaries Sipser pages 1-28 Mathematical Preliminaries This course is about the fundamental capabilities and limitations of computers. It has 3 parts 1. Automata Models of computation

More information

Lecture Notes on DISCRETE MATHEMATICS. Eusebius Doedel

Lecture Notes on DISCRETE MATHEMATICS. Eusebius Doedel Lecture Notes on DISCRETE MATHEMATICS Eusebius Doedel c Eusebius J. Doedel, 009 Contents Logic. Introduction............................................................................... Basic logical

More information

LECTURE NOTES DISCRETE MATHEMATICS. Eusebius Doedel

LECTURE NOTES DISCRETE MATHEMATICS. Eusebius Doedel LECTURE NOTES on DISCRETE MATHEMATICS Eusebius Doedel 1 LOGIC Introduction. First we introduce some basic concepts needed in our discussion of logic. These will be covered in more detail later. A set is

More information

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

2/2/2018. CS 103 Discrete Structures. Chapter 1. Propositional Logic. Chapter 1.1. Propositional Logic CS 103 Discrete Structures Chapter 1 Propositional Logic Chapter 1.1 Propositional Logic 1 1.1 Propositional Logic Definition: A proposition :is a declarative sentence (that is, a sentence that declares

More information

HANDOUT AND SET THEORY. Ariyadi Wijaya

HANDOUT AND SET THEORY. Ariyadi Wijaya HANDOUT LOGIC AND SET THEORY Ariyadi Wijaya Mathematics Education Department Faculty of Mathematics and Natural Science Yogyakarta State University 2009 1 Mathematics Education Department Faculty of Mathematics

More information

Informal Statement Calculus

Informal Statement Calculus FOUNDATIONS OF MATHEMATICS Branches of Logic 1. Theory of Computations (i.e. Recursion Theory). 2. Proof Theory. 3. Model Theory. 4. Set Theory. Informal Statement Calculus STATEMENTS AND CONNECTIVES Example

More information

3. Abstract Boolean Algebras

3. Abstract Boolean Algebras 3. ABSTRACT BOOLEAN ALGEBRAS 123 3. Abstract Boolean Algebras 3.1. Abstract Boolean Algebra. Definition 3.1.1. An abstract Boolean algebra is defined as a set B containing two distinct elements 0 and 1,

More information

Mid-Semester Quiz Second Semester, 2012

Mid-Semester Quiz Second Semester, 2012 THE AUSTRALIAN NATIONAL UNIVERSITY Mid-Semester Quiz Second Semester, 2012 COMP2600 (Formal Methods for Software Engineering) Writing Period: 1 hour duration Study Period: 10 minutes duration Permitted

More information

CSE 1400 Applied Discrete Mathematics Definitions

CSE 1400 Applied Discrete Mathematics Definitions CSE 1400 Applied Discrete Mathematics Definitions Department of Computer Sciences College of Engineering Florida Tech Fall 2011 Arithmetic 1 Alphabets, Strings, Languages, & Words 2 Number Systems 3 Machine

More information

WUCT121. Discrete Mathematics. Logic. Tutorial Exercises

WUCT121. Discrete Mathematics. Logic. Tutorial Exercises WUCT11 Discrete Mathematics Logic Tutorial Exercises 1 Logic Predicate Logic 3 Proofs 4 Set Theory 5 Relations and Functions WUCT11 Logic Tutorial Exercises 1 Section 1: Logic Question1 For each of the

More information

Propositional Logic: Models and Proofs

Propositional Logic: Models and Proofs Propositional Logic: Models and Proofs C. R. Ramakrishnan CSE 505 1 Syntax 2 Model Theory 3 Proof Theory and Resolution Compiled at 11:51 on 2016/11/02 Computing with Logic Propositional Logic CSE 505

More information

Logic. Propositional Logic: Syntax. Wffs

Logic. Propositional Logic: Syntax. Wffs Logic Propositional Logic: Syntax Logic is a tool for formalizing reasoning. There are lots of different logics: probabilistic logic: for reasoning about probability temporal logic: for reasoning about

More information

Propositional Logic: Part II - Syntax & Proofs 0-0

Propositional Logic: Part II - Syntax & Proofs 0-0 Propositional Logic: Part II - Syntax & Proofs 0-0 Outline Syntax of Propositional Formulas Motivating Proofs Syntactic Entailment and Proofs Proof Rules for Natural Deduction Axioms, theories and theorems

More information

CHAPTER 1. Relations. 1. Relations and Their Properties. Discussion

CHAPTER 1. Relations. 1. Relations and Their Properties. Discussion CHAPTER 1 Relations 1. Relations and Their Properties 1.1. Definition of a Relation. Definition 1.1.1. A binary relation from a set A to a set B is a subset R A B. If (a, b) R we say a is Related to b

More information

( V ametavariable) P P true. even in E)

( V ametavariable) P P true. even in E) Propositional Calculus E Inference rules (3.1) Leibniz: (3.2) Transitivity: (3.3) Equanimity: P = Q E[V := P ]=E[V := Q] P = Q Q = R P = R P P Q Q ( V ametavariable) Derived inference rules (3.11) Redundant

More information

Today s Topics. Methods of proof Relationships to logical equivalences. Important definitions Relationships to sets, relations Special functions

Today s Topics. Methods of proof Relationships to logical equivalences. Important definitions Relationships to sets, relations Special functions Today s Topics Set identities Methods of proof Relationships to logical equivalences Functions Important definitions Relationships to sets, relations Special functions Set identities help us manipulate

More information

Exercises 1 - Solutions

Exercises 1 - Solutions Exercises 1 - Solutions SAV 2013 1 PL validity For each of the following propositional logic formulae determine whether it is valid or not. If it is valid prove it, otherwise give a counterexample. Note

More information

Sample Problems for all sections of CMSC250, Midterm 1 Fall 2014

Sample Problems for all sections of CMSC250, Midterm 1 Fall 2014 Sample Problems for all sections of CMSC250, Midterm 1 Fall 2014 1. Translate each of the following English sentences into formal statements using the logical operators (,,,,, and ). You may also use mathematical

More information

n CS 160 or CS122 n Sets and Functions n Propositions and Predicates n Inference Rules n Proof Techniques n Program Verification n CS 161

n CS 160 or CS122 n Sets and Functions n Propositions and Predicates n Inference Rules n Proof Techniques n Program Verification n CS 161 Discrete Math at CSU (Rosen book) Sets and Functions (Rosen, Sections 2.1,2.2, 2.3) TOPICS Discrete math Set Definition Set Operations Tuples 1 n CS 160 or CS122 n Sets and Functions n Propositions and

More information

Logic. Propositional Logic: Syntax

Logic. Propositional Logic: Syntax Logic Propositional Logic: Syntax Logic is a tool for formalizing reasoning. There are lots of different logics: probabilistic logic: for reasoning about probability temporal logic: for reasoning about

More information

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

CS2742 midterm test 2 study sheet. Boolean circuits: Predicate logic: x NOT ~x x y AND x /\ y x y OR x \/ y Figure 1: Types of gates in a digital circuit. CS2742 midterm test 2 study sheet Boolean circuits: Boolean circuits is a generalization of Boolean formulas in which

More information

LECTURE NOTES DISCRETE MATHEMATICS. Eusebius Doedel

LECTURE NOTES DISCRETE MATHEMATICS. Eusebius Doedel LECTURE NOTES on DISCRETE MATHEMATICS Eusebius Doedel 1 LOGIC Introduction. First we introduce some basic concepts needed in our discussion of logic. These will be covered in more detail later. A set is

More information

Automata and Languages

Automata and Languages Automata and Languages Prof. Mohamed Hamada Software Engineering Lab. The University of Aizu Japan Mathematical Background Mathematical Background Sets Relations Functions Graphs Proof techniques Sets

More information

Finite Automata Theory and Formal Languages TMV027/DIT321 LP Recap: Logic, Sets, Relations, Functions

Finite Automata Theory and Formal Languages TMV027/DIT321 LP Recap: Logic, Sets, Relations, Functions Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2017 Formal proofs; Simple/strong induction; Mutual induction; Inductively defined sets; Recursively defined functions. Lecture 3 Ana Bove

More information

MATH 363: Discrete Mathematics

MATH 363: Discrete Mathematics MATH 363: Discrete Mathematics Learning Objectives by topic The levels of learning for this class are classified as follows. 1. Basic Knowledge: To recall and memorize - Assess by direct questions. The

More information

Discrete Mathematics. W. Ethan Duckworth. Fall 2017, Loyola University Maryland

Discrete Mathematics. W. Ethan Duckworth. Fall 2017, Loyola University Maryland Discrete Mathematics W. Ethan Duckworth Fall 2017, Loyola University Maryland Contents 1 Introduction 4 1.1 Statements......................................... 4 1.2 Constructing Direct Proofs................................

More information

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

COMP 182 Algorithmic Thinking. Proofs. Luay Nakhleh Computer Science Rice University COMP 182 Algorithmic Thinking Proofs Luay Nakhleh Computer Science Rice University 1 Reading Material Chapter 1, Section 3, 6, 7, 8 Propositional Equivalences The compound propositions p and q are called

More information

Propositional and Predicate Logic

Propositional and Predicate Logic 8/24: pp. 2, 3, 5, solved Propositional and Predicate Logic CS 536: Science of Programming, Spring 2018 A. Why Reviewing/overviewing logic is necessary because we ll be using it in the course. We ll be

More information

With Question/Answer Animations. Chapter 2

With Question/Answer Animations. Chapter 2 With Question/Answer Animations Chapter 2 Chapter Summary Sets The Language of Sets Set Operations Set Identities Functions Types of Functions Operations on Functions Sequences and Summations Types of

More information

Language of Propositional Logic

Language of Propositional Logic Logic A logic has: 1. An alphabet that contains all the symbols of the language of the logic. 2. A syntax giving the rules that define the well formed expressions of the language of the logic (often called

More information

Computation and Logic Definitions

Computation and Logic Definitions Computation and Logic Definitions True and False Also called Boolean truth values, True and False represent the two values or states an atom can assume. We can use any two distinct objects to represent

More information

Lecture Notes 1 Basic Concepts of Mathematics MATH 352

Lecture Notes 1 Basic Concepts of Mathematics MATH 352 Lecture Notes 1 Basic Concepts of Mathematics MATH 352 Ivan Avramidi New Mexico Institute of Mining and Technology Socorro, NM 87801 June 3, 2004 Author: Ivan Avramidi; File: absmath.tex; Date: June 11,

More information

CSE 1400 Applied Discrete Mathematics Proofs

CSE 1400 Applied Discrete Mathematics Proofs CSE 1400 Applied Discrete Mathematics Proofs Department of Computer Sciences College of Engineering Florida Tech Fall 2011 Axioms 1 Logical Axioms 2 Models 2 Number Theory 3 Graph Theory 4 Set Theory 4

More information

Automated Reasoning Lecture 5: First-Order Logic

Automated Reasoning Lecture 5: First-Order Logic Automated Reasoning Lecture 5: First-Order Logic Jacques Fleuriot jdf@inf.ac.uk Recap Over the last three lectures, we have looked at: Propositional logic, semantics and proof systems Doing propositional

More information

THE AUSTRALIAN NATIONAL UNIVERSITY Second Semester COMP2600 (Formal Methods for Software Engineering)

THE AUSTRALIAN NATIONAL UNIVERSITY Second Semester COMP2600 (Formal Methods for Software Engineering) THE AUSTRALIAN NATIONAL UNIVERSITY Second Semester 2012 COMP2600 (Formal Methods for Software Engineering) Writing Period: 3 hours duration Study Period: 15 minutes duration Permitted Materials: One A4

More information

Propositional and Predicate Logic

Propositional and Predicate Logic Propositional and Predicate Logic CS 536-05: Science of Programming This is for Section 5 Only: See Prof. Ren for Sections 1 4 A. Why Reviewing/overviewing logic is necessary because we ll be using it

More information

Section 1.1 Propositions

Section 1.1 Propositions Set Theory & Logic Section 1.1 Propositions Fall, 2009 Section 1.1 Propositions In Chapter 1, our main goals are to prove sentences about numbers, equations or functions and to write the proofs. Definition.

More information

Section 2.2 Set Operations. Propositional calculus and set theory are both instances of an algebraic system called a. Boolean Algebra.

Section 2.2 Set Operations. Propositional calculus and set theory are both instances of an algebraic system called a. Boolean Algebra. Section 2.2 Set Operations Propositional calculus and set theory are both instances of an algebraic system called a Boolean Algebra. The operators in set theory are defined in terms of the corresponding

More information

Reexam in Discrete Mathematics

Reexam in Discrete Mathematics Reexam in Discrete Mathematics First Year at the Faculty of Engineering and Science and the Technical Faculty of IT and Design August 15th, 2017, 9.00-13.00 This exam consists of 11 numbered pages with

More information

cse 311: foundations of computing Fall 2015 Lecture 6: Predicate Logic, Logical Inference

cse 311: foundations of computing Fall 2015 Lecture 6: Predicate Logic, Logical Inference cse 311: foundations of computing Fall 2015 Lecture 6: Predicate Logic, Logical Inference quantifiers x P(x) P(x) is true for every x in the domain read as for all x, P of x x P x There is an x in the

More information

Introduction. Foundations of Computing Science. Pallab Dasgupta Professor, Dept. of Computer Sc & Engg INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR

Introduction. Foundations of Computing Science. Pallab Dasgupta Professor, Dept. of Computer Sc & Engg INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR 1 Introduction Foundations of Computing Science Pallab Dasgupta Professor, Dept. of Computer Sc & Engg 2 Comments on Alan Turing s Paper "On Computable Numbers, with an Application to the Entscheidungs

More information

Why Learning Logic? Logic. Propositional Logic. Compound Propositions

Why Learning Logic? Logic. Propositional Logic. Compound Propositions Logic Objectives Propositions and compound propositions Negation, conjunction, disjunction, and exclusive or Implication and biconditional Logic equivalence and satisfiability Application of propositional

More information

Propositional and Predicate Logic - V

Propositional and Predicate Logic - V Propositional and Predicate Logic - V Petr Gregor KTIML MFF UK WS 2016/2017 Petr Gregor (KTIML MFF UK) Propositional and Predicate Logic - V WS 2016/2017 1 / 21 Formal proof systems Hilbert s calculus

More information

Predicate Logic & Quantification

Predicate Logic & Quantification Predicate Logic & Quantification Things you should do Homework 1 due today at 3pm Via gradescope. Directions posted on the website. Group homework 1 posted, due Tuesday. Groups of 1-3. We suggest 3. In

More information

Logic. Definition [1] A logic is a formal language that comes with rules for deducing the truth of one proposition from the truth of another.

Logic. Definition [1] A logic is a formal language that comes with rules for deducing the truth of one proposition from the truth of another. Math 0413 Appendix A.0 Logic Definition [1] A logic is a formal language that comes with rules for deducing the truth of one proposition from the truth of another. This type of logic is called propositional.

More information

Intro to Logic and Proofs

Intro to Logic and Proofs Intro to Logic and Proofs Propositions A proposition is a declarative sentence (that is, a sentence that declares a fact) that is either true or false, but not both. Examples: It is raining today. Washington

More information

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

Logic Overview, I. and T T T T F F F T F F F F Logic Overview, I DEFINITIONS A statement (proposition) is a declarative sentence that can be assigned a truth value T or F, but not both. Statements are denoted by letters p, q, r, s,... The 5 basic logical

More information

MATH 1090 Problem Set #3 Solutions March York University

MATH 1090 Problem Set #3 Solutions March York University York University Faculties of Science and Engineering, Arts, Atkinson MATH 1090. Problem Set #3 Solutions Section M 1. Use Resolution (possibly in combination with the Deduction Theorem, Implication as

More information

CSCE 222 Discrete Structures for Computing. Review for Exam 1. Dr. Hyunyoung Lee !!!

CSCE 222 Discrete Structures for Computing. Review for Exam 1. Dr. Hyunyoung Lee !!! CSCE 222 Discrete Structures for Computing Review for Exam 1 Dr. Hyunyoung Lee 1 Topics Propositional Logic (Sections 1.1, 1.2 and 1.3) Predicate Logic (Sections 1.4 and 1.5) Rules of Inferences and Proofs

More information

Propositional Logic: Syntax

Propositional Logic: Syntax Logic Logic is a tool for formalizing reasoning. There are lots of different logics: probabilistic logic: for reasoning about probability temporal logic: for reasoning about time (and programs) epistemic

More information

REVIEW QUESTIONS. Chapter 1: Foundations: Sets, Logic, and Algorithms

REVIEW QUESTIONS. Chapter 1: Foundations: Sets, Logic, and Algorithms REVIEW QUESTIONS Chapter 1: Foundations: Sets, Logic, and Algorithms 1. Why can t a Venn diagram be used to prove a statement about sets? 2. Suppose S is a set with n elements. Explain why the power set

More information

CHAPTER 1. MATHEMATICAL LOGIC 1.1 Fundamentals of Mathematical Logic

CHAPTER 1. MATHEMATICAL LOGIC 1.1 Fundamentals of Mathematical Logic CHAPER 1 MAHEMAICAL LOGIC 1.1 undamentals of Mathematical Logic Logic is commonly known as the science of reasoning. Some of the reasons to study logic are the following: At the hardware level the design

More information

Sets, Logic, Relations, and Functions

Sets, Logic, Relations, and Functions Sets, Logic, Relations, and Functions Andrew Kay September 28, 2014 Abstract This is an introductory text, not a comprehensive study; these notes contain mainly definitions, basic results, and examples.

More information

Logic and Proofs. (A brief summary)

Logic and Proofs. (A brief summary) Logic and Proofs (A brief summary) Why Study Logic: To learn to prove claims/statements rigorously To be able to judge better the soundness and consistency of (others ) arguments To gain the foundations

More information

Review CHAPTER. 2.1 Definitions in Chapter Sample Exam Questions. 2.1 Set; Element; Member; Universal Set Partition. 2.

Review CHAPTER. 2.1 Definitions in Chapter Sample Exam Questions. 2.1 Set; Element; Member; Universal Set Partition. 2. CHAPTER 2 Review 2.1 Definitions in Chapter 2 2.1 Set; Element; Member; Universal Set 2.2 Subset 2.3 Proper Subset 2.4 The Empty Set, 2.5 Set Equality 2.6 Cardinality; Infinite Set 2.7 Complement 2.8 Intersection

More information

Predicate Logic. Andreas Klappenecker

Predicate Logic. Andreas Klappenecker Predicate Logic Andreas Klappenecker Predicates A function P from a set D to the set Prop of propositions is called a predicate. The set D is called the domain of P. Example Let D=Z be the set of integers.

More information

Formal Epistemology: Lecture Notes. Horacio Arló-Costa Carnegie Mellon University

Formal Epistemology: Lecture Notes. Horacio Arló-Costa Carnegie Mellon University Formal Epistemology: Lecture Notes Horacio Arló-Costa Carnegie Mellon University hcosta@andrew.cmu.edu Logical preliminaries Let L 0 be a language containing a complete set of Boolean connectives, including

More information

CS589 Principles of DB Systems Fall 2008 Lecture 4e: Logic (Model-theoretic view of a DB) Lois Delcambre

CS589 Principles of DB Systems Fall 2008 Lecture 4e: Logic (Model-theoretic view of a DB) Lois Delcambre CS589 Principles of DB Systems Fall 2008 Lecture 4e: Logic (Model-theoretic view of a DB) Lois Delcambre lmd@cs.pdx.edu 503 725-2405 Goals for today Review propositional logic (including truth assignment)

More information

Logic and Proofs. (A brief summary)

Logic and Proofs. (A brief summary) Logic and Proofs (A brief summary) Why Study Logic: To learn to prove claims/statements rigorously To be able to judge better the soundness and consistency of (others ) arguments To gain the foundations

More information

Today s topics. Introduction to Set Theory ( 1.6) Naïve set theory. Basic notations for sets

Today s topics. Introduction to Set Theory ( 1.6) Naïve set theory. Basic notations for sets Today s topics Introduction to Set Theory ( 1.6) Sets Definitions Operations Proving Set Identities Reading: Sections 1.6-1.7 Upcoming Functions A set is a new type of structure, representing an unordered

More information

1 The Foundation: Logic and Proofs

1 The Foundation: Logic and Proofs 1 The Foundation: Logic and Proofs 1.1 Propositional Logic Propositions( 명제 ) a declarative sentence that is either true or false, but not both nor neither letters denoting propositions p, q, r, s, T:

More information

COMP 2600: Formal Methods for Software Engineeing

COMP 2600: Formal Methods for Software Engineeing COMP 2600: Formal Methods for Software Engineeing Dirk Pattinson Semester 2, 2013 What do we mean by FORMAL? Oxford Dictionary in accordance with convention or etiquette or denoting a style of writing

More information

Chapter Summary. Sets The Language of Sets Set Operations Set Identities Functions Types of Functions Operations on Functions Computability

Chapter Summary. Sets The Language of Sets Set Operations Set Identities Functions Types of Functions Operations on Functions Computability Chapter 2 1 Chapter Summary Sets The Language of Sets Set Operations Set Identities Functions Types of Functions Operations on Functions Computability Sequences and Summations Types of Sequences Summation

More information

UNIVERSITY OF CALICUT SCHOOL OF DISTANCE EDUCATION B Sc (MATHEMATICS) I Semester Core Course. FOUNDATIONS OF MATHEMATICS (MODULE I & ii) QUESTION BANK

UNIVERSITY OF CALICUT SCHOOL OF DISTANCE EDUCATION B Sc (MATHEMATICS) I Semester Core Course. FOUNDATIONS OF MATHEMATICS (MODULE I & ii) QUESTION BANK UNIVERSITY OF CALICUT SCHOOL OF DISTANCE EDUCATION B Sc (MATHEMATICS) (2011 Admission Onwards) I Semester Core Course FOUNDATIONS OF MATHEMATICS (MODULE I & ii) QUESTION BANK 1) If A and B are two sets

More information

Handout on Logic, Axiomatic Methods, and Proofs MATH Spring David C. Royster UNC Charlotte

Handout on Logic, Axiomatic Methods, and Proofs MATH Spring David C. Royster UNC Charlotte Handout on Logic, Axiomatic Methods, and Proofs MATH 3181 001 Spring 1999 David C. Royster UNC Charlotte January 18, 1999 Chapter 1 Logic and the Axiomatic Method 1.1 Introduction Mathematicians use a

More information

Logic and Propositional Calculus

Logic and Propositional Calculus CHAPTER 4 Logic and Propositional Calculus 4.1 INTRODUCTION Many algorithms and proofs use logical expressions such as: IF p THEN q or If p 1 AND p 2, THEN q 1 OR q 2 Therefore it is necessary to know

More information

Chapter 4, Logic using Propositional Calculus Handout

Chapter 4, Logic using Propositional Calculus Handout ECS 20 Chapter 4, Logic using Propositional Calculus Handout 0. Introduction to Discrete Mathematics. 0.1. Discrete = Individually separate and distinct as opposed to continuous and capable of infinitesimal

More information

Unit I LOGIC AND PROOFS. B. Thilaka Applied Mathematics

Unit I LOGIC AND PROOFS. B. Thilaka Applied Mathematics Unit I LOGIC AND PROOFS B. Thilaka Applied Mathematics UNIT I LOGIC AND PROOFS Propositional Logic Propositional equivalences Predicates and Quantifiers Nested Quantifiers Rules of inference Introduction

More information

Department of Computer Science University at Albany, State University of New York Solutions to Sample Discrete Mathematics Examination II (Fall 2007)

Department of Computer Science University at Albany, State University of New York Solutions to Sample Discrete Mathematics Examination II (Fall 2007) Department of Computer Science University at Albany, State University of New York Solutions to Sample Discrete Mathematics Examination II (Fall 2007) Problem 1: Specify two different predicates P (x) and

More information

FOUNDATION OF COMPUTER SCIENCE ETCS-203

FOUNDATION OF COMPUTER SCIENCE ETCS-203 ETCS-203 TUTORIAL FILE Computer Science and Engineering Maharaja Agrasen Institute of Technology, PSP Area, Sector 22, Rohini, Delhi 110085 1 Fundamental of Computer Science (FCS) is the study of mathematical

More information

Tutorial Obtain the principal disjunctive normal form and principal conjunction form of the statement

Tutorial Obtain the principal disjunctive normal form and principal conjunction form of the statement Tutorial - 1 1. Obtain the principal disjunctive normal form and principal conjunction form of the statement Let S P P Q Q R P P Q Q R A: P Q Q R P Q R P Q Q R Q Q R A S Minterm Maxterm T T T F F T T T

More information

Predicate Logic: Syntax

Predicate Logic: Syntax Predicate Logic: Syntax Alice Gao Lecture 12 Based on work by J. Buss, L. Kari, A. Lubiw, B. Bonakdarpour, D. Maftuleac, C. Roberts, R. Trefler, and P. Van Beek 1/31 Outline Syntax of Predicate Logic Learning

More information

MATH 22 INFERENCE & QUANTIFICATION. Lecture F: 9/18/2003

MATH 22 INFERENCE & QUANTIFICATION. Lecture F: 9/18/2003 MATH 22 Lecture F: 9/18/2003 INFERENCE & QUANTIFICATION Sixty men can do a piece of work sixty times as quickly as one man. One man can dig a post-hole in sixty seconds. Therefore, sixty men can dig a

More information

Chapter 0 Introduction. Fourth Academic Year/ Elective Course Electrical Engineering Department College of Engineering University of Salahaddin

Chapter 0 Introduction. Fourth Academic Year/ Elective Course Electrical Engineering Department College of Engineering University of Salahaddin Chapter 0 Introduction Fourth Academic Year/ Elective Course Electrical Engineering Department College of Engineering University of Salahaddin October 2014 Automata Theory 2 of 22 Automata theory deals

More information

Chapter 1. Logic and Proof

Chapter 1. Logic and Proof Chapter 1. Logic and Proof 1.1 Remark: A little over 100 years ago, it was found that some mathematical proofs contained paradoxes, and these paradoxes could be used to prove statements that were known

More information

1 The Foundation: Logic and Proofs

1 The Foundation: Logic and Proofs 1 The Foundation: Logic and Proofs 1.1 Propositional Logic Propositions( ) a declarative sentence that is either true or false, but not both nor neither letters denoting propostions p, q, r, s, T: true

More information

Notes for Math 290 using Introduction to Mathematical Proofs by Charles E. Roberts, Jr.

Notes for Math 290 using Introduction to Mathematical Proofs by Charles E. Roberts, Jr. Notes for Math 290 using Introduction to Mathematical Proofs by Charles E. Roberts, Jr. Chapter : Logic Topics:. Statements, Negation, and Compound Statements.2 Truth Tables and Logical Equivalences.3

More information

3. Only sequences that were formed by using finitely many applications of rules 1 and 2, are propositional formulas.

3. Only sequences that were formed by using finitely many applications of rules 1 and 2, are propositional formulas. 1 Chapter 1 Propositional Logic Mathematical logic studies correct thinking, correct deductions of statements from other statements. Let us make it more precise. A fundamental property of a statement is

More information

Knowledge representation DATA INFORMATION KNOWLEDGE WISDOM. Figure Relation ship between data, information knowledge and wisdom.

Knowledge representation DATA INFORMATION KNOWLEDGE WISDOM. Figure Relation ship between data, information knowledge and wisdom. Knowledge representation Introduction Knowledge is the progression that starts with data which s limited utility. Data when processed become information, information when interpreted or evaluated becomes

More information

Review 1. Andreas Klappenecker

Review 1. Andreas Klappenecker Review 1 Andreas Klappenecker Summary Propositional Logic, Chapter 1 Predicate Logic, Chapter 1 Proofs, Chapter 1 Sets, Chapter 2 Functions, Chapter 2 Sequences and Sums, Chapter 2 Asymptotic Notations,

More information

Notes on Sets for Math 10850, fall 2017

Notes on Sets for Math 10850, fall 2017 Notes on Sets for Math 10850, fall 2017 David Galvin, University of Notre Dame September 14, 2017 Somewhat informal definition Formally defining what a set is is one of the concerns of logic, and goes

More information

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

2. The Logic of Compound Statements Summary. Aaron Tan August 2017 2. The Logic of Compound Statements Summary Aaron Tan 21 25 August 2017 1 2. The Logic of Compound Statements 2.1 Logical Form and Logical Equivalence Statements; Compound Statements; Statement Form (Propositional

More information

CS 250/251 Discrete Structures I and II Section 005 Fall/Winter Professor York

CS 250/251 Discrete Structures I and II Section 005 Fall/Winter Professor York CS 250/251 Discrete Structures I and II Section 005 Fall/Winter 2013-2014 Professor York Practice Quiz March 10, 2014 CALCULATORS ALLOWED, SHOW ALL YOUR WORK 1. Construct the power set of the set A = {1,2,3}

More information

Equivalence of Propositions

Equivalence of Propositions Equivalence of Propositions 1. Truth tables: two same columns 2. Sequence of logical equivalences: from one to the other using equivalence laws 1 Equivalence laws Table 6 & 7 in 1.2, some often used: Associative:

More information

Knowledge Representation and Reasoning

Knowledge Representation and Reasoning Knowledge Representation and Reasoning Geraint A. Wiggins Professor of Computational Creativity Department of Computer Science Vrije Universiteit Brussel Objectives Knowledge Representation in Logic The

More information