Specifications

with

Observable

Formulae

and

Observational

Satisfaction

Relation

Teodor

KNAPIK

Laboratoire

d'Informatique

URA

du

CNRS

D?epartement

de

Math?ematiques

et

d'Informatique

Ecole

Normale

Sup?erieure

LIENS

June

Specifications

with

Observable

Formulae

and

Observational

Satisfaction

Relation

Teodor

Knapik

LIENS

CNRS

URA

Rue

d'Ulm

F

-LCB-

PARIS

Cedex

France

e-mail

knapik@dmi.ens.fr

or

Abstract

We

consider

algebraic

specifications

with

observational

features

Axioms

as

well

as

observations

are

formulae

of

full

-LRB-

Many-Sorted

-RRB-

First

Order

Logic

with

Equality

The

associated

semantics

is

based

on

a

non

standard

interpretation

of

equality

called

observational

equality

We

study

the

adequacy

of

this

semantics

for

software

specification

and

the

relationship

with

behavioural

equivalence

of

algebras

We

show

that

this

framework

defines

an

institution

Introduction

Within

an

observational

approach

the

loose

semantics

of

a

specification

may

either

be

defined

as

a

class

of

algebras

observationally

equivalent

to

models

satisfying

the

specification

in

the

usual

sense

or

as

a

class

of

algebras

observationally

satisfying

the

specification

The

former

way

has

already

been

deeply

explored

in

-LSB-

-RSB-

while

in

the

latter

one

the

following

problems

remains

open

How

to

define

an

observational

satisfaction

relation

w.r.t.

more

sophisticated

observation

techniques

than

sort

observation

How

to

generalize

the

observational

satisfaction

relation

of

equational

axioms

of

-LSB-

-RSB-

positive

conditional

axioms

of

-LSB-

-RSB-

-LSB-

-RSB-

or

-LSB-

-RSB-

first

order

axioms

without

existential

quantifier

nor

predicate

symbols

of

-LSB-

-RSB-

or

-LSB-

-RSB-

to

the

full

-LRB-

Many

Sorted

-RRB-

First

Order

Logic

with

Equality

Is

it

possible

to

provide

an

observational

in

such

a

general

framework

All

these

questions

are

investigated

in

the

present

paper

For

the

first

one

the

answer

was

partially

given

in

-LSB-

-RSB-

and

-LSB-

-RSB-

where

observable

signatures

are

and

in

-LSB-

-RSB-

where

observable

terms

-LRB-

possibly

with

variables

-RRB-

are

considered

In

the

present

paper

observable

-LSB-

-RSB-

for

more

details

about

institutions

fact

these

approaches

combine

signature

and

sort

observations

-LRB-

first

order

-RRB-

formulae

are

considered

More

precisely

a

set

of

formulae

represents

available

experiments

An

experiment

consists

of

checking

the

validity

of

a

formula

in

an

algebra

for

a

given

assignment

of

variables

Thus

each

value

is

involved

only

in

some

experiments

We

assume

that

only

the

results

of

such

experiments

provide

an

information

on

what

an

algebra

resembles

It

is

then

impossible

to

distinguish

some

values

from

the

others

This

is

represented

by

an

indistinguishability

relation

defined

according

to

the

following

Indistinguishability

Assumption

Two

values

are

indistinguishable

with

respect

to

some

experiments

when

it

is

impossible

to

see

if

they

are

different

using

the

results

of

these

experiments

We

show

that

our

indistinguishability

relation

is

neither

a

congruence

nor

an

equivalence

relation

We

do

not

think

that

this

is

unfortunate

This

fact

seems

rather

necessary

in

order

to

model

the

real

situations

in

a

better

way

for

instance

the

following

ones

A

specification

of

sets

of

natural

numbers

may

be

additionally

equipped

with

an

operation

choose

which

takes

a

set

as

argument

and

returns

an

element

of

the

set

Sequences

over

IN

should

clearly

be

considered

as

a

correct

realization

of

this

specification

choose

being

for

instance

an

operation

which

returns

the

head

of

a

sequence

Then

the

sequences

mn

and

nm

are

indistinguishable

since

they

represent

the

same

set

fm

ng

But

when

n

m

we

want

the

results

of

choose

-LRB-

nm

-RRB-

and

choose

-LRB-

mn

-RRB-

-LRB-

i.e.

n

and

m

-RRB-

to

be

distinguishable

Given

a

specification

of

something

like

a

metric

space

we

may

want

to

consider

as

indistinguishable

two

elements

which

are

very

close

-LRB-

let

us

say

a

and

b

indistinguishable

iff

jja

bjj

for

some

fixed

-RRB-

Such

a

relation

is

clearly

non

transitive

Another

surprising

fact

is

that

the

indistinguishability

relation

is

not

compatible

with

the

predicates

as

illustrated

by

the

following

example

spec

OPT-SET

use

CONST

sort

set

generated

by

O

set

add

Const

set

set

predicates

Const

set

axioms

optional

-LRB-

e

-RRB-

-RRB-

add

-LRB-

e

s

-RRB-

s

-LRB-

e

O

-RRB-

optional

-LRB-

e

-RRB-

-RRB-

-LRB-

e

add

-LRB-

s

-RRB-

e

e

s

-RRB-

observations

optional

-LRB-

e

-RRB-

e

s

spec

CONST

sort

Const

generated

by

an

Const

bm

Const

predicates

optional

Const

particular

Const

axioms

optional

-LRB-

-RRB-

optional

-LRB-

an

-RRB-

optional

-LRB-

-RRB-

optional

-LRB-

bm

-RRB-

Some

axioms

about

particular

observations

x

y

Figure

Specification

OPT-SET

Example

Figure

is

an

attempt

to

specify

a

data

type

-LRB-

sort

set

-RRB-

whose

elements

are

sets

of

some

constants

-LRB-

sort

Const

-RRB-

Some

of

these

constants

should

be

considered

as

optional

in

the

sense

that

if

optional

-LRB-

c

-RRB-

holds

then

add

-LRB-

c

cng

-RRB-

does

not

necessarily

returns

fc

cng

it

may

also

return

cng

We

may

then

consider

a

realization

by

the

sets

with

the

usual

membership

but

unusual

add

non

optional

constants

are

always

added

while

the

optional

ones

are

added

only

if

some

other

properties

are

satisfied

-LRB-

e.g.

particular

-LRB-

c

-RRB-

-RRB-

We

will

show

later

that

in

this

realization

two

sets

are

indistinguishable

if

they

have

the

same

non

optional

elements

Consequently

the

indistinguishability

relation

is

not

compatible

with

since

for

instance

O

and

any

singleton

set

feg

with

an

optional

e

are

indistinguishable

whereas

the

realization

under

consideration

satisfies

e

feg

but

not

e

O

In

contrast

to

the

non

transitivity

and

the

non

compatibility

with

operations

or

with

predicate

symbols

another

property

causes

a

serious

problem

for

the

indistinguishability

relation

In

general

the

indistinguishability

relation

is

not

transported

through

the

forgetful

functor

This

in

part

provides

an

answer

for

the

third

question

mentioned

at

the

beginning

of

the

introduction

an

institution

may

be

established

under

some

restrictions

on

the

category

of

signatures

Our

institution

for

observational

specifications

requires

signature

morphisms

to

be

injective

However

without

such

a

restriction

our

formalism

is

still

a

semi-institution

-LRB-

only

the

if

part

of

the

Satisfaction

Condition

holds

-RRB-

This

is

probably

our

main

contribution

since

with

all

the

definitions

of

observational

satisfaction

relation

preceding

-LSB-

-RSB-

such

a

result

requires

at

least

the

restriction

to

positive

conditional

axioms

with

observable

preconditions

In

our

approach

such

a

restriction

is

not

necessary

anymore

due

to

the

following

idea

We

define

observational

algebras

as

usual

algebras

equipped

with

an

additional

equivalence

relation

called

observational

equality

which

is

used

as

a

non

standard

interpretation

of

equality

Moreover

we

require

an

observational

equality

to

be

included

in

the

indistinguishability

relation

-LRB-

Thus

in

our

example

of

metric-like

space

observational

equality

provides

a

tiling

of

space

such

that

the

longest

distance

between

two

points

in

a

same

tile

is

less

than

-RRB-

Unlike

the

indistinguishability

relation

an

observational

equality

is

of

course

transported

by

the

forgetful

functor

It

is

important

to

notice

that

similarly

to

the

indistinguishability

relation

an

observational

equality

is

not

necessarily

a

congruence

This

choice

allows

more

realistic

realizations

of

observational

specifications

and

may

be

motivated

by

examples

such

as

sets

with

choose

or

similar

to

Consequently

with

our

observational

semantics

if

in

a

specification

one

writes

the

axiom

a

b

together

with

f

-LRB-

a

-RRB-

f

-LRB-

b

-RRB-

such

a

specification

may

have

a

model

This

points

out

that

approaches

with

an

observational

satisfaction

relation

may

have

the

advantage

to

be

fully

observational

over

the

approaches

based

on

the

observational

equivalence

of

algebras

where

unfortunately

some

observational

features

are

directly

based

on

the

usual

ones

In

particular

in

these

approaches

observational

consistency

always

coincide

with

the

usual

one

whereas

in

ours

a

specification

being

inconsistent

-LRB-

in

the

usual

sense

-RRB-

may

still

have

observational

models

-LRB-

