Download presentation
Presentation is loading. Please wait.
Published byMelanie Harrison Modified over 6 years ago
1
CSCI 3310 Mathematical Foundation of Computer Science
Instructor: David L Egle
2
Instructor – David Egle
Office: ENGR 3.296 Office Hours: see syllabus Phone: (office) Website: faculty.utrgv.edu/david.egle/csci3310
3
Grading Homework and quizzes 40% (only individual submissions allowed)
Two exams % final exam %
4
Academic Dishonesty You are allowed to discuss problems regarding your homework with other students in the class. However, you have to do the actual work (computing values, writing algorithms, drawing graphs, etc.) by yourself. You cannot copy anything from other sources (Wikipedia, other students’ work, etc.) The first violation will result in zero points for the entire homework or exam (and official notification). The second violation will result in failing the course.
5
Complaints about Grading
If you think that the grading of your assignment or exam was unfair, write down your complaint (handwriting is OK), attach it to the assignment or exam, and give it to me or hand it in at the department office to put in my mailbox. I will re-grade the whole exam/assignment and return it to you in class.
6
Why Care about Discrete Math?
Digital computers are based on discrete “atoms” (bits). Therefore, both a computer’s structure (circuits) and operations (execution of algorithms) can be described by discrete math.
7
Topics Logic Proofs Sets and Functions Computation
Induction and Recursion Introduction to Counting Discrete Probability Trees Graphs *** But not necessarily in this order ***
8
Mathematical Appetizers
Useful tools for discrete mathematics: Logic Set Theory Functions Sequences
9
Logic Crucial for mathematical reasoning
Used for designing electronic circuitry Logic is a system based on propositions. A proposition is a statement that is either true or false (not both). We say that the truth value of a proposition is either true (T) or false (F). Corresponds to 1 and 0 in digital circuits
10
The Statement/Proposition Game
“Elephants are bigger than mice.” Is this a statement? yes Is this a proposition? yes What is the truth value of the proposition? true
11
The Statement/Proposition Game
“520 < 111” Is this a statement? yes Is this a proposition? yes What is the truth value of the proposition? false
12
The Statement/Proposition Game
“y > 5” Is this a statement? yes Is this a proposition? no Its truth value depends on the value of y, but this value is not specified. We call this type of statement a propositional function or open sentence.
13
The Statement/Proposition Game
“Today is April 1 and 99 < 5.” Is this a statement? yes Is this a proposition? yes What is the truth value of the proposition? false
14
The Statement/Proposition Game
“Please do not fall asleep.” Is this a statement? no It’s a request. Is this a proposition? no Only statements can be propositions.
15
The Statement/Proposition Game
“If elephants were red, they could hide in cherry trees.” Is this a statement? yes Is this a proposition? yes What is the truth value of the proposition? probably false
16
The Statement/Proposition Game
“x < y if and only if y > x.” Is this a statement? yes Is this a proposition? yes … because its truth value does not depend on specific values of x and y. What is the truth value of the proposition? true
17
Combining Propositions
As we have seen in the previous examples, one or more propositions can be combined to form a single compound proposition. We formalize this by denoting propositions with letters such as p, q, r, s, and introducing several logical operators.
18
Logical Operators (Connectives)
We will examine the following logical operators: Negation (NOT) Conjunction (AND) Disjunction (OR) Exclusive or (XOR) Implication (if – then) Biconditional (if and only if) Truth tables can be used to show how these operators can combine propositions to compound propositions.
19
Unary Operator, Symbol:
Negation (NOT) Unary Operator, Symbol: P P true false
20
Binary Operator, Symbol:
Conjunction (AND) Binary Operator, Symbol: P Q PQ true false
21
Binary Operator, Symbol:
Disjunction (OR) Binary Operator, Symbol: P Q PQ true false
22
Binary Operator, Symbol:
Exclusive Or (XOR) Binary Operator, Symbol: P Q PQ true false
23
Implication (if - then)
Binary Operator, Symbol: P Q PQ true false
24
Implication (if - then)
Other terminology: “if p, then q” “p implies q” “if p, q” “p only if q” “q if p” “q whenever p” “q when p” “q is necessary for p” “p is sufficient for q” “a sufficient condition for q is p” “a necessary condition for p is q” “q follows from p” “q unless ¬p”
25
Implication (if - then)
Three conditional statements related to p → q Converse: q → p Contrapositive: ¬q → ¬p Inverse: ¬p → ¬q
26
Biconditional (if and only if)
Binary Operator, Symbol: P Q PQ true false
27
Biconditional (if and only if)
Other terminology: “p is necessary and sufficient for q” “if p then q, and conversely” “p iff q”
28
Precedence of Logical Operators
Parentheses Not (¬) And (∧) Or (∨) Implication (→) Biconditional (↔)
29
Statements and Operators
Statements and operators can be combined in any way to form new statements. P Q P Q (P)(Q) true false
30
Statements and Operations
Statements and operators can be combined in any way to form new statements. P Q PQ (PQ) (P)(Q) true false
31
Equivalent Statements
P Q (PQ) (P)(Q) (PQ)(P)(Q) true false The statements (PQ) and (P)(Q) are logically equivalent, because (PQ)(P)(Q) is always true.
32
Tautologies and Contradictions
A tautology is a statement that is always true. Examples: R (R) (P Q) (P) (Q) If ST is a tautology, we write ST. If ST is a tautology, we write ST.
33
Tautologies and Contradictions
A contradiction is a statement that is always false. Examples: R (R) ((P Q) (P) (Q)) The negation of any tautology is a contradiction, and the negation of any contradiction is a tautology.
34
Laws of Propositional Logic
Idempotent laws: p ∨ p ≡ p p ∧ p ≡ p Associative laws: ( p ∨ q ) ∨ r ≡ p ∨ ( q ∨ r ) ( p ∧ q ) ∧ r ≡ p ∧ ( q ∧ r ) Commutative laws: p ∨ q ≡ q ∨ p p ∧ q ≡ q ∧ p Distributive laws: p ∨ ( q ∧ r ) ≡ ( p ∨ q ) ∧ ( p ∨ r ) p ∧ ( q ∨ r ) ≡ ( p ∧ q ) ∨ ( p ∧ r ) Identity laws: p ∨ F ≡ p p ∨ T ≡ T p ∧ F ≡ F p ∧ T ≡ p Double negation law: ¬¬p ≡ p Complement laws: p ∨ ¬p ≡ T ¬T ≡ F p ∧ ¬p ≡ F ¬F ≡ T De Morgan's laws: ¬( p ∨ q ) ≡ ¬p ∧ ¬q ¬( p ∧ q ) ≡ ¬p ∨ ¬q Absorption laws: p ∨ (p ∧ q) ≡ p p ∧ (p ∨ q) ≡ p Conditional identities: p → q ≡ ¬p ∨ q p ↔ q ≡ ( p → q ) ∧ ( q → p )
35
Predicate Logic Propositional logic is rather limited in its expressive power. E.g., “For every x, x > 0” is true if x is a positive integer. We cannot say it in propositional logic. Nor can we show the following logical equivalences: "Not all birds fly" is equivalent to "Some birds don't fly". "Not all integers are even" is equivalent to "Some integers are not even". "Not all cars are expensive" is equivalent to "Some cars are not expensive“.
36
Predicate and Quantifiers
To deal with deficiencies of propositional logic. Two new features are added: predicates and quantifiers Predicate: A predicate is a property about of some objects or a relationship among objects represented by the variables. Quantifier: Tell how many objects have a certain property.
37
Example predicates "The sky is blue” "The cover of that book is blue"
For the above two sentences, we can use is_Blue as the predicate. We can also simply use B. B(x), where x represents an arbitrary object. B(x) reads as "x is blue".
38
Another example "John gives the book to Mary",
"Jim gives a loaf of bread to Tom", and "Jane gives a lecture to Mary" All can be expressed using this predicate: give(x, y, z) which reads, x gives y to z. E.g., give(john, book, Mary), …
39
Quantification A predicate with variables is not a proposition.
E.g., the statement x > 1 with variable x over the universe of real numbers is neither true nor false since we don't know what x is. It can be true or false depending on the value of x. For x > 1 to be a proposition either we substitute a specific number for x or change it to something like "There is a number x for which x > 1 holds", or "For every number x, x > 1 holds". We are using quantifiers …
40
From predicate to propositions
A predicate with variables (called an atomic formula) can be made a proposition by applying one of the following two operations to each of its variables: assign a value to the variable quantify the variable using a quantifier universal quantifier: “for every object x in the universe, x > 1” written as: x x > 1 existential quantifier: "for some object x in the universe, x > 1“ written as: x x > 1
41
Universe of Discourse The universe of discourse, also called universe (also called domain), is the set of objects of interest. Universal Quantifier (): The expression: x P(x), denotes the universal quantification of P(x). In English: "For all x, P(x) holds" or "for every x, P(x) holds". P(x) is true for every object x in the universe Existential Quantifier(): The expression: xP(x), denotes the existential quantification of P(x). In English: "There exists an x such that P(x)" or "There is at least one x such that P(x)“. x means at least one object x in the universe.
42
Application of Quantifiers
When more than one variables are quantified such as y x P( x, y ), they are applied from the inside I.e., the one closest to the atomic formula is applied first. Thus y x P( x, y ), reads y [x P( x, y )] Note that the positions of different types of quantifiers cannot be switched. For example x y P(x, y ) is not equivalent to y x P(x, y ).
43
Examples for (1) x y P(x, y ) and (2) y x P(x, y ).
Let P(X, Y) stands for “X likes Y”. (1). There is a person who likes every person. (2). For any person y, there is a person x who likes y. Let P(X, Y) stands for “X < Y”. (1). There is a number x that is smaller than any number y. (2). For any number, there is a smaller number
44
How to read quantified formulas
Let F(x, y) stands for “x flies faster than y”. let the universe be the set of airplanes. x y F(x, y): "For every airplane x the following holds: x is faster than any airplane y". Or simply: "Every airplane is faster than every airplane (including itself!)". x y F(x, y): "For every airplane x the following holds: for some airplane y, x is faster than y". Or simply: "Every airplane is faster than some airplane".
45
How to read quantified formulas
x y F(x, y): "There exist an airplane x which satisfies the following: (or such that) for every airplane y, x is faster than y". Or simply: “some airplane is faster than every airplane". x y F(x, y): "For some airplane x there exists an airplane y such that x is faster than y“. Or simply: "Some airplane is faster than some airplane".
46
De Morgan's law for quantified statements
The negation operation can be applied to a quantified statement, such as ¬∀x F(x). If the domain for the variable x is the set of all birds and the predicate F(x) is "x can fly", then the statement ¬∀x F(x) is equivalent to: "Not every bird can fly." which is logically equivalent to the statement: "There exists a bird that can not fly." Symbolically ¬∀x F(x) = ∃x ¬F(x)
47
De Morgan's law for quantified statements
Similarly, consider the statement ¬∃x A(x) in which the domain is the set of children enrolled in a class and A(x) is the predicate "x is absent today". The statement is expressed in English as: "It is not true that there is a child in the class who is absent today." which is logically equivalent to: "Every child in the class is not absent today." Symbolically ¬∃x A(x) = ∀x ¬A(x)
48
Exercises We already know the following tautology:
(P Q) (P) (Q) Show that (P Q) (P) (Q) These two tautologies are known as De Morgan’s laws.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.