SlideShare a Scribd company logo
1 of 63
1
Computer Science Theory
Prof.Dr. Bekim Fetaji
Formal Specifications
Aims
• Present the concept of Formalspecifications
• Present the concept for Zlanguage
Objectives
• Haveaclear understanding of Formalspecifications
• Haveaclear understanding for Z– ZEDLanguage
• Understand, read and interpret Formalspecifications
3
What is a formal specification?
4
Prof.Dr. Bekim Fetaji (b.fetaji@seeu.edu.mk)
Formal Specification
mathematical description of software or
hardware that may be used to develop an
implementation.
Uses mathematical notation to describe in
a precise way the properties which an
information system must have
FORMAL METHODS
5
Prof.Dr. Bekim Fetaji (b.fetaji@seeu.edu.mk)
Techniques based upon mathematics can be
used at every stage of software development.
Why mathematics?
abstraction vs confusion
precision vs ambiguity
reason vs doubt
Programming Language vs Mathematics
Benefits of Using formal Specification
6
Prof.Dr. Bekim Fetaji (b.fetaji@seeu.edu.mk)
Benefits of Using formal Specification
7
Prof.Dr. Bekim Fetaji (b.fetaji@seeu.edu.mk)
Structure of a Formal specification language
8
Prof.Dr. Bekim Fetaji (b.fetaji@seeu.edu.mk)
Z Notation
9
Prof.Dr. Bekim Fetaji (b.fetaji@seeu.edu.mk)
The Z notation
universally pronounced zed, named after
Zermelo-Fränkel set theory
is a formal specification language used for
describing and modeling computing systems.
Z Notation
The Z Notation represents;
•a mathematical language of logic, sets, and relations;
•a schema language of patterns and objects;
•a theory of refinement between abstract data types.
10
Prof.Dr. Bekim Fetaji (b.fetaji@seeu.edu.mk)
Formal verification
11
Prof.Dr. Bekim Fetaj
The act of proving or disproving the correctness of
a system with respect to a certain formal
specification or property, using formal methods of
mathematics.
The verification of these systems is done by
providing a formal proof on an abstract
mathematical model of the system, the
correspondance between the mathematical model
and the nature of the system being otherwise
known by construction.
Refinement
12
Prof.Dr. Bekim Fetaji
The verifiable transformation of an abstract (high-level) formal
specification into a concrete executable program.
Stepwise refinement allows this process to be done in
stages. Logically, refinement normally involves implication,
but there can be additional complications.
Data refinement is used to convert an abstract data model
(in terms of sets for example) into implementable data
structures (such as arrays).
Operation refinement converts a specification of an
operation on a system into an implementable program (e.g.,
a procedure).
RECAP
13
Prof.Dr. Bekim Fetaji (b.fetaji@seeu.edu.mk)
RECAP
14
Prof.Dr. Bekim Fetaji (b.fetaji@seeu.edu.mk)
RECAP
15
Prof.Dr. Bekim Fetaji (b.fetaji@seeu.edu.mk)
RECAP
16
Prof.Dr. Bekim Fetaji (b.fetaji@seeu.edu.mk)
RECAP
17
Prof.Dr. Bekim Fetaji (b.fetaji@seeu.edu.mk)
RECAP
18
Prof.Dr. Bekim Fetaji (b.fetaji@seeu.edu.mk)
RECAP
PRACTICAL EXAMPLES:
1)
19
Prof.Dr. Bekim Fetaji (b.fetaji@seeu.edu.mk)
RECAP
PRACTICAL EXAMPLE:
1)
20
Prof.Dr. Bekim Fetaji (b.fetaji@seeu.edu.mk)
RECAP
PRACTICAL EXAMPLES:
2)
21
Prof.Dr. Bekim Fetaji (b.fetaji@seeu.edu.mk)
RECAP
PRACTICAL EXAMPLE:
2)
1
22
Prof.Dr. Bekim Fetaji (b.fetaji@seeu.edu.mk)
2 5 4 3
PRACTICAL EXAMPLE:
2 1 6 3 5 4
3) (p q r) (p q) (q r)
Prof.Dr. Bekim Fetaji (b.fetaji@seeu.edu.mk) 23
RECAP
PRACTICAL EXAMPLE:
2 1 6 4 5 3
4) (p q r) (p q) (
q r
)
24
Prof.Dr. Bekim Fetaji (b.fetaji@seeu.edu.mk)
RECAP
PRACTICAL EXAMPLE:
1 2 6 4 5 3
5) (p q r) (p q) (
q r)
25
Prof.Dr. Bekim Fetaji (b.fetaji@seeu.edu.mk)
RECAP
PRACTICAL EXAMPLE:
2 3 1 9 6 7 8 4 5
6) (p q r z) (p q z) (q r z)
26
Prof.Dr. Bekim Fetaji
FUNCTIONS IN ZED
Partial function: if for each x there is a description (mapping) of y
Total function, if also for each x, there is some y;
27
Prof.Dr. Bekim Fetaji (b.fetaji@seeu.edu.mk)
with xR® y
FUNCTIONS IN ZED
Injective function
А function f is said to be injective (one-to-one) if it maps distinct x in the
domain to distinct y in the codomain, such that f(x) = y.
Domain Range (codomain)
28
Prof.Dr. Bekim Fetaji (b.fetaji@seeu.edu.mk)
FUNCTIONS IN ZED
Surjective function
А function f is said to be surjective (onto) if its values span its whole codomain;
that is, for every y in the codomain, there is at least one x in the domain such that
f(x) = y.
Domain Range (codomain)
29
Prof.Dr. Bekim Fetaji (b.fetaji@seeu.edu.mk)
FUNCTIONS IN ZED
Bijective function
Bijective function is a function f (Injective and surjective at the same time)
from a set X to a set Y with the property that, for every y in Y, there is exactly
one x in X such that f(x) = y.
Domain Range (codomain)
30
Prof.Dr. Bekim Fetaji (b.fetaji@seeu.edu.mk)
FUNCTIONS IN ZED
Symbols
SIMBOLS
31
Prof.Dr. Bekim Fetaji (b.fetaji@seeu.edu.mk)
FUNCTIONS IN ZED
PRACTICAL EXAMPLE 1:
32
Prof.Dr. Bekim Fetaji (b.fetaji@seeu.edu.mk)
FUNCTIONS IN ZED
PRACTICAL EXAMPLE 2:
33
Prof.Dr. Bekim Fetaji (b.fetaji@seeu.edu.mk)
FUNCTIONS IN ZED
PRACTICAL EXAMPLE 3:
34
Prof.Dr. Bekim Fetaji (b.fetaji@seeu.edu.mk)
FUNCTIONS IN ZED
PRACTICAL EXAMPLE 4:
35
Prof.Dr. Bekim Fetaji (b.fetaji@seeu.edu.mk)
FUNCTIONS IN ZED
PRACTICAL EXAMPLES:
36
Prof.Dr. Bekim Fetaji (b.fetaji@seeu.edu.mk)
FUNCTIONS IN ZED
PRACTICAL EXAMPLES:
37
Prof.Dr. Bekim Fetaji (b.fetaji@seeu.edu.mk)
FUNCTIONS IN ZED
PRACTICAL EXAMPLES:
38
Prof.Dr. Bekim Fetaji (b.fetaji@seeu.edu.mk)
FUNCTIONS IN ZED
PRACTICAL EXAMPLES:
39
Prof.Dr. Bekim Fetaji (b.fetaji@seeu.edu.mk)
FUNCTIONS IN ZED
PRACTICAL EXAMPLES:
40
Prof.Dr. Bekim Fetaji (b.fetaji@seeu.edu.mk)
41
Z Schema
42
43
44
QUESTIONS
Prof.Dr. Bekim Fetaji (b.fetaji@seeu.edu.mk)
PRACTICAL
Assignments 1
1
1
Prof.Dr. BekimFetaji
Konjukcioni Disjunkcioni
Implikacioni Ekuivalenca
RECAP
PRACTICALEXAMPLE:
1)
3
3
Prof.Dr. BekimFetaji(b.fetaji@seeu.edu.mk)
RECAP
PRACTICALEXAMPLE:
2)
1 2 5 4 3
4
4
Prof.Dr. BekimFetaji
Assignment
Prof.Dr. BekimFetaji(b.fetaji@seeu
p q r (p V q  r )  (p q)
r
t t t
.edu.mk) 5
5
Assignment
2 1 6 3 5 4
2) (p q r) (p q) (
q r
)
Prof.Dr. BekimFetaji(b.fetaji@seeu
p q r (p q r) (p q) (q r)
.edu.mk) 6
6
Assignment
2 1 6 4 5 3
3) (p q r) (p q) (
qr
)
p q r (p q r) (p q) (q r)
Prof.Dr.Bekim Fetaji (b.fetaji@seeu.edu.mk) 7
7
Assignment
1 2 6 4 5 3
4) (p q r) (p q)
(
qr
)
Pro
p q r (p q r) (p q) (q r)
f.Dr. Bekim Fetaji (b.fetaji@seeu.edu.mk) 8
8
Assignment
2 3 1 9 6 7 8 4 5
5) (p q r z) (p q z) (q r z)
p q r (p q r z) (p q z) (q r z)
9
9
Prof.Dr. BekimFetaji(b.fetaji@seeu.edu.mk)
Assignment
2 3 1 9 6 7 8 4 5
5) (p q r z) (p q z) (q r z)
p q r (p q r z) (p q z) (q r z)
9
9
Prof.Dr. BekimFetaji(b.fetaji@seeu.edu.mk)
6) ( p q r) (p q) ( q r)
Assignment
2 3 1 9 6 7 8 4 5
5) (p q r z) (p q z) (q r z)
p q r (p q r z) (p q z) (q r z)
9
9
Prof.Dr. BekimFetaji(b.fetaji@seeu.edu.mk)
7) ( p q) ( p q r) ( q r)
PRACTICAL
Assignments 2
1
1
0
0
Prof.Dr. BekimFetaji(b.fetaji@seeu.edu.mk)
FUNCTIONS IN ZED
Partial function:if for each x there is adescription (mapping) of y
Totalfunction,if also for each x, there is somey;
1
1
1
1
Prof.Dr. BekimFetaji(b.fetaji@seeu.edu.mk)
with xR®y
FUNCTIONS IN ZED
Symbols
SIMBOLS
1
1
2
2
Prof.Dr. BekimFetaji(b.fetaji@seeu.edu.mk)
FUNCTIONS IN ZED
PRACTICALEXAMPLE 8:
What kindof a function is this?
1
1
3
3
Prof.Dr. BekimFetaji(b.fetaji@seeu.edu.mk)
FUNCTIONS IN ZED
PRACTICALEXAMPLE 9:
What kind of a function is this?
1
1
4
4
Prof.Dr. BekimFetaji(b.fetaji@seeu.edu.mk)
FUNCTIONS IN ZED
PRACTICALEXAMPLE 10: What kindof a function is this?
1
1
5
5
Prof.Dr. BekimFetaji(b.fetaji@seeu.edu.mk)
FUNCTIONS IN ZED
PRACTICALEXAMPLE 11: What kind of a function is this?
1
1
6
6
Prof.Dr. BekimFetaji(b.fetaji@seeu.edu.mk)
Assignment
Prof.Dr. BekimFetaji
12) Write an explanation what is Z and what are the benefits of using Z (ZED)?

