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

"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
 
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
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
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
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
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
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
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
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
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
 

Recently uploaded (20)

"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
 
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
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
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
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
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
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
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)
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
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
 

Propositional logic for Beginners

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