A (Linear) Spine Calculus



Σχετικά έγγραφα
About these lecture notes. Simply Typed λ-calculus. Types

C.S. 430 Assignment 6, Sample Solutions

Abstract Storage Devices

The Simply Typed Lambda Calculus

λρ-calculus 1. each λ-variable is a λρ-term, called an atom or atomic term; 2. if M and N are λρ-term then (MN) is a λρ-term called an application;

A Lambda Model Characterizing Computational Behaviours of Terms

3.4 SUM AND DIFFERENCE FORMULAS. NOTE: cos(α+β) cos α + cos β cos(α-β) cos α -cos β

Lecture 2. Soundness and completeness of propositional logic

From the finite to the transfinite: Λµ-terms and streams

Proving with Computer Assistance Lecture 2. Herman Geuvers

Ζητήματα Τυποποίησης στην Ορολογία - ο ρόλος και οι δράσεις της Επιτροπής Ορολογίας ΤΕ21 του ΕΛΟΤ

2 Composition. Invertible Mappings

Types and Logics. Programming Languages CS442. David Toman. School of Computer Science University of Waterloo

Formal Semantics. 1 Type Logic

CRASH COURSE IN PRECALCULUS

Assalamu `alaikum wr. wb.

Matrices and Determinants

Fourier Series. MATH 211, Calculus II. J. Robert Buchanan. Spring Department of Mathematics

EE512: Error Control Coding

Every set of first-order formulas is equivalent to an independent set

Section 7.6 Double and Half Angle Formulas

CS-XXX: Graduate Programming Languages. Lecture 27 Higher-Order Polymorphism. Matthew Fluet 2012

Type Theory and Coq. Herman Geuvers. Principal Types and Type Checking

Right Rear Door. Let's now finish the door hinge saga with the right rear door

Inverse trigonometric functions & General Solution of Trigonometric Equations

Nowhere-zero flows Let be a digraph, Abelian group. A Γ-circulation in is a mapping : such that, where, and : tail in X, head in

Introduction to Type Theory February 2008 Alpha Lernet Summer School Piriapolis, Uruguay. Herman Geuvers Nijmegen & Eindhoven, NL

A Hierarchy of Theta Bodies for Polynomial Systems

The λ-calculus. Lecturer: John Wickerson. Phil Wadler

Finite Field Problems: Solutions

CHAPTER 25 SOLVING EQUATIONS BY ITERATIVE METHODS

Διπλωματική Εργασία του φοιτητή του Τμήματος Ηλεκτρολόγων Μηχανικών και Τεχνολογίας Υπολογιστών της Πολυτεχνικής Σχολής του Πανεπιστημίου Πατρών

Finitary proof systems for Kozen s µ

Solutions to Exercise Sheet 5

ΣΥΓΧΡΟΝΕΣ ΤΑΣΕΙΣ ΣΤΗΝ ΕΚΤΙΜΗΣΗ ΚΑΙ ΧΑΡΤΟΓΡΑΦΗΣΗ ΤΩΝ ΚΙΝΔΥΝΩΝ

Derivation of Optical-Bloch Equations

6.1. Dirac Equation. Hamiltonian. Dirac Eq.

CHAPTER 48 APPLICATIONS OF MATRICES AND DETERMINANTS

Section 8.3 Trigonometric Equations

Ordinal Arithmetic: Addition, Multiplication, Exponentiation and Limit

Επίδραση της Συμβολαιακής Γεωργίας στην Χρηματοοικονομική Διοίκηση των Επιχειρήσεων Τροφίμων. Ιωάννης Γκανάς

ST5224: Advanced Statistical Theory II

Γιπλυμαηική Δπγαζία. «Ανθπυποκενηπικόρ ζσεδιαζμόρ γέθςπαρ πλοίος» Φοςζιάνηρ Αθανάζιορ. Δπιβλέπυν Καθηγηηήρ: Νηθφιανο Π. Βεληίθνο

Αλγόριθμοι και πολυπλοκότητα NP-Completeness (2)

"ΦΟΡΟΛΟΓΙΑ ΕΙΣΟΔΗΜΑΤΟΣ ΕΤΑΙΡΕΙΩΝ ΣΥΓΚΡΙΤΙΚΑ ΓΙΑ ΤΑ ΟΙΚΟΝΟΜΙΚΑ ΕΤΗ "

Sequent Calculi for the Modal µ-calculus over S5. Luca Alberucci, University of Berne. Logic Colloquium Berne, July 4th 2008

Example Sheet 3 Solutions

LECTURE 2 CONTEXT FREE GRAMMARS CONTENTS

Dr. D. Dinev, Department of Structural Mechanics, UACEG

Other Test Constructions: Likelihood Ratio & Bayes Tests

Homomorphism in Intuitionistic Fuzzy Automata

Distances in Sierpiński Triangle Graphs

Matrices and vectors. Matrix and vector. a 11 a 12 a 1n a 21 a 22 a 2n A = b 1 b 2. b m. R m n, b = = ( a ij. a m1 a m2 a mn. def

ΣΤΗ ΣΧΕ ΙΑΣΗ ΕΚΠΑΙ ΕΥΤΙΚΟΥ ΛΟΓΙΣΜΙΚΟΥ 1

ΤΕΧΝΟΛΟΓΙΚΟ ΠΑΝΕΠΙΣΤΗΜΙΟ ΚΥΠΡΟΥ ΣΧΟΛΗ ΕΠΙΣΤΗΜΩΝ ΥΓΕΙΑΣ

MATHEMATICS. 1. If A and B are square matrices of order 3 such that A = -1, B =3, then 3AB = 1) -9 2) -27 3) -81 4) 81

k A = [k, k]( )[a 1, a 2 ] = [ka 1,ka 2 ] 4For the division of two intervals of confidence in R +

14 Lesson 2: The Omega Verb - Present Tense

TMA4115 Matematikk 3

Overview. Transition Semantics. Configurations and the transition relation. Executions and computation

Math 6 SL Probability Distributions Practice Test Mark Scheme

Homework 8 Model Solution Section

Syntax Analysis Part IV

Statistical Inference I Locally most powerful tests

2. THEORY OF EQUATIONS. PREVIOUS EAMCET Bits.

Παράλληλος προγραμματισμός περιστροφικών αλγορίθμων εξωτερικών σημείων τύπου simplex ΠΛΟΣΚΑΣ ΝΙΚΟΛΑΟΣ

ORDINAL ARITHMETIC JULIAN J. SCHLÖDER

Approximation of distance between locations on earth given by latitude and longitude

Homomorphism of Intuitionistic Fuzzy Groups

Συστήματα Διαχείρισης Βάσεων Δεδομένων

ΔΙΑΜΟΡΦΩΣΗ ΣΧΟΛΙΚΩΝ ΧΩΡΩΝ: ΒΑΖΟΥΜΕ ΤΟ ΠΡΑΣΙΝΟ ΣΤΗ ΖΩΗ ΜΑΣ!

HOMEWORK 4 = G. In order to plot the stress versus the stretch we define a normalized stretch:

derivation of the Laplacian from rectangular to spherical coordinates

Westfalia Bedienungsanleitung. Nr

Differential equations

The k-bessel Function of the First Kind

ΔΗΜΟΚΡΙΤΕΙΟ ΠΑΝΕΠΙΣΤΗΜΙΟ ΘΡΑΚΗΣ ΣΧΟΛΗ ΕΠΙΣΤΗΜΩΝ ΑΓΩΓΗΣ

Srednicki Chapter 55

SCITECH Volume 13, Issue 2 RESEARCH ORGANISATION Published online: March 29, 2018

On Generating Relations of Some Triple. Hypergeometric Functions

Dynamic types, Lambda calculus machines Section and Practice Problems Apr 21 22, 2016

ΤΕΧΝΟΛΟ ΓΙ ΚΟ ΕΚΠΑ ΙΔ ΕΥ Τ ΙΚΟ Ι ΔΡΥ Μ Α 'ΠΕ Ι ΡΑ ΙΑ ΤΜΗΜΑ ΚΛΩΣΤΟΥΦΑΝΤΟΥΡΓΙΑΣ ΕΙΔΙΚΟΤΗΤΑ ΒΑΦΙΚΗΣ ΠΤΥΧΙΑΚΉ ΕΡΓ ΑΣΙΑ ΤΙΤΛΟΣ ΕΥΧΡΗΣΤΙΑ ΕΞΕΙΔΙΚΕΥΜΕΝΟΥ

Bayesian statistics. DS GA 1002 Probability and Statistics for Data Science.

SUPERPOSITION, MEASUREMENT, NORMALIZATION, EXPECTATION VALUES. Reading: QM course packet Ch 5 up to 5.6

MathCity.org Merging man and maths

Notes on the Open Economy

ΙΑΤΜΗΜΑΤΙΚΟ ΠΡΟΓΡΑΜΜΑ ΜΕΤΑΠΤΥΧΙΑΚΩΝ ΣΠΟΥ ΩΝ ΣΤΗ ΙΟΙΚΗΣΗ ΕΠΙΧΕΙΡΗΣΕΩΝ. ιπλωµατική Εργασία. της ΘΕΟ ΟΣΟΠΟΥΛΟΥ ΕΛΕΝΗΣ ΜΣ:5411

Policy Coherence. JEL Classification : J12, J13, J21 Key words :

ω ω ω ω ω ω+2 ω ω+2 + ω ω ω ω+2 + ω ω+1 ω ω+2 2 ω ω ω ω ω ω ω ω+1 ω ω2 ω ω2 + ω ω ω2 + ω ω ω ω2 + ω ω+1 ω ω2 + ω ω+1 + ω ω ω ω2 + ω

Lecture 34 Bootstrap confidence intervals

ΤΕΧΝΟΛΟΓΙΚΟ ΠΑΝΕΠΙΣΤΗΜΙΟ ΚΥΠΡΟΥ ΤΜΗΜΑ ΝΟΣΗΛΕΥΤΙΚΗΣ

ΚΑΘΟΡΙΣΜΟΣ ΠΑΡΑΓΟΝΤΩΝ ΠΟΥ ΕΠΗΡΕΑΖΟΥΝ ΤΗΝ ΠΑΡΑΓΟΜΕΝΗ ΙΣΧΥ ΣΕ Φ/Β ΠΑΡΚΟ 80KWp

ΕΠΙΧΕΙΡΗΣΙΑΚΗ ΑΛΛΗΛΟΓΡΑΦΙΑ ΚΑΙ ΕΠΙΚΟΙΝΩΝΙΑ ΣΤΗΝ ΑΓΓΛΙΚΗ ΓΛΩΣΣΑ

Rewrite semantics for guarded recursion with universal quantification over clocks

SCHOOL OF MATHEMATICAL SCIENCES G11LMA Linear Mathematics Examination Solutions

Introduction to Type Theory February 2008 Alpha Lernet Summer School Piriapolis, Uruguay. Herman Geuvers Nijmegen & Eindhoven, NL

ΘΕΜΑΤΙΚΗ ΕΥΡΕΤΗΡΙΑΣΗ ΚΑΙ ΚΑΘΙΕΡΩΣΗ ΟΡΟΛΟΓΙΑΣ ΣΤΙΣ ΤΕΧΝΙΚΕΣ ΒΙΒΛΙΟΘΗΚΕΣ: Η ΕΜΠΕΙΡΙΑ ΣΤΟ ΤΕΕ

Συντακτικές λειτουργίες

Second Order Partial Differential Equations

(Biomass utilization for electric energy production)

Transcript:

A (Linear) Spine Calculus Iliano Cervesato iliano@itd.nrl.navy.mil ITT Industries, Inc @ NRL Washington DC http://www.cs.stanford.edu/~iliano/ Joint work with Frank Pfenning Dagstuhl Seminar on Semantic Foundations of Proof Search April 4 th, 2001

Our Motivations Speed up term manipulation (Linear) higher-order unification (Weak-head) normalization Implementation of Twelf, LLF Type reconstruction Logic programming Theorem proving A Linear Spine Calculus 2

Other People s Motivations Study the -calculus Barendregt Proof-terms for sequent calculi Herbelin Schwitchtenberg Speed-up HOU Nadathur A Linear Spine Calculus 3

Roadmap 1. The -calculus o & T 2. The spine calculus S o & T 3. Translations 4. NIL transitions 5. Uniform provability A Linear Spine Calculus 4

Part I The -Calculus o & T A Linear Spine Calculus 5

o & T Terms x, c x:a. M, x^a. M, <M,N>, <> M N, M^N, fst M, snd M Types a, A B, A o B, A & B, T Generally skipped A Linear Spine Calculus 6

o & T (cont d) Simply-typed fragment of LLF Core of Prolog Lolli Biggest fragment of ILL that admits unique normal forms A Linear Spine Calculus 7

η-long Forms?? Simplifies unification / normalization Efficiency Simpler code No types needed Clarity Preserved by β-reduction Easy to build from type declarations η-rule needed for type reconstruction A Linear Spine Calculus 8

Examples c : (a a) o a & a a X X c f^a a. p:a&a. c^f p f^a a. p:a&a. c ^ (x:a.f x) <fst p, snd p> A Linear Spine Calculus 9

Pre-canonical Typing Γ; Δ - M A M is pre-canonical of type A in Γ and Δ Γ; Δ - M A M is pre-atomic of type A in Γ and Δ A Linear Spine Calculus 10

Term Formation Rules Γ, x:a - M B Γ - x:a. M A B Γ - M B A Γ - N B Γ - M N A Γ, x:a - x A A Linear Spine Calculus 11

Tying it Together Γ - M a Γ - M a Γ - M A Γ - M A Forces extensionality Allows β-redices Remove to force β-normal terms A Linear Spine Calculus 12

Examples Not η-long: η-long X f a a a a x:a. f x a a a a a a a β-redex (x:a. f x) c a a a a A Linear Spine Calculus 13

Reductions (x:a. M) N β [N/x]M (x^a. M) ^ N β [N/x]M fst <M,N> β M snd <M,N> β N + congruences A Linear Spine Calculus 14

Properties Church-Rosser Subject reduction Strong normalization Uniqueness of normal forms A Linear Spine Calculus 15

Part II The Spine Calculus S o & T A Linear Spine Calculus 16

Unification X: logical variables in terms Find subst. σ such that M σ = β N σ Algorithms work on the head of M, N Pre-unification Higher-order patterns h M 1 M n A Linear Spine Calculus 17

First Order vs. Higher Order First Order: f(x, g(a), c) = f(b, Y, c) f ; b X ; c ; NIL Higher-Order: (((f X) (g a)) c) = (((f b) Y) c) f c X b A Linear Spine Calculus 18

Objective Devise representation of -terms that allows efficient head access does not penalize F.O. problems allows simple recursive descriptions is not ad-hoc fst ((snd c) ^ x y) c: A & (B C o D & E) A Linear Spine Calculus 19

Idea h M 1 M n h (M 1 ; M n ; NIL) Assoc. fst ((snd c) ^ x y) spine Assoc. end of spine c (π 2 x ;^ y ; π 1 NIL) A Linear Spine Calculus 20

The Spine Calculus Terms x S, x:a. U, x^a. U, <U,V>, <> Spines NIL, V;S, V;^S, π 1 S, π 2 S Heads x, U, c A Linear Spine Calculus 21

Typing Judgments Γ; Δ - U : A Γ; Δ - S : A > a Term U has type A in Γ and Δ S is a spine from heads of type A to terms of type a in Γ and Δ A Linear Spine Calculus 22

Rules for Terms Γ, x:a - U : B Γ - x:a. U : A B Γ, x:a - S : A > a Γ, x:a - x S : a Γ - U : A Γ - S : A > a Γ - U S : a A Linear Spine Calculus 23

Rules for Spines Γ - U : B Γ - S : A > a Γ - U; S : B A > a Γ - NIL : a > a A Linear Spine Calculus 24

β-reductions (x:a. U) (V;S) β (x^a. U) (V;^S) β <U,V> (π 1 S) β [V/x]U S [V/x]U S U S <U,V> (π 2 S) β V S + congruences A Linear Spine Calculus 25

NIL-reduction (x. f x) c β (x. f (x NIL; NIL)) (c NIL; NIL) (f ((c NIL) NIL; NIL)) NIL β NIL f ((c NIL) NIL; NIL) f c NIL f (c NIL; NIL) (U S) NIL NIL U S A Linear Spine Calculus 26

Properties of NIL-reduction Preserves typing (both directions) Strong NIL-normalization Uniqueness of NIL-normal forms Permutes past β-reductions U V NIL U V NIL A Linear Spine Calculus 27 β β

Part III Translations A Linear Spine Calculus 28

Translating to Spine Notation M S U M \ S S U Pre-canonical Pre-atomic accumulator A Linear Spine Calculus 29

Some Rules destructor M S x:a. M S U x:a. U constructor x \ S S x S M \ NIL S H S M S M S H S H M \ S S U S N S U M \ U;S S V M N \ S S V A Linear Spine Calculus 30

Schematically S o & T o & T S o & T NIL Always produces NIL-normal forms A Linear Spine Calculus 31

Properties of the Translation Sound w.r.t. typing Sound w.r.t. reducibility, but M N β S S V U V NIL β A Linear Spine Calculus 32

Translating from Spine Notation M S U Pre-canonical S \ N S M Pre-atomic accumulator A Linear Spine Calculus 33

Some Rules U S M x:a. U S x:a. M S \ x S M U S N S \ N S M x S S M U S S M NIL \ M S M U S M S \ N M U; S \ N S M S M A Linear Spine Calculus 34

Schematically S o & T o & T NIL Identifies NIL-equivalent terms A Linear Spine Calculus 35

Properties of the Translation Weak inverse of S o & T S o & T Sound w.r.t. typing NIL Weak completeness of S and S Sound w.r.t. reductions Weak completeness of S and S A Linear Spine Calculus 36

Properties of the Spine Calculus Church-Rosser Subject reduction Strong normalization β and NIL reductions Uniqueness of normal forms A Linear Spine Calculus 37

Down to Earth Empirical evaluation Efficiency improvement? Logical status of spine NIL-reduction Logical status of spine calculus A Linear Spine Calculus 38

The Twelf / LLF Experience Noticeable efficiency gains (not only spines) Extends to dependent types Extends to linearity Supports weak normal forms Mixes with explicit substitutions Great for logic programming / compil. A Linear Spine Calculus 39

Part IV NIL Transitions A Linear Spine Calculus 40

A glimpse back to o & T Mismatch between o & T Pre-canonical derivations Γ - M a Γ - M A Γ - M a Γ - M A No trace of rule application A Linear Spine Calculus 41

Explicit Mode Switching M ::= Γ - M a ac M ca M Γ - M A Γ - ac M a Γ - ca M A Witness of rule application A Linear Spine Calculus 42

Reduction Rules (ca (x:a. M)) N β (ca [ca N/x]M) (ca (x^a. M)) ^ N β (ca [ca N/x]M) fst (ca <M,N>) β (ca M) snd (ca <M,N>) β (ca N) β ca (ac M) M (coercion) A Linear Spine Calculus 43

Updating the translation Coercion mapped to NIL-reduction The translations are now exact o & T S o & T NIL ca-ac A Linear Spine Calculus 44

Schematically S o & T o & T ca-ac S o & T NIL o & T ca-ac A Linear Spine Calculus 45

Part V Uniform Proofs A Linear Spine Calculus 46

Uniform Sequent Derivations 1. Apply right rules till RHS a is atomic 2. Chose focus A from lhs 3. Apply left rules till A matches a 4. Repeat Abstract logic programing languages are complete w.r.t. uniform provability A Linear Spine Calculus 47

Intuitionistic Implicational Logic Γ, A B Γ, A A a Γ A B Γ, A a Γ B Γ A a Γ B A a Γ a a Γ A Γ A a Γ a A Linear Spine Calculus 48

Recovering the Spine Calculus Γ, x:a - U : B Γ - x:a. U : A B Γ - U : B Γ - S : A > a Γ - U; S : B A > a Γ, x:a - S : A > a Γ, x:a - x S : a Γ - NIL : a > a Γ - U : A Γ - S : A > a Γ - U S : a A Linear Spine Calculus 49

Extending the Curry-Howard Iso. ND SC Uniform logic Curry-Howard Curry-Howard S S S Term calculi A Linear Spine Calculus 50

Beyond Uniform Provability Howard [ 69] Indirect reference Huet [ 89] The Constructive Machine Herbelin [ 95] LJT : implic. int. logic with focus No η-long forms: spines concatenation Interprets cut as explicit substitutions A Linear Spine Calculus 51

Beyond (cont d) Dyckhoff & Pinto [ 98, 99, 01] Refines Herbelin s work Explicit substitutions Schwichtenberg [ 97] Also and No focus: commuting conversions No concatenation / substitutions A Linear Spine Calculus 52

Details Tech. Report www.cs.stanford.edu/~iliano/byyear/#1997 Forthcoming paper 2001? A Linear Spine Calculus 53