SlideShare a Scribd company logo
1 of 7
Download to read offline
Empty and unit types
Dmytro Mitin
https://stepik.org/course/Introduction-to-programming-
with-dependent-types-in-Scala-2294/
March 2017
Dmytro Mitin Empty and unit types
Sets
Empty set
∅
Set with one element
{∅}
Dmytro Mitin Empty and unit types
Empty type
1 Type Formation
Γ ctx
Γ 0 : ∗
2 Constructor
3 Eliminator
Γ C : ∗
Γ, x : 0 abortC x : C
4 Computation rule (”β-reduction“)
5 Uniqueness principle (”η-conversion“)
Γ c : C
Γ, x : 0 abortC x ≡ c : C
Dmytro Mitin Empty and unit types
Unit type
1 Type Formation
Γ ctx
Γ 1 : ∗
2 Constructor
Γ ctx
Γ 1 : 1
3 Eliminator
Γ c : C
Γ, x : 1 case1(x)(c) : C
x match { case () => c }
Dmytro Mitin Empty and unit types
Unit type
4 Computation rule (”β-reduction“)
Γ c : C
Γ case1(1)(c) ≡ c : C
5 Uniqueness principle (”η-conversion“)
Γ C : ∗ Γ, x : 1 c : C
Γ, y : 1 case1(y)(c) [x ← 1] ≡ c[x ← y] : C
Dmytro Mitin Empty and unit types
Haskell, Scala and Java
Haskell
() :: ()
Scala
() : Unit Nothing null : Null
Java
void Void null
Dmytro Mitin Empty and unit types
ProvingGround
git clone https://github.com/siddhartha-gadgil/ProvingGround.git
cd ProvingGround
sbt mantle/test:console
Zero
val A = "A" :: Type
val recZA = Zero.rec(A)
val z = "z" :: Zero
recZA(z) !: A
Star !: Unit
val recUA = Unit.rec(A)
recUA(a)(Star) == a
Dmytro Mitin Empty and unit types

More Related Content

What's hot

Grincon U.S. 2019 Grin Privacy and Scaling
Grincon U.S. 2019 Grin Privacy and ScalingGrincon U.S. 2019 Grin Privacy and Scaling
Grincon U.S. 2019 Grin Privacy and ScalingKaren Hsu
 
Roots With Calc2
Roots With Calc2Roots With Calc2
Roots With Calc2bwlomas
 
Answers+of+C+sample+exam.docx
Answers+of+C+sample+exam.docxAnswers+of+C+sample+exam.docx
Answers+of+C+sample+exam.docxismailaboshatra
 
Ib maths sl derivatives of transcendental functions
Ib maths sl derivatives of transcendental functionsIb maths sl derivatives of transcendental functions
Ib maths sl derivatives of transcendental functionsestelav
 
Difference of two squares
Difference of two squaresDifference of two squares
Difference of two squaresMartinGeraldine
 
6.2-3 Slope-Intercept and Standard forms
6.2-3 Slope-Intercept and Standard forms6.2-3 Slope-Intercept and Standard forms
6.2-3 Slope-Intercept and Standard formskjmonopoly7311
 
Maths questions with solutions
Maths questions with solutionsMaths questions with solutions
Maths questions with solutionsPid Ahas
 
Tutorials--Rational Expressions
Tutorials--Rational ExpressionsTutorials--Rational Expressions
Tutorials--Rational ExpressionsMedia4math
 
โจทย์ Java
โจทย์ Javaโจทย์ Java
โจทย์ Javaxuou888
 
Forms of Quadratics
Forms of QuadraticsForms of Quadratics
Forms of Quadraticsmrodolewicz
 

What's hot (17)

Grincon U.S. 2019 Grin Privacy and Scaling
Grincon U.S. 2019 Grin Privacy and ScalingGrincon U.S. 2019 Grin Privacy and Scaling
Grincon U.S. 2019 Grin Privacy and Scaling
 
Py9 3
Py9 3Py9 3
Py9 3
 
Roots With Calc2
Roots With Calc2Roots With Calc2
Roots With Calc2
 
Thesis PPT
Thesis PPTThesis PPT
Thesis PPT
 
Answers+of+C+sample+exam.docx
Answers+of+C+sample+exam.docxAnswers+of+C+sample+exam.docx
Answers+of+C+sample+exam.docx
 
Ib maths sl derivatives of transcendental functions
Ib maths sl derivatives of transcendental functionsIb maths sl derivatives of transcendental functions
Ib maths sl derivatives of transcendental functions
 
Difference of two squares
Difference of two squaresDifference of two squares
Difference of two squares
 
