0% found this document useful (0 votes)
30 views31 pages

FL 1

This document introduces some basic concepts in set theory and discrete mathematics, including: - Sets can be defined by listing elements or describing their properties. Operations on sets include union, intersection, and complement. - Sets can be finite or infinite. The power set of a set contains all its subsets. - Relations are collections of ordered pairs that can represent inputs and outputs. Functions are special relations where each input corresponds to a single output. - Strings are finite sequences of symbols from an alphabet. The length, prefixes, suffixes and lexicographic ordering of strings are defined. Formal languages are subsets of the set of all possible strings.

Uploaded by

eyobeshete16
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views31 pages

FL 1

This document introduces some basic concepts in set theory and discrete mathematics, including: - Sets can be defined by listing elements or describing their properties. Operations on sets include union, intersection, and complement. - Sets can be finite or infinite. The power set of a set contains all its subsets. - Relations are collections of ordered pairs that can represent inputs and outputs. Functions are special relations where each input corresponds to a single output. - Strings are finite sequences of symbols from an alphabet. The length, prefixes, suffixes and lexicographic ordering of strings are defined. Formal languages are subsets of the set of all possible strings.

Uploaded by

eyobeshete16
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 31

Introduction to the

Preliminary Mathematical
Theories

1
Sets
• Sets are collections of well defined objects in which order of elements
and duplication of elements do not matter.
• The individual objects in a set are called the elements or the members.
• To indicate that x is an element of the set S, we write x ∈ S.
• The statement that x is not in S is written x ∉ S.
• A set can be specified by enclosing some description of its
elements in curly braces;
• for example, the set of integers 0, 1, 2 is shown as

S = {0, 1, 2}.
• order of elements and duplication of elements do not matter.
– {1,a,1,1} = {a,a,a,1} = {a,1}
Operations on Sets

3
Finite Set, Infinite Set, Subsets and Power set

Definition
i A set S is called finite, if it contains n elements
where n is some non-negative integer.
a S = { xÎℝ½x2=–1}, so n (S) = 0
b S = {xÎℕ½x is a multiple of 2 less than 12}, n (S) = 5
ii A set S is called infinite, if it is not finite.
a Let E = {2, 4, 6,…}. E is infinite
b Let T = {x½x is a real number and 0<x < 1}. T is infinite.

4
Finite Set, Infinite Set, Subsets and
Powerset
• A is a subset of B if all elements of A are elements of B as well.
Notation: A B.
Note: If A is not a subset of B, then we denote this by A⊈B.
• For any set A
• iÆÍA ii A Í A
• The powerset P(A) is the set whose elements are all subsets of
A: P(A) = {X | X A }.
• Let M = {–1, 1}. Then subsets of M are Æ, {–1}, {1} and M.
• Therefore P(M) = {Æ, {–1}, {1}, M}

• Fact. If A has n elements, then P(A) has 2n elements.


• In other words, |P(A)| = 2|A| , where |X| denotes the number
of elements (cardinality) of X. 5
Finite Set, Infinite Set, Subsets and Power set

• Set A is said to be a proper subset of a set B,


denoted by A ÌB, if A is a subset of B and B
is not a subset of A.
• That is, A Ì B means A ÍB but B Í A.
• Note: For any set A, A is not a proper subset of
itself.

6
•Disjoint Sets. If A and B have no common
element, that is, A B = , then the sets A and B
are said to be disjoint.
•Cardinality. The “Cardinality” of a set A, written |A|,
is the number of elements in set A.

•Cartesian Product. Let A and B be two sets. Then


the
set of all ordered pairs (x, y) where x A and yB is
called the “Cartesian Product” of the sets A and B and
is denoted by AXB, i.e. AXB = {(x, y) : x A and yB}.
eg A={1, 2} B={a, b}
7
AXB={(1,a), (1,b), (2,a), (2,b)}
Equality and non-equality

• To show that two sets A and B are equal, you need to do