More Related Content

Similar to 1 - Introduction to Formal Specification.pptx

WachemoUniversity_Cryptography_and_Network_Security.pdf
WachemoUniversity_Cryptography_and_Network_Security.pdfWachemoUniversity_Cryptography_and_Network_Security.pdf
WachemoUniversity_Cryptography_and_Network_Security.pdf
LegesseSamuel
 
QwalKeko, a History Querying Tool
QwalKeko, a History Querying ToolQwalKeko, a History Querying Tool
QwalKeko, a History Querying Tool
stevensreinout
 
Shared Editing on the Web: A Classification of Developer Support Frameworks
Shared Editing on the Web: A Classification of Developer Support FrameworksShared Editing on the Web: A Classification of Developer Support Frameworks
Shared Editing on the Web: A Classification of Developer Support Frameworks
IstvanKoren
 

Similar to 1 - Introduction to Formal Specification.pptx (20)

Strategies for Rule-Based Program Transformation
Strategies for Rule-Based Program TransformationStrategies for Rule-Based Program Transformation
Strategies for Rule-Based Program Transformation
 
“Towards Multi-Step Expert Advice for Cognitive Computing” - Dr. Achim Rettin...
“Towards Multi-Step Expert Advice for Cognitive Computing” - Dr. Achim Rettin...“Towards Multi-Step Expert Advice for Cognitive Computing” - Dr. Achim Rettin...
“Towards Multi-Step Expert Advice for Cognitive Computing” - Dr. Achim Rettin...
 