Math hssc-ii-a1
Math hssc-ii-a1Math hssc-ii-a1
Math hssc-ii-a1
 
Module 6.7
Module 6.7Module 6.7
Module 6.7
 
MFC Map1
MFC Map1MFC Map1
MFC Map1
 
Exercise #19
Exercise #19Exercise #19
Exercise #19
 
Unicamp 2015 - aberta
Unicamp 2015 - abertaUnicamp 2015 - aberta
Unicamp 2015 - aberta
 
6.2-3 Slope-Intercept and Standard forms
6.2-3 Slope-Intercept and Standard forms6.2-3 Slope-Intercept and Standard forms
6.2-3 Slope-Intercept and Standard forms
 
Maths questions with solutions
Maths questions with solutionsMaths questions with solutions
Maths questions with solutions
 
Tutorials--Rational Expressions
Tutorials--Rational ExpressionsTutorials--Rational Expressions
Tutorials--Rational Expressions
 
โจทย์ Java
โจทย์ Javaโจทย์ Java
โจทย์ Java
 
Forms of Quadratics
Forms of QuadraticsForms of Quadratics
Forms of Quadratics
 

Similar to 12 - Scala. Empty and unit types

19 - Scala. Eliminators into dependent types (induction)
19 - Scala. Eliminators into dependent types (induction)19 - Scala. Eliminators into dependent types (induction)
19 - Scala. Eliminators into dependent types (induction)Roman Brovko
 
Eliminators into dependent types
Eliminators into dependent typesEliminators into dependent types
Eliminators into dependent typesDmytro Mitin
 
04 - Scala. Type of natural numbers
04 - Scala. Type of natural numbers04 - Scala. Type of natural numbers
04 - Scala. Type of natural numbersRoman Brovko
 
03 - Scala. Boolean type
03 - Scala. Boolean type03 - Scala. Boolean type
03 - Scala. Boolean typeRoman Brovko
 
09 - Scala. Product type
09 - Scala. Product type09 - Scala. Product type
09 - Scala. Product typeRoman Brovko
 
13 - Scala. Dependent pair type (Σ-type)
13 - Scala. Dependent pair type (Σ-type)13 - Scala. Dependent pair type (Σ-type)
13 - Scala. Dependent pair type (Σ-type)Roman Brovko
 
16 - Scala. Type of length-indexed vectors
16 - Scala. Type of length-indexed vectors16 - Scala. Type of length-indexed vectors
16 - Scala. Type of length-indexed vectorsRoman Brovko
 
A One-Pass Triclustering Approach: Is There any Room for Big Data?
A One-Pass Triclustering Approach: Is There any Room for Big Data?A One-Pass Triclustering Approach: Is There any Room for Big Data?
A One-Pass Triclustering Approach: Is There any Room for Big Data?Dmitrii Ignatov
 
15 - Scala. Dependent function type (Π-type)
15 - Scala. Dependent function type (Π-type)15 - Scala. Dependent function type (Π-type)
15 - Scala. Dependent function type (Π-type)Roman Brovko
 
Introduction to cython: example of GCoptimization
Introduction to cython: example of GCoptimizationIntroduction to cython: example of GCoptimization
Introduction to cython: example of GCoptimizationKevin Keraudren
 
TreatJS: Higher-Order Contracts for JavaScripts
TreatJS: Higher-Order Contracts for JavaScriptsTreatJS: Higher-Order Contracts for JavaScripts
TreatJS: Higher-Order Contracts for JavaScriptsMatthias Keil
 

Similar to 12 - Scala. Empty and unit types (20)

19 - Scala. Eliminators into dependent types (induction)
19 - Scala. Eliminators into dependent types (induction)19 - Scala. Eliminators into dependent types (induction)
19 - Scala. Eliminators into dependent types (induction)
 
Eliminators into dependent types
Eliminators into dependent typesEliminators into dependent types
Eliminators into dependent types
 
04 - Scala. Type of natural numbers
04 - Scala. Type of natural numbers04 - Scala. Type of natural numbers
04 - Scala. Type of natural numbers
 
03 - Scala. Boolean type
03 - Scala. Boolean type03 - Scala. Boolean type
03 - Scala. Boolean type
 
09 - Scala. Product type
09 - Scala. Product type09 - Scala. Product type
09 - Scala. Product type
 
Sigma type
Sigma typeSigma type
Sigma type
 
13 - Scala. Dependent pair type (Σ-type)
13 - Scala. Dependent pair type (Σ-type)13 - Scala. Dependent pair type (Σ-type)
13 - Scala. Dependent pair type (Σ-type)
 
