towards type theory with continuity
play

Towards Type Theory with Continuity Thorsten Altenkirch School of - PowerPoint PPT Presentation

Towards Type Theory with Continuity Thorsten Altenkirch School of Computer Science University of Nottingham March 17, 2008 Thorsten Altenkirch Russell 08 Setting Extensional Type Theory with W and Quotient types In category speak: LCC


  1. Towards Type Theory with Continuity Thorsten Altenkirch School of Computer Science University of Nottingham March 17, 2008 Thorsten Altenkirch Russell 08

  2. Setting Extensional Type Theory with W and Quotient types In category speak: LCC pretopos with W predicative topos Prop = sets with at most one inhabitant. Define ∃ a : A . P a = [Σ a : A . P a ] (bracket types). A : Set [ A ] = A / ( λ x , y . true ) [ A ] : Prop Logic, Set Theory and Programming Language As a Programming Language: purely functional, total ! How to capture real world programming, i.e. computational effects ? Thorsten Altenkirch Russell 08

  3. Effects as Monads Functional Programming Effects = Monads (Moggi, Wadler) Monad M : Set → Set a : A m : M A f : A → M B η a : M A a > > = f : MB + equations ( A → M B is a category) Thorsten Altenkirch Russell 08

  4. Examples of computational effects Monads Error M E X = 1 + X State M S X = S → S × X Cont. M C X = ( X → R ) → R Kleisli category A → M B = effectful computations. Thorsten Altenkirch Russell 08

  5. Partiality as an effect Delay M D Partial M P X = ( M D X ) / ∼ Idea Partial functions from A to B = A → M P B . Based on published work by Venanzio Capretta and unpublished work with Tarmo Uuustalu and Venanzio. Thorsten Altenkirch Russell 08

  6. Delay A : Set a : A d : M D A codata where N a : M D A L d : M D A M D A : Set Divergent computation ⊥ = M D A ⊥ = L ⊥ Monad structure η D a = N a N a > > = f = f a L d > > = f = L ( d > > = f ) Thorsten Altenkirch Russell 08

  7. Termination d : M D A a : A d ↓ a data where N a ↓ a d ↓ a : Prop L d ↓ a Termination order Π a : A . d ↓ a → d ′ ↓ a d ⊑ d ′ = d ⊑ d ′ ∧ d ′ ⊑ d d ∼ d ′ = Thorsten Altenkirch Russell 08

  8. Partiality M P X = ( M D X ) / ∼ Classically: M P X = X + {⊥} Inherits monad structure ( > > = D stable under ∼ ). Lift order: ⊑ : M D A → M D A → Prop Thorsten Altenkirch Russell 08

  9. Recursion (call by value) How to construct ? f : ( A → M P B ) → A → M P B fix f : A → M P B � ( λ n . f n ⊥ ) fix f = Thorsten Altenkirch Russell 08

  10. ω -CPO structure directed completeness Chain = { � d : N → M D A | Π n : N .� d n ⊑ � d ( n + 1 ) } � d : Chain � � � � d = � � � d 0 ⊔ L d ◦ (+ 1 ) d : M D A race N a ⊔ d ′ = N a L d ⊔ N b = b L d ⊔ L d ′ L ( d ⊔ d ′ ) = Thorsten Altenkirch Russell 08

  11. Continuity? � works on M P (but not ⊔ ). ω -CPO structure lifts pointwise to A → M P B . We need that f : ( A → M P B ) → A → M P B is ω -continuous, i.e. � � λ i . f ( � � f ( d ) = d i ) We have to prove ω -continuity again and again. We cannot define a non-continuous f ! Thorsten Altenkirch Russell 08

  12. Type Theory with Continuity ? How to add continuity to Type Theory? Consistent with extensionality. Computational (BHK). Explained by translation? Thorsten Altenkirch Russell 08

  13. 1st order continuity Consider ( N → N ) → N What are the possible computations of this type? Thorsten Altenkirch Russell 08

  14. Eating games (Hancock et al) g : N → G n : N data G : Set where G g : G R n : G g : G � R n � h = n � G g � h = � g ( h 0 ) � h ◦ (+ 1 ) � G � : ( N → N ) → N f : ( N → N ) → N � q f � = f q � g � = g q f : G Too intensional! Thorsten Altenkirch Russell 08

  15. Extensional games g ∼ g ′ = ( � g � = � g ′ � ) f : ( N → N ) → N � q f � = f q � g � = g q f : G / ∼ Thorsten Altenkirch Russell 08

  16. Local continuity f : ( N → N ) → N h : N → N lc f h : ∃ n : N . Π h ′ : N → N . (Π i < n . h n = h ′ n ) → f h = f h ′ Derive lc using lc’: g : G h : N → N lc ′ g h : Σ n : N . Π h ′ : N → N . (Π i < n . h n = h ′ n ) → f h = f h ′ Thorsten Altenkirch Russell 08

  17. Higher order continuity? What are games for: (( N → N ) → N ) → N ? (( N → N ) → N ) → N ≃ G / ∼→ N { f : G → N | Π g , g ′ : G . g ∼ g ′ → f g = f g ′ } ≃ We need games for: G → N Thorsten Altenkirch Russell 08

  18. Higher order games ( G → N ) S : Set Q : S → Set R : Set n : Π s : S , q : Q s . R → S Synek-Petersson trees : T : S → Set � n : N s : S ∗ data S : Set where R n : S N � s : S q : Q � s i s : S data where H : Q ( N � s ) D i q : Q ( N � Q s : Set s ) n : N data R : Set where N : R R n : R Thorsten Altenkirch Russell 08

  19. Interpreting T t : T s � t � : { g : G | s < g } → N t ∼ t ′ = ( � t � = � t ′ � ) f : { g : G | s < g } → N q f : ( T s ) / ∼ We can use T to give an interpretation of a 3rd order type by 1st order games. Thorsten Altenkirch Russell 08

  20. Loose ends Can we interpret all arithmetic types by 1st order games? (using Synek-Petersson trees). Such a construction should give rise to a translation justifying continuity in Type Theory. Has this been done in intuitionistic logic? Applications to the elimination of extensionality in Observational Type Theory. Thorsten Altenkirch Russell 08

Recommend


More recommend