New Features of Python 3.10
New Features of Python 3.10New Features of Python 3.10
New Features of Python 3.10
 
WachemoUniversity_Cryptography_and_Network_Security.pdf
WachemoUniversity_Cryptography_and_Network_Security.pdfWachemoUniversity_Cryptography_and_Network_Security.pdf
WachemoUniversity_Cryptography_and_Network_Security.pdf
 
Beyond the GFLOPS
Beyond the GFLOPSBeyond the GFLOPS
Beyond the GFLOPS
 
Sciunits: Resuable Research Object
Sciunits: Resuable Research Object Sciunits: Resuable Research Object
Sciunits: Resuable Research Object
 
Boetticher Presentation Promise 2008v2
Boetticher Presentation Promise 2008v2Boetticher Presentation Promise 2008v2
Boetticher Presentation Promise 2008v2
 
QwalKeko, a History Querying Tool
QwalKeko, a History Querying ToolQwalKeko, a History Querying Tool
QwalKeko, a History Querying Tool
 
ACS 248th Paper 67 Eureka Collaboration
ACS 248th Paper 67 Eureka CollaborationACS 248th Paper 67 Eureka Collaboration
ACS 248th Paper 67 Eureka Collaboration
 
Object? You Keep Using that Word
Object? You Keep Using that WordObject? You Keep Using that Word
Object? You Keep Using that Word
 
