View of computer algebra data from Coq Vladimir Komendantsky 1 , Alexander Konovalov 1 , and Steve Linton 1 School of Computer Science University of St Andrews St Andrews, KY16 9SX, UK {vk,alexk,sal}@cs.st-andrews.ac.uk Abstract. Data representation is an important aspect of software com- position. It is often the case that different software components are pro- grammed to represent data in the ways which are the most appropriate for their problem domains. Sometimes, converting data from one repre- sentation to another is a non-trivial task. This is the case with computer algebra systems and type-theory based interactive theorem provers such as Coq. We provide some custom instrumentation inside Coq to support a computer algebra system (CAS) communication protocol known as SC- SCP. We describe general aspects of viewing OpenMath terms produced by a CAS in the calculus of Coq, as well as viewing pure Coq terms in a simpler type system that is behind OpenMath. 1 Introduction In this paper, we describe a realistic example of communication between a state- of-art interactive prover Coq [23] and a modern computer algebra system GAP (Groups, Algorithms, Programs) [11]. What makes this communication most interesting is the complexity of both systems. Indeed, Coq is a constructive sys- tem based on a variant of the predicative Calculus of Inductive and Coinductive Constructions (CIC, for short) [23]. Coq has a powerful type system featuring the universe of types, Type, but is not Turing-complete and does not allow ar- bitrary non-terminating computations since any recursive function should be defined over a decreasing measure respecting the well-founded induction princi- ple. Therefore Coq is not a “real-world” programming language since it is not in the custom of a mainstream programmer to provide termination guarantees for every program they write. On the other hand, the mathematical type system of GAP [5] originates from the object-oriented paradigm and is therefore more conventional. Besides, GAP is a real-world imperative programming language where any computation is allowed. There is a type of all objects, IsObject, but it is not predicative. Hence, instead of mapping of the type system of GAP to that of Coq, we consider a two-stage embedding: first, a partial embedding of OpenMath terms (which are presented in XML) to a simple inductive type OM of OpenMath object, and second, a translation of simply typed OpenMath objects to dependently typed objects of the mathematical hierarchy of Ssreflect [13, 12]. Already the first stage of our embedding is forgetful in GAP types and disregards