Nicolas M. Thiéry et al.
Tetrapod: Modular Knowledge workshop
FLoC 2018, Oxford, July 13th of 2018
Over the last decades, a huge amount of computational software was developed for pure mathematics, in particular to support research and education. As for any complex ecosystem of software components, the ability to compose them has a multiplier effect on the expressive power, flexibility, and range of applications.
The purpose of this session is to share experience on the many barriers to composability in computational mathematics, and how they are being tackled. Of particular interest will be the exploitation of knowledge to leverage some of the barriers. feedback from neighbor fields (proofs, data, knowledge) will be most welcome.
This document, hosted on: https://hackmd.io/IZESWGzKSOCKJiC_tIP3pw, benefited from edits and comments from the participants of the workshop, including:
For the sake of simplicity, we will mostly focus on two aspects of composability: the ability to transfer data and run procedures across “systems” (two different software, two instances of the same software on different machines, two libraries within a system, …).
Goal: Transfer an object O from system A
to system B
Requirements:
A communication channel: shared memory, disk, pipe, (web)socket, …
A communication protocol
Serialization / Deserialization: conversion to/from a string of bytes
A format specification; e.g. XML (syntax) + OpenMath content dictionary (semantic)
Format conversion
DihedralGroup(4)
<-> DihedralGroup(8)
Idealy: applying a theory morphism to guarantee semantic preservation
B
request the computation f(a,b,c)
in A
a
,b
,c
to A
, receive back the resultf
in A
?Adapting the API in B to the API in A: Size(A)
<-> A.cardinality()
Idealy: applying a theory morphism to guarantee semantic preservation
Many kinds of objects:
E.g. thousands in Sage, compared to “matrices of floats” in Matlab
Many data representations, with very different algorithmic complexity
E.g. for polynomials: sparse, dense, recursive, straight line program, evaluation, …
Objects at different levels of abstraction
Few core concepts
addition, multiplication commutativity
… but many interesting ways to combine them:
Groups, Fields, graded commutative algebras, …
Many interactions across different areas of mathematics
Hey, that’s the point of maths!
A large variety of use cases
speed maniacs, flexibility fans, composability devouts
We can afford not to be completely formal; best effort is usually ok
Come on, we are in 2018!
Tight man power resources
Mastering math and computer science
We can’t afford to not reimplement them:
learn from one’s mistakes, benefit from technology advances
Systems written in different languages / idioms
C, C++, Python 2/3, Java, Javascript, Julia, GAP, Singular, Macaulay, Maple, Mathematica, MuPAD, Magma, Axiom/Aldor, Haskell, ML, Agda, …
Systems written using different frameworks / API
Packaging barriers
Tendency for large old systems: 10-30 years, $10^6$ lines of code
Specialized projects – often with a dedication to speed – make efforts to be developed as low-level libraries (e.g. C, C++).
Large systems make efforts to be usable as libraries and not just standalone systems. Typically enabling low-level calls at the C level for fine-grained interactions.
Modern languages make it easier to call libraries written in other languages (e.g. C, C++).
A not so successful attempt: OpenMath
A tentative reboot with OpenDreamKit’s Math-in-the-Middle approach
How to foster a sustainable and agile ecosystem where (sub)components have their own life cycle, explore new approaches, compete, and happily die when no more relevant.
What other barriers do you identify in Computational Math?
How do the barriers differ from other areas
Other case studies? solutions? approaches?
After twenty years, little adoption
A central math ontology
Formalize each systems by aligning to the central ontology
Barrier: compose building blocks A1
and A2
into modular generic code B
: f(a1, a2)
Requirements: uniform modular API + method resolution mechanism
Remember: few core concepts, hundreds of interesting combinations
Approaches:
Axiom, MuPAD: OOP with large hierarchies of abstract classes (categories)
Author: James B. Mitchel et al.
A
from a system B
written in a different languageProblem
Use funtionalities from a system A
in a system B
written in a different language
B.cardinality() -> Size(A)
attached to the category of setsB.conjugacy_classes() -> ConjugacyClasses(A)
attached to the category of groups