packaging mathematical structures
play

Packaging Mathematical Structures F. Garillot 1 , G. Gonthier 2 , A. - PowerPoint PPT Presentation

Packaging Mathematical Structures F. Garillot 1 , G. Gonthier 2 , A. Mahboubi 3 , L. Rideau 4 1 : Microsoft Research - INRIA Joint Centre 2 : Microsoft Research 3 : INRIA Saclay-le de France 4 : INRIA Sophia-Antipolis 1 Formalizing Finite Group


  1. Packaging Mathematical Structures F. Garillot 1 , G. Gonthier 2 , A. Mahboubi 3 , L. Rideau 4 1 : Microsoft Research - INRIA Joint Centre 2 : Microsoft Research 3 : INRIA Saclay-Île de France 4 : INRIA Sophia-Antipolis 1

  2. Formalizing Finite Group Algebra the Feit-Thompson proof combinatorics, linear algebra, local analysis character theory finite setting infinite setting problems 2007 2009 2010 2011 2008 This paper presents our so- lutions using Coq ’s de- pendent records, coercions, type inference. 2

  3. Packaging Mathematical Structures Composable mathematical structures This talk Our algebraic hierarchy Our paper Hierarchy details, a nice alternative to Σ -types Two proof examples, in depth 3

  4. Our Algebraic Hierarchy Type Type See the paper, Equality SubType § 3.1. Choice Zmodule Countable See A Modular Formaliza- Ring Finite tion Of Finite Group Theory , . . . (TPHOLs 07) Commutative Ring Unit Ring Commutative Unit Ring Integral Domain Field Decidable field Closed Field 4

  5. Our Algebraic Hierarchy Type Type See the paper, Equality SubType § 3.1. Choice Zmodule Countable See A Modular Formaliza- Ring Finite tion Of Finite Group Theory , . . . (TPHOLs 07) Commutative Ring Unit Ring Commutative Unit Ring Integral Domain Field Decidable field Closed Field depth = 10 4-a

  6. Our Algebraic Hierarchy Type Type See the paper, (nothing here) Equality SubType § 3.1. ➘ Choice Zmodule Countable See A Modular Formaliza- Ring Finite tion Of Finite Group Theory , . . . (TPHOLs 07) Commutative Ring Unit Ring Commutative Unit Ring Integral Domain practical Field Decidable field Closed Field purpose 4-b

  7. Our Algebraic Hierarchy Type Type See the paper, Equality SubType § 3.1. Choice Zmodule Countable See A Modular Formaliza- Ring Finite tion Of Finite Group Theory , . . . (TPHOLs 07) Commutative Ring Unit Ring Commutative Unit Ring multiple Integral Domain inheri- tance Field Decidable field Closed Field 4-c

  8. Our Algebraic Hierarchy infinite Type Type See the quotients in paper, intentional nodes collapse Equality SubType § 3.1. Blue setting on in a clas- green Choice sical/untyped setting. Zmodule Countable See A Modular Formaliza- Ring Finite tion Of Finite Group Theory , . . . (TPHOLs 07) Commutative Ring Unit Ring Commutative Unit Ring Integral Domain Field Decidable field Closed Field 4-d

  9. Our Algebraic Hierarchy Type Type See the better paper, composi- Equality SubType § 3.1. tionality Choice Zmodule Countable See A Modular Formaliza- Ring Finite tion Of Finite Group Theory , . . . (TPHOLs 07) Commutative Ring Unit Ring Commutative Unit Ring Integral Domain Field Decidable field Closed Field 4-e

  10. Our Algebraic Hierarchy 5

  11. Our Algebraic Hierarchy (1) This hierarchy is populated by ground types, e.g.: Z /n Z , F p 5-a

  12. Our Algebraic Hierarchy (1) This hierarchy is populated by ground types, e.g.: Z /n Z , F p (2) . . . and parametric types, e.g.: matrix, polynomials. 5-b

  13. Our Algebraic Hierarchy (1) This hierarchy is populated by ground types, e.g.: Z /n Z , F p (2) . . . and parametric types, e.g.: matrix, polynomials. (3) Very little computational content or theory in a Ring 5-c

  14. Our Algebraic Hierarchy (1) This hierarchy is populated by ground types, e.g.: Z /n Z , F p (2) . . . and parametric types, e.g.: matrix, polynomials. (3) Very little computational content or theory in a Ring (4) but it is a nice package that occurs several times in lemma statements. 5-d

  15. Our Algebraic Hierarchy (1) This hierarchy is populated by ground types, e.g.: Z /n Z , F p (2) . . . and parametric types, e.g.: matrix, polynomials. (3) Very little computational content or theory in a Ring (4) but it is a nice package that occurs several times in lemma statements. (5) � � � � � = Components, objects APIs, interfaces 5-e

  16. Our Algebraic Hierarchy (1) This hierarchy is populated by ground types, e.g.: Z /n Z , F p (2) . . . and parametric types, e.g.: matrix, polynomials. (3) Very little computational content or theory in a Ring (4) but it is a nice package that occurs several times in lemma statements. (5) � � � � � = Components, objects APIs, interfaces (6) algebraic properties ^ = interface programming 5-f

  17. Representing objects and structures We want to manipulate objects: 6

  18. Representing objects and structures We want to manipulate objects: (Cayley-Hamilton) � � P ( A ) = 0 where P ( X ) = det ( X • I n − A ) 6-a

  19. Representing objects and structures We want to manipulate objects: (Cayley-Hamilton) � � P ( A ) = 0 where P ( X ) = det ( X • I n − A ) But we do not want to specify the corresponding structure:  The Ring of polynomials over  the Ring of matrices   over a general Commutative Ring . 6-b

  20. A Type class ZModule (M:Type) � a constant zero : M C elements per structure, � an operation : add : M-> M -> M n nested (parametric) struc- tures in which the parame- � axiom(s) verified by add on M ter occurs at every element: associative add; term size in C n � . . . � How do we pass structures when enunciating lemmas ? � Proofs introduce structures. 7

  21. A Typical structure We fill the blanks using Canonical Structures . operation on the type Module Equality. Record mixin_of (T : Type) : Type := Mixin { op : rel T; _ : forall x y, reflect (x = y) (op x y) }. Structure type : Type := Pack { sort :> Type; mixin : mixin_of sort}. End Equality. representation type axiom(s) verified by the operation projection 8

  22. A Typical structure We fill the blanks using Canonical Structures . Module Equality. Record mixin_of (T : Type) : Type := Mixin { : _ ; _ : _ }. Structure type : Type := Pack {sort :> Type; mixin : mixin_of sort}. End Equality. This is generic: we use modules as namespaces only: Notation eqType := Equality.type. 9

  23. Canonical Structure Composition � Most widely used: Telescopes zmodType eqType Mixin Eq Mixin Zmod op zmod op zmod T axioms zmod axioms zmod 10

  24. Telescopes : Canonical Structure inference 2 + 2 Notation Zmodule.add α 2 2 type inference Equality.sort ( Zmodule.sort α ) ≡ βιδ int lookup (Equality.sort,int) ❀ int eqT ype Zmodule.sort α ≡ βιδ int eqT ype lookup (Zmodule.sort,int eqT ype ) ❀ int zmodT ype Equality.sort (Zmodule.sort (int zmodT ype )) 11

  25. Telescopes : Canonical Structure inference 2 + 2 Notation Zmodule.add α 2 2 type inference Equality.sort ( Zmodule.sort α ) ≡ βιδ int lookup (Equality.sort,int) ❀ int eqT ype Zmodule.sort α ≡ βιδ int eqT ype lookup (Zmodule.sort,int eqT ype ) ❀ int zmodT ype Equality.sort (Zmodule.sort (int zmodT ype )) � Simple packaging, but 11-a

  26. Telescopes : Canonical Structure inference 2 + 2 Notation Zmodule.add α 2 2 type inference Equality.sort ( Zmodule.sort α ) ≡ βιδ int lookup (Equality.sort,int) ❀ int eqT ype Zmodule.sort α ≡ βιδ int eqT ype lookup (Zmodule.sort,int eqT ype ) ❀ int zmodT ype Equality.sort (Zmodule.sort (int zmodT ype )) � Simple packaging, but � head constant always the same x:T is interpreted as x:Equality.sort(Zmodule.sort T) 11-b

  27. Telescopes : Canonical Structure inference 2 + 2 Notation Zmodule.add α 2 2 type inference Equality.sort ( Zmodule.sort α ) ≡ βιδ int lookup (Equality.sort,int) ❀ int eqT ype Zmodule.sort α ≡ βιδ int eqT ype lookup (Zmodule.sort,int eqT ype ) ❀ int zmodT ype Equality.sort (Zmodule.sort (int zmodT ype )) � Simple packaging, but � head constant always the same x:T is interpreted as x:Equality.sort(Zmodule.sort T) � we’re defining coercions/canonical projections on Equality.sort ! 11-c

  28. Telescopes : Canonical Structure inference 2 + 2 Notation Zmodule.add α 2 2 type inference Equality.sort ( Zmodule.sort α ) ≡ βιδ int lookup (Equality.sort,int) ❀ int eqT ype Zmodule.sort α ≡ βιδ int eqT ype lookup (Zmodule.sort,int eqT ype ) ❀ int zmodT ype Equality.sort (Zmodule.sort (int zmodT ype )) � Simple packaging, but � head constant always the same x:T is interpreted as x:Equality.sort(Zmodule.sort T) � we’re defining coercions/canonical projections on Equality.sort ! � as is, no multiple inheritance 11-d

  29. Packed Classes zmodType Class zmod Class Eq Mixin Zmod op eq op zmod T axioms eq axioms zmod 12

  30. Packed Classes zmodType Class zmod Class Eq Mixin Zmod op eq op zmod T axioms eq axioms zmod ϕ ϕ Class eq T denotes x : T (Zmodule.sort T α ) , x : eqType which, thanks to ϕ , has a canonical eqType structure. 12-a

  31. Packed Classes 2 + 2 == 4 Notation Equality.op γ ( Zmodule.add α 2 2 ) 4 Zmodule.sort α ≡ int lookup (Zmodule.sort,int) � �� � ❀ int zmodT ype Zmodule.sort int zmodType Equality.sort γ ≡ Zmodule.sort int zmodType lookup (Equality.sort,Zmodule.sort int zmodT ype ) ❀ Zmodule.eqType(int zmodT ype ) Equality.op (Zmodule.eqType(int zmodT ype ))(Zmodule.add ...) 4 ≡ βιδ 4 == 2 + 2 Notation Equality.op γ (Zmodule.add α 2 2) 4 lookup (Equality.sort,int) ❀ int eqT ype Equality.op int eqT ype (Zmodule.add α 2 2) 4 ... 13

Recommend


More recommend