An

example

of

such

specifications

may

be

found

in

-LSB-

-RSB-

or

-LSB-

-RSB-

-RRB-

In

this

paper

some

proofs

have

been

presented

in

a

reduced

form

Complete

proofs

may

be

found

in

-LSB-

-RSB-

Algebraic

and

Logic

Preliminaries

We

assume

that

the

reader

is

familiar

with

algebraic

specifications

-LRB-

see

e.g.

-LSB-

-RSB-

or

-LSB-

-RSB-

-RRB-

A

signature

consists

of

a

finite

set

S

of

sorts

and

a

finite

set

of

operation

and

predicate

names

with

arities

ambiguously

denoted

by

We

assume

that

each

signature

is

provided

with

an

S-sorted

set

of

variables

X

such

that

Xs

is

countable

for

each

s

S

We

use

the

following

conventions

Given

a

signature

-LRB-

resp

-RRB-

S

-LRB-

resp

-RRB-

denotes

the

sorts

of

-LRB-

resp

-RRB-

and

X

-LRB-

resp

-RRB-

denotes

the

variables

of

-LRB-

resp

-RRB-

A

signature

morphism

oe

maps

each

sort

of

S

to

a

sort

of

each

operation

-LRB-

f

sn

s

-RRB-

to

an

operation

oe

-LRB-

f

-RRB-

of

with

the

arity

oe

-LRB-

-RRB-

oe

-LRB-

sn

-RRB-

oe

-LRB-

s

-RRB-

each

predicate

-LRB-

q

sn

-RRB-

to

a

predicate

oe

-LRB-

q

-RRB-

of

with

the

arity

oe

-LRB-

-RRB-

oe

-LRB-

sn

-RRB-

and

each

variable

of

Xs

to

a

variable

of

-LRB-

s

-RRB-

Moreover

we

assume

that

a

signature

morphism

is

always

injective

on

Remark

Our

approach

to

variables

is

slightly

different

than

the

one

of

-LSB-

-RSB-

-LRB-

page

Definition

of

-LSB-

-RSB-

-RRB-

where

the

authors

consider

an

S-sorted

set

of

variables

as

a

map

X

X

S

from

a

fixed

set

X

of

variable

symbols

to

sorts

In

presence

of

oe

variables

used

for

are

defined

in

-LSB-

-RSB-

as

X

oe

In

other

words

the

authors

of

-LSB-

-RSB-

assume

that

signature

morphisms

are

always

bijective

on

variables

Consequently

in

their

approach

there

are

no

variables

of

sorts

c

oe

-LRB-

S

-RRB-

This

seems

to

us

a

bit

restrictive

Since

we

deal

with

predicate

symbols

our

algebras

are

usual

-LRB-

total

-RRB-

algebras

equipped

additionally

with

relations

qA

Asn

for

each

predicate

symbol

-LRB-

q

sn

-RRB-

Consequently

a

morphism

in

our

sense

is

any

usual

morphism

A

B

which

additionally

satisfies

the

following

condition

an

Asn

ani

qA

-RRB-

h

-LRB-

-RRB-

-LRB-

an

-RRB-

i

qB

The

category

of

algebras

is

denoted

by

Alg

-LSB-

-RSB-

Given

a

signature

morphism

oe

the

oe-reduct

of

a

written

is

defined

in

the

usual

way

-LRB-

with

oe

-LRB-

q

-RRB-

for

each

predicate

symbol

q

-RRB-

and

extending

it

on

we

obtain

the

forgetful

functor

joe

Alg

-LSB-

-RSB-

Alg

-LSB-

-RSB-

Given

an

S-sorted

set

E

we

denote

by

T

-LRB-

E

-RRB-

the

free

algebra

over

E.

For

instance

T

-LRB-

resp

T

-LRB-

X

-RRB-

-RRB-

denotes

the

algebra

of

ground

terms

-LRB-

resp

terms

with

variables

-RRB-

T

-LRB-

A

-RRB-

-LRB-

resp

T

-LRB-

A

-LSB-

X

-RRB-

-RRB-

denotes

the

algebra

of

ground

terms

-LRB-

resp

terms

with

variables

-RRB-

over

the

carriers

of

a

algebra

A.

Notice

that

if

A

is

a

free

algebra

then

we

have

necessarily

qA

O

for

any

predicate

symbol

q

A

valuation

is

a

morphism

X

A

which

maps

each

x

Xs

to

a

value

x

As

The

set

of

all

valuations

from

X

to

A

is

written

Val

-LSB-

X

A

-RSB-

A

partial

valuation

is

a

valuation

preceded

by

an

inclusion

X.

From

the

freeness

of

T

-LRB-

X

-RRB-

any

valuation

-LRB-

resp

partial

valuation

-RRB-

followed

this

assumption

which

in

a

stronger

form

appears

in

-LSB-

-RSB-

it

would

be

impossible

to

establish

that

j

oe

-LRB-

x

y

-RRB-

iff

j

x

y

for

instance

with

oe

-LRB-

x

y

-RRB-

-LRB-

-RRB-

by

the

inclusion

A

T

-LRB-

A

-RRB-

-LRB-

resp

A

T

-LRB-

A

-LSB-

X

-RRB-

-RRB-

extends

to

a

unique

morphism

-LRB-

written

ambiguously

-RRB-

from

T

-LRB-

X

-RRB-

to

T

-LRB-

A

-RRB-

-LRB-

resp

T

-LRB-

A

-LSB-

X

-RRB-

-RRB-

which

maps

each

term

t

-LRB-

T

-LRB-

X

-RRB-

-RRB-

s

to

a

valued

term

t

-LRB-

T

-LRB-

A

-RRB-

-RRB-

s

-LRB-

resp

partially

valued

term

t

-LRB-

T

-LRB-

A

-LSB-

X

-RRB-

-RRB-

s

-RRB-

The

evaluation

morphism

from

T

-LRB-

A

-RRB-

to

A

is

defined

as

the

unique

morphism

which

maps

each

element

of

-LRB-

T

-LRB-

A

-RRB-

-RRB-

s

As

to

itself

This

morphism

maps

a

valued

term

o

to

its

evaluation

result

written

o

From

T

-LRB-

X

-RRB-

predicate

symbols

-LRB-

including

equality

-RRB-

connectives

-LRB-

-RRB-

etc.

-RRB-

and

quantifiers

-LRB-

-RRB-

we

construct

the

set

Wff

-LRB-

X

-RRB-

of

well

formed

formulae

Given

Wff

-LRB-

X

-RRB-

among

the

variables

of

-LRB-

written

Var

-LSB-

-RSB-

-RRB-

we

distinguish

between

free

and

bound

variables

both

being

defined

in

the

usual

way

We

assume

that

there

are

no

clashes

between

them

in

a

formula

-LRB-

otherwise

variables

are

properly

renamed

-RRB-

A

valuation

X

A

may

also

be

applied

to

a

formula

We

then

define

valued

formulae

-LRB-

resp

partially

valued

formulae

-RRB-

as

follows

Wff

-LRB-

A

-RRB-

f

j

Wff

-LRB-

X

-RRB-

Val

-LSB-

X

A

-RSB-

g

-LRB-

resp

Wff

-LRB-

A

-LSB-

X

-RRB-

f

j

Wff

-LRB-

X

-RRB-

Val

-LSB-

X

A

-RSB-

is

partialg

-RRB-

Satisfaction

relation

between

algebras

and

formulae

is

the

usual

one

of

-LRB-

Many

Sorted

-RRB-

First

Order

Logic

with

Equality

We

may

also

write

A

j

for

Wff

-LRB-

A

-RRB-

and

A

Alg

-LSB-

-RSB-

that

is

we

extend

the

usual

notion

of

satisfaction

relation

on

valued

formulae

in

the

following

way

elements

of

A

appearing

in

are

considered

as

constants

interpreted

by

themselves

The

extension

of

a

signature

morphism

oe

on

formulae

is

ambiguously

denoted

by

oe

Given

a

we

also

use

oe

to

denote

the

extension

of

a

signature

morphism

on

valued

formulae

namely

oe

T

-LRB-

-RRB-

T

-LRB-

-RRB-

Definition

Given

a

signature

morphism

oe

and

a

we

define

a

oe-reduct

of

a

valuation

as

a

valuation

X

satisfying

x

X

oe

-LRB-

x

-RRB-

x

Moreover

given

X

we

denote

by

oe

-LRB-

-RRB-

the

class

of

all

valuations

such

that

Remark

Since

our

approach

to

variables

is

slightly

different

than

the

one

of

-LSB-

-RSB-

-LRB-

see

Remark

-RRB-

we

do

not

have

a

one

to

one

map

between

Val

-LSB-

X

-RSB-

and

Val

-LSB-

-RSB-

In

order

to

reuse

the

results

of

-LSB-

-RSB-

about

Satisfaction

Condition

in

various

institutions

we

translate

our

approach

to

variables

in

the

Goguen

's

and

Burstall

's

one

as

follows

we

consider

the

quotient

of

Val

-LSB-

-RSB-

by

the

equivalence

relation

determined

by

Consequently

there

is

a

one

to

one

map

between

Val

-LSB-

X

-RSB-

and

this

quotient

Thus

any

logical

system

which

is

an

institution

in

a

-LSB-

-RSB-

like

approach

to

variables

is

also

an

institution

in

our

approach

to

variables

due

to

