SlideShare una empresa de Scribd logo
1 de 10
Descargar para leer sin conexión
• 
• 
– 
– 
– 
•                  




• 
     – 
          • 
     – 

          •    


• 
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   	
  

Más contenido relacionado

La actualidad más candente

Artdm170 Week10 Arrays Math
Artdm170 Week10 Arrays MathArtdm170 Week10 Arrays Math
Artdm170 Week10 Arrays MathGilbert Guerrero
 
Kristhyan kurtlazartezubia evidencia1-metodosnumericos
Kristhyan kurtlazartezubia evidencia1-metodosnumericosKristhyan kurtlazartezubia evidencia1-metodosnumericos
Kristhyan kurtlazartezubia evidencia1-metodosnumericosKristhyanAndreeKurtL
 
Short intro to the Rust language
Short intro to the Rust languageShort intro to the Rust language
Short intro to the Rust languageGines Espada
 
Introduction to programming with dependent types in Scala
Introduction to programming with dependent types in ScalaIntroduction to programming with dependent types in Scala
Introduction to programming with dependent types in ScalaDmytro Mitin
 
Python легко и просто. Красиво решаем повседневные задачи
Python легко и просто. Красиво решаем повседневные задачиPython легко и просто. Красиво решаем повседневные задачи
Python легко и просто. Красиво решаем повседневные задачиMaxim Kulsha
 
Gentlest Introduction to Tensorflow
Gentlest Introduction to TensorflowGentlest Introduction to Tensorflow
Gentlest Introduction to TensorflowKhor SoonHin
 
บทที่ 3 พื้นฐานภาษา Java
บทที่ 3 พื้นฐานภาษา Javaบทที่ 3 พื้นฐานภาษา Java
บทที่ 3 พื้นฐานภาษา JavaItslvle Parin
 
Exploring Canvas
Exploring CanvasExploring Canvas
Exploring CanvasKevin Hoyt
 
Documento de acrobat2
Documento de acrobat2Documento de acrobat2
Documento de acrobat2fraytuck
 
Create an animation with CAreplicatorLayer
Create an animation with CAreplicatorLayerCreate an animation with CAreplicatorLayer
Create an animation with CAreplicatorLayerAlessandro Ludovici
 
Inteligencia artificial 11
Inteligencia artificial 11Inteligencia artificial 11
Inteligencia artificial 11Nauber Gois
 
メディアアートにおけるプログラミング言語Rubyの役割
メディアアートにおけるプログラミング言語Rubyの役割メディアアートにおけるプログラミング言語Rubyの役割
メディアアートにおけるプログラミング言語Rubyの役割Koichiro Eto
 
All I know about rsc.io/c2go
All I know about rsc.io/c2goAll I know about rsc.io/c2go
All I know about rsc.io/c2goMoriyoshi Koizumi
 
Зависимые типы в GHC 8. Максим Талдыкин
Зависимые типы в GHC 8. Максим ТалдыкинЗависимые типы в GHC 8. Максим Талдыкин
Зависимые типы в GHC 8. Максим ТалдыкинЮрий Сыровецкий
 
Gentlest Introduction to Tensorflow - Part 3
Gentlest Introduction to Tensorflow - Part 3Gentlest Introduction to Tensorflow - Part 3
Gentlest Introduction to Tensorflow - Part 3Khor SoonHin
 
Set Operations in Unix Shell
Set Operations in Unix ShellSet Operations in Unix Shell
Set Operations in Unix ShellPeter Krumins
 

La actualidad más candente (19)

Artdm170 Week10 Arrays Math
Artdm170 Week10 Arrays MathArtdm170 Week10 Arrays Math
Artdm170 Week10 Arrays Math
 
Kristhyan kurtlazartezubia evidencia1-metodosnumericos
Kristhyan kurtlazartezubia evidencia1-metodosnumericosKristhyan kurtlazartezubia evidencia1-metodosnumericos
Kristhyan kurtlazartezubia evidencia1-metodosnumericos
 
Arrays
ArraysArrays
Arrays
 
Short intro to the Rust language
Short intro to the Rust languageShort intro to the Rust language
Short intro to the Rust language
 
Wcbpijwbpij new
Wcbpijwbpij newWcbpijwbpij new
Wcbpijwbpij new
 
Introduction to programming with dependent types in Scala
Introduction to programming with dependent types in ScalaIntroduction to programming with dependent types in Scala
Introduction to programming with dependent types in Scala
 
Python легко и просто. Красиво решаем повседневные задачи
Python легко и просто. Красиво решаем повседневные задачиPython легко и просто. Красиво решаем повседневные задачи
Python легко и просто. Красиво решаем повседневные задачи
 
Gentlest Introduction to Tensorflow
Gentlest Introduction to TensorflowGentlest Introduction to Tensorflow
Gentlest Introduction to Tensorflow
 
บทที่ 3 พื้นฐานภาษา Java
บทที่ 3 พื้นฐานภาษา Javaบทที่ 3 พื้นฐานภาษา Java
บทที่ 3 พื้นฐานภาษา Java
 
Exploring Canvas
Exploring CanvasExploring Canvas
Exploring Canvas
 
