SlideShare a Scribd company logo
1 of 23
Download to read offline
Truth, Deduction,
Computation
Lecture B
Quantifiers, part 1
Vlad Patryshev
SCU
2013
Folding ∨ and ∧
● P1∨P2∨...∨Pn - associativity!
● P1∧P2∧...∧Pn - associativity!

∨1..nPi
∧1..nPi
In Java
interface Predicate<X> {
public boolean check(X x);
}
boolean foreach<X>(Iterable<X> xs, Predicate<X> p) {
for (x: xs) if (!p.check(xs)) return false;
return true;
}
boolean exists<X>(Iterable<X> xs, Predicate<X> p) {
for (x: xs) if (p.check(xs)) return true;
return false;
}
In Scala
type Predicate[X] = X => Boolean

def foreach[X](xs: Iterable[X], p: Predicate[X]) = {
xs.foreach(p)
}

boolean exists[X](xs: Iterable[X], p: Predicate[X]) {
xs.exists(p)
}
In Scala

def foreach[X](xs: Iterable[X], p: X => Boolean) =
xs foreach p

boolean exists[X](xs: Iterable[X], p: X => Boolean) =
xs exists p
In Logic, take 1
● P1∨P2∨...∨Pn ->

∨1..nPi

∃i=1..nPi
● P1∧P2∧...∨Pn ->

∀i=1..nPi

∧1..nPi
In Logic, take 2: Example
● P1=Tet(a); P2=Small(b); P3=¬Red(c)
Not much to parameterize, all formulas are different…
● P1=Tet(a); P2=Tet(b); P3=Tet(c)
or:
● x1=a; x2=b; x3=c; Pi=Tet(xi)

∀i=1..nTet(xi) or ∃i=1..nTet(xi)

or:
● x1=a; x2=b; x3=c; Pi=Tet(xi)

(x)

∀x

in {a,b,c}

Tet(x) or ∃x

in {a,b,c}

Tet
In Logic, take 3
● Can we always enumerate arguments?
● e.g. all real numbers from [0,1]

