Intensionality, Extensionality, and Proof Irrelevance in Modal Type Theory

Similar documents
Towards Modal Type Theory

Intensionality, Extensionality, and Proof Irrelevance in Modal Type Theory

Subtyping and Intersection Types Revisited

Intensionality, Extensionality, and Proof Irrelevance in Modal Type Theory

On Equivalence and Canonical Forms in the LF Type Theory

A Judgmental Reconstruction of Modal Logic

Decomposing Modalities

Type Systems as a Foundation for Reliable Computing

Towards Concurrent Type Theory

On a Logical Foundation for Explicit Substitutions

The Curry-Howard Isomorphism

Lecture Notes on Combinatory Modal Logic

Propositions and Proofs

Notes on Logical Frameworks

Justifying Algorithms for βη-conversion

Lecture Notes on Intuitionistic Kripke Semantics

Equality and dependent type theory. CIRM, May 31

Two-dimensional models of type theory

Normalisation by evaluation

Strong Normalization with Singleton Types

Sequent Combinators: A Hilbert System for the Lambda Calculus

Type Theory and Constructive Mathematics. Type Theory and Constructive Mathematics Thierry Coquand. University of Gothenburg

The Calculus of Inductive Constructions

Type Theory and Univalent Foundation

Properties of Terms in Continuation-Passing Style in an Ordered Logical Framework

HOAS by example What is a Formal System? A Simply Typed Framework What Does it Mean? Canonical LF References HOAS. Randy Pollack

Homotopy and Directed Type Theory: a Sample

Lecture Notes on Linear Logic

On Equivalence and Canonical Forms inthelftypetheory

3.2 Reduction 29. Truth. The constructor just forms the unit element,. Since there is no destructor, there is no reduction rule.

Lecture Notes on Sequent Calculus

Adjoint Logic and Its Concurrent Semantics

Program Testing and Constructive Validity

Higher toposes Internal logic Modalities Sub- -toposes Formalization. Modalities in HoTT. Egbert Rijke, Mike Shulman, Bas Spitters 1706.

On Equivalence and Canonical Forms inthelftypetheory

Lecture Notes on From Rules to Propositions

Lecture Notes on The Curry-Howard Isomorphism

Deductive System: Calculus of axioms and inference rules dening judgments. Used in the presentation of logics and programming derivable Logical Framew

Introduction to type theory and homotopy theory

1 / A bird s-eye view of type theory. 2 A bird s-eye view of homotopy theory. 3 Path spaces and identity types. 4 Homotopy type theory

Lazy Strong Normalization

Extensional Equivalence and Singleton Types

On a computational interpretation of sequent calculus for modal logic S4

Lecture Notes on A Concurrent Logical Framework

On Equivalence and Canonical Forms in the LF Type Theory (Extended Abstract) Robert Harper and Frank Pfenning Department of Computer Science Carnegie

Univalent Foundations and Set Theory

TR : Binding Modalities

Lecture Notes on Kripke Semantics for Validity

Handbook of Logic and Proof Techniques for Computer Science

A categorical structure of realizers for the Minimalist Foundation

Informal Statement Calculus

NICTA Advanced Course. Theorem Proving Principles, Techniques, Applications

5. The Logical Framework

A JUDGMENTAL ANALYSIS OF LINEAR LOGIC

Lecture Notes on Heyting Arithmetic

First Order Logic: Syntax and Semantics

CS156: The Calculus of Computation

Canonicity for 2-Dimensional Type Theory

Lecture Notes on Identity and Inversion

Principal-Centric Reasoning in Constructive Authorization Logic

A Proof Theory for Generic Judgments

Proof-Carrying Code in a Session-Typed Process Calculus

Homotopy Probability Theory in the Univalent Foundations

Canonicity for 2-Dimensional Type Theory

Encoding Graph Transformation in Linear Logic

Investigation of Prawitz s completeness conjecture in phase semantic framework

Modal Logic as a Basis for Distributed Computation

3 Propositional Logic

Homotopy Type Theory

Mechanizing Metatheory in a Logical Framework

Inducing syntactic cut-elimination for indexed nested sequents

Proving Completeness for Nested Sequent Calculi 1

Lecture Notes on From Rules to Propositions

Meaning and Reference INTENSIONAL AND MODAL LOGIC. Intensional Logic. Frege: Predicators (general terms) have

Model Theory in the Univalent Foundations

Theoretical Computer Science. Representing model theory in a type-theoretical logical framework

A Judgmental Deconstruction of Modal Logic

Quantum groupoids and logical dualities

Consequence Relations and Natural Deduction

Mathematical Logic IV

REFINEMENT TYPES FOR LOGICAL FRAMEWORKS AND THEIR INTERPRETATION AS PROOF IRRELEVANCE

Dependent type theory

Γ is usually left implicit: ϕ

Advanced Lambda Calculus Lecture 5

Formalising the Completeness Theorem of Classical Propositional Logic in Agda (Proof Pearl)

