# [TYPES] Types as theories

PATRICK BROWNE patrick.browne at dit.ie
Tue May 13 08:09:38 EDT 2014

```Dear list
I am studying Goguen's paper Types as theories [1].
Below are two examples coded in CafeOBJ (any other algebraic specification
language would do).
Based on Goguen's paper, are the following true?

1) Subsort inheritance provides a classification of values, every value of
the sub-sort is a value of the super-sort.(MONOID1)

2) Module import inheritance provides classification of models, each model
of the class of models of the importing module contains a model of the
imported module.(MONOID2)

My intention is that MONOID1 illustrates 1) and 2) MONOID2 illustrates 2).
Assumptions

the CafeOBJ module is the software realization of a theory

loose semantics, so any model of TRIV will do

the term type is synonym for sort

the < symbol indicates subsort

a monoid is associative and has a  neutral element.

mod* MONOID1 {
[  Monoid < Elt ]
-- Signature in terms of super type
op e : -> Elt
op _._ : Elt Elt -> Elt
-- equations in terms of subtype
vars A B C : Group
eq A . e = A .
eq e . A = A .
eq A . (B . C) = ((A . B) . C) .
}

mod* MONOID2 {
--
-- The TRIV theory represented by the CafeOBJ
-- built in loose theory TRIV which has Elt as its principal sort and no
operations.
-- I used protecting mode for import, perhaps it should be extending?
pr(TRIV)
op e : -> Elt
op _._ : Elt Elt -> Elt
vars A B C : Elt
eq A . e = A .
eq e . A = A .
eq A . (B . C) = ((A . B) . C) . -- Associativity could be specified as a
property
}

Regards, Pat

[1]Goguen, J. (1991). Types as Theories. Topology and Category in Computer
Science. G. M. Reed, A. W. Roscoe and R. F. Wachter, Oxford University
Press: 357-390.
http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.16.2241

--

This email originated from DIT. If you received this email in error, please
delete it from your system. Please note that if you are not the named
addressee, disclosing, copying, distributing or taking any action based on
the contents of this email or attachments is prohibited. www.dit.ie

Is ó ITBÁC a tháinig an ríomhphost seo. Má fuair tú an ríomhphost seo trí
earráid, scrios de do chóras é le do thoil. Tabhair ar aird, mura tú an
seolaí ainmnithe, go bhfuil dianchosc ar aon nochtadh, aon chóipeáil, aon
dáileadh nó ar aon ghníomh a dhéanfar bunaithe ar an ábhar atá sa
ríomhphost nó sna hiatáin seo. www.dit.ie

Tá ITBÁC ag aistriú go Gráinseach Ghormáin – DIT is on the move to
Grangegorman <http://www.dit.ie/grangegorman>
```