a type system for monotonicity
play

A type system for monotonicity Michael Arntzenius University of - PowerPoint PPT Presentation

A type system for monotonicity Michael Arntzenius University of Birmingham ICFP 2018 Its just the simply-typed -calculus! A Poset A B = monotone maps A B , ordered pointwise op A A A b b


  1. A type system for monotonicity Michael Arntzenius University of Birmingham ICFP 2018

  2. It’s just the simply-typed λ -calculus! � A � ∈ Poset � A → B � = monotone maps � A � → � B � , ordered pointwise

  3. op A A ✷ A b b b a c a c a c f : ✷ A → B is monotone iff x = y = ⇒ f ( x ) � f ( y ) i.e. always !

  4. setMap : ✷ ( ✷ A → B ) → Set A → Set B setMap f xs = let box g = f in do x ← xs let box y = x return ( box ( g ( box y )))

  5. setMap : ✷ ( ✷ A → B ) → Set A → Set B setMap f xs = do x ← xs return ( f x )

  6. A < : B id : A → B

  7. [ T ] A < : B id : TA → B T ∈ { id, op, ✷ , ... }

  8. f : TA → B g : UB → C g ◦ f : ( UT ) A → C

  9. Monotonicity tames dragons! 1. Eventual consistency in distributed systems http://bloom-lang.net/calm/ 2. Determinism in parallel programs LVars: Lattice-based Data Structures for Deterministic Parallelism , Lindsey Kuper & Ryan Newton 3. Recursive queries in Datalog & Datafun http://www.rntz.net/datafun 4. Paradoxes of self-reference

  10. fin

  11. subtractEach : List ( Z × op Z ) → List Z subtractEach xs = [ x − y | ( x , y ) ← xs ]

  12. a � b : id A a � b : A ⇐ ⇒ a � b : op A ⇐ ⇒ a � b : A a � b : ✷ A ⇐ ⇒ a � b ∧ a � b : A a � b : ♦ A a � b ∨ b � a : A ⇐ = T UT id op ✷ ♦ ♦ id id op ✷ ♦ op id op op id ✷ ♦ U ✷ ♦ ✷ ✷ ✷ ✷ ♦ ♦ ♦ ✷ ♦

  13. subsumption Γ ⊢ M : A [ T ] A < : B TΓ ⊢ M : C

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