Computational Duality and the Sequent Calculus

Computational Duality and the Sequent Calculus

Computational duality and the sequent calculus Paul Downen University of Oregon [email protected] Abstract totally different form, yet the two are still strongly related through The correspondence between proving theorems and writing pro- their mutual opposition. Duality appears in proof theory: “true” grams, known as the Curry-Howard isomorphism or the proofs-as- and “false” are dual, “and” and “or” are dual. Duality appears in programs paradigm, has spurred the development of new tools like category theory: the opposite of a category is found by reversing its proof assistants, new fields like certified programming, and new ad- arrows, sums naturally arise as the dual of products. However, even vanced type features like dependent types. The isomorphism gives though the theory of programming languages is closely connected us a correspondence between Gentzen’s natural deduction, a system to logic and categories, this kind of duality does not appear to for formalizing common mathematical reasoning, and Church’s λ- arise so readily in the practice of programming. For example, sum calculus, one of the first models of computation and the foundation types (disjoint unions) and pair types (structures) are related to for functional programming languages. However, concepts found dual concepts in logic and category theory. But in the realm of in modern programming, such as the provision of computational programming languages, the duality between these two concepts effects, combination of different programming paradigms and eval- is not readily apparent, and languages typically present the two as uation strategies, and definition of infinite objects still lack a strong unrelated features and often with different levels of expressiveness. foundation. The situation is even worse for more complicated language fea- In the hopes of gaining a better understanding of these issues, tures, where we have two concepts connected by duality that are we will look at an alternate form of logic, called the sequent calcu- both important in the theory and practice of programming, but lus, through the Curry-Howard lens. Doing so leads us to a method one is well understood while the other is enigmatic and under- of computation that heavily emphasizes the concept of duality and developed. In the case of recursion and looping, inductive data types (like lists and trees of arbitrary, but finite, size) are known the interaction between opposites — production interacts with con- 1 sumption; construction interacts with deconstruction. The symme- to be dual to co-inductive infinite processes (like streams of input try of this framework naturally explains more complicated features or servers that are indefinitely available) [58]. However, whereas of programming languages through relatively familiar concepts — the programming languages behind proof assistants like Coq [67] binding a value to a variable is dual to manipulation over the flow of have a sophisticated notion of induction, a lack of understanding control in a program; case analysis over data structures in the func- about the computational foundations of co-induction is problem- tional paradigm is dual to dynamic dispatch in the object-oriented atic. McBride [107] notes how the poor foundation for the compu- paradigm. tational interpretation of co-induction is a road block for the goal In this report, we survey the background of the connections be- of program verification and correctness: tween proofs and programs along with more modern advances. We We are obsessed with foundations partly because we are begin by reviewing the traditional form of the Curry-Howard iso- aware of a number of significant foundational problems that morphism that connect proof theory, category theory, and type the- we’ve got to get right before we can do anything realis- ory, and has roots in the beginnings of computer science. We intro- tic. The thing I would think of in particular in that respect duce the sequent calculus as an alternative form of logic, and show is co-induction and reasoning about co-recursive processes. how the Curry-Howard isomorphism still applies and presents a That’s currently, in all major implementations of type the- different basis for expressing computation. We then show how the ory, a disaster. And if we’re going to talk about real systems, fundamental dilemma in the sequent calculus gives rise to a dual- we’ve got to actually have something sensible to say about ity between evaluation strategies: strict languages are dual to lazy that. languages. Next, we discuss concepts that were developed in the setting of proof search, polarization and focalization, which give Not only is this mismatch between the foundations of the two a foundation for data structures and pattern matching in program- features aesthetically unpleasing, but it has real consequences on ming languages. Taking a step back, we give a retrospective look at the application of theory for solving practical problems. Perhaps the history of these developments, and illustrate a generalized the- the reason for this disparity and disconnect between related features ory that unifies the different systems for the sequent calculus and is a symptom of the fact that they are not considered with the right more closely matches actual programming languages. Finally, we frame of mind. consider the long road ahead for using the sequent calculus as a Our main philosophy for approaching these questions is known basis for understanding programming, and discuss various future as the Curry-Howard isomorphism [25, 30, 65] or proofs-as- directions remaining in this line of work. programs paradigm. The Curry-Howard isomorphism reveals a deep and profound connection between three different fields of study — logic, category theory, and programming languages — 1. Introduction where quite literally mathematical proofs are algorithmic pro- As Alcmaeon (510BC) once said, most things come in pairs: left and right, even and odd, true and false, good and bad. Duality is a 1 In general, adding the prefix “co-” to a term or concept means “the dual of guiding force that reveals the existence of a counter entity with a that thing.” 1 2014/1/23 grams. The canonical example of the isomorphism is the corre- false. This problem, and its negative answer, prompted for a rigor- spondence between Gentzen’s natural deduction [47], a system ous definition of “effectively computable” from Church [20], Tur- for formalizing common mathematical reasoning, and Church’s ing [110], and Godel¨ [55]. Later on, a much deeper connection be- λ-calculus [19], one of the first models of computation and the tween models of computation and formalized logic was indepen- foundation for functional programming languages. However, the dently discovered many times [25, 30, 65]. The most typical form λ-calculus not an ideal setting for studying duality in computation. of this connection, now known as the Curry-Howard isomorphism, Dualities that are simple in other settings, like the De Morgan du- gives a structural isomorphism between Church’s λ-calculus [19], a als in logic or products and sums in category theory, are far from system for computing with functions, and Gentzen’s natural deduc- obvious in the λ-calculus. The problem is related to the lack of tion [47], a system for formalizing mathematical logic and reason- symmetry in natural deduction: in natural deduction all the empha- ing. Additionally, this correspondence also includes an algebraic sis is on concluding true statements and in the λ-calculus all the structure known as cartesian closed categories [77]. To illustrate emphasis is on producing results. the connection between logic, programming, and categories, we In contrast, the sequent calculus, introduced by Gentzen [47] will review the three systems and show how they reveal core con- simultaneously with natural deduction, is a system logic about du- cepts in different ways. In particular, we will see how two princi- alities. In these formal systems of logic, equal attention is given to ples important for characterizing the meaning of various structures, falsity and truth, to assumptions and conclusions, such that there which we will call β and η, arise independently in each field of is perfect symmetry. These symmetries are even more apparent in study. the related system of linear logic by Girard [51]. When interpreted as a programming language, the sequent calculus reveals hidden 2.1 Logic dualities in programming — input and output, production and con- In 1935, Gentzen [47] formalized an intuitive model of logical sumption, construction and deconstruction, structure and pattern — reasoning called natural deduction, as it aimed to symbolically and makes them a prominent part of the computational model. Fun- model the “natural” way that mathematicians reason about proofs. damentally, the sequent calculus expresses computation as an inter- A proof in natural deduction is a tree-like structure made up of action between two opposed entities: a producer which is represen- several inferences: tative of a program that creates information, and a consumer which . is representative of an environment or context that observes infor- . mation. Computation then occurs as a protocol of communication H1 H2 ::: Hn that allows a producer and consumer to speak to one another, and J as a negotiation for resolving conflicts between the two. This two- party, protocol-based style of computation lends itself to naturally where we conclude the deduction J from proofs of the premises describe a lower-level view of computation than expressed by the H1;H2;:::;H3. The conclusion J and premises Hi are all judg- λ-calculus. In particular, programs in the sequent calculus can also ments that make statement about logical propositions, such as “0 be seen as configurations of an abstract machine, in which the eval- is greater than 1.” For example, if we let A; B; C; : : : range over uation context is reified as a syntactic object that may be directly the set of propositions, then we may make the basic judgment that manipulated.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    47 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us