Pure Type Systems and HOL-Omega in ProofPower

Similar documents
The Proposition. Roger Bishop Jones. Abstract. A place to play formally with the concept of proposition. Created 2009/11/22

An Introduction to ProofPower

Category Theory. Roger Jones. Abstract. Formalisation of some of the concepts of category theory in ProofPower-HOL. Created 2006/04/09

Basic Foundations of Isabelle/HOL

The Category of Categories

Programming Languages 3. Definition and Proof by Induction

Formalizing Dijkstra

15 212: Principles of Programming. Some Notes on Continuations

type classes & locales

Theorem Proving Principles, Techniques, Applications Recursion

CSE505, Fall 2012, Midterm Examination October 30, 2012

Packaging Theories of Higher Order Logic

Programming with Math and Logic

15 212: Principles of Programming. Some Notes on Induction

CS152: Programming Languages. Lecture 11 STLC Extensions and Related Topics. Dan Grossman Spring 2011

4.5 Pure Linear Functional Programming

Functional Programming and Modeling

locales ISAR IS BASED ON CONTEXTS CONTENT Slide 3 Slide 1 proof - fix x assume Ass: A. x and Ass are visible Slide 2 Slide 4 inside this context

Lecture slides & distribution files:

These notes are intended exclusively for the personal usage of the students of CS352 at Cal Poly Pomona. Any other usage is prohibited without

Programming Languages Fall 2014

Functional Programming with Isabelle/HOL

Embedding logics in Dedukti

CS-XXX: Graduate Programming Languages. Lecture 9 Simply Typed Lambda Calculus. Dan Grossman 2012

3.4 Deduction and Evaluation: Tools Conditional-Equational Logic

Programming with (co-)inductive types in Coq

NFU and NF in ProofPower-HOL

Preuves Interactives et Applications

This is already grossly inconvenient in present formalisms. Why do we want to make this convenient? GENERAL GOALS

A CRASH COURSE IN SEMANTICS

Lecture Notes on Program Equivalence

Computing Fundamentals 2 Introduction to CafeOBJ

Review. CS152: Programming Languages. Lecture 11 STLC Extensions and Related Topics. Let bindings (CBV) Adding Stuff. Booleans and Conditionals

Theorem proving. PVS theorem prover. Hoare style verification PVS. More on embeddings. What if. Abhik Roychoudhury CS 6214

Propositional Logic Formal Syntax and Semantics. Computability and Logic

Introduction to SML Getting Started

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2016

CSE341: Programming Languages Lecture 7 First-Class Functions. Dan Grossman Winter 2013

Provably Correct Software

Subsumption. Principle of safe substitution

Meeting13:Denotations

Supplementary Notes on Recursive Types

λ calculus is inconsistent

Lecture Notes on Data Representation

The design of a programming language for provably correct programs: success and failure

Inductive Definitions, continued

Lecture 3: Recursion; Structural Induction

CS 11 Haskell track: lecture 1

A Case Study of Co-induction in Isabelle 1

Isabelle s meta-logic. p.1

Inductive data types

CS 456 (Fall 2018) Scribe Notes: 2

Chapter 3: Propositional Languages

DRA FRONT END FILTER PROJECT

(Refer Slide Time: 4:00)

CIS 500: Software Foundations

Finite Model Generation for Isabelle/HOL Using a SAT Solver

Lambda Calculus: Implementation Techniques and a Proof. COS 441 Slides 15

COMP 4161 NICTA Advanced Course. Advanced Topics in Software Verification. Toby Murray, June Andronick, Gerwin Klein

Operational Semantics 1 / 13

Functional Programming

15 150: Principles of Functional Programming Some Notes on Regular Expression Matching

Fundamental Concepts. Chapter 1

Part VI. Imperative Functional Programming

Programs and Proofs in Isabelle/HOL

CS 4110 Programming Languages & Logics. Lecture 28 Recursive Types

Safe Stratified Datalog With Integer Order Does not Have Syntax

Denotational Semantics. Domain Theory

Subtyping. Lecture 13 CS 565 3/27/06

Induction for Data Types

Reasoning About Programs Panagiotis Manolios

(Advanced) topics in Programming Languages

Polymorphic Types in ACL2

Coq, a formal proof development environment combining logic and programming. Hugo Herbelin

Homework 1. Notes. What To Turn In. Unix Accounts. Reading. Handout 3 CSCI 334: Spring, 2017

Polymorphism. Lecture 19 CS 565 4/17/08

