processos e concorr^encia 2015/16 bloco de acetatos 7alfa.di.uminho.pt/~madeira/uc/bloco7.pdf ·...
TRANSCRIPT
Processos e Concorrencia 2015/16Bloco de acetatos 7
Alexandre MadeiraHASLab INESC TEC, DI UMINHO
April 6, 2017
Algebraic specification is everywhere
Definition A (Monoid)
A monoid is an algebraic structure with a single associative binaryoperation and an identity element.
Definition B (Monoid)
A monoid is a model of the following specification:
Sorts s;
Op · : s × s → s
e :→ s
Ax (a · b) · c = a · (b · c)
a · e = a
e · a = a
Algebraic specification is everywhere
Definition A (Monoid)
A monoid is an algebraic structure with a single associative binaryoperation and an identity element.
Definition B (Monoid)
A monoid is a model of the following specification:
Sorts s;
Op · : s × s → s
e :→ s
Ax (a · b) · c = a · (b · c)
a · e = a
e · a = a
Algebraic specification is everywhere
Specification of a computer memory
Sorts state;
id;
elt;
Op update: id × elt ×state → state;
lookup: id × state → elt;
Ax lookup(i , update(i , e, s)) = e
i 6= j → lookup(i , update(j , e, s)) = lookup(i , s)
Algebraic specification is everywhere
Specification of a computer memory
Sorts state;
id;
elt;
Op update: id × elt ×state → state;
lookup: id × state → elt;
Ax lookup(i , update(i , e, s)) = e
i 6= j → lookup(i , update(j , e, s)) = lookup(i , s)
Algebraic specification is everywhere
Specification of a computer memory
Sorts state;
id;
elt;
Op update: id × elt ×state → state;
lookup: id × state → elt;
Ax lookup(i , update(i , e, s)) = e
i 6= j → lookup(i , update(j , e, s)) = lookup(i , s)
Algebraic specification of data andprocesses
Algebraic specification
• rooted in universal algebra
• Original aims: modelling software systems as algebras
• specialised along the times: definition of ADT (abstractdata types)
Process algebra
• rooted in automata and languages theory
• aims to formal modelling and analysis of concurrent systems
Algebraic specification of data andprocesses
Algebraic specification
• rooted in universal algebra
• Original aims: modelling software systems as algebras
• specialised along the times: definition of ADT (abstractdata types)
Process algebra
• rooted in automata and languages theory
• aims to formal modelling and analysis of concurrent systems
Algebraic specification in this course
AS and PA are highly related:
Micro perspective
• actions can be parametrized by data – we need a rigorous wayto define new suitable ADT
Macro perspective
• a process algebra can be seen, itself, as an algebraicspecification
Revisiting mCRL2
e.g., the fragment
A1 x + y = y + x
A2 (x + y) + z = x + (y + z)
A3 x + x = x
A4 (x + y) · z = x · z + y · z
A5 (x · y) · z = x · (y · z)
A6 x + δ = x
A7 δ · x = δ
• actually mCRL2 can be seen as an algebraic specification• the mCRL2 axiomatics can be understood as an algebraic
specification for the “generic shape of processes”
Revisiting CCS
e.g., the fragment
(act)a.p
a−→ p
pa−→ p′
(sum − l)p + q
a−→ p′
qa−→ q′
(sum − r)p + q
a−→ q′
• the axiomatics of CCS is now given by a set of inference rules(against the equational axiomatization of mCRL2)
• the previous analogy remains valid
Universal Algebra
Many-sorted sets
Definition (Many-sorted set)
An S-sorted set is an S-family of sets X = (Xs)s∈S .
Given two S-sorted sets X = (Xs)s∈S and Y = (Ys)s∈S :
X ∪ Y = (Xs ∪ Ys)s∈S
X × Y = (Xs × Ys)s∈S
X ⊆ Y iff for each s ∈ S , Xs ⊆ Ys
. . .
Many-sorted sets
Definition (Many-sorted set)
An S-sorted set is an S-family of sets X = (Xs)s∈S .
Given two S-sorted sets X = (Xs)s∈S and Y = (Ys)s∈S :
X ∪ Y = (Xs ∪ Ys)s∈S
X × Y = (Xs × Ys)s∈S
X ⊆ Y iff for each s ∈ S , Xs ⊆ Ys
. . .
Many-sorted sets
Definition (Many-sorted set function)
Let X = (Xs)s∈S and Y = (Ys)s∈S two S-sorted sets. An S-sortedfunction f : X → Y is an S-family of functions fs : Xs → Ys .
Many-sorted sets
Many-sorted relation
Let X = (Xs)s∈S and Y = (Ys)s∈S two S-sorted sets. An S-sortedrelation R ⊆ X × Y is an S-family of relations Rs ⊆ Xs × Ys .
Many-sorted equivalence relation
An S-sorted relation X ⊆ R ×R is an equivalence on X if, for eachs ∈ S :
• Rs is reflexive, i.e., for any x ∈ Xs , (x , x) ∈ Rs ;• Rs is simetric, i.e., for any x , y ∈ Xs , (x , y) ∈ Rs implies
(y , x) ∈ Rs ;• Rs is transitive, i.e., for any x , y , z ∈ Xs , (x , y) ∈ Rs and
(y , z) ∈ Rs implies (x , z) ∈ Rs ;.
Many-sorted sets
Quotient setGiven an S-sorted equivalence relation R ⊆ X × X :
• the equivalence class of x ∈ Xs modulo R:[x ]Rs = y ∈ Xs | (x , y) ∈ Rs,
• the quotient of X modulo R: X/R = (Xs/Rs)s∈S , whereXs/Rs = [x ]Rs |x ∈ Xs.
Many-sorted sets
Exercise E1
1 Show that, in any S-sorted equivalence relation, [x ]≡s = [y ]≡s iffx ≡s y .
2 Let consider the sorted set X = (Xs)s∈s1,s2, with Xs1 = 1, 2 andXs2 = a, b, c. Identify, in the following relations, the equivalencerelations. Define, for these cases, the respective quotient set.
a) R1 = (1, 1), (2, 2) and R2 = (a, a), (b, b), (c , c)b) S1 = (1, 1), (2, 2), (1, 2), (2, 1) and
S2 = (a, a), (b, b), (c , c)c) T1 = (1, 1), (2, 2) and
T2 = (a, a), (b, b), (b, c), (c , b), (c , c)d) Q1 = (1, 2), (2, 1) and
Q2 = (a, a), (b, b), (b, c), (c , b), (c , c)
Signatures and Algebras
Definition (Many-sorted signature)
A signature is a pair Σ = (S ,Ω), where:
• S is a set of sort names
• Ω is a (S∗ × S)-sorted set of operation names
Notation - as usual we may denote
• operation names f ∈ Ωs1...sn,s by f : s1 × · · · × sn → s ∈ Σ
• (in particular) constants names c ∈ Ωε,s by c : s ∈ Σ
Signatures and Algebras
Signature example: Σ = (S ,Ω), where
• S = s1, s2• Ωε,s1 = c1, Ωε,s2 = c2• Ωs1,s1 = f , Ωs2s1,s1 = g• Ωω,s = ∅ for other ω ∈ S∗, s ∈ S
A more standard presentation
sorts s1
s2
op c1 :→ s1
c2 :→ s2
f : s1 → s1
g : s2 × s1 → s1
Signatures and Algebras
Signature example: Σ = (S ,Ω), where
• S = s1, s2• Ωε,s1 = c1, Ωε,s2 = c2• Ωs1,s1 = f , Ωs2s1,s1 = g• Ωω,s = ∅ for other ω ∈ S∗, s ∈ S
A more standard presentation
sorts s1
s2
op c1 :→ s1
c2 :→ s2
f : s1 → s1
g : s2 × s1 → s1
Signatures and Algebras
Exercise E2
1 define a signature for groups
2 define a signature for natural numbers
3 define a signature for stacks of elements of a set A
4 define a signature for boolean algebra
5 a signature for a simple process algebra?• e.g., for the fragment of CCS
P := 0 | a.P | P + P | P|P
for a fixed set of actions A
Signatures and Algebras
Exercise E2
1 define a signature for groups
2 define a signature for natural numbers
3 define a signature for stacks of elements of a set A
4 define a signature for boolean algebra
5 a signature for a simple process algebra?
• e.g., for the fragment of CCS
P := 0 | a.P | P + P | P|P
for a fixed set of actions A
Signatures and Algebras
Exercise E2
1 define a signature for groups
2 define a signature for natural numbers
3 define a signature for stacks of elements of a set A
4 define a signature for boolean algebra
5 a signature for a simple process algebra?• e.g., for the fragment of CCS
P := 0 | a.P | P + P | P|P
for a fixed set of actions A
Signatures and Algebras
Definition (Many-sorted algebra)
Let Σ = (S ,Ω) be a many-sorted signature. A Σ-algebra Aconsists of:
• an S-sorted set |A|, i.e., for each s ∈ S , |A|s is a set; and
• for each f : s1 × · · · × sn → s ∈ Σ, a functionf A : |A|s1 × · · · × |A|s1 → |A|s .
Signatures and Algebras
Let consider the signature Σ:
sorts s1, s2
op c1 :→ s1, c2 :→ s2
f : s1 → s1
g : s2 × s1 → s1
Two example of Σ-algebras:
|A|s1 = a, b, |A|s2 = 1, 2, 3cA
1 = a cA2 = 3
f A(a) = a, f A(b) = a
gA = (1, a) 7→ 1, (1, b) 7→1, (2, a) 7→ 2, (2, b) 7→ 2, (3, a) 7→3, (3, b) 7→ 3
|B|s1 = •, |B|s2 = ♥,♠cB
1 = •, cB2 = ♠
f B(•) = •gB = (♥, •) 7→ ♥, (♠, •) 7→ ♠
Signatures and Algebras
Let consider the signature Σ:
sorts s1, s2
op c1 :→ s1, c2 :→ s2
f : s1 → s1
g : s2 × s1 → s1
Two example of Σ-algebras:
|A|s1 = a, b, |A|s2 = 1, 2, 3cA
1 = a cA2 = 3
f A(a) = a, f A(b) = a
gA = (1, a) 7→ 1, (1, b) 7→1, (2, a) 7→ 2, (2, b) 7→ 2, (3, a) 7→3, (3, b) 7→ 3
|B|s1 = •, |B|s2 = ♥,♠cB
1 = •, cB2 = ♠
f B(•) = •gB = (♥, •) 7→ ♥, (♠, •) 7→ ♠
Signatures and Algebras
Exercise E3Define two distinct algebras for each signature introduced inExercise E2.
Morphisms and Congruences
Morphism
Let A and B two Σ-algebras. A Σ-morphism h : A→ B is anS-sorted function h : |A| → |B| such that, for eachf : s1, . . . , sn → s ∈ Σ, and for any a1 ∈ |A|s1 , . . . , an ∈ |A|sn ,
hs(f A(a1, . . . , an)) = f B(hs1(a1), . . . , hsn(an))
|A|s1 × · · · × |A|snhs1×···×hsn //
f A
|B|s1 × · · · × |B|snf B
|A|s
hs// |B|s
Morphisms and Congruences
Morphism
Let A and B two Σ-algebras. A Σ-morphism h : A→ B is anS-sorted function h : |A| → |B| such that, for eachf : s1, . . . , sn → s ∈ Σ, and for any a1 ∈ |A|s1 , . . . , an ∈ |A|sn ,
hs(f A(a1, . . . , an)) = f B(hs1(a1), . . . , hsn(an))
|A|s1 × · · · × |A|snhs1×···×hsn //
f A
|B|s1 × · · · × |B|snf B
|A|s
hs// |B|s
Morphisms and Congruences
Exercise E4Let consider the algebras A and B of previous example. Define, ifpossible, two morphisms h : A→ B and h′ : B → A.
Morphisms and Congruences
Definition (Congruence)
Let A be a Σ-algebra and ≡⊆ |A| × |A| an equivalence relation onA. The relation ≡ is a congruence if
• for all a1, a′1 ∈ |A|s1 , . . . , an, a
′n ∈ |A|s1 , if as1 ≡ a′s1
and · · ·and asn ≡ a′sn , then,
f A(a1, . . . , an) ≡ f A(a′1, . . . , a′n)
Morphisms and Congruences
Definition (Quotient Algebra)
Let A be a Σ-algebra and ≡ ⊆ |A| × |A| a congruence on A. Thequotient algebra A modulo ≡ is the Σ-algebra A/ ≡ defined by:
• |A/ ≡ | = |A|/ ≡, and
• for each f : s1 × · · · × s2 → s ∈ Σ,f A/≡([a1]≡s1
, . . . , [an]≡sn) = [f A(a1, . . . , an)]≡s for all
a1 ∈ |A|s1 , . . . , an ∈ |A|sn .
Morphisms and Congruences
Exercise E5Given a S-function f : X → Y , let us consider the S-relationKer(f ), defined for each s ∈ S as
Ker(fs) = (x , y)|x , y ∈ Xs and fs(x) = fs(y)
1 show that Ker(f ) is an equivalence relation
2 let us assume an homomorphism h : A→ B. Show thatKer(h) is a congruence.
3 Using the morphism h : A→ B of exercise E4, define thealgebra A/Ker(h).
Term Algebras
Definition (Σ-terms)
Let Σ be a signature and X = (Xs)s∈S a S-sorted set of variablesfor Σ. The set Σ-terms over X is the smallest S-set T(Σ,X )such that:
• Xs ⊆ T(Σ,X )s ;
• Ωε,s ⊆ T(Σ,X )s ;
• For any f : s1 × · · · × sn → s ∈ Σ andt1 ∈ T(Σ,X )s1 , . . . , tn ∈ T(Σ,X )sn , f (t1, . . . , tn) ∈ T(Σ,X )s ;
ExerciseEnumerate the terms of each signature of Exercise E2.
Term Algebras
Definition (Σ-terms)
Let Σ be a signature and X = (Xs)s∈S a S-sorted set of variablesfor Σ. The set Σ-terms over X is the smallest S-set T(Σ,X )such that:
• Xs ⊆ T(Σ,X )s ;
• Ωε,s ⊆ T(Σ,X )s ;
• For any f : s1 × · · · × sn → s ∈ Σ andt1 ∈ T(Σ,X )s1 , . . . , tn ∈ T(Σ,X )sn , f (t1, . . . , tn) ∈ T(Σ,X )s ;
ExerciseEnumerate the terms of each signature of Exercise E2.
Term Algebras
Ground terms
• The set of terms T(Σ, ∅) is called the set of ground terms.
Term Algebras
Definition (Term Algebra)
If T(Σ,X ) is non empty, the term algebra over X is the Σ-algebraT (Σ,X ) such that
• |T (Σ,X )| = T(Σ,X )
• for any f : s1 × sn → s ∈ Σ and everyt1 ∈ T(Σ,X )s1 , . . . , tn ∈ T(Σ,X )sn ,
f T (Σ,X )(t1, . . . , tn) := f (t1, . . . , tn)
Term algebra
Fact.For any Σ-algebra A and for any S-function v : X → |A|, there isexactly one Σ-morphism v # : T(Σ,X )→ A that extends v , i.e.,such that v #(ιX (x)) = v(x), where ιX : X → T(Σ,X ) maps eachvariable to its corresponding term.
XιX //
v##
T(Σ,X )
v#
|A|
Definition (Term evaluation)
The interpretation of a term t ∈ T(Σ,X )s in a Σ-algebra A underthe valuation v : X → |A|, denoted by tA(v), is v #(t).
Term algebra
Fact.For any Σ-algebra A and for any S-function v : X → |A|, there isexactly one Σ-morphism v # : T(Σ,X )→ A that extends v , i.e.,such that v #(ιX (x)) = v(x), where ιX : X → T(Σ,X ) maps eachvariable to its corresponding term.
XιX //
v##
T(Σ,X )
v#
|A|
Definition (Term evaluation)
The interpretation of a term t ∈ T(Σ,X )s in a Σ-algebra A underthe valuation v : X → |A|, denoted by tA(v), is v #(t).
Term algebra
Fact.For any Σ-algebra A and for any S-function v : X → |A|, there isexactly one Σ-morphism v # : T(Σ,X )→ A that extends v , i.e.,such that v #(ιX (x)) = v(x), where ιX : X → T(Σ,X ) maps eachvariable to its corresponding term.
XιX //
v##
T(Σ,X )
v#
|A|
Definition (Term evaluation)
The interpretation of a term t ∈ T(Σ,X )s in a Σ-algebra A underthe valuation v : X → |A|, denoted by tA(v), is v #(t).
Exercise
Exercise E6 - Consider the following signature:
sorts nat
op 0 : nat
suc : nat → nat
+ : nat × nat → nat
1 Consider its set of terms;
2 Consider its set of ground terms;
3 Consider 2 models for this signature;
Equational Specification
Equations and satisfaction
Equations
A Σ-equation (of sort s) is an expression t1 = t2, fort1, t2 ∈ T(Σ,X )s .
SatisfactionLet A be a Σ-algebra and v : X → |A| be a valuation. Then
A, v |= t1 = t2 iff tA1 (v) = tA2 (v)
Notation
• A |= t1 = t2 iff for any v : X → |A|, A |= t1 = t2.
• A |= Φ iff for any t1 = t2 ∈ Φ, A |= t1 = t2.
• K |= t1 = t2 iff for any A ∈ K , A |= t1 = t2.
• Φ |= t1 = t2 iff, for any Σ-algebra A, if A |= Φ, thenA |= t1 = t2
Equations and satisfaction
Equations
A Σ-equation (of sort s) is an expression t1 = t2, fort1, t2 ∈ T(Σ,X )s .
SatisfactionLet A be a Σ-algebra and v : X → |A| be a valuation. Then
A, v |= t1 = t2 iff tA1 (v) = tA2 (v)
Notation
• A |= t1 = t2 iff for any v : X → |A|, A |= t1 = t2.
• A |= Φ iff for any t1 = t2 ∈ Φ, A |= t1 = t2.
• K |= t1 = t2 iff for any A ∈ K , A |= t1 = t2.
• Φ |= t1 = t2 iff, for any Σ-algebra A, if A |= Φ, thenA |= t1 = t2
Equations and satisfaction
Equations
A Σ-equation (of sort s) is an expression t1 = t2, fort1, t2 ∈ T(Σ,X )s .
SatisfactionLet A be a Σ-algebra and v : X → |A| be a valuation. Then
A, v |= t1 = t2 iff tA1 (v) = tA2 (v)
Notation
• A |= t1 = t2 iff for any v : X → |A|, A |= t1 = t2.
• A |= Φ iff for any t1 = t2 ∈ Φ, A |= t1 = t2.
• K |= t1 = t2 iff for any A ∈ K , A |= t1 = t2.
• Φ |= t1 = t2 iff, for any Σ-algebra A, if A |= Φ, thenA |= t1 = t2
Equations and satisfaction
Equations
A Σ-equation (of sort s) is an expression t1 = t2, fort1, t2 ∈ T(Σ,X )s .
SatisfactionLet A be a Σ-algebra and v : X → |A| be a valuation. Then
A, v |= t1 = t2 iff tA1 (v) = tA2 (v)
Notation
• A |= t1 = t2 iff for any v : X → |A|, A |= t1 = t2.
• A |= Φ iff for any t1 = t2 ∈ Φ, A |= t1 = t2.
• K |= t1 = t2 iff for any A ∈ K , A |= t1 = t2.
• Φ |= t1 = t2 iff, for any Σ-algebra A, if A |= Φ, thenA |= t1 = t2
Equations and satisfaction
Equations
A Σ-equation (of sort s) is an expression t1 = t2, fort1, t2 ∈ T(Σ,X )s .
SatisfactionLet A be a Σ-algebra and v : X → |A| be a valuation. Then
A, v |= t1 = t2 iff tA1 (v) = tA2 (v)
Notation
• A |= t1 = t2 iff for any v : X → |A|, A |= t1 = t2.
• A |= Φ iff for any t1 = t2 ∈ Φ, A |= t1 = t2.
• K |= t1 = t2 iff for any A ∈ K , A |= t1 = t2.
• Φ |= t1 = t2 iff, for any Σ-algebra A, if A |= Φ, thenA |= t1 = t2
Equations and satisfaction
Equations
A Σ-equation (of sort s) is an expression t1 = t2, fort1, t2 ∈ T(Σ,X )s .
SatisfactionLet A be a Σ-algebra and v : X → |A| be a valuation. Then
A, v |= t1 = t2 iff tA1 (v) = tA2 (v)
Notation
• A |= t1 = t2 iff for any v : X → |A|, A |= t1 = t2.
• A |= Φ iff for any t1 = t2 ∈ Φ, A |= t1 = t2.
• K |= t1 = t2 iff for any A ∈ K , A |= t1 = t2.
• Φ |= t1 = t2 iff, for any Σ-algebra A, if A |= Φ, thenA |= t1 = t2
Specifications
(Flat) Specification
A flat specification consists of a pair SP = (Σ,Φ), where
• Σ is a signature
• Φ is a set of Σ-equations
Specification models
For SP = (Σ,Φ),
Mod[SP] = A|A is Σ-algebra and A |= Φ
Specifications
(Flat) Specification
A flat specification consists of a pair SP = (Σ,Φ), where
• Σ is a signature
• Φ is a set of Σ-equations
Specification models
For SP = (Σ,Φ),
Mod[SP] = A|A is Σ-algebra and A |= Φ
Exercise
Exercise E7Consider the signature of exercise E6.
• Suggest an axiomatisation for natural numbers (at least 5equations)
• Identify 3 models for your specification and a counter-example(in the same signature)
Some Examples of thebase data types of mCRL2
printed from the tool’s reference:Jan Friso Groote, Mohammad Reza Mousavi. Modeling andAnalysis of Communicating Systems. MIT Press, 2008.
Example: generic useful auxiliary stuff
Example: Booleans
Example: positive naturals
Example: positive naturals
Example: lists
Example: sets
Theories
Definition(Theories)
Let Φ be a set of Σ-equations and K be a class of Σ-algebras.Then, we define:
• Mod(Φ) := A|A is Σ-algebra and A |= Φ• ThΣ(K ) = t1 = t2|for any A ∈ K ,A |= t1 = t2
Galois connections
1 Φ ⊆ Ψ implies Mod(Φ) ⊇ Mod(Ψ);
2 K ⊆ K ′ implies ThΣ(K ) ⊇ ThΣ(K ′);
3 Φ ⊆ ThΣ(Mod(Φ)) and K ⊆ Mod(ThΣ(K )).
Equational Calculus
(reflexivity)Φ `Σ t = t
, t1 = t2 ∈ Φ (axioms)Φ `Σ t1 = t2
Φ `Σ t1 = t2(symmetry)
Φ `Σ t2 = t1
Φ `Σ t1 = t2 Φ `Σ t2 = t3(transitivity)
Φ `Σ t1 = t3
Φ `Σ t1 = t ′1 · · · Φ `Σ tn = t ′n, f : s1 × · · · × sn → s ∈ Σ (congruence)
Φ `Σ f (t1, · · · , tn) = f (t ′1, · · · , t ′n)
Φ `Σ t1 = t2, σ : X → T(Σ,X )(replacement)
Φ `Σ σ(t1) = σ(t2)
Exercise
Sort bool
Op true : bool
false : bool
¬ : bool → bool
∧ : bool × bool → bool
AxBool • ¬true = false• ¬false = true• p ∧ true = p• p ∧ false = false• p ∧ ¬p = false
Using the equational calculus prove that:
1 AxBool ` ¬¬true = true
2 AxBool ` ¬true ∧ ¬false = false
3 AxBool ` (p ∧ ¬true) ∧ false = ¬true
Equational Calculus
DefinitionLet ≡Φ⊆ T(Σ,X )× T(Σ,X ) the relation defined by
≡Φ= (t1, t2)|Φ ` t1 = t2
i.e.t1 ≡Φ t2 iff Φ ` t1 = t2
Equational Calculus
Lemma≡Φ is a congruence in T (Σ,X )
Equational Calculus
LemmaΦ ` t1 = t2 iff T (Σ,X )/ ≡Φ|= t1 = t2
Equational Calculus
Theorem (Soundness and completeness of equational calculus)
For any set of Σ-equations Φ and for any equation t1 = t2,
Φ ` t1 = t2 iff Φ |= t1 = t2
Hints for the proof:
soundness, i.e., for implication ⇒, use induction over theequational calculus rules
completness, i.e., for implication ⇐, use the previous Lemma
Equational Calculus
Theorem (Soundness and completeness of equational calculus)
For any set of Σ-equations Φ and for any equation t1 = t2,
Φ ` t1 = t2 iff Φ |= t1 = t2
Hints for the proof:
soundness, i.e., for implication ⇒, use induction over theequational calculus rules
completness, i.e., for implication ⇐, use the previous Lemma
Initial Models
• The class of Σ-algebras given by loose semantics of a Σ -specification contains too many algebras to be useful inpractices. E.g.,
• if Σ has no constants, the empty algebra is a model of anyΣ-specification
• if Σ has constants, an algebra carried by an S-family ofsingletons is a model of any Σ-specification
Initial Models
Let A ∈ Mod(Σ,Φ). A contains
• Junk, if A is not reachable, i.e., there is an a ∈ |A|s suchthat, there is no a ground term t ∈ T(Σ,X ) such that tA = a
• Confusion, if A satisfies some ground equation t1 = t2 suchthat Φ 6` t1 = t2
What should be a good model for a specification?
Initial Models
Let A ∈ Mod(Σ,Φ). A contains
• Junk, if A is not reachable, i.e., there is an a ∈ |A|s suchthat, there is no a ground term t ∈ T(Σ,X ) such that tA = a
• Confusion, if A satisfies some ground equation t1 = t2 suchthat Φ 6` t1 = t2
What should be a good model for a specification?
Exercise
Sort bool
Op true : bool
false : bool
¬ : bool → bool
∧ : bool × bool → bool
Ax • ¬true = false• ¬false = true• p ∧ true = p• p ∧ q = q ∧ p• p ∧ false = false• p ∧ ¬p = false
1 Present 3 finite models with 1, 2 and 3 elements.
2 Classify the models with respect to “junk” and “confusion”.
3 Build the algebra T (ΣBool)/ ≡Φ, where Φ is the set ofequations of the specification.
Initial Models
LemmaThe model T (Σ)/ ≡Φ has no junk neither confusion
Initial Model
Initial modelAn algebra A is initial in a class K if for any algebra B ∈ K , thereis an unique morphism h : A→ B.
LemmaInitial models are unique up to isomorphism
Initial Model
Initial modelAn algebra A is initial in a class K if for any algebra B ∈ K , thereis an unique morphism h : A→ B.
LemmaInitial models are unique up to isomorphism
Initial Model
TheoremT (Σ)/ ≡Φ is an initial model of Mod(〈Σ,Φ〉)