two proofs:
– Assume x A and then prove x B
– Assume x B and then prove x A
• Example. Prove that P(A B) = P(A)  P(B).

To prove that two sets A and B are not equal, you need to
produce a counterexample : an element x that belongs to
one of the two sets, but does not belong to the other.
• Example. Prove that P(A B)  P(A) P(B).
• Counterexample: A={1}, B={2}, X={1,2}. The set X belongs to
P(A∪ B), but it does not belong to P(A) ∪
P(B).
8
Various Ways of Describing a Set
•By listing its elements. For example, the set of all positive
integers divisible by 15 and less than 100 can be written as
{15, 30, 45, 60, 75, 90}.
•By describing the properties of the elements of the set.
For example. The set {15, 30, 45, 60, 75, 90} can be
described as: {n│n is a positive integer divisible by 15 and
less than 100}. (The description of the property is called
predicate.
•By recursion. example the set of all natural numbers
leaving a remainder 1 when divided by 3 can be described
as {an l ao = 1, an+1 = an + 3} The previous set can be written
as {1. 4, 7, 10, ...}.The four elements given suggest that the
computational rule is: an+1 = an + 3. 9
Relation
Definition: A relation R in a set S is a collection of
ordered pairs of elements in S (i.e. a subset of S x S).
When (x, y) is in R, we write xRy. When (x, y) is not in
R. we write xR’y.
• An input output relationship where a single input
can have more than 1 output is called a relation.
• Less(4) = {3,2,1,0} i.e. a set of results

Because the output is not


unique, we write this as Less(4,3),
Less(4,2),
think of this a setLess(4,1),
of tuples. Less(4,0) we can
{(4,3),(4,2),(4,1),(4,0)} 6
Relationship

11
Relations
Let A = {0,1,2}, B = {1,2,3}. A x B = {(0,1), (0,2), (0,3),
(1,1), (1,2), (1,3), (2,1), (2,2), (2,3)}
Let say an element x in A is related to an element y in B
iff x is less than y. x R y: x is related to y
0 R 1, 0 R 2, 0 R 3, 1 R 2, 1 R 3, 2 R 3
The set of all ordered pair in A x B where elements
are related {(0,1), (0,2), (0,3), (1,2), (1,3), (2,3)}

12
Properties of Relations
Definition Let R be a binary relation on S2.
• R is reflexive iff R(x, x) for all x ∈ S.
• R is symmetric iff R(x , x ) implies R(x , x ).
1 2 2 1

• R is transitive iff R(x , x ) and R(x , x ) imply


1 2 2 3

R(x , x ).
1 3

R*, the reflexive transitive closure of R, is


defined as follows:
• If R*(x , x ) then R* (x , x ).
1 2 1 2

• R* (xi, xi ) for all xi ∈ S.


• R*(x , x ) and R* (x , x ) imply R*(x , x ).
1 2 2 3 1 3

13
Functions
Definition
-A function is a relation such that no two ordered pairs
have the same first-coordinates and different second-
coordinates.
-For nonempty sets A and B,
A function, or mapping, f from A to B, denoted
f: A  B, is a relation from A to B in which every
element of A appears exactly once as the first
component of an ordered pair in the relation
Sample functions:
f : R  R, f(x) = x2
f : Z  Z, f(x) = x + 1
f : Q  Z, f(x) = 2
14
Example (1)
Let A = {1,2,3}, B = {7,8,9}

a) g = {(1,8), (2,9), (3,9), (3,10)}  A x B is not a


function from A to B: (3,9), (3,10)  g but 9  10.
Relation g fails to be a function because 3  A is
related to two (distinct) elements 9, 10  B

b) h = {(1,9), (2,10), (3,9)}  A x B is a function from A