the

following

lemma

Lemma

Let

be

a

formula

with

Var

-LSB-

-RSB-

and

A

be

a

algebra

Two

valuations

which

differ

on

X

c

have

the

same

effect

on

the

truth

of

In

particular

for

a

signature

morphism

oe

and

a

any

valuations

Val

-LSB-

-RSB-

such

that

are

both

solutions

-LRB-

that

is

valuations

which

make

the

formula

true

-RRB-

of

the

same

formulae

of

oe

-LRB-

Wff

-LRB-

X

-RRB-

-RRB-

In

other

words

for

any

X

and

any

Wff

-LRB-

X

-RRB-

we

have

that

either

all

elements

of

the

class

oe

-LRB-

-RRB-

are

solutions

of

oe

-LRB-

-RRB-

or

of

them

are

Also

the

following

result

may

be

deduced

from

Goguen

's

and

Burstall

's

proof

of

Satisfaction

Condition

for

-LRB-

Many-Sorted

-RRB-

Equational

Logic

Fact

Let

oe

be

a

signature

morphism

and

be

a

For

any

valued

term

o

T

-LRB-

-RRB-

we

have

oe

-LRB-

o

-RRB-

o

Indistinguishable

Elements

As

mentioned

in

the

introduction

we

need

to

define

an

indistinguishability

relation

on

the

carriers

of

an

algebra

in

order

to

loosen

the

satisfaction

relation

Usually

this

is

done

using

the

concept

of

observable

contexts

Since

we

observe

formulae

we

consider

contextual

formulae

instead

of

contexts

The

definition

of

contextual

formula

requires

some

additional

notations

We

assume

that

a

formula

can

be

represented

by

a

tree

A

term

position

p

in

is

a

sequence

of

integers

which

describe

the

path

from

the

topmost

position

of

to

the

considered

term

in

written

jp

The

replacement

of

jp

by

a

term

t

in

is

written

-LSB-

t

-RSB-

p.

Definition

Given

sorts

S

sng

the

set

of

contextual

variables

is

the

-LRB-

S-indexed

-RRB-

set

sng

with

f?sig

being

called

the

contextual

variable

of

sort

si

A

contextual

formula

over

a

algebra

A

is

a

partially

valued

formula

with

only

one

variable

being

both

contextual

and

free

Consequently

the

set

of

all

contextual

formulae

over

A

written

Cf

-LRB-

A

-RRB-

is

defined

as

follows

Cf

-LRB-

A

-RRB-

-LSB-

Wff

-LRB-

A

-LSB-

f?sg

-RRB-

The

application

of

Wff

-LRB-

A

-LSB-

f?sg

-RRB-

on

a

As

is

written

-LSB-

a

-RSB-

Our

meta-concept

of

observation

is

that

for

each

element

a

of

an

algebra

there

is

a

set

of

experiments

in

which

a

may

be

involved

We

call

such

a

set

observers

of

a.

Here

an

observer

of

a

is

some

contextual

formulae

and

the

corresponding

experiment

is

the

truth

of

-LSB-

a

-RSB-

In

order

to

define

what

the

observers

of

a

are

we

first

need

two

auxiliary

definitions

Definition

Let

A

be

a

algebra

We

define

the

partial

evaluation

relation

written

pEv

on

Wff

-LRB-

A

-RRB-

as

follows

We

say

that

a

formula

Wff

-LRB-

A

-RRB-

is

the

result

of

the

partial

evaluation

of

Wff

-LRB-

A

-RRB-

written

pEv

if

there

is

a

term

position

p

in

satisfying

Var

-LSB-

-RSB-

O

and

such

that

-LSB-

-RSB-

p

The

requirement

Var

-LSB-

-RSB-

O

may

seem

strange

This

is

necessary

since

given

Wff

-LRB-

X

-RRB-

only

the

free

variables

of

can

be

mapped

to

A.

Consequently

we

assume

that

when

applied

to

a

valuation

is

implicitly

preceded

by

the

inclusion

free

variables

of

X.

For

instance

if

which

maps

x

to

a

and

y

to

b

is

applied

on

a

formula

y

x

y

we

obtain

y

a

y

and

not

b

a

b.

Thus

given

a

valued

formula

in

general

we

do

not

have

Var

-LSB-

-RSB-

O.

Definition

Let

Wff

-LRB-

X

-RRB-

be

a

set

of

formulae

and

A

be

a

algebra

The

closure

by

partial

evaluations

of

in

A

written

e?A

is

defined

as

follows

e?A

f#

Wff

-LRB-

A

-RRB-

j

X

A

pEv

g

where

pEv

denotes

the

reflexive-transitive

closure

of

pEv

Now

if

is

a

set

of

observable

formulae

e?A

provides

an

information

about

experiments

in

which

a

may

by

involved

Definition

Let

Wff

-LRB-

X

-RRB-

be

a

set

of

formulae

which

we

call

observable

formulae

and

a

be

an

element

of

a

algebra

A

We

say

that

a

contextual

formula

Cf

-LRB-

A

-RRB-

is

a

observer

of

a

-LRB-

an

observer

of

a

in

short

-RRB-

if

-LSB-

a

-RSB-

e?A

The

set

of

observers

of

a

is

written

obs

-LRB-

a

-RRB-

Once

we

know

which

experiments

can

be

made

on

a

value

a

we

want

to

know

how

to

compare

their

results

with

the

ones

made

on

another

value

b

We

claim

that

only

common

observers

of

a

and

b

-LRB-

called

comparators

-RRB-

may

be

used

for

this

purpose

Definition

A

comparator

-LRB-

comparator

in

short

-RRB-

of

elements

a

and

b

of

a

given

carrier

of

a

algebra

is

any

observer

of

a

and

b

The

set

of

all

comparators

of

both

a

and

b

is

denoted

by

cmp

-LRB-

a

b

-RRB-

We

say

that

a

comparator

distinguishes

a

and

b

iff

A

-LSB-

a

-RSB-

-LSB-

b

-RSB-

We

can

now

state

the

following

definition

of

indistinguishability

Definition

We

say

that

two

elements

a

and

b

of

a

given

carrier

of

a

algebra

are

indistinguishable

w.r.t.

a

set

of

formulae

Wff

-LRB-

X

-RRB-

-LRB-

or

indistinguishable

-RRB-

written

a

b

if

there

is

no

comparator

which

distinguishes

them

We

illustrate

these

concepts

by

the

following

example

Example

Consider

an

algebra

L

of

sets

over

the

signature

of

OPT-SET

-LRB-

see

Figure

-RRB-

with

the

usual

membership

test

and

with

the

following

add

addL

-LRB-

c

cng

-RRB-

-LRB-

fc

cng

if

c

particularL

or

c

optionalL

cng

otherwise

that

is

any

non

optional

constant

is

always

added

to

a

set

and

optional

ones

are

added

only

if

they

are

particular

The

set

of

observable

formulae

Opt

of

this

specification

is

foptional

-LRB-

x

-RRB-

x

sg

Applying

the

definition

we

obtain

g

OptL

foptional

-LRB-

c

-RRB-

c

l

j

c

LConst

l

LSetg

Consequently

any

l

LSet

has

the

same

observers

foptional

-LRB-

c

-RRB-

c

j

c

LConstg

Such

an

observer

may

only

distinguish

two

sets

which

differ

on

non

optional

elements

As

mentioned

in

Introduction

we

would

like

to

present

an

institution

for

observational

specifications

Since

our

observational

satisfaction

relation

-LRB-

which

will

be

defined

further

-RRB-

strongly

depends

on

observers

we

must

first

study

their

properties

w.r.t.

the

forgetful

functor

and

the

translation

of

observable

formulae

In

this

way

we

shall

provide

tools

which

will

be

useful

to

show

that

the

Satisfaction

Condition

holds

in

our

formalism

Below

we

give

the

first

important

theorem

It

is

a

good

occasion

to

establish

some

interesting

lemmas

about

partial

evaluation

Theorem

Let

oe

be

a

signature

morphism

Wff

-LRB-

X

-RRB-

and

Wff

-LRB-

-RRB-

be

sets

of

formulae

such

that

oe

-LRB-

-RRB-

and

be

a

For

any

element

a

and

any

contextual

formula

Cf

-LRB-

-RRB-

we

have

obs

-LRB-

a

-RRB-

-RRB-

oe

-LRB-

-RRB-

obs

-LRB-

a

-RRB-

We

need

the

following

lemmas

for

the

proof

Lemma

Let

oe

be

a

signature

morphism

and

be

a

For

any

Wff

-LRB-

-RRB-

we

have

pEv

-RRB-

oe

-LRB-

-RRB-

pEvoe

-LRB-

-RRB-

Proof

Follows

directly

from

Definition

and

Fact

Lemma

Let

oe

be

a

signature

morphism

Wff

-LRB-

X

-RRB-

and

Wff

-LRB-

-RRB-

be

sets

of

formulae

such

that

oe

-LRB-

-RRB-

and

be

a

For

any

Wff

-LRB-

-RRB-

we

have

-RRB-

oe

-LRB-

-RRB-

f

Proof

Assume

By

Definition

we

have

X

pEv

By

Lemma

we

obtain

X

oe

-LRB-

-RRB-

pEvoe

-LRB-

-RRB-

-LRB-

i

-RRB-

It

is

obvious

from

Definition

that

for

any

oe

-LRB-

-RRB-

