# [FOM] Object-Oriented Formal Mathematical Languages

Jacques Carette carette at mcmaster.ca
Thu Apr 29 15:00:09 EDT 2004

A better analogy would be that (class, object) corresponds to
(mathematical theory, model).  This second pair is significantly
more powerful, as inheritance is not the only theory combinator,
whereas it is essentially the only class combinator.  Mixins
help too, but they are not enough compared to the wealth of
functors that exist on the category of theories.

Axioms in a mathematical theory have a much more powerful role than
in traditional object-oriented models.  And mathematical theories
come with derivation rules, where OO only has the equivalent of
method calls (ie beta reduction).

As an exercise, you should try to find an adequate OO model of
the theory of the ring of rectangular matrices, where you can only
add and multiply matrices of compatible size *at compile time*.  As
far as I know, even die-hard OO fans have tried and given up in
disgust.  [The Standard Template Library is functional, not OO, so
Blitz++ does not count].

Jacques

-----Original Message-----
From: Victor Makarov [mailto:viktormakarov at hotmail.com]
Sent: April 29, 2004 10:59 AM
To: bpostow at union.edu; carette at mcmaster.ca
Cc: sbuss at math.ucsd.edu; fom at cs.nyu.edu
Subject: Re: [FOM] Object-Oriented Formal Mathematical Languages

On Wed, 28 Apr 2004 11:34:14 , Brian Postow wrote:
"There are several object oriented models at the level of the lambda
calculus.The $\varsigma$ calculus by Cardelli and Abadi and the $\lambda \&$

calculus by Castagna are two good places to start."

On Wed, 28 Apr 2004 19:51:19, Jacques Carette wrote:

"the systems above are lambda-calculus models of object-oriented
programming.  The two
models above (ie $\varsigma$ and $\lambda \&$) are beautiful pieces
of mathematics that nicely capture most (but unfortunately not all)
of the essence of object-oriented systems."

I doubt that the lambda calculus (or calculi baset on it) can be a good
theoretical foundation of Object-Oriented Programming.

For me, the essence of the Object-Oriented Programming paradigm is as
follows.

The main concepts of OOP are the concepts of object and class. An object is
a k-tuple of values. A value can be, for example, an integer or real number,

a character or a string of characters or another object. Any object is an
instance of a class. A class is a description (in an object-oriented
programming language) of the structure of its objects, some conditions
(called class invariant) that all objects of the class must satisfy and some

operations on its objects. A class is to an object (of its class) as a
blueprint of a real object (a bicycle, for example) is to the real object.

Note the similarity between the concept of object in OOP and the concept
of mathematical object. A mathematical object, such as a group, a graph and
so on, is also usually defined as a k-tuple of sets, functions or other
mathematical objects. For example, a group is a pair( or a 2-tuple) <G, f>
where G is the carrier set and f is a function from G x G to G, satisfying
certain conditions - group axioms. Note that a concrete group is a model of
the group theory and, more generally, a concrete mathematical object is a
model of the corresponding theory (excluding primitive mathematical objects
such as, for example, integer numbers). So we may say that a class is to an
object (of the class) as a mathematical theory is to a model of the theory
(and the class invariant is the analogue of the axioms of a theory).

As mathematical theories are the main way of structuring of the
mathematical knowledge, so classes are the main way of structuring of the
"programming knowledge". A very important feature of OOP is the possibility
to build class hierarchies by defining a class as an heir of other class
(simple inheritance) or classes (multiple inheritance). In mathematics, a
similar method is used when we define, for example, the theory of linear
ordered groups referring to the theory of linear order and the group theory.

This analogy suggests that the theoretical foundation of Object-Oriented
Programming can be rather Foundations of Mathematics (according to  Stephen
G. Simpson, "Foundations of mathematics is the study of the most basic
concepts and logical structure of mathematics, with an eye to the unity of
human knowledge. Among the most basic mathematical concepts are: number,
shape, set, function, algorithm, mathematical axiom, mathematical
definition, mathematical proof."

Sure, we can add to this list the concept of mathematical theory).

Victor Makarov

http://home.nyu.edu/~yvm204/vm/vm.htm

_________________________________________________________________
Test your 'Travel Quotient' and get the chance to win your dream trip!
http://travel.msn.com