OVERALL PERFORMANCE EVALUATION OF ENGINEERING STUDENTS USING FUZZY LOGIC
OVERALL PERFORMANCE EVALUATION OF ENGINEERING STUDENTS USING FUZZY LOGICOVERALL PERFORMANCE EVALUATION OF ENGINEERING STUDENTS USING FUZZY LOGIC
OVERALL PERFORMANCE EVALUATION OF ENGINEERING STUDENTS USING FUZZY LOGIC
 
Shared Editing on the Web: A Classification of Developer Support Frameworks
Shared Editing on the Web: A Classification of Developer Support FrameworksShared Editing on the Web: A Classification of Developer Support Frameworks
Shared Editing on the Web: A Classification of Developer Support Frameworks
 
Jalt2014
Jalt2014Jalt2014
Jalt2014
 
1901200100000 presentation short term mini project on python
1901200100000 presentation short term mini project on python1901200100000 presentation short term mini project on python
1901200100000 presentation short term mini project on python
 
LOA seminar 2017 - Product and 3D geometry ontologies at action in constructi...
LOA seminar 2017 - Product and 3D geometry ontologies at action in constructi...LOA seminar 2017 - Product and 3D geometry ontologies at action in constructi...
LOA seminar 2017 - Product and 3D geometry ontologies at action in constructi...
 
FScaFi: A Core Calculus for Collective Adaptive Systems Programming
FScaFi: A Core Calculus for Collective Adaptive Systems ProgrammingFScaFi: A Core Calculus for Collective Adaptive Systems Programming
FScaFi: A Core Calculus for Collective Adaptive Systems Programming
 
STATICMOCK : A Mock Object Framework for Compiled Languages
STATICMOCK : A Mock Object Framework for Compiled Languages STATICMOCK : A Mock Object Framework for Compiled Languages
STATICMOCK : A Mock Object Framework for Compiled Languages
 
TexGen: Open Source Software for Modelling of Textile Composites
TexGen: Open Source Software for Modelling of Textile CompositesTexGen: Open Source Software for Modelling of Textile Composites
TexGen: Open Source Software for Modelling of Textile Composites
 
Fosdem 2013 petra selmer flexible querying of graph data
Fosdem 2013 petra selmer   flexible querying of graph dataFosdem 2013 petra selmer   flexible querying of graph data
Fosdem 2013 petra selmer flexible querying of graph data
 
Determining costs of construction errors, based on fuzzy logic systems ipcmc2...
Determining costs of construction errors, based on fuzzy logic systems ipcmc2...Determining costs of construction errors, based on fuzzy logic systems ipcmc2...
Determining costs of construction errors, based on fuzzy logic systems ipcmc2...
 

Recently uploaded

Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
EADTU
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
CaitlinCummins3
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code Examples
Peter Brusilovsky
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
中 央社
 

Recently uploaded (20)

Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
 
Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...
 
UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................
 
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhĐề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
 
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
 
Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategies
 
Supporting Newcomer Multilingual Learners
Supporting Newcomer  Multilingual LearnersSupporting Newcomer  Multilingual Learners
Supporting Newcomer Multilingual Learners
 
Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 
How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio App
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code Examples
 
8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management
 
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
 
Scopus Indexed Journals 2024 - ISCOPUS Publications
Scopus Indexed Journals 2024 - ISCOPUS PublicationsScopus Indexed Journals 2024 - ISCOPUS Publications
Scopus Indexed Journals 2024 - ISCOPUS Publications
 
Book Review of Run For Your Life Powerpoint
Book Review of Run For Your Life PowerpointBook Review of Run For Your Life Powerpoint
Book Review of Run For Your Life Powerpoint
 
Including Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdfIncluding Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdf
 

1 - Introduction to Formal Specification.pptx