the coq proof assistant principles and practice
play

The Coq proof assistant : principles and practice J.-F. Monin - PowerPoint PPT Presentation

Coq J.-F. Monin Polymorphism Lists The Coq proof assistant : principles and practice J.-F. Monin Universit Grenoble Alpes 2016 Lecture 7 Outline Coq J.-F. Monin Polymorphism Lists Polymorphism Outline Coq J.-F. Monin


  1. Coq J.-F. Monin Polymorphism Lists The Coq proof assistant : principles and practice J.-F. Monin Université Grenoble Alpes 2016 Lecture 7

  2. Outline Coq J.-F. Monin Polymorphism Lists Polymorphism

  3. Outline Coq J.-F. Monin Polymorphism Lists Polymorphism Lists

  4. Outline Coq J.-F. Monin Polymorphism Lists Polymorphism Lists

  5. Polymorphism Coq J.-F. Monin Polymorphism Lists A type can be a parameter of a function Example: the identity function Definition ide := fun (X: Type) => fun (x: X) => x. Definition ide (X: Type) (x: X) := x.

  6. Implicit arguments Coq J.-F. Monin When using the identity function, the first argument can be Polymorphism automatically inferred from the second Lists Example id nat 3 id 3 Local declaration Definition id {X: Type} (x: X) := x. Simplified application id 3

  7. Implicit arguments Coq J.-F. Monin When using the identity function, the first argument can be Polymorphism automatically inferred from the second Lists Example id nat 3 id 3 Local declaration Definition id {X: Type} (x: X) := x. Simplified application id 3 Recovering explicit application @id nat id (X:=nat)

  8. Implicit arguments Coq J.-F. Monin When using the identity function, the first argument can be Polymorphism automatically inferred from the second Lists Example id nat 3 id 3 Local declaration Definition id {X: Type} (x: X) := x. Simplified application id 3 Recovering explicit application @id nat id (X:=nat) Global declaration Set Implicit Arguments.

  9. Outline Coq J.-F. Monin Polymorphism Lists Polymorphism Lists

  10. Lists Coq J.-F. Monin Polymorphism Lists Polymorphic inductive definition Inductive list (X: Set) : Set := | nil : list X | cons : X -> list X -> list X. On Type Can be used in more situations (e.g., lists of predicates) Inductive list (X: Type) : Type := | nil : list X | cons : X -> list X -> list X.

  11. Basic important properties Coq J.-F. Monin Polymorphism Lists app : for appending two lists

  12. Basic important properties Coq J.-F. Monin Polymorphism Lists app : for appending two lists nil is neutral on the left and on the right for app ◮ left : by reflexivity ◮ right : by induction

  13. Basic important properties Coq J.-F. Monin Polymorphism Lists app : for appending two lists nil is neutral on the left and on the right for app ◮ left : by reflexivity ◮ right : by induction app is associative ◮ app (app u v) w = app u (app v w) just by induction on u

  14. Additional material Coq J.-F. Monin Polymorphism Lists See coq files Lecture07 lists

Recommend


More recommend