16 - Scala. Type of length-indexed vectors
16 - Scala. Type of length-indexed vectors16 - Scala. Type of length-indexed vectors
16 - Scala. Type of length-indexed vectors
 
sheet6.pdf
sheet6.pdfsheet6.pdf
sheet6.pdf
 
doc6.pdf
doc6.pdfdoc6.pdf
doc6.pdf
 
paper6.pdf
paper6.pdfpaper6.pdf
paper6.pdf
 
lecture5.pdf
lecture5.pdflecture5.pdf
lecture5.pdf
 
additional.pptx
additional.pptxadditional.pptx
additional.pptx
 
A One-Pass Triclustering Approach: Is There any Room for Big Data?
A One-Pass Triclustering Approach: Is There any Room for Big Data?A One-Pass Triclustering Approach: Is There any Room for Big Data?
A One-Pass Triclustering Approach: Is There any Room for Big Data?
 
Presentation.pdf
Presentation.pdfPresentation.pdf
Presentation.pdf
 
Lec7.ppt
Lec7.pptLec7.ppt
Lec7.ppt
 
15 - Scala. Dependent function type (Π-type)
15 - Scala. Dependent function type (Π-type)15 - Scala. Dependent function type (Π-type)
15 - Scala. Dependent function type (Π-type)
 
Calculus
CalculusCalculus
Calculus
 
Introduction to cython: example of GCoptimization
Introduction to cython: example of GCoptimizationIntroduction to cython: example of GCoptimization
Introduction to cython: example of GCoptimization
 
TreatJS: Higher-Order Contracts for JavaScripts
TreatJS: Higher-Order Contracts for JavaScriptsTreatJS: Higher-Order Contracts for JavaScripts
TreatJS: Higher-Order Contracts for JavaScripts
 

More from Roman Brovko

Individual task Networking
Individual task NetworkingIndividual task Networking
Individual task NetworkingRoman Brovko
 
Networking essentials lect3
Networking essentials lect3Networking essentials lect3
Networking essentials lect3Roman Brovko
 
Gl embedded starterkit_ethernet
Gl embedded starterkit_ethernetGl embedded starterkit_ethernet
Gl embedded starterkit_ethernetRoman Brovko
 
Networking essentials lect2
Networking essentials lect2Networking essentials lect2
Networking essentials lect2Roman Brovko
 
Networking essentials lect1
Networking essentials lect1Networking essentials lect1
Networking essentials lect1Roman Brovko
 
Bare metal training_07_spi_flash
Bare metal training_07_spi_flashBare metal training_07_spi_flash
Bare metal training_07_spi_flashRoman Brovko
 
Bare metal training_06_I2C
Bare metal training_06_I2CBare metal training_06_I2C
Bare metal training_06_I2CRoman Brovko
 
Bare metal training_05_uart
Bare metal training_05_uartBare metal training_05_uart
Bare metal training_05_uartRoman Brovko
 
Bare metal training_04_adc_temp_sensor
Bare metal training_04_adc_temp_sensorBare metal training_04_adc_temp_sensor
Bare metal training_04_adc_temp_sensorRoman Brovko
 
Bare metal training_03_timers_pwm
Bare metal training_03_timers_pwmBare metal training_03_timers_pwm
Bare metal training_03_timers_pwmRoman Brovko
 
Bare metal training_02_le_ds_and_buttons
Bare metal training_02_le_ds_and_buttonsBare metal training_02_le_ds_and_buttons
Bare metal training_02_le_ds_and_buttonsRoman Brovko
 
Bare metal training_01_hello_world
Bare metal training_01_hello_worldBare metal training_01_hello_world
Bare metal training_01_hello_worldRoman Brovko
 
Bare metal training_00_prerequisites
Bare metal training_00_prerequisitesBare metal training_00_prerequisites
Bare metal training_00_prerequisitesRoman Brovko
 
C language lect_23_advanced
C language lect_23_advancedC language lect_23_advanced
C language lect_23_advancedRoman Brovko
 
C language lect_22_advanced
C language lect_22_advancedC language lect_22_advanced
C language lect_22_advancedRoman Brovko
 
C language lect_21_advanced
C language lect_21_advancedC language lect_21_advanced
C language lect_21_advancedRoman Brovko
 
подготовка рабочего окружения
подготовка рабочего окруженияподготовка рабочего окружения
подготовка рабочего окруженияRoman Brovko
 
C language lect_20_advanced
C language lect_20_advancedC language lect_20_advanced
C language lect_20_advancedRoman Brovko
 
C language lect_19_basics
C language lect_19_basicsC language lect_19_basics
C language lect_19_basicsRoman Brovko
 

