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

Total Page:16

File Type:pdf, Size:1020Kb

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 .
Recommended publications
  • Pst-Plot — Plotting Functions in “Pure” L ATEX
    pst-plot — plotting functions in “pure” LATEX Commonly, one wants to simply plot a function as a part of a LATEX document. Using some postscript tricks, you can make a graph of an arbitrary function in one variable including implicitly defined functions. The commands described on this worksheet require that the following lines appear in your document header (before \begin{document}). \usepackage{pst-plot} \usepackage{pstricks} The full pstricks manual (including pst-plot documentation) is available at:1 http://www.risc.uni-linz.ac.at/institute/systems/documentation/TeX/tex/ A good page for showing the power of what you can do with pstricks is: http://www.pstricks.de/.2 Reverse Polish Notation (postfix notation) Reverse polish notation (RPN) is a modification of polish notation which was a creation of the logician Jan Lukasiewicz (advisor of Alfred Tarski). The advantage of these notations is that they do not require parentheses to control the order of operations in an expression. The advantage of this in a computer is that parsing a RPN expression is trivial, whereas parsing an expression in standard notation can take quite a bit of computation. At the most basic level, an expression such as 1 + 2 becomes 12+. For more complicated expressions, the concept of a stack must be introduced. The stack is just the list of all numbers which have not been used yet. When an operation takes place, the result of that operation is left on the stack. Thus, we could write the sum of all integers from 1 to 10 as either, 12+3+4+5+6+7+8+9+10+ or 12345678910+++++++++ In both cases the result 55 is left on the stack.
    [Show full text]
  • On Pocrims and Hoops
    On Pocrims and Hoops Rob Arthan & Paulo Oliva August 10, 2018 Abstract Pocrims and suitable specialisations thereof are structures that pro- vide the natural algebraic semantics for a minimal affine logic and its extensions. Hoops comprise a special class of pocrims that provide al- gebraic semantics for what we view as an intuitionistic analogue of the classical multi-valuedLukasiewicz logic. We present some contribu- tions to the theory of these algebraic structures. We give a new proof that the class of hoops is a variety. We use a new indirect method to establish several important identities in the theory of hoops: in particular, we prove that the double negation mapping in a hoop is a homormorphism. This leads to an investigation of algebraic ana- logues of the various double negation translations that are well-known from proof theory. We give an algebraic framework for studying the semantics of double negation translations and use it to prove new re- sults about the applicability of the double negation translations due to Gentzen and Glivenko. 1 Introduction Pocrims provide the natural algebraic models for a minimal affine logic, ALm, while hoops provide the models for what we view as a minimal ana- arXiv:1404.0816v2 [math.LO] 16 Oct 2014 logue, LL m, ofLukasiewicz’s classical infinite-valued logic LL c. This paper presents some new results on the algebraic structure of pocrims and hoops. Our main motivation for this work is in the logical aspects: we are interested in criteria for provability in ALm, LL m and related logics. We develop a useful practical test for provability in LL m and apply it to a range of prob- lems including a study of the various double negation translations in these logics.
    [Show full text]
  • Supplementary Section 6S.10 Alternative Notations
    Supplementary Section 6S.10 Alternative Notations Just as we can express the same thoughts in different languages, ‘He has a big head’ and ‘El tiene una cabeza grande’, there are many different ways to express the same logical claims. Some of these differences are thinly cosmetic. Others are more interesting. Insofar as the different systems of notation we’ll examine in this section are merely different ways of expressing the same logic, they are not particularly important. But one of the most frustrating aspects of studying logic, at first, is getting comfortable with different systems of notation. So it’s good to try to get comfortable with a variety of different ways of presenting logic. Most simply, there are different symbols for all of the logical operators. You can easily find some by perusing various logical texts and websites. The following table contains the most common. Operator We use Others use Negation ∼P ¬P −P P Conjunction P • Q P ∧ Q P & Q PQ Disjunction P ∨ Q P + Q Material conditional P ⊃ Q P → Q P ⇒ Q Biconditional P ≡ Q P ↔ Q P ⇔ Q P ∼ Q Existential quantifier ∃ ∑ ∨ Universal quantifier ∀ ∏ ∧ There are also propositional operators that do not appear in our logical system at all. For example, there are two unary operators called the Sheffer stroke (|) and the Peirce arrow (↓). With these operators, we can define all five of the operators ofPL . Such operators may be used for systems in which one wants a minimal vocabulary and in which one does not need to have simplicity of expression. The balance between simplicity of vocabulary and simplicity of expression is a deep topic, but not one we’ll engage in this section.
    [Show full text]
  • First-Order Logic in a Nutshell Syntax
    First-Order Logic in a Nutshell 27 numbers is empty, and hence cannot be a member of itself (otherwise, it would not be empty). Now, call a set x good if x is not a member of itself and let C be the col- lection of all sets which are good. Is C, as a set, good or not? If C is good, then C is not a member of itself, but since C contains all sets which are good, C is a member of C, a contradiction. Otherwise, if C is a member of itself, then C must be good, again a contradiction. In order to avoid this paradox we have to exclude the collec- tion C from being a set, but then, we have to give reasons why certain collections are sets and others are not. The axiomatic way to do this is described by Zermelo as follows: Starting with the historically grown Set Theory, one has to search for the principles required for the foundations of this mathematical discipline. In solving the problem we must, on the one hand, restrict these principles sufficiently to ex- clude all contradictions and, on the other hand, take them sufficiently wide to retain all the features of this theory. The principles, which are called axioms, will tell us how to get new sets from already existing ones. In fact, most of the axioms of Set Theory are constructive to some extent, i.e., they tell us how new sets are constructed from already existing ones and what elements they contain. However, before we state the axioms of Set Theory we would like to introduce informally the formal language in which these axioms will be formulated.
    [Show full text]
  • Operator Notation Operators Are Special Symbols That Allow Us to Perform Certain Actions on the Operands. by Using These Operato
    Operator Notation Operators are special symbols that allow us to perform certain actions on the operands. By using these operators we can write expressions that can act on one, two, or three operands to perform a specific task. We have three different styles of operator notations based on where the operator is placed relative to its operands. This discussion focuses on operation notation for binary operators (i.e., operators that require two operands). Infix Notation In this type of notation, the operator is written in between the two operands. For example, the addition of two numbers, 3 and 4, can be written as follows in the infix notation: 3 + 4 The infix notation is the most commonly used notation in mathematics. A more complex example, of parenthesized infix notation, is shown below: ((1*2) + (3*4)) – ((5-6) +(7/8)) Here the operators are evaluated from left to right, with the operations within parentheses being evaluated first, followed by multiplication, division, addition, and subtraction. Prefix Notation This is also known as Polish notation. In this type of notation, the operators are written before their operands. The operators are evaluated from left to right and they operate upon their nearest two right operands. For example, the addition of two numbers 3 and 4 can be written as follows in the prefix notation: + 3 4 Here the operator “+” is written before 3 and 4 and acts on its immediate two operands on the right (i.e., 3 and 4). A more complex example in prefix notation is shown below: - + * 1 2 * 3 4 + - 5 6 / 8 8 The above example involves multiple operands in the beginning.
    [Show full text]
  • Learning Postscript by Doing
    Learning PostScript by Doing Andr¶eHeck °c 2005, AMSTEL Institute, UvA Contents 1 Introduction 3 2 Getting Started 3 2.1 A Simple Example Using Ghostscript ..................... 4 2.2 A Simple Example Using GSview ........................ 5 2.3 Using PostScript Code in a Microsoft Word Document . 6 2.4 Using PostScript Code in a LATEX Document . 7 2.5 Numeric Quantities . 8 2.6 The Operand Stack . 9 2.7 Mathematical Operations and Functions . 11 2.8 Operand Stack Manipulation Operators . 12 2.9 If PostScript Interpreting Goes Wrong . 13 3 Basic Graphical Primitives 14 3.1 Point . 15 3.2 Curve . 18 3.2.1 Open and Closed Curves . 18 3.2.2 Filled Shapes . 18 3.2.3 Straight and Circular Line Segments . 21 3.2.4 Cubic B¶ezierLine Segment . 23 3.3 Angle and Direction Vector . 25 3.4 Arrow . 27 3.5 Circle, Ellipse, Square, and Rectangle . 29 3.6 Commonly Used Path Construction Operators and Painting Operators . 31 3.7 Text . 33 3.7.1 Simple PostScript Text . 33 3.7.2 Importing LATEX text . 38 3.8 Symbol Encoding . 40 4 Style Directives 42 4.1 Dashing . 42 4.2 Coloring . 43 4.3 Joining Lines . 45 1 5 Control Structures 48 5.1 Conditional Operations . 48 5.2 Repetition . 50 6 Coordinate Transformations 66 7 Procedures 75 7.1 De¯ning Procedure . 75 7.2 Parameter Passing . 75 7.3 Local variables . 76 7.4 Recursion . 76 8 More Examples 82 8.1 Planar curves . 83 8.2 The Lorenz Butterfly . 88 8.3 A Surface Plot .
    [Show full text]
  • 2005 Front Matter
    PHILOSOPHY OF LOGIC PHIL323 First Semester, 2014 City Campus Contents 1. COURSE INFORMATION 2. GENERAL OVERVIEW 3. COURSEWORK AND ASSESSMENT 4. READINGS 5. LECTURE SCHEDULE WITH ASSOCIATED READINGS 6. TUTORIAL EXERCISES 7. ASSIGNMENTS 1. Assignment 1: First Problem Set 2. Assignment 2: Essay 3. Assignment 3: Second Problem Set 8. ADMINISTRIVIA CONCERNING ALL ASSIGNMENTS 1. COURSE INFORMATION Lecturer and course supervisor: Jonathan McKeown-Green Office: Room 201, Level 2, Arts 2, 18 Symonds Street, City Campus Office hour: Wednesday, 11am-1pm Email: [email protected] Telephone: 373 7599 extension 84631 Classes Lectures are on Wednesdays 3pm – 5pm, and Tutorials are on Thursdays 9-10am, 2. GENERAL OVERVIEW This course is an introduction to two closely related subjects: the philosophy of logic and logic’s relevance to ordinary reasoning. The philosophy of logic is a systematic inquiry into what it is for and what it is like. Taster questions include: Question 1 Must we believe, as classical logic preaches, that every statement whatsoever is entailed by a contradiction? Question 2 Are there any good arguments that bad arguments are bad? As noted, our second subject is the connection between ordinary, everyday reasoning, on the one hand, and logic, as it is practised by mathematicians, philosophers and computer scientists, on the other. Taster questions include: Question 3 Should logical principles be regarded as rules for good thinking? Question 4 Are logical principles best understood as truths about a reality that is independent of us or are they really only truths about how we do, or should, draw conclusions? The close relationship between our two subject areas becomes evident once we note that much philosophical speculation about what logic is and what it is like arises because we care about the relationship between logic and ordinary reasoning.
    [Show full text]
  • First-Order Logic in a Nutshell
    Chapter 2 First-Order Logic in a Nutshell Mathematicians devised signs, not separate from matter except in essence, yet distant from it. These were points, lines, planes, solids, numbers, and countless other characters, which are depicted on paper with certain colours, and they used these in place of the things sym- bolised. GIOSEFFO ZARLINO Le Istitutioni Harmoniche, 1558 First-Order Logic is the system of Symbolic Logic concerned not only with rep- resenting the logical relations between sentences or propositions as wholes (like Propositional Logic), but also with their internal structure in terms of subject and predicate. First-Order Logic can be considered as a kind of language which is dis- tinguished from higher-order languages in that it does not allow quantification over subsets of the domain of discourse or other objects of higher type. Nevertheless, First-Order Logic is strong enough to formalise all of Set Theory and thereby vir- tually all of Mathematics. In other words, First-Order Logic is an abstract language that in one particular case might be the language of Group Theory, and in another case might be the language of Set Theory. The goal of this brief introductionto First-Order Logic is to illustrate and summarise some of the basic concepts of this language and to show how it is applied to fields like Group Theory and Peano Arithmetic (two theories which will accompany us for a while). Syntax: The Grammar of Symbols Like any other written language, First-Order Logic is based on an alphabet, which consists of the following symbols: 11 12 2 First-Order Logic in a Nutshell (a) Variables such as v0, v1, x, y, .
    [Show full text]
  • Curry's Study of Inverse Interpolation on the ENIAC
    Curry’s study of inverse interpolation on the ENIAC M. Bullynck and L. De Mol Curry’s study of inverse interpolation on the ENIAC From a concrete problem to the problem of program composition M. Bullynck1 and L. De Mol2 1 Paris 8, [email protected] 2Universiteit Gent, [email protected] CHOC09, Amsterdam 1 Introduction M. Bullynck and L. De Mol Introduction • How a logician got involved with computers... • 1946: “A study of inverse interpolation of the Eniac” • 1949: “On the composition of programs for automatic comput- ing” • 1950: “A program composition technique as applied to inverse interpolation” • Discussion CHOC09, Amsterdam 2 How a logician got involved with computers... M. Bullynck and L. De Mol How a logician got involved with computers... CHOC09, Amsterdam 3 How a logician got involved with computers... M. Bullynck and L. De Mol How a logician got involved with computers... Highlights in Curry’s career before 1945 • 1924: Starts PhD on differential equations and switches to PhD in logic • 1926–1927: Reads Russell and Whitehead’s Principia Mathematica and starts developing his theory of combinators • 1927–1928: Discovers Sch¨onfinkel’s paper “Uber¨ die Bausteine der mathe- matischen Logik” (1924) • 1929: PhD Grundlagen der kombinatorischen Logik, supervised by Hilbert (actually Bernays) • September 1929: Appointed at the State College, Pennsylvania • 1930ies: Publications on combinatory logic • During World War II, research in applied mathematics (Heaviside opera- tional calculus) • 1942–1944: work at Frankford Arsenal and Applied Physics Laboratories • 1944: moves to Aberdeen Proving Ground → ENIAC CHOC09, Amsterdam 4 How a logician got involved with computers..
    [Show full text]
  • ENGI E1112 Departmental Project Report: Computer Science/Computer Engineering
    ENGI E1112 Departmental Project Report: Computer Science/Computer Engineering Phillip Godzin, Joseph Thompson, Ashley Kling December 2012 Abstract This lab report is on our assignment of reprogramming a HP-20b calcula- tor. The code was written in C programming language on a Mac Pro and uploaded to the device. The operating system was wiped and only had some lower level programming before we started working on it. The calculator now can turn on, display digits, and implements the basic operations of multiplication, division, subtraction, addition and negation. The calculator uses Reverse Polish Notation for its computations, which was also utilized on the original calculator software. Reverse Polish Notation is slightly more ecient for computations than our standard system. Our calculator displays numbers justied to the right. The keyboard of the HP-20b is organized into rows and columns. When a key is pressed, the program stores the associated operation or number. Many of the more complex operations on the calculator were rendered useless for our project. The calculator can hold up to 4 separate numbers in its stack. If overowed, it will return the max value for int. Underow will simply cause nothing to be returned. Following is a more in depth look at how we designed the software for the calculator. 1 1 Introduction The calculator we reprogrammed is a HP-20b calculator. It is a fairly recent product from the long line of HP business calculators, and like its ancestors uses Reverse Polish Notation. You can nd one of these calcula- tors for around 30-40 dollars on Amazon.com.[1] Unfortunately, many of the reviewers were not terribly enthusiastic about the HP-20b, in particular they did not like the build quality of the hardware.
    [Show full text]
  • Notation, Logical (See: Notation, Mathematical) Notation Is a Conventional Written System for Encoding a Formal Axiomatic System
    From: The International Encyclopedia of John Lawler, University of Michigan Language and Linguistics, 2nd Edition and Western Washington University Notation, Logical (see: Notation, Mathematical) Notation is a conventional written system for encoding a formal axiomatic system . Notation governs: • the rules for assignment of written symbols to elements of the axiomatic system • the writing and interpretation rules for well-formed formulae in the axiomatic system • the derived writing and interpretation rules for representing transformations of formulae, in accordance with the rules of deduction in the axiomatic system. All formal systems impose notational conventions on the forms. Just as in natural language, to some extent such conventions are matters of style and politics, even defining group affiliation. Thus notational conventions display sociolinguistic variation ; alternate conventions are often in competing use, though there is usually substantial agreement on a ‘classical’ core notation taught to neophytes. This article is about notational conventions in formal logic, which is (in the view of most mathematicians) that branch of mathematics (logicians, by contrast, tend to think of mathematics as a branch of logic; both metaphors are correct, in the appropriate formal axiomatic system) most concerned with many questions that arise in natural language, e.g, questions of meaning, syntax, predication, well-formedness, and – for our purposes, the most important such – detailed, precise specification. Specification is the purpose of notation, both in mathematics and in science, but such precise conventions are unavoidably context-sensitive. Thus the use of logical notation is different in logic and in linguistics. Bochenski 1948 (English translation 1960) is still the best short introduction to logical notation.
    [Show full text]
  • 12902 Reverse Polish Notation
    12902 Reverse Polish Notation It is a bit complicated to describe what is “Reverse polish notation” (in short RPN). If you already knew about RPN hopefully you can recall them after looking at some examples: Normal Form Reverse Polish Notation 1 + 2 1 2 + (1 + 3) * 6 1 3 + 6 * (1 + 3) * (7 - 2) 1 2 + 7 2 - * If you still do not remember please go through the hint section for some detailed explanation of RPN. For this problem we will consider only one variable ‘a’ and only one binary operator ‘+’. So some valid RPN will be: a which means: a aa+ which means: a + a aa+a+ which means: (a + a) + a aaa++ which means: a + (a + a) And some invalid RPN can be: ‘aaa’, ‘+aa’, ‘a+a’, etc. It might seem a bit confusing since all the variables are same, so you can not map which variable went where but for our problem it does not matter. We only care if the RPN is valid or not. You will be given an RPN, you need to make it valid in minimum number of moves. In a move you can do one of the following operations: 1. Insert one a at any place you wish. 2. Insert one + at any place you wish. 3. Swap any two adjacent characters in the RPN. You can apply the operations at any order you wish, that means, you can apply operation 3 with some newly added character by operation 1 or 2. Input First line of the input is number of test cases T (1 ≤ T ≤ 3000).
    [Show full text]