SlideShare a Scribd company logo
1 of 15
Propositional Logic for Programmers ,[object Object]
Propositions ,[object Object],[object Object],[object Object],[object Object]
[object Object],¬ (NOT) ∧  (AND) ∨  (OR) P Q P ∧ Q TRUE TRUE TRUE TRUE FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE P Q P ∨ Q TRUE TRUE TRUE TRUE FALSE TRUE FALSE TRUE TRUE FALSE FALSE FALSE P ¬ P TRUE FALSE FALSE TRUE
[object Object],For a given proposition - express results for all combinations of inputs. P Q ¬  P ∨ ( P ∧ Q ) TRUE TRUE TRUE TRUE FALSE FALSE FALSE TRUE TRUE FALSE FALSE TRUE
[object Object],[object Object],[object Object],[object Object],[object Object]
P ∧ ( ¬ Q ∨ P)
[object Object],Two propositions are equivalent if their truth tables are the same. P Q P ∧ ( ¬ Q ∨ P) TRUE TRUE TRUE TRUE FALSE TRUE FALSE TRUE FALSE FALSE FALSE FALSE
[object Object],¬  (P ∧ Q) ===  ¬ P ∨  ¬ Q ¬  (P ∨ Q) ===  ¬ P ∧  ¬ Q
[object Object],Some operations *unavoidably* cost more than others to execute. Aim: Juggle evaluation order so lower cost operations are evaluated first and if possible reduce the number of calls to more expensive operations.
[object Object],Eager - Will evaluate both sides of expression. Lazy (Short Circuit) - Will only evaluate RHS of expression if will effect return. (Most developers use lazy without realising the full implication) Operator C-Standard Lazy C-Standard Eager ¬  (NOT) ! ! ∧  (AND) && & ∨  (OR) || |
[object Object],class A {      int _a;      public awesome() {          _a++;          return true;      }      public freakin() {          return true;      } } a.awesome() && a.freakin() > true (A._a == 1) a.freakin() && a.awesome() > true (A._a == 0) Make sure you understand the side effects of methods before refactoring expressions.
[object Object],[object Object],[object Object]
[object Object],Succeeds where the first proposition is true. Therefore - if we can express a statement with a cheap successful first proposition, then we limit the number of calls to second proposition.
Example ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object]

More Related Content

Viewers also liked

#3 formal methods – propositional logic
#3 formal methods – propositional logic#3 formal methods – propositional logic
#3 formal methods – propositional logicSharif Omar Salem
 
Propositional logic
Propositional logicPropositional logic
Propositional logicRushdi Shams
 
Syntax and semantics of propositional logic
Syntax and semantics of propositional logicSyntax and semantics of propositional logic
Syntax and semantics of propositional logicJanet Stemwedel
 
Predicate Logic
Predicate LogicPredicate Logic
Predicate Logicgiki67
 
03 - Predicate logic
03 - Predicate logic03 - Predicate logic
03 - Predicate logicTudor Girba
 
Knowledge representation and Predicate logic
Knowledge representation and Predicate logicKnowledge representation and Predicate logic
Knowledge representation and Predicate logicAmey Kerkar
 
On your soap box presentation
On your soap box presentationOn your soap box presentation
On your soap box presentationRob McIver
 
Search Engine Optimisation Waterford
Search Engine Optimisation WaterfordSearch Engine Optimisation Waterford
Search Engine Optimisation Waterfordcianmurphy85
 
Think together, talk together
Think together, talk togetherThink together, talk together
Think together, talk togetherRob McIver
 
Monash net neutrality 2202 2012
Monash net neutrality 2202 2012Monash net neutrality 2202 2012
Monash net neutrality 2202 2012Chris Marsden
 
Sunderland early years web ver
Sunderland early years web verSunderland early years web ver
Sunderland early years web verRob McIver
 
Durham dads and male carers into museums
Durham dads and male carers into museumsDurham dads and male carers into museums
Durham dads and male carers into museumsRob McIver
 
Public policy and online social networks: The trillion dollar zombie question
Public policy and online social networks: The trillion dollar zombie questionPublic policy and online social networks: The trillion dollar zombie question
Public policy and online social networks: The trillion dollar zombie questionChris Marsden
 
