SlideShare a Scribd company logo
1 of 55
IST Studies - UH
George Pasparakis
Formal Systems
Introduction to Formal Systems
IST STudies - UH
George Pasparakis
Languages
The terms language and word are
used in a strict technical sense in
this course:
A language is a set of words.
A word is a sequence (or string) of
symbols.
 (or ) denotes the empty word, the
sequence of zero symbols.
IST STudies - UH
George Pasparakis
Symbols and Alphabets
• What is a symbol, then?
• Anything, but it has to come from
an alphabet which is a finite set.
• A common (and important)
instance is = {0, 1}.
•  , the empty word, is never an
symbol of an alphabet.
IST STudies - UH
George Pasparakis
Computation
CPU memory
IST STudies - UH
George Pasparakis
CPU
input memory
output memory
Program memory
temporary memory
IST STudies - UH
George Pasparakis
CPU
input memory
output memory
Program memory
temporary memory
3
)
( x
x
f 
compute x
x
compute x
x 
2
Example:
IST STudies - UH
George Pasparakis
CPU
input memory
output memory
Program memory
temporary memory
3
)
( x
x
f 
compute x
x
compute x
x 
2
2

x
IST STudies - UH
George Pasparakis
CPU
input memory
output memory
Program memory
temporary memory
3
)
( x
x
f 
compute x
x
compute x
x 
2
2

x
4
2
*
2 

z
8
2
*
)
( 
 z
x
f
IST STudies - UH
George Pasparakis
CPU
input memory
output memory
Program memory
temporary memory
3
)
( x
x
f 
compute x
x
compute x
x 
2
2

x
4
2
*
2 

z
8
2
*
)
( 
 z
x
f
8
)
( 
x
f
IST STudies - UH
George Pasparakis
Automaton
CPU
input memory
output memory
Program memory
temporary memory
Automaton
IST STudies - UH
George Pasparakis
Different Kinds of Automata
Automata are distinguished by the temporary memory
• Finite Automata: no temporary memory
• Pushdown Automata: stack
• Turing Machines: random access memory
IST STudies - UH
George Pasparakis
input memory
output memory
temporary memory
Finite
Automaton
Finite Automaton
Example: Vending Machines
(small computing power)
IST STudies - UH
George Pasparakis
input memory
output memory
Stack
Pushdown
Automaton
Pushdown Automaton
Example: Compilers for Programming Languages
(medium computing power)
Push, Pop
IST STudies - UH
George Pasparakis
input memory
output memory
Random Access Memory
Turing
Machine
Turing Machine
Examples: Any Algorithm
(highest computing power)
IST STudies - UH
George Pasparakis
Finite
Automata
Pushdown
Automata
Turing
Machine
Power of Automata
Less power More power
Solve more
computational problems
IST STudies - UH
George Pasparakis
Mathematical Preliminaries
IST STudies - UH
George Pasparakis
Mathematical Preliminaries
• Sets
• Functions
• Relations
• Graphs
• Proof Techniques
IST STudies - UH
George Pasparakis
}
3
,
2
,
1
{

A
A set is a collection of elements
SETS
}
,
,
,
{ airplane
bicycle
bus
train
B 
We write
A

1
B
ship
IST STudies - UH
George Pasparakis
Set Representations
C = { a, b, c, d, e, f, g, h, i, j, k }
C = { a, b, …, k }
S = { 2, 4, 6, … }
S = { j : j > 0, and j = 2k for some k>0 }
S = { j : j is nonnegative and even }
finite set
infinite set
IST STudies - UH
George Pasparakis
A = { 1, 2, 3, 4, 5 }
Universal Set: all possible elements
U = { 1 , … , 10 }
1 2 3
4 5
A
U
6
7
8
9
10
IST STudies - UH
George Pasparakis
Set Operations
A = { 1, 2, 3 } B = { 2, 3, 4, 5}
• Union
A U B = { 1, 2, 3, 4, 5 }
• Intersection
A B = { 2, 3 }
• Difference
A - B = { 1 }
B - A = { 4, 5 }
U
A B
A-B
IST STudies - UH
George Pasparakis
A
• Complement
Universal set = {1, …, 7}
A = { 1, 2, 3 } A = { 4, 5, 6, 7}
1
2
3
4
5
6
7
A
A = A
IST STudies - UH
George Pasparakis
0
2
4
6
1
3
5
7
even
{ even integers } = { odd integers }
odd
Integers
IST STudies - UH
George Pasparakis
DeMorgan’s Laws
A U B = A B
U
A B = A U B
U
IST STudies - UH
George Pasparakis
Empty, Null Set:
= { }
S U = S
S =
S - = S
- S =
U
= Universal Set
IST STudies - UH
George Pasparakis
Subset
A = { 1, 2, 3} B = { 1, 2, 3, 4, 5 }
A B
U
Proper Subset: A B
U
A
B
IST STudies - UH
George Pasparakis
Disjoint Sets
A = { 1, 2, 3 } B = { 5, 6}
A B =
U
A B
IST STudies - UH
George Pasparakis
Set Cardinality
• For finite sets
A = { 2, 5, 7 }
|A| = 3
IST STudies - UH
George Pasparakis
Powersets
A powerset is a set of sets
Powerset of S = the set of all the subsets of S
S = { a, b, c }
2S = { , {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c} }
Observation: | 2S | = 2|S| ( 8 = 23 )
IST STudies - UH
George Pasparakis
Cartesian Product
A = { 2, 4 } B = { 2, 3, 5 }
A X B = { (2, 2), (2, 3), (2, 5), ( 4, 2), (4, 3), (4, 5) }
|A X B| = |A| |B|
Generalizes to more than two sets
A X B X … X Z
IST STudies - UH
George Pasparakis
FUNCTIONS
domain
1
2
3
a
b
c
range
f : A -> B
A B
If A = domain
then f is a total function
otherwise f is a partial function
f(1) = a
IST STudies - UH
George Pasparakis
RELATIONS
R = {(x1, y1), (x2, y2), (x3, y3), …}
xi R yi
e. g. if R = ‘>’: 2 > 1, 3 > 2, 3 > 1
In relations xi can be repeated
IST STudies - UH
George Pasparakis
Equivalence Relations
• Reflexive: x R x
• Symmetric: x R y y R x
• Transitive: x R y and y R z x R z
Example: R = ‘=‘
• x = x
• x = y y = x
• x = y and y = z x = z
IST STudies - UH
George Pasparakis
Equivalence Classes
For equivalence relation R
equivalence class of x = {y : x R y}
Example:
R = { (1, 1), (2, 2), (1, 2), (2, 1),
(3, 3), (4, 4), (3, 4), (4, 3) }
Equivalence class of 1 = {1, 2}
Equivalence class of 3 = {3, 4}
IST STudies - UH
George Pasparakis
GRAPHS
A directed graph
• Nodes (Vertices)
V = { a, b, c, d, e }
• Edges
E = { (a,b), (b,c), (b,e),(c,a), (c,e), (d,c), (e,b), (e,d) }
node
a
b
c
d
e
IST STudies - UH
George Pasparakis
Labeled Graph
a
b
c
d
e
1 3
5
6
2
6
2
IST STudies - UH
George Pasparakis
Walk
a
b
c
d
e
Walk is a sequence of adjacent edges
(e, d), (d, c), (c, a)
IST STudies - UH
George Pasparakis
Path
a
b
c
d
e
Path is a walk where no edge is repeated
Simple path: no node is repeated
IST STudies - UH
George Pasparakis
Cycle
a
b
c
d
e
1
2
3
Cycle: a walk from a node (base) to itself
Simple cycle: only the base node is repeated
base
IST STudies - UH
George Pasparakis
Euler Tour
a
b
c
d
e
1
2
3
4
5
6
7
8 base
A cycle that contains each edge once
IST STudies - UH
George Pasparakis
Hamiltonian Cycle
a
b
c
d
e
1
2
3
4
5 base
A simple cycle that contains all nodes
IST STudies - UH
George Pasparakis
Trees
root
leaf
parent
child
Trees have no cycles
IST STudies - UH
George Pasparakis
root
leaf
Level 0
Level 1
Level 2
Level 3
Height 3
IST STudies - UH
George Pasparakis
Binary Trees
IST STudies - UH
George Pasparakis
PROOF TECHNIQUES
• Proof by induction
• Proof by contradiction
IST STudies - UH
George Pasparakis
Induction
We have statements P1, P2, P3, …
If we know
• for some b that P1, P2, …, Pb are true
• for any k >= b that
P1, P2, …, Pk imply Pk+1
Then
Every Pi is true
IST STudies - UH
George Pasparakis
Proof by Induction
• Inductive basis
Find P1, P2, …, Pb which are true
• Inductive hypothesis
Let’s assume P1, P2, …, Pk are true,
for any k >= b
• Inductive step
Show that Pk+1 is true
IST STudies - UH
George Pasparakis
Example
Theorem: A binary tree of height n
has at most 2n leaves.
Proof by induction:
let L(i) be the number of leaves at level i
L(0) = 1
L(1) = 2
L(2) = 4
L(3) = 8
IST STudies - UH
George Pasparakis
We want to show: L(i) <= 2i
• Inductive basis
L(0) = 1 (the root node)
• Inductive hypothesis
Let’s assume L(i) <= 2i for all i = 0, 1, …, k
• Induction step
we need to show that L(k + 1) <= 2k+1
IST STudies - UH
George Pasparakis
Induction Step
From Inductive hypothesis: L(k) <= 2k
Level
k
k+1
IST STudies - UH
George Pasparakis
L(k) <= 2k
Level
k
k+1
L(k+1) <= 2 * L(k) <= 2 * 2k = 2k+1
Induction Step
IST STudies - UH
George Pasparakis
Remark
Recursion is another thing
Example of recursive function:
f(n) = f(n-1) + f(n-2)
f(0) = 1, f(1) = 1
IST STudies - UH
George Pasparakis
Proof by Contradiction
We want to prove that a statement P is true
• we assume that P is false
• then we arrive at an incorrect conclusion
• therefore, statement P must be true
IST STudies - UH
George Pasparakis
Example
Theorem: is not rational
Proof:
Assume by contradiction that it is rational
= n/m
n and m have no common factors
We will show that this is impossible
2
2
IST STudies - UH
George Pasparakis
= n/m 2 m2 = n2
Therefore, n2 is even
n is even
n = 2 k
2 m2 = 4k2 m2 = 2k2
m is even
m = 2 p
Thus, m and n have common factor 2
Contradiction!
2

More Related Content

What's hot

Integers and matrices (slides)
Integers and matrices (slides)Integers and matrices (slides)
Integers and matrices (slides)
IIUM
 
Sets and Functions By Saleh ElShehabey
Sets and Functions By Saleh ElShehabeySets and Functions By Saleh ElShehabey
Sets and Functions By Saleh ElShehabey
ravingeek
 

What's hot (16)

Sets in discrete mathematics
Sets in discrete mathematicsSets in discrete mathematics
Sets in discrete mathematics
 
Class7 converted
Class7 convertedClass7 converted
Class7 converted
 
Learn Set Theory
Learn Set TheoryLearn Set Theory
Learn Set Theory
 
SETS [Algebra]
SETS [Algebra]SETS [Algebra]
SETS [Algebra]
 
Sets Part I The Basics
Sets Part I   The BasicsSets Part I   The Basics
Sets Part I The Basics
 
Integers and matrices (slides)
Integers and matrices (slides)Integers and matrices (slides)
Integers and matrices (slides)
 
Lexical Analysis
Lexical AnalysisLexical Analysis
Lexical Analysis
 
Set in discrete mathematics
Set in discrete mathematicsSet in discrete mathematics
Set in discrete mathematics
 
[Book Reading] 機械翻訳 - Section 5 No.2
[Book Reading] 機械翻訳 - Section 5 No.2[Book Reading] 機械翻訳 - Section 5 No.2
[Book Reading] 機械翻訳 - Section 5 No.2
 
Static Analysis
Static AnalysisStatic Analysis
Static Analysis
 
Chpt 2-sets v.3
Chpt 2-sets v.3Chpt 2-sets v.3
Chpt 2-sets v.3
 
Presentation
PresentationPresentation
Presentation
 
Discrete Structure Mathematics lecture 1
Discrete Structure Mathematics lecture 1Discrete Structure Mathematics lecture 1
Discrete Structure Mathematics lecture 1
 
Sets and Functions By Saleh ElShehabey
Sets and Functions By Saleh ElShehabeySets and Functions By Saleh ElShehabey
Sets and Functions By Saleh ElShehabey
 
Discrete Math Ch5 counting + proofs
Discrete Math Ch5 counting + proofsDiscrete Math Ch5 counting + proofs
Discrete Math Ch5 counting + proofs
 
Bounded arithmetic in free logic
Bounded arithmetic in free logicBounded arithmetic in free logic
Bounded arithmetic in free logic
 

Viewers also liked

Technol2
Technol2Technol2
Technol2
Lauren
 
Electronic Grant Management & Research Administration
Electronic Grant Management & Research AdministrationElectronic Grant Management & Research Administration
Electronic Grant Management & Research Administration
Peter Chanda
 
12.1. short functional text
12.1. short functional text12.1. short functional text
12.1. short functional text
Heriyono Yono
 
Matchfixnig power point
Matchfixnig power pointMatchfixnig power point
Matchfixnig power point
Marco Buus
 
õPpe ja kasvatustöö käsitlemine õpetajatöö kolme järjestiku etapina
õPpe  ja kasvatustöö käsitlemine õpetajatöö kolme järjestiku etapinaõPpe  ja kasvatustöö käsitlemine õpetajatöö kolme järjestiku etapina
õPpe ja kasvatustöö käsitlemine õpetajatöö kolme järjestiku etapina
rita Nevidemskaja
 
Vhdl cevaplari
Vhdl cevaplariVhdl cevaplari
Vhdl cevaplari
sersld80
 
Marsh Magazine, Issue 3 - December 2014
Marsh Magazine, Issue 3 - December 2014Marsh Magazine, Issue 3 - December 2014
Marsh Magazine, Issue 3 - December 2014
Fabio Tomassini
 
Chiropractic Health Orientation
Chiropractic Health OrientationChiropractic Health Orientation
Chiropractic Health Orientation
petimi
 

Viewers also liked (20)

Learn, grow, and discover
Learn, grow, and discoverLearn, grow, and discover
Learn, grow, and discover
 
Excellent presentation On Cancer
Excellent presentation On CancerExcellent presentation On Cancer
Excellent presentation On Cancer
 
Equivariance
EquivarianceEquivariance
Equivariance
 
Viata Domnului nostru Iisus Hristos
Viata Domnului nostru Iisus HristosViata Domnului nostru Iisus Hristos
Viata Domnului nostru Iisus Hristos
 
Technol2
Technol2Technol2
Technol2
 
Electronic Grant Management & Research Administration
Electronic Grant Management & Research AdministrationElectronic Grant Management & Research Administration
Electronic Grant Management & Research Administration
 
12.1. short functional text
12.1. short functional text12.1. short functional text
12.1. short functional text
 
EHR Certification HIMSS Presentation
EHR Certification HIMSS PresentationEHR Certification HIMSS Presentation
EHR Certification HIMSS Presentation
 
CSS Meetup at The Hive in Rock Hill, SC - 2014
CSS Meetup at The Hive in Rock Hill, SC - 2014CSS Meetup at The Hive in Rock Hill, SC - 2014
CSS Meetup at The Hive in Rock Hill, SC - 2014
 
Matchfixnig power point
Matchfixnig power pointMatchfixnig power point
Matchfixnig power point
 
CRNM - Health Study
CRNM - Health StudyCRNM - Health Study
CRNM - Health Study
 
õPpe ja kasvatustöö käsitlemine õpetajatöö kolme järjestiku etapina
õPpe  ja kasvatustöö käsitlemine õpetajatöö kolme järjestiku etapinaõPpe  ja kasvatustöö käsitlemine õpetajatöö kolme järjestiku etapina
õPpe ja kasvatustöö käsitlemine õpetajatöö kolme järjestiku etapina
 
Summer Reading 2011-2012
Summer Reading 2011-2012Summer Reading 2011-2012
Summer Reading 2011-2012
 
Marketing management of LG
Marketing management of LGMarketing management of LG
Marketing management of LG
 
3 อนุกรมเลขคณิต
3 อนุกรมเลขคณิต3 อนุกรมเลขคณิต
3 อนุกรมเลขคณิต
 
Vhdl cevaplari
Vhdl cevaplariVhdl cevaplari
Vhdl cevaplari
 
Marsh Magazine, Issue 3 - December 2014
Marsh Magazine, Issue 3 - December 2014Marsh Magazine, Issue 3 - December 2014
Marsh Magazine, Issue 3 - December 2014
 
VMZINC and Medical Builldings
VMZINC and Medical BuilldingsVMZINC and Medical Builldings
VMZINC and Medical Builldings
 
Chiropractic Health Orientation
Chiropractic Health OrientationChiropractic Health Orientation
Chiropractic Health Orientation
 
Presentation1
Presentation1Presentation1
Presentation1
 

Similar to Formal systems introduction

Class1
 Class1 Class1
Class1
issbp
 
DM in 5 hours fo discrete mathematics in bca semester exam
DM in 5 hours fo discrete mathematics in bca semester examDM in 5 hours fo discrete mathematics in bca semester exam
DM in 5 hours fo discrete mathematics in bca semester exam
nobitashag
 
Set theory- Introduction, symbols with its meaning
Set theory- Introduction, symbols with its meaningSet theory- Introduction, symbols with its meaning
Set theory- Introduction, symbols with its meaning
DipakMahurkar1
 

Similar to Formal systems introduction (20)

file_5.pptx
file_5.pptxfile_5.pptx
file_5.pptx
 
Mathematical preliminaries in Automata
Mathematical preliminaries in AutomataMathematical preliminaries in Automata
Mathematical preliminaries in Automata
 
Set theory and its operations
Set theory and its operations Set theory and its operations
Set theory and its operations
 
Class1
 Class1 Class1
Class1
 
Set Theory.pdf
Set Theory.pdfSet Theory.pdf
Set Theory.pdf
 
sets.ppt
sets.pptsets.ppt
sets.ppt
 
Grade 7 Sets.ppt
Grade 7 Sets.pptGrade 7 Sets.ppt
Grade 7 Sets.ppt
 
07-sets.ppt
07-sets.ppt07-sets.ppt
07-sets.ppt
 
7-Sets-1.ppt
7-Sets-1.ppt7-Sets-1.ppt
7-Sets-1.ppt
 
Rough Entropy-Based Gene Selection
Rough Entropy-Based Gene SelectionRough Entropy-Based Gene Selection
Rough Entropy-Based Gene Selection
 
Ch01
Ch01Ch01
Ch01
 
Sets
SetsSets
Sets
 
DM in 5 hours fo discrete mathematics in bca semester exam
DM in 5 hours fo discrete mathematics in bca semester examDM in 5 hours fo discrete mathematics in bca semester exam
DM in 5 hours fo discrete mathematics in bca semester exam
 
set 1.pdf
set 1.pdfset 1.pdf
set 1.pdf
 
Common Fixed Point Theorems in Uniform Spaces
Common Fixed Point Theorems in Uniform SpacesCommon Fixed Point Theorems in Uniform Spaces
Common Fixed Point Theorems in Uniform Spaces
 
Probability QA 4
Probability QA 4Probability QA 4
Probability QA 4
 
Explore the foundational concepts of sets in discrete mathematics
Explore the foundational concepts of sets in discrete mathematicsExplore the foundational concepts of sets in discrete mathematics
Explore the foundational concepts of sets in discrete mathematics
 
Introduction to Set theory
Introduction to Set theoryIntroduction to Set theory
Introduction to Set theory
 
PRP - Unit 1.pptx
PRP - Unit 1.pptxPRP - Unit 1.pptx
PRP - Unit 1.pptx
 
Set theory- Introduction, symbols with its meaning
Set theory- Introduction, symbols with its meaningSet theory- Introduction, symbols with its meaning
Set theory- Introduction, symbols with its meaning
 

Recently uploaded

Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 

Recently uploaded (20)

How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 

Formal systems introduction

  • 1. IST Studies - UH George Pasparakis Formal Systems Introduction to Formal Systems
  • 2. IST STudies - UH George Pasparakis Languages The terms language and word are used in a strict technical sense in this course: A language is a set of words. A word is a sequence (or string) of symbols.  (or ) denotes the empty word, the sequence of zero symbols.
  • 3. IST STudies - UH George Pasparakis Symbols and Alphabets • What is a symbol, then? • Anything, but it has to come from an alphabet which is a finite set. • A common (and important) instance is = {0, 1}. •  , the empty word, is never an symbol of an alphabet.
  • 4. IST STudies - UH George Pasparakis Computation CPU memory
  • 5. IST STudies - UH George Pasparakis CPU input memory output memory Program memory temporary memory
  • 6. IST STudies - UH George Pasparakis CPU input memory output memory Program memory temporary memory 3 ) ( x x f  compute x x compute x x  2 Example:
  • 7. IST STudies - UH George Pasparakis CPU input memory output memory Program memory temporary memory 3 ) ( x x f  compute x x compute x x  2 2  x
  • 8. IST STudies - UH George Pasparakis CPU input memory output memory Program memory temporary memory 3 ) ( x x f  compute x x compute x x  2 2  x 4 2 * 2   z 8 2 * ) (   z x f
  • 9. IST STudies - UH George Pasparakis CPU input memory output memory Program memory temporary memory 3 ) ( x x f  compute x x compute x x  2 2  x 4 2 * 2   z 8 2 * ) (   z x f 8 ) (  x f
  • 10. IST STudies - UH George Pasparakis Automaton CPU input memory output memory Program memory temporary memory Automaton
  • 11. IST STudies - UH George Pasparakis Different Kinds of Automata Automata are distinguished by the temporary memory • Finite Automata: no temporary memory • Pushdown Automata: stack • Turing Machines: random access memory
  • 12. IST STudies - UH George Pasparakis input memory output memory temporary memory Finite Automaton Finite Automaton Example: Vending Machines (small computing power)
  • 13. IST STudies - UH George Pasparakis input memory output memory Stack Pushdown Automaton Pushdown Automaton Example: Compilers for Programming Languages (medium computing power) Push, Pop
  • 14. IST STudies - UH George Pasparakis input memory output memory Random Access Memory Turing Machine Turing Machine Examples: Any Algorithm (highest computing power)
  • 15. IST STudies - UH George Pasparakis Finite Automata Pushdown Automata Turing Machine Power of Automata Less power More power Solve more computational problems
  • 16. IST STudies - UH George Pasparakis Mathematical Preliminaries
  • 17. IST STudies - UH George Pasparakis Mathematical Preliminaries • Sets • Functions • Relations • Graphs • Proof Techniques
  • 18. IST STudies - UH George Pasparakis } 3 , 2 , 1 {  A A set is a collection of elements SETS } , , , { airplane bicycle bus train B  We write A  1 B ship
  • 19. IST STudies - UH George Pasparakis Set Representations C = { a, b, c, d, e, f, g, h, i, j, k } C = { a, b, …, k } S = { 2, 4, 6, … } S = { j : j > 0, and j = 2k for some k>0 } S = { j : j is nonnegative and even } finite set infinite set
  • 20. IST STudies - UH George Pasparakis A = { 1, 2, 3, 4, 5 } Universal Set: all possible elements U = { 1 , … , 10 } 1 2 3 4 5 A U 6 7 8 9 10
  • 21. IST STudies - UH George Pasparakis Set Operations A = { 1, 2, 3 } B = { 2, 3, 4, 5} • Union A U B = { 1, 2, 3, 4, 5 } • Intersection A B = { 2, 3 } • Difference A - B = { 1 } B - A = { 4, 5 } U A B A-B
  • 22. IST STudies - UH George Pasparakis A • Complement Universal set = {1, …, 7} A = { 1, 2, 3 } A = { 4, 5, 6, 7} 1 2 3 4 5 6 7 A A = A
  • 23. IST STudies - UH George Pasparakis 0 2 4 6 1 3 5 7 even { even integers } = { odd integers } odd Integers
  • 24. IST STudies - UH George Pasparakis DeMorgan’s Laws A U B = A B U A B = A U B U
  • 25. IST STudies - UH George Pasparakis Empty, Null Set: = { } S U = S S = S - = S - S = U = Universal Set
  • 26. IST STudies - UH George Pasparakis Subset A = { 1, 2, 3} B = { 1, 2, 3, 4, 5 } A B U Proper Subset: A B U A B
  • 27. IST STudies - UH George Pasparakis Disjoint Sets A = { 1, 2, 3 } B = { 5, 6} A B = U A B
  • 28. IST STudies - UH George Pasparakis Set Cardinality • For finite sets A = { 2, 5, 7 } |A| = 3
  • 29. IST STudies - UH George Pasparakis Powersets A powerset is a set of sets Powerset of S = the set of all the subsets of S S = { a, b, c } 2S = { , {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c} } Observation: | 2S | = 2|S| ( 8 = 23 )
  • 30. IST STudies - UH George Pasparakis Cartesian Product A = { 2, 4 } B = { 2, 3, 5 } A X B = { (2, 2), (2, 3), (2, 5), ( 4, 2), (4, 3), (4, 5) } |A X B| = |A| |B| Generalizes to more than two sets A X B X … X Z
  • 31. IST STudies - UH George Pasparakis FUNCTIONS domain 1 2 3 a b c range f : A -> B A B If A = domain then f is a total function otherwise f is a partial function f(1) = a
  • 32. IST STudies - UH George Pasparakis RELATIONS R = {(x1, y1), (x2, y2), (x3, y3), …} xi R yi e. g. if R = ‘>’: 2 > 1, 3 > 2, 3 > 1 In relations xi can be repeated
  • 33. IST STudies - UH George Pasparakis Equivalence Relations • Reflexive: x R x • Symmetric: x R y y R x • Transitive: x R y and y R z x R z Example: R = ‘=‘ • x = x • x = y y = x • x = y and y = z x = z
  • 34. IST STudies - UH George Pasparakis Equivalence Classes For equivalence relation R equivalence class of x = {y : x R y} Example: R = { (1, 1), (2, 2), (1, 2), (2, 1), (3, 3), (4, 4), (3, 4), (4, 3) } Equivalence class of 1 = {1, 2} Equivalence class of 3 = {3, 4}
  • 35. IST STudies - UH George Pasparakis GRAPHS A directed graph • Nodes (Vertices) V = { a, b, c, d, e } • Edges E = { (a,b), (b,c), (b,e),(c,a), (c,e), (d,c), (e,b), (e,d) } node a b c d e
  • 36. IST STudies - UH George Pasparakis Labeled Graph a b c d e 1 3 5 6 2 6 2
  • 37. IST STudies - UH George Pasparakis Walk a b c d e Walk is a sequence of adjacent edges (e, d), (d, c), (c, a)
  • 38. IST STudies - UH George Pasparakis Path a b c d e Path is a walk where no edge is repeated Simple path: no node is repeated
  • 39. IST STudies - UH George Pasparakis Cycle a b c d e 1 2 3 Cycle: a walk from a node (base) to itself Simple cycle: only the base node is repeated base
  • 40. IST STudies - UH George Pasparakis Euler Tour a b c d e 1 2 3 4 5 6 7 8 base A cycle that contains each edge once
  • 41. IST STudies - UH George Pasparakis Hamiltonian Cycle a b c d e 1 2 3 4 5 base A simple cycle that contains all nodes
  • 42. IST STudies - UH George Pasparakis Trees root leaf parent child Trees have no cycles
  • 43. IST STudies - UH George Pasparakis root leaf Level 0 Level 1 Level 2 Level 3 Height 3
  • 44. IST STudies - UH George Pasparakis Binary Trees
  • 45. IST STudies - UH George Pasparakis PROOF TECHNIQUES • Proof by induction • Proof by contradiction
  • 46. IST STudies - UH George Pasparakis Induction We have statements P1, P2, P3, … If we know • for some b that P1, P2, …, Pb are true • for any k >= b that P1, P2, …, Pk imply Pk+1 Then Every Pi is true
  • 47. IST STudies - UH George Pasparakis Proof by Induction • Inductive basis Find P1, P2, …, Pb which are true • Inductive hypothesis Let’s assume P1, P2, …, Pk are true, for any k >= b • Inductive step Show that Pk+1 is true
  • 48. IST STudies - UH George Pasparakis Example Theorem: A binary tree of height n has at most 2n leaves. Proof by induction: let L(i) be the number of leaves at level i L(0) = 1 L(1) = 2 L(2) = 4 L(3) = 8
  • 49. IST STudies - UH George Pasparakis We want to show: L(i) <= 2i • Inductive basis L(0) = 1 (the root node) • Inductive hypothesis Let’s assume L(i) <= 2i for all i = 0, 1, …, k • Induction step we need to show that L(k + 1) <= 2k+1
  • 50. IST STudies - UH George Pasparakis Induction Step From Inductive hypothesis: L(k) <= 2k Level k k+1
  • 51. IST STudies - UH George Pasparakis L(k) <= 2k Level k k+1 L(k+1) <= 2 * L(k) <= 2 * 2k = 2k+1 Induction Step
  • 52. IST STudies - UH George Pasparakis Remark Recursion is another thing Example of recursive function: f(n) = f(n-1) + f(n-2) f(0) = 1, f(1) = 1
  • 53. IST STudies - UH George Pasparakis Proof by Contradiction We want to prove that a statement P is true • we assume that P is false • then we arrive at an incorrect conclusion • therefore, statement P must be true
  • 54. IST STudies - UH George Pasparakis Example Theorem: is not rational Proof: Assume by contradiction that it is rational = n/m n and m have no common factors We will show that this is impossible 2 2
  • 55. IST STudies - UH George Pasparakis = n/m 2 m2 = n2 Therefore, n2 is even n is even n = 2 k 2 m2 = 4k2 m2 = 2k2 m is even m = 2 p Thus, m and n have common factor 2 Contradiction! 2