Академический Документы
Профессиональный Документы
Культура Документы
A A A A A n n
1 3 2 1
..., , , ,
Discrete Mathematical Structures: Theory and Applications
51
Validity of Arguments
Valid Argument Forms
Modus Ponens (Method of Affirming)
Modus Tollens (Method of Denying)
Discrete Mathematical Structures: Theory and Applications
52
Validity of Arguments
Valid Argument Forms
Disjunctive Syllogisms
Disjunctive Syllogisms
Discrete Mathematical Structures: Theory and Applications
53
Validity of Arguments
Valid Argument Forms
Hypothetical Syllogism
Dilemma
Discrete Mathematical Structures: Theory and Applications
54
Validity of Arguments
Valid Argument Forms
Conjunctive Simplification
Conjunctive Simplification
Discrete Mathematical Structures: Theory and Applications
55
Validity of Arguments
Valid Argument
Forms
Disjunctive Addition
Disjunctive Addition
Discrete Mathematical Structures: Theory and Applications
56
Validity of Arguments
Valid Argument Forms
Conjunctive Addition
Discrete Mathematical Structures: Theory and Applications
57
Quantifiers and First Order Logic
Predicate or Propositional Function
Let x be a variable and D be a set; P(x) is a
sentence
Then P(x) is called a predicate or propositional
function with respect to the set D if for each
value of x in D, P(x) is a statement; i.e., P(x) is
true or false
Moreover, D is called the domain of the
discourse and x is called the free variable
Discrete Mathematical Structures: Theory and Applications
58
Quantifiers and First Order Logic
Predicate or Propositional Function
Example:
Q(x,y) : x > y, where the Domain is the set of
integers
Q is a 2-place predicate
Q is T for Q(4,3) and Q is F for Q (3,4)
Discrete Mathematical Structures: Theory and Applications
59
Quantifiers and First Order Logic
Universal Quantifier
Let P(x) be a predicate and let D be the domain
of the discourse. The universal quantification of
P(x) is the statement:
For all x, P(x) or
For every x, P(x)
The symbol is read as for all and every
Two-place predicate:
) (x P x
) , ( y x P y x
Discrete Mathematical Structures: Theory and Applications
60
Quantifiers and First Order Logic
Existential Quantifier
Let P(x) be a predicate and let D be the domain
of the discourse. The existential quantification of
P(x) is the statement:
There exists x, P(x)
The symbol is read as there exists
Bound Variable
The variable appearing in: or
-
) (x P x -
) (x P x ) (x P x -
Discrete Mathematical Structures: Theory and Applications
61
Quantifiers and First Order Logic
Negation of Predicates (DeMorgans Laws)
Example:
If P(x) is the statement x has won a race where
the domain of discourse is all runners, then the
universal quantification of P(x) is , i.e.,
every runner has won a race. The negation of this
statement is it is not the case that every runner
has won a race. Therefore there exists at least one
runner who has not won a race. Therefore:
and so,
) ( ~ ) ( ~ x P x x P x -
) (x P x
) ( ~ x P x -
) ( ~ ) ( ~ x P x x P x -
Discrete Mathematical Structures: Theory and Applications
62
Quantifiers and First Order Logic
Negation of Predicates (DeMorgans
Laws)
) ( ~ ) ( ~ x P x x P x -
Discrete Mathematical Structures: Theory and Applications
63
Quantifiers and First Order Logic
Formulas in Predicate Logic
All statement formulas are considered formulas
Each n, n =1,2,...,n-place predicate P( )
containing the variables is a formula.
If A and B are formulas, then the expressions ~A,
(AB), (AB) , A B and AB are statement
formulas, where ~, , , and are logical
connectives
If A is a formula and x is a variable, then x A(x) and
x A(x) are formulas
All formulas constructed using only above rules are
considered formulas in predicate logic
x x x
n
, ... , ,
2 1
x x x
n
, ... , ,
2 1
Discrete Mathematical Structures: Theory and Applications
64
Quantifiers and First Order Logic
Additional Rules of Inference
If the statement x P(x) is assumed to be true, then
P(a) is also true,where a is an arbitrary member of the
domain of the discourse. This rule is called the
universal specification (US)
If P(a) is true, where a is an arbitrary member of the
domain of the discourse, then x P(x) is true. This
rule is called the universal generalization (UG)
If the statement x P (x) is true, then P(a) is true, for
some member of the domain of the discourse. This
rule is called the existential specification (ES)
If P(a) is true for some member a of the domain of the
discourse, then x P(x) is also true. This rule is
called the existential generalization (EG)
Discrete Mathematical Structures: Theory and Applications
65
Quantifiers and First Order Logic
Counterexample
An argument has the form x (P(x ) Q(x )), where
the domain of discourse is D
To show that this implication is not true in the domain D,
it must be shown that there exists some x in D such that
(P(x ) Q(x )) is not true
This means that there exists some x in D such that P(x)
is true but Q(x) is not true. Such an x is called a
counterexample of the above implication
To show that x (P(x) Q(x)) is false by finding an x
in D such that P(x) Q(x) is false is called the
disproof of the given statement by counterexample
Discrete Mathematical Structures: Theory and Applications
66
Proof Techniques
Theorem
Statement that can be shown to be true (under
certain conditions)
Typically Stated in one of three ways
As Facts
As Implications
As Biimplications
Discrete Mathematical Structures: Theory and Applications
67
Proof Techniques
Direct Proof or Proof by Direct Method
Proof of those theorems that can be expressed in
the form x (P(x) Q(x)), D is the domain of
discourse
Select a particular, but arbitrarily chosen, member
a of the domain D
Show that the statement P(a) Q(a) is true.
(Assume that P(a) is true
Show that Q(a) is true
By the rule of Universal Generalization (UG),
x (P(x) Q(x)) is true
Discrete Mathematical Structures: Theory and Applications
68
Proof Techniques
Indirect Proof
The implication p q is equivalent to the
implication (q p)
Therefore, in order to show that p q is true,
one can also show that the implication
(q p) is true
To show that (q p) is true, assume that the
negation of q is true and prove that the negation
of p is true
Discrete Mathematical Structures: Theory and Applications
69
Proof Techniques
Proof by Contradiction
Assume that the conclusion is not true and then
arrive at a contradiction
Example: Prove that there are infinitely many prime
numbers
Proof:
Assume there are not infinitely many prime numbers,
therefore they are listable, i.e. p
1
,p
2
,,p
n
Consider the number q = p
1
p
2
p
n
+1. q is not
divisible by any of the listed primes
Therefore, q is a prime. However, it was not listed.
Contradiction! Therefore, there are infinitely many
primes
Discrete Mathematical Structures: Theory and Applications
70
Proof Techniques
Discrete Mathematical Structures: Theory and Applications
71
Proof Techniques
Proof of Biimplications
To prove a theorem of the form x (P(x)
Q(x )), where D is the domain of the
discourse, consider an arbitrary but fixed
element a from D. For this a, prove that the
biimplication P(a) Q(a) is true
The biimplication p q is equivalent to
(p q) (q p)
Prove that the implications p q and q p
are true
Assume that p is true and show that q is true
Assume that q is true and show that p is true
Discrete Mathematical Structures: Theory and Applications
72
Proof Techniques
Proof of Equivalent Statements
Consider the theorem that says that statements
p,q and r are equivalent
Show that p q, q r and r p
Assume p and prove q. Then assume q and prove
r Finally, assume r and prove p
Or, prove that p if and only if q, and then q if and
only if r
Other methods are possible
Discrete Mathematical Structures: Theory and Applications
73
Algorithms
Definition: step-by-step problem-solving process in which a
solution is arrived at in a finite amount of time
All algorithms have the following properties:
Input : For example, a set of numbers to find the sum of
the numbers
Output : For example, the sum of the numbers
Precision : Each step of the algorithm is precisely defined
Uniqueness : Results of each step are unique and depend
on the input and results of previous step
Finiteness : Algorithm must terminate after executing a
finite number of steps
Generality : Algorithm is general in that it applies to a set
of inputs
Discrete Mathematical Structures: Theory and Applications
74
Algorithms
Pseudocode Conventions
The symbol := is called the assignment operator
Example: The statement x := a is read as assign the value a
to x or x gets the value a or copy the value of a into x
x := a is also known as an assignment statement
Control Structures
One way-selection
if booleanExpression then statement
If booleanExpression evaluates to true, statement is
evaluated
Two way-selection
if booleanExpression then statement1
else statement2
If booleanExpression evaluates to true , statement1
executes,
otherwise statement2 executes
Discrete Mathematical Structures: Theory and Applications
75
Algorithms
Pseudocode Conventions
Control Structures
The while loop takes the form:
while booleanExpression do loopBody
The booleanExpression is evaluated. If it evaluates
to true, loopBody executes. Thereafter loopBody
continues to execute as long as booleanExpression
is true
The for loop takes the form:
for var := start to limit do loopBody
var is an integer variable. The variable var is set to
the value specified by start. If var limit, loopBody
executes. After executing the loopBody , var is
incremented by 1. The statement continues to
execute until var > limit
s
Discrete Mathematical Structures: Theory and Applications
76
Algorithms
Pseudocode Conventions
Control Structures
The do/while loop takes the form:
do loopBody while booleanExpression
The loopBody is executed first and then the
booleanExpression is evaluated. The loopBody
continues to execute as long as the
booleanExpression is true
Discrete Mathematical Structures: Theory and Applications
77
Algorithms
Pseudocode Conventions
Block of Statement
To consider a set of statements a single
statement, the statements are written between the
words begin and end
begin
statement1
statement2
...
statementn;
end
Discrete Mathematical Structures: Theory and Applications
78
Algorithms
Pseudocode Conventions
Return Statement
The return statement is used to return the value
computed by the algorithm and it takes the following
form:
return expression;
The value specified by expression is returned. In an
algorithm, the execution of a return statement also
terminates the algorithm
Read and Print Statements
read x;
Read the next value and store it in the variable x
print x;
Output the value of x
s
Discrete Mathematical Structures: Theory and Applications
79
Algorithms
Pseudocode Conventions
Arrays (List)
A list is a set of elements of the same type
The length of the list is the number of elements in the list
L[1...n ]. L is an array of n components, indexed 1 to n . L[i ]
denotes the i
th
element of L
For data in tabular form, a two-dimensional array is used:
M[1...m,1...n ] M is a two-dimensional array of m rows
and n columns
The rows are indexed 1 to m and the columns are
indexed 1 to n
M[i,j] denotes the (i,j)
th
element of M, that is, the element
at the i
th
row and j
th
column position
Discrete Mathematical Structures: Theory and Applications
80
Algorithms
Pseudocode Conventions
Subprograms (Procedures)
In a programming language,an algorithm is implemented in
the form of a subprogram, a.k.a. a subroutine or a module
Two types of subprograms
Functions
Returns a unique value
Procedure
Other types of subprograms
body of the function or procedure is enclosed between the
words begin and end
the execution of a return statement in a function terminates
the function
Discrete Mathematical Structures: Theory and Applications
81
Algorithms
Pseudocode Conventions
Comments
In describing the steps of an algorithm, comments are
included wherever necessary to clarify the steps
Two types of comments: single-line and multi-line
Single-line comments start anywhere in the line
with the pair of symbols //
Multi-line comments are enclosed between the pair
of symbols /* and */
Specifies what the algorithm does, as well as the input
and output
Discrete Mathematical Structures: Theory and Applications
82
Algorithms
Polynomial Operations
Polynomial in one variable is
a
i
are real (or complex) and n is a non-negative integer
If p(x) = a
0
then p(x) is a constant polynomial
If p(x) is a nonzero constant polynomial, then the degree of p(x) is
defined to be 0
If p(x) is not constant and a
n
0, then n is called the degree of p(x);
that is, the degree of a non-constant polynomial is defined to be the
exponent of the highest power of x
The basic operations performed on polynomials are to add, subtract,
multiply, and divide polynomials, and to evaluate a polynomial at a
given point
=