a categorical semantics for inductive inductive
play

A categorical semantics for inductive-inductive definitions Thorsten - PowerPoint PPT Presentation

A categorical semantics for inductive-inductive definitions Thorsten Altenkirch 2 Peter Morris 2 Fredrik Nordvall Forsberg 1 Anton Setzer 1 1 University of Nottingham, UK 2 Swansea University, UK CALCO 30/08/2011, Winchester Plan of the talk 1


  1. A categorical semantics for inductive-inductive definitions Thorsten Altenkirch 2 Peter Morris 2 Fredrik Nordvall Forsberg 1 Anton Setzer 1 1 University of Nottingham, UK 2 Swansea University, UK CALCO 30/08/2011, Winchester

  2. Plan of the talk 1 What are inductive-inductive definitions? 2 How can they be described, categorically? 3 Exploiting initiality. 1

  3. Notation Work in the framework of Martin-L¨ of type theory. Unit type 1 , disjoint union A + B . Dependent function spaces ( x : A ) → B ( x ). ◮ Elements are functions f such that f ( a ) : B ( a ) whenever a : A . Dependent pairs Σ x : A . B ( x ). ◮ Elements are pairs � a , b � where a : A , b : B ( a ). ◮ Projections π 0 : Σ x : A . B ( x ) → A and π 1 : ( y : Σ A B ) → B ( π 0 ( y )). Set the type of (small) types / propositions. 2

  4. Inductive-inductive definitions

  5. What is an inductive-inductive definition? Induction-induction is a principle for defining datatypes A : Set, B : A → Set. Both A and B are defined inductively, i.e. “built up from below”. 3

  6. What is an inductive-inductive definition? Induction-induction is a principle for defining datatypes A : Set, B : A → Set. Both A and B are defined inductively, i.e. “built up from below”. A and B are defined simultaneously, so the constructors for A can refer to B and vice versa. In addition, the constructors for B can even refer to the constructors for A . 3

  7. But isn’t that. . . ? An inductive-inductive definition is in general not: An ordinary inductive definition ◮ Because we define A : Set and B : A → Set simultaneously. 4

  8. But isn’t that. . . ? An inductive-inductive definition is in general not: An ordinary inductive definition ◮ Because we define A : Set and B : A → Set simultaneously. An ordinary mutual inductive definition ◮ Because B : A → Set is indexed by A . 4

  9. But isn’t that. . . ? An inductive-inductive definition is in general not: An ordinary inductive definition ◮ Because we define A : Set and B : A → Set simultaneously. An ordinary mutual inductive definition ◮ Because B : A → Set is indexed by A . An indexed inductive definition ◮ Because the index set A : Set is defined along with B : A → Set, and not fixed beforehand. ◮ However, conjecture that it can be reduced to IID. 4

  10. But isn’t that. . . ? An inductive-inductive definition is in general not: An ordinary inductive definition ◮ Because we define A : Set and B : A → Set simultaneously. An ordinary mutual inductive definition ◮ Because B : A → Set is indexed by A . An indexed inductive definition ◮ Because the index set A : Set is defined along with B : A → Set, and not fixed beforehand. ◮ However, conjecture that it can be reduced to IID. An inductive-recursive definition ◮ Because B : A → Set is defined inductively, not recursively. 4

  11. Induction-recursion vs induction-induction Inductive-recursive definition: Need to define B ( c ( � x )) completely when introducing c ( � x ). ◮ For each constructor c of A , must define B ( c ( � x )) = . . . B . . . . ◮ But can refer to B ( x ) both positively and negatively in type of c . ◮ Example: B ( σ ( s , t )) = Σ x : B ( s ) . B ( t ( x )). Inductive-inductive definition: Elements of B ( x ) can be defined any time after x is introduced. ◮ So might depend on elements introduced after x . ◮ We can refer to B ( x ) only positively. ◮ Example: B : A → Set where d : ( x : A ) → ( y : B ( x )) → B ( c ( x , y )). 5

  12. An example Instances of induction-induction have been used implicitly by Dybjer (Internal type theory, 1996) , Danielsson (A formalisation of a dependently typed language as an inductive-recursive family, 2007) , and Chapman (Type theory should eat itself, 2009) to model dependent type theory inside itself. 6

  13. Type theory inside type theory Context : Set defined inductively Type : Context → Set Term : (Γ : Context) → Type(Γ) → Set . . . Substitutions, . . . . . . 7

  14. The crucial point The empty context ε is a well-formed context. If τ is a well-formed type in context Γ, then Γ , x : τ is a well-formed context. ε : Context Γ : Context τ : Type(Γ) Γ ⊲ τ : Context 8

  15. Constructor for Type referring to constructor for Context Γ context Γ ⊢ σ type Γ , x : σ ⊢ τ ( x ) type Γ ⊢ Π x : σ . τ ( x ) type 9

  16. Constructor for Type referring to constructor for Context Γ context Γ ⊢ σ type Γ , x : σ ⊢ τ ( x ) type Γ ⊢ Π x : σ . τ ( x ) type Γ : Context 9

  17. Constructor for Type referring to constructor for Context Γ context Γ ⊢ σ type Γ , x : σ ⊢ τ ( x ) type Γ ⊢ Π x : σ . τ ( x ) type Γ : Context σ : Type(Γ) 9

  18. Constructor for Type referring to constructor for Context Γ context Γ ⊢ σ type Γ , x : σ ⊢ τ ( x ) type Γ ⊢ Π x : σ . τ ( x ) type Γ : Context σ : Type(Γ) τ : Type(Γ ⊲ σ ) 9

  19. Constructor for Type referring to constructor for Context Γ context Γ ⊢ σ type Γ , x : σ ⊢ τ ( x ) type Γ ⊢ Π x : σ . τ ( x ) type Γ : Context σ : Type(Γ) τ : Type(Γ ⊲ σ ) 9

  20. Constructor for Type referring to constructor for Context Γ context Γ ⊢ σ type Γ , x : σ ⊢ τ ( x ) type Γ ⊢ Π x : σ . τ ( x ) type Γ : Context σ : Type(Γ) τ : Type(Γ ⊲ σ ) Π( σ, τ ) : Type(Γ) 9

  21. But is there a theory? Previous work: axiomatisation. Now: initial algebra like semantics – less ugly details. 10

  22. Describing inductive-inductive datatypes

  23. � � � Initial algebra semantics Let F : C → C be a functor. Recall that an F -algebra is a pair ( X , f ) where X ∈ C and f : F ( X ) → X . A morphism α : ( X , f ) → ( Y , g ) between F -algebras is a morphism α : X → Y such that f F ( X ) X F ( α ) α � Y F ( Y ) g Model inductive data types as initial F -algebra for suitable endofunctor F . ( F “represents” the data type by describing its constructors.) Example: F ( X ) = 1 + ( X × X ), [ empty , node ] : F ( BTree ) → BTree . 11

  24. Induction-induction as initial algebras? In general, an inductive-inductive definition consists of ◮ A : Set, ◮ B : A → Set, ◮ a constructor in A : Arg A ( A , B ) → A for A , ◮ a constructor in B : ( x : Arg A ( A , B )) → Arg B ( A , B , in A ) → B (in A ( x )) for B for some functors Arg A , Arg B (but from and to where?). 12

  25. Induction-induction as initial algebras? In general, an inductive-inductive definition consists of ◮ A : Set, ◮ B : A → Set, ◮ a constructor in A : Arg A ( A , B ) → A for A , ◮ a constructor in B : ( x : Arg A ( A , B )) → Arg B ( A , B , in A ) → B (in A ( x )) for B for some functors Arg A , Arg B (but from and to where?). First thought: an inductive-inductive def. is a family ( A , B ) of sets, so they should be represented by functors F = ( F 0 , F 1 ) : Fam ( Set ) → Fam ( Set ) . 12

  26. Induction-induction as initial algebras? In general, an inductive-inductive definition consists of ◮ A : Set, ◮ B : A → Set, ◮ a constructor in A : Arg A ( A , B ) → A for A , ◮ a constructor in B : ( x : Arg A ( A , B )) → Arg B ( A , B , in A ) → B (in A ( x )) for B for some functors Arg A , Arg B (but from and to where?). First thought: an inductive-inductive def. is a family ( A , B ) of sets, so they should be represented by functors F = ( F 0 , F 1 ) : Fam ( Set ) → Fam ( Set ) . Here, Fam ( Set ) category with objects ( A , B ) where A : Set, B : A → Set. Morphism ( A , B ) to ( A ′ , B ′ ) is ( f , g ) where f : A → A ′ , g : ( x : A ) → B ( x ) → B ′ ( f ( x )). 12

  27. Induction-induction as initial algebras? In general, an inductive-inductive definition consists of ◮ A : Set, ◮ B : A → Set, ◮ a constructor in A : Arg A ( A , B ) → A for A , ◮ a constructor in B : ( x : Arg A ( A , B )) → Arg B ( A , B , in A ) → B (in A ( x )) for B for some functors Arg A , Arg B (but from and to where?). First thought: an inductive-inductive def. is a family ( A , B ) of sets, ? ? so they should be represented by functors F = ( F 0 , F 1 ) : Fam ( Set ) → Fam ( Set ) . Here, Fam ( Set ) category with objects ( A , B ) where A : Set, B : A → Set. Every endofunctor F on Fam ( Set ) can be split up into Morphism ( A , B ) to ( A ′ , B ′ ) is ( f , g ) where f : A → A ′ , F 0 : Fam ( Set ) → Set , F 1 : ( X : Fam ( Set )) → F 0 ( X ) → Set . g : ( x : A ) → B ( x ) → B ′ ( f ( x )). 12

  28. Induction-induction as initial algebras? In general, an inductive-inductive definition consists of ◮ A : Set, ◮ B : A → Set, ◮ a constructor in A : Arg A ( A , B ) → A for A , ◮ a constructor in B : ( x : Arg A ( A , B )) → Arg B ( A , B , in A ) → B (in A ( x )) for B for some functors Arg A , Arg B (but from and to where?). First thought: an inductive-inductive def. is a family ( A , B ) of sets, so they should be represented by functors F = ( F 0 , F 1 ) : Fam ( Set ) → Fam ( Set ) . Here, Fam ( Set ) category with objects ( A , B ) where A : Set, B : A → Set. Morphism ( A , B ) to ( A ′ , B ′ ) is ( f , g ) where f : A → A ′ , g : ( x : A ) → B ( x ) → B ′ ( f ( x )). 12

  29. Induction-induction as initial algebras? (cont.) F = ( F 0 , F 1 ) : Fam ( Set ) → Fam ( Set ) An F -algebra (( A , B ) , ( c , d )) would have “constructors” c : F 0 ( A , B ) → A and d : ( x : F 0 ( A , B )) → F 1 ( A , B , x ) → B ( c ( x )). 13

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend