coinduction in agda via copatterns and sized types
play

Coinduction in Agda via Copatterns and Sized Types Andreas Abel - PowerPoint PPT Presentation

Coinduction in Agda via Copatterns and Sized Types Andreas Abel Department of Computer Science and Engineering Chalmers and Universitt Gteborg Dagstuhl Seminar 16131 Language Based Verification Tools for Functional Programs 30 March 2016


  1. Coinduction in Agda via Copatterns and Sized Types Andreas Abel Department of Computer Science and Engineering Chalmers and Universität Göteborg Dagstuhl Seminar 16131 Language Based Verification Tools for Functional Programs 30 March 2016 Andreas Abel (GU) Coinduction via Copatterns Dagstuhl 16131 1 / 7

  2. Agda’s new coinduction Type-based termination using sized types (1996-). Overcome limits of syntactic termination checking. Workarounds for inductive case: measures, well-founded relations. Don’t work for coinductive case (productivity checking). Copattern matching was invented for type-based productivity checking. Corecursion via copattern matching dualizes recursion via pattern matching. Foundations: new article Abel/Pientka JFP 2016. Andreas Abel (GU) Coinduction via Copatterns Dagstuhl 16131 2 / 7

  3. Languages (infinite tries) Lang ∼ = Bool × ( A → Lang ) Coinductive tries Lang defined via observations/projections ν and δ : Lang is the greatest type consistent with these rules: l : Lang l : Lang a : A ν l : Bool δ l a : Lang Empty language ∅ : Lang. Language of the empty word ε : Lang defined by copattern matching: ν ε = true = ∅ δ ε a Andreas Abel (GU) Coinduction via Copatterns Dagstuhl 16131 3 / 7

  4. Corecursion Empty language ∅ : Lang defined by corecursion: ν ∅ = false δ ∅ a = ∅ Language union k ∪ l is pointwise disjunction: ν ( k ∪ l ) = ν k ∨ ν l δ ( k ∪ l ) a δ k a ∪ δ l a = Language composition k · l à la Brzozowski: ν ( k · l ) ν k ∧ ν l = � ( δ k a · l ) ∪ δ l a if ν k δ ( k · l ) a = ( δ k a · l ) otherwise Not accepted because ∪ is not a constructor. Andreas Abel (GU) Coinduction via Copatterns Dagstuhl 16131 4 / 7

  5. Sized coinductive types Lang i ∼ = Bool × ( ∀ j < i . A → Lang j ) l : Lang i l : Lang i j < i a : A ν l : Bool δ l { j } a : Lang j ∅ : ∀ i . Lang i by copatterns and induction on i : ν ( ∅ { i } ) = false δ ( ∅ { i } ) { j } a = ∅ { j } Andreas Abel (GU) Coinduction via Copatterns Dagstuhl 16131 5 / 7

  6. Type-based guardedness checking Union preserves size/guardeness: k : Lang i l : Lang i k ∪ l : Lang i ν ( k ∪ l ) = ν k ∨ ν l δ ( k ∪ l ) { j } a = δ k { j } a ∪ δ l { j } a Composition is accepted and also guardedness-preserving: k : Lang i l : Lang i k · l : Lang i ν ( k · l ) = ν k ∧ ν l � ( δ k { j } a · l ) ∪ δ l { j } a if ν k δ ( k · l ) { j } a = ( δ k { j } a · l ) otherwise Andreas Abel (GU) Coinduction via Copatterns Dagstuhl 16131 6 / 7

  7. Bisimilarity Equality of infinite tries is defined coinductively. _ ∼ = _ is the greatest relation consistent with l ∼ l ∼ = k = k a : A δ l a ∼ ν l = ν k = δ k a Equivalence relation. Congruence for language constructions. k ∼ l ∼ = k ′ = l ′ ( k ∪ k ′ ) ∼ = ( l ∪ l ′ ) Prove language laws: ( k ∪ l ) · m ∼ = ( k · m ) ∪ ( l · m ) Andreas Abel (GU) Coinduction via Copatterns Dagstuhl 16131 7 / 7

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