100% found this document useful (1 vote)
195 views20 pages

Discrete Mathematics - Odt

The document discusses the basics of propositional logic. Propositional logic studies mathematical statements that are either true or false. Propositions are declarative sentences that can be true or false. Propositional variables represent propositions, often using letters like p and q. Truth tables represent all possible combinations of the truth values of the constituent propositional variables.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
195 views20 pages

Discrete Mathematics - Odt

The document discusses the basics of propositional logic. Propositional logic studies mathematical statements that are either true or false. Propositions are declarative sentences that can be true or false. Propositional variables represent propositions, often using letters like p and q. Truth tables represent all possible combinations of the truth values of the constituent propositional variables.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
You are on page 1/ 20

1.1 Sets.

Introduction to set theory

Set is an unordered collection of unique objects.


Cardinality of a set is the number of elements contained in the set.

∈ - element of a set (A = {1,2,3,4} where 2 ∈ A)


∉ - not an element of a set (A = {1,2,3,4) where 5 ∉ A)
|S| - cardinality of set S (S = {1,2,5,6} where |S| = 4
⊆ - subset of a set (A is said to be a subset of B, so A ⊆ B)
⊂ - proper subset (A is subset of B, but B is not subset of A)
⊄ - not subset of a set
∅ - empty set = {}

Special sets:
N - set of natural numbers = {1,2,3,4, ...}
Z - set of integers = {..., -3,-2,-1,0,1,2,3, ...}
Q - set of rational numbers (of form a/b where a and b are elements of Z and b≠0)
R - set of real numbers

Set representation:
- listing methos (ex.{1,2,3,4,5,6,7,8,9})
- set builder notation (rules of inclusion) (ex. Q={n/m | n,m ∈ Z and m≠0}

Powerset of a set is the set containing all the subsets of the set (ex. the powerset of set S = P(S)).
S = {1,2,3}; P(S) = {∅,{1},{2},{3},{1,2},{1,3},{2,3},{1,2,3}}.

Attention!
P(∅) = ?
∅⊄∅
P(∅) = {∅}
∅ ⊄ P(∅)
{∅} ⊄ P(∅)
P(P(∅) = {∅, {∅}}

Cardinality of a powerset
Given a set S, then |P(S)| = 2|S| (ex. S={1,2,3}. |S| = 3. |P(S)| = 8 = 23 = 2|S|.
Given a set A, then |P(P(P(A)))| = 2|P(P(A))| = 2 to the power of 2 to the power of 2 to the power of n where n is the cardinality of A.

Set operations
∪ (union) - given two sets A and B, the union of A and B, A∪B, contains all the elements in EITHER A or B (A∪B={x | x ∈ A or x
∈ B}).
∩ (intersection) - given two sets A and B, the intersection of A and B, A∩B, contains all the elements IN BOTH A and B (A∩B={x | x
∈ A and x ∈ B}).
- (difference) - given two sets A and B, the set difference, A-B, contains the elements that are in A BUT NOT IN B (A-B={x | x ∈ A
and x ∉ B}).
∆ or ⊕ (symmetric difference) - gitven two sets A and B, the symmetric difference, A∆B, contains the elements that are in A OR IN B
BUT NOT IN both (A∆B={x | (x ∈ A or x ∈ B) and x ∉ A∩B)}).

Example:
A={1,2,3} and B={3,4,5}
A∪B={1,2,3,4,5 }
A∩B={3}
A-B={1,2}
A∆B={1,2,4,5}
1.2 Sets. Set representation and manipulation

Universal set (U) is a set that contains everything.


Venn diagram is used to visualize the possible relations among a collection of sets.

U
A⊆U
A

Complement of a set. The complement of a set A, denoted A' or , contains all the elements in the universal set U but not in A
(A'=U-A; U=A'∪A=U).

De Morgan's laws
Describe how mathematical statements and concepts are related through their opposites. In set theory, De Morgan's laws relate to the
intersection and union of sets through their complements.
=A'∩B'
=A'∪B'

Inclusion-exclusion principle
|A∪B| = |A| + |B| - |A∩B|
|A∪B∪C| = |A| + |B| + |C| - |A∩B| - |A∩C| - |B∩C| + |A∩B∩C|

Laws of sets
commutativity is an operation in which the order of elements does not affect the result:
- set union (A∪B=B∪A)
- set intersection (A∩B=B∩A)
- symmetric difference (A⊕B=B⊕A)
associativity concerns the grouping of elements in an operation:
- set union ( (A∪B)∪C=A∪(B∪C) )
- set intersection ( (A∩B)∩C=A∩(B∩C) )
- symmetric difference( (A⊕B)⊕C=A⊕(B⊕C) )
distributivity is an operation in which the multiplying a sum by a number gives the same result as multiplying each number and them
adding the products together ( 3*(2+5)=3*2 + 3*5=21 ):
- set union is distributive over the set intersection ( A∪(B∩C)=(A∪B)∩(A∪C) )
- set intersection is distributive over the set union ( A∩(B∪C)=(A∩B)∪(A∩C) )

Partition is a subdivision of the object into parts, so that these parts are completely sepatated from each other, yet together they form
the whole object.
dis-joint sets when A∩B=∅
A partition of A is a set of subsets Ai of A such that all the subsets Ai are dis-joints. The union of all subsets Ai is equal to A. Example,
{A1,A2,A3,A4,A5} is a partition on A.
2.1 Functions. Introduction to functions

Function is a rule that relates to how one quantity depends on other quantities. It is a relation between a set of inputs and a set of
outputs in which each input maps to exactly one output.

Given a function f: A → B
x ∈ A → f(x) = y ∈ B

f(A) - denotes a set, that consists of the images of the elements of A.

A is the set of inputs and is called the domain of f => Df = A.


B is the set of containing the outputs and is called the co-domain of f => co-Df = B.
The set of all outputs is called the range of f => Rf .
y is called the image of x, whereas x is called the pre-image of y => f(x) = y.

*every input must have an image


*every input must have only 1 unique image

Linear function
f(x)=ax+b where a ∈ R and b ∈ R.
- straight line function
- passes through the point (0,b)
- a is the gradient
if a>0 then the function is increasing (x1 ≤ x2 then f(x1) ≤ f(x2))

if a<0 then the function is decreasing (x1 ≤ x2 then f(x1) ≥ f(x2))


Quadratic function
f(x)=ax2+bx+c where a≠0.

Exponential function
f(x)=bx where b>0 and b≠1.
base of the function is the value of b.

Laws of exponential functions


• bxby=bx+y
• bx/by=bx-y
• (bx)y=bxy
• (ab)x=axby
• (a/b)x=ax/bx
• b-x=1/bx

Types:
- exponential growth
- exponential decay

Function properties:
Injective (one-to-one) functions. The function is injective (one-to-one) if and only if
- for all a,b ∈ A, if a≠b then f(a)≠f(b)
- for all a,b ∈ A, if f(a)=f(b) then a=b
Surjective (onto) functions. The function is surjective (onto) if and only if every element of the co-domain of f (co-Df), B, has at least
one pre-image in the domain of f (Df).
- for all y ∈ B there exists x ∈ A such that y=f(x) ≡ co-Df=Rf
Bijective functions (invertible; one-to-one correspondence) are both injective (one-to-one) and surjective (onto).

Suppose that f: A → B
To show that f is injective Show that if f(x)=f(y) for arbitrary x,y ∈ A, then x=y
To show that f is not injective Find particular elements x,y ∈ A such that x≠y and f(x)=f(y)
To show that f is surjective Consider an arbitrary element y ∈ B and find an element x ∈ A such that f(x)=y
To show that f is not surjective Find a particular y ∈ B such that f(x)≠y for all x ∈ A
2.2 Functions. More about functions

Function composition
(f o g)(x) = f(g(x)) - given two functions f and g.
Df o g = Dg, Rg ⊆ Df
(f -1 o f)(a) = f -1(f(a)) = f -1(b) = a - identity function
(f o f -1)(b) = f(f -1(b)) = f(a) = b - identity function

* function composition is not commutative

Function operations
(f1 + f2)(x) = f1(x) + f2(x)
(f1f2)(x) = f1(x)f2(x)

Graph
The graph of the function f is the set of ordered pairs {(a,b) | a ∈ A and f(a)=b}. The graph of a function f from A to B is the subset of
AxB containing the ordered pairs with the second entry equal to the element of B assigned by f to the first entry.

Logarithmic functions
The logarithmic function with base b where b > 0 and b ≠ 1 is defined as follows:
logb x = y if and only if x = by
logb x is the inverse function of the exponential function bx.

Laws of logarithms:
logb m*n = logb m + logb n
logb m/n = logb m - logb n
logb mn = n logb m
logb 1 = 0
logb b = 1

Natural logarithm: ln x
ln x = loge x where e = 2.71828

Floor functions
The function R → Z. It takes a real number x as an input and returns the largest integer that is less than or equal to x, denoted as
floor(x) = ⌊ x ⌋

Ceiling function
The function R → Z. It takes a real number x as an input and returns the smallest integer that is greater than or equal to x, denoted as
ceiling(x) = ⌈ x ⌉.
Properties of ceiling and floor functions:
1. ⌊ x ⌋ = n if and only if n ≤ x < n+1
2. ⌈ x ⌉ = n if and only if n-1 < x ≤ n
3. ⌊ x ⌋ = n if and only if n-1 < n ≤ x
4. ⌈ x ⌉ = n if and only if x ≤ n < x+1
5. x-1 < ⌊ x ⌋ ≤ x ≤ ⌈ x ⌉ < x+1
6. ⌊ -x ⌋ = - ⌊ x ⌋
7. ⌈ -x ⌉ = - ⌈ x ⌉
8. ⌈ x+n ⌉ = ⌈ x ⌉ + n
9. ⌊ x+n ⌋ = ⌊ x ⌋ + n

Inverse function (f -1)


f -1 - Let f: A → B, if f is bijective (invertible) then the inverse function, exists and is defined as follows:
f -1: B → A.
Example: f(x) = x2 => f -1(x) = √x

Identity function (ɩA(x))


ɩA(x) - on A is the function ɩA : A → A, where
ɩA(x) = x for all x ∈ A
Example: ɩA(2) = 2

Factorial function (f(n) = n!)


f(n) = n! f: N → Z+ where f(n) = 1*2*...(n-1)*n[and f(0)=0!=1].
Example: f(6) = 6! = 1*2*3*4*5*6 = 720.
3.1 Propositional logic. The basics

Propositional logic is a branch of logic interested in studying mathematical statements.

Proposition is a declarative sentence that is either true or false, but not both (most basic element of logic).
Example of propositions:
London is the capital of the United Kingdom - true proposition
1 + 1 = 2 - true proposition
Madrid is the capital of France - false proposition
3 < 2 - false proposition
Example that are not propositions:
x + 1 = 2 - not proposition, because we do not know x
x + y = z - not proposition, because we do not know x, y, z
this coffee is strong - not proposition, because have relative meaning of strong

Propositional variables is typically a letter, such as: p, q, r, ...


Examples:
p: London is the capital of the United Kingdom
q: 1 + 1 = 2

Truth table is a tabular representation of all the possible combinations of its constituent variables.
Example:
Here are two propositional variables p and q:

p q
FALSE FALSE
TRUE FALSE
FALSE TRUE
TRUE TRUE

Constructing truth tables for n propositions


1. create a table with 2n rows and n columns
2. fill in the first n columns with all the possible combinations

Truth set of p is the set of elements of S for which p is true (let p be a proposition on a set S).
A capital letter a proposition is used to refer to a truth set of the proposition, i.e. the truth set of a proposition p is noted as P.
Example:
S = {1,2,3,4,5,6,7,8,9,10}
p and q - two propositions concerning an integer n in S, defined as follows:
p: n is even
q: n is odd
P = {2,4,6,8,10} - the truth set of p written as P
Q = {1,3,5,7,9} - the truth set of q written as Q

Compound statements
Compound propositions are statements built by combining multiple propositions using certain rules.
Logic operators:
• negation (¬)
Let p be a proposition. The negation of p, denoted by ¬p, and read "not p", is the statements "It is not the case that p.".
• conjunction (Λ)
Let p and q be propositions. The conjunction of p and q, denoted by pΛq, is the proposition "p and q". The conjunction pΛq is
only true when both p and q are true, and is false if this isn't the case.
p q pΛq
F F F
T F F
F T F
T T T

• disjunction (ν)
Let p and q be propositions. The disjunction of p and q, denoted by pνq, is the proposition "p or q". The disjunction pνq is
only false when both p and q are false, and is otherwise true.

p q pνq
F F F
T F T
F T T
T T T

• exclusive-or (⊕)
Let p and q be propositions. The exclusive-or of p and q, denoted by p⊕q, is the proposition "p or q (but not both)". The
exclusive-or p⊕q is true when p is true and q is false and when p is false and q is true.

p q p⊕q
F F F
T F T
F T T
T T F

Conditional statement (implication)


Let p and q be propositions. p → q is the proposition: "if p then q".
Hypothesis is p (or antecedent or premise)
Conclusion is q (or consequence)
p → q:
• p → q the same as (q unless ¬p)
• converse q → p
• contrapositive ¬q → ¬p (always has the same truth value as p → q)
• inverse ¬p → ¬q

p q p→q
F F T
T F F
F T T
T T T

Different expressions of p → q:
• if p then q
• if p,q
• p implies q
• p only if q
• q follows from p
• p is sufficient for q
• q unless ¬p
• q is necessary for p

Biconditional statements (bi-implications)


p ↔ q the same as ( (p → q) Λ (q → p) )
The biconditional statement is true when p and q have the same truth values, and is false otherwise.

p q p→q q→p (p → q) Λ (q → p)
F F T T T
T F F T F
F T T F F
T T T T T
3.2 Propositional logic. Applications

Tautology - a compound proposition that is always true, no matter what the truth values of the propositional variables that occur in it.
Contradiction - a compound proposition that is always false.
Contingency - a compound proposition that is neither a tautology nor a contradiction.

Equivalent propositions
p and q are logically equivalent if they always have the same truth value. p ≡ q is not a compound proposition but, rather, is the
statement that p ↔ q is always true - tautology.

Precedence of logical operators

operator precedence
¬ 1
Λ 2
ν 3
→ 4
↔ 5

Laws of propositional logic

De Morgan's Laws
¬ (p Λ q) ≡ ¬p ν ¬q
¬ (p ν q) ≡ ¬p Λ ¬q

Logical Equivalences Involving Conditional Statements


p → q ≡ ¬p ν q
p ν q ≡ ¬p → q
p → q ≡ ¬q → ¬p
p Λ q ≡ ¬(p → ¬q)
p Λ ¬q ≡ ¬(p → q)
(p → q) Λ (p → r) ≡ p → (q Λ r)
(p → r) Λ (q → r) ≡ (p ν q) → r
(p → q) ν (p → r) ≡ p → (q ν r)
(p → r) ν (q → r) ≡ (p Λ q) → r
Logical Equivalences Involving Biconditional Statements
p ↔ q ≡ (p → q) Λ (q → p)
p ↔ q ≡ ¬p ↔ ¬q
p ↔ q ≡ (p Λ q) ν (¬p Λ ¬q)
¬(p ↔ q) ≡ p ↔ ¬q

Satisfiable compound proposition - when it is a tautology or a contingency.


Unsatisfiable compound proposition - when it is a contradiction (if and only if its negation is true for all assignments of truth values to
the variables, that is, if and only if its negation is a tautology).
4.1 Predicate logic. Introduction

Predicates are a more general form of proposition. They behave as functions whose values are T or F. Predicates become
propositions when their variables are given actual values.

Parts of predicate "x2=4"


• variable x, which is the subject of the statement
• predicate "x2=4", which is the property that the subject of the statement can have

P(x) - propositional function - where P is the predicate "x2=4" and x is the variable. Once a value is assigned to the variable x, the
statement P(x) becomes a proposition and has a truth value.

Quantification expresses the extent to which a predicate is true over a range of elements. They expresses the meaning of the words all
and some.

Types of quantifiers:
• universal - "P(x) is true for all values of x in the universe of discourse" (Ɐx P(x) - "for all x"); if finite {n1, n2 ..., nk},
ⱯxP(x)↔P(n1)^P(n2) ^ ... ^ P(nk)
Ɐx <0(x2 >0) ↔ Ɐx(x<0 → x2>0)
*if the domain is empty, then ⱯxP(x) is true for any propositional function P(x), because there are no elemtns x in the domain
for which P(x) is false
• existential - "There exists a value x in the universe of discourse such that P(x) is true" (ⱻx P(x) - "there exists x"); if finite
{n1,n2 ..., nk}, ⱻxP(x)↔P (n1) v P(n2) v ... v P(nk)
ⱻz>0(z2=2) ↔ ⱻz(z>0^z2=2)
*if the domain is empty, then ⱻxQ(x) is false whenever Q(x) is a propositional function, because when the domain is empty,
there can be no element x in the domain for which Q(x) is true
• uniqueness (special case of existential) - "There exists a unique value x in the universe of discourse such that P(x) is true"
( ⱻ!xP(x) - "there exists a unique x")

A variable is said to be bound if it is within the scope of a quantifier.


A variable is free if it is not bound by a quantifier or particular values.
Example:
ⱻx P(x,y) - x is bound and y is free.

Order of operators
- same type = order does not matter (ⱯxⱯy P(x,y) ≡ ⱯyⱯx P(x,y)
- different type = order does matter (Ɐxⱻy P(x,y) is different from ⱻyⱯx P(x,y)

Precedence of quantifiers
The quantifiers Ɐ and ⱻ have a higher precedence priority than all logical operators.

De Morgan's Laws
¬ⱯP(x) ≡ ⱻx¬P(x)
¬ⱻxP(x) ≡ Ɐx¬P(x)
in the case of nested quantifiers, we apply De Morgan's laws successively from left to right:
¬ⱯxⱻyⱯzP(x,y,z) ≡ ⱻx¬ⱻyⱯzP(x,y,z) ≡ ⱻxⱯy¬ⱯzP(x,y,z) ≡ ⱻxⱯyⱻz¬P(x,y,z)
4.2 Predicate logic. Rules of inference

An argument in propositional logic is a sequence of propositions.


The conclusion is the final proposition.
Premises (or hypotheses) the other propositions in the argument.
Valid argument is when the truth of all its premises implies the truth of the conclusion.
Fallacy is the use of incorrect argument when reasoning.

Rules of inference can be seen as building blocks in constructing incrementally complex valid arguments.

Rules of inference:
• Modus ponens

• Modus tollens

• Conjunction

• Simplification

• Addition

• Hypothetical syllogism
• Disjunctive syllogism

• Resolution

Rules of inference with quantifiers


• Universal instantiation (UI)

• Universal generalization (UG)

• Existential instantiation (EI)

• Existential generalization (EG)

• Universal modus ponens

• Universal modus tollens


5.1 Boolean argebra. The basics

Boolean algebra is a set B with two binary operations ν and Λ, elements 0 and 1, and a unary operation --- (') such that these
properties hold for all x, y, and z in B:

Fundamental operations:
- and (.) (logical product, intersection, conjunction)
- or (+) (sum, union, disjunction)
- not(') (logical complement of negation)

Precedence:
1) not
2) and
3) or

Boolean Function
Let B = {0, 1}, then Bn = {(x1,x2, ..., xn)} | xi ∈ B for 1 ≤ i ≤ n - is the set of all possible n-tuples of 0s and 1s.
Boolean variable is variable x, if it assumes values only from B, that is, if its only possible values are 0 and 1.
Boolean function is a function which defines a mapping from one or multiple Boolean input values to a Boolean output value.
Boolean function of degree n is a function from Bn to B.

(F + G)(x1,x2, ..., xn) = F(x1,x2, ..., xn) + G(x1,x2, ..., xn)


(FG)(x1,x2, ..., xn) = F(x1,x2, ..., xn)G(x1,x2, ..., xn)

Number of Boolean Functions of Degree n


22^n

Boolean Identities

Huntington's postulates (must be sutisfied by any Boolean argebra):


• closure
result belongs to the set {0,1}
• identity
x + 0=x, x . 1 = x
• commutativity
x + y = y + x, x . y = y . x
• distrubutivity
x(y + z) = (x . y) + (x . z); x + (y . z) = (x + y) . (x + z)
• complements
x + x' = 1, x . x' = 0
• distinct elements
0≠1

Basic theorems
• idempotent laws
x + x = x, x . x = x
• tautology and contradiction
x + 1 = 1, x . 0 = 0
• involution
(x')' = x
• associative laws
(x + y) + z = x + (y + z), (x . y) . z = x . (y . z)
• absorption laws
x + (x . y) = x, x . (x + y) = x
• uniqueness of complement
if y + x = 1 and y . x = 0, then x = y'
• inversion law
0' = 1, 1' = 0

Duality (Fd)
we can build another equivalent Boolean relation by:
- chaning each + to . and each . to +
- changing each 0 to 1 and each 1 to 0
Example:
e1: (a . 1) . (0 + a') = 0 - dual for e1: (a + 0) + (1 . a') = 1
e2: a + a' . b = a + b - dual for e2: a . (a' + b) = a . b

Ways of proving theorems:


• perfect induction
by showing the two expressions have identical truth tables
• axiomatic proof
by applying Huntington's postulates or theorems
• duality principle
evety theorem in Boolean algebra remains valid if we interchange ...
• contradiction
by assuming that the hypothesis is false and then proving that the conclusion is false

A literal is a Boolean variable or its complement.


A minterm of the Boolean variables x1, x2, ..., xn is a Boolean product y1y2...y3, where yi = xi or yi = x'i. Hence, a minterm is a product
of n literals, with one literal for each variable.
A minterm is a Boolean expression resulting in 1 for the output of a single cell, and 0s for all other cells in a Karnaugh map, or truth
table. If a minterm has a single1nd the remaining cells as0s, it would appear to cover a minimum area of 1s.
A maxterm is a Boolean expression resulting in a 0 for the output of a single cell expression, and s for all other cells in the Karnaugh
map, or truth table. The illustration above left shows the maxterm(A+B+C), a single sum term, as a single0 in a map that is otherwise
1s.
Functionally complete function is the function which can be represented using ., +, and --- . A smaller set of functionally complete
operations can be expressed in terms of the other two.
Example:
x + y = (x'y')' - {., ---} set is functionally complete
xy = (x' + y')' - {+, ---} set is functionally complete

Forms of function:
• in algebraic form, a function can be expressed in a variety of ways.
Example:
f(x) = x + x' . y and
f(x) = x + y
are both algebraic represenctions of the same truth Table.
• standardised forms
- sum of products ( f(x,y,z) = xy + xz + yz )
to build it, focus on:
- values that make the function 1
- if an input = 1, it appears uncomplemented
- if an input = 0, it appears complemented
- the function f is then expressed as the sum of products of all the terms for with f = 1
- product of sums ( f(x,y,z) = (x + y)(x + z)(y + z) )

Useful funcitons:
- 'exlusive-or' function ( x ⊕ y = x'y + xy' )
- 'implies' function ( x → y = x' + y )
5.2 Boolean argebra. Applications

A logic gate is defined as the basic element of circuits implementing a Boolean operation.

Basic logic circuits


• AND gates
• OR gates
• NOT gates (invertors)

Output of logic gates


• hight (one)
• low (zero)

Additional gates
• XOR gate (true only when the values of the inputs differ)
• NAND gate (not and) commutative, but not associative
• NOR gate (not or) commutative and associative
• XNOR gate (not XOR)

Combinational circuits (logical networks) are a combination of logic gates designed to model Boolean functions.

The logic values assigned to the output signals is a Boolean function of the current configuration of input signals.

Simplifications
• algebraic simplification is based on the use of Boolean algebra theorems to represent and simplify the behaviour of Boolean
functions.
• karnaugh maps (or K-Map) is a graphical representation of Boolean functions and is different from a truth table. It can be
used for expressions with 2, 3, 4 or 5 variables. It is shown in a array of cells.
Number of cells in a KMap is the total number of possible input variable combinations = 2 k.

You might also like