we

have

oe

-LRB-

-RRB-

oe

-LRB-

-RRB-

Let

oe

-LRB-

-RRB-

then

from

-LRB-

i

-RRB-

we

deduce

X

pEvoe

-LRB-

-RRB-

By

Definition

this

yields

oe

-LRB-

-RRB-

f

Proof

of

Theorem

Let

oe

be

a

signature

morphism

Wff

-LRB-

X

-RRB-

and

Wff

-LRB-

-RRB-

be

sets

of

formulae

such

that

oe

-LRB-

-RRB-

and

a

be

Let

a

and

assume

obs

-LRB-

a

-RRB-

By

Definition

we

have

-LSB-

a

-RSB-

hence

by

Lemma

we

deduce

oe

-LRB-

-LSB-

a

-RSB-

-RRB-

f

By

Definition

this

yields

oe

-LRB-

-RRB-

obs

-LRB-

a

-RRB-

Note

that

the

converse

of

the

above

theorem

does

not

hold

even

if

oe

-LRB-

-RRB-

Example

Consider

the

signatures

sg

and

Let

-LRB-

x

-RRB-

g.

Consider

oe

such

that

oe

-LRB-

s

-RRB-

and

oe

-LRB-

-RRB-

oe

-LRB-

-RRB-

It

is

clear

that

for

any

-LRB-

-RRB-

is

not

a

observer

of

any

element

a

whereas

oe

-LRB-

-LRB-

-RRB-

-RRB-

-LRB-

-RRB-

and

-LRB-

-RRB-

obsoe

-LRB-

-RRB-

-LRB-

a

-RRB-

However

for

injective

signature

morphisms

the

converse

of

Theorem

holds

Theorem

Let

oe

be

an

injective

signature

morphism

Wff

-LRB-

X

-RRB-

be

a

set

of

formulae

and

be

a

For

any

a

and

any

Cf

-LRB-

-RRB-

we

have

obs

-LRB-

a

-RRB-

oe

-LRB-

-RRB-

obsoe

-LRB-

-RRB-

-LRB-

a

-RRB-

Proof

sketch

Since

oe

is

injective

the

implications

in

lemmas

become

equivalences

when

oe

-LRB-

-RRB-

Consequently

we

obtain

the

proof

we

are

looking

for

by

replacing

the

implications

in

the

proof

of

by

equivalences

The

former

example

shows

the

real

source

of

problems

in

our

approach

More

generally

a

signature

morphism

oe

may

map

two

-LRB-

or

more

-RRB-

different

sorts

S

to

the

same

sort

By

definition

of

oe-reduct

we

then

have

-LRB-

-RRB-

-LRB-

-RRB-

but

the

indistinguishability

relations

may

be

different

on

these

three

carrier

sets

even

if

oe

-LRB-

-RRB-

Consequently

given

on

an

algebra

we

often

need

to

mention

the

carrier

we

are

working

on

This

makes

the

statements

of

some

theorems

and

their

proofs

unusually

complicated

Properties

of

the

Indistinguishability

Relation

The

definition

expresses

a

situation

in

which

two

elements

of

a

algebra

are

indistinguishable

Indeed

it

defines

an

S-sorted

relation

-LRB-

-RRB-

on

an

algebra

called

the

indistinguishability

relation

Since

this

relation

is

the

next

step

toward

a

complete

description

of

our

institution

for

observational

specifications

we

must

study

its

properties

w.r.t.

the

forgetful

functor

and

the

translation

of

observable

formulae

This

will

be

subsequently

necessary

for

establishing

the

Satisfaction

Condition

-LRB-

see

-LSB-

-RSB-

-RRB-

The

following

proposition

is

devoted

to

this

purpose

and

next

we

study

other

interesting

properties

of

the

indistinguishability

relation

Proposition

Let

oe

be

a

signature

morphism

let

Wff

-LRB-

X

-RRB-

and

Wff

-LRB-

-RRB-

be

sets

of

formulae

such

that

oe

-LRB-

-RRB-

and

be

a

For

any

oe

-LRB-

S

-RRB-

for

all

a

b

we

have

that

if

a

b

then

for

any

s

oe

-LRB-

-RRB-

a

and

b

are

indistinguishable

in

-LRB-

-RRB-

s

We

need

the

following

lemma

for

the

proof

Lemma

Let

oe

be

a

signature

morphism

and

be

a

For

any

valued

formula

Wff

-LRB-

-RRB-

we

have

j

iff

j

oe

-LRB-

-RRB-

Proof

sketch

This

lemma

is

a

slightly

modified

version

of

the

Satisfaction

Condition

-LRB-

see

-LSB-

-RSB-

-RRB-

for

-LRB-

Many

Sorted

-RRB-

First

Order

Logic

with

Equality

and

is

proved

similarly

Proof

of

Proposition

Assume

by

contradiction

that

there

exists

s

S

and

a

b

-LRB-

s

-RRB-

such

that

a

b

and

a

b

in

-LRB-

-RRB-

s.

By

Definition

there

exists

cmp

-LRB-

a

b

-RRB-

such

that

-LSB-

a

-RSB-

-LSB-

b

-RSB-

Hence

from

Lemma

we

have

oe

-LRB-

-RRB-

-LSB-

a

-RSB-

oe

-LRB-

-RRB-

-LSB-

b

-RSB-

-LRB-

i

-RRB-

But

according

to

Theorem

oe

-LRB-

-RRB-

is

a

for

both

a

and

b.

Thus

according

to

-LRB-

i

-RRB-

oe

-LRB-

-RRB-

distinguishes

a

and

b

This

is

in

contradiction

with

the

assumption

a

b.

As

mentioned

at

the

end

of

the

previous

section

the

converse

of

this

proposition

does

not

hold

even

if

oe

-LRB-

-RRB-

But

once

again

this

converse

holds

for

injective

signature

morphisms

The

following

fact

is

obvious

from

the

definition

of

the

indistinguishability

relation

Fact

The

indistinguishability

relation

is

reflexive

and

symmetric

The

next

fact

fully

agrees

with

our

claims

Fact

The

indistinguishability

relation

is

neither

compatible

with

operations

nor

with

predicates

Proof

sketch

It

is

enough

to

consider

the

examples

given

in

Introduction

We

have

already

announced

the

following

fact

which

is

a

consequence

of

our

Indistinguishability

Assumption

together

with

general

form

observations

we

use

Fact

The

indistinguishability

relation

is

not

transitive

in

general

Proof

Consider

fa

b

c

Trans

q

Transg

fq

-LRB-

a

-RRB-

q

-LRB-

c

-RRB-

g

and

a

algebra

A

such

that

qA

faAg

In

this

algebra

we

have

obs

-LRB-

aA

-RRB-

obs

-LRB-

cA

-RRB-

fq

-LRB-

-RRB-

g

and

obs

-LRB-

bA

-RRB-

O

Since

aA

and

bA

-LRB-

resp

bA

and

cA

-RRB-

have

no

comparator

they

are

indistinguishable

On

the

other

hand

aA

and

cA

are

distinguished

by

q

-LRB-

-RRB-

Consequently

in

this

example

the

indistinguishability

relation

is

not

transitive

More

generally

the

above

result

has

the

following

explanation

since

we

did

not

impose

any

restriction

on

the

set

of

observable

formulae

nothing

ensures

that

all

the

elements

of

a

given

data

type

can

be

observed

in

the

same

way

On

the

contrary

when

all

the

elements

of

a

carrier

set

have

the

same

observers

the

indistinguishability

relation

is

transitive

on

this

carrier

set

This

may

be

illustrated

as

follows

Example

The

indistinguishability

relation

from

Example

is

transitive

One

may

think

that

Fact

is

quite

unfortunate

and

claim

that

two

elements

should

be

indistinguishable

if

they

are

in

the

sense

of

Definition

and

if

additionally

they

have

the

same

observers

But

in

our

opinion

such

definition

would

not

be

adequate

due

to

the

reason

detailed

in

the

following

example

Example

Consider

a

signature

and

assume

that

we

need

to

provide

a

set

of

observable

formulae

which

induces

on

any

algebra

A

the

following

indistinguishability

relation

a

b

A

a

b

iff

t

T

t

a

With

Definition

we

obtain

this

relation

by

taking

fl

r

j

l

r

-LRB-

T

-RRB-

s

s

Sg

Now

if

we

add

to

this

definition

the

additional

requirement

mentioned

above

we

do

not

obtain

the

desired

indistinguishability

relation

whatever

we

consider

This

example

points

out

that

the

discussed

modification

of

the

Definition

would

decrease

the

expressive

power

of

our

approach

Consequently

we

are

not

enthusiastic

about

such

a

modification

Moreover

as

we

will

see

in

the

sequel

-LRB-

Definition

-RRB-

Fact

raises

no

particular

problem

Observational

Algebras

As

mentioned

in

the

introduction

in

this

paper

an

observational

equality

does

not

necessarily

coincide

with

the

indistinguishability

relation

This

choice

was

dictated

by

the

fact

that

the

indistinguishability

relation

is

not

transported

by

the

forgetful

functor

-LRB-

the

converse

of

Proposition

does

not

hold

even

if

oe

-LRB-

-RRB-

-RRB-

whereas

an

observational

equality

should

be

transported

through

the

forgetful

functor

as

the

usual

equality

does

For

this

reason

we

introduce

in

this

section

a

