verification of redecoration for infinite triangular
play

Verification of Redecoration for Infinite Triangular Matrices in Coq - PowerPoint PPT Presentation

Introduction Reference Representation with a Coinductive Family Another Conception of Triangles Conclusion Verification of Redecoration for Infinite Triangular Matrices in Coq Celia Picard joint work with Ralph Matthes 13/09/2012 13/09/2012


  1. Introduction Reference Representation with a Coinductive Family Another Conception of Triangles Conclusion Verification of Redecoration for Infinite Triangular Matrices in Coq Celia Picard joint work with Ralph Matthes 13/09/2012 13/09/2012 Celia Picard Redecoration for Infinite Triangles 1/20

  2. Introduction Reference Representation with a Coinductive Family Another Conception of Triangles Conclusion Introduction The finite case: finite triangles seen as triangular matrices A E E E . . . A E E A E A Type E fixed throughout Special type A for elements of the diagonal Inductive family Tri fin A 13/09/2012 Celia Picard Redecoration for Infinite Triangles 2/20

  3. Introduction Reference Representation with a Coinductive Family Another Conception of Triangles Conclusion Introduction The finite case: definitions Triangles and trapeziums E × A E E E E E E E triangle E × A A E E E E E . . . . . . E × A A E E E trapezium E × A A E A Formal definition a : A t : Tri fin ( E × A ) a : A sg fin a : Tri fin A constr fin a t : Tri fin A 13/09/2012 Celia Picard Redecoration for Infinite Triangles 3/20

  4. Introduction Reference Representation with a Coinductive Family Another Conception of Triangles Conclusion Introduction The finite case: redecoration f Verifications of redecoration: A E E E B E E E against a . . . . . . A E E B E E list-based model A E B E comonad laws A B All details in: [A. Abel, R. Matthes, and T. Uustalu. Iteration and coiteration schemes for higher-order and nested datatypes. Theoretical Computer Science 2005] [R. Matthes and M. Strecker. Verification of the redecoration algorithm for triangular matrices. TYPES 2007] 13/09/2012 Celia Picard Redecoration for Infinite Triangles 4/20

  5. Introduction Reference Representation with a Coinductive Family Another Conception of Triangles Conclusion Outline Reference Representation with a Coinductive Family 1 2 Another Conception of Triangles 3 Conclusion 13/09/2012 Celia Picard Redecoration for Infinite Triangles 5/20

  6. Introduction Reference Representation with a Coinductive Family Another Conception of Triangles Conclusion Outline Reference Representation with a Coinductive Family 1 Definitions Redecoration Properties of redecoration Another Conception of Triangles 2 Conclusion 3 13/09/2012 Celia Picard Redecoration for Infinite Triangles 6/20

  7. Introduction Reference Representation with a Coinductive Family Another Conception of Triangles Conclusion Reference Representation with a Coinductive Family Definitions Definition of the infinite triangles a : A t : Tri ( E × A ) Trap A = Tri ( E × A ) constr a t : Tri A Projections and function cut rest top : ∀ A . Tri A → A top A E E E top ( constr a r ) := a . . . A E E rest : ∀ A . Tri A → Trap A A E rest ( constr a r ) := r cut A cut ( constr � e , a � r ) := constr a ( cut r ) top : counit of the comonad (signature) 13/09/2012 Celia Picard Redecoration for Infinite Triangles 7/20

  8. Introduction Reference Representation with a Coinductive Family Another Conception of Triangles Conclusion Outline Reference Representation with a Coinductive Family 1 Definitions Redecoration Properties of redecoration Another Conception of Triangles 2 Conclusion 3 13/09/2012 Celia Picard Redecoration for Infinite Triangles 8/20

  9. Introduction Reference Representation with a Coinductive Family Another Conception of Triangles Conclusion Reference Representation with a Coinductive Family Redecoration The lift operation id E E E lift : ∀ A ∀ B . ( Tri A → B ) → Tri ( E × A ) → E × B A E E . . . E × B lift f r := � fst ( top r ) , f ( cut r ) � A E A f The redec operation redec : ∀ A ∀ B . ( Tri A → B ) f A E E E B E E E → Tri A → Tri B redec f t := A E E B E E . . . . . . redec ( lift f ) constr ( f t ) A E B E � redec ( lift f ) A B � ( rest t ) 13/09/2012 Celia Picard Redecoration for Infinite Triangles 9/20

  10. Introduction Reference Representation with a Coinductive Family Another Conception of Triangles Conclusion Outline Reference Representation with a Coinductive Family 1 Definitions Redecoration Properties of redecoration Another Conception of Triangles 2 Conclusion 3 13/09/2012 Celia Picard Redecoration for Infinite Triangles 10/20

  11. Introduction Reference Representation with a Coinductive Family Another Conception of Triangles Conclusion Reference Representation with a Coinductive Family Properties of redecoration – New tools on Tri Equivalence relation on Tri and associated result t 1 , t 2 : Tri A top t 1 = top t 2 rest t 1 ≃ rest t 2 t 1 ≃ t 2 ∀ A ∀ B ∀ ( f f ′ : Tri A → B ) . ( ∀ t , f t = f ′ t ) ⇒ ∀ t , redec f t ≃ redec f ′ t with full extensionality of lift . New tools to manipulate Tri es _ cut : ∀ A . Trap A → Str E es _ cut r es _ cut ( constr � e , a � r ) := e :: ( es _ cut r ) frow t frow : ∀ A . Tri A → Str E A E E E frow t := es _ cut ( rest t ) A E E . . . addes : ∀ A . Str E → Tri A → Trap A t A E addes ( e :: es ) ( constr a r ) := r constr � e , a � ( addes es r ) A ∀ A ∀ ( r : Trap A ) . addes ( es _ cut r ) ( cut r ) ≃ r 13/09/2012 Celia Picard Redecoration for Infinite Triangles 11/20

  12. Introduction Reference Representation with a Coinductive Family Another Conception of Triangles Conclusion Reference Representation with a Coinductive Family Properties of redecoration – Comonad Comonad laws ∀ A ∀ B ∀ f Tri A → B ∀ t Tri A . top ( redec f t ) = f t (1) ∀ A ∀ t Tri A . redec top t ≃ t (2) ∀ A ∀ B ∀ f Tri A → B ∀ g Tri B → C ∀ t Tri A . redec ( g ◦ redec f ) t ≃ redec g ( redec f t ) (3) Application to Tri The type transformation Tri , the projection function top ( counit ) and redec ( cobind ) form a constructive weak comonad w. r. t. ≃ . Weak: compatibility of g in (3) required. Proved with a stronger form of (2): ∀ A ∀ ( f : Tri A → A ) . ( ∀ ( t : Tri A ) , f t = top t ) (2’) ⇒ ∀ ( t : Tri A ) . redec f t ≃ t 13/09/2012 Celia Picard Redecoration for Infinite Triangles 12/20

  13. Introduction Reference Representation with a Coinductive Family Another Conception of Triangles Conclusion Outline Reference Representation with a Coinductive Family 1 Another Conception of Triangles 2 Definitions Redecoration Conclusion 3 13/09/2012 Celia Picard Redecoration for Infinite Triangles 13/20

  14. Introduction Reference Representation with a Coinductive Family Another Conception of Triangles Conclusion Another Conception of Triangles Definitions (1/2) New visualization A E E E Tri ′ A := Str ( A × Str E ) . . . A E E A E A The three parts of the definition top ′ : ∀ A . Tri ′ A → A frow ′ top ′ ( � a , es � :: t ) := a top ′ A E E E . . . frow ′ : ∀ A . Tri ′ A → Str E A E E frow ′ ( � a , es � :: t ) := es rest ′ A E rest ′ : ∀ A . Tri ′ A → Tri ′ A A rest ′ ( � a , es � :: t ) := t 13/09/2012 Celia Picard Redecoration for Infinite Triangles 14/20

  15. Introduction Reference Representation with a Coinductive Family Another Conception of Triangles Conclusion Another Conception of Triangles Definitions (2/2) Equivalence relation t 1 , t 2 : Tri ′ A top ′ t 1 = top ′ t 2 frow ′ t 1 ≡ frow ′ t 2 rest ′ t 1 ∼ = rest ′ t 2 t 1 ∼ = t 2 with ≡ relation on Str (cannot use it directly) Conversion functions to/from Tri toStrRep Tri Tri ′ fromStrRep ∀ A ∀ ( t : Tri ′ A ) . toStrRep ( fromStrRep t ) ∼ = t ∀ A ∀ ( t : Tri A ) . fromStrRep ( toStrRep t ) ≃ t 13/09/2012 Celia Picard Redecoration for Infinite Triangles 15/20

  16. Introduction Reference Representation with a Coinductive Family Another Conception of Triangles Conclusion Outline Reference Representation with a Coinductive Family 1 Another Conception of Triangles 2 Definitions Redecoration Conclusion 3 13/09/2012 Celia Picard Redecoration for Infinite Triangles 16/20

  17. Introduction Reference Representation with a Coinductive Family Another Conception of Triangles Conclusion Another Conception of Triangles Redecoration Definition – Much simpler than redec id A E E E B E E E f A E E B E E . . . redec ′ f . . . A E B E A B redec ′ : ∀ A ∀ B . ( Tri ′ A → B ) → Tri ′ A → Tri ′ B redec ′ f t := � f t , frow ′ t � :: redec ′ f ( rest ′ t ) Results = t ′ ⇒ f t = f t ′ ) ( ∀ t t ′ , t ∼ ∀ f t , redec ′ f t ∼ ⇒ = toStrRep ( redec ( f ◦ toStrRep ) ( fromStrRep t )) ( ∀ t t ′ , t ≃ t ′ ⇒ f t = f t ′ ) ∀ f t , redec f t ≃ fromStrRep ( redec ′ ( f ◦ fromStrRep ) ( toStrRep t )) ⇒ 13/09/2012 Celia Picard Redecoration for Infinite Triangles 17/20

Recommend


More recommend