to B. Relation h is a function because each
element of A is related to exactly one element in B
15
Strings and Languages
• Symbol: any thing like a, b, c, 0, 1, …
• Alphabet Σ: It is defined as a finite set of symbols.
• Example: Roman alphabet {A,..,Z, a, b, ...... z}.
• “Binary Alphabet” {0, 1} is pertinent to the theory of computation.
• String: A “string” over an alphabet is a finite sequence of symbols
from that alphabet, which is usually written next to one another and
not separated by commas.
• (i) If Sa = {0,1} then 001001 is a string over Sa.
• (ii) If Sb = {a, b, .., z) then axyrpqstcd is a string over Sb .
• Length of String: is its length as a sequence. It is the number of
symbols in the string.
• The length of a string w is written as |w|.
• Example: |10011| = 5
• Empty String: The string of zero length is called the “empty
string”.
• This is denoted by e or λ.
• The empty string plays the role of 0 in a number system.
Strings
• If w is a string, then wn stands for the string obtained by
repeating ω n times.
• As a special case, we define w0= λ, for all w.
• If Σ is an alphabet, then we use Σ* to denote the set of
strings obtained by concatenating zero or more symbols
from Σ.
• The set Σ* always contains λ.
• To exclude the empty string, we define Σ+= Σ*- {λ}
• 0={ε}, where ε is the empty string (common to all
17
alphabets).
• While Σ is finite by assumption, Σ* and Σ+ are always infinite since
there is no limit on the length of the strings in these sets.

• A language is defined as a subset of Σ*.

• A string in a language L will be called a sentence of L.

• any set of strings on an alphabet Σ can be considered a language.


• A set of strings over Σ (i.e. any subset of Σ*) is called a formal
language over Σ.
• For example, if Σ = {0, 1}, the set of strings with an even number of
zeros ({ε, 1, 00, 11, 001, 010, 100, 111, 0000, 0011, 0101, 0110, 1001,
1010, 1100, 1111, …}) is a formal language over Σ.
Suffix: If w = xv for some x, then v is a suffix of w.
Example: Let us take a string w = 0110. For the particular string, λ, 0, 10,
110, and 0110 are suffixes of the string 0110. For a string of length n, there
are n + 1 number of suffixes.

Proper suffix: For a string, any suffix of the string other than the string
itself is called as the proper suffix of the string. Example: For the string w
= 0110, the proper suffixes are λ, 0, 10, and 110.

Prefix: If w = vy for some y, then v is a prefix of w.


Example: Let us take a string w = 0111. For the particular string, λ, 0, 01,
011, and 0111 are prefixes of the string 0111. For a string of length n, there
are n + 1 number of prefixes.
Proper prefix: any prefix of the string other than the string itself
is called as the proper prefix of the string. Example: For the string
w = 0111, the proper prefixes are λ, 0, 01, and 011.
Lexicographic ordering: is the same as the dictionary ordering,
except that shorter strings precede longer strings.
The lexicographic ordering of all strings over the alphabet {0, 1} is (Î, 0,
1, 00, 01, 10, 11, 000, … ).
The set of all strings over Σ will be written Σ∗. For the alphabet {a,b}, we
have {a,b}∗ ={λ,a,b,aa,ab,ba,bb,aaa,aab,...}
Here we have listed the strings in canonical order, the order in which
shorter strings precede longer strings and strings of the same length
appear alphabetically.
Canonical order is different from lexicographic, or strictly alphabetical
order, in which aa precedes b.
An essential difference is that canonical order can be described by
making a single list of strings that includes every element of Σ∗ exactly
once.
If we wanted to describe an algorithm that did something with each
string in {a,b}∗, it would make sense to say, “Consider the strings in
canonical order, and for each one, ...” .
If an algorithm were to “consider the strings of {a,b}∗ in lexicographic
order”, it would have to start by considering ε, a, aa, aaa, ..., and it would
never get around to considering the string b.
Language: Any set of strings over an alphabet S is called a language.