Modeling Ontological Structures with Type Classes in Coq

A judgmental analysis of linear logic

Mode checking in the Concurrent Logical Framework

Mechanizing a Decision Procedure for Coproduct Equality in Twelf

An insider s look at LF type reconstruction:

A Concurrent Logical Framework

Lecture Notes on Ordered Logic

Non-Axiomatic Logic (NAL) Specification. Pei Wang

Natural Deduction for Propositional Logic

Church and Curry: Combining Intrinsic and Extrinsic Typing

Prefixed Tableaus and Nested Sequents

Notation for Logical Operators:

Type safety for substructural specifications: preliminary results

Normalization by Evaluation for Intuitionistic Propositional Logic

Focusing on Binding and Computation

Transcription:

Intensionality, Extensionality, and Proof Irrelevance in Modal Type Theory Frank Pfenning LICS 01 Boston, Massachusetts June 17, 2001 Acknowledgments: Alberto Momigliano,... 1

Outline 1. Introduction 2. Judgmental Analysis 3. Programs and Extensionality 4. Proofs and Irrelevance 5. Expressions and Intensionality 6. Conclusion 2

Objective and Approach Study fundamental notions in logic and computer science Formal expressions, intensionality Programs, types, computations, extensionality Proofs, propositions, truth, proof-irrelevance How are they related? How can they co-exist? Analysis via judgments in the style of Martin-Löf 3

Motivation Formal expressions, intensionality: reflection, meta-programming run-time code generation Programs, types, computations, extensionality: (functional) programming logical frameworks Proofs, propositions, truth, proof-irrelevance: (constructive) logic, reasoning about programs computational contents, dead code elimination 4

Preview of Results Judgmental analysis of expressions, programs, proofs Definitional equality is intensional, extensional, irrelevant Smooth integration in a single modal type theory Presently restricted to dependent functions only Type theory is decidable Canonical forms exist Sufficient for logical framework applications More work needed for functional programming 5

Judgments Judgment object of knowledge Evident judgment something we know Derivation evidence for a judgment Basic judgments, for example P is a proposition P is true D is a proof of P A is a type M isatermoftypea Mand N are equal terms of type A Following Martin-Löf [ 83, 94, 96] 6

Judgmental Analysis Minimal conceptual machinery Basic judgments Parametric and hypothetical judgments Extends to richer type theories Categorical judgments (modal logic) Linear hypothetical judgments (linear logic) Ordered hypothetical judgments (Lambek calculus and ordered logic) Orthogonality and open-endedness Constructive 7

Hypothetical Judgments General form of hypothetical judgment: Γ=J 1,...,J n are hypotheses J 1,...,J n J General form of hypothesis rule: J 1,...,J n J i Substitution property: If Γ J and Γ,J J then Γ J Substitute the derivation of J for uses of the hypothesis J. Also satisfies weakening and contraction. 8

Outline Introduction Judgmental Analysis Terms and Extensionality Proofs and Irrelevance Expressions and Intensionality Conclusion 9

Terms and Types Basic judgments: A : type A is a type A = B : type types A and B are equal M : A object M has type A M = N : A object M equals N at type A M M object M reduces to M Hypotheses Γ = x 1 :A 1,...,x n :A n All judgments except reduction are hypothetical in Γ Presupposition: all x i distinct and x 1 :A 1,...,x i :A i A i+1 : type 10

Role of Definitional Equality Related to operational semantics: If M M and M : A then M = M : A If M = M : A then M and M are observably equivalent A = B : type if embedded terms are equal Necessary for type conversion: Γ M : A Γ A = B : type Γ M : B Functional programming: congruence based on β-reduction Logical framework: congruence based on βη-conversion Should be decidable for decidable type-checking 11

Functions Reflect hypothetical judgment as type Πx:A. B(x) Introduction rule Γ A : type Γ,x:A M(x):B(x) Γ λx:a. M(x) :Πx:A. B(x) Elimination rule Γ M :Πx:A. B(x) Γ N : A Γ MN :B(N) Reduction (λx:a. M(x)) N M (N ) 12

Extensional Definitional Equality Γ M = N : A Reflexive, transitive, congruent Computational equality (β) Γ A 1 : type Γ,x:A 1 M 2 (x):a 2 (x) Γ M 1 : A 1 Γ (λx:a 1.M 2 (x)) M 1 = M 2 (M 1 ):A 2 (M 1 ) Extensionality (equivalent to η) Equality is decidable Γ A : type Γ,x:A Mx=Nx:B(x) Γ M=N:Πx:A. B(x) 13

Outline Introduction Judgmental Analysis Terms and Extensionality Proofs and Irrelevance Expressions and Intensionality Conclusion 14

A Puzzle: Subset Types Illustrates computational irrelevance of proofs Introduction rule Γ M : A Γ D : B(M) Γ M : {x:a B(x)} Second elimination rule Γ M : {x:a B(x)} Γ,u:B(M) N : C Γ N : C provided u not free in N u can still be used for proofs in second premise Type-checking undecidable 15

