Lecture 9 CS 1813 – Discrete Mathematics

Slides:



Advertisements
Similar presentations
Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
Advertisements

© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Chapter 1: (Part 2): The Foundations: Logic and Proofs.
Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 1 Lecture 3 CS 1813 – Discrete Mathematics Truth Inference and the Logical Way.
EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 12 Number theory Mathematical induction Proof by induction Examples.
Lecture , 3.1 Methods of Proof. Last time in 1.5 To prove theorems we use rules of inference such as: p, p  q, therefore, q NOT q, p  q, therefore.
CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 1 Lecture 18 CS 1813 – Discrete Mathematics Loops Without Invariants Are Like.
INTRODUCTION TO THE THEORY OF COMPUTATION INTRODUCTION MICHAEL SIPSER, SECOND EDITION 1.
Mathematical preliminaries Episode 2 0 Sets Sequences Functions Relations Strings.
Mathematical Preliminaries (Hein 1.1 and 1.2) Sets are collections in which order of elements and duplication of elements do not matter. – {1,a,1,1} =
CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 1 Lecture 10 CS 1813 – Discrete Mathematics Quantify What? Reasoning with Predicates.
DISCRETE COMPUTATIONAL STRUCTURES
1 Introduction to Abstract Mathematics Predicate Logic Instructor: Hayk Melikya Purpose of Section: To introduce predicate logic (or.
CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 1 Lecture 2 CS 1813 – Discrete Mathematics Proofs Propositions and Calculuses.
CS 285- Discrete Mathematics Lecture 4. Section 1.3 Predicate logic Predicate logic is an extension of propositional logic that permits concisely reasoning.
CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 1 Lecture 19 CS 1813 – Discrete Mathematics Trees and Inductive Definitions.
Predicate Logic One step stronger than propositional logic Copyright © Curt Hill.
1 2/21/2016 MATH 224 – Discrete Mathematics Sequences and Sums A sequence of the form ar 0, ar 1, ar 2, ar 3, ar 4, …, ar n, is called a geometric sequence.
CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 1 Lecture 14 CS 1813 – Discrete Mathematics A Little Bit of Set Theory.
Discrete Mathematical Structures: Theory and Applications 1 Logic: Learning Objectives  Learn about statements (propositions)  Learn how to use logical.
CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 1 Lecture 17 CS 1813 – Discrete Mathematics How Does It Work in the Real World?
Chapter 2 1. Chapter Summary Sets (This Slide) The Language of Sets - Sec 2.1 – Lecture 8 Set Operations and Set Identities - Sec 2.2 – Lecture 9 Functions.
Sequences Lecture 11. L62 Sequences Sequences are a way of ordering lists of objects. Java arrays are a type of sequence of finite size. Usually, mathematical.
CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page 1 CS 1813 – Discrete Mathematics Review of Predicate Calculus Set Theory Inductive.
Sequences and Sums.
CSE15 Discrete Mathematics 02/13/17
CS 2210:0001 Discrete Structures Logic and Proof
MATH 224 – Discrete Mathematics
Propositional Equivalence
(State) Model-Based Approaches I Software Specification Lecture 35
Applied Discrete Mathematics Week 11: Relations
Functional Programming Lecture 12 - more higher order functions
COT 3100, Spring 2001 Applications of Discrete Structures
Formal Modeling Concepts
Knowledge Representation and Reasoning
Chapter 3 The Logic of Quantified Statements
CS1022 Computer Programming & Principles
Predicate Calculus Validity
Revisiting Predicate Logic LN chapters 3,4
Theory of Computation Lecture 22: Turing Machines III
Lecture 15 CS 1813 – Discrete Mathematics
CS 1813 – Discrete Mathematics
Lecture 12 CS 1813 – Discrete Mathematics
Lecture 3: Analysis of Algorithms
Rosen 5th ed., §3.2 ~9 slides, ~½ lecture
Lecture 13 CS 1813 – Discrete Mathematics
Mathematical Structures for Computer Science Chapter 1
CS201: Data Structures and Discrete Mathematics I
CS 1813 – Discrete Mathematics
Copyright © Cengage Learning. All rights reserved.
Lecture 16 CS 1813 – Discrete Mathematics
Alternating tree Automata and Parity games
Quizzes CS 1813 – Discrete Mathematics
Lecture 1 CS 1813 – Discrete Mathematics
Lecture 11 CS 1813 – Discrete Mathematics
First Order Logic Rosen Lecture 3: Sept 11, 12.
Lecture 15 — CS 2603 Applied Logic for Hardware and Software
Mathematical Background 1
Mathematical Background 1
Back to “Serious” Topics…
Copyright © Zeph Grunschlag,
CSCE 314: Programming Languages Dr. Dylan Shell
MA/CSSE 474 More Math Review Theory of Computation
Rosen 5th ed., §3.2 ~9 slides, ~½ lecture
Discrete Mathematics Lecture 3: Predicate and Quantifier
Discrete Mathematics CMP-200 Propositional Equivalences, Predicates & Quantifiers, Negating Quantified Statements Abdul Hameed
Discrete Mathematics and its Applications
Lecture 8 CS 1813 – Discrete Mathematics
CS201: Data Structures and Discrete Mathematics I
Theory of Computation Lecture 23: Turing Machines III
Presentation transcript:

Lecture 9 CS 1813 – Discrete Mathematics Lecture 9 - CS 1813 Discrete Math, University of Oklahoma 12/10/2018 Lecture 9 CS 1813 – Discrete Mathematics Predicate Calculus Propositions Plus Plus CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page

Lecture 9 - CS 1813 Discrete Math, University of Oklahoma 12/10/2018 What is a Predicate? Predicate Parameterized collection of propositions P(x) Typically a different proposition for each x Universe of discourse Values that x may take Must be specified Otherwise, all bets off — muchas contradicciónes Non-empty Empty universe calls for special handling Default assumption: non-empty universe CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page

Predicate on a Program for Sums Lecture 9 - CS 1813 Discrete Math, University of Oklahoma 12/10/2018 Predicate on a Program for Sums sum::[Rational] -> Rational function-type arrow, not implication Input (argument) Sequence of Rational values (ratios of whole numbers) Type: [Rational] — square brackets indicate sequence-type Output (value delivered): Rational — not a sequence (so, no brackets) Predicate S(n)  sum[x1, x2, …, xn] = x1 + x2 + … + xn S is a predicate — each equation S(n) is a different proposition Each S(n) is either True or False S(3) is the (atomic) proposition sum[x1, x2, x3] = x1 + x2 + x3 Universe of discourse (collection of values that parameterize S) Natural numbers N = {0, 1, 2, … } — a collection of infinite size Why not T([x1, x2, … xn]) instead of S(n)? Nothing wrong with T([x1, x2, … xn]) Universe of discourse for T: finite sequences of numbers Universe of discourse for S: counting numbers {0, 1, 2, …} CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page

Predicate on a Program for Maximums Lecture 9 - CS 1813 Discrete Math, University of Oklahoma Predicate on a Program for Maximums 12/10/2018 maximum :: [String] -> String Argument Sequence of strings (String means sequence of characters) Type: [String] — square brackets indicate sequence-type Value: String — not a sequence of strings (so, no brackets) Predicate B(n, k)  maximum[s1, s2, …, sn]  sk B is a predicate — each B(n, k) is a proposition (True or False) B(4,2) is the (atomic) proposition maximum[s1, s2, s3 , s4]  s2 Universe of discourse (collection of values that parameterize B) Pairs of non-zero natural numbers {(1,1), (2,1), (2,2), (3,1), … } where second number in pair does not exceed first Why not C([s1, s2, … sn], sk) instead of B(n, k)? C is ok, but depends on the strings si — not just on n and k Proofs involving B must take care to encompass arbitrary si’s Note: Proofs will work for any type of class Ord, not just String What is the universe of discourse for C([s1, s2, … sn], sk)? CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page

Another Predicate about Maximums Lecture 9 - CS 1813 Discrete Math, University of Oklahoma Another Predicate about Maximums 12/10/2018 maximum :: [String] -> String Argument Sequence of strings (String means sequence of characters) Type: [String] — square brackets indicate sequence-type Value: String — not a sequence of strings (so, no brackets) Predicate E(n, k)  maximum[s1, s2, …, sn] = sk E is a predicate —each equation E(n, k) is an atomic proposition Each E(n, k) is either True or False E(4,1) is the proposition maximum[s1, s2, s3 , s4] = s1 Universe of discourse (collection of values that parameterize E) Pairs of non-zero natural numbers {(1,1), (2,1), (2,2), (3,1), … } where second number in pair does not exceed first Is E(n, k) usually True or usually False? Would you expect E(n, k) to be True for some pairs (n, k)? Given a sequence of strings [s1, s2, … sn], would you expect to be able to find any values of k for which E(n, k) is true? CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page

Predicates about a Sorting Program Lecture 9 - CS 1813 Discrete Math, University of Oklahoma 12/10/2018 Predicates about a Sorting Program qsort :: Ord a => [a] -> [a] Argument Sequence of type [a] — where a is a type of class Ord Value — Also a sequence of type [a] Predicates L(n)  length(qsort[a1, a2, …, an] ) = n L is a predicate — each equation L(n) is a proposition Universe of discourse: Natural numbers N = {0, 1, 2, … } What does [a1, a2, …, an] mean when n = 0 Would you expect L(n) to be True, regardless of the ai’s? I(n, k)  (qsort[a1, a2, …, an] = [b1, b2, …, bn] )  (bk  bk+1 ) I is a predicate — each I(n, k) is a proposition (non-atomic, btw) Universe of discourse: Pairs of non-zero natural numbers where first number exceeds second {(2,1), (3,1), (3,2), (4,1), … } For what pairs would you expect I(n, k) to be True? R(n, j, k)  (qsort[a1, a2, …, an] = [b1, b2, …, bn] )  (aj = bk) Universe of discourse? Places in universe where R(n, j, k) is True? CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page

Predicates about Concatenation Lecture 9 - CS 1813 Discrete Math, University of Oklahoma 12/10/2018 Predicates about Concatenation (++) :: [a] -> [a] -> [a] Two arguments Sequences of type [a] — where a can be any type Value — Also a sequence of type [a] Predicates C(n, m)  length( [a1, a2, …, an] ++ [b1, b2, …, bm] ) = n + m C is a predicate — each equation C(n, m) is a proposition Universe of discourse: Pairs of natural numbers {(0,0), (1,0), … } Would you expect C(n, m) to be True? A(xs, ys, zs)  xs ++ (ys ++ zs) = (xs ++ ys) ++ zs A is a predicate — each equation A(xs, ys, zs) is a proposition Universe of discourse: Triples of sequences of type [a] For what sequences would you expect A(xs, ys, zs) to be True? CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page

 — the Universal Quantifier, Forall Lecture 9 - CS 1813 Discrete Math, University of Oklahoma 12/10/2018  — the Universal Quantifier, Forall x.P(x) This formula is a WFF of predicate calculus whenever P(x) is a WFF of predicate calculus True if the proposition P(x) is True for every value of x in the universe of discourse False if there is some value x in the universe of discourse for which P(x) is False Equivalent to forming the Logical And of all P(x)’s Example – S predicate about sum S(n)  sum[x1, x2, …, xn] = x1 + x2 + … + xn n.S(n) Universe of discourse: natural numbers N = {0, 1, 2, … } n.S(n) means S(0)  S(1)  S(2)  … So, “” provides a way to write formulas that would contain an infinite number of symbols if written in propositional calculus notation (but infinitely long formulas aren’t WFFs) CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page

Another Example with Forall  — the Universal Quantifier Lecture 9 - CS 1813 Discrete Math, University of Oklahoma 12/10/2018 Another Example with Forall  — the Universal Quantifier B — predicate about maximum B(n, k)  maximum[s1, s2, …, sn]  sk Universe of discourse Pairs of non-zero natural numbers where second number in pair does not exceed first U = {(n, k)  N N | 0  k  n} = {(1,1), (2,1), (2,2), (3,1), … } OK, so we haven’t gotten to set theory yet — Sabe, verdad? (n, k).B(n, k) A predicate calculus formula because each B(n, k) is a proposition, which is a portion of predicate calculus Do you expect (n, k).B(n, k) to be True? Other ways to write (n, k).B(n, k) nN . kN . (0  k)  (k  n)  B(n, k) nN, n  0 . kN, 0  k  n . B(n, k) Note nesting and direct specification of universe of discourse Technically, U = N N in this case, but values of B(n, k) outside the old U are immaterial. CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page

Lecture 9 - CS 1813 Discrete Math, University of Oklahoma 12/10/2018 End of Lecture 9 CS 1813 Discrete Mathematics, Univ Oklahoma Copyright © 2000 by Rex Page