Documento de acrobat2
Documento de acrobat2Documento de acrobat2
Documento de acrobat2
 
Create an animation with CAreplicatorLayer
Create an animation with CAreplicatorLayerCreate an animation with CAreplicatorLayer
Create an animation with CAreplicatorLayer
 
Inteligencia artificial 11
Inteligencia artificial 11Inteligencia artificial 11
Inteligencia artificial 11
 
The Big Three
The Big ThreeThe Big Three
The Big Three
 
メディアアートにおけるプログラミング言語Rubyの役割
メディアアートにおけるプログラミング言語Rubyの役割メディアアートにおけるプログラミング言語Rubyの役割
メディアアートにおけるプログラミング言語Rubyの役割
 
All I know about rsc.io/c2go
All I know about rsc.io/c2goAll I know about rsc.io/c2go
All I know about rsc.io/c2go
 
Зависимые типы в GHC 8. Максим Талдыкин
Зависимые типы в GHC 8. Максим ТалдыкинЗависимые типы в GHC 8. Максим Талдыкин
Зависимые типы в GHC 8. Максим Талдыкин
 
Gentlest Introduction to Tensorflow - Part 3
Gentlest Introduction to Tensorflow - Part 3Gentlest Introduction to Tensorflow - Part 3
Gentlest Introduction to Tensorflow - Part 3
 
Set Operations in Unix Shell
Set Operations in Unix ShellSet Operations in Unix Shell
Set Operations in Unix Shell
 

Destacado

Cbug function Presentation
Cbug function PresentationCbug function Presentation
Cbug function Presentationosamu kimura
 
Proove Mark&Sweep GC with Coq
Proove Mark&Sweep GC with CoqProove Mark&Sweep GC with Coq
Proove Mark&Sweep GC with CoqHiroki Mizuno
 
Coq Tutorial at Proof Summit 2011
Coq Tutorial at Proof Summit 2011Coq Tutorial at Proof Summit 2011
Coq Tutorial at Proof Summit 2011tmiya
 
Typeclass
TypeclassTypeclass
Typeclasstmiya
 
Proofsummit2011a
Proofsummit2011aProofsummit2011a
Proofsummit2011atmiya
 
Coq for ML users
Coq for ML usersCoq for ML users
Coq for ML userstmiya
 
Type based termination for recursive definitions
Type based termination for recursive definitionsType based termination for recursive definitions
Type based termination for recursive definitionsrodrigogribeiro
 
Coq to Rubyによる証明駆動開発@名古屋ruby会議02
Coq to Rubyによる証明駆動開発@名古屋ruby会議02Coq to Rubyによる証明駆動開発@名古屋ruby会議02
Coq to Rubyによる証明駆動開発@名古屋ruby会議02Hiroki Mizuno
 

Destacado (8)

Cbug function Presentation
Cbug function PresentationCbug function Presentation
Cbug function Presentation
 
Proove Mark&Sweep GC with Coq
Proove Mark&Sweep GC with CoqProove Mark&Sweep GC with Coq
Proove Mark&Sweep GC with Coq
 
Coq Tutorial at Proof Summit 2011
Coq Tutorial at Proof Summit 2011Coq Tutorial at Proof Summit 2011
Coq Tutorial at Proof Summit 2011
 
Typeclass
TypeclassTypeclass
Typeclass
 
Proofsummit2011a
Proofsummit2011aProofsummit2011a
Proofsummit2011a
 
Coq for ML users
Coq for ML usersCoq for ML users
Coq for ML users
 
Type based termination for recursive definitions
Type based termination for recursive definitionsType based termination for recursive definitions
Type based termination for recursive definitions
 
Coq to Rubyによる証明駆動開発@名古屋ruby会議02
Coq to Rubyによる証明駆動開発@名古屋ruby会議02Coq to Rubyによる証明駆動開発@名古屋ruby会議02
Coq to Rubyによる証明駆動開発@名古屋ruby会議02
 

Más de tmiya

Coq Tutorial
Coq TutorialCoq Tutorial
Coq Tutorialtmiya
 
RegExp20110305
RegExp20110305RegExp20110305
RegExp20110305tmiya
 
Coq Party 20101127
Coq Party 20101127Coq Party 20101127
Coq Party 20101127tmiya
 
Maude20100719
Maude20100719Maude20100719
Maude20100719tmiya
 
Formal methods20100529
Formal methods20100529Formal methods20100529
Formal methods20100529tmiya
 
Coq 20100208a
Coq 20100208aCoq 20100208a
Coq 20100208atmiya
 

Más de tmiya (6)

Coq Tutorial
Coq TutorialCoq Tutorial
Coq Tutorial
 
RegExp20110305
RegExp20110305RegExp20110305
RegExp20110305
 
Coq Party 20101127
Coq Party 20101127Coq Party 20101127
Coq Party 20101127
 
Maude20100719
Maude20100719Maude20100719
Maude20100719
 
Formal methods20100529
Formal methods20100529Formal methods20100529
Formal methods20100529
 
Coq 20100208a
Coq 20100208aCoq 20100208a
Coq 20100208a
 

Último

Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 

Último (20)

DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 

Coq setoid 20110129

  • 1.
  • 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