Example: Using a Proof Judgment D P D is proof of proposition P Introduction rule Γ M : A Γ D B(M) Γ M, D : {x:a B(x)} Second elimination rule Γ M : {x:a B(x)} Γ,u B(π 1 M) N : C Γ let u = π 2 M in N : C No side condition Proofs are dead code (erase before computation) Type-checking decidable 16

Proofs and Propositions Γ A type type Ais a proposition Γ M A object M is a proof of proposition A New judgment on same language of objects and types! Defined by only one rule (terms are proofs) Γ M : A Γ M A Proofs are not terms (M A M : A) Γ allows proof variables as term variables: ( ) = (Γ,x:A) = Γ,x:A (Γ,x A) = Γ,x:A 17

Proof Irrelevance Γ M = N A M and N are equal proofs Do not care about the proofs, only their existence Defined by only one rule (all valid proofs are equal) Γ M : A Γ N : A Γ M = N A Proofs are not observable Erase dead code before computation 18

Irrelevant Function Types Πx A. B(x) a function that ignores its argument May use x in correctness proof Introduction rule (boring) Γ A type Γ,x A M(x):B(x) Γ λx A. M(x) :Πx A. B(x) Elimination rule (boring) Γ M :Πx A. B(x) Γ N A Γ M N : B(N) Reduction (λx A. M(x)) N M (N ) 19

Logical Framework Application Proofs of decidable propositions can be erased Decidability can be established syntactically Replace proofs of undecidable propositions by oracle strings [Necula & Rahul 01] Enough information to reconstruct a proof All proofs are equal, so any proof will do! Consistent integration of oracle strings in LF Important for compact certificates in proof-carrying code 20

Proof Irrelevance as a Modality Internalize proof irrelevance as a modal operator Introduction rule Γ M A Γ tri M : A Elimination rule Γ M : A Γ,x A N(x):C Γ let tri x = M in N(x) :C Proof theory not yet fully investigated Commuting conversions and dependent types? Categorical analysis [Awodey & Bauer 01] 21

Modal Logic Axiomatic characterization of (non-dependent fragment) A A A A (A B) A B x:a. B(x) quantifies over ephemeral objects Need exist only in present worlds x A. B(x) quantifies over real objects Existed in some past or present world 22

Outline Introduction Judgmental Analysis Terms and Extensionality Proofs and Irrelevance Expressions and Intensionality Conclusion 23

Intensional Expressions Γ M :: A object M is an expression of type A All expressions are terms (via evaluation) Some terms are expressions Γ,x::A, Γ x : A Γ M : A Γ M :: A Γ prohibits term variables and proof variables in expressions except inside proofs ( ) = (Γ,x::A) = Γ,x::A (Γ,x:A) = Γ,x A (Γ,x A) = Γ,x A 24

Intensionality (modulo Proofs) Γ M = N :: A objects M and N are intensionally equal Defined as α-conversion Γ M : A Γ M = M :: A However, embedded proofs are still identified M(D) =(λx A. M(x)) D =(λx A. M(x)) E = M(E) Caveat: type labels (see paper) 25

Internalizing Expressions Intensional function type Πx::A. B Rules completely analogous to terms and proofs Internalizing expressions as a modal operator 2A Introduction rule Γ M :: A Γ box M : 2A Elimination rule Γ M : 2A Γ,x::A N(x) :C Γ let box x = M in N(x) :C 26

Modal Logic Revisited Axiomatic characterization of 2 (non-dependent fragment) Interaction with 2A A 2A 22A 2(A B) 2A 2B A 2A A 2 A x::a. B(x) quantifies over persistent objects Must exist in all future worlds 27

Application: Run-Time Code Generation To generate (optimized) code at run-time, we need (at least conceptually) the source expression. Property guaranteed by 2A Dependent type theory to reason about run-time code generating programs. Requires both 2A and A 28

Some Theorems LF is based on type theory with Πx:A. B(x) LF extended with Πx A. B(x), and Πx::A. B(x) satisfies: decidability of definitional equality decidability of type-checking existence of canonical forms conservativity over LF Approximately typed algorithm for equality [Harper & Pf. 00] See paper and technical report for details 29

Related Work Non-dependent modal type theory [Davies & Pf 96, 01] Program extraction [Constable 86] M :#A (smash type) Program extraction [Paulin-Mohring 89] P : prop, A : type Program extraction [Berger et al. 01] (many others) Extensional concepts in non-extensional type theory [Hofmann 95] 30

Conclusions Intensionality (α-conversion) Extensionality (βη-conversion) Proof irrelevance (all proofs equal) Co-exist easily in judgmental framework Applications of proof irrelevance: proof compression (PCC), dead code elimination Applications of intensionality: run-time code generation, reflection(?) Basic study of fundamental notions The framework makes a difference! 31