SlideShare a Scribd company logo
Coq setoid 20110129
• 
• 
– 
– 
– 
•                  




• 
     – 
          • 
     – 

          •    


• 
Inductive	
  Z’	
  :	
  Set	
  :=	
  
|	
  Z’pos	
  :	
  nat	
  -­‐>	
  Z’	
  
|	
  Z’zero	
  :	
  Z’	
  
|	
  Z’neg	
  :	
  nat	
  -­‐>	
  Z’.	
  



Inductive	
  Z’	
  :	
  Set	
  :=	
  
|	
  mkZ’	
  :	
  nat	
  -­‐>	
  nat	
  -­‐>	
  Z.	
  
Require	
  Import	
  Setoid.	
  
Require	
  Import	
  Relation_Definitions.	
  
Require	
  Import	
  Arith.	
  
Require	
  Import	
  Compare_dec.	
  
Require	
  Import	
  Omega.	
  

Inductive	
  Z'	
  :	
  Set	
  :=	
  
|	
  mkZ'	
  :	
  nat	
  -­‐>	
  nat	
  -­‐>	
  Z'.	
  

Definition	
  Z'eq	
  (z	
  z':Z')	
  :	
  Prop	
  :=	
  
	
  	
  let	
  (a,b)	
  :=	
  z	
  in	
  
	
  	
  let	
  (c,d)	
  :=	
  z'	
  in	
  
	
  	
  a	
  +	
  d	
  =	
  b	
  +	
  c.	
  

Notation	
  "a	
  =Z=	
  b"	
  :=	
  (Z'eq	
  a	
  b)	
  (at	
  level	
  70).	
  
(*	
  Z’eq Z’                                           	
  *)	
  
Lemma	
  Z'eq_refl	
  :	
  reflexive	
  Z'	
  Z'eq.	
  
Lemma	
  Z'eq_sym	
  :	
  symmetric	
  Z'	
  Z'eq.	
  
Lemma	
  Z'eq_trans	
  :	
  transitive	
  Z'	
  Z'eq.	
  

(*	
  Z’	
  Z’eq	
   Setoid	
                        	
  *)	
  
Add	
  Parametric	
  Relation	
  :	
  Z'	
  Z'eq	
  
	
  	
  reflexivity	
  proved	
  by	
  Z'eq_refl	
  
	
  	
  symmetry	
  proved	
  by	
  Z'eq_sym	
  
	
  	
  transitivity	
  proved	
  by	
  Z'eq_trans	
  
	
  	
  as	
  Z'_rel.	
  
(*	
  Z’                               	
  *)	
  
Definition	
  Z'plus	
  (z	
  z':Z')	
  :	
  Z'	
  :=	
  
	
  	
  let	
  (a,b)	
  :=	
  z	
  in	
  
	
  	
  let	
  (c,d)	
  :=	
  z'	
  in	
  
	
  	
  mkZ'	
  (a+c)	
  (b+d).	
  

(*	
  Z’plus	
   	
  Z’	
  Z’eq	
                             well-­‐defined                      	
  
	
  	
  x	
  =Z=	
  y	
  -­‐>	
  x0	
  =Z=	
  y0	
  -­‐>	
  Z'plus	
  x	
  x0	
  =Z=	
  Z'plus	
  y	
  y0	
  
                            .	
  *)	
  
Add	
  Parametric	
  Morphism	
  :	
  Z'plus	
  with	
  
	
  	
  signature	
  Z'eq	
  ==>	
  Z'eq	
  ==>	
  Z'eq	
  as	
  Z'_plus_mor.	
  
Proof.	
  
                     	
  
Qed.	
  
(*	
                                           	
  *)	
  
Lemma	
  Z'eq_plus_id_l	
  :	
  forall	
  z	
  a,	
  Z'plus	
  (mkZ'	
  a	
  a)	
  z	
  =Z=	
  z.	
  
Lemma	
  Z'eq_plus_comm	
  :	
  forall	
  z	
  z',	
  Z'plus	
  z	
  z'	
  =Z=	
  Z'plus	
  z'	
  z.	
  

(*	
  rewrite	
              setoid_rewrite	
           	
  *)	
  