flexible

concept

of

observational

algebras

Definition

Given

a

signature

an

observational

algebra

is

a

pair

hA

i

where

A

is

a

algebra

and

is

an

S-sorted

equivalence

relation

on

A

called

observational

equality

on

A

We

denote

the

class

of

all

observational

algebras

by

OAlg

-LSB-

-RSB-

According

to

the

above

definition

we

consider

the

equality

symbol

as

a

particular

predicate

symbol

This

symbol

is

explicitly

interpreted

in

an

algebra

by

a

particular

relation

namely

an

observational

equality

Example

Let

L

and

Opt

be

respectively

the

algebra

and

the

indistinguishability

relation

described

in

Example

Since

Opt

is

an

equivalence

relation

-LRB-

c.f.

-RRB-

the

pair

hL

Opti

is

an

observational

algebra

Definition

An

observational

morphism

hA

Ai

hB

B

i

is

any

morphism

from

A

to

B

which

preserves

observational

equalities

i.e

b

As

a

A

b

-RRB-

-LRB-

a

-RRB-

B

-LRB-

b

-RRB-

It

is

obvious

that

OAlg

-LSB-

-RSB-

equipped

with

the

observational

morphisms

forms

a

category

Definition

Let

oe

be

a

signature

morphism

The

oe-reduct

of

an

observational

is

the

observational

algebra

where

is

the

usual

oe-reduct

of

the

and

-LRB-

-RRB-

s

-LRB-

-RRB-

oe

-LRB-

s

-RRB-

The

mapping

joe

extends

to

observational

morphisms

as

in

the

usual

framework

Consequently

it

defines

the

forgetful

functor

from

OAlg

-LSB-

-RSB-

to

OAlg

-LSB-

-RSB-

associated

to

oe

Thus

OAlg

is

a

functor

from

the

category

of

signatures

Sig

to

the

dual

of

the

category

of

all

categories

Catop

OAlg

maps

an

object

of

Sig

to

the

category

of

the

observational

algebras

and

a

signature

morphism

oe

to

the

corresponding

forgetful

functor

joe

This

provides

components

upon

which

an

institution

can

be

built

Validity

of

Observational

Formulae

Before

introducing

observational

formulae

and

defining

their

validity

in

observational

algebras

we

give

some

additional

definitions

and

results

Definition

A

solution

of

an

equation

l

r

-LRB-

resp

atomic

formula

q

-LRB-

tn

-RRB-

-RRB-

in

an

observational

algebra

hA

i

is

a

valuation

X

A

such

that

l

r

-LRB-

resp

tn?i

qA

-RRB-

The

set

of

solutions

of

a

formula

written

-LSB-

-RSB-

hA

i

is

defined

recursively

as

follows

ffl

if

then

-LSB-

-RSB-

hA

i

Val

-LSB-

X

A

-RSB-

c

-LSB-

-RSB-

hA

i

ffl

if

then

-LSB-

-RSB-

hA

i

-LSB-

-RSB-

hA

i

-LSB-

-RSB-

hA

i

ffl

if

then

-LSB-

-RSB-

hA

i

f

Val

-LSB-

X

A

-RSB-

j

Val

-LSB-

X

A

-RSB-

-LRB-

y

X

c

fxg

y

y

-RRB-

-RRB-

-LSB-

-RSB-

hA

ig

where

are

formulae

Since

all

the

connectives

of

the

classical

logic

as

well

as

the

existential

quantifier

can

be

expressed

by

means

of

and

the

solutions

of

an

arbitrary

first

order

logic

formula

are

well

defined

by

the

above

definition

Before

putting

our

formalism

into

an

institutional

framework

we

need

to

investigate

the

solutions

across

the

forgetful

functor

and

the

translation

of

formulae

This

is

done

in

the

following

theorem

Theorem

Let

oe

be

a

signature

morphism

and

be

an

observational

For

any

formula

we

have

-LSB-

-RSB-

iff

oe

-LRB-

-RRB-

-LRB-

-LSB-

oe

-LRB-

-RRB-

-RSB-

-RRB-

joe

-LRB-

i

-RRB-

Proof

sketch

The

proof

is

based

on

the

fact

that

-LRB-

Many-Sorted

-RRB-

First

Order

Logic

is

an

institution

The

Goguen

's

and

Burstall

's

proof

of

this

fact

establishes

a

one

to

one

map

between

Val

-LSB-

X

-RSB-

and

Val

-LSB-

-RSB-

which

is

shown

to

be

solution

preserving

w.r.t.

formula

translation

that

is

-LRB-

i

-RRB-

holds

-LRB-

replacing

by

-RRB-

in

the

usual

framework

of

-LRB-

Many-Sorted

-RRB-

First

Order

Logic

According

to

Remark

which

is

justified

by

Lemma

-LRB-

i

-RRB-

also

holds

for

-LRB-

Many-Sorted

-RRB-

First

Order

Logic

with

our

approach

to

variables

Our

logical

system

is

not

exactly

-LRB-

Many-Sorted

-RRB-

First

Order

Logic

but

may

be

mapped

into

this

in

the

following

way

ffl

We

consider

the

equality

symbol

as

an

S-indexed

family

of

ordinary

predicate

symbols

s.

ffl

Since

in

our

approach

-LRB-

s

-RRB-

are

interpreted

by

equivalence

relations

we

consider

an

S-indexed

set

of

axioms

E

fx

s

x

x

s

y

-RRB-

y

s

x

x

s

y

y

s

z

-RRB-

x

s

zg

Since

-LRB-

i

-RRB-

holds

in

the

usual

framework

of

-LRB-

Many-Sorted

-RRB-

First

Order

Logic

it

also

holds

for

a

particular

class

of

first

order

formulae

of

the

form

E

Consequently

in

the

axiomatic

theory

E

underlying

our

logical

system

-LRB-

i

-RRB-

holds

for

any

first

order

formula

An

elementary

and

complete

proof

of

this

theorem

may

be

found

in

-LSB-

-RSB-

Definition

An

observational

formula

is

a

pair

h

i

where

Wff

-LRB-

X

-RRB-

is

a

formula

and

Wff

-LRB-

X

-RRB-

is

a

set

of

formulae

We

note

OWff

-LSB-

-RSB-

the

set

of

all

observational

formulae

Notice

that

observational

formulae

are

only

atomic

ones

We

have

neither

observational

connectives

nor

observational

quantifiers

It

may

be

interesting

to

investigate

the

possibility

of

including

such

features

to

our

approach

As

in

the

usual

framework

OWff

is

extended

to

a

functor

from

the

category

of

signatures

Sig

to

Set

-LRB-

the

category

of

sets

-RRB-

This

functor

maps

an

objet

of

Sig

to

the

set

of

all

observational

formulae

An

arrow

oe

of

Sig

-LRB-

-RRB-

is

mapped

by

OWff

to

the

corresponding

translation

of

observational

formula

OWff

-LSB-

oe

-RSB-

-LRB-

h

i

-RRB-

hoe

-LRB-

-RRB-

oe

-LRB-

-RRB-

i.

-LRB-

We

write

shortly

oe

instead

of

OWff

-LSB-

oe

-RSB-

-RRB-

We

have

already

all

the

elements

necessary

to

define

an

observational

satisfaction

relation

Definition

We

say

that

an

observational

algebra

hA

i

satisfies

an

observational

formula

h

i

written

hA

i

Oj

h

i

iff

-LSB-

-RSB-

hA

i

Val

-LSB-

X

A

-RSB-

-LRB-

i

-RRB-

-LRB-

ii

-RRB-

Notice

that

in

the

above

we

have

defined

a

family

of

relations

fOj

g

Sig

with

Oj

OAlg

-LSB-

-RSB-

OWff

-LSB-

-RSB-

We

examine

now

how

our

satisfaction

relation

behaves

w.r.t.

the

variance

of

observational

formulae

-LRB-

translation

-RRB-

and

the

covariance

of

algebras

-LRB-

oe-reduct

-RRB-

We

start

by

the

first

requirement

of

Definition

Proposition

Let

oe

be

a

signature

morphism

For

any

set

of

formulae

Wff

-LRB-

X

-RRB-

any

observational

and

any

formula

we

have

-LSB-

oe

-LRB-

-RRB-

-RSB-

Val

-LSB-

-RSB-

iff

-LSB-

-RSB-

Val

-LSB-

X

-RSB-

Proof

We

have

-LSB-

oe

-LRB-

-RRB-

-RSB-

Val

-LSB-

-RSB-

which

is

equivalent

to

-LRB-

-LSB-

oe

-LRB-

-RRB-

-RSB-

-RRB-

joe

-LRB-

Val

-LSB-

-RSB-

-RRB-

joe

which

by

Theorem

is

equivalent

to

-LSB-

-RSB-

-LRB-

Val

-LSB-

-RSB-

-RRB-

joe

-LRB-

i

-RRB-

Since

joe

is

surjective

on

valuations

we

have

-LRB-

Val

-LSB-

-RSB-

-RRB-

joe

Val

-LSB-

X

-RSB-

Thus

the

formula

-LRB-

i

-RRB-

is

equivalent

to

-LSB-

-RSB-

Val

-LSB-

X

-RSB-

The

next

step

is

to

study

the

second

condition

of

Definition

w.r.t.

formula

translation

and

the

forgetful

functor

Proposition

Let

oe

be

a

signature

morphism

For

all

