A Synopsis of Morphoid Type Theory

Morphoid type theory (MTT) is a typetheoretic foundation for mathematics supporting the concept of isomorphism and the substitution of isomorphics. Unlike homotopy type theory (HoTT), which also supports isomorphism, morphoid type theory is a direct extension of classical predicate calculus and avoids the intuitionistic constructs of propositionsas-types, path induction and squashing. Although HoTT is capable of supporting classical inference, MTT’s thoroughly classical treatment is expected to be more comfortable for those who take a Platonic or realist approach to the practice of mathematics.


Introduction
The central issue in both homotopy type theory (HoTT-Authors, 2013) and morphoid type theory (McAllester, 2014) is isomorphism. The notion of isomorphism in mathematics seems related to the notion of an application programming interface (API) in computer software. An API specifies what information and behavior an object provides. Two different implementations can produce identical behavior when interaction is restricted to that allowed by the API. For example, textbooks on real analysis typically start from axioms involving multiplication, addition, and ordering. Addition, multiplication and ordering define an abstract interfacethe well formed statements about real numbers are limited to those that can be defined in terms of the operations of the interface. We can implement real numbers in different ways -as Dedekind cuts or Cauchy sequences. However, these different implementations provide identical behavior as viewed through the interface -the different implementations are isomorphic as ordered fields. The axioms of real analysis specify the reals up to isomorphism for ordered fields. Peano's axioms (the second order version) similarly specify the structure of the natural numbers up to isomorphism.
The general notion of isomorphism is best illustrated by considering dependent pair types. Here we will write a dependent pair type as PairOf (x : σ, y : τ [x]) where the instances of this type are the pairs Pair(x, y) where x is an instance of the type σ and y is an instance of τ [x]. The type of directed graphs can be written as PairOf (N : type, P : (N × N ) → Bool) where N is a type representing the set of nodes of the graph and P is a binary predicate on the nodes giving the edge relation. Two directed graphs Pair(N , P ) and Pair(M, Q) are isomorphic if there exists a bijection from N to M that carries P to Q. Some bijections will carry P to Q while others will not. Two pairs Pair(x, y) and Pair(u, w) of a general dependent pair type PairOf (x : σ, y : τ [x]) are isomorphic if there is a σ-isomorphism from x to u that carries y to w. Some σ-isomorphisms from x to u will carry y to w while others will not. This implies that to define isomorphism at general dependent pairs types we need that for any type σ, and for any two isomorphic values x and u of type σ, we can define the full set of σ-isomorphisms from x to u. An interesting special case is the full set of σ-isomorphisms from x to x. This is the symmetry group of x.
Both Homotopy type theory (HoTT) and morphoid type theory (MTT) are intended as typetheoretic foundations for mathematics supporting a concept of isomorphism. HoTT is an extension of constructive logic while MTT is an extension of classical predicate calculus. More specifically, HoTT is a version of Martin Löf type theory (Martin-Löf, 1971;Coquand and Huet, 1988;Sambin and Smith, 1998) extended to includes Voevodsky's univalence axiom (HoTT-Authors, 2013). Martin-Löf type theory involves propositions-astypes and path induction, neither of which are used in MTT. To accommodate classical (nonconstructive) inference, HoTT can be extended with a version of the law of the excluded middle. However, even in the classical version propositions continue to be represented as types rather than Boolean-valued expressions. To accommodate classical inference HoTT also includes squashing -a technicality required to allow propositions-types to be treated more like Boolean-valued expressions. In MTT all propositions are Boolean-valued and there is no need for squashing.
Perhaps the most significant difference between HoTT and MTT involves the abstraction barrier imposed on types. In MTT two types are typeisomorphic if there exists a bijection between them. In MTT two types with the same cardinality (number of equivalence classes) cannot be distinguished by well-typed predicates on types. In HoTT, however, types with the same cardinality can still be distinguished by well-typed predicates. In HoTT two types are equivalent only when they have the same higher-order groupoid structure. For example, two graphs fail to be isomorphic unless the node types have the same higher order groupoid structure. This can be interpreted as implementation details of a type leaking from the abstraction barrier on types. This leakage interpretation is discussed more explicitly in section 3.
HoTT allows one to block the leakage of type implementations by squashing types to "sets". A set is a type whose internal groupoid structure is effectively suppressed. One can construct the type of topological space whose point types are sets. In this case we get the familiar notion isomorphism (homeomorphism) where two topological spaces are homeomorphic if there is any bijection between their points that identifies their open sets. We can then define the groupoid of topological spaces to be the category consisting of the topological spaces and the homeomorphisms between them. This is the "first order" groupoid of topological spaces. If we take the point types of topological spaces to be first order groupoids rather than sets, and restrict the point bijections to functors, we get the second order groupoid of topological spaces. We can then define a third order groupoid and so on. In HoTT we can even have ω-order groupoids.
In MTT the internal structure of types is approached in a different way. In MTT natural mappings are distinguished from general functions. For example, there is an isomorphism (a linear bijection) from a finite dimensional vector space to its dual. However, there is no natural isomorphism. Although not covered in this synopsis, MTT takes a function to be natural if it can be written as a lambda expression. Lambda expressions (natural functions) have commutation properties not shared by general functions. Two types σ and τ are cryptomorphic (in the sense of Birkoff or Rota) if there exists a pair of natural functions (lambda expressions) f : σ → τ and g : τ → σ such that f • g and g • f are both identity functions (viewed as functions on the isomorphism classes of σ and τ respectively). MTT does not attempt to handle higher order groupoid structure.
This synopsis of MTT is preliminary and many of the features described here go beyond the features covered by soundness proofs in version 4 of (McAllester, 2014). This synopsis should be viewed as a plan, or program, for the next version of (McAllester, 2014).

