Coinductive semantics
[
Home
]
[ Index:
by date

by threads
]
[ Message by date: previous  next ] [ Message in thread: previous  next ] [ Thread: previous  next ]
[ Message by date: previous  next ] [ Message in thread: previous  next ] [ Thread: previous  next ]
Date:   (:) 
From:  Francisco J. Valverde Albacete <fva@t...> 
Subject:  Re: [Camllist] Coinductive semantics 
Hi although I may be out on a limb here, I recall reading *somewhere* :( that while initial algebras where good models for stateless abstract data types (and (structural) induction the way to work over terms in the free algebra defined by constructors modulo the laws of the ADT), final algebras where good models for *stateful* datatypes (and coinduction the way to work over the finer "state descriptors" modulo the laws of state equivalence), hence they *might* be better models for *objects* (as stateful datatypes) than initial algebras. Has anybody read anything proving or disproving this? Regards, Francisco Valverde  DTSC Univ. Carlos III de Madrid Andrej Bauer wrote: >Alessandro Baretta wrote: > > >>Is there anyone around who can help? >> >> > >Induction is about initial algebras. It says that an initial algebra >does not have any nontrivial SUBalgebras. General induction principle >for the initial algebra A with operations f_1, ..., f_n (some of which >may be 0ary operations, i.e., constants) goes as follows: > >INDUCTION PRINCIPLE: >Suppose S is a subset of A which is closed under operations f_i, meaning >that if x_1, ..., x_{k_i} are in S then also f_i(x_1, ..., x_{k_i}) is >in S (here k is the arity of operation f_i). Then S = A. > >If we apply this to the case when we have one constant f_0=Empty and one >binary operation f_1=Tree, we get as A all finite binary trees and the >induction principle: > >INDUCTION PRINCIPLE FOR FINITE BINARY TREES: >Suppose S is a set of finite binary trees such that the empty tree is in >S, and whenever x and y are in S then also tree Tree(x,y) is in S. Then >S is the set of all finite binary trees. > >Now coinduction is about final coalgebras. It says that a final >coalgebra does not have any nontrivial QUOTIENT coaglebras. This is >usually expressed as follows: if F is the final coalgebra for operations >f_1, ..., f_n, and E is an equivalence relation on F which respects the >operations, then E is the identity relation (because if it were not, we >could form a nontrivial quotient coaglebra F/E). The actual coinduction >principle may be stated for an arbitrary relation R (think of E as the >equivalence relation generated by R): > >COINDUCTION PRINCIPLE: >Suppose R is a relation on the final coalgebra F which respects the >operations, i.e., if x_1 R y_1, ...., x_{k_i} R y_{k_i} then >f_i(x_1, ..., x_{k_i}) R f_i(y_1, ..., y_{k_i}) for all x's, y's and >f_i's. Then R(x,y) implies x = y. > >An R satisfying the above condition generates the trivial equivalence >relation (equality) and so the quotient F/R is just F. > >We take again as example the final coalgebra F with one constant >f_0=Empty and one binary operation f_1=Tree. This is the set of finite >and infinite binary trees. > >COINDUCTION FOR (FINITE AND INFINITE) BINARY TREES: >Suppose R is a relation on trees such that: >(1) Empty R Empty >(2) if x R y and x' R y' then Tree(x,y) R Tree(x',y'). >Then x R y implies x = y. > >It takes some practice to get used to coinduction and to figure out how >to prove properties of final coalgebras with it. If this was too terse, >let me know (and tell me which bits to expand upon). > >Andrej > >_______________________________________________ >Camllist mailing list. Subscription management: >http://yquem.inria.fr/cgibin/mailman/listinfo/camllist >Archives: http://caml.inria.fr >Beginner's list: http://groups.yahoo.com/group/ocaml_beginners >Bug reports: http://caml.inria.fr/bin/camlbugs > >