sets

of

formulae

Wff

-LRB-

X

-RRB-

Wff

-LRB-

-RRB-

such

that

oe

-LRB-

-RRB-

and

for

any

observational

we

have

-RRB-

where

and

are

the

indistinguishability

relations

on

and

respectively

Proof

Assume

that

a

b

a

b

-RRB-

a

b.

Applying

Definition

we

obtain

a

b

a

-RRB-

a

b

But

from

Proposition

it

follows

that

a

b

-RRB-

a

b.

Consequently

The

next

step

would

be

to

prove

the

converse

of

the

above

proposition

when

restricted

to

oe

-LRB-

-RRB-

Unfortunately

this

is

not

true

in

general

The

following

example

illustrates

this

fact

Example

Consider

fa

b

s

p

q

sg

and

fc

d

s

r

sg

Let

fp

-LRB-

a

-RRB-

q

-LRB-

b

-RRB-

g.

Notice

that

in

any

algebra

A

we

have

aA

bA

-LRB-

i

-RRB-

because

aA

and

bA

have

no

comparator

Consider

oe

defined

by

oe

-LRB-

s

-RRB-

s

oe

-LRB-

a

-RRB-

c

oe

-LRB-

b

-RRB-

d

oe

-LRB-

p

-RRB-

oe

-LRB-

q

-RRB-

r.

Notice

that

in

any

we

have

cmpoe

-LRB-

-RRB-

-LRB-

-RRB-

fr

-LRB-

-RRB-

g

-LRB-

ii

-RRB-

since

oe

-LRB-

-RRB-

fr

-LRB-

c

-RRB-

r

-LRB-

d

-RRB-

g.

Consider

then

a

reachable

observational

such

that

-LRB-

-RRB-

-LRB-

-RRB-

-LRB-

iii

-RRB-

-LRB-

iv

-RRB-

Notice

that

f

-LRB-

aAjoe

bAjoe

-RRB-

g.

Therefore

according

to

-LRB-

i

-RRB-

we

have

but

oe

-LRB-

-RRB-

since

from

-LRB-

ii

-RRB-

and

-LRB-

iii

-RRB-

we

have

oe

-LRB-

-RRB-

while

-LRB-

iv

-RRB-

holds

From

this

negative

result

we

may

conclude

that

in

order

to

define

institutions

within

our

approach

we

will

be

constrained

to

restrict

somehow

our

formalism

This

will

be

the

subject

of

Section

Observational

Specifications

This

section

is

devoted

to

some

general

notions

about

observational

specifications

Definition

An

observational

specification

OSP

is

a

triplet

h

i

where

is

the

signature

of

OSP

the

-LRB-

finite

-RRB-

set

of

its

axioms

and

is

a

set

of

formulae

Wff

-LRB-

X

-RRB-

called

observations

of

OSP

The

models

are

defined

as

in

the

usual

approach

except

that

we

use

the

observational

satisfaction

instead

of

the

usual

one

Definition

Let

OSP

h

f

ng

i

be

an

observational

specification

We

say

that

an

observational

algebra

hA

i

is

a

model

of

OSP

iff

hA

i

Oj

h

n

i

We

note

OAlg

-LSB-

OSP

-RSB-

the

class

of

all

observational

models

of

OSP

OAlg

-LSB-

OSP

-RSB-

with

observational

morphisms

is

a

full

subcategory

of

OAlg

-LSB-

-RSB-

Fact

The

observational

algebra

hL

Opti

described

in

Example

is

a

model

of

the

observational

specification

OPT-SET

Proof

Since

the

observational

equality

on

hL

Opti

is

just

the

indistinguishability

relation

we

only

need

to

prove

that

for

any

axiom

of

OPT-SET

we

have

-LSB-

-RSB-

L

Val

-LSB-

X

L

-RSB-

-LRB-

i

-RRB-

ffl

For

the

first

axiom

the

requirement

-LRB-

i

-RRB-

is

satisfied

because

for

any

set

cng

LSet

and

any

optional

constant

c

the

result

of

addL

-LRB-

c

cng

-RRB-

is

either

fc

cng

or

cng

-LRB-

depending

on

whether

c

is

particular

or

not

-RRB-

and

we

know

-LRB-

see

-RRB-

that

fc

cng

and

cng

are

in

the

same

equivalence

class

of

the

observational

equality

Opt

ffl

Since

is

the

usual

membership

it

is

clear

that

the

requirement

-LRB-

i

-RRB-

is

also

satisfied

by

the

second

and

the

third

axiom

The

next

result

points

out

that

our

observational

specifications

generalize

the

usual

approach

On

one

hand

an

algebra

A

can

be

viewed

as

the

observational

algebra

hA

i.

On

the

other

hand

an

algebraic

specification

h

i

can

be

considered

as

an

observational

one

in

the

straightforward

way

Proposition

Let

h

i

be

an

algebraic

specification

Each

model

of

h

i

with

fxs

ys

j

s

Sg

is

of

the

form

hA

i

with

A

Alg

-LSB-

h

i

-RSB-

Proof

Note

first

that

is

the

identity

relation

on

any

algebra

This

is

obvious

since

all

a

b

As

a

b

are

distinguished

by

e.g.

-LRB-

a

-RRB-

cmp

-LRB-

a

b

-RRB-

According

to

Definition

for

any

hA

i

OAlg

-LSB-

h

i

-RSB-

we

should

have

Thus

is

just

the

usual

equality

From

the

requirement

-LSB-

-RSB-

hA

i

Val

-LSB-

X

A

-RSB-

we

deduce

that

A

Alg

-LSB-

h

i

-RSB-

Conversely

it

is

clear

that

for

any

B

Alg

-LSB-

h

i

-RSB-

we

have

hB

i

OAlg

-LSB-

h

i

-RSB-

Up

to

now

we

have

not

been

studying

modularity

issues

We

have

only

defined

the

semantics

of

flat

specifications

In

fact

as

in

-LSB-

-RSB-

our

semantics

extends

to

an

observational

stratified

loose

semantics

-LSB-

-RSB-

without

additional

assumptions

For

instance

the

next

theorem

shows

that

our

approach

fulfills

the

requirement

of

reusing

by

restriction

of

-LSB-

-RSB-

Theorem

Let

oe

be

a

signature

morphism

For

all

observational

specifications

OSP

h

i

and

h

such

that

oe

-LRB-

-RRB-

and

oe

-LRB-

-RRB-

we

have

OAlg

-LSB-

-RSB-

joe

OAlg

-LSB-

OSP

-RSB-

Proof

From

definitions

and

it

is

enough

to

prove

OAlg

-LSB-

-RSB-

-LSB-

-RSB-

Val

-LSB-

-RSB-

-RRB-

-LSB-

-RSB-

Val

-LSB-

X

-RSB-

-LRB-

i

-RRB-

and

OAlg

-LSB-

-RSB-

-RRB-

-LRB-

ii

-RRB-

ffl

Proof

of

-LRB-

i

-RRB-

Let

OAlg

-LSB-

-RSB-

such

that

-LSB-

-RSB-

Val

-LSB-

-RSB-

Since

oe

-LRB-

-RRB-

is

included

in

by

definition

of

solution

of

a

conjunction

of

formulae

-LRB-

c.f.

-RRB-

we

have

oe

-LRB-

-RRB-

Hence

-LSB-

oe

-LRB-

-RRB-

-RSB-

Val

-LSB-

-RSB-

which

according

to

Proposition

implies

that

-LSB-

-RSB-

Val

-LSB-

X

-RSB-

ffl

Proof

of

-LRB-

ii

-RRB-

follows

directly

from

Proposition

This

result

corresponds

to

a

very

fundamental

property

which

holds

in

most

non

observational

frameworks

With

all

the

definitions

of

observational

satisfaction

relation

preceding

-LSB-

-RSB-

such

a

result

holds

only

for

equational

axioms

or

positive-conditional

axioms

with

observable

preconditions

which

is

a

rather

strong

restriction

It

may

be

then

surprising

that

in

our

approach

the

former

theorem

holds

without

restrictions

even

if

the

axioms

are

arbitrary

first

order

formulae

The

reason

is

that

our

observational

equality

is

not

fixed

by

observations

even

though

the

indistinguishability

relation

is

fixed

Unlike

-LSB-

-RSB-

-LSB-

-RSB-

-LSB-

-RSB-

-LSB-

-RSB-

and

-LSB-

-RSB-

our

observational

equality

does

not

coincide

with

the

indistinguishability

relation

This

choice

was

dictated

by

the

fact

that

the

indistinguishability

relation

is

disconnected

from

the

forgetful

functor

On

the

contrary

our

observational

equality

similarly

to

the

usual

equality

is

always

transported

through

the

forgetful

functor

In

short

the

main

difference

of

our

approach

with

the

above-mentioned

works

is

that

our

satisfaction

relation

is

based

on

an

observational

equality

which

does

not

coincide

with

the

indistinguishability

relation

This

situation

-LRB-

in

part

-RRB-

guarantees

such

a

general

result

as

Theorem

We

may

also

consider

a

particular

case

of

this

theorem

with

oe

-LRB-

-RRB-

This

points

out

that

observations

act

on

the

semantics

of

a

specification

in

a

similar

way

as

the

axioms

do

by

adding

observations

we

diminish

the

class

of

the

observational

models

This

is

yet

another

reason

for

introducing

observational

formulae

