SlideShare ist ein Scribd-Unternehmen logo
1 von 53
Downloaden Sie, um offline zu lesen
Equality is Hard
paul phillips
lambdaconf 2016
Too hard. It's not even 10AM.
If A = B, does F[A] = F[B] ?
• A ma&er of overriding interest to func4onal programmers
• Subs4tu4on is the founda4on of equa4onal reasoning
• Without subs4tu4on, we are lost
Boolean values
in a nutshell
The meaning of a
ques/on is the method
of answering it. Tell me
how you are searching,
and I will tell you what
you are searching for.
Two possible truth values?
"Are you s*ll abusing animals?"
"This statement is false."
"The program will halt."
• I don't know.
• I don't know yet.
• I forgot.
• Pre2y sure.
• Doub7ul.
• The ques<on is nonsense.
Category Theory
in a nutshell
It depends on what the
meaning of the word
'is' is.
Classical logic
in a nutshell
Two truth values ought
to be enough for
anybody.
Nega%on: not without its problems
Classical logic: p <=> !!p
Intuitionist: p => !!p
Paraconsistent: p <= !!p
Intui&onist: even if p is not false, that doesn't make it true
Paraconsistent: even if p is true, that doesn't mean it isn't false
Is nega(on inver(ble?
• He's certainly a/rac0ve.
• He's certainly una/rac0ve.
• He's certainly not una/rac0ve...
Is nega(on inver(ble?
• The boss has accepted my plan.
• The boss has rejected my plan.
• The boss has not rejected my plan.
Is nega(on inver(ble?
• There is evidence he is at fault.
• There is no evidence he is at fault.
• There is no evidence he is not at fault.
I'm exploi+ng natural language.
Maybe it's chea-ng.
But what do Boolean values encode?
Taking the principle of
excluded middle from
the mathema5cian
would be like
proscribing the boxer
the use of his fists.
Object-oriented equality
in a nutshell
All instances are equal,
but some instances are
more equal than
others.
Equality depends desperately on symmetry.
Um.
trait Any {
def ==(x: Any): Bool
def !=(x: Any): Bool = !(this == x)
}
trait AnyRef extends Any {
def eq(x: AnyRef): Bool
def ne(x: AnyRef): Bool = !(this eq x)
}
Floa%ng point equality
in a nutshell
The worst form of
inequality is to try to
make unequal things
equal.
FP equality is fish in a barrel, sure.
Why then is it s*ll to be found?
def s1(n: Int) = 0.1 * n
def s2(n: Int) = Stream continually 0.1 take n reduceLeft (_ + _)
def s3(n: Int) = BigDecimal("0." + n)
1 to 9 map (n => Seq(
s1(n) == s2(n),
s2(n) == s3(n),
s3(n) == s1(n)
))
TTT
TTT
TFF
TTT
TTT
FTF
FTF
FFT
FFT
TTT
TTT
TFF
TTT
TTT
FTF
FTF
FFT
FFT
Booleans without totality
in a nutshell
He said to his friend, "If the Bri2sh march
By land or sea from the town to-night,
Hang a lantern alo+ in the belfry arch
Of the North Church tower as a signal light,
Zero if by land, and one if by sea;
And I on the opposite shore will be...
Overspecifica+on
in a nutshell
The difficulty in
philosophy is to say no
more than we know.
We habitually work with values
which convey total certainty boiled
down to a single bit.
Is this the most robust approach?
A typical scala compiler method.
def isMethodWithExtension = (
isMethod
&& owner.isDerivedValueClass
&& !isParamAccessor
&& !isConstructor
&& !hasFlag(SUPERACCESSOR)
&& !isMacro
&& !isSpecialized
)
ex falso quodlibet
in a nutshell
You get tragedy where
the tree, instead of
bending, breaks.
The principle of explosion
Rejected by paraconsistent "inconsistency
tolerant" logics
You can have it all
True or False? Why stop at one?
Logic is a system for preserving some property
across logical opera3ons.
• Classical logic: truth
• Intui0onist logic: jus'fica'on
• Probability logic: likelihood
Laws to consider repealing
• Law of non-contradic/on: !(p && !p)
"Contradictory statements cannot both be true."
• Law of the excluded middle: p || !p
"Either a proposi/on is true or its nega/on is true."
Ari$es of truthiness.
_0 = Void // The void stares back at you
_1 = Unit // Indifference logic
_2 = Bool // You Are Here
_3 = Opt[Bool] // billion dollar mistake?
_4 = Bool x Bool // Is it true? Y/N Is it false? Y/N
R = [0,1) // Fuzzy, possibility, probability logics
Setoids
In a nutshell
Whereof one cannot
speak, thereof one
must be silent.
A setoid is a set equipped with an
equivalence rela1on.
A construc(ve setoid is equipped
with an apartness rela1on.
Boolean Blindness
To make use of a Boolean you have to know its provenance so that
you can know what it means.
Haskell
class Eq a where
(==) :: a -> a -> Bool
I know, "performance"
data Compared a =
Equal a a
| DisEqual a a
| Incomparable
class Eq a where
(==) :: a -> a -> Compared a
Laws: do not confuse with fallacies
PhilosphyProgramming
is a ba0le against the
bewitchment of our
intelligence by means
of our language.
The purpose of
abstrac/on is not to be
vague, but to create a
new seman/c level in
which one can be
absolutely precise.
The real founda-ons
of his enquiry do not
strike a man at all.
Unless that fact has at
some -me struck him.
[Wi$genstein] says
every morning he
begins his work with
hope, and every
evening he ends in
despair.
If a lion could talk, we
could not understand
him.
If you want to learn
more about the law of
the excluded middle,
take a voyage down to
your public library. It's
all in books!

Weitere ähnliche Inhalte

Ähnlich wie Keynote, Lambdaconf 2016 - Equality is Hard

First meeting
First meetingFirst meeting
First meetingbutest
 
Supervised learning: Types of Machine Learning
Supervised learning: Types of Machine LearningSupervised learning: Types of Machine Learning
Supervised learning: Types of Machine LearningLibya Thomas
 
Section 8 Programming Style and Your Brain: Douglas Crockford
Section 8 Programming Style and Your Brain: Douglas CrockfordSection 8 Programming Style and Your Brain: Douglas Crockford
Section 8 Programming Style and Your Brain: Douglas Crockfordjaxconf
 
optimizedBell.pptx
optimizedBell.pptxoptimizedBell.pptx
optimizedBell.pptxRichard Gill
 
Ilja state2014expressivity
Ilja state2014expressivityIlja state2014expressivity
Ilja state2014expressivitymaartenmarx
 
Peter Norvig - NYC Machine Learning 2013
Peter Norvig - NYC Machine Learning 2013Peter Norvig - NYC Machine Learning 2013
Peter Norvig - NYC Machine Learning 2013Michael Scovetta
 
Bisection & Regual falsi methods
Bisection & Regual falsi methodsBisection & Regual falsi methods
Bisection & Regual falsi methodsDivya Bhatia
 
A JavaScript Master Class - From the Wows to the WTFs
A JavaScript Master Class - From the Wows to the WTFsA JavaScript Master Class - From the Wows to the WTFs
A JavaScript Master Class - From the Wows to the WTFsShahriar Hyder
 
Seeking Simplicity by Phil Nash (codeHarbour June 2019)
Seeking Simplicity by Phil Nash (codeHarbour June 2019)Seeking Simplicity by Phil Nash (codeHarbour June 2019)
Seeking Simplicity by Phil Nash (codeHarbour June 2019)Alex Cachia
 
Diagnosing cancer with Computational Intelligence
Diagnosing cancer with Computational IntelligenceDiagnosing cancer with Computational Intelligence
Diagnosing cancer with Computational IntelligenceSimon van Dyk
 
A Generative Model for Joint Natural Language Understanding and Generation
A Generative Model for Joint Natural Language Understanding and GenerationA Generative Model for Joint Natural Language Understanding and Generation
A Generative Model for Joint Natural Language Understanding and Generationtaeseon ryu
 
Pwl rewal-slideshare
Pwl rewal-slidesharePwl rewal-slideshare
Pwl rewal-slidesharepalvaro
 
Logic programming (1)
Logic programming (1)Logic programming (1)
Logic programming (1)Nitesh Singh
 
Mathreasoning
MathreasoningMathreasoning
MathreasoningAza Alias
 

Ähnlich wie Keynote, Lambdaconf 2016 - Equality is Hard (20)

L07 msr
L07 msrL07 msr
L07 msr
 
Ruby Gotchas
Ruby GotchasRuby Gotchas
Ruby Gotchas
 
First meeting
First meetingFirst meeting
First meeting
 
Supervised learning: Types of Machine Learning
Supervised learning: Types of Machine LearningSupervised learning: Types of Machine Learning
Supervised learning: Types of Machine Learning
 
Section 8 Programming Style and Your Brain: Douglas Crockford
Section 8 Programming Style and Your Brain: Douglas CrockfordSection 8 Programming Style and Your Brain: Douglas Crockford
Section 8 Programming Style and Your Brain: Douglas Crockford
 
optimizedBell.pptx
optimizedBell.pptxoptimizedBell.pptx
optimizedBell.pptx
 
Ilja state2014expressivity
Ilja state2014expressivityIlja state2014expressivity
Ilja state2014expressivity
 
True but Unprovable
True but UnprovableTrue but Unprovable
True but Unprovable
 
Peter Norvig - NYC Machine Learning 2013
Peter Norvig - NYC Machine Learning 2013Peter Norvig - NYC Machine Learning 2013
Peter Norvig - NYC Machine Learning 2013
 
Bisection & Regual falsi methods
Bisection & Regual falsi methodsBisection & Regual falsi methods
Bisection & Regual falsi methods
 
A JavaScript Master Class - From the Wows to the WTFs
A JavaScript Master Class - From the Wows to the WTFsA JavaScript Master Class - From the Wows to the WTFs
A JavaScript Master Class - From the Wows to the WTFs
 
Seeking Simplicity by Phil Nash (codeHarbour June 2019)
Seeking Simplicity by Phil Nash (codeHarbour June 2019)Seeking Simplicity by Phil Nash (codeHarbour June 2019)
Seeking Simplicity by Phil Nash (codeHarbour June 2019)
 
Diagnosing cancer with Computational Intelligence
Diagnosing cancer with Computational IntelligenceDiagnosing cancer with Computational Intelligence
Diagnosing cancer with Computational Intelligence
 
4535092.ppt
4535092.ppt4535092.ppt
4535092.ppt
 
A Generative Model for Joint Natural Language Understanding and Generation
A Generative Model for Joint Natural Language Understanding and GenerationA Generative Model for Joint Natural Language Understanding and Generation
A Generative Model for Joint Natural Language Understanding and Generation
 
Pwl rewal-slideshare
Pwl rewal-slidesharePwl rewal-slideshare
Pwl rewal-slideshare
 
Logic programming (1)
Logic programming (1)Logic programming (1)
Logic programming (1)
 
continuity of module 2.pptx
continuity of module 2.pptxcontinuity of module 2.pptx
continuity of module 2.pptx
 
Mathreasoning
MathreasoningMathreasoning
Mathreasoning
 
Pigeon hole principle
Pigeon hole principlePigeon hole principle
Pigeon hole principle
 

Kürzlich hochgeladen

TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024Mind IT Systems
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdfPearlKirahMaeRagusta1
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastPapp Krisztián
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durbanmasabamasaba
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareJim McKeeth
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...masabamasaba
 

Kürzlich hochgeladen (20)

TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 

Keynote, Lambdaconf 2016 - Equality is Hard