Lambda Calculus and Type Inference

How Efficient Can Fully Verified Functional Programs Be - A Case Study of Graph Traversal Algorithms

7. Introduction to Denotational Semantics. Oscar Nierstrasz

Semantics via Syntax. f (4) = if define f (x) =2 x + 55.

Semantics of Programming Languages

To prove something about all Boolean expressions, we will need the following induction principle: Axiom 7.1 (Induction over Boolean expressions):

More Untyped Lambda Calculus & Simply Typed Lambda Calculus

Coq projects for type theory 2018

Semantics. There is no single widely acceptable notation or formalism for describing semantics Operational Semantics

CMSC 330: Organization of Programming Languages. Formal Semantics of a Prog. Lang. Specifying Syntax, Semantics

Combining Programming with Theorem Proving

Chapter 2 & 3: Representations & Reasoning Systems (2.2)

Programming language design and analysis

Chapter 1. Introduction

To prove something about all Boolean expressions, we will need the following induction principle: Axiom 7.1 (Induction over Boolean expressions):

Formal Systems and their Applications

Built-in Module BOOL. Lecture Note 01a

The Isabelle/HOL type-class hierarchy

Inductive datatypes in HOL. lessons learned in Formal-Logic Engineering

Meeting14:Denotations

Mutable References. Chapter 1

Concepts of programming languages

CIS 500 Software Foundations Fall December 6

Administrivia. Existential Types. CIS 500 Software Foundations Fall December 6. Administrivia. Motivation. Motivation

Transcription:

Pure Type Systems and HOL-Omega in ProofPower Roger Bishop Jones Abstract The abstract syntax and semantics of Pure Type Systems and HOL-Omega in a formal higherorder theory of well-founded sets. Created: 2009/8/31 Last Change Date: 2009/10/05 09:18:19 http://www.rbjones.com/rbjpub/pp/doc/t031.pdf Id: t031.doc,v 1.3 2009/10/05 09:18:19 rbj Exp c Roger Bishop Jones; Licenced under Gnu LGPL

Contents 1 Introduction 3 2 Pure Type Systems 4 3 HOL-Omega 4 4 Syntax 4 4.1 Constructors and Discriminators.............................. 4 4.1.1 Kinds......................................... 4 4.1.2 Types......................................... 5 4.1.3 Terms......................................... 6 4.2 The Inductive Definition of Syntax............................. 8 5 Proof Contexts 10 6 The Theory holw 11 6.1 Parents............................................ 11 6.2 Constants........................................... 11 6.3 Definitions.......................................... 12 7 INDEX 14 References [1] Peter V. Homeier. The HOL-Omega Logic. pages 244 259. 2009. also available at: http://trustworthytools.com. [2] Roger Bishop Jones. Higher Order Set Theory. RBJones.com, 2010. http://www.rbjones.com/rbjpub/pp/doc/t023.pdf. 2

1 Introduction This document was started after discussions with Peter Homeier at a workshop on Interactive Theorem Proving in 2009. It is intended for explorations into the formalisation of the semantics of Pure Type Systems and of Hol-Omega [1] using a well-founded theory of well-founded sets [2]. The connections betweem the Pure Type Systems and HOL-Omega are very tenuous indeed. For me they are both examples of systems which in some way or to some extent seek to mitigate the problems which arise in trying to work formally with a well-founded ontology. This can be done either by dropping the constraint to a well-founded ontology, or by adopting various pragmatic paliatives. The Pure Type Systems include systems which have no well-founded semantics, notably Coquand s Calculus of Constructions. For this reason they are worth study to increase one s armoury of methods for constructing consistent logical systems without the draconian constraint to well-foundedness. HOL-Omega on the other hand, represents one of the many different ways of mitigating the problems arising from well-foundedness without actually disposing of it. HOL is itself such a system, its polymorphism probably representing the least one can do in the object language. Though HOL s polymorphism is of the very simplest kind, it is very effective. It is hard to improve upon and attempts to improve on it usually yield much more complex logical systems whose merits in the respects we consider are not beyond debate. HOL-Omega is such a system. It may be worth mentioning what are the principle problems which this kind of development is intended to address. For me, they relate to formalisation in tha large, i.e. in support for abstraction, modularity and reuse of specifications and proofs. The formalisation of abstract theories, notably of category theory, is also, whether or not thought of in the context of modularity, a test for this kind of foundational development. The attempt to deal with these problems by foundational innovation is itself controversial. This is primarily I think because of the difficulties involved, the risk of ending up with a system which provides poor support for mainstream mathematics (such as analysis) done in the established manner, and because these matters can be addressed without resort to foundational innovations (and are usually addressed in such ways). My own interest has primarily been in the foundational route, no doubt because I just like thinking about this problem. But I have also an interest in approaches, at least to the specification in the large side of things, which are foundationally neutral, and allow interworking between logical systems. So far as this document is concerned, it has so far gone nowhere, for I quickly realised (though not until after I had started the document) that the higher order theory of well-founded sets which I had intended to use for the purpose [2] fell short of the demands I would put upon it and would have to be upgraded. So that is where movement is taking place at present. 3

2 Pure Type Systems 3 HOL-Omega SML open theory "misc2"; force new theory "holw"; force new pc " holw"; merge pcs [" savedthm cs proof "] " holw"; set merge pcs ["misc21 ", " holw"]; 4 Syntax The formalisation of the syntax has no particular interest. It is essentially the definition of a recursive datatype. If our proof tool supported datatype definitions then I would have used them, since it does not the easiest way to get the required dayatype is by using set theory. Note however, that I do not necessarily need to make a new type, and will only prove those theorems which I actually need. The manual construction of the three mutually recursive datatypes in our higher order set theory is done by defining the constructors and taking the intersection of all sets closed under the constructors. 4.1 Constructors and Discriminators 4.1.1 Kinds MkKindT y : GS GS t MkKindTy t = (Nat g 0 ) g t IsKindT y : GS BOOL k IsKindTy k t k = MkKindTy t MkKindV ar : GS GS n MkKindVar n = (Nat g 1 ) g n IsKindV ar : GS BOOL k IsKindVar k n k = MkKindVar n 4

MkKindArr : GS GS GS lr MkKindArr lr = (Nat g 2 ) g (MkPair g lr) IsKindArr : GS BOOL k IsKindArr k t k = MkKindArr t IsKind : GS BOOL k IsKind k IsKindTy k IsKindVar k IsKindArr k 4.1.2 Types MkT ypev ar : GS GS GS GS nkr MkTypeVar nkr = (Nat g 3 ) g (MkTriple g nkr) IsT ypev ar : GS BOOL t IsTypeVar t p t = MkTypeVar p MkT ypecon : GS GS GS GS nkr MkTypeCon nkr = (Nat g 4 ) g (MkTriple g nkr) IsT ypecon : GS BOOL t IsTypeCon t p t = MkTypeCon p MkT ypeapp : GS GS GS fa MkTypeApp fa = (Nat g 5 ) g (MkPair g fa) 5

IsT ypeapp : GS BOOL a IsTypeApp a p a = MkTypeApp p MkT ypeabs : GS GS GS vb MkTypeAbs vb = (Nat g 6 ) g (MkPair g vb) IsT ypeabs : GS BOOL a IsTypeAbs a p a = MkTypeAbs p MkT ypeuniv : GS GS GS vb MkTypeUniv vb = (Nat g 7 ) g (MkPair g vb) IsT ypeuniv : GS BOOL t IsTypeUniv t p t = MkTypeUniv p IsT ype : GS BOOL t IsType t IsTypeVar t IsTypeCon t IsTypeApp t IsTypeAbs t IsTypeUniv t 4.1.3 Terms MkT ermv ar : GS GS GS nt MkTermVar nt = (Nat g 8 ) g (MkPair g nt) IsT ermv ar : GS BOOL t IsTermVar t p t = MkTermVar p 6

MkT ermcon : GS GS GS nt MkTermCon nt = (Nat g 9 ) g (MkPair g nt) IsT ermcon : GS BOOL t IsTermCon t p t = MkTermCon p MkT ermapp : GS GS GS fa MkTermApp fa = (Nat g 10 ) g (MkPair g fa) IsT ermapp : GS BOOL a IsTermApp a p a = MkTermApp p MkT ermabs : GS GS GS vb MkTermAbs vb = (Nat g 11 ) g (MkPair g vb) IsT ermabs : GS BOOL a IsTermAbs a p a = MkTermAbs p MkT ermappt ype : GS GS GS fa MkTermAppType fa = (Nat g 12 ) g (MkPair g fa) IsT ermappt ype : GS BOOL a IsTermAppType a p a = MkTermAppType p MkT ermabst ype : GS GS GS vb MkTermAbsType vb = (Nat g 13 ) g (MkPair g vb) 7

IsT ermabst ype : GS BOOL a IsTermAbsType a p a = MkTermAbsType p IsT erm : GS BOOL t IsTerm t IsTermVar t IsTermCon t IsTermApp t IsTermAbs t IsTermAppType t 4.2 The Inductive Definition of Syntax This is accomplished by defining the required closure condition (closure under the above constructors for arguments of the right kind) and then taking the intersection of all sets which satisfy the closure condition. The closure condition is: 8

HolwSynClosed: GS SET BOOL s HolwSynClosed s ( t t s IsType t MkKindTy t s) ( p MkKindVar p s) ( k1 k2 k1 s k2 s IsKind k1 IsKind k2 MkKindArr (k1, k2 ) s) ( n k r k s IsKind k MkTypeVar (Nat g n, k, Nat g r) s) ( n k r k s IsKind k MkTypeCon (Nat g n, k, Nat g r) s) ( f a f s a s IsType f IsType a MkTypeApp (f, a) s) ( v b v s b s IsTypeVar v IsType b MkTypeAbs (v, b) s) ( v b v s b s IsTypeVar v IsType b MkTypeUniv (v, b) s) ( n t t s IsType t MkTermVar (Nat g n, t) s) ( n t t s IsType t MkTermCon (Nat g n, t) s) ( f a f s a s IsTerm f IsTerm a MkTermApp (f, a) s) ( v b v s b s IsTermVar v IsTerm b MkTermAbs (v, b) s) ( f a f s a s IsTerm f IsType a MkTermAppType (f, a) s) ( v b v s b s IsTypeVar v IsTerm b MkTermAbsType (v, b) s) The well-formed syntax is then the smallest set closed under these constructions (which might be a class ). HolwSyntax : GS SET HolwSyntax = {x HolwSynClosed x} 9

5 Proof Contexts SML ( add pc thms " holw" []; ) ( add pc thms " holw" []; ) commit pc " holw"; force new pc "holw"; merge pcs ["misc2 ", " holw"] "holw"; commit pc "holw"; force new pc "holw1"; merge pcs ["misc21 ", " holw"] "holw1 "; commit pc "holw1 "; SML set flag ("subgoal package quiet", false); 10

6 The Theory holw 6.1 Parents misc2 6.2 Constants MkKindT y GS GS IsKindT y GS BOOL MkKindV ar GS GS IsKindV ar GS BOOL MkKindArr GS GS GS IsKindArr GS BOOL IsKind GS BOOL MkT ypev ar GS GS GS GS IsT ypev ar GS BOOL MkT ypecon GS GS GS GS IsT ypecon GS BOOL MkT ypeapp GS GS GS IsT ypeapp GS BOOL MkT ypeabs GS GS GS IsT ypeabs GS BOOL MkT ypeuniv GS GS GS IsT ypeu niv GS BOOL IsT ype GS BOOL MkT ermv ar GS GS GS IsT ermv ar GS BOOL MkT ermcon GS GS GS IsT ermcon GS BOOL MkT ermapp GS GS GS IsT ermapp GS BOOL MkT ermabs GS GS GS IsT ermabs GS BOOL MkT ermappt ype GS GS GS IsT ermappt ype GS BOOL MkT ermabst ype GS GS GS IsT ermabst ype GS BOOL IsT erm GS BOOL HolwSynClosed GS P BOOL HolwSyntax GS P 11

6.3 Definitions MkKindT y t MkKindTy t = Nat g 0 g t IsKindT y k IsKindTy k ( t k = MkKindTy t) MkKindV ar n MkKindVar n = Nat g 1 g n IsKindV ar k IsKindVar k ( n k = MkKindVar n) MkKindArr lr MkKindArr lr = Nat g 2 g MkPair g lr IsKindArr k IsKindArr k ( t k = MkKindArr t) IsKind k IsKind k IsKindTy k IsKindVar k IsKindArr k MkT ypev ar nkr MkTypeVar nkr = Nat g 3 g MkTriple g nkr IsT ypev ar t IsTypeVar t ( p t = MkTypeVar p) MkT ypecon nkr MkTypeCon nkr = Nat g 4 g MkTriple g nkr IsT ypecon t IsTypeCon t ( p t = MkTypeCon p) MkT ypeapp fa MkTypeApp fa = Nat g 5 g MkPair g fa IsT ypeapp a IsTypeApp a ( p a = MkTypeApp p) MkT ypeabs vb MkTypeAbs vb = Nat g 6 g MkPair g vb IsT ypeabs a IsTypeAbs a ( p a = MkTypeAbs p) MkT ypeuniv vb MkTypeUniv vb = Nat g 7 g MkPair g vb IsT ypeuniv t IsTypeUniv t ( p t = MkTypeUniv p) IsT ype t IsType t IsTypeVar t IsTypeCon t IsTypeApp t IsTypeAbs t IsTypeUniv t MkT ermv ar nt MkTermVar nt = Nat g 8 g MkPair g nt IsT ermv ar t IsTermVar t ( p t = MkTermVar p) MkT ermcon nt MkTermCon nt = Nat g 9 g MkPair g nt IsT ermcon t IsTermCon t ( p t = MkTermCon p) MkT ermapp fa MkTermApp fa = Nat g 10 g MkPair g fa IsT ermapp a IsTermApp a ( p a = MkTermApp p) MkT ermabs vb MkTermAbs vb = Nat g 11 g MkPair g vb IsT ermabs a IsTermAbs a ( p a = MkTermAbs p) MkT ermappt ype fa MkTermAppType fa = Nat g 12 g MkPair g fa IsT ermappt ype a IsTermAppType a ( p a = MkTermAppType p) MkT ermabst ype vb MkTermAbsType vb = Nat g 13 g MkPair g vb IsT ermabst ype a IsTermAbsType a ( p a = MkTermAbsType p) IsT erm t IsTerm t IsTermVar t IsTermCon t IsTermApp t IsTermAbs t IsTermAppType t IsTermAbsType t HolwSynClosed 12

s HolwSynClosed s ( t t s IsType t MkKindTy t s) ( p MkKindVar p s) ( k1 k2 k1 s k2 s IsKind k1 IsKind k2 MkKindArr (k1, k2 ) s) ( n k r k s IsKind k MkTypeVar (Nat g n, k, Nat g r) s) ( n k r k s IsKind k MkTypeCon (Nat g n, k, Nat g r) s) ( f a f s a s IsType f IsType a MkTypeApp (f, a) s) ( v b v s b s IsTypeVar v IsType b MkTypeAbs (v, b) s) ( v b v s b s IsTypeVar v IsType b MkTypeUniv (v, b) s) ( n t t s IsType t MkTermVar (Nat g n, t) s) ( n t t s IsType t MkTermCon (Nat g n, t) s) ( f a f s a s IsTerm f IsTerm a MkTermApp (f, a) s) ( v b v s b s IsTermVar v IsTerm b MkTermAbs (v, b) s) ( f a f s a s IsTerm f IsType a MkTermAppType (f, a) s) ( v b v s b s IsTypeVar v IsTerm b MkTermAbsType (v, b) s) HolwSyntax HolwSyntax = {x HolwSynClosed x} 13

7 INDEX holw........................................ 4 holw..................................... 4, 10 holw1...................................... 10 HolwSynClosed........................ 9, 11, 12 HolwSyntax........................... 9, 11, 13 IsKind................................ 5, 11, 12 IsKindArr............................ 5, 11, 12 IsKindT y............................. 4, 11, 12 IsKindV ar............................ 4, 11, 12 IsT erm............................... 8, 11, 12 IsT ermabs............................ 7, 11, 12 IsT ermabst ype........................ 8, 11, 12 IsT ermapp............................ 7, 11, 12 IsT ermappt ype....................... 7, 11, 12 IsT ermcon............................ 7, 11, 12 IsT ermv ar............................ 6, 11, 12 IsT ype................................ 6, 11, 12 IsT ypeabs............................. 6, 11, 12 IsT ypeapp............................. 6, 11, 12 IsT ypecon............................ 5, 11, 12 IsT ypeuniv............................ 6, 11, 12 IsT ypev ar............................ 5, 11, 12 MkKindArr........................... 5, 11, 12 MkKindT y............................ 4, 11, 12 MkKindV ar........................... 4, 11, 12 MkT ermabs........................... 7, 11, 12 MkT ermabst ype...................... 7, 11, 12 MkT ermapp........................... 7, 11, 12 MkT ermappt ype...................... 7, 11, 12 MkT ermcon.......................... 7, 11, 12 MkT ermv ar........................... 6, 11, 12 MkT ypeabs............................ 6, 11, 12 MkT ypeapp........................... 5, 11, 12 MkT ypecon........................... 5, 11, 12 MkT ypeuniv.......................... 6, 11, 12 MkT ypev ar........................... 5, 11, 12 14