From Curry to Haskell Syntactical Insights at the Confluence of Logic, Algebra and Programming

From Curry to Haskell Syntactical Insights at the Confluence of Logic, Algebra and Programming

From Curry to Haskell Syntactical insights at the confluence of logic, algebra and programming Felice Cardone Dipartimento di Informatica Universit`adi Torino 16 March 2016 Felice Cardone From Curry to Haskell Curry's achievements Curry's timeline 1927 Invention of combinators (I; W; B; C) 1930 PhD in G¨ottingenunder Hilbert, birth of combinatory logic 1934 Theory of functionality; \propositions as types" 1939 Outlines of a Formalist Philosophy of Mathematics 1942 Curry's paradox 1950 Theory of formal deducibility 1958 (with R. Feys) Combinatory Logic I Haskell Brooks Curry (1920) 1972 (with J. R. Hindley and J. P. Seldin) Combinatory Logic II Felice Cardone From Curry to Haskell Overview Curry's contribution to computer science is mostly identified with outcomes of the theory of combinators I the lazy functional programming language Haskell I implementation of functional programming languages via combinator reduction machines I types and the propositions as types analogy In this talk I focus on neglected aspects of Curry's work: formal systems and syntactic structure and their influence on programming Felice Cardone From Curry to Haskell Plan Theory of meaning Dialogue games Formal systems Constructions Semiotics Lorenzen Abstract syntax Calculi Inversion principle Curry Admissible rules Haskell Structural induction Free structures McCarthy Burstall Landin Programming Felice Cardone From Curry to Haskell Plan Theory of meaning Dialogue games Formal systems Constructions Semiotics Lorenzen Abstract syntax Calculi Inversion principle Curry Admissible rules Haskell Structural induction Free structures McCarthy Burstall Landin Programming Felice Cardone From Curry to Haskell Formal systems Felice Cardone From Curry to Haskell Formal systems: example [Curry, 1949] We start from the alphabet with three symbols fa; b; cg. The expressions are the finite sequences of symbols. We single out classes of expressions by means of rules: I Sams: X sam a sam Xb sam I Tettles: X sam Y sam XcY tettle I Tantets: XcY tantet aca tantet XbcYb tantet Felice Cardone From Curry to Haskell Special types of formal systems A basic kind of formal system is built from: I Obs, formed from a set Ω of operations and atoms. Obs constructed by different processes are distinct. I Elementary statements, formed by applying predicates (of degree n) to n obs. I Axioms, which are statements, and rules for inferring statement from other statements. Felice Cardone From Curry to Haskell Sams, tettles and tantets as an ob system I Sams: X is a sam 0 is a sam σ(X ) is a sam I Tettles: X is a sam Y is a sam X = Y is a tettle I Tantets: X = Y is a tantet 0 = 0 is a tantet σ(X ) = σ(Y ) is a tantet Felice Cardone From Curry to Haskell The semiotics of formal systems I A formal system is an activity carried out in the language being used for communication (U-language), which is extended by nouns and verbs used for denoting obs and sentences (the A-language). I The construction of a formal system is an elaborate semiotic process: Curry described in detail the linguistic aspects of formal systems. Example: the theory of grammatical categories, based on the theory of functionality from combinatory logic. I The semiotic parts of Curry and Feys (1958) { together with Carnap's Introduction to Semantics (1948) { influenced the linguistic approach to programming language theory, in particular Saul Gorn. Felice Cardone From Curry to Haskell Example: an ob the holes are for the attachment of strings from the constituents A; B while the rings are for attachment of a string connecting to an operation when the term A ◦ B or A0 is itself a constituent of a more complex term (Curry, 1941) Felice Cardone From Curry to Haskell Example: an ob Alexander Calder, Mobile (c. 1932) Tate Modern, London Felice Cardone From Curry to Haskell Example: a formal system Computations as proofs in structured operational semantics (Plotkin, 1981) I Obs: built from atoms >; ? by an operation _ of degree 2 I Elementary statements: X ; Y for obs X ; Y I Axioms and rules: > ; > ? ; ? X ; > X ; ? Y ; Z X _ Y ; > X _ Y ; Z Felice Cardone From Curry to Haskell Example: a formal system Computations as proofs in structured operational semantics (Plotkin, 1981) I Obs: built from atoms >; ? by an operation _ of degree 2 I Elementary statements: X ; Y for obs X ; Y I Axioms and rules: > ; > ? ; ? X ; > X ; ? Y ; Z X _ Y ; > X _ Y ; Z Felice Cardone From Curry to Haskell > ; > ? ; ? > _ ? ; > ? ; ?? ; ? ?_? ; ? ?_ (> _ ?) ; > Sample computation (?_?) _ (?_ (> _ ?)) ; > Felice Cardone From Curry to Haskell > ; > ? ; ? ? ; ? ? ; ? > _ ? ; > ?_ (> _ ?) ; > Sample computation ?_? ; ? (?_?) _ (?_ (> _ ?)) ; > Felice Cardone From Curry to Haskell > ; > ? ; ? ? ; ? > _ ? ; > ?_ (> _ ?) ; > Sample computation ? ; ? ?_? ; ? (?_?) _ (?_ (> _ ?)) ; > Felice Cardone From Curry to Haskell > ; > ? ; ? > _ ? ; > ?_ (> _ ?) ; > Sample computation ? ; ?? ; ? ?_? ; ? (?_?) _ (?_ (> _ ?)) ; > Felice Cardone From Curry to Haskell > ; > ? ; ? > _ ? ; > Sample computation ? ; ?? ; ? ?_? ; ? ?_ (> _ ?) ; > (?_?) _ (?_ (> _ ?)) ; > Felice Cardone From Curry to Haskell > ; > > _ ? ; > Sample computation ? ; ?? ; ? ? ; ? ?_? ; ? ?_ (> _ ?) ; > (?_?) _ (?_ (> _ ?)) ; > Felice Cardone From Curry to Haskell > ; > Sample computation ? ; ?? ; ? ? ; ? > _ ? ; > ?_? ; ? ?_ (> _ ?) ; > (?_?) _ (?_ (> _ ?)) ; > Felice Cardone From Curry to Haskell Sample computation > ; > ? ; ?? ; ? ? ; ? > _ ? ; > ?_? ; ? ?_ (> _ ?) ; > (?_?) _ (?_ (> _ ?)) ; > Felice Cardone From Curry to Haskell Variations on a theme of Curry Felice Cardone From Curry to Haskell Obs and their formation In an ob system, an operation ! (of degree n) forms an ob b from n obs a1;:::; an, denoted by !(a1;:::; an) the genesis of such a b from !; a1;:::; an will also be referred to as a formation (of b), and for this formation ! will be called the operation, a1;:::; an the arguments, and b the closure (Curry, 1952) Felice Cardone From Curry to Haskell An aside: why is this interesting? I Distinction between act and product (Twardowski, Actions and Products, 1912) I Examples: construction, judgement, proof, organization,. I The distinction has been refined for judgements by Sundholm and Martin-L¨ofto that between act, product, and content. For certain kinds of acts (e.g., proof) we also have their trace. I These distinctions are useful for a full understanding of the constructive explanations of the logical constants. Felice Cardone From Curry to Haskell The anatomy of an ob We distinguish: I the formation of the ob b = !(a1;:::; an)(act), denoted by h! · a1;:::; ani I the closure of a formation ξ (product) denoted by ξ. Therefore !(a1;:::; an) ≡ h! · a1;:::; ani Felice Cardone From Curry to Haskell The anatomy of an ob We introduce \types": I Ω(X ) is the type of obs built from elements of X using operations in Ω I Ω is the type of operations I Ω(X ) is the type of formations with arguments in X with rules (simplified) ! :Ω a : Ω(X ) ξ : Ω(Ω(X )) h! · ai : Ω(Ω(X )) ξ : Ω(X ) Then, for example: ! :Ω a : Ω(X ) h! · ai : Ω(Ω(X )) !(a) ≡ h! · ai : Ω(X ) Felice Cardone From Curry to Haskell The standard algebraic approach I Ω(X ) is the set of terms (= trees) over \variables" X and operations Ω - I There is a natural coercion ηX : X Ω(X ) mapping each x 2 X to a one-node tree hxi I There is a natural composition as substitution of trees - µX : Ω(Ω(X )) Ω(X ) I Ω(·): Set - Set is a monad Felice Cardone From Curry to Haskell Composition as substitution Here x; y 2 Ω(fv; wg); a 2 Ω(fx; yg): a x x y y v v w Felice Cardone From Curry to Haskell Composition as substitution Here x; y 2 Ω(fv; wg); a 2 Ω(fx; yg): a x x y y v v w a Then µfv;wg(a) 2 Ω(fv; wg) v v w Felice Cardone From Curry to Haskell The standard algebraic approach | Take 2 I Given a signature Ω and f : X - Y , define Ω(X ) = fh! · ai j ! 2 Ω; a 2 X g Ω(f )(h! · ai) = h! · f (a)i I An Ω-algebra is a set A with a mapping δ : Ω(A) - A 0 I An Ω-homomorphism is a mapping h : A - A such that δ Ω(A) - A Ω(h) h ? ? δ0 Ω(A0) - A0 Felice Cardone From Curry to Haskell The standard algebraic approach | Take 2 - Then Ω(X ) becomes an Ω-algebra τX : Ω(Ω(X )) Ω(X ) where τX (h! · ai) = h! · ai = !(a) I Ω(X ) is the free Ω-algebra over X I Ω(·) is the free monad generated by Ω Felice Cardone From Curry to Haskell I Lorenzen Calculi (Einf¨uhrungin die Operative Logik und Mathematik, 1955) with rules of the form: A1 ::: An A (originally written as A1;:::; An ! A) where Ai ; A are strings of atomic figures from a finite alphabet and variables Variants of formal systems I Post Canonical and normal systems (1920s) as a model of the process of generation of sets of \theorems" formal grammar (Harris and Chomsky, early 1950s) Felice Cardone From Curry to Haskell Variants of formal systems I Post Canonical and normal systems (1920s) as a model of the process of generation of sets of \theorems" formal grammar (Harris and Chomsky, early 1950s) I Lorenzen Calculi (Einf¨uhrungin die Operative Logik und Mathematik, 1955) with rules of the form: A1 ::: An A (originally written as A1;:::; An ! A) where Ai ; A are strings of atomic figures from a finite alphabet and variables Felice Cardone From Curry to Haskell Calculi: an example I Atomic figures: +; o I Variables: X I Rules( R1) X ! Xo,(R2) X ! +X + A derivation: + +o +oo + + oo+ + + oo + o Felice Cardone From Curry to Haskell Theory of meaning Felice Cardone From Curry to Haskell Dialogue games Lorenzen Inversion principle Admissible rules Felice Cardone From Curry to Haskell Admissible rules I Atomic figures: +; o I Variables: X I Rules( R1) X ! Xo,(R2) X ! +X + Admissibility A rule R is admissible relative to a calculus K if any derivation obtained by the use of R can be constructively transformed into one obtained without such use (this definition of admissibility is due to Curry!) Felice Cardone From Curry to Haskell Admissible rules I Atomic figures: +; o I Variables: X I Rules( R1) X ! Xo,(R2) X ! +X + The rule X ! ++X is admissible: how could X have been derived? For example .

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    67 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