A2 Media Studies - Teaser Traile
A2 Media Studies -  Teaser TraileA2 Media Studies -  Teaser Traile
A2 Media Studies - Teaser Trailevorkekgbeke
 
Embedding museums in times of change
Embedding museums in times of changeEmbedding museums in times of change
Embedding museums in times of changeRob McIver
 
Photography Effects
Photography EffectsPhotography Effects
Photography EffectsAxel Millán
 
Whats happening in education 2011
Whats happening in education 2011Whats happening in education 2011
Whats happening in education 2011Rob McIver
 
#IFCLA2014 keynote 'Open internet and Open access to law'
#IFCLA2014 keynote 'Open internet and Open access to law'#IFCLA2014 keynote 'Open internet and Open access to law'
#IFCLA2014 keynote 'Open internet and Open access to law'Chris Marsden
 

Viewers also liked (20)

#3 formal methods – propositional logic
#3 formal methods – propositional logic#3 formal methods – propositional logic
#3 formal methods – propositional logic
 
Propositional logic
Propositional logicPropositional logic
Propositional logic
 
Syntax and semantics of propositional logic
Syntax and semantics of propositional logicSyntax and semantics of propositional logic
Syntax and semantics of propositional logic
 
Propositional logic
Propositional logicPropositional logic
Propositional logic
 
Propositional logic
Propositional logicPropositional logic
Propositional logic
 
Predicate Logic
Predicate LogicPredicate Logic
Predicate Logic
 
03 - Predicate logic
03 - Predicate logic03 - Predicate logic
03 - Predicate logic
 
Knowledge representation and Predicate logic
Knowledge representation and Predicate logicKnowledge representation and Predicate logic
Knowledge representation and Predicate logic
 
On your soap box presentation
On your soap box presentationOn your soap box presentation
On your soap box presentation
 
Search Engine Optimisation Waterford
Search Engine Optimisation WaterfordSearch Engine Optimisation Waterford
Search Engine Optimisation Waterford
 
Think together, talk together
Think together, talk togetherThink together, talk together
Think together, talk together
 
Monash net neutrality 2202 2012
Monash net neutrality 2202 2012Monash net neutrality 2202 2012
Monash net neutrality 2202 2012
 
Sunderland early years web ver
Sunderland early years web verSunderland early years web ver
Sunderland early years web ver
 
Durham dads and male carers into museums
Durham dads and male carers into museumsDurham dads and male carers into museums
Durham dads and male carers into museums
 
Public policy and online social networks: The trillion dollar zombie question
Public policy and online social networks: The trillion dollar zombie questionPublic policy and online social networks: The trillion dollar zombie question
Public policy and online social networks: The trillion dollar zombie question
 
A2 Media Studies - Teaser Traile
A2 Media Studies -  Teaser TraileA2 Media Studies -  Teaser Traile
A2 Media Studies - Teaser Traile
 
Embedding museums in times of change
Embedding museums in times of changeEmbedding museums in times of change
Embedding museums in times of change
 
Photography Effects
Photography EffectsPhotography Effects
Photography Effects
 
Whats happening in education 2011
Whats happening in education 2011Whats happening in education 2011
Whats happening in education 2011
 
#IFCLA2014 keynote 'Open internet and Open access to law'
#IFCLA2014 keynote 'Open internet and Open access to law'#IFCLA2014 keynote 'Open internet and Open access to law'
#IFCLA2014 keynote 'Open internet and Open access to law'
 

Similar to Propositional logic for Beginners

Unit Testing Presentation
Unit Testing PresentationUnit Testing Presentation
Unit Testing Presentationnicobn
 
R Programming: Comparing Objects In R
R Programming: Comparing Objects In RR Programming: Comparing Objects In R
R Programming: Comparing Objects In RRsquared Academy
 
Scala as a Declarative Language
Scala as a Declarative LanguageScala as a Declarative Language
Scala as a Declarative Languagevsssuresh
 
C Sharp Jn (2)
C Sharp Jn (2)C Sharp Jn (2)
C Sharp Jn (2)jahanullah
 
Multinomial Model Simulations
Multinomial Model SimulationsMultinomial Model Simulations
Multinomial Model Simulationstim_hare
 
