SlideShare une entreprise Scribd logo
1  sur  10
Télécharger pour lire hors ligne
• 
• 
– 
– 
– 
•                  




• 
     – 
          • 
     – 

          •    


• 
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   	
  

Contenu connexe

Tendances

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
 

Tendances (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
 

En vedette

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
 

En vedette (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
 

Plus 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
 

Plus 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
 

Dernier

[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 

Dernier (20)

[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 

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