The Core Rules of Morphoid Type Theory
Morphoid type theory starts from the syntax and semantics of classical predicate calculus. In sorted first order logic every term has a sort and each function symbol f specifies the sorts of its arguments and the sort of its value. We write f : σ 1 × · · · × σ n → τ to indicate that f is a function that takes n arguments of sort σ 1 , . . ., σ n respectively and which produces a value of sort τ . The syntax of sorted first order logic can be defined by the following grammar where function and predicate applications must sat- Here type 0 , type 1 , type 2 , . . . are distinct constants and is a constant denoting the empty context. The first two rules of the first row allow us to derive ; α : type j α : type j thereby declaring primitive types. We can then declare additional symbols such as c : α or P : α → Bool. The requirement of j < i in the first rule is needed to avoid Russel's paradox. The second rule of the second row allows Boolean assumptions to be introduced into contexts.
isfy the sort constraints associated with the function and predicate symbols.
Note that in the above grammar the equality symbol = σ is subscripted with a sort σ to which it applies. The labeling of equality with sorts is important for the treatment of isomorphism. Given this basic grammar of terms and formulas it is standard to introduce the following abbreviations.
We now replace the word "sort" with the word "type". To define the set of well formed terms and formulas we need to specify primitive types and a set of constant and function symbols each with specified argument and value types. In formal type systems this is done with symbol declarations. We write Σ t : σ to indicate that the symbol declarations in Σ imply that t is a well-formed expression of type σ. For example we have the following.
An expression of the form Σ Θ is called a sequent where Σ is called the context and Θ is called the judgement. The sequent Σ Θ says that judgement Θ holds in context Σ. We allow a context to contain both symbol declarations and Boolean assumptions. For example we have In higher order predicate calculus the type system is extended to include not only primitive types but also function types and we can write, for example, P (f ) where we have f : σ → τ and P : (σ → τ ) → Bool. In the higher order case we can use the following standard abbreviations due to Curry.
This extends in the obvious way to abbreviations of the form σ 1 × · · · × σ n → τ . Without loss of generality we then need consider only single argument functions. Figure 1 gives a set of inference rules for forming the expressions of higher order predicate calculus. Each rule allows for the derivation of the sequent below the line provided that the sequents above the line are derivable. A rule with no antecedents is written as a single derivable sequent. Figure 2 gives inference rules for predicate calculus including definite descriptions of the form The(x : σ, Φ[x]) (Hilbert's ι-operator) and rules representing the axiom of extensionality and the axiom of choice. Figure 3 gives inference rules for dependent pair types, subtypes, and existential types. A dependent pair type has the form PairOf (x : σ, y : τ [x]) and is the type whose instances are the pairs Pair(x, y) where x is an instance of σ and y is an instance of τ [x]. A subtype expression has the form is a Boolean expression. This expression denotes the type whose elements are those elements x in σ such that Φ[x] holds. We let PairOf (x : σ, y : . = in the rules for pair types. We can have two distinct but isomorphic things -we can have a = σ b with a . = b. It is important that absolute equalities are not Boolean expressions -otherwise the substitution of isomorphics would yield that a = σ b implies a .
The type of groups, abbreviated Group, can then be written as where Φ[α, f ] states the group axioms. For example, the group axiom that an identity element exists can be written as Here the open sets of the topological space are represented by predicates. Note that the types Group and TOP are closed type expressions -these type expressions do not contain free variables. We should note that subtypes are literally subsets and, for example, we can derive the sequent G : AbelianGroup G : Group.
Existential types have the form ∃x : σ τ [x] where τ [x] is a type expression. This is the type whose members are those values v such that there exists a value u : σ such that v is in the type τ [u]. Existential types allow one to express the type of permutation groups as distinct from the type of groups. A permutation group is a group whose group elements are permutations of an underlying set. The type of permutation groups, denoted PermGroup, has the form ∃α : type ∃P : (Permutation[α] → Bool) τ [α, P ].
Here the predicate P represents a set of permutations on the type α and τ [α, P ] is a pair type specifying a group whose elements are the permutations of α satisfying P and where the group operation is functional composition. Again note that PermGroup is a closed type expression. The rules for existential types then allow the derivation of the sequent G : PermGroup G : Group.
We also have the representation theorem However, the isomorphism relations = Group and = PermGroup are different. Two permutation groups can be group-isomorphic while operating on underlying sets of different sizes. Such permutation groups are group-isomorphic but not permutationgroup-isomorphic.

Observational Equivalence
Our intention now is to interpret an equation such as G = Group H as stating that G and H are groupisomorphic. The significance of isomorphism arises from the substitution rule of figure 2. The rules of equality -reflexivity, symetry, transitivity and substitution -support the congruence closure algorithm for reasoning about equality. The ability to apply congruence closure to the isomorphism relation should be of great value in automated reasoning. 1 The core rules define a notion of "observational equivalence" -two closed terms a and b of type σ are observationally σ-equivalent if for every predicate expression P : σ → Bool (typable by the core rules) we have P (a) if and only if P (b). We want = σ to be as course as possible subject to the constraint that a = σ b implies that a and b are observationally σ-equivalent.
The desire to be as coarse as possible while staying within observational equivalence motivates the interpretation of type-isomorphism as samecardinality. Predicates on types that are well formed 1 It is tempting to suggest that congruence closure is of great value in subconscious human thought. under the core rules cannot distinguish between types of the same cardinality.

Morphoids
The semantics of morphoid type theory is developed within a meta-theory of Platonic mathematics -we adopt the position that it is meaningful to discuss actual (Platonic) mathematical objects.
The semantics of morphoid type theory is based on a class of values called morphoids. A rigorous definition of a class of morphoids for a subset of the language can be found in (McAllester, 2014) version 4. Here we give some intuition for morphoids and state some formal properties.
Morphoids are built from "points". Morphoid points are analogous to the ur-elements of some early versions of set theory. General morphoids are built from points in a manner analogous to the way that sets are constructed from ur-elements.
A morphoid point has the form Point(i, j) where i is called the left index and j is the right index of the point. We define the operations of Left, Right, inverse and composition on points as follows.
Here we have that x • y is defined only in the case where Right(x) = Left(y).
Every morphoid value is either a Boolean value (True or False), a point, a morphoid type, a pair of morphoid values, or a morphoid function. The operations of Left, Right, inverse and composition are defined recursively on all morphoid values where x • y is defined when Right(x) = Left(y). We consider each kind of value in turn.
A morphoid type is a set σ of morphoid values satisfying certain properties defined in (McAllester, 2014). A fundamental property is the following.
The following equations define the morphoid operations on types where σ • τ is defined only when Point(a, a), Point(a,ã), Point(ã, a), Point(ã,ã), A morphoid type whose elements are points is called a point type. Figure 4 gives examples of morphoid point types and examples of the morphoid operations applied to point types. The morphoid closure condition (M) implies that for any morphoid type σ we have that Left(σ) and Right(σ) are equivalence relations (see figure 4). Note that morphoid types are not required to be closed under inverse. This allows types to be directed from left to right. Again consider the types in figure 4. Furthermore, property (M) implies that any morphoid type σ defines a bijection between the equivalence classes of Left(σ) and the equivalence classes of Right(σ).
A morphoid pair is simply a pair of morphoids. The morphoid operations on pairs are defined as follows where again x • y is defined only when Right(x) = Left(y).
Left(Pair(x, y)) = Pair(Left(x), Left(y)) Right(Pair(x, y)) = Pair(Right(x), Right(y)) Pair(x, y) −1 = Pair(x −1 , y −1 ) The treatment of morphoid functions involves subtleties. In this synopsis we note only that for any two morphoid types σ and τ we can define the type σ → τ such that for f ∈ σ → τ and x ∈ σ we can define the application f (x) so that we have f (x) ∈ τ . Furthermore, these definitions are such that the elements of the type σ → τ represents all functions from the equivalence classes of σ to the equivalence classes of τ . Details, including the definitions of the morphoid operations on functions, can be found in (McAllester, 2014).
It is possible to prove that morphoids satisfy the following properties where properties (G4), (G5), (G6), and (G9) apply when the compositions are defined.
(G1) For any morphoid x we have that Left(x), Right(x) and x −1 are also morphoids.
(G2) For any morphoids x and y we have that x • y is defined if and only if Right(x) = Left(y) and when x • y is defined we have that x • y is a morphoid.
Properties (G1) through (G9) state that the class of morphoids forms a groupoid under the morphoid operations. Figure 5 shows morphoid operations on graphs whose nodes are points.

Abstraction and Isomorphism
The semantic definition of isomorphism relies on an additional operation on morphoids -the operation of abstraction. As an example we consider vector spaces. In morphoid type theory an abstract vector space is one in which the vectors are points. The space R n is a vector space whose vectors are ntuples of real numbers. A tuple of real numbers is an implementation of a vector -a tuple of real numbers is not a point. However, we can define an abstraction operation such that for any morphoid value x we have that x@Point is a point. Details can be found in (McAllester, 2014).
There is an abstraction ordering on morphoids where x y if x can be converted to y by abstracting parts of x to points. For every type there is a set of maximally abstract elements of that type. The maximally abstract graphs are the graphs whose nodes are points. The maximally abstract vector spaces are those vector spaces in which the vectors are points. The maximally abstract types are the point types. For each morphoid type σ it is possible to define an abstraction operation mapping x ∈ σ to x@σ where x@σ is a maximally abstract member of σ. For example, for any morphoid type σ ∈ type i we have that σ@type i is the point type whose members are the points of the form x@Point for x ∈ σ. Details can be found in (McAllester, 2014).
The isomorphism relation x = σ y is defined to mean that x ∈ σ, y ∈ σ, and there exists z ∈ σ such that (x@σ) • z −1 • (y@σ) is defined. Condition (M) on morphoid types guarantees that this is an equivalence relation on the elements of σ.

The Semantic Value Function
The semantics of morphoid type theory is an extension of the sementics of predicate calculus. The semantics involves three concepts -variable interpretations, semantic entailment, and a semantic value function. These three concepts are defined by mutual recursion where the recursion reduces the size of the expressions involved. A variable interpretation assigns a value to each variable declared in a given context. More formally, for any wellformed context Σ we write V Σ for the set of variable interpretations consistent with declarations and Boolean assertions in Σ. We define V Σ by the following rules where this is undefined if no rule applies.
• We define V to be the set containing the empty variable interpretation.
not declared in Σ, and Σ |= τ : type i in which case V Σ; x : τ is defined to be the set of variable interpretations of the form ρ[x ← v] for ρ ∈ V Σ and v ∈ V Σ τ ρ.
A semantic entailment is written as Σ |= Θ and this holds if V Σ is defined and Θ holds under all variable interpretations in V Σ . The entailment relation Σ |= Θ holds if one of the following clauses applies.
• The entailment Σ |= e : τ holds if V Σ , V Σ e and V Σ τ are all defined and for all ρ ∈ V Σ we have that V Σ τ ρ is a morphoid type and V Σ e ρ ∈ V Σ τ ρ.
• For a Boolean expression Φ, i.e., for Σ |= Φ : • We write Σ |= e 1 . = e 2 if V Σ , V Σ e 1 and V Σ e 2 are all defined and for ρ ∈ V Σ we have that V Σ e 1 ρ and V Σ e 2 ρ are the same value.
For V Σ defined and for an expression e that is well-formed in the context Σ, we have a semantic value function V Σ e . The semantic value function V Σ e maps a variable interpretation ρ ∈ V Σ to a morphoid value V Σ e ρ. For V Σ defined, the following clauses state when V Σ e is defined and, when it is defined, define the value V Σ e ρ for ρ ∈ V Σ .
• Bool. We have that V Σ Bool ρ is the type containing the two Boolean values True and False.
• type i . We have V Σ type i ρ is the type whose members are all morphoid types in the set-theoretic universe V κ i where κ i is the ith inaccessible cardinal.
• σ → τ. If Σ |= σ : type i , and Σ |= τ : • f (e). If V Σ f and V Σ e are defined and for all ρ ∈ V Σ we have that V Σ f ρ can be ap- , a, b) Figure 6: Internalizing Isomorphism. Here iso(σ, x, y) is the type whose elements are the σ-isomorphisms from x to y. The fourth row gives the rules of iso-substition and iso-extensionality.
• π i (e). If V Σ e is defined and for all ρ ∈ V Σ we have that V Σ e ρ is a pair then V Σ π i (e) is defined with V Σ π i (e) ρ = π i (V Σ e ρ).
A fundamental property of Morphoid type theory is that if V Σ is defined then it is closed under inverse and composition -for ρ ∈ V Σ we have ρ −1 ∈ V Σ and for ρ, γ ∈ V Σ with ρ • γ defined we have (ρ • γ) ∈ V Σ . Furthermore for V Σ e defined and for ρ, γ ∈ V Σ we have and V Σ e (ρ −1 ) = (V Σ e ρ) −1 . Another fundamental property of the value function involves the abstraction ordering. The abstraction ordering can be extended to variable interpretations where we have ρ γ if ρ and γ are defined on the same set of variables and for each variable x we have ρ(x) γ(x). The value function is monotone with respect to the abstraction ordering -for ρ γ we have V Σ e ρ V Σ e γ. 7 Internalizing Isomorphism Figure 6 gives inference rules for isomorphism. Figure 7 gives rules which can be derived from the rules in figure 6. The first rule in figure 7 derives isomorphisms at types of the form PairOf(α : type i , τ [α]). We note that types Group and TOP as defined in section 2 can be written as subtypes of pair types of this form. The rule states that two objects Pair(σ, a) and Pair(τ, b) of type PairOf(α : type i , τ [α]) are isomorphic if there exists a bijection f from σ to τ which carries a to b. The two rules in the second row of figure 7 allow one to determine whether or not f carries a to b in the case where τ [α] is a "simple type" over α. To define the simple types we first introduce the notation PairOf (γ, η) as an abbreviation for PairOf (x : γ, y : η) in the case where x does not occur in η. A simple type expression γ[α] over the type variable α is then defined to be either the variable α itself, a type γ not containing α, or a type of the form PairOf (δ[α], η[α]) or δ[α] → η [α] where δ[α] and η[α] are recursively simple type expressions over α. Subtypes of pair types of the form PairOf (α : type i , γ[α]) where γ[α] is a simple type over α covers the types Group and TOP as well as many other mathematical concepts. We leave the derivation of the rules in the second row of figure 7 as a (tricky and tedious) exercise for the reader.
While the rules in figure 7 are adequate in many situations, they do not cover types such as For the general case we need the rules of figure 6.

Summary
Morphoid type theory is a type-theoretic foundation for mathematics supporting the concept of isomorphism and the substitution of isomorphics. Morphoid type theory is an extension of classical predicate calculus that avoids the use of propositions-astypes, path induction or squashing. Morphoid type theory may be more comfortable for mathemticians who take a realist or Platonic approach to the practice of mathematics.