The Logical Basis of Evaluation Order and Pattern-Matching

Abstract

An old and celebrated analogy says that writing programs is like proving theorems. This analogy has been productive in both directions, but in particular has demonstrated remarkable utility in driving progress in programming languages, for example leading towards a better understanding of concepts such as abstract data types and polymorphism. One of the best known instances of the analogy actually rises to the level of an isomorphism: between Gentzen's natural deduction and Church's lambda calculus. However, as has been recognized for a while, lambda calculus fails to capture some of the important features of modern programming languages. Notably, it does not have an inherent notion of evaluation order, needed to make sense of programs with side effects. Instead, the historical descendents of lambda calculus (languages like Lisp, ML, Haskell, etc.) impose evaluation order in an ad hoc way. This thesis aims to give a fresh take on the proofs-as-programs analogy-one which better accounts for features of modern programming languages-by starting from a different logical foundation. Inspired by Andreoli's focusing proofs for linear logic, we explain how to axiomatize certain canonical forms of logical reasoning through a notion of pattern. Propositions come with an intrinsic polarity, based on whether they are defined by patterns of proof, or by patterns of refutation. Applying the analogy, we then obtain a programming language with built-in support for pattern-matching, in which evaluation order is explicitly reflected at the level of types-and hence can be controlled locally, rather than being an ad hoc, global policy decision. As we show, different forms of continuation-passing style (one of the historical tools for analyzing evaluation order) can be described in terms of different polarizations.

Open PDF

Document Details

Document Type
Technical Report
Publication Date
Apr 17, 2009
Accession Number
ADA507018

Entities

People

  • Noam Zeilberger

Organizations

  • Carnegie Mellon University

Tags

Communities of Interest

  • C4I

DTIC Thesaurus Topics

  • Artificial Intelligence
  • Birds
  • Calculus
  • Complex Variables
  • Computations
  • Computer Programming
  • Computer Science
  • Computers
  • Construction
  • Language
  • Law
  • Mathematical Logic
  • Mathematics
  • Programming Languages
  • Recursive Functions
  • Theoretical Computer Science
  • Trees (Data Structures)

Readers

  • Computational Linguistics
  • Mathematical Modeling and Probability Theory.
  • Military History of the United States in the 20th Century.