Lemma	
  Z'eq_plus_id_r	
  :	
  forall	
  z	
  a,	
  Z'plus	
  z	
  (mkZ'	
  a	
  a)	
  =Z=	
  z.	
  	
  
Proof.	
  
	
  	
  intros.	
  	
  setoid_rewrite	
  (Z'eq_plus_comm	
  z	
  (mkZ'	
  a	
  a)).	
  
	
  	
  apply	
  Z'eq_plus_id_l.	
  
Qed.	
  

(*	
          	
  tactic	
    	
  
	
  	
  setoid_reflexivity,	
  setoid_rewrite,	
  setoid_replace	
                            	
  
*)	
  
• 
• 
     – 
• 
     – 
     – 
          • 
          • 
          • 
          • 
          • 
          • 

• 
     –         Coq.QArith.QArith_base   	
  

More Related Content

PDF
Hyperparameter optimization landscape
neptune.ml
 
PPTX
ProgrammingwithGOLang
Shishir Dwivedi
 
PDF
Swift, via "swift-2048"
Austin Zheng
 
DOCX
Oracle SQL
Anar Godjaev
 
PDF
JavaScript - Agora nervoso
Luis Vendrame
 
PDF
Implementation of c string functions
mohamed sikander
 
KEY
【第一季第三期】Thinking in Javascript & OO in Javascript - 清羽
tbosstraining
 
PDF
ECMAScript 6 major changes
hayato
 
Hyperparameter optimization landscape
neptune.ml
 
ProgrammingwithGOLang
Shishir Dwivedi
 
Swift, via "swift-2048"
Austin Zheng
 
Oracle SQL
Anar Godjaev
 
JavaScript - Agora nervoso
Luis Vendrame
 
Implementation of c string functions
mohamed sikander
 
【第一季第三期】Thinking in Javascript & OO in Javascript - 清羽
tbosstraining
 
ECMAScript 6 major changes
hayato
 

What's hot (19)

PPT
Artdm170 Week10 Arrays Math
Gilbert Guerrero
 
PDF
Kristhyan kurtlazartezubia evidencia1-metodosnumericos
KristhyanAndreeKurtL
 
PPTX
Arrays
mohamed sikander
 
PDF
Short intro to the Rust language
Gines Espada
 
PPTX
Wcbpijwbpij new
Hanokh Aloni
 
PDF
Introduction to programming with dependent types in Scala
Dmytro Mitin
 
PPT
Python легко и просто. Красиво решаем повседневные задачи
Maxim Kulsha
 
PDF
Gentlest Introduction to Tensorflow
Khor SoonHin
 
PPTX
บทที่ 3 พื้นฐานภาษา Java
Itslvle Parin
 
KEY
Exploring Canvas
Kevin Hoyt
 
PDF
Documento de acrobat2
fraytuck
 
PDF
Create an animation with CAreplicatorLayer
Alessandro Ludovici
 
PDF
Inteligencia artificial 11
Nauber Gois
 
PDF
The Big Three
Roman Okolovich
 
PDF
メディアアートにおけるプログラミング言語Rubyの役割
Koichiro Eto
 
PDF
All I know about rsc.io/c2go
Moriyoshi Koizumi
 
PDF
Зависимые типы в GHC 8. Максим Талдыкин
Юрий Сыровецкий
 
PDF
Gentlest Introduction to Tensorflow - Part 3
Khor SoonHin
 
PDF
Set Operations in Unix Shell
Peter Krumins
 
Artdm170 Week10 Arrays Math
Gilbert Guerrero
 
Kristhyan kurtlazartezubia evidencia1-metodosnumericos
KristhyanAndreeKurtL
 
Short intro to the Rust language
Gines Espada
 
Wcbpijwbpij new
Hanokh Aloni
 
Introduction to programming with dependent types in Scala
Dmytro Mitin
 
Python легко и просто. Красиво решаем повседневные задачи
Maxim Kulsha
 
Gentlest Introduction to Tensorflow
Khor SoonHin
 
บทที่ 3 พื้นฐานภาษา Java
Itslvle Parin
 
Exploring Canvas
Kevin Hoyt
 
Documento de acrobat2
fraytuck
 
Create an animation with CAreplicatorLayer
Alessandro Ludovici
 
Inteligencia artificial 11
Nauber Gois
 
