SlideShare a Scribd company logo
Formal Methods in
Software
Lecture 4. Z Notation
Vlad Patryshev
SCU
2014
you may need Chrome browser to view these slides
Z Notation, a Specification Language
● Vaguely based on typed version of Zermelo-Fraenkel set theory
● Uses set-theoretic notation for algorithm description
● Software tools exist(ed) that could, arguably, verify algorithms
● Related to computational logic
● Partially replaced these days by Coq and Agda
● ISO standard: ISO/IEC 13568:2002
● WSDL definition uses it
● Lives in an ideal world, not very good for programming with effects
● But is related to Agda
The Logic of Z
● Propositional logic
○ predicates; true/false
○ connectives: a∧b, a∨b,¬a, a⇒b, a⇔b
● Quantifiers
○ ∀x • q
○ ∃x • q
○ ∃1
x • q (“exists unique”)
● Many laws (but nothing unusual)
Z has types and constraints
a:T - a is of type T
q a - a satisfies a constraint (a predicate) q
E.g.
a,b: Human
x: Dog
likes(a,x)
likes(b,x)
loves(x,a)
loves(x,b)
Signature
Predicates (constraints)
Z uses typed sets
● ∅[T] - empty set of elements of type T
● {Peter, Paul, James} - a set of people; elements must be of the same type
● order does not matter; repetitions make no sense
● x∈S - x is an element of S e.g. William ∉ {Jonathan, Jane, Alice, Emma}
● P∪Q - union
● P∩Q - intersection
● PQ - complement ({x∈P|x∉Q})
● P ⊆ Q - P is a subset of Q (P∩Q=P)
● P-
- complement of P, all members of type that do not belong to P (P-
=TP)
E.g. T-
=∅[T] and ∅[T]-
=T
● ∪{A,B,C,...} = A ∪B∪C∪…
● ∩{A,B,C,...} = A∩B∩C∩…
Set Comprehension
{x∈T|P(x)} - a set of all such x that P(x) is true
Properties:
● {x:T |p}∩{x:T |q}={x:T |p ∧q}
● {x:T |p}∪{x:T |q}={x:T |p ∨q}
● {x:T |p}− ={x:T |¬p}
● {x:T |p}⊆{x:T |q} ≡ p⇒q
● {x:T |p}={x:T |q} ≡ p ⇔q
● ∅[T]={x:T |false}
● T={x:T |true}
Cartesian Product
If T and U are types,
T×U is the type of pairs (t,u), where t:T, u:U
If P and Q are sets, P×Q = {p:T; q:U|p∈P∧q∈Q • (p,q)}
(meaning, take ps from P, qs from Q, produce all pairs (p,q))
Powerset
X∈ℙS ≡ X⊆S
E.g.
ℙ∅ = {∅}; ℙ{a} = {∅,{a}}
Finite subsets of S: FS
ℙ1
S = {X∈ℙS | X!=∅}
F
1
S = {X∈FS | X!=∅}
Binary Relations
R⊆P×Q
Notation: given a relation R, pRq means (p,q)∈R
Alternative notation for pairs (p,q): p↦q
E.g. authors = {Bjarne ↦ Cpp, Guido ↦ Python, Martin ↦
Scala}
Set of all relations T ↔ U == ℙ(T × U)
E.g. authors ∈ Humans ↔ Languages
Domain and Range
R ∈ T ↔ U
dom R = {x:T |(∃y:U•(x,y)∈R)} - not a very good idea, actually
ran R = {y:U |(∃x:T•(x,y)∈R)} - an even worse idea
E.g.
dom authors = {Bjarne, Guido, Martin}
ran authors = {Cpp, Python, Scala}
Inverse Relation
Every relation has an inverse
R∼
= {y:U;x:T|(x,y)∈R}
E.g. authors = {Bjarne↦Cpp, Guido↦Python, Martin↦Scala}
authors~
= {Cpp↦Bjarne, Python↦Guido, Scala↦Martin}
Obviously,
● ran(R∼
) = dom R
● dom(R∼
) = ran R
● (R∼
)∼
= R
Functions are Relations
● Partial Function f: A B ≡
∀x:A ∀y1
,y2
:B (x,y1
)∈f∧(x,y2
)∈f⇒y1
=y2
● Total function f: A→B ≡ f is p.f. and
∀x:A ∃y:B (x,y)∈f
● Injection f: A↣B ≡ f is function, and
∀x1
,x2
:A (x1
,y)∈f∧(x2
,y)∈f⇒x1
=x2
● Surjection f: A↠B: f is function, and
∀y:B ∃x:A (x,y)∈f
● Partial injection, partial surjection
● Finite partial function, A B
● Identity id A = {(x,x):T×T|x∈A}
● RTL Composition Q∘R = {(z,x):T×V|∃y:U•(y,x)∈R∧(z,y)∈Q}
● Domain restriction A◁R = {(x,y):T×U|(x,y)∈R∧x∈A}
● Domain anti-restriction A R = {(x,y):T×U|(x,y)∈R∧x∉A}
● Range restriction A▷R = {(x,y):T×U|(x,y)∈R∧y∈A}
● Range anti-restriction A R = {(x,y):T×U|(x,y)∈R∧y∉A}
● Image R(|A|) = {y:U|∃x:T•(x,y)∈R∧x∈A
● Inverse R~
● Iteration iter n R = R∘(iter (n-1) R); iter 0 R = id
● Overriding Q⨁R = (dom R Q) ∪ R
Operations on Relations
Numbers
● ℤ - all integers
● ℕ = {x∈ℤ|x≥0}
● _+_, _-_, _*_, _div_, _mod_, -_
● _≥_, _>_, _≤_, _<_
● max(<nonempty set>), min
Axiomatic Description
● new operator
● new data with constraint
abs : Z → Z
∀n:Z•
n ≤ 0 ⇒ abs n = −n ∧ n ≥ 0 ⇒ abs n = n
n:ℕ
n<10
Iteration etc
● Introduce succ=={0↦1,1↦2,...}; pred==succ~
● succ = ℕ◁(_+1)
● Rn
=R∘R∘...∘R
e.g. succn
= ℕ◁(_+n)
● Number range a..b={n:ℕ|a≤n≤b}
● Cardinality of set S ∈ F T , #S
(For a set to be ‘finite’, it must be in bijection with 1..n for some n.)
Introducing New Types
● Just by naming, [A]
● data type (like enum): Friends ::= Peter|John|James
● recursively, e.g. ℕ ::= zero | succ⟨⟨ℕ⟩⟩
Sequences
seq T =={s:ℕ T |∃n:ℕ • dom s = 1..n}
● ⟨⟩ - empty sequence
● Nonempty sequence seq1
T == seq T  {⟨⟩}
● Injective sequence iseq T == {f: seq T| injective f}
● ⟨’a’,’b’,’c’⟩
● concatenation: ⟨’a’,’b’,’c’⟩◠⟨’d’,’e’,’f’⟩
● prefix ⟨’a’,’b’⟩ ⊆ ⟨’a’,’b’,’c’⟩
● head s = s(1); last s = s(#s); tail s; front s
● rev ⟨⟩ = ⟨⟩, rev ⟨x⟩ = ⟨x⟩, rev(s◠t) = rev(t)◠rev(s)
Schemas
Example:
alternatively,
Book≘[author:People;title:seq CHAR; readership: ℙ People;rating:0..10 |
readership = dom rating]
author:People
title: seq CHAR
readership: ℙ People
rating: ↠ 0..10
readership = dom
rating
Book
State Machine: Operational Schema
Operation ≘ [
x1
:S1
;...;xn
:Sn
; // current state
x1
′:S1
;...;xn
′:Sn
; // new state
i1
?:T1
;...;im
?:Tm
; // input
o1
!:U1
;...;op
!:Up
// output
|
Pre(i1
?,...,im
?,x1
,...,xn
); // preconditions
Inv(x1
,...,xn
); // invariants
Inv(x1
′,...,xn
′); // invariants
Op(i1
?,...,im
?,x1
,...,xn
,x1
′ ,...,xn
′ ,o1
!,...,op
!) // step function
]
Example of Operational Schema
AddBirthday ≘ [
known : ℙ NAME;
birthday : NAME DATE
known′ : ℙ NAME;
birthday′ : NAME DATE
name? : NAME;
date? : DATE;
|
name? ∉ known;
known = dom birthday;
known′ = dom birthday′;
birthday′ = birthday ∪ {name? ↦ date?}
]
Δ: Operational Schemas Reuse
StateSpace ≘ [ x1
:S1
;...;xn
:Sn
| Inv(x1
,...,xn
) ]
Operation ≘ [
Δ StateSpace; // encapsulates changing state
i1
?:T1
;...;im
?:Tm
; // input
o1
!:U1
;...;op
!:Up
// output
|
Pre(i1
?,...,im
?,x1
,...,xn
); // preconditions
Op(i1
?,...,im
?,x1
,...,xn
,x1
′ ,...,xn
′ ,o1
!,...,op
!) // step function
]
Example of Δ inclusion
AddBirthday ≘ [
Δ BirthdayBook;
name? : NAME;
date? : DATE;
|
name? ∉ known;
birthday′ = birthday ∪ {name? ↦ date?}
]
Operations that don’t change State
Operation ≘ [
x1
:S1
;...;xn
:Sn
; // current state
x1
′:S1
;...;xn
′:Sn
; // new state
i1
?:T1
;...;im
?:Tm
; // input
o1
!:U1
;...;op
!:Up
// output
|
Pre(i1
?,...,im
?,x1
,...,xn
); // preconditions
Inv(x1
,...,xn
); // invariants
Inv(x1
′,...,xn
′ ); // invariants
(x1
’=x1
∧x2
’=x2
∧...∧xn
’=xn
); // state does not change
Op(i1
?,...,im
?,x1
,...,xn
,x1
′ ,...,xn
′ ,o1
!,...,op
!) // step function
]
Ξ: Operational Schemas Reuse
Greek letter Ξ, pronounced as /ˈzaɪ/ or /ˈksaɪ/
Operation ≘ [
Ξ StateSpace; // encapsulates unchanging state
i1
?:T1
;...;im
?:Tm
; // input
o1
!:U1
;...;op
!:Up
// output
|
Pre(i1
?,...,im
?,x1
,...,xn
); // preconditions
Op(i1
?,...,im
?,x1
,...,xn
,x1
′ ,...,xn
′ ,o1
!,...,op
!) // step function
]
Example of Ξ inclusion
FindBirthday ≘ [
Ξ BirthdayBook;
name? : NAME;
date! : DATE;
|
name? ∈ known;
date! = birthday(name?)
]
And more...
● Can compose schema states
● Can connect schemas (output to input)
● Can include schemas
WSDL
http://www.w3.org/TR/wsdl20/wsdl20-z.html
ServiceComponents ≘ [ ComponentModel1; serviceComps :ℙ Service; endpointComps : ℙ Endpoint;|
serviceComps = { x : Service |service(x)∈components }
endpointComps = { x : Endpoint | endpoint(x)∈components }
]
References
http://images4.wikia.nocookie.net/formalmethods/images/4/4e/Zbook.pdf
ISO/IEC 13568:2002
W3C WSDL standard
Wikipedia
Formal methods   4 - Z notation

More Related Content

What's hot

Circle generation algorithm
Circle generation algorithmCircle generation algorithm
Circle generation algorithm
Ankit Garg
 
Decision properties of reular languages
Decision properties of reular languagesDecision properties of reular languages
Decision properties of reular languages
SOMNATHMORE2
 
Introduction to Web Architecture
Introduction to Web ArchitectureIntroduction to Web Architecture
Introduction to Web Architecture
Chamnap Chhorn
 
Software architecture design ppt
Software architecture design pptSoftware architecture design ppt
Software architecture design ppt
farazimlak
 
2D Rotation- Transformation in Computer Graphics
2D Rotation- Transformation in Computer Graphics2D Rotation- Transformation in Computer Graphics
2D Rotation- Transformation in Computer Graphics
Susmita
 
Spline representations
Spline representationsSpline representations
Spline representations
Nikhil krishnan
 
Uml in software engineering
Uml in software engineeringUml in software engineering
Uml in software engineering
Mubashir Jutt
 
Software project management
Software project managementSoftware project management
Software project management
R A Akerkar
 
Prolog basics
Prolog basicsProlog basics
Prolog basics
shivani saluja
 
Finite Automata
Finite AutomataFinite Automata
Finite Automata
Mukesh Tekwani
 
Lab report for Prolog program in artificial intelligence.
Lab report for Prolog program in artificial intelligence.Lab report for Prolog program in artificial intelligence.
Lab report for Prolog program in artificial intelligence.
Alamgir Hossain
 
Software Quality Management
Software Quality ManagementSoftware Quality Management
Software Quality Management
Krishna Sujeer
 
Curves and surfaces
Curves and surfacesCurves and surfaces
Curves and surfaces
Mohammed Mahmoud
 
Design and Analysis of Algorithms.pptx
Design and Analysis of Algorithms.pptxDesign and Analysis of Algorithms.pptx
Design and Analysis of Algorithms.pptx
Syed Zaid Irshad
 
Basic concepts for python web development
Basic concepts for python web developmentBasic concepts for python web development
Basic concepts for python web development
NexSoftsys
 
UNIT-1-PPTS-DAA.ppt
UNIT-1-PPTS-DAA.pptUNIT-1-PPTS-DAA.ppt
UNIT-1-PPTS-DAA.ppt
racha49
 
Software Configuration Management (SCM)
Software Configuration Management (SCM)Software Configuration Management (SCM)
Software Configuration Management (SCM)
Er. Shiva K. Shrestha
 
2 d transformations and homogeneous coordinates
2 d transformations and homogeneous coordinates2 d transformations and homogeneous coordinates
2 d transformations and homogeneous coordinates
Tarun Gehlot
 
Introduction to Compiler design
Introduction to Compiler design Introduction to Compiler design
Introduction to Compiler design
Dr. C.V. Suresh Babu
 
Artificial intelligence and first order logic
Artificial intelligence and first order logicArtificial intelligence and first order logic
Artificial intelligence and first order logic
parsa rafiq
 

What's hot (20)

Circle generation algorithm
Circle generation algorithmCircle generation algorithm
Circle generation algorithm
 
Decision properties of reular languages
Decision properties of reular languagesDecision properties of reular languages
Decision properties of reular languages
 
Introduction to Web Architecture
Introduction to Web ArchitectureIntroduction to Web Architecture
Introduction to Web Architecture
 
Software architecture design ppt
Software architecture design pptSoftware architecture design ppt
Software architecture design ppt
 
2D Rotation- Transformation in Computer Graphics
2D Rotation- Transformation in Computer Graphics2D Rotation- Transformation in Computer Graphics
2D Rotation- Transformation in Computer Graphics
 
Spline representations
Spline representationsSpline representations
Spline representations
 
Uml in software engineering
Uml in software engineeringUml in software engineering
Uml in software engineering
 
Software project management
Software project managementSoftware project management
Software project management
 
Prolog basics
Prolog basicsProlog basics
Prolog basics
 
Finite Automata
Finite AutomataFinite Automata
Finite Automata
 
Lab report for Prolog program in artificial intelligence.
Lab report for Prolog program in artificial intelligence.Lab report for Prolog program in artificial intelligence.
Lab report for Prolog program in artificial intelligence.
 
Software Quality Management
Software Quality ManagementSoftware Quality Management
Software Quality Management
 
Curves and surfaces
Curves and surfacesCurves and surfaces
Curves and surfaces
 
Design and Analysis of Algorithms.pptx
Design and Analysis of Algorithms.pptxDesign and Analysis of Algorithms.pptx
Design and Analysis of Algorithms.pptx
 
Basic concepts for python web development
Basic concepts for python web developmentBasic concepts for python web development
Basic concepts for python web development
 
UNIT-1-PPTS-DAA.ppt
UNIT-1-PPTS-DAA.pptUNIT-1-PPTS-DAA.ppt
UNIT-1-PPTS-DAA.ppt
 
Software Configuration Management (SCM)
Software Configuration Management (SCM)Software Configuration Management (SCM)
Software Configuration Management (SCM)
 
2 d transformations and homogeneous coordinates
2 d transformations and homogeneous coordinates2 d transformations and homogeneous coordinates
2 d transformations and homogeneous coordinates
 
Introduction to Compiler design
Introduction to Compiler design Introduction to Compiler design
Introduction to Compiler design
 
Artificial intelligence and first order logic
Artificial intelligence and first order logicArtificial intelligence and first order logic
Artificial intelligence and first order logic
 

Similar to Formal methods 4 - Z notation

Introduction to modern Variational Inference.
Introduction to modern Variational Inference.Introduction to modern Variational Inference.
Introduction to modern Variational Inference.
Tomasz Kusmierczyk
 
Low Complexity Regularization of Inverse Problems
Low Complexity Regularization of Inverse ProblemsLow Complexity Regularization of Inverse Problems
Low Complexity Regularization of Inverse Problems
Gabriel Peyré
 
Runtime Analysis of Population-based Evolutionary Algorithms
Runtime Analysis of Population-based Evolutionary AlgorithmsRuntime Analysis of Population-based Evolutionary Algorithms
Runtime Analysis of Population-based Evolutionary Algorithms
Per Kristian Lehre
 
Runtime Analysis of Population-based Evolutionary Algorithms
Runtime Analysis of Population-based Evolutionary AlgorithmsRuntime Analysis of Population-based Evolutionary Algorithms
Runtime Analysis of Population-based Evolutionary Algorithms
PK Lehre
 
QMC Program: Trends and Advances in Monte Carlo Sampling Algorithms Workshop,...
QMC Program: Trends and Advances in Monte Carlo Sampling Algorithms Workshop,...QMC Program: Trends and Advances in Monte Carlo Sampling Algorithms Workshop,...
QMC Program: Trends and Advances in Monte Carlo Sampling Algorithms Workshop,...
The Statistical and Applied Mathematical Sciences Institute
 
Computation in Real Closed Infinitesimal and Transcendental Extensions of the...
Computation in Real Closed Infinitesimal and Transcendental Extensions of the...Computation in Real Closed Infinitesimal and Transcendental Extensions of the...
Computation in Real Closed Infinitesimal and Transcendental Extensions of the...
TawseefAhmad25
 
Low Complexity Regularization of Inverse Problems - Course #2 Recovery Guaran...
Low Complexity Regularization of Inverse Problems - Course #2 Recovery Guaran...Low Complexity Regularization of Inverse Problems - Course #2 Recovery Guaran...
Low Complexity Regularization of Inverse Problems - Course #2 Recovery Guaran...
Gabriel Peyré
 
Discrete mathematics
Discrete mathematicsDiscrete mathematics
Discrete mathematics
M.Saber
 
Higher-order Factorization Machines(第5回ステアラボ人工知能セミナー)
Higher-order Factorization Machines(第5回ステアラボ人工知能セミナー)Higher-order Factorization Machines(第5回ステアラボ人工知能セミナー)
Higher-order Factorization Machines(第5回ステアラボ人工知能セミナー)
STAIR Lab, Chiba Institute of Technology
 
Abstract machines for great good
Abstract machines for great goodAbstract machines for great good
Abstract machines for great good
Александр Ежов
 
A new Perron-Frobenius theorem for nonnegative tensors
A new Perron-Frobenius theorem for nonnegative tensorsA new Perron-Frobenius theorem for nonnegative tensors
A new Perron-Frobenius theorem for nonnegative tensors
Francesco Tudisco
 
Introduction to Artificial Neural Networks
Introduction to Artificial Neural NetworksIntroduction to Artificial Neural Networks
Introduction to Artificial Neural Networks
Stratio
 
Truth, deduction, computation lecture f
Truth, deduction, computation   lecture fTruth, deduction, computation   lecture f
Truth, deduction, computation lecture f
Vlad Patryshev
 
Lec1 01
Lec1 01Lec1 01
Metrics for generativemodels
Metrics for generativemodelsMetrics for generativemodels
Metrics for generativemodels
Dai-Hai Nguyen
 
Introduction to Neural Networks and Deep Learning from Scratch
Introduction to Neural Networks and Deep Learning from ScratchIntroduction to Neural Networks and Deep Learning from Scratch
Introduction to Neural Networks and Deep Learning from Scratch
Ahmed BESBES
 
Orthogonal basis and gram schmidth process
Orthogonal basis and gram schmidth processOrthogonal basis and gram schmidth process
Orthogonal basis and gram schmidth process
gidc engineering college
 
Scala as a Declarative Language
Scala as a Declarative LanguageScala as a Declarative Language
Scala as a Declarative Language
vsssuresh
 
Reading Seminar (140515) Spectral Learning of L-PCFGs
Reading Seminar (140515) Spectral Learning of L-PCFGsReading Seminar (140515) Spectral Learning of L-PCFGs
Reading Seminar (140515) Spectral Learning of L-PCFGs
Keisuke OTAKI
 
Ijmet 10 01_046
Ijmet 10 01_046Ijmet 10 01_046
Ijmet 10 01_046
IAEME Publication
 

Similar to Formal methods 4 - Z notation (20)

Introduction to modern Variational Inference.
Introduction to modern Variational Inference.Introduction to modern Variational Inference.
Introduction to modern Variational Inference.
 
Low Complexity Regularization of Inverse Problems
Low Complexity Regularization of Inverse ProblemsLow Complexity Regularization of Inverse Problems
Low Complexity Regularization of Inverse Problems
 
Runtime Analysis of Population-based Evolutionary Algorithms
Runtime Analysis of Population-based Evolutionary AlgorithmsRuntime Analysis of Population-based Evolutionary Algorithms
Runtime Analysis of Population-based Evolutionary Algorithms
 
Runtime Analysis of Population-based Evolutionary Algorithms
Runtime Analysis of Population-based Evolutionary AlgorithmsRuntime Analysis of Population-based Evolutionary Algorithms
Runtime Analysis of Population-based Evolutionary Algorithms
 
QMC Program: Trends and Advances in Monte Carlo Sampling Algorithms Workshop,...
QMC Program: Trends and Advances in Monte Carlo Sampling Algorithms Workshop,...QMC Program: Trends and Advances in Monte Carlo Sampling Algorithms Workshop,...
QMC Program: Trends and Advances in Monte Carlo Sampling Algorithms Workshop,...
 
Computation in Real Closed Infinitesimal and Transcendental Extensions of the...
Computation in Real Closed Infinitesimal and Transcendental Extensions of the...Computation in Real Closed Infinitesimal and Transcendental Extensions of the...
Computation in Real Closed Infinitesimal and Transcendental Extensions of the...
 
Low Complexity Regularization of Inverse Problems - Course #2 Recovery Guaran...
Low Complexity Regularization of Inverse Problems - Course #2 Recovery Guaran...Low Complexity Regularization of Inverse Problems - Course #2 Recovery Guaran...
Low Complexity Regularization of Inverse Problems - Course #2 Recovery Guaran...
 
Discrete mathematics
Discrete mathematicsDiscrete mathematics
Discrete mathematics
 
Higher-order Factorization Machines(第5回ステアラボ人工知能セミナー)
Higher-order Factorization Machines(第5回ステアラボ人工知能セミナー)Higher-order Factorization Machines(第5回ステアラボ人工知能セミナー)
Higher-order Factorization Machines(第5回ステアラボ人工知能セミナー)
 
Abstract machines for great good
Abstract machines for great goodAbstract machines for great good
Abstract machines for great good
 
A new Perron-Frobenius theorem for nonnegative tensors
A new Perron-Frobenius theorem for nonnegative tensorsA new Perron-Frobenius theorem for nonnegative tensors
A new Perron-Frobenius theorem for nonnegative tensors
 
Introduction to Artificial Neural Networks
Introduction to Artificial Neural NetworksIntroduction to Artificial Neural Networks
Introduction to Artificial Neural Networks
 
Truth, deduction, computation lecture f
Truth, deduction, computation   lecture fTruth, deduction, computation   lecture f
Truth, deduction, computation lecture f
 
Lec1 01
Lec1 01Lec1 01
Lec1 01
 
Metrics for generativemodels
Metrics for generativemodelsMetrics for generativemodels
Metrics for generativemodels
 
Introduction to Neural Networks and Deep Learning from Scratch
Introduction to Neural Networks and Deep Learning from ScratchIntroduction to Neural Networks and Deep Learning from Scratch
Introduction to Neural Networks and Deep Learning from Scratch
 
Orthogonal basis and gram schmidth process
Orthogonal basis and gram schmidth processOrthogonal basis and gram schmidth process
Orthogonal basis and gram schmidth process
 
Scala as a Declarative Language
Scala as a Declarative LanguageScala as a Declarative Language
Scala as a Declarative Language
 
Reading Seminar (140515) Spectral Learning of L-PCFGs
Reading Seminar (140515) Spectral Learning of L-PCFGsReading Seminar (140515) Spectral Learning of L-PCFGs
Reading Seminar (140515) Spectral Learning of L-PCFGs
 
Ijmet 10 01_046
Ijmet 10 01_046Ijmet 10 01_046
Ijmet 10 01_046
 

More from Vlad Patryshev

Formal methods 8 - category theory (last one)
Formal methods   8 - category theory (last one)Formal methods   8 - category theory (last one)
Formal methods 8 - category theory (last one)
Vlad Patryshev
 
Formal methods 6 - elements of algebra
Formal methods   6 - elements of algebraFormal methods   6 - elements of algebra
Formal methods 6 - elements of algebra
Vlad Patryshev
 
Formal methods 5 - Pi calculus
Formal methods   5 - Pi calculusFormal methods   5 - Pi calculus
Formal methods 5 - Pi calculus
Vlad Patryshev
 
Formal methods 3 - languages and machines
Formal methods   3 - languages and machinesFormal methods   3 - languages and machines
Formal methods 3 - languages and machines
Vlad Patryshev
 
Formal methods 2 - languages and machines
Formal methods   2 - languages and machinesFormal methods   2 - languages and machines
Formal methods 2 - languages and machines
Vlad Patryshev
 
Formal methods 1 - introduction
Formal methods   1 - introductionFormal methods   1 - introduction
Formal methods 1 - introduction
Vlad Patryshev
 
Formal methods 7 - category theory
Formal methods   7 - category theoryFormal methods   7 - category theory
Formal methods 7 - category theory
Vlad Patryshev
 
Truth, deduction, computation lecture i (last one)
Truth, deduction, computation   lecture i (last one)Truth, deduction, computation   lecture i (last one)
Truth, deduction, computation lecture i (last one)
Vlad Patryshev
 
Truth, deduction, computation lecture h
Truth, deduction, computation   lecture hTruth, deduction, computation   lecture h
Truth, deduction, computation lecture h
Vlad Patryshev
 
Truth, deduction, computation lecture g
Truth, deduction, computation   lecture gTruth, deduction, computation   lecture g
Truth, deduction, computation lecture g
Vlad Patryshev
 
Truth, deduction, computation lecture e
Truth, deduction, computation   lecture eTruth, deduction, computation   lecture e
Truth, deduction, computation lecture e
Vlad Patryshev
 
Truth, deduction, computation lecture d
Truth, deduction, computation   lecture dTruth, deduction, computation   lecture d
Truth, deduction, computation lecture d
Vlad Patryshev
 
Truth, deduction, computation lecture c
Truth, deduction, computation   lecture cTruth, deduction, computation   lecture c
Truth, deduction, computation lecture c
Vlad Patryshev
 
Truth, deduction, computation lecture b
Truth, deduction, computation   lecture bTruth, deduction, computation   lecture b
Truth, deduction, computation lecture b
Vlad Patryshev
 
Truth, deduction, computation lecture a
Truth, deduction, computation   lecture aTruth, deduction, computation   lecture a
Truth, deduction, computation lecture a
Vlad Patryshev
 
Truth, deduction, computation lecture 9
Truth, deduction, computation   lecture 9Truth, deduction, computation   lecture 9
Truth, deduction, computation lecture 9
Vlad Patryshev
 
Truth, deduction, computation lecture 8
Truth, deduction, computation   lecture 8Truth, deduction, computation   lecture 8
Truth, deduction, computation lecture 8
Vlad Patryshev
 
Truth, deduction, computation lecture 7
Truth, deduction, computation   lecture 7Truth, deduction, computation   lecture 7
Truth, deduction, computation lecture 7
Vlad Patryshev
 
Truth, deduction, computation lecture 6
Truth, deduction, computation   lecture 6Truth, deduction, computation   lecture 6
Truth, deduction, computation lecture 6
Vlad Patryshev
 
Truth, deduction, computation; lecture 5
Truth, deduction, computation;  lecture 5Truth, deduction, computation;  lecture 5
Truth, deduction, computation; lecture 5
Vlad Patryshev
 

More from Vlad Patryshev (20)

Formal methods 8 - category theory (last one)
Formal methods   8 - category theory (last one)Formal methods   8 - category theory (last one)
Formal methods 8 - category theory (last one)
 
Formal methods 6 - elements of algebra
Formal methods   6 - elements of algebraFormal methods   6 - elements of algebra
Formal methods 6 - elements of algebra
 
Formal methods 5 - Pi calculus
Formal methods   5 - Pi calculusFormal methods   5 - Pi calculus
Formal methods 5 - Pi calculus
 
Formal methods 3 - languages and machines
Formal methods   3 - languages and machinesFormal methods   3 - languages and machines
Formal methods 3 - languages and machines
 
Formal methods 2 - languages and machines
Formal methods   2 - languages and machinesFormal methods   2 - languages and machines
Formal methods 2 - languages and machines
 
Formal methods 1 - introduction
Formal methods   1 - introductionFormal methods   1 - introduction
Formal methods 1 - introduction
 
Formal methods 7 - category theory
Formal methods   7 - category theoryFormal methods   7 - category theory
Formal methods 7 - category theory
 
Truth, deduction, computation lecture i (last one)
Truth, deduction, computation   lecture i (last one)Truth, deduction, computation   lecture i (last one)
Truth, deduction, computation lecture i (last one)
 
Truth, deduction, computation lecture h
Truth, deduction, computation   lecture hTruth, deduction, computation   lecture h
Truth, deduction, computation lecture h
 
Truth, deduction, computation lecture g
Truth, deduction, computation   lecture gTruth, deduction, computation   lecture g
Truth, deduction, computation lecture g
 
Truth, deduction, computation lecture e
Truth, deduction, computation   lecture eTruth, deduction, computation   lecture e
Truth, deduction, computation lecture e
 
Truth, deduction, computation lecture d
Truth, deduction, computation   lecture dTruth, deduction, computation   lecture d
Truth, deduction, computation lecture d
 
Truth, deduction, computation lecture c
Truth, deduction, computation   lecture cTruth, deduction, computation   lecture c
Truth, deduction, computation lecture c
 
Truth, deduction, computation lecture b
Truth, deduction, computation   lecture bTruth, deduction, computation   lecture b
Truth, deduction, computation lecture b
 
Truth, deduction, computation lecture a
Truth, deduction, computation   lecture aTruth, deduction, computation   lecture a
Truth, deduction, computation lecture a
 
Truth, deduction, computation lecture 9
Truth, deduction, computation   lecture 9Truth, deduction, computation   lecture 9
Truth, deduction, computation lecture 9
 
Truth, deduction, computation lecture 8
Truth, deduction, computation   lecture 8Truth, deduction, computation   lecture 8
Truth, deduction, computation lecture 8
 
Truth, deduction, computation lecture 7
Truth, deduction, computation   lecture 7Truth, deduction, computation   lecture 7
Truth, deduction, computation lecture 7
 
Truth, deduction, computation lecture 6
Truth, deduction, computation   lecture 6Truth, deduction, computation   lecture 6
Truth, deduction, computation lecture 6
 
Truth, deduction, computation; lecture 5
Truth, deduction, computation;  lecture 5Truth, deduction, computation;  lecture 5
Truth, deduction, computation; lecture 5
 

Recently uploaded

Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
NgcHiNguyn25
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
Assessment and Planning in Educational technology.pptx
Assessment and Planning in Educational technology.pptxAssessment and Planning in Educational technology.pptx
Assessment and Planning in Educational technology.pptx
Kavitha Krishnan
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
RitikBhardwaj56
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
tarandeep35
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
Celine George
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
Celine George
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
Colégio Santa Teresinha
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
Dr. Shivangi Singh Parihar
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
IreneSebastianRueco1
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
chanes7
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
Celine George
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 

Recently uploaded (20)

Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
Assessment and Planning in Educational technology.pptx
Assessment and Planning in Educational technology.pptxAssessment and Planning in Educational technology.pptx
Assessment and Planning in Educational technology.pptx
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 

Formal methods 4 - Z notation

  • 1. Formal Methods in Software Lecture 4. Z Notation Vlad Patryshev SCU 2014 you may need Chrome browser to view these slides
  • 2. Z Notation, a Specification Language ● Vaguely based on typed version of Zermelo-Fraenkel set theory ● Uses set-theoretic notation for algorithm description ● Software tools exist(ed) that could, arguably, verify algorithms ● Related to computational logic ● Partially replaced these days by Coq and Agda ● ISO standard: ISO/IEC 13568:2002 ● WSDL definition uses it ● Lives in an ideal world, not very good for programming with effects ● But is related to Agda
  • 3. The Logic of Z ● Propositional logic ○ predicates; true/false ○ connectives: a∧b, a∨b,¬a, a⇒b, a⇔b ● Quantifiers ○ ∀x • q ○ ∃x • q ○ ∃1 x • q (“exists unique”) ● Many laws (but nothing unusual)
  • 4. Z has types and constraints a:T - a is of type T q a - a satisfies a constraint (a predicate) q E.g. a,b: Human x: Dog likes(a,x) likes(b,x) loves(x,a) loves(x,b) Signature Predicates (constraints)
  • 5. Z uses typed sets ● ∅[T] - empty set of elements of type T ● {Peter, Paul, James} - a set of people; elements must be of the same type ● order does not matter; repetitions make no sense ● x∈S - x is an element of S e.g. William ∉ {Jonathan, Jane, Alice, Emma} ● P∪Q - union ● P∩Q - intersection ● PQ - complement ({x∈P|x∉Q}) ● P ⊆ Q - P is a subset of Q (P∩Q=P) ● P- - complement of P, all members of type that do not belong to P (P- =TP) E.g. T- =∅[T] and ∅[T]- =T ● ∪{A,B,C,...} = A ∪B∪C∪… ● ∩{A,B,C,...} = A∩B∩C∩…
  • 6. Set Comprehension {x∈T|P(x)} - a set of all such x that P(x) is true Properties: ● {x:T |p}∩{x:T |q}={x:T |p ∧q} ● {x:T |p}∪{x:T |q}={x:T |p ∨q} ● {x:T |p}− ={x:T |¬p} ● {x:T |p}⊆{x:T |q} ≡ p⇒q ● {x:T |p}={x:T |q} ≡ p ⇔q ● ∅[T]={x:T |false} ● T={x:T |true}
  • 7. Cartesian Product If T and U are types, T×U is the type of pairs (t,u), where t:T, u:U If P and Q are sets, P×Q = {p:T; q:U|p∈P∧q∈Q • (p,q)} (meaning, take ps from P, qs from Q, produce all pairs (p,q))
  • 8. Powerset X∈ℙS ≡ X⊆S E.g. ℙ∅ = {∅}; ℙ{a} = {∅,{a}} Finite subsets of S: FS ℙ1 S = {X∈ℙS | X!=∅} F 1 S = {X∈FS | X!=∅}
  • 9. Binary Relations R⊆P×Q Notation: given a relation R, pRq means (p,q)∈R Alternative notation for pairs (p,q): p↦q E.g. authors = {Bjarne ↦ Cpp, Guido ↦ Python, Martin ↦ Scala} Set of all relations T ↔ U == ℙ(T × U) E.g. authors ∈ Humans ↔ Languages
  • 10. Domain and Range R ∈ T ↔ U dom R = {x:T |(∃y:U•(x,y)∈R)} - not a very good idea, actually ran R = {y:U |(∃x:T•(x,y)∈R)} - an even worse idea E.g. dom authors = {Bjarne, Guido, Martin} ran authors = {Cpp, Python, Scala}
  • 11. Inverse Relation Every relation has an inverse R∼ = {y:U;x:T|(x,y)∈R} E.g. authors = {Bjarne↦Cpp, Guido↦Python, Martin↦Scala} authors~ = {Cpp↦Bjarne, Python↦Guido, Scala↦Martin} Obviously, ● ran(R∼ ) = dom R ● dom(R∼ ) = ran R ● (R∼ )∼ = R
  • 12. Functions are Relations ● Partial Function f: A B ≡ ∀x:A ∀y1 ,y2 :B (x,y1 )∈f∧(x,y2 )∈f⇒y1 =y2 ● Total function f: A→B ≡ f is p.f. and ∀x:A ∃y:B (x,y)∈f ● Injection f: A↣B ≡ f is function, and ∀x1 ,x2 :A (x1 ,y)∈f∧(x2 ,y)∈f⇒x1 =x2 ● Surjection f: A↠B: f is function, and ∀y:B ∃x:A (x,y)∈f ● Partial injection, partial surjection ● Finite partial function, A B
  • 13. ● Identity id A = {(x,x):T×T|x∈A} ● RTL Composition Q∘R = {(z,x):T×V|∃y:U•(y,x)∈R∧(z,y)∈Q} ● Domain restriction A◁R = {(x,y):T×U|(x,y)∈R∧x∈A} ● Domain anti-restriction A R = {(x,y):T×U|(x,y)∈R∧x∉A} ● Range restriction A▷R = {(x,y):T×U|(x,y)∈R∧y∈A} ● Range anti-restriction A R = {(x,y):T×U|(x,y)∈R∧y∉A} ● Image R(|A|) = {y:U|∃x:T•(x,y)∈R∧x∈A ● Inverse R~ ● Iteration iter n R = R∘(iter (n-1) R); iter 0 R = id ● Overriding Q⨁R = (dom R Q) ∪ R Operations on Relations
  • 14. Numbers ● ℤ - all integers ● ℕ = {x∈ℤ|x≥0} ● _+_, _-_, _*_, _div_, _mod_, -_ ● _≥_, _>_, _≤_, _<_ ● max(<nonempty set>), min
  • 15. Axiomatic Description ● new operator ● new data with constraint abs : Z → Z ∀n:Z• n ≤ 0 ⇒ abs n = −n ∧ n ≥ 0 ⇒ abs n = n n:ℕ n<10
  • 16. Iteration etc ● Introduce succ=={0↦1,1↦2,...}; pred==succ~ ● succ = ℕ◁(_+1) ● Rn =R∘R∘...∘R e.g. succn = ℕ◁(_+n) ● Number range a..b={n:ℕ|a≤n≤b} ● Cardinality of set S ∈ F T , #S (For a set to be ‘finite’, it must be in bijection with 1..n for some n.)
  • 17. Introducing New Types ● Just by naming, [A] ● data type (like enum): Friends ::= Peter|John|James ● recursively, e.g. ℕ ::= zero | succ⟨⟨ℕ⟩⟩
  • 18. Sequences seq T =={s:ℕ T |∃n:ℕ • dom s = 1..n} ● ⟨⟩ - empty sequence ● Nonempty sequence seq1 T == seq T {⟨⟩} ● Injective sequence iseq T == {f: seq T| injective f} ● ⟨’a’,’b’,’c’⟩ ● concatenation: ⟨’a’,’b’,’c’⟩◠⟨’d’,’e’,’f’⟩ ● prefix ⟨’a’,’b’⟩ ⊆ ⟨’a’,’b’,’c’⟩ ● head s = s(1); last s = s(#s); tail s; front s ● rev ⟨⟩ = ⟨⟩, rev ⟨x⟩ = ⟨x⟩, rev(s◠t) = rev(t)◠rev(s)
  • 19. Schemas Example: alternatively, Book≘[author:People;title:seq CHAR; readership: ℙ People;rating:0..10 | readership = dom rating] author:People title: seq CHAR readership: ℙ People rating: ↠ 0..10 readership = dom rating Book
  • 20. State Machine: Operational Schema Operation ≘ [ x1 :S1 ;...;xn :Sn ; // current state x1 ′:S1 ;...;xn ′:Sn ; // new state i1 ?:T1 ;...;im ?:Tm ; // input o1 !:U1 ;...;op !:Up // output | Pre(i1 ?,...,im ?,x1 ,...,xn ); // preconditions Inv(x1 ,...,xn ); // invariants Inv(x1 ′,...,xn ′); // invariants Op(i1 ?,...,im ?,x1 ,...,xn ,x1 ′ ,...,xn ′ ,o1 !,...,op !) // step function ]
  • 21. Example of Operational Schema AddBirthday ≘ [ known : ℙ NAME; birthday : NAME DATE known′ : ℙ NAME; birthday′ : NAME DATE name? : NAME; date? : DATE; | name? ∉ known; known = dom birthday; known′ = dom birthday′; birthday′ = birthday ∪ {name? ↦ date?} ]
  • 22. Δ: Operational Schemas Reuse StateSpace ≘ [ x1 :S1 ;...;xn :Sn | Inv(x1 ,...,xn ) ] Operation ≘ [ Δ StateSpace; // encapsulates changing state i1 ?:T1 ;...;im ?:Tm ; // input o1 !:U1 ;...;op !:Up // output | Pre(i1 ?,...,im ?,x1 ,...,xn ); // preconditions Op(i1 ?,...,im ?,x1 ,...,xn ,x1 ′ ,...,xn ′ ,o1 !,...,op !) // step function ]
  • 23. Example of Δ inclusion AddBirthday ≘ [ Δ BirthdayBook; name? : NAME; date? : DATE; | name? ∉ known; birthday′ = birthday ∪ {name? ↦ date?} ]
  • 24. Operations that don’t change State Operation ≘ [ x1 :S1 ;...;xn :Sn ; // current state x1 ′:S1 ;...;xn ′:Sn ; // new state i1 ?:T1 ;...;im ?:Tm ; // input o1 !:U1 ;...;op !:Up // output | Pre(i1 ?,...,im ?,x1 ,...,xn ); // preconditions Inv(x1 ,...,xn ); // invariants Inv(x1 ′,...,xn ′ ); // invariants (x1 ’=x1 ∧x2 ’=x2 ∧...∧xn ’=xn ); // state does not change Op(i1 ?,...,im ?,x1 ,...,xn ,x1 ′ ,...,xn ′ ,o1 !,...,op !) // step function ]
  • 25. Ξ: Operational Schemas Reuse Greek letter Ξ, pronounced as /ˈzaɪ/ or /ˈksaɪ/ Operation ≘ [ Ξ StateSpace; // encapsulates unchanging state i1 ?:T1 ;...;im ?:Tm ; // input o1 !:U1 ;...;op !:Up // output | Pre(i1 ?,...,im ?,x1 ,...,xn ); // preconditions Op(i1 ?,...,im ?,x1 ,...,xn ,x1 ′ ,...,xn ′ ,o1 !,...,op !) // step function ]
  • 26. Example of Ξ inclusion FindBirthday ≘ [ Ξ BirthdayBook; name? : NAME; date! : DATE; | name? ∈ known; date! = birthday(name?) ]
  • 27. And more... ● Can compose schema states ● Can connect schemas (output to input) ● Can include schemas
  • 28. WSDL http://www.w3.org/TR/wsdl20/wsdl20-z.html ServiceComponents ≘ [ ComponentModel1; serviceComps :ℙ Service; endpointComps : ℙ Endpoint;| serviceComps = { x : Service |service(x)∈components } endpointComps = { x : Endpoint | endpoint(x)∈components } ]