Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Term Algebras and Equational Reasoning
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Signatures and finite terms
Σ: Set offunction symbolshaving anarityn∈IN. X: Set ofvariables.
T(X,Σ): Set oftermsoverXandΣ:
x∈ X x∈ T(X,Σ)
t1, . . . ,tn∈ T(X,Σ) fhas arityn∈Σ f(t1, . . . ,tn)∈ T(X,Σ)
We noteVar(t)the set of variables of the termt. A termtisclosedifVar(t)=∅.
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Signatures and finite terms
Σ: Set offunction symbolshaving anarityn∈IN. X: Set ofvariables.
T(X,Σ): Set oftermsoverXandΣ:
x∈ X x∈ T(X,Σ)
t1, . . . ,tn∈ T(X,Σ) fhas arityn∈Σ f(t1, . . . ,tn)∈ T(X,Σ)
We noteVar(t)the set of variables of the termt. A termtisclosedifVar(t)=∅.
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Example Signature:
b: arity0 s: arity1
+: arity2 eq: arity2
true: arity0 f alse: arity0 Terms:
eq(s(x+b),b) eq(true,f alse) eq(s(x+b),f alse) closed
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Positions of terms
IN∗:positionsoverIN
Λ∈IN∗
i∈INandp∈IN∗ ip∈IN∗
To simplify the notation, we usually write a position by omitting the symbolΛ,e.g.2 denotes the position2Λ.
Pos(t):positions of a termt
Λ∈Pos(t)
p∈Pos(ti)and1≤i≤n ip∈Pos(f(t1, . . . ,tn)) Example
Pos(f(g(a,h(b)),x,c))={Λ,1,2,3,11,12,121}
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Positions of terms
IN∗:positionsoverIN
Λ∈IN∗
i∈INandp∈IN∗ ip∈IN∗
To simplify the notation, we usually write a position by omitting the symbolΛ,e.g.2 denotes the position2Λ.
Pos(t):positions of a termt
Λ∈Pos(t)
p∈Pos(ti)and1≤i≤n ip∈Pos(f(t1, . . . ,tn)) Example
Pos(f(g(a,h(b)),x,c))={Λ,1,2,3,11,12,121}
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Positions of terms
IN∗:positionsoverIN
Λ∈IN∗
i∈INandp∈IN∗ ip∈IN∗
To simplify the notation, we usually write a position by omitting the symbolΛ,e.g.2 denotes the position2Λ.
Pos(t):positions of a termt
Λ∈Pos(t)
p∈Pos(ti)and1≤i≤n ip∈Pos(f(t1, . . . ,tn)) Example
Pos(f(g(a,h(b)),x,c))={Λ,1,2,3,11,12,121}
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
The relation ≤
pre fover positions
Concatenationof positions:
( Λ.q = q (ip).q = i(p.q)
Comparing positions: p≤pre f qiff∃r∈IN∗p.r=q Example
1 ≤pre f 1211 ”1is smaller than1211”
231 ≥pre f 23 ”231is greater than23”
12 ./ 2 ”12is parallel to2”(12pre f 2 & 2pre f 12)
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
The relation ≤
pre fover positions
Concatenationof positions:
( Λ.q = q (ip).q = i(p.q)
Comparing positions: p≤pre f qiff∃r∈IN∗p.r=q Example
1 ≤pre f 1211 ”1is smaller than1211”
231 ≥pre f 23 ”231is greater than23”
12 ./ 2 ”12is parallel to2”(12pre f 2 & 2pre f 12)
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
The relation ≤
pre fover positions
Concatenationof positions:
( Λ.q = q (ip).q = i(p.q)
Comparing positions: p≤pre f qiff∃r∈IN∗p.r=q Example
1 ≤pre f 1211 ”1is smaller than1211”
231 ≥pre f 23 ”231is greater than23”
12 ./ 2 ”12is parallel to2”(12pre f 2 & 2pre f 12)
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Sub-terms
vEt:vis asubterm/subtreeoft:
tEt
vEti
vEf(t1, . . . ,tn)
vEt:vis a subterm oft. v/t:vis astrictsubterm oft. S T(t): All the subterms oft.
Example
g(x,y)/f(g(x,y),a)anda/f(g(x,y),a)butf(x,a)6 f(g(x,y),a).
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Sub-terms
vEt:vis asubterm/subtreeoft:
tEt
vEti
vEf(t1, . . . ,tn)
vEt:vis a subterm oft. v/t:vis astrictsubterm oft. S T(t): All the subterms oft.
Example
g(x,y)/f(g(x,y),a)anda/f(g(x,y),a)butf(x,a)6 f(g(x,y),a).
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Sub-terms
vEt:vis asubterm/subtreeoft:
tEt
vEti
vEf(t1, . . . ,tn)
vEt:vis a subterm oft. v/t:vis astrictsubterm oft. S T(t): All the subterms oft.
Example
g(x,y)/f(g(x,y),a)anda/f(g(x,y),a)butf(x,a)6 f(g(x,y),a).
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Sub-term X at position Y
t|p:subterm oftat positionp
t|Λ=t
ti|q=v f(t1, . . . ,tn)|iq=v
Example
f(g(a,h(b)),x,c)|11=abutf(g(a,h(b)),x,c)|21is not defined.
Exercise :Show thatp.q∈Pos(t)impliest|p.q=(t|p)|q.
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Sub-term X at position Y
t|p:subterm oftat positionp
t|Λ=t
ti|q=v f(t1, . . . ,tn)|iq=v
Example
f(g(a,h(b)),x,c)|11=abutf(g(a,h(b)),x,c)|21is not defined.
Exercise :Show thatp.q∈Pos(t)impliest|p.q=(t|p)|q.
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Sub-term X at position Y
t|p:subterm oftat positionp
t|Λ=t
ti|q=v f(t1, . . . ,tn)|iq=v
Example
f(g(a,h(b)),x,c)|11=abutf(g(a,h(b)),x,c)|21is not defined.
Exercise :Show thatp.q∈Pos(t)impliest|p.q=(t|p)|q.
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Replacement
t[p//v]:replacementof the subtermt|pby the termv t[Λ//v]=v
f(t1, . . . ,tn)[ip//v]=f(t1, . . . ,ti[p//v], . . . ,tn)
Other notations:t[v]port[v]ifpis clear from the context.
Example
f(h(x,y),a)[12//b]= f(h(x,b),a)and f(h(x,y),a)[1//b]= f(b,a).
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Replacement
t[p//v]:replacementof the subtermt|pby the termv t[Λ//v]=v
f(t1, . . . ,tn)[ip//v]=f(t1, . . . ,ti[p//v], . . . ,tn)
Other notations:t[v]port[v]ifpis clear from the context.
Example
f(h(x,y),a)[12//b]= f(h(x,b),a)and f(h(x,y),a)[1//b]= f(b,a).
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Replacement
t[p//v]:replacementof the subtermt|pby the termv t[Λ//v]=v
f(t1, . . . ,tn)[ip//v]=f(t1, . . . ,ti[p//v], . . . ,tn)
Other notations:t[v]port[v]ifpis clear from the context.
Example
f(h(x,y),a)[12//b]= f(h(x,b),a)and f(h(x,y),a)[1//b]= f(b,a).
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Exercise :Show the following properties:
Ifp∈Pos(s)andq∈Pos(t), then(s[t]p)|p.q=t|qand(s[t]p)[r]p.q=s[t[r]q]p. Ifp.q∈Pos(s), then(s[t]p.q)|p=(s|p)[t]qand(s[t]p.q)[r]p=s[r]p.
Ifp,q∈Pos(s)andp./q, then(s[t]p)|q=s|qand(s[t]p)[r]q=(s[r]q)[t]p.
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Σ -algebras
AΣ-algebraAis defined by two ingredients:
A non-emptydomainA.
AninterpretationfunctionfA:An7→A, for each f/n∈Σ. We writeA=hA,{fA:An7→A|f/n∈Σ}i.
Example
LetΣ ={b/0,s/1,p/2}. We give three differentΣ-algebras:
1 Ais the setIN,bA=0,sA:n7→n+1andpA: (n,m)7→n+m.
2 Ais the setZ,bA=−5,sA:n7→n∗13andpA: (n,m)7→n∗m.
3 Syntactic Algebra:Ais the set of all the terms overXandΣsuch thatbA=b, sA:t7→s(t)andpA: (t,u)7→p(t,u).
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Σ -algebras
AΣ-algebraAis defined by two ingredients:
A non-emptydomainA.
AninterpretationfunctionfA:An7→A, for each f/n∈Σ. We writeA=hA,{fA:An7→A|f/n∈Σ}i.
Example
LetΣ ={b/0,s/1,p/2}. We give three differentΣ-algebras:
1 Ais the setIN,bA=0,sA:n7→n+1andpA: (n,m)7→n+m.
2 Ais the setZ,bA=−5,sA:n7→n∗13andpA: (n,m)7→n∗m.
3 Syntactic Algebra:Ais the set of all the terms overXandΣsuch thatbA=b, sA:t7→s(t)andpA: (t,u)7→p(t,u).
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Σ -algebras
AΣ-algebraAis defined by two ingredients:
A non-emptydomainA.
AninterpretationfunctionfA:An7→A, for each f/n∈Σ. We writeA=hA,{fA:An7→A|f/n∈Σ}i.
Example
LetΣ ={b/0,s/1,p/2}. We give three differentΣ-algebras:
1 Ais the setIN,bA=0,sA:n7→n+1andpA: (n,m)7→n+m.
2 Ais the setZ,bA=−5,sA:n7→n∗13andpA: (n,m)7→n∗m.
3 Syntactic Algebra:Ais the set of all the terms overXandΣsuch thatbA=b, sA:t7→s(t)andpA: (t,u)7→p(t,u).
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Σ -algebras
AΣ-algebraAis defined by two ingredients:
A non-emptydomainA.
AninterpretationfunctionfA:An7→A, for each f/n∈Σ. We writeA=hA,{fA:An7→A|f/n∈Σ}i.
Example
LetΣ ={b/0,s/1,p/2}. We give three differentΣ-algebras:
1 Ais the setIN,bA=0,sA:n7→n+1andpA: (n,m)7→n+m.
2 Ais the setZ,bA=−5,sA:n7→n∗13andpA: (n,m)7→n∗m.
3 Syntactic Algebra:Ais the set of all the terms overXandΣsuch thatbA=b, sA:t7→s(t)andpA: (t,u)7→p(t,u).
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Valuations
We use valuations to interpret terms in aΣ-algebra.
LetAbe aΣ-algebra and letXbe a set of variables.
AA-valuationis an applicationσ:X → A.
Definition
Given aA-valuationσ:X → A, we define a functionbσ:T(X,Σ)→ Ainterpreting arbitrary terms into theΣ-algebraAas follows:
bσ(x) = σ(x)
bσ(f(t1, . . . ,tn)) = fA(bσ(t1), . . . ,bσ(tn))
Remark: By abuse of notation, we usually do not distinguish thevaluationσfrom the morphismbσ.
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Valuations
We use valuations to interpret terms in aΣ-algebra.
LetAbe aΣ-algebra and letXbe a set of variables.
AA-valuationis an applicationσ:X → A.
Definition
Given aA-valuationσ:X → A, we define a functionbσ:T(X,Σ)→ Ainterpreting arbitrary terms into theΣ-algebraAas follows:
bσ(x) = σ(x)
bσ(f(t1, . . . ,tn)) = fA(bσ(t1), . . . ,bσ(tn))
Remark: By abuse of notation, we usually do not distinguish thevaluationσfrom the morphismbσ.
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Valuations
We use valuations to interpret terms in aΣ-algebra.
LetAbe aΣ-algebra and letXbe a set of variables.
AA-valuationis an applicationσ:X → A.
Definition
Given aA-valuationσ:X → A, we define a functionbσ:T(X,Σ)→ Ainterpreting arbitrary terms into theΣ-algebraAas follows:
bσ(x) = σ(x)
bσ(f(t1, . . . ,tn)) = fA(bσ(t1), . . . ,bσ(tn))
Remark: By abuse of notation, we usually do not distinguish thevaluationσfrom the morphismbσ.
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Substitutions are valuations
Asubstitutionθis valuation fromXto the syntactic algebra (the set of all the terms).
Finitesubstitutions (having a finite domain) are denotedθ={x1/t1, . . . ,xn/tn}. Arenamingis an isomorphic substitution.
Example
θ1={x/y,y/x}andθ2={x/y,y/z,z/w}are renamings.
Givent= f(x,g(y))andθ={x/g(a),y/f(x,x)}we haveθ(t)= f(g(a),g(f(x,x))).
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Substitutions are valuations
Asubstitutionθis valuation fromXto the syntactic algebra (the set of all the terms).
Finitesubstitutions (having a finite domain) are denotedθ={x1/t1, . . . ,xn/tn}. Arenamingis an isomorphic substitution.
Example
θ1={x/y,y/x}andθ2={x/y,y/z,z/w}are renamings.
Givent= f(x,g(y))andθ={x/g(a),y/f(x,x)}we haveθ(t)= f(g(a),g(f(x,x))).
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Substitutions are valuations
Asubstitutionθis valuation fromXto the syntactic algebra (the set of all the terms).
Finitesubstitutions (having a finite domain) are denotedθ={x1/t1, . . . ,xn/tn}. Arenamingis an isomorphic substitution.
Example
θ1={x/y,y/x}andθ2={x/y,y/z,z/w}are renamings.
Givent= f(x,g(y))andθ={x/g(a),y/f(x,x)}we haveθ(t)= f(g(a),g(f(x,x))).
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Substitutions are valuations
Asubstitutionθis valuation fromXto the syntactic algebra (the set of all the terms).
Finitesubstitutions (having a finite domain) are denotedθ={x1/t1, . . . ,xn/tn}. Arenamingis an isomorphic substitution.
Example
θ1={x/y,y/x}andθ2={x/y,y/z,z/w}are renamings.
Givent= f(x,g(y))andθ={x/g(a),y/f(x,x)}we haveθ(t)= f(g(a),g(f(x,x))).
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Substitutions are valuations
Asubstitutionθis valuation fromXto the syntactic algebra (the set of all the terms).
Finitesubstitutions (having a finite domain) are denotedθ={x1/t1, . . . ,xn/tn}. Arenamingis an isomorphic substitution.
Example
θ1={x/y,y/x}andθ2={x/y,y/z,z/w}are renamings.
Givent= f(x,g(y))andθ={x/g(a),y/f(x,x)}we haveθ(t)= f(g(a),g(f(x,x))).
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Congruence
The symbol f∈Σismonotonicw.r.t the relationRiff aiR biimplies fA(a1, . . . ,ai, . . . ,an)R fA(a1, . . . ,bi, . . . ,an).
Acongruence∼is an equivalence relation (reflexive, symmetric, transitive) for a Σ-algebraAiff every symbol f∈Σis monotonic w.r.t.∼.
Example
∼={(x,y)|4dividesx−y}is a congruence.
Notation :A/∼is the set of equivalence classes of aAmodulo the congruence∼. We write[e]∼to denote the equivalent class of the elemente∈ Aw.r.t. the congruence∼.
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Congruence
The symbol f∈Σismonotonicw.r.t the relationRiff aiR biimplies fA(a1, . . . ,ai, . . . ,an)R fA(a1, . . . ,bi, . . . ,an).
Acongruence∼is an equivalence relation (reflexive, symmetric, transitive) for a Σ-algebraAiff every symbol f∈Σis monotonic w.r.t.∼.
Example
∼={(x,y)|4dividesx−y}is a congruence.
Notation :A/∼is the set of equivalence classes of aAmodulo the congruence∼. We write[e]∼to denote the equivalent class of the elemente∈ Aw.r.t. the congruence∼.
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Congruence
The symbol f∈Σismonotonicw.r.t the relationRiff aiR biimplies fA(a1, . . . ,ai, . . . ,an)R fA(a1, . . . ,bi, . . . ,an).
Acongruence∼is an equivalence relation (reflexive, symmetric, transitive) for a Σ-algebraAiff every symbol f∈Σis monotonic w.r.t.∼.
Example
∼={(x,y)|4dividesx−y}is a congruence.
Notation :A/∼is the set of equivalence classes of aAmodulo the congruence∼. We write[e]∼to denote the equivalent class of the elemente∈ Aw.r.t. the congruence∼.
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
The quotient algebra
Given aΣ-algebraAwith domainA, thequotient algebraA∼overAis defined by:
The domain isA/∼
The Interpretations arefA∼([a1], . . . ,[an])=[fA(a1, . . . ,an)].
Example
LetΣ ={b/0,suc/1,pred/1,add/2}and letAbe theΣ-algebra given byA=Z,bA=0, sucA(n)=n+1,predA(n)=n−1andaddA(n,m)=n+m.
Let∼={(x,y)|4dividesx−y}. We haveA/∼={[0],[1],[2],[3]}, where
[0] = {. . . ,−4,0,4,8, . . .} [1] = {. . . ,−3,1,5,9, . . .}
[2] = {. . . ,−6,−2,2,6,10, . . .} [3] = {. . . ,−5,−1,3,7, . . .}
We havebA∼=[0],sucA∼([n])=[n+1],predA∼([n])=[n−1]and addA∼([n],[m])=[n+m].
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
The quotient algebra
Given aΣ-algebraAwith domainA, thequotient algebraA∼overAis defined by:
The domain isA/∼
The Interpretations arefA∼([a1], . . . ,[an])=[fA(a1, . . . ,an)].
Example
LetΣ ={b/0,suc/1,pred/1,add/2}and letAbe theΣ-algebra given byA=Z,bA=0, sucA(n)=n+1,predA(n)=n−1andaddA(n,m)=n+m.
Let∼={(x,y)|4dividesx−y}. We haveA/∼={[0],[1],[2],[3]}, where
[0] = {. . . ,−4,0,4,8, . . .} [1] = {. . . ,−3,1,5,9, . . .}
[2] = {. . . ,−6,−2,2,6,10, . . .} [3] = {. . . ,−5,−1,3,7, . . .}
We havebA∼=[0],sucA∼([n])=[n+1],predA∼([n])=[n−1]and addA∼([n],[m])=[n+m].
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
A -valuations vs A
∼-valuations
Given aA-valuationσ, we can always constructtheA∼-valuationτgiven by τ(x)=[σ(x)]∼. We usually writeτ=σ∼.
Given aA∼-valuationτ, we can always constructaA-valuationσs.t.
τ(x)=[σ(x)]∼. This means that we choose an elementein the equivalence class τ(x)and then we defineσ(x)=e.
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Homomorphism, endomorphism, isomorphism
LetAandBbe twoΣ-algebras. Amorphismis a functionΦ:A → Bs.t. for alln≥0, for all f/n∈Σand for alla1, . . . ,an∈Awe have
Φ(fA(a1, . . . ,an))=fB(Φ(a1), . . . ,Φ(an))
Anendomorphismover aΣ-algebraAis a morphism fromAto itself. Anisomorphismis a bijective morphism.
Theorem
For everyA-valuationσ:X → A, there is aunique morphismbσ:T(X,Σ)→ A, s.t.
bσ(x) = σ(x)
bσ(f(t1, . . . ,tn)) = fA(bσ(t1), . . . ,bσ(tn))
bσis the function that we have defined so far to interpret arbitrary terms in aΣ-algebra.
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Homomorphism, endomorphism, isomorphism
LetAandBbe twoΣ-algebras. Amorphismis a functionΦ:A → Bs.t. for alln≥0, for all f/n∈Σand for alla1, . . . ,an∈Awe have
Φ(fA(a1, . . . ,an))=fB(Φ(a1), . . . ,Φ(an))
Anendomorphismover aΣ-algebraAis a morphism fromAto itself. Anisomorphismis a bijective morphism.
Theorem
For everyA-valuationσ:X → A, there is aunique morphismbσ:T(X,Σ)→ A, s.t.
bσ(x) = σ(x)
bσ(f(t1, . . . ,tn)) = fA(bσ(t1), . . . ,bσ(tn))
bσis the function that we have defined so far to interpret arbitrary terms in aΣ-algebra.
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Homomorphism, endomorphism, isomorphism
LetAandBbe twoΣ-algebras. Amorphismis a functionΦ:A → Bs.t. for alln≥0, for all f/n∈Σand for alla1, . . . ,an∈Awe have
Φ(fA(a1, . . . ,an))=fB(Φ(a1), . . . ,Φ(an))
Anendomorphismover aΣ-algebraAis a morphism fromAto itself. Anisomorphismis a bijective morphism.
Theorem
For everyA-valuationσ:X → A, there is aunique morphismbσ:T(X,Σ)→ A, s.t.
bσ(x) = σ(x)
bσ(f(t1, . . . ,tn)) = fA(bσ(t1), . . . ,bσ(tn))
bσis the function that we have defined so far to interpret arbitrary terms in aΣ-algebra.
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Homomorphism, endomorphism, isomorphism
LetAandBbe twoΣ-algebras. Amorphismis a functionΦ:A → Bs.t. for alln≥0, for all f/n∈Σand for alla1, . . . ,an∈Awe have
Φ(fA(a1, . . . ,an))=fB(Φ(a1), . . . ,Φ(an))
Anendomorphismover aΣ-algebraAis a morphism fromAto itself. Anisomorphismis a bijective morphism.
Theorem
For everyA-valuationσ:X → A, there is aunique morphismbσ:T(X,Σ)→ A, s.t.
bσ(x) = σ(x)
bσ(f(t1, . . . ,tn)) = fA(bσ(t1), . . . ,bσ(tn))
bσis the function that we have defined so far to interpret arbitrary terms in aΣ-algebra.
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Exercise :LetΣ ={a/0,s/1,g/1,h/2}. Define aΣ-algebraBand a morphismΦbetween the syntacticΣ-algebra andB.
LetBbe theΣ-algebradefined by:
The domainB={n∈IN|n≥2}
The interpretations:
aB = 2 gB(t) = t+1
sB(t) = t hB(u,t) = u+t LetΦbe the following function:
Φ(a) = 2 Φ(g(t)) = Φ(t)+1 Φ(s(t)) = Φ(t) Φ(h(u,t)) = Φ(u)+ Φ(t) One verifiesΦ(fA(t1, . . . ,tn))=fB(Φ(t1), . . . ,Φ(tn))for everyf/ninΣ.
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Exercise :LetΣ ={a/0,s/1,g/1,h/2}. Define aΣ-algebraBand a morphismΦbetween the syntacticΣ-algebra andB.
LetBbe theΣ-algebradefined by:
The domainB={n∈IN|n≥2}
The interpretations:
aB = 2 gB(t) = t+1
sB(t) = t hB(u,t) = u+t LetΦbe the following function:
Φ(a) = 2 Φ(g(t)) = Φ(t)+1 Φ(s(t)) = Φ(t) Φ(h(u,t)) = Φ(u)+ Φ(t) One verifiesΦ(fA(t1, . . . ,tn))=fB(Φ(t1), . . . ,Φ(tn))for everyf/ninΣ.
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Exercise :LetΣ ={a/0,s/1,g/1,h/2}. Define aΣ-algebraBand a morphismΦbetween the syntacticΣ-algebra andB.
LetBbe theΣ-algebradefined by:
The domainB={n∈IN|n≥2}
The interpretations:
aB = 2 gB(t) = t+1
sB(t) = t hB(u,t) = u+t LetΦbe the following function:
Φ(a) = 2 Φ(g(t)) = Φ(t)+1 Φ(s(t)) = Φ(t) Φ(h(u,t)) = Φ(u)+ Φ(t) One verifiesΦ(fA(t1, . . . ,tn))=fB(Φ(t1), . . . ,Φ(tn))for everyf/ninΣ.
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Exercise :LetΣ ={a/0,s/1,g/1,h/2}. Define aΣ-algebraBand a morphismΦbetween the syntacticΣ-algebra andB.
LetBbe theΣ-algebradefined by:
The domainB={n∈IN|n≥2}
The interpretations:
aB = 2 gB(t) = t+1
sB(t) = t hB(u,t) = u+t LetΦbe the following function:
Φ(a) = 2 Φ(g(t)) = Φ(t)+1 Φ(s(t)) = Φ(t) Φ(h(u,t)) = Φ(u)+ Φ(t) One verifiesΦ(fA(t1, . . . ,tn))=fB(Φ(t1), . . . ,Φ(tn))for everyf/ninΣ.
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Semantical equational reasoning
AΣ-equationis a pair of terms denotedst.
Definition
LetAbe aΣ-algebra.
Ais amodelofan equationst, writtenA |=st, iff the equalitybσ(s)=bσ(t) holds for everyA-valuationσ.
Ais amodelof aset ofΣ-equationsE, writtenA |=E, iffAis a model of every equation inE.
Example
The firstΣ-algebra on slide (Σ-algebras) is a model of the equationp(x,y)p(y,x). What about the second and the third?
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Semantical equational reasoning
AΣ-equationis a pair of terms denotedst.
Definition
LetAbe aΣ-algebra.
Ais amodelofan equationst, writtenA |=st, iff the equalitybσ(s)=bσ(t) holds for everyA-valuationσ.
Ais amodelof aset ofΣ-equationsE, writtenA |=E, iffAis a model of every equation inE.
Example
The firstΣ-algebra on slide (Σ-algebras) is a model of the equationp(x,y)p(y,x). What about the second and the third?
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Semantical equational reasoning
AΣ-equationis a pair of terms denotedst.
Definition
LetAbe aΣ-algebra.
Ais amodelofan equationst, writtenA |=st, iff the equalitybσ(s)=bσ(t) holds for everyA-valuationσ.
Ais amodelof aset ofΣ-equationsE, writtenA |=E, iffAis a model of every equation inE.
Example
The firstΣ-algebra on slide (Σ-algebras) is a model of the equationp(x,y)p(y,x). What about the second and the third?
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Semantical equational reasoning
AΣ-equationis a pair of terms denotedst.
Definition
LetAbe aΣ-algebra.
Ais amodelofan equationst, writtenA |=st, iff the equalitybσ(s)=bσ(t) holds for everyA-valuationσ.
Ais amodelof aset ofΣ-equationsE, writtenA |=E, iffAis a model of every equation inE.
Example
The firstΣ-algebra on slide (Σ-algebras) is a model of the equationp(x,y)p(y,x). What about the second and the third?
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Semantical equational reasoning
AΣ-equationis a pair of terms denotedst.
Definition
LetAbe aΣ-algebra.
Ais amodelofan equationst, writtenA |=st, iff the equalitybσ(s)=bσ(t) holds for everyA-valuationσ.
Ais amodelof aset ofΣ-equationsE, writtenA |=E, iffAis a model of every equation inE.
Example
The firstΣ-algebra on slide (Σ-algebras) is a model of the equationp(x,y)p(y,x). What about the second and the third?
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Properties of semantical equational reasoning
A |=ss.
IfA |=st, thenA |=ts.
IfA |=standA |=tu, thenA |=su.
IfA |=st, then∀u∀p∈Pos(u),A |=u[s]pu[t]p.
Proof.
By induction onu.
IfA |=st, thenA |=θ(s)θ(t), for every substitutionθ.
Proof.
We want to provebσ(θ(s))=bσ(θ(t))for everyA-valuationσ, so that let us take an arbitrary A-valuationσ. Letτσbe theA-valuation given byτσ(x)=bσ(θ(x)). We first show by induction onuthatτbσ(u)=bσ(θ(u))(easy). Now,A |=stimpliesbτ(s)=bτ(t)for every A-valuationτ, so that in particular forτσ. Thus,τbσ(s)=bσ(θ(s))=bσ(θ(t))=τbσ(t).
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Properties of semantical equational reasoning
A |=ss.
IfA |=st, thenA |=ts.
IfA |=standA |=tu, thenA |=su.
IfA |=st, then∀u∀p∈Pos(u),A |=u[s]pu[t]p.
Proof.
By induction onu.
IfA |=st, thenA |=θ(s)θ(t), for every substitutionθ.
Proof.
We want to provebσ(θ(s))=bσ(θ(t))for everyA-valuationσ, so that let us take an arbitrary A-valuationσ. Letτσbe theA-valuation given byτσ(x)=bσ(θ(x)). We first show by induction onuthatτbσ(u)=bσ(θ(u))(easy). Now,A |=stimpliesbτ(s)=bτ(t)for every A-valuationτ, so that in particular forτσ. Thus,τbσ(s)=bσ(θ(s))=bσ(θ(t))=τbσ(t).
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Properties of semantical equational reasoning
A |=ss.
IfA |=st, thenA |=ts.
IfA |=standA |=tu, thenA |=su.
IfA |=st, then∀u∀p∈Pos(u),A |=u[s]pu[t]p.
Proof.
By induction onu.
IfA |=st, thenA |=θ(s)θ(t), for every substitutionθ. Proof.
We want to provebσ(θ(s))=bσ(θ(t))for everyA-valuationσ, so that let us take an arbitrary A-valuationσ. Letτσbe theA-valuation given byτσ(x)=bσ(θ(x)). We first show by induction onuthatτbσ(u)=bσ(θ(u))(easy). Now,A |=stimpliesbτ(s)=bτ(t)for every A-valuationτ, so that in particular forτσ. Thus,τbσ(s)=bσ(θ(s))=bσ(θ(t))=τbσ(t).
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Properties of semantical equational reasoning
A |=ss.
IfA |=st, thenA |=ts.
IfA |=standA |=tu, thenA |=su.
IfA |=st, then∀u∀p∈Pos(u),A |=u[s]pu[t]p.
Proof.
By induction onu.
IfA |=st, thenA |=θ(s)θ(t), for every substitutionθ. Proof.
We want to provebσ(θ(s))=bσ(θ(t))for everyA-valuationσ, so that let us take an arbitrary A-valuationσ. Letτσbe theA-valuation given byτσ(x)=bσ(θ(x)). We first show by induction onuthatτbσ(u)=bσ(θ(u))(easy). Now,A |=stimpliesbτ(s)=bτ(t)for every A-valuationτ, so that in particular forτσ. Thus,τbσ(s)=bσ(θ(s))=bσ(θ(t))=τbσ(t).
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Semantic equational consequence
Definition
The equationstis asemantic consequenceof a set of equationsE, writtenE |=st, iff every model ofEis also a model ofstiff for everyΣ-algebraA,A |=Eimplies A |=st.
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Syntactic rules for equational reasoning
st∈ E
st (axiom) ss (reflexivity)
st
ts (symmetry)
st tu
su (transitivity)
st
θ(s)θ(t) (substitution) st u[s]pu[t]p
(context)
Derivationofstfrom the setE(which gives a tree) is denoted byE `st.
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Syntactic rules for equational reasoning
st∈ E
st (axiom) ss (reflexivity)
st
ts (symmetry)
st tu
su (transitivity)
st
θ(s)θ(t) (substitution) st u[s]pu[t]p
(context)
Derivationofstfrom the setE(which gives a tree) is denoted byE `st.
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Syntactic rules for equational reasoning
st∈ E
st (axiom) ss (reflexivity)
st
ts (symmetry)
st tu
su (transitivity)
st
θ(s)θ(t) (substitution) st u[s]pu[t]p
(context)
Derivationofstfrom the setE(which gives a tree) is denoted byE `st.
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Example
LetE={0+zz,s(y)+xs(y+x)}. Let us use the notations3=s(s(s(0)))and 4=s(s(s(s(0)))).
We derives(0)+34fromEas follows:
s(y)+xs(y+x)∈ E
(axiom)
s(y)+xs(y+x)
(substitution)
s(0)+3s(0+3)
0+zz∈ E
(axiom)
0+zz
(substitution)
0+33
(context)
s(0+3)s(3)
(transitivity)
s(0)+3s(3)
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
The relation ↔
∗Est∈ E θ(s)↔Eθ(t)
st∈ E θ(t)↔Eθ(s)
s↔Et u[s]p↔Eu[t]p
↔∗Eis the reflexive-transitive closure of↔E.
Exercise :
1 ↔∗Eis stable by substitution.
2 ↔∗Eis an equivalence relation.
3 ↔∗Eis a congruence overT(X,Σ).
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
The relation ↔
∗Est∈ E θ(s)↔Eθ(t)
st∈ E θ(t)↔Eθ(s)
s↔Et u[s]p↔Eu[t]p
↔∗Eis the reflexive-transitive closure of↔E.
Exercise :
1 ↔∗Eis stable by substitution.
2 ↔∗Eis an equivalence relation.
3 ↔∗Eis a congruence overT(X,Σ).
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
The relation ↔
∗Est∈ E θ(s)↔Eθ(t)
st∈ E θ(t)↔Eθ(s)
s↔Et u[s]p↔Eu[t]p
↔∗Eis the reflexive-transitive closure of↔E.
Exercise :
1 ↔∗Eis stable by substitution.
2 ↔∗Eis an equivalence relation.
3 ↔∗Eis a congruence overT(X,Σ).
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Properties of ↔
∗EExercise :E `stif and only ifs↔∗Et.
Proof.
Left-Right: by induction on derivation ofE `st. Right-Left: by induction on the length of↔∗E.
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Properties of ↔
∗EExercise :E `stif and only ifs↔∗Et.
Proof.
Left-Right: by induction on derivation ofE `st. Right-Left: by induction on the length of↔∗E.
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Properties of ↔
∗EExercise :E `stif and only ifs↔∗Et.
Proof.
Left-Right: by induction on derivation ofE `st. Right-Left: by induction on the length of↔∗E.
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Substitution Lemma
Lemma
Letσbe anyA-valuation, and letτbe theA∼-valuation defined byτ:x7→[σ(x)]∼. Then bτ(t)=[bσ(t)]∼for every termt.
Proof.
By induction ont.
Fort=xthe property holds by definition.
Fort=f(t1, ..,tn), we have
bτ(f(t1, ..,tn)) = fA∼(bτ(t1), . . . ,bτ(tn)) =h.r
fA∼([bσ(t1)]∼, . . . ,[bσ(tn)]∼) =de f [fA(bσ(t1), . . . ,bσ(tn))]∼ =
[bσ(t)]∼ =
A particular case of this Lemma is given whenσis a substitution andτa T(X,Σ)↔∗E-valuation.
An even more particular case is whenσis theidsubstitution so thatbτ(t)=[t]↔∗ E.
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Substitution Lemma
Lemma
Letσbe anyA-valuation, and letτbe theA∼-valuation defined byτ:x7→[σ(x)]∼. Then bτ(t)=[bσ(t)]∼for every termt.
Proof.
By induction ont.
Fort=xthe property holds by definition.
Fort=f(t1, ..,tn), we have
bτ(f(t1, ..,tn)) = fA∼(bτ(t1), . . . ,bτ(tn)) =h.r
fA∼([bσ(t1)]∼, . . . ,[bσ(tn)]∼) =de f [fA(bσ(t1), . . . ,bσ(tn))]∼ =
[bσ(t)]∼ =
A particular case of this Lemma is given whenσis a substitution andτa T(X,Σ)↔∗E-valuation.
An even more particular case is whenσis theidsubstitution so thatbτ(t)=[t]↔∗ E.
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Substitution Lemma
Lemma
Letσbe anyA-valuation, and letτbe theA∼-valuation defined byτ:x7→[σ(x)]∼. Then bτ(t)=[bσ(t)]∼for every termt.
Proof.
By induction ont.
Fort=xthe property holds by definition.
Fort=f(t1, ..,tn), we have
bτ(f(t1, ..,tn)) = fA∼(bτ(t1), . . . ,bτ(tn)) =h.r
fA∼([bσ(t1)]∼, . . . ,[bσ(tn)]∼) =de f [fA(bσ(t1), . . . ,bσ(tn))]∼ =
[bσ(t)]∼ =
A particular case of this Lemma is given whenσis a substitution andτa T(X,Σ)↔∗E-valuation.
An even more particular case is whenσis theidsubstitution so thatbτ(t)=[t]↔∗ E.
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
T (X, Σ )
↔∗Eas a model
Theorem
T(X,Σ)↔∗Eas a model ofE.
Proof.
Take any equationst∈ E. Take anyT(X,Σ)↔∗E-valuationτ. By previous remark we can construt aT(X,Σ)-valuationσ(which is a substitution in this case) such that
τ(x)=[σ(x)]↔∗
E. The substitution lemma guarantees thatbτ(t)=[bσ(t)]↔∗
Efor every termt. Now,st∈ Eimplies (by def)
E `stiff (previous exercise)s↔∗Etimplies (↔∗Eis stable by substitution) bσ(s)↔∗Ebσ(t)iff (by def)[bσ(s)]↔∗
E=[bσ(t)]↔∗
Eiff (Subst. Lemma)bτ(s)=bτ(t).
Since anyT(X,Σ)↔∗E-valuationτsatifies the equationsE:T(X,Σ)↔∗Eis a model ofE.
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
T (X, Σ )
↔∗Eas a model
Theorem
T(X,Σ)↔∗Eas a model ofE.
Proof.
Take any equationst∈ E. Take anyT(X,Σ)↔∗E-valuationτ. By previous remark we can construt aT(X,Σ)-valuationσ(which is a substitution in this case) such that
τ(x)=[σ(x)]↔∗
E. The substitution lemma guarantees thatbτ(t)=[bσ(t)]↔∗
Efor every termt. Now,st∈ Eimplies (by def)
E `stiff (previous exercise)s↔∗Etimplies (↔∗Eis stable by substitution) bσ(s)↔∗Ebσ(t)iff (by def)[bσ(s)]↔∗
E=[bσ(t)]↔∗
Eiff (Subst. Lemma)bτ(s)=bτ(t).
Since anyT(X,Σ)↔∗E-valuationτsatifies the equationsE:T(X,Σ)↔∗Eis a model ofE.
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Birkhoff’s Theorem (1933)
LetEbe a set ofΣ-equations.
(Soundness)IfE `st, thenE |=st.
Proof.
By induction onE `stusing the properties of semantical equational reasoning.
(Completeness)IfE |=st, thenE `st.
Proof.
IfE |=st, then every model ofEis a a model ofst. SinceT(X,Σ)↔∗Eis a model ofE (previous theorem), then in particularT(X,Σ)↔∗E|=st.
This means thatbτ(s)=bτ(t)for everyT(X,Σ)↔∗E-valuationτ, so in particular for τid:x7→[id(x)]↔∗
E. Thus,τcid(s)=cτid(t). By the Substitution Lemmaτcid(s)=[bid(s)]↔∗
Eandcτid(t)=[bid(t)]↔∗ E, thus [bid(s)]↔∗
E=[s]↔∗ E=[t]↔∗
E=[bid(t)]↔∗
Ewhich meanss↔∗Et. We concludeE `st.
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Birkhoff’s Theorem (1933)
LetEbe a set ofΣ-equations.
(Soundness)IfE `st, thenE |=st.
Proof.
By induction onE `stusing the properties of semantical equational reasoning.
(Completeness)IfE |=st, thenE `st.
Proof.
IfE |=st, then every model ofEis a a model ofst. SinceT(X,Σ)↔∗Eis a model ofE (previous theorem), then in particularT(X,Σ)↔∗E|=st.
This means thatbτ(s)=bτ(t)for everyT(X,Σ)↔∗E-valuationτ, so in particular for τid:x7→[id(x)]↔∗
E. Thus,τcid(s)=cτid(t). By the Substitution Lemmaτcid(s)=[bid(s)]↔∗
Eandcτid(t)=[bid(t)]↔∗ E, thus [bid(s)]↔∗
E=[s]↔∗ E=[t]↔∗
E=[bid(t)]↔∗
Ewhich meanss↔∗Et. We concludeE `st.
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Birkhoff’s Theorem (1933)
LetEbe a set ofΣ-equations.
(Soundness)IfE `st, thenE |=st.
Proof.
By induction onE `stusing the properties of semantical equational reasoning.
(Completeness)IfE |=st, thenE `st.
Proof.
IfE |=st, then every model ofEis a a model ofst. SinceT(X,Σ)↔∗Eis a model ofE (previous theorem), then in particularT(X,Σ)↔∗E|=st.
This means thatbτ(s)=bτ(t)for everyT(X,Σ)↔∗E-valuationτ, so in particular for τid:x7→[id(x)]↔∗
E. Thus,τcid(s)=cτid(t). By the Substitution Lemmaτcid(s)=[bid(s)]↔∗
Eandcτid(t)=[bid(t)]↔∗ E, thus [bid(s)]↔∗
E=[s]↔∗ E=[t]↔∗
E=[bid(t)]↔∗
Ewhich meanss↔∗Et. We concludeE `st.
Delia KESNER IRIF, CNRS et Universit ´e Paris [email protected] www.irif.fr/˜kesner
Birkhoff’s Theorem (1933)
LetEbe a set ofΣ-equations.
(Soundness)IfE `st, thenE |=st.
Proof.
By induction onE `stusing the properties of semantical equational reasoning.
(Completeness)IfE |=st, thenE `st.
Proof.
IfE |=st, then every model ofEis a a model ofst. SinceT(X,Σ)↔∗Eis a model ofE (previous theorem), then in particularT(X,Σ)↔∗E|=st.
This means thatbτ(s)=bτ(t)for everyT(X,Σ)↔∗E-valuationτ, so in particular for τid:x7→[id(x)]↔∗
E. Thus,τcid(s)=cτid(t). By the Substitution Lemmaτcid(s)=[bid(s)]↔∗
Eandcτid(t)=[bid(t)]↔∗ E, thus [bid(s)]↔∗
E=[s]↔∗ E=[t]↔∗
E=[bid(t)]↔∗
Ewhich meanss↔∗Et. We concludeE `st.