The Big Three
Roman Okolovich
 
メディアアートにおけるプログラミング言語Rubyの役割
Koichiro Eto
 
All I know about rsc.io/c2go
Moriyoshi Koizumi
 
Зависимые типы в GHC 8. Максим Талдыкин
Юрий Сыровецкий
 
Gentlest Introduction to Tensorflow - Part 3
Khor SoonHin
 
Set Operations in Unix Shell
Peter Krumins
 
Ad

Viewers also liked (8)

PDF
Cbug function Presentation
osamu kimura
 
KEY
Proove Mark&Sweep GC with Coq
Hiroki Mizuno
 
PDF
Coq Tutorial at Proof Summit 2011
tmiya
 
PDF
Typeclass
tmiya
 
PDF
Proofsummit2011a
tmiya
 
PDF
Coq for ML users
tmiya
 
PDF
Type based termination for recursive definitions
rodrigogribeiro
 
KEY
Coq to Rubyによる証明駆動開発@名古屋ruby会議02
Hiroki Mizuno
 
Cbug function Presentation
osamu kimura
 
Proove Mark&Sweep GC with Coq
Hiroki Mizuno
 
Coq Tutorial at Proof Summit 2011
tmiya
 
Typeclass
tmiya
 
Proofsummit2011a
tmiya
 
Coq for ML users
tmiya
 
Type based termination for recursive definitions
rodrigogribeiro
 
Coq to Rubyによる証明駆動開発@名古屋ruby会議02
Hiroki Mizuno
 
Ad

Similar to Coq setoid 20110129 (20)

PDF
Intro To Agda
Larry Diehl
 
PDF
Eight Regression Algorithms
guestfee8698
 
PPTX
Prolog Cpt114 - Week 2
a_akhavan
 
PDF
A type system for the vectorial aspects of the linear-algebraic lambda-calculus
Alejandro Díaz-Caro
 
KEY
Tprimal agh
Seiya Tokui
 
PDF
確率伝播その2
Yoshihide Nishio
 
PDF
mathematical_notation
Kenta Oono
 
PDF
型理論 なんて自分には関係ないと思っているあなたへ
Yusuke Matsushita
 
PDF
Lect1 No 873503264
yangrong
 
PDF
rinko2011-agh
Seiya Tokui
 
PDF
2_IGARSS2011_BPT_v2.pdf
grssieee
 
PDF
Solutions manual for digital logic and microprocessor design with interfacing...
Brase947
 
KEY
Arrows in perl
Masahiro Honma
 
PDF
Gottlob ICDE 2011
Giorgio Orsi
 
PDF
Complex Numbers
guestf1c1708
 
PPTX
State equations model based on modulo 2 arithmetic and its applciation on rec...
Anax Fotopoulos
 
PPTX
State Equations Model Based On Modulo 2 Arithmetic And Its Applciation On Rec...
Anax_Fotopoulos
 
PDF
Coq for beginners
Yoshihiro Imai
 
PDF
Extending Operators in Perl with Operator::Util
Nova Patch
 
Intro To Agda
Larry Diehl
 
Eight Regression Algorithms
guestfee8698
 
Prolog Cpt114 - Week 2
a_akhavan
 
A type system for the vectorial aspects of the linear-algebraic lambda-calculus
Alejandro Díaz-Caro
 
Tprimal agh
Seiya Tokui
 
確率伝播その2
Yoshihide Nishio
 
mathematical_notation
Kenta Oono
 
型理論 なんて自分には関係ないと思っているあなたへ
Yusuke Matsushita
 
Lect1 No 873503264
yangrong
 
rinko2011-agh
Seiya Tokui
 
2_IGARSS2011_BPT_v2.pdf
grssieee
 
Solutions manual for digital logic and microprocessor design with interfacing...
Brase947
 
Arrows in perl
Masahiro Honma
 
Gottlob ICDE 2011
Giorgio Orsi
 
Complex Numbers
guestf1c1708
 
State equations model based on modulo 2 arithmetic and its applciation on rec...
Anax Fotopoulos
 
State Equations Model Based On Modulo 2 Arithmetic And Its Applciation On Rec...
Anax_Fotopoulos
 
Coq for beginners
Yoshihiro Imai
 