especially

in

context

of

the

next

section

We

argue

that

in

any

approach

with

an

observational

satisfaction

relation

the

Satisfaction

Condition

may

hold

only

if

the

translation

of

observations

is

considered

at

the

same

level

as

the

translation

of

axioms

Relationship

with

Behavioural

Equivalence

In

this

section

we

investigate

deeper

the

relationship

of

our

approach

with

behavioural

equivalence

of

algebras

Several

papers

dealing

with

an

observational

satisfaction

relation

provide

also

a

definition

of

a

behavioural

equivalence

Obs

of

algebras

which

aims

at

reflecting

the

situation

when

algebras

behave

in

the

same

way

w.r.t.

some

observations

Obs

One

may

then

define

the

class

of

behaviours

of

a

specification

SP

written

BehObs

-LSB-

SP

-RSB-

as

the

closure

of

the

usual

class

of

the

models

of

SP

by

the

equivalence

Obs

BehObs

-LSB-

SP

-RSB-

fA

Alg

-LSB-

-RSB-

j

B

Alg

-LSB-

SP

-RSB-

A

Obs

Bg

-LRB-

-LCB-

i

-RRB-

In

such

a

framework

it

is

interesting

to

establish

that

the

class

of

the

behaviours

of

SP

h

i

coincides

with

the

class

of

observational

models

of

SP

BehObs

-LSB-

h

i

-RSB-

OAlg

-LSB-

h

Obsi

-RSB-

This

result

can

not

hold

in

our

approach

since

according

to

-LRB-

-LCB-

i

-RRB-

for

an

inconsistent

specification

SP

-LRB-

Alg

-LSB-

SP

-RSB-

O

-RRB-

we

have

always

BehObs

-LSB-

SP

-RSB-

O

whereas

the

class

of

the

observational

models

of

SP

may

be

nonempty

This

is

due

to

the

fact

that

our

observational

satisfaction

relation

is

based

on

an

observational

equality

which

is

not

necessarily

a

congruence

But

this

phenomenon

disappears

when

we

restrict

to

observational

equalities

being

congruences

It

is

then

interesting

to

investigate

the

relationship

between

behavioural

equivalence

on

algebras

and

our

approach

in

this

restricted

framework

We

assume

for

the

scope

of

this

section

that

observational

equalities

are

congruences

Consequently

in

this

section

an

element

of

OAlg

-LSB-

-RSB-

is

any

pair

hA

i

such

that

A

is

a

algebra

and

is

a

congruence

Under

this

assumption

it

is

always

possible

to

consider

the

quotient

A

This

allows

to

provide

an

adequate

to

our

approach

definition

of

behavioural

equivalence

of

observational

algebras

w.r.t.

a

set

of

formulae

Definition

We

say

that

two

observational

algebras

hA

Ai

and

hB

B

i

are

behaviourally

equivalent

w.r.t.

a

set

of

fromulae

written

hA

Ai

hB

Bi

iff

A

A

B

B

-LRB-

i

-RRB-

A

A

B

B

-LRB-

ii

-RRB-

where

A

and

B

are

the

indistinguishability

relations

on

A

and

B

respectively

The

formula

-LRB-

-LCB-

i

-RRB-

which

defines

the

class

of

behaviours

is

adapted

to

observational

algebras

Definition

Given

an

observational

specification

h

i

the

class

of

its

behaviours

written

Beh

-LSB-

h

i

-RSB-

is

defined

as

follows

Beh

-LSB-

h

i

-RSB-

fhA

i

OAlg

-LSB-

-RSB-

j

B

Alg

-LSB-

h

i

-RSB-

hA

i

hB

ig

The

result

we

are

interested

in

may

be

stated

as

follows

Theorem

For

any

observational

specification

h

i

we

have

Beh

-LSB-

h

i

-RSB-

OAlg

-LSB-

h

i

-RSB-

We

need

an

auxiliary

definition

as

well

as

some

lemmas

for

the

proof

Lemma

For

any

specification

h

i

and

any

observational

algebra

hA

i

we

have

hA

i

Beh

-LSB-

h

i

-RSB-

iff

A

j

and

A

Proof

Let

hA

i

Beh

-LSB-

h

i

-RSB-

By

Definition

this

is

equivalent

to

B

Alg

-LSB-

h

i

-RSB-

hA

i

hB

i

Since

B

by

Definition

this

is

equivalent

to

B

Alg

-LSB-

-RSB-

A

B

B

j

and

A

which

is

equivalent

to

A

j

and

A

Definition

Let

be

a

congruence

on

a

algebra

A

and

let

X

A

be

a

valuation

Then

X

A

is

defined

as

a

valuation

such

that

if

x

a

then

x

-LSB-

a

-RSB-

where

-LSB-

a

-RSB-

is

the

equivalence

class

of

a

w.r.t.

Lemma

Let

be

a

congruence

on

a

algebra

A

and

let

X

A

and

X

A

be

valuations

such

that

For

any

Wff

-LRB-

X

-RRB-

we

have

-LSB-

-RSB-

hA

i

iff

-LSB-

-RSB-

hA

i

Proof

Obvious

from

the

fact

that

if

then

-LSB-

-RSB-

hA

i

-LSB-

-RSB-

hA

i

for

any

formula

Lemma

Let

be

a

congruence

on

a

algebra

A.

For

any

Wff

-LRB-

X

-RRB-

we

have

-LSB-

-RSB-

hA

i

Val

-LSB-

X

A

-RSB-

iff

-LSB-

-RSB-

hA

i

Val

-LSB-

X

A

Proof

Obvious

from

the

previous

lemma

Proof

of

Theorem

Let

hA

i

Beh

-LSB-

h

i

-RSB-

By

Lemma

this

is

equivalent

to

-LSB-

-RSB-

hA

i

Val

-LSB-

X

A

and

A

which

by

Lemma

and

Definition

is

equivalent

to

hA

i

OAlg

-LSB-

h

i

-RSB-

Theorem

shows

that

when

observational

equalities

are

restricted

to

congruences

the

class

of

such

observational

models

may

be

characterized

as

the

closure

of

the

usual

class

of

the

models

by

an

appropriate

behavioural

equivalence

Towards

an

Institution

of

Observational

Specifications

In

this

section

based

on

the

formalism

we

have

developed

so

far

we

propose

an

institution

for

observational

specifications

As

mentioned

in

Section

this

task

requires

to

introduce

some

restrictions

in

our

general

formalism

According

to

the

definition

of

-LSB-

-RSB-

the

quadruple

hSig

OWff

OAlg

Oj

i

could

be

an

institution

provided

that

it

would

fulfill

the

Satisfaction

Condition

which

in

our

formalism

is

expressed

by

the

following

property

Property

For

any

oe

any

observational

formula

h

i

and

any

observational

we

have

Oj

oe

-LRB-

h

i

-RRB-

iff

Oj

h

i

To

show

that

this

property

holds

by

definition

it

is

enough

to

prove

that

for

any

observational

the

following

conditions

hold

OAlg

-LSB-

-RSB-

-LSB-

oe

-LRB-

-RRB-

-RSB-

Val

-LSB-

-RSB-

-LSB-

-RSB-

Val

-LSB-

X

-RSB-

-LRB-

i

-RRB-

and

OAlg

-LSB-

-RSB-

oe

-LRB-

-RRB-

-LRB-

ii

-RRB-

The

first

requirement

is

guaranteed

by

From

Proposition

we

have

the

if

part

of

the

second

requirement

Unfortunately

we

know

from

Example

that

its

converse

part

does

not

hold

without

additional

assumptions

The

following

is

the

necessary

and

sufficient

condition

of

the

converse

part

of

-LRB-

ii

-RRB-

Property

Let

oe

be

a

signature

morphism

and

Wff

-LRB-

X

-RRB-

be

a

set

of

formulae

For

any

any

oe

-LRB-

S

-RRB-

and

all

a

b

oe

-LRB-

-RRB-

distinguishable

there

exist

s

oe

-LRB-

-RRB-

such

that

a

and

b

are

distinguishable

when

considered

as

elements

of

-LRB-

-RRB-

s.

Proposition

Let

oe

be

a

signature

morphism

The

property

holds

for

a

set

of

formulae

if

and

only

if

-RRB-

oe

-LRB-

-RRB-

holds

on

all

OAlg

-LSB-

-RSB-

Proof

ffl

-RRB-

Let

OAlg

-LSB-

-RSB-

Assume

that

a

b

a

-RRB-

a

b

-LRB-

i

-RRB-

By

contradiction

assume

that

there

exist

-LRB-

s

-RRB-

such

that

oe

-LRB-

-RRB-

and

-LRB-

ii

-RRB-

Using

Property

we

find

that

there

exist

oe

-LRB-

oe

-LRB-

s

-RRB-

-RRB-

such

that

in

-LRB-

-RRB-

But

according

to

-LRB-

ii

-RRB-

we

conclude

that

Therefore

-RRB-

which

is

a

contradiction

to

the

assumption

-LRB-

i

-RRB-

ffl

-LRB-

-LRB-

We

use

the

contrapositive

method

for

the

proof

-RRB-

Let

oe

and

Wff

-LRB-

X

-RRB-

for

which

the

property

does

not

hold

Consequently

there

is

a

with

elements

a

b

-LRB-

-RRB-

-LRB-

for

some

S

-RRB-

oe

-LRB-

-RRB-

