.Open Object-oriented vs algebraic documentation
There are two ways to define a set of objects by setting up rules relating the objects, or by specifying the 'contents' of the objects themselves.
Example::=following
.Net
Two ways of defining the complex numbers: c1 and c2.
C1::=Net{
rp,ip::Real.
arg::angle= /tan(ip/rp).
abs::Real~Negative= /(_^2)(rp^2+ip^2).
}.
c1::=$ $C1.
C2::=Net{
c2::Sets.
rp,ip::c2->Real
arg::c2->angle= /tan((ip)/(rp)).
abs::c2->Real~Negative= /(_^2)((rp)^2+(ip)^2).
}.
First, note that c2 satisfies C:
|- c2 in $ $C.
Consider the category of classes that satisfy `C` It might be thought that `c1---c2`. However, by definition of "$", `c1` is the initial class satisfying `C`. Class `c2` can be any class that satisfies `C`. Because `c1` is initial,
`c1->c2`.
Consider
C3::=C2 and Net{for z:c2, z.abs=1}.
Clearly if c3=$ $C3 then c1->c2<==c3<-