Extending Operators in Perl with Operator::Util
Nova Patch
 

More from tmiya (6)

PDF
Coq Tutorial
tmiya
 
PDF
RegExp20110305
tmiya
 
PDF
Coq Party 20101127
tmiya
 
PPTX
Maude20100719
tmiya
 
PDF
Formal methods20100529
tmiya
 
PPTX
Coq 20100208a
tmiya
 
Coq Tutorial
tmiya
 
RegExp20110305
tmiya
 
Coq Party 20101127
tmiya
 
Maude20100719
tmiya
 
Formal methods20100529
tmiya
 
Coq 20100208a
tmiya
 

Recently uploaded (20)

PDF
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
PPTX
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
PDF
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
PDF
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
PDF
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
 
PPTX
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
PDF
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
PDF
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
PPTX
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
PDF
Software Development Methodologies in 2025
KodekX
 
PPTX
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
PDF
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
PDF
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
PDF
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
PDF
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
PDF
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
PPTX
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
PDF
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
PDF
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
 
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
Software Development Methodologies in 2025
KodekX
 
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 

Coq setoid 20110129

  • 4. •   •  –  •  –  •   • 
  • 5. Inductive  Z’  :  Set  :=   |  Z’pos  :  nat  -­‐>  Z’   |  Z’zero  :  Z’   |  Z’neg  :  nat  -­‐>  Z’.   Inductive  Z’  :  Set  :=   |  mkZ’  :  nat  -­‐>  nat  -­‐>  Z.  
  • 6. Require  Import  Setoid.   Require  Import  Relation_Definitions.   Require  Import  Arith.   Require  Import  Compare_dec.   Require  Import  Omega.   Inductive  Z'  :  Set  :=   |  mkZ'  :  nat  -­‐>  nat  -­‐>  Z'.   Definition  Z'eq  (z  z':Z')  :  Prop  :=      let  (a,b)  :=  z  in      let  (c,d)  :=  z'  in      a  +  d  =  b  +  c.   Notation  "a  =Z=  b"  :=  (Z'eq  a  b)  (at  level  70).  
  • 7. (*  Z’eq Z’  *)   Lemma  Z'eq_refl  :  reflexive  Z'  Z'eq.   Lemma  Z'eq_sym  :  symmetric  Z'  Z'eq.   Lemma  Z'eq_trans  :  transitive  Z'  Z'eq.   (*  Z’  Z’eq   Setoid    *)   Add  Parametric  Relation  :  Z'  Z'eq      reflexivity  proved  by  Z'eq_refl      symmetry  proved  by  Z'eq_sym      transitivity  proved  by  Z'eq_trans      as  Z'_rel.  
  • 8. (*  Z’  *)   Definition  Z'plus  (z  z':Z')  :  Z'  :=      let  (a,b)  :=  z  in      let  (c,d)  :=  z'  in      mkZ'  (a+c)  (b+d).   (*  Z’plus    Z’  Z’eq   well-­‐defined      x  =Z=  y  -­‐>  x0  =Z=  y0  -­‐>  Z'plus  x  x0  =Z=  Z'plus  y  y0   .  *)   Add  Parametric  Morphism  :  Z'plus  with      signature  Z'eq  ==>  Z'eq  ==>  Z'eq  as  Z'_plus_mor.   Proof.     Qed.  
  • 9. (*    *)   Lemma  Z'eq_plus_id_l  :  forall  z  a,  Z'plus  (mkZ'  a  a)  z  =Z=  z.   Lemma  Z'eq_plus_comm  :  forall  z  z',  Z'plus  z  z'  =Z=  Z'plus  z'  z.   (*  rewrite   setoid_rewrite    *)   Lemma  Z'eq_plus_id_r  :  forall  z  a,  Z'plus  z  (mkZ'  a  a)  =Z=  z.     Proof.      intros.    setoid_rewrite  (Z'eq_plus_comm  z  (mkZ'  a  a)).      apply  Z'eq_plus_id_l.   Qed.   (*    tactic        setoid_reflexivity,  setoid_rewrite,  setoid_replace     *)  
  • 10. •  •  –  •  –  –  •  •  •  •  •  •  •  –  Coq.QArith.QArith_base