We Need Variables!
In Logic, take 4: Introducing Variables
Anything that looks like an identifier
Even _ can do if we know what we mean
Scala:
List(1,2,3) exists (_ % 2 == 0)
Add Variables to Atomic Sentences
<atomic> ::= <predicateName>(<arguments>)
<predicateName> ::= <Capital>
<predicateName> ::= <Capital><letters>
<var> ::= /* choose a distinct set of words */
<name> ::= <objectName>|<var>
<arguments> ::= <name>|<arguments>,<name>
E.g. Left(x, a)
x is a variable
Variables in the Exercises
Build Formulas with Variables
● Tet(x)∧¬Cube(y)v(Left(a,x)∧Right(y,a))
● ∀x (Tet(x)∧(Left(a,x)∧Right(c,a))
● ∃x Between(x,a,b)
● ∀x ∀y ∃z Between(z,x,y)
Bound Variables
● Tet(x)∧¬Cube(y)v(Left(a,x)∧Right(y,a))
● ∀x (Tet(x)∧(Left(a,x)∧Right(y,a))
● ∃x Between(x,a,b)
● ∀x ∀y ∃z Between(z,x,y)
Formulas with Quantifiers, formally
<wff> ::= <atomic formula>
<wff> ::= ¬<wff>|(<wff>)
<wff> ::= <wff>v<wff>|<wff>∧<wff>
<wff> ::= <wff>→<wff>|<wff>↔<wff>
<wff> ::= ∀<var> <wff> // the var is bound here
<wff> ::= ∃<var> <wff> // the var is bound here
<sentence> ::= <wff /*where all vars are bound*/>
Satisfaction
A wff P(x) with an unbound variable x
is satisfied on a iff ⊨ P(a)

E.g. a small cube satisfies the formula
Cube(x) ∧ ¬ Large(x)
Satisfaction for Specific Formulas
Formula Kind How Satisfied
<atomic>

find an object or objects

¬P

find counterexample for P

PvQ

find something that satisfies at least one of
P and Q

P∧Q

find something that satisfies P and Q

∀x P

P is satisfied by all objects

∃x P

we can find an object that satisfies P
Problems with Domain
Formula Kind How Satisfied
<atomic>

find an object or objects

¬P

find counterexample for P

PvQ

find something that satisfies at least one of
P and Q

P∧Q

find something that satisfies P and Q

∀x P

P is satisfied by all objects

∃x P

we can find an object that satisfies P
Problems with Domain
● ∀x (Cube(x)∨Tet(x))
- how about 27? 28?
● ∃n (n*n > n*n*n)
- how about Claire’s cat?
Translating Aristotelian Forms
Aristotle says

We write

All P’s are Q’s

∀x (P(x) → Q(x))

Some P’s are Q’s

∃x (P(x) ∧ Q(x))

No P’s are Q’s

∀x (P(x) → ¬Q(x))

Some P’s are not Q’s

∃x (P(x) ∧ ¬Q(x))

How about
∃x (P(x) → Q(x))
Or, e.g., ∀y(Tet(y) → Small(y))
Ambiguousness with Aristotelian...
∀x (P(x) → ¬Q(x))
or
¬∃x (P(x) ∧ Q(x))
In Boolean logic, they are
semantically equivalent
In Plain English
Existential noun phrase involves “∃ x…”
Universal noun phrase involves “∀ x…”
Reformulating Previous Exercises
●
●

∀x ∀y ∀z ((FatherOf(x,y)∧FatherOf(y,z)) → Nicer(x,y))
∀x ∀y (¬Even(x+y) → Even(x*y))
That’s it for today

More Related Content

Viewers also liked

Directpurposefulexperiencesandbeyond 120713045550-phpapp01 (2)
Directpurposefulexperiencesandbeyond 120713045550-phpapp01 (2)Directpurposefulexperiencesandbeyond 120713045550-phpapp01 (2)
Directpurposefulexperiencesandbeyond 120713045550-phpapp01 (2)Rizelle Queen Decrito
 
What are tanks used for
What are tanks used forWhat are tanks used for
What are tanks used forTahunanui10
 
Trenches and barbwire
Trenches and barbwireTrenches and barbwire
Trenches and barbwireTahunanui10
 
Formal methods 6 - elements of algebra
Formal methods   6 - elements of algebraFormal methods   6 - elements of algebra
Formal methods 6 - elements of algebraVlad Patryshev
 
Formal methods 2 - languages and machines
Formal methods   2 - languages and machinesFormal methods   2 - languages and machines
Formal methods 2 - languages and machinesVlad Patryshev
 
Truth, deduction, computation lecture 7
Truth, deduction, computation   lecture 7Truth, deduction, computation   lecture 7
Truth, deduction, computation lecture 7Vlad Patryshev
 
Truth, deduction, computation; lecture 2
Truth, deduction, computation;   lecture 2Truth, deduction, computation;   lecture 2
Truth, deduction, computation; lecture 2Vlad Patryshev
 
Television Production Salary Report 2015
Television Production Salary Report 2015Television Production Salary Report 2015
Television Production Salary Report 2015Jacqui Moore
 
Formal methods 4 - Z notation
Formal methods   4 - Z notationFormal methods   4 - Z notation
Formal methods 4 - Z notationVlad Patryshev
 
Meilleures pratiques pour optimiser la performance sur les Reseaux Sociaux en...
Meilleures pratiques pour optimiser la performance sur les Reseaux Sociaux en...Meilleures pratiques pour optimiser la performance sur les Reseaux Sociaux en...
Meilleures pratiques pour optimiser la performance sur les Reseaux Sociaux en...RevSquare
 
Formal methods 7 - category theory
Formal methods   7 - category theoryFormal methods   7 - category theory
Formal methods 7 - category theoryVlad Patryshev
 

Viewers also liked (14)

Directpurposefulexperiencesandbeyond 120713045550-phpapp01 (2)
Directpurposefulexperiencesandbeyond 120713045550-phpapp01 (2)Directpurposefulexperiencesandbeyond 120713045550-phpapp01 (2)
Directpurposefulexperiencesandbeyond 120713045550-phpapp01 (2)
 
Ww2 tanks
Ww2 tanksWw2 tanks
Ww2 tanks
 
What are tanks used for
What are tanks used forWhat are tanks used for
What are tanks used for
 
Trenches and barbwire
Trenches and barbwireTrenches and barbwire
Trenches and barbwire
 
The morepork
The moreporkThe morepork
The morepork
 
Formal methods 6 - elements of algebra
Formal methods   6 - elements of algebraFormal methods   6 - elements of algebra
Formal methods 6 - elements of algebra
 
Formal methods 2 - languages and machines
Formal methods   2 - languages and machinesFormal methods   2 - languages and machines
Formal methods 2 - languages and machines
 
Truth, deduction, computation lecture 7
Truth, deduction, computation   lecture 7Truth, deduction, computation   lecture 7
Truth, deduction, computation lecture 7
 
Truth, deduction, computation; lecture 2
Truth, deduction, computation;   lecture 2Truth, deduction, computation;   lecture 2
Truth, deduction, computation; lecture 2
 
Television Production Salary Report 2015
Television Production Salary Report 2015Television Production Salary Report 2015
Television Production Salary Report 2015
 
Huang
HuangHuang
Huang
 
Formal methods 4 - Z notation
Formal methods   4 - Z notationFormal methods   4 - Z notation
Formal methods 4 - Z notation
 
Meilleures pratiques pour optimiser la performance sur les Reseaux Sociaux en...
Meilleures pratiques pour optimiser la performance sur les Reseaux Sociaux en...Meilleures pratiques pour optimiser la performance sur les Reseaux Sociaux en...
Meilleures pratiques pour optimiser la performance sur les Reseaux Sociaux en...
 
Formal methods 7 - category theory
Formal methods   7 - category theoryFormal methods   7 - category theory
Formal methods 7 - category theory
 

Similar to Truth, deduction, computation lecture b

Truth, deduction, computation lecture a
Truth, deduction, computation   lecture aTruth, deduction, computation   lecture a
Truth, deduction, computation lecture aVlad Patryshev
 
Understanding distributed calculi in Haskell
Understanding distributed calculi in HaskellUnderstanding distributed calculi in Haskell
Understanding distributed calculi in HaskellPawel Szulc
 
RChain - Understanding Distributed Calculi
RChain - Understanding Distributed CalculiRChain - Understanding Distributed Calculi
RChain - Understanding Distributed CalculiPawel Szulc
 
Discrete mathematic question answers
Discrete mathematic question answersDiscrete mathematic question answers
Discrete mathematic question answersSamet öztoprak
 
Propositional logic
Propositional logicPropositional logic
Propositional logicMamta Pandey
 
Algorithmic foundations.docx
Algorithmic foundations.docxAlgorithmic foundations.docx
Algorithmic foundations.docxedwin orege
 
Lecture 2 predicates quantifiers and rules of inference
Lecture 2 predicates quantifiers and rules of inferenceLecture 2 predicates quantifiers and rules of inference
Lecture 2 predicates quantifiers and rules of inferenceasimnawaz54
 
Truth, deduction, computation lecture e
Truth, deduction, computation   lecture eTruth, deduction, computation   lecture e
Truth, deduction, computation lecture eVlad Patryshev
 
L03 ai - knowledge representation using logic
L03 ai - knowledge representation using logicL03 ai - knowledge representation using logic
L03 ai - knowledge representation using logicManjula V
 
Discrete structures &amp; optimization unit 1
Discrete structures &amp; optimization unit 1Discrete structures &amp; optimization unit 1
Discrete structures &amp; optimization unit 1SURBHI SAROHA
 
Boolean Programs and Quantified Propositional Proof System -
Boolean Programs and Quantified Propositional Proof System - Boolean Programs and Quantified Propositional Proof System -
Boolean Programs and Quantified Propositional Proof System - Michael Soltys
 
Lecture 3 qualtifed rules of inference
Lecture 3 qualtifed rules of inferenceLecture 3 qualtifed rules of inference
Lecture 3 qualtifed rules of inferenceasimnawaz54
 
Discrete-Chapter 04 Logic Part II
Discrete-Chapter 04 Logic Part IIDiscrete-Chapter 04 Logic Part II
Discrete-Chapter 04 Logic Part IIWongyos Keardsri
 
Use of quantifiers
Use of quantifiersUse of quantifiers
Use of quantifiersLakshmi R
 
On the Design of a Galculator
On the Design of a GalculatorOn the Design of a Galculator
On the Design of a GalculatorPaulo Silva
 

Similar to Truth, deduction, computation lecture b (20)

Truth, deduction, computation lecture a
Truth, deduction, computation   lecture aTruth, deduction, computation   lecture a
Truth, deduction, computation lecture a
 
Understanding distributed calculi in Haskell
Understanding distributed calculi in HaskellUnderstanding distributed calculi in Haskell
Understanding distributed calculi in Haskell
 
RChain - Understanding Distributed Calculi
RChain - Understanding Distributed CalculiRChain - Understanding Distributed Calculi
RChain - Understanding Distributed Calculi
 
Formal Logic - Lesson 8 - Predicates and Quantifiers
Formal Logic - Lesson 8 - Predicates and QuantifiersFormal Logic - Lesson 8 - Predicates and Quantifiers
Formal Logic - Lesson 8 - Predicates and Quantifiers
 
Discrete mathematic question answers
Discrete mathematic question answersDiscrete mathematic question answers
Discrete mathematic question answers
 
Propositional logic
Propositional logicPropositional logic
Propositional logic
 
Algorithmic foundations.docx
Algorithmic foundations.docxAlgorithmic foundations.docx
Algorithmic foundations.docx
 
DISMATH_Part1
DISMATH_Part1DISMATH_Part1
DISMATH_Part1
 
Lecture 2 predicates quantifiers and rules of inference
Lecture 2 predicates quantifiers and rules of inferenceLecture 2 predicates quantifiers and rules of inference
Lecture 2 predicates quantifiers and rules of inference
 
Truth, deduction, computation lecture e
Truth, deduction, computation   lecture eTruth, deduction, computation   lecture e
Truth, deduction, computation lecture e
 
dma_ppt.pdf
dma_ppt.pdfdma_ppt.pdf
dma_ppt.pdf
 
chapter9.ppt
chapter9.pptchapter9.ppt
chapter9.ppt
 
L03 ai - knowledge representation using logic
L03 ai - knowledge representation using logicL03 ai - knowledge representation using logic
L03 ai - knowledge representation using logic
 
Discrete structures &amp; optimization unit 1
Discrete structures &amp; optimization unit 1Discrete structures &amp; optimization unit 1
Discrete structures &amp; optimization unit 1
 
Boolean Programs and Quantified Propositional Proof System -
Boolean Programs and Quantified Propositional Proof System - Boolean Programs and Quantified Propositional Proof System -
Boolean Programs and Quantified Propositional Proof System -
 
Per3 logika
Per3 logikaPer3 logika
Per3 logika
 
Lecture 3 qualtifed rules of inference
Lecture 3 qualtifed rules of inferenceLecture 3 qualtifed rules of inference
Lecture 3 qualtifed rules of inference
 
Discrete-Chapter 04 Logic Part II
Discrete-Chapter 04 Logic Part IIDiscrete-Chapter 04 Logic Part II
Discrete-Chapter 04 Logic Part II
 
Use of quantifiers
Use of quantifiersUse of quantifiers
Use of quantifiers
 
On the Design of a Galculator
On the Design of a GalculatorOn the Design of a Galculator
On the Design of a Galculator
 

More from Vlad Patryshev

Formal methods 8 - category theory (last one)
Formal methods   8 - category theory (last one)Formal methods   8 - category theory (last one)
Formal methods 8 - category theory (last one)Vlad Patryshev
 
Formal methods 5 - Pi calculus
Formal methods   5 - Pi calculusFormal methods   5 - Pi calculus
Formal methods 5 - Pi calculusVlad Patryshev
 
Formal methods 3 - languages and machines
Formal methods   3 - languages and machinesFormal methods   3 - languages and machines
Formal methods 3 - languages and machinesVlad Patryshev
 
Formal methods 1 - introduction
Formal methods   1 - introductionFormal methods   1 - introduction
Formal methods 1 - introductionVlad Patryshev
 
Truth, deduction, computation lecture i (last one)
Truth, deduction, computation   lecture i (last one)Truth, deduction, computation   lecture i (last one)
Truth, deduction, computation lecture i (last one)Vlad Patryshev
 
Truth, deduction, computation lecture g
Truth, deduction, computation   lecture gTruth, deduction, computation   lecture g
Truth, deduction, computation lecture gVlad Patryshev
 
Truth, deduction, computation lecture f
Truth, deduction, computation   lecture fTruth, deduction, computation   lecture f
Truth, deduction, computation lecture fVlad Patryshev
 
Truth, deduction, computation lecture d
Truth, deduction, computation   lecture dTruth, deduction, computation   lecture d
Truth, deduction, computation lecture dVlad Patryshev
 
Truth, deduction, computation lecture c
Truth, deduction, computation   lecture cTruth, deduction, computation   lecture c
Truth, deduction, computation lecture cVlad Patryshev
 
Truth, deduction, computation lecture 6
Truth, deduction, computation   lecture 6Truth, deduction, computation   lecture 6
Truth, deduction, computation lecture 6Vlad Patryshev
 
Truth, deduction, computation; lecture 5
Truth, deduction, computation;  lecture 5Truth, deduction, computation;  lecture 5
Truth, deduction, computation; lecture 5Vlad Patryshev
 
Truth, deduction, computation; lecture 4
Truth, deduction, computation;  lecture 4Truth, deduction, computation;  lecture 4
Truth, deduction, computation; lecture 4Vlad Patryshev
 
Truth, deduction, computation; lecture 3
Truth, deduction, computation;  lecture 3Truth, deduction, computation;  lecture 3
Truth, deduction, computation; lecture 3Vlad Patryshev
 
Truth, deduction, computation; lecture 1
Truth, deduction, computation;   lecture 1Truth, deduction, computation;   lecture 1
Truth, deduction, computation; lecture 1Vlad Patryshev
 

More from Vlad Patryshev (19)

Formal methods 8 - category theory (last one)
Formal methods   8 - category theory (last one)Formal methods   8 - category theory (last one)
Formal methods 8 - category theory (last one)
 
Formal methods 5 - Pi calculus
Formal methods   5 - Pi calculusFormal methods   5 - Pi calculus
Formal methods 5 - Pi calculus
 
Formal methods 3 - languages and machines
Formal methods   3 - languages and machinesFormal methods   3 - languages and machines
Formal methods 3 - languages and machines
 
Formal methods 1 - introduction
Formal methods   1 - introductionFormal methods   1 - introduction
Formal methods 1 - introduction
 
Truth, deduction, computation lecture i (last one)
Truth, deduction, computation   lecture i (last one)Truth, deduction, computation   lecture i (last one)
Truth, deduction, computation lecture i (last one)
 
Truth, deduction, computation lecture g
Truth, deduction, computation   lecture gTruth, deduction, computation   lecture g
Truth, deduction, computation lecture g
 
Truth, deduction, computation lecture f
Truth, deduction, computation   lecture fTruth, deduction, computation   lecture f
Truth, deduction, computation lecture f
 
Truth, deduction, computation lecture d
Truth, deduction, computation   lecture dTruth, deduction, computation   lecture d
Truth, deduction, computation lecture d
 
Truth, deduction, computation lecture c
Truth, deduction, computation   lecture cTruth, deduction, computation   lecture c
Truth, deduction, computation lecture c
 
Truth, deduction, computation lecture 6
Truth, deduction, computation   lecture 6Truth, deduction, computation   lecture 6
Truth, deduction, computation lecture 6
 
Truth, deduction, computation; lecture 5
Truth, deduction, computation;  lecture 5Truth, deduction, computation;  lecture 5
Truth, deduction, computation; lecture 5
 
Truth, deduction, computation; lecture 4
Truth, deduction, computation;  lecture 4Truth, deduction, computation;  lecture 4
Truth, deduction, computation; lecture 4
 
Truth, deduction, computation; lecture 3
Truth, deduction, computation;  lecture 3Truth, deduction, computation;  lecture 3
Truth, deduction, computation; lecture 3
 
Truth, deduction, computation; lecture 1
Truth, deduction, computation;   lecture 1Truth, deduction, computation;   lecture 1
Truth, deduction, computation; lecture 1
 
Woo
WooWoo
Woo
 
Pathela m
Pathela mPathela m
Pathela m
 
Nguyenmaria
NguyenmariaNguyenmaria
Nguyenmaria
 
K usatine
K usatineK usatine
K usatine
 
Kevin liu
Kevin liuKevin liu
Kevin liu
 

Recently uploaded

18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 

Recently uploaded (20)

18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 

Truth, deduction, computation lecture b

  • 2. Folding ∨ and ∧ ● P1∨P2∨...∨Pn - associativity! ● P1∧P2∧...∧Pn - associativity! ∨1..nPi ∧1..nPi
  • 3. In Java interface Predicate<X> { public boolean check(X x); } boolean foreach<X>(Iterable<X> xs, Predicate<X> p) { for (x: xs) if (!p.check(xs)) return false; return true; } boolean exists<X>(Iterable<X> xs, Predicate<X> p) { for (x: xs) if (p.check(xs)) return true; return false; }
  • 4. In Scala type Predicate[X] = X => Boolean def foreach[X](xs: Iterable[X], p: Predicate[X]) = { xs.foreach(p) } boolean exists[X](xs: Iterable[X], p: Predicate[X]) { xs.exists(p) }
  • 5. In Scala def foreach[X](xs: Iterable[X], p: X => Boolean) = xs foreach p boolean exists[X](xs: Iterable[X], p: X => Boolean) = xs exists p
  • 6. In Logic, take 1 ● P1∨P2∨...∨Pn -> ∨1..nPi ∃i=1..nPi ● P1∧P2∧...∨Pn -> ∀i=1..nPi ∧1..nPi
  • 7. In Logic, take 2: Example ● P1=Tet(a); P2=Small(b); P3=¬Red(c) Not much to parameterize, all formulas are different… ● P1=Tet(a); P2=Tet(b); P3=Tet(c) or: ● x1=a; x2=b; x3=c; Pi=Tet(xi) ∀i=1..nTet(xi) or ∃i=1..nTet(xi) or: ● x1=a; x2=b; x3=c; Pi=Tet(xi) (x) ∀x in {a,b,c} Tet(x) or ∃x in {a,b,c} Tet
  • 8. In Logic, take 3 ● Can we always enumerate arguments? ● e.g. all real numbers from [0,1] We Need Variables!
  • 9. In Logic, take 4: Introducing Variables Anything that looks like an identifier Even _ can do if we know what we mean Scala: List(1,2,3) exists (_ % 2 == 0)
  • 10. Add Variables to Atomic Sentences <atomic> ::= <predicateName>(<arguments>) <predicateName> ::= <Capital> <predicateName> ::= <Capital><letters> <var> ::= /* choose a distinct set of words */ <name> ::= <objectName>|<var> <arguments> ::= <name>|<arguments>,<name> E.g. Left(x, a) x is a variable
  • 11. Variables in the Exercises
  • 12. Build Formulas with Variables ● Tet(x)∧¬Cube(y)v(Left(a,x)∧Right(y,a)) ● ∀x (Tet(x)∧(Left(a,x)∧Right(c,a)) ● ∃x Between(x,a,b) ● ∀x ∀y ∃z Between(z,x,y)
  • 13. Bound Variables ● Tet(x)∧¬Cube(y)v(Left(a,x)∧Right(y,a)) ● ∀x (Tet(x)∧(Left(a,x)∧Right(y,a)) ● ∃x Between(x,a,b) ● ∀x ∀y ∃z Between(z,x,y)
  • 14. Formulas with Quantifiers, formally <wff> ::= <atomic formula> <wff> ::= ¬<wff>|(<wff>) <wff> ::= <wff>v<wff>|<wff>∧<wff> <wff> ::= <wff>→<wff>|<wff>↔<wff> <wff> ::= ∀<var> <wff> // the var is bound here <wff> ::= ∃<var> <wff> // the var is bound here <sentence> ::= <wff /*where all vars are bound*/>
  • 15. Satisfaction A wff P(x) with an unbound variable x is satisfied on a iff ⊨ P(a) E.g. a small cube satisfies the formula Cube(x) ∧ ¬ Large(x)
  • 16. Satisfaction for Specific Formulas Formula Kind How Satisfied <atomic> find an object or objects ¬P find counterexample for P PvQ find something that satisfies at least one of P and Q P∧Q find something that satisfies P and Q ∀x P P is satisfied by all objects ∃x P we can find an object that satisfies P
  • 17. Problems with Domain Formula Kind How Satisfied <atomic> find an object or objects ¬P find counterexample for P PvQ find something that satisfies at least one of P and Q P∧Q find something that satisfies P and Q ∀x P P is satisfied by all objects ∃x P we can find an object that satisfies P
  • 18. Problems with Domain ● ∀x (Cube(x)∨Tet(x)) - how about 27? 28? ● ∃n (n*n > n*n*n) - how about Claire’s cat?
  • 19. Translating Aristotelian Forms Aristotle says We write All P’s are Q’s ∀x (P(x) → Q(x)) Some P’s are Q’s ∃x (P(x) ∧ Q(x)) No P’s are Q’s ∀x (P(x) → ¬Q(x)) Some P’s are not Q’s ∃x (P(x) ∧ ¬Q(x)) How about ∃x (P(x) → Q(x)) Or, e.g., ∀y(Tet(y) → Small(y))
  • 20. Ambiguousness with Aristotelian... ∀x (P(x) → ¬Q(x)) or ¬∃x (P(x) ∧ Q(x)) In Boolean logic, they are semantically equivalent
  • 21. In Plain English Existential noun phrase involves “∃ x…” Universal noun phrase involves “∀ x…”
  • 22. Reformulating Previous Exercises ● ● ∀x ∀y ∀z ((FatherOf(x,y)∧FatherOf(y,z)) → Nicer(x,y)) ∀x ∀y (¬Even(x+y) → Even(x*y))