eg. S={0,1}
L1=set of all strings of length 2, ={00,01,10,11}
L2=set of all strings of length 3, ={000,001,010,011,100, 101, 111}
L3=set of all strings that begin with 0, ={0,00,01,011,000, 0101, …}
L1and L2 are finite and L3 is infinite
Power of S : S={0,1}
S0= set of all strings of length 0: S0={Î}
S1= set of all strings of length 1: S1={0,1}
S2= set of all strings of length 2: S2={00,01,10,11}
S3= set of all strings of length 3: S3={000,001,010,011,101,110,111}
….
Sn= set of all strings of length n
Cardinality: number of elements in a set, Sn =2n . Cardinality(S0)=1
S*={Î} u {0,1} u {00,01,10,11} u...
= set of all possible strings of all lengths over {0,1}
it is infinite
Concatenation of Languages:
If L and L are languages over S, their
1 2

concatenation is L = L L , or simply L = L L ,
1· 2 1 2

where
L= {wÎS* :w = x y for some x ÎL , and yÎ L }
· 1 2
Formal Language
• A formal language is a set of words, i.e. finite strings of letters, or
symbols.
• The inventory/list from which these letters are taken is called the
alphabet over which the language is defined.
• A formal language is often defined by means of a formal grammar.
Formal languages are a purely syntactical notion, so there is not
necessarily any meaning associated with them.
• To distinguish the words that belong to a language from arbitrary
words over its alphabet, the former are sometimes called well-formed
words (or, in their application in logic, well-formed formulas).
Formal Definition
A formal language L over an alphabet Σ is just a subset of Σ*, that
is, a set of words over that alphabet. For example, three sample
languages over the same alphabet Σ = { a, b }:
L1 = {a a, a a a }
L2 = {a ba, a a b}
L3 = {a b, b a, a a bb, a ba b, . . . , a a a bbb, . . . }
In computer science and mathematics, which do not deal with
natural languages, the adjective "formal" is usually omitted as
redundant.
Example1
The following rules define a formal language L over the alphabet Σ=
{0,1,2,3,4,5,6,7,8,9,+,=}:
• Every non empty string that does not contain + or = and does not
start with 0 is in L.
• The string 0 is in L.
• A string containing=is in L if and only if there is exactly one =, and
it separates two strings in L.
• A string containing + is in L if and only if every + in the string
separates two valid strings in L.
• No string is in L other than those implied by the previous rules.
Automata
• An automaton is an abstract model of a digital
computer and the computational problems that
can be solved using these machines.
• abstract 'mathematical' machines or systems
• It has a mechanism for reading input
• the input is a string over a given alphabet, written
on an input file, which the automaton can read but
not change
• The input file is divided into cells, each of which can
hold one symbol.

27
Figure 1.1 schematic representation of a general automaton.
• The input mechanism can read the input file from left
to right, one symbol at a time
• The automaton can produce output of some form.
• It may have a temporary storage device,
• consisting of an unlimited number of cells,
• each capable of holding a single symbol from an alphabet
(not necessarily the same one as the input alphabet).
• The automaton can read and change the contents of
the storage cells.
• the automaton has a control unit, which can be in
any one of a finite number of internal states, and
which can change state in some defined manner.
• Automata theory is closely related to formal language theory,
• automata are often classified by the class of formal languages they
are able to recognize.
• An automaton can be a finite representation of a formal language
that may be an infinite set.
In other words, automata theory is a subject matter which studies
properties of various types of automata.
For example, following questions are studied about a given type of
automata.
• Which class of formal languages is recognizable by some type of
automata? (Recognizable languages)
• Is certain automata closed under union, intersection, or
complementation of formal languages? (Closure properties)
• How much is a type of automata expressive in terms of recognizing
class of formal languages? And, their relative expressive power?
(Language Hierarchy)
Automata theory also studies if there exist any effective algorithm
or not to solve problems similar to the following list:
• Does an automaton accept any input word? (emptiness checking)
• Is it possible to transform a given non-deterministic automaton
into deterministic automaton without changing the recognizing
language? (Determinization)
• For a given formal language, what is the smallest automaton that
recognizes it? (Minimization).
Automata play a major role in compiler design and parsing.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy