Download presentation
Presentation is loading. Please wait.
Published byAnis Carr Modified over 7 years ago
1
Type-Theoretical Semantics with Coercive Subtyping Zhaohui Luo Department of Computer Science Royal Holloway, University of London
2
Type theory Combines computation and logical inference Uniformly in a single language Simple operational semantics + embedded logic Provides structural mechanisms Natural description power Remark: “types” are natural in math. (cf, “sets” in set theory) Has nice properties Eg, Normalisation (decidability + consistency), Subject Reduction, Church-Rosser, … … Is the basis of implementations of Proof assistants (ALF/Agda, Coq, Lego/Plastic, Matita, NuPRL, … )
3
I. Type Theory: an Introduction Basic judgement of type theory a : A “a is an object of type A.” Examples 3 : Nat 2, 2+1 : Nat Nat x:Nat.x : Nat Nat How do we understand “a : A”?
4
Basics – canonical objects Examples: A = Nat, a = 3+4, v = 7. A = Nat Nat,a = ( x:Nat. x,x+1 )(2),v = 2,3 .
5
Type of natural numbers
6
Elimination rule explained “If C holds for all canonical nats, then C holds for every nat.” General pattern (for all inductive types): C holds for all canonical objects of … ======================================================================== C holds for every object of …
7
Inductive/dependent types: examples Finite types (Unit, Bool,...) Types of lists, vectors, trees, … Types of dependent functions Types of dependent pairs (tuples) Types of ordinals, well-orderings,... ......
8
Embedded logic in type theory Propositions-as-types formulatypeexample A BA B If … then … x:A.B(x) x:A.B(x) Every man is handsome. Prop – totality of logical propositions Impredicative type theories such as Simple TT (Church 40) and UTT (Luo 94) Example – predicates to formalise adjectives/verbs: handsome : Man Prop walk : Man Prop
9
Combining types with propositions: examples -types – types of dependent pairs/tuples Intuitively, for A : Type and B(x) : Type [x:A], (A,B) = { x,y | x :A & y : B(x) } Examples (when B is an A-indexed proposition): (Nat, positive)-- type of positive nats (Man, handsome)-- type of handsome men
10
Historical remarks Early development (from early 1900’s) Logical paradoxes (eg, S S if S = { x | x x }?) Ramified type theory (Russell) Simple type theory (Ramsay 1926 & Church 40) Modern development (since 1970’s) Martin-Löf’s type theory (predicative) (Martin-Löf 84) Impredicative type theories Polymorphic -calculus – F (Girard 72) Calculus of Constructions – CC (Coquand & Huet 88) Unifying Theory of dependent Types – UTT (Luo 94)
11
Nice properties: examples Normalisation: Every computation terminates. Decidability: Given a and A, it is decidable whether “a : A”. (Compare this with the undecidable “a A” in set theory.) Logical consistency: “False” is not provable. Other properties e.g., “Church-Rosser”, “Subject Reduction”, … Remark: Based on such good properties, we have simple operational semantics can implement type theories as, eg, proof assistants
12
Applications of type theory Application example: Interactive theorem proving and proof assistants ALF/Agda (Sweden) and NuPRL (USA), implementing Martin- Löf’s TT Coq (France) and Lego/Plastic (UK), implementing CIC and UTT Formalisation of mathematics (eg, 4-colour Theorem in Coq) Program verification (eg, security protocols) Dependently-typed programming Cayenne (Sweden), DML (USA), Epigram (UK),... Today: type-theoretical semantics in linguistics
13
II. Coercive Subtyping Limitations of type theory? Compare with set theory: a A ------a : A A B ------??? Subtyping A B ! How? Traditional notion of subtyping (“subsumptive subtyping”) a : A A B =================================================== a : B Q: Is this OK for type theories with canonical objects? A: No. (Why? Then what?)
14
Two different views of types Type assignment Objects exist first – types are then assigned to objects. Overloading -terms, which may reside in different types. Examples: ML-like programming languages. Eg, x.x : (Nat Nat, Int Int, A A, … ) Types as collections of canonical objects Types and their objects co-exist (one does not without the other) Given by introduction/elimination/computation rules Embedded (consistent) logic, unique typing, … Examples: Martin-Löf’s TT and UTT.
15
Two corresponding views of subtyping Subsumptive subtyping (for type assignment systems) Subsumption rule: a : A A B ======================================= a : B Difficulty of subsumption with canonical objects Q: If a is canonical in A, is it canonical in B? If so, how would one formulate the elimination rule for B? “Bounded quantification”? ( A B C:A Type x:A … Troublesome.) If not, then what? … … Problematic …
16
Coercive subtyping Research on coercive subtyping (Luo 1999 et al) Subtyping as abbreviation f : B C a : A A c B =================================================================================== f(a) = f(c(a)) : C a : A c B “a” can be regarded as an object of type B C B [a] = C B [c(a)], ie, “a” stands for “c(a)” Example, if we declare 1 as a coercion: (Man, handsome) 1 Man Coercive subtyping solves the incompatibility problem of subsumption; is adequate for TTs with canonical objects.
17
Coercive subtyping generalises/subsumes Injective/subset subtyping: Even N; Man Human. Projective/inheritance subtyping: (Man, handsome) Man. Implementations of coercive subtyping: Coq, Lego, Plastic, Matita Applications, including Proof development Dependently-typed programming...... Today: Coercive subtyping in type-theoretical semantics
18
Coercive subtyping is an adequate theory of subtyping for the type theories with canonical objects.
19
III. Type-Theoretical Semantics Formal semantics of NLs Montague grammar (Montague 74) Situation semantics (Barwise-Perry 83) Discourse Representation Theory (Kamp-Reyle 93) Examples in Montague grammar Common nouns (as functional subsets of entities) man : CN / 〔 man 〕 : e t Verbs (also as functional subsets over entities) walk : IV / 〔 walk 〕 : e t Adjectives (as functions from subsets to subsets) handsome : CN/CN / 〔 handsome 〕 : (e t) (e t)
20
Some new developments in, eg, lexical sem Reference transfers (cf, Jackendoff) “The ham sandwich shouts.” (in a special context) Logical polysemy (cf, Pustejovsky 95) “burn an interesting book” (“book”: both “physical” and “informational”) Problem and solution Montague Grammar is not fit for the purpose! (cf, work by Pustejovsky, Asher, …) Types instead of functional subsets + coercive subtyping
21
Type-theoretical semantics: CNs as types Type theory – “many domains/types” (cf, (Ranta 94)) Common nouns are interpreted as types 〔 man 〕 : Type 〔 book 〕 : Type Verbs are interpreted as predicates (functional subsets) 〔 walk 〕 : 〔 man 〕 Prop 〔 John walks 〕 = 〔 walk 〕 (John) : Prop, where John : Man. Adjectives are interpreted as predicates (functional subsets) 〔 handsome 〕 : 〔 man 〕 Prop Modified CNs are interpreted by -types 〔 handsome man 〕 = ( 〔 man 〕, 〔 handsome 〕 )
22
What about, eg, “A handsome man is a man” ? “Paul walks”, with Paul : 〔 handsome man 〕 ? Solution: coercive subtyping First projection 1 as coercion: (A,B) 1 A 〔 handsome man 〕 = ( 〔 man 〕, 〔 handsome 〕 ) 1 〔 man 〕 〔 Paul walks 〕 = 〔 walk 〕 (Paul) : Prop because 〔 walk 〕 : 〔 man 〕 Prop 〔 handsome man 〕 Prop. Remark: Subtyping is crucial in type-theoretical semantics.
23
Examples involving dot-types Dot-types A B in Generative Lexicon Theory (Pustejovsky 95) Example: PHY INFO PHY INFO PHY and PHY INFO INFO In type-theoretical semantics, 〔 book 〕 PHY INFO 〔 interesting 〕 : INFO Prop PHY INFO Prop 〔 book 〕 Prop 〔 burn 〕 : Human PHY Prop Human PHY INFO Prop Human 〔 book 〕 Prop Human 〔 interesting book 〕 Prop 〔 John burned an interesting book 〕 = b : 〔 interesting book 〕. 〔 burn 〕 (John,b) : Prop
24
Another example – copredication (Asher 09) “John picked up and mastered the book.” 〔 pick up 〕 : Human PHY Prop Human PHY INFO Prop Human 〔 book 〕 Prop 〔 master 〕 : Human INFO Prop Human PHY INFO Prop Human 〔 book 〕 Prop Remarks: Common nouns as types in type-theoretical semantics – so things work. (But coercive subtyping is crucial!) Problematic if sticking to Montague’s interpretations of CNs as functional subsets.
25
Modelling dot-types in type theory What is A B? Inadequate accounts Intersection type Product type Representing A B as A B with 1 / 2 as (implicit) coercions where the C-condition (disjointness of A/B-components) guarantees that the coercions concerned are coherent.
26
Coercion contexts Coercive subtyping only happens in local contexts (eg, reference transfers) Coercion contexts in type theory
27
Conclusions Type theories with coercive subtyping provide a logical basis for formal semantics of NLs. Coercive subtyping is crucial in giving an adequate type-theoretical semantics. can be used to adequately model many lexical phenomena (eg, by means of dot-types) in lexical semantics.
28
Selected References (Asher 09) N. Asher. Lexical Meaning in Context: A Web of Words. (Draft Book to appear in Cambridge Univ Press) (Church 40) A. Church. A formulation of the simple theory of types. J. Of Symbolic Logic 5(1). (Luo 94) Z. Luo. Computation and Reasoning: A Type Theory for Computer Science. Oxford Univ Press. (Luo 99) Z. Luo. Coercive subtyping. J of Logic and Comput. 9(1). (Montague 74) R. Montague. Formal Philosophy. Yale Univ Press. (Pustejovsky 95) J. Pustejovsky. The Generative Lexicon. MIT. (Ranta 94) A. Ranta. Type-Theoretical Grammar. Oxford Univ Press.
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.