Object Oriented Mathematics (1995) [pdf]
Way too many years ago, I was trying to invent what should have been &quot;object oriented constructive mathematics&quot;, but we didn&#x27;t have object oriented programming yet.<p>There was an actual reason for this.  I was working on program verification [1], and we&#x27;d put together a system which used the Oppen-Nelson prover in combination with the Boyer-Moore prover. We needed to prove that their theories were consistent.<p>The Oppen-Nelson prover is a complete, fast, automatic, decision procedure for expressions composed of addition, subtraction, multiplication by constants, conditionals, logical operators, and structure and array access.  This subset of mathematics is completely decidable.  (If you add multiplication of two variables, it becomes undecidable.)  It can also accept &quot;rules&quot;, which are identities that it accepts as true. In our system, the Boyer-Moore prover was used to prove any new rules needed, which could then be imported into the Oppen-Nelson prover. Anything complicated involving loops usually required a new rule.<p>The Boyer-Moore system is completely constructive, and is based on recursive functions.  Numbers are defined as (add1 (add1 (add1 (zero)))), for example.  One can then write recursive functions for addition and subtraction, and work up to multiplication and division.  A few hundred theorems cover basic number theory.<p>Arrays, though, were a problem.  There are four classic axioms, from McCarthy, which define basic array semantics.  The Oppen-Nelson prover has those built in, but the Boyer-Moore system does not. We thus wanted to prove them in the Boyer-Moore system.  If we could do that, it became safe to prove new things about arrays and import those rules into the Oppen-Nelson prover.<p>The axioms: arrays have two operations, SELECT and STORE.  SELECT(array, index) returns the appropriate element from an array.  STORE(array, index, newvalue) returns a new array where newvalue has replaced the element previously at index.  We then have rules such as<p><pre><code>    SELECT(STORE(A, I, V), I) = V       &#x2F;&#x2F; what you store, you get back
</code></pre>
or, in Boyer-Moore notation:<p><pre><code>    (implies (and (arrayp! A) (numberp I))
        (equal (selecta! (storea! A I V) I)
                V))
</code></pre>
The rest can be seen at p. 129 of the manual[1] if you care.<p>Arrays had to be defined in the Boyer-Moore system as a list of (subscript, value) tuples. Not a set, a list.  A set isn&#x27;t a constructive construct, because, informally, a set is a collection of unique values, the order of which is not significant.  In the Boyer-Moore world, two values are equal iff they are identical.  Two sets of tuples with a different order would not be equal.<p>So we had to define an array in the Boyer-Moore world as a list of (subscript, value) tuples ordered by increasing subscript.  This is a clunky notation, because then we have to prove that the STORE operation preserved the correctness of the ordered list. Then we had to prove that all the rules for arrays were always true for that clunky representation.  This required about 50 pages of machine proofs.<p>Back then (this was around 1981-1982), long machine proofs were not acceptable in mathematics. I had a JACM paper rejected for that reason.  The approach was just too ugly.<p>Years later, I realized that what was needed was a kind of object oriented version of constructive mathematics.  The key concept is that two things are equal if there is no way they can be distinguished.  This comes from the theory of uninterpreted functions:<p><pre><code>    forall f, x: f(x) = f(y) implies x = y
</code></pre>
So we would like to be able to define an type with public and private functions, one which exposes a new &quot;equal&quot; operation for the type.  Then, if we can prove that the new &quot;equal&quot; function obeys the rule above for all public functions, and we disallow all further access to the private functions, we can construct a consistent theory with a new, more abstract notion of &quot;equal&quot;.  Now we can write set theory in Boyer-Moore theory without adding new axioms.<p>Unfortunately, I figured this out about a decade too late.  We didn&#x27;t really need that result to get a valid verification system, but it would have cleaned up the theory and made it publishable.  But anyway, there&#x27;s a form of object oriented mathematics which could be potentially useful.<p>The verification system was never used much; it was for a dialect of Pascal for Ford engine control programs that was never used in production.  We looked at extending it to Ada (too hard) and C (too ill-defined).  DEC SRL did a similar system for Modula III, but that died with DEC SRL, DEC, and Modula III. Some of the ideas were reused, decades later, in Microsoft&#x27;s Spec#.<p>[1] <a href="http:&#x2F;&#x2F;www.animats.com&#x2F;papers&#x2F;verifier&#x2F;verifiermanual.pdf" rel="nofollow">http:&#x2F;&#x2F;www.animats.com&#x2F;papers&#x2F;verifier&#x2F;verifiermanual.pdf</a>