distinguishable

such

that

for

any

s

S

satisfying

oe

-LRB-

s

-RRB-

oe

-LRB-

-RRB-

a

and

b

are

indisintguishable

in

-LRB-

-RRB-

s.

Let

be

provided

with

so

that

c

d

-RRB-

c

oe

-LRB-

-RRB-

d

for

all

c

d

except

for

a

b

where

a

b

and

as

assumed

a

oe

-LRB-

-RRB-

b

It

is

clear

from

the

proof

of

that

for

all

of

these

c

d

we

have

also

c

-RRB-

c

d

It

follows

from

the

above

formula

that

since

by

Definition

we

have

a

and

we

assumed

that

a

b

Now

oe

-LRB-

-RRB-

because

a

b

and

we

have

assumed

that

a

oe

-LRB-

-RRB-

b.

We

can

conclude

from

the

above

that

in

our

approach

the

Satisfaction

Condition

does

not

hold

in

general

Only

the

if

part

of

Property

holds

Consequently

according

to

-LSB-

-RSB-

our

approach

defines

a

reduction-preserving

pre-institution

The

converse

part

of

holds

only

for

the

signature

morphisms

and

the

observations

which

preserve

Therefore

our

approach

is

another

motivation

for

more

liberal

formalizations

than

institutions

of

the

notion

of

logical

system

such

as

e.g.

specification

logic

-LSB-

-RSB-

or

pre-institutions

-LSB-

-RSB-

Since

the

Satisfaction

Condition

holds

only

for

some

signature

morphisms

in

order

to

define

an

institution

in

our

framework

one

could

ignore

the

problematic

arrows

of

Sig

and

consider

as

a

category

of

signatures

a

category

which

has

the

same

objects

as

Sig

but

less

arrows

Then

the

question

is

which

signature

morphisms

we

should

eliminate

in

order

to

obtain

an

institution

It

is

easy

to

see

that

examples

similar

to

can

be

constructed

as

soon

as

we

have

an

non

injective

signature

morphism

We

conclude

that

an

observational

institution

can

be

provided

within

our

formalism

under

the

restriction

of

the

arrows

of

Sig

to

injective

morphisms

only

Proposition

Consider

the

quadruple

OAlgSpec

hISig

OWff

OAlg

Oj

i

where

ISig

is

the

category

whose

objects

are

the

usual

signatures

and

whose

arrows

are

the

injective

signature

morphisms

Then

OAlgSpec

is

an

institution

Proof

It

is

sufficient

to

prove

that

Property

holds

for

injective

signature

morphisms

Let

oe

be

an

injective

signature

morphism

let

Wff

-LRB-

X

-RRB-

be

a

set

of

formulae

a

and

let

a

b

-LRB-

s

-RRB-

oe

-LRB-

-RRB-

distinguishable

Let

cmpoe

-LRB-

-RRB-

-LRB-

a

b

-RRB-

be

a

comparator

which

distinguishes

a

from

b

Since

oe

is

injective

there

is

a

unique

Cf

-LRB-

-RRB-

such

that

oe

-LRB-

-RRB-

According

to

Theorem

is

an

observer

of

a

and

b

So

cmp

-LRB-

a

b

-RRB-

Since

-LSB-

a

-RSB-

-LSB-

b

-RSB-

from

Lemma

we

deduce

that

-LSB-

a

-RSB-

-LSB-

b

-RSB-

Therefore

by

Definition

we

have

a

b.

A

drawback

of

our

approach

is

the

necessity

to

restrict

the

category

of

signatures

to

ISig

in

order

to

have

an

institution

However

except

for

some

particular

examples

of

parameterpassing

morphisms

non

injective

signature

morphisms

seem

to

be

not

very

useful

In

spite

of

this

restriction

OAlgSpec

may

be

used

for

modular

specifications

with

no

parameterized

modules

-LRB-

Observational

semantics

of

parameterized

specifications

is

one

of

our

current

research

topics

-RRB-

Conclusions

We

have

presented

an

observational

semantics

of

algebraic

specifications

supporting

full

first

order

axioms

and

full

first

order

formulae

as

observations

This

has

been

achieved

by

defining

an

observational

satisfaction

relation

whose

cornerstone

is

the

use

of

a

non

standard

interpretation

of

equality

We

have

shown

that

our

formalism

is

a

reduction-preserving

pre-institution

and

may

under

some

restrictions

even

provide

an

institution

This

work

may

continue

along

different

lines

Since

our

observational

formulae

are

in

some

sense

only

atomic

ones

one

may

want

to

define

some

observational

connectives

or

quantifiers

together

with

their

semantics

This

may

lead

to

an

Observational

Model

Theory

A

much

more

problematic

still

missing

contribution

would

be

the

corresponding

Observational

Proof

Theory

However

the

results

of

this

research

area

are

crucial

for

most

applications

of

observational

specifications

in

software

engineering

Acknowledgments

I

gratefully

acknowledge

Gilles

Bernot

Michel

Bidoit

and

Fernando

Orejas

for

their

extensive

comments

and

numerous

fruitful

discussions

I

also

wish

to

thank

particularly

Regina

Yillah

for

the

careful

proof

reading

of

this

paper

This

work

is

partially

supported

by

ESPRIT

Working

Group

COMPASS

and

CNRS

GDR

de

Programmation

References

-LSB-

-RSB-

G.

Bernot

and

M.

Bidoit

Proving

the

correctness

of

algebraically

specified

software

Modularity

and

observability

issues

In

Proceedings

of

Second

International

Conference

on

Algebraic

Methodology

and

Software

Technology

pages

-LCB-

Iowa

City

May

-LSB-

-RSB-

G.

Bernot

M.

Bidoit

and

T.

Knapik

Observational

approaches

and

indistinguishability

assumption

Technical

Report

LIENS

-LCB-

-LCB-

Laboratoire

d'Informatique

de

l'Ecole

Normale

Sup?erieure

-LSB-

-RSB-

G.

Bernot

M.

Bidoit

and

T.

Knapik

Towards

an

adequate

notion

of

observation

In

B.

Krieg-Br

uckner

editor

European

Syposium

on

Programming

LNCS

pages

-LCB-

Rennes

Feb.

-LSB-

-RSB-

M.

Bidoit

The

stratified

loose

approach

A

generalization

of

initial

and

loose

semantics

In

D.

Sannella

and

A.

Tarlecki

editors

Recent

Trends

in

Data

Type

Specification

LNCS

pages

-LCB-

Gullane

Sept.

Selected

papers

from

Workshop

on

Specification

of

Abstract

Data

Types

-LSB-

-RSB-

H.

Ehrig

M.

Baldamus

and

F.

Orejas

New

concepts

for

amalgamation

and

extension

in

the

framework

of

specification

logics

Technical

Report

Technische

Universit?at

Berlin

May

-LSB-

-RSB-

H.

Ehrig

and

B.

Mahr

Fundamentals

of

Algebraic

Specifications

volume

of

EATCS

Monographs

on

Theoretical

Computer

Science

Springer-Verlag

-LSB-

-RSB-

J.

A.

Goguen

and

R.

Burstall

Institutions

Abstract

model

theory

for

specification

and

programming

Technical

Report

ECS

-LCB-

LFCS

-LCB-

-LCB-

Department

of

Computer

Science

University

of

Edinburgh

Jan.

-LSB-

-RSB-

J.

A.

Goguen

and

J.

Meseguer

Persistent

interconnection

and

implementation

of

abstract

modules

In

M.

Nielsen

and

E.

M.

Schmidt

editors

ICALP

LNCS

pages

-LCB-

Aarhus

May

-LSB-

-RSB-

J.

A.

Goguen

J.

W.

Thatcher

and

E.

G.

Wagner

An

initial

approach

to

the

specification

correctness

and

implementation

of

abstract

data

types

In

R.

T.

Yeh

editor

Data

Structuring

volume

of

Current

Trends

in

Programming

Methodology

pages

-LCB-

Prentice

Hall

-LSB-

-RSB-

P.

Nivela

and

F.

Orejas

Initial

behaviour

semantics

for

algebraic

specification

In

D.

Sannella

and

A.

Tarlecki

editors

Recent

Trends

in

Data

Type

Specification

LNCS

pages

-LCB-

Gullane

Sept.

Selected

papers

from

Workshop

on

Specification

of

Abstract

Data

Types

-LSB-

-RSB-

H.

Reichel

Behavioural

validity

of

conditional

equations

in

abstract

data

types

In

Contributions

to

General

Algebra

pages

-LCB-

Proceedings

of

the

Vienna

Conference

-LSB-

-RSB-

A.

Salibra

and

G.

Scollo

A

soft

stairway

to

institutions

In

M.

Bidoit

and

C.

Choppy

editors

Recent

Trends

in

Data

Type

Specification

Dourdan

Sept.

Selected

papers

from

Workshop

on

Specification

of

Abstract

Data

Types

-LSB-

-RSB-

D.

Sannella

and

A.

Tarlecki

On

observational

equivalence

and

algebraic

specification

J.

Comput

Syst

Sci.

-LRB-

-RRB-

-LCB-

-LSB-

-RSB-

N.

W.

P.

van

Diepen

Implementation

of

modular

algebraic

specifications

In

H.

Ganzinger

editor

European

Syposium

on

Programming

LNCS

pages

-LCB-

Nancy

Mar.

algebraic specification
observability
semantics