Implementing External DSLs Using Scala Parser Combinators
Implementing External DSLs Using Scala Parser CombinatorsImplementing External DSLs Using Scala Parser Combinators
Implementing External DSLs Using Scala Parser CombinatorsTim Dalton
 
Php-Continuation
Php-ContinuationPhp-Continuation
Php-Continuationlotlot
 
Rewriting Java In Scala
Rewriting Java In ScalaRewriting Java In Scala
Rewriting Java In ScalaSkills Matter
 
Operators
OperatorsOperators
OperatorsKamran
 
Otter 2016-11-28-01-ss
Otter 2016-11-28-01-ssOtter 2016-11-28-01-ss
Otter 2016-11-28-01-ssRuo Ando
 
Lecture-3-and-4.pdf
Lecture-3-and-4.pdfLecture-3-and-4.pdf
Lecture-3-and-4.pdfssuserc478ac
 
TMPA-2017: The Quest for Average Response Time
TMPA-2017: The Quest for Average Response TimeTMPA-2017: The Quest for Average Response Time
TMPA-2017: The Quest for Average Response TimeIosif Itkin
 
Fuzzing and Verifying RAT Refutations with Deletion Information
Fuzzing and Verifying RAT Refutations with Deletion InformationFuzzing and Verifying RAT Refutations with Deletion Information
Fuzzing and Verifying RAT Refutations with Deletion InformationTobias Philipp
 

Similar to Propositional logic for Beginners (20)

Unit Testing Presentation
Unit Testing PresentationUnit Testing Presentation
Unit Testing Presentation
 
Dismath part2 2013
Dismath part2 2013Dismath part2 2013
Dismath part2 2013
 
DISMATH_Part2
DISMATH_Part2DISMATH_Part2
DISMATH_Part2
 
R Programming: Comparing Objects In R
R Programming: Comparing Objects In RR Programming: Comparing Objects In R
R Programming: Comparing Objects In R
 
DISMATH_Part1
DISMATH_Part1DISMATH_Part1
DISMATH_Part1
 
Scala as a Declarative Language
Scala as a Declarative LanguageScala as a Declarative Language
Scala as a Declarative Language
 
C Sharp Jn (2)
C Sharp Jn (2)C Sharp Jn (2)
C Sharp Jn (2)
 
C Sharp Jn (2)
C Sharp Jn (2)C Sharp Jn (2)
C Sharp Jn (2)
 
Dicrete structure
Dicrete structureDicrete structure
Dicrete structure
 
Multinomial Model Simulations
Multinomial Model SimulationsMultinomial Model Simulations
Multinomial Model Simulations
 
Implementing External DSLs Using Scala Parser Combinators
Implementing External DSLs Using Scala Parser CombinatorsImplementing External DSLs Using Scala Parser Combinators
Implementing External DSLs Using Scala Parser Combinators
 
Php-Continuation
Php-ContinuationPhp-Continuation
Php-Continuation
 
Rewriting Java In Scala
Rewriting Java In ScalaRewriting Java In Scala
Rewriting Java In Scala
 
Operators
OperatorsOperators
Operators
 
Issta13 workshop on debugging
Issta13 workshop on debuggingIssta13 workshop on debugging
Issta13 workshop on debugging
 
Otter 2016-11-28-01-ss
Otter 2016-11-28-01-ssOtter 2016-11-28-01-ss
Otter 2016-11-28-01-ss
 
Lecture-3-and-4.pdf
Lecture-3-and-4.pdfLecture-3-and-4.pdf
Lecture-3-and-4.pdf
 
TMPA-2017: The Quest for Average Response Time
TMPA-2017: The Quest for Average Response TimeTMPA-2017: The Quest for Average Response Time
TMPA-2017: The Quest for Average Response Time
 
Polynomials.pdf
Polynomials.pdfPolynomials.pdf
Polynomials.pdf
 
Fuzzing and Verifying RAT Refutations with Deletion Information
Fuzzing and Verifying RAT Refutations with Deletion InformationFuzzing and Verifying RAT Refutations with Deletion Information
Fuzzing and Verifying RAT Refutations with Deletion Information
 

Recently uploaded

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
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
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
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
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
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
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
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
 

Recently uploaded (20)

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
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
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
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...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 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
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
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
 

Propositional logic for Beginners

  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6. P ∧ ( ¬ Q ∨ P)
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.