The Formalization of Syntax-Based Mathematical Algorithms Using Quotation and Evaluation

Algorithms like those for differentiating functional expressions manipulate the syntactic structure of mathematical expressions in a mathematically meaningful way. A formalization of such an algorithm should include a specification of its computational behavior, a specification of its mathematical meaning, and a mechanism for applying the algorithm to actual expressions. Achieving these goals requires the ability to integrate reasoning about the syntax of the expressions with reasoning about what the expressions mean. A syntax framework is a mathematical structure that is an abstract model for a syntax reasoning system. It contains a mapping of expressions to syntactic values that represent the syntactic structures of the expressions; a language for reasoning about syntactic values; a quotation mechanism to refer to the syntactic value of an expression; and an evaluation mechanism to refer to the value of the expression represented by a syntactic value. We present and compare two approaches, based on instances of a syntax framework, to formalize a syntax-based mathematical algorithm in a formal theory T. In the first approach the syntactic values for the expressions manipulated by the algorithm are members of an inductive type in T, but quotation and evaluation are functions defined in the metatheory of T. In the second approach every expression in T is represented by a syntactic value, and quotation and evaluation are operators in T itself.

[1]  Simon L. Peyton Jones,et al.  Template meta-programming for Haskell , 2002, Haskell '02.

[2]  P. D. van der Walt,et al.  Reflection in Agda , 2012 .

[3]  William M. Farmer Biform Theories in Chiron , 2007, Calculemus/MKM.

[4]  Tobias Nipkow,et al.  Certifying Machine Code Safety: Shallow Versus Deep Embedding , 2004, TPHOLs.

[5]  Christoph Lüth,et al.  A Framework for Interactive Proof , 2007, Calculemus/MKM.

[6]  Jacques Malenfant,et al.  Reflection in logic, functional and object-oriented programming: a Short Comparative Study , 1995 .

[7]  William M. Farmer Chiron: A Set Theory with Types, Undefinedness, Quotation, and Evaluation , 2013, ArXiv.

[8]  J. Harrison Metatheory and Reflection in Theorem Proving: A Survey and Critique , 1995 .

[9]  R. Carnap Logische Syntax der Sprache , 1935 .

[10]  Jim Grundy,et al.  A reflective functional language for hardware design and theorem proving , 2005, Journal of Functional Programming.

[11]  Peter Koellner,et al.  On reflection principles , 2009, Ann. Pure Appl. Log..

[12]  Richard J. Boulton,et al.  Experience with Embedding Hardware Description Languages in HOL , 1992, TPCD.

[13]  Jacques Carette,et al.  MathScheme: Project Description , 2011, Calculemus/MKM.

[14]  Pierre Courtieu,et al.  Certification of Automated Termination Proofs , 2007, FroCoS.

[15]  William M. Farmer,et al.  The seven virtues of simple type theory , 2008, J. Appl. Log..

[16]  William M. Farmer,et al.  Frameworks for Reasoning about Syntax that Utilize Quotation and Evaluation , 2013, ArXiv.

[17]  Torben Mogensen Diku Eecient Self-interpretation in Lambda Calculus , 1994 .

[18]  Walid Taha,et al.  MetaML and multi-stage programming with explicit annotations , 2000, Theor. Comput. Sci..

[19]  Peter Koellner On Reection Principles , 2008 .