More from Roman Brovko (20)

Individual task Networking
Individual task NetworkingIndividual task Networking
Individual task Networking
 
Networking essentials lect3
Networking essentials lect3Networking essentials lect3
Networking essentials lect3
 
Gl embedded starterkit_ethernet
Gl embedded starterkit_ethernetGl embedded starterkit_ethernet
Gl embedded starterkit_ethernet
 
Networking essentials lect2
Networking essentials lect2Networking essentials lect2
Networking essentials lect2
 
Networking essentials lect1
Networking essentials lect1Networking essentials lect1
Networking essentials lect1
 
Bare metal training_07_spi_flash
Bare metal training_07_spi_flashBare metal training_07_spi_flash
Bare metal training_07_spi_flash
 
Bare metal training_06_I2C
Bare metal training_06_I2CBare metal training_06_I2C
Bare metal training_06_I2C
 
Glesk worshop
Glesk worshopGlesk worshop
Glesk worshop
 
Bare metal training_05_uart
Bare metal training_05_uartBare metal training_05_uart
Bare metal training_05_uart
 
Bare metal training_04_adc_temp_sensor
Bare metal training_04_adc_temp_sensorBare metal training_04_adc_temp_sensor
Bare metal training_04_adc_temp_sensor
 
Bare metal training_03_timers_pwm
Bare metal training_03_timers_pwmBare metal training_03_timers_pwm
Bare metal training_03_timers_pwm
 
Bare metal training_02_le_ds_and_buttons
Bare metal training_02_le_ds_and_buttonsBare metal training_02_le_ds_and_buttons
Bare metal training_02_le_ds_and_buttons
 
Bare metal training_01_hello_world
Bare metal training_01_hello_worldBare metal training_01_hello_world
Bare metal training_01_hello_world
 
Bare metal training_00_prerequisites
Bare metal training_00_prerequisitesBare metal training_00_prerequisites
Bare metal training_00_prerequisites
 
C language lect_23_advanced
C language lect_23_advancedC language lect_23_advanced
C language lect_23_advanced
 
C language lect_22_advanced
C language lect_22_advancedC language lect_22_advanced
C language lect_22_advanced
 
C language lect_21_advanced
C language lect_21_advancedC language lect_21_advanced
C language lect_21_advanced
 
подготовка рабочего окружения
подготовка рабочего окруженияподготовка рабочего окружения
подготовка рабочего окружения
 
C language lect_20_advanced
C language lect_20_advancedC language lect_20_advanced
C language lect_20_advanced
 
C language lect_19_basics
C language lect_19_basicsC language lect_19_basics
C language lect_19_basics
 

Recently uploaded

Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 

Recently uploaded (20)

Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 

12 - Scala. Empty and unit types

  • 1. Empty and unit types Dmytro Mitin https://stepik.org/course/Introduction-to-programming- with-dependent-types-in-Scala-2294/ March 2017 Dmytro Mitin Empty and unit types
  • 2. Sets Empty set ∅ Set with one element {∅} Dmytro Mitin Empty and unit types
  • 3. Empty type 1 Type Formation Γ ctx Γ 0 : ∗ 2 Constructor 3 Eliminator Γ C : ∗ Γ, x : 0 abortC x : C 4 Computation rule (”β-reduction“) 5 Uniqueness principle (”η-conversion“) Γ c : C Γ, x : 0 abortC x ≡ c : C Dmytro Mitin Empty and unit types
  • 4. Unit type 1 Type Formation Γ ctx Γ 1 : ∗ 2 Constructor Γ ctx Γ 1 : 1 3 Eliminator Γ c : C Γ, x : 1 case1(x)(c) : C x match { case () => c } Dmytro Mitin Empty and unit types
  • 5. Unit type 4 Computation rule (”β-reduction“) Γ c : C Γ case1(1)(c) ≡ c : C 5 Uniqueness principle (”η-conversion“) Γ C : ∗ Γ, x : 1 c : C Γ, y : 1 case1(y)(c) [x ← 1] ≡ c[x ← y] : C Dmytro Mitin Empty and unit types
  • 6. Haskell, Scala and Java Haskell () :: () Scala () : Unit Nothing null : Null Java void Void null Dmytro Mitin Empty and unit types
  • 7. ProvingGround git clone https://github.com/siddhartha-gadgil/ProvingGround.git cd ProvingGround sbt mantle/test:console Zero val A = "A" :: Type val recZA = Zero.rec(A) val z = "z" :: Zero recZA(z) !: A Star !: Unit val recUA = Unit.rec(A) recUA(a)(Star) == a Dmytro Mitin Empty and unit types