03 - predicate logic
Post on 10-May-2015
1.139 Views
Preview:
DESCRIPTION
TRANSCRIPT
Boolean algebra Propositional logic0, 1 True, False
boolean variables: a∈{0, 1} atomic formulas: p∈{True,False}
boolean operators: ¬ ∧ ∨ ⇒ ⇔ logical connectives: ¬ ∧ ∨ ⇒ ⇔
boolean functions:
0, 1
boolean variables
if a is a boolean function, then ¬a is a boolean function
if a and b are boolean functions, then a∧b, a∨b, a⇒b, a⇔b are boolean
functions
propositional formulas (propositions):
True and False
atomic formulas
if a is a propositional formula, then ¬a is a propositional formula
if a and b are propositional formulas, then a∧b, a∨b, a⇒b, a⇔b are
propositional formulas
truth value of a boolean function (truth tables)
truth value of a propositional formula (truth tables)
Boolean algebra Propositional logic0, 1 True, False
boolean variables: a∈{0, 1} atomic formulas: p∈{True,False}
boolean operators: ¬ ∧ ∨ ⇒ ⇔ logical connectives: ¬ ∧ ∨ ⇒ ⇔
boolean functions:
0, 1
boolean variables
if a is a boolean function, then ¬a is a boolean function
if a and b are boolean functions, then a∧b, a∨b, a⇒b, a⇔b are boolean
functions
propositional formulas (propositions):
True and False
atomic formulas
if a is a propositional formula, then ¬a is a propositional formula
if a and b are propositional formulas, then a∧b, a∨b, a⇒b, a⇔b are
propositional formulas
truth value of a boolean function (truth tables)
truth value of a propositional formula (truth tables)
The Russian spy problem
There are three persons: Stirlitz, Mueller, and Eismann. It is known that exactly one of them is Russian, while the other two are Germans.
Moreover, every Russian must be a spy.
When Stirlitz meets Mueller in a corridor, he makes the following joke: “you know, Mueller, you are as German as I am Russian”. It is known that Stirlitz always says the truth when he is joking.
Establish that Eismann is not a Russian spy.
There are three persons: Stirlitz, Mueller, and Eismann. It is known that exactly one of them is Russian, while the other two are Germans.
Moreover, every Russian must be a spy.
When Stirlitz meets Mueller in a corridor, he makes the following joke: “you know, Mueller, you are as German as I am Russian”. It is known that Stirlitz always says the truth when he is joking.
Establish that Eismann is not a Russian spy.
There are three persons: Stirlitz, Mueller, and Eismann. It is known that exactly one of them is Russian, while the other two are Germans.
Moreover, every Russian must be a spy.
When Stirlitz meets Mueller in a corridor, he makes the following joke: “you know, Mueller, you are as German as I am Russian”. It is known that Stirlitz always says the truth when he is joking.
Establish that Eismann is not a Russian spy.
X ∈ {R, G, S} (denoting Russian, German, Spy)Y ∈ {S,M,E} (denoting Stirlitz, Müller, Eismann)
SE : Eismann is a SpyRS : Stirlitz is Russian
There are three persons: Stirlitz, Mueller, and Eismann. It is known that exactly one of them is Russian, while the other two are Germans.(RS ∧ GM ∧ GE) ∨ (GS ∧ RM ∧ GE) ∨ (GS ∧ GM ∧ RE).(RS ⇔ ¬GS) ∧ (RM ⇔ ¬GM) ∧ (RE ⇔ ¬GE).
Moreover, every Russian must be a spy.(RS ⇒ SS) ∧ (RM ⇒ SM) ∧ (RE ⇒ SE).
When Stirlitz meets Mueller in a corridor, he makes the following joke: “you know, Mueller, you are as German as I am Russian”. It is known that Stirlitz always says the truth when he is joking.RS ⇔ GM.
Establish that Eismann is not a Russian spy.RE ∧ SE.
There are three persons: Stirlitz, Mueller, and Eismann. It is known that exactly one of them is Russian, while the other two are Germans.(RS ∧ GM ∧ GE) ∨ (GS ∧ RM ∧ GE) ∨ (GS ∧ GM ∧ RE).(RS ⇔ ¬GS) ∧ (RM ⇔ ¬GM) ∧ (RE ⇔ ¬GE).
Moreover, every Russian must be a spy.(RS ⇒ SS) ∧ (RM ⇒ SM) ∧ (RE ⇒ SE).
When Stirlitz meets Mueller in a corridor, he makes the following joke: “you know, Mueller, you are as German as I am Russian”. It is known that Stirlitz always says the truth when he is joking.RS ⇔ GM.
Establish that Eismann is not a Russian spy.RE ∧ SE.
There are three persons: Stirlitz, Mueller, and Eismann. It is known that exactly one of them is Russian, while the other two are Germans.(RS ∧ GM ∧ GE) ∨ (GS ∧ RM ∧ GE) ∨ (GS ∧ GM ∧ RE).(RS ⇔ ¬GS) ∧ (RM ⇔ ¬GM) ∧ (RE ⇔ ¬GE).
Moreover, every Russian must be a spy.(RS ⇒ SS) ∧ (RM ⇒ SM) ∧ (RE ⇒ SE).
When Stirlitz meets Mueller in a corridor, he makes the following joke: “you know, Mueller, you are as German as I am Russian”. It is known that Stirlitz always says the truth when he is joking.RS ⇔ GM.
Establish that Eismann is not a Russian spy.RE ∧ SE.
There are three persons: Stirlitz, Mueller, and Eismann. It is known that exactly one of them is Russian, while the other two are Germans.(RS ∧ GM ∧ GE) ∨ (GS ∧ RM ∧ GE) ∨ (GS ∧ GM ∧ RE).(RS ⇔ ¬GS) ∧ (RM ⇔ ¬GM) ∧ (RE ⇔ ¬GE).
Moreover, every Russian must be a spy.(RS ⇒ SS) ∧ (RM ⇒ SM) ∧ (RE ⇒ SE).
When Stirlitz meets Mueller in a corridor, he makes the following joke: “you know, Mueller, you are as German as I am Russian”. It is known that Stirlitz always says the truth when he is joking.RS ⇔ GM.
Establish that Eismann is not a Russian spy.RE ∧ SE.
There are three persons: Stirlitz, Mueller, and Eismann. It is known that exactly one of them is Russian, while the other two are Germans.(RS ∧ GM ∧ GE) ∨ (GS ∧ RM ∧ GE) ∨ (GS ∧ GM ∧ RE).(RS ⇔ ¬GS) ∧ (RM ⇔ ¬GM) ∧ (RE ⇔ ¬GE).
Moreover, every Russian must be a spy.(RS ⇒ SS) ∧ (RM ⇒ SM) ∧ (RE ⇒ SE).
When Stirlitz meets Mueller in a corridor, he makes the following joke: “you know, Mueller, you are as German as I am Russian”. It is known that Stirlitz always says the truth when he is joking.RS ⇔ GM.
Establish that Eismann is not a Russian spy.RE ∧ SE.
There are three persons: Stirlitz, Mueller, and Eismann. It is known that exactly one of them is Russian, while the other two are Germans.(RS ∧ GM ∧ GE) ∨ (GS ∧ RM ∧ GE) ∨ (GS ∧ GM ∧ RE).(RS ⇔ ¬GS) ∧ (RM ⇔ ¬GM) ∧ (RE ⇔ ¬GE).
Moreover, every Russian must be a spy.(RS ⇒ SS) ∧ (RM ⇒ SM) ∧ (RE ⇒ SE).
When Stirlitz meets Mueller in a corridor, he makes the following joke: “you know, Mueller, you are as German as I am Russian”. It is known that Stirlitz always says the truth when he is joking.RS ⇔ GM.
Establish that Eismann is not a Russian spy.RE ∧ SE.
computerinformation information
computation
2 is greater than 5
2 is greater than 5 False
2 is greater than 5
6 is greater than 5
False
2 is greater than 5
6 is greater than 5
False
True
2 is greater than 5
6 is greater than 5
False
True
x is greater than 5
2 is greater than 5
6 is greater than 5
False
True
x is greater than 5 ?
2 is greater than 5
6 is greater than 5
False
True
x is greater than 5 ?predicate
x is greater than 5
2 is greater than 5
6 is greater than 5
False
True
predicate
x is greater than 5F(x) =
2 is greater than 5
6 is greater than 5
False
True
predicate
x is greater than 5F(x) =
2 is greater than 5
6 is greater than 5F(6) =
F(2) = False
True
predicate
x is greater than 5F(x) =
2 is greater than 5
6 is greater than 5F(6) =
F(2) = False
True
for all natural numbers x,x is greater than 5
predicate
x is greater than 5F(x) =
2 is greater than 5
6 is greater than 5F(6) =
F(2) = False
True
for all natural numbers x,x is greater than 5 False
predicate
x is greater than 5F(x) =
2 is greater than 5
6 is greater than 5F(6) =
F(2) = False
True
for all natural numbers x,x is greater than 5 False
for some natural numbers x,x is greater than 5
predicate
True
x is greater than 5F(x) =
2 is greater than 5
6 is greater than 5F(6) =
F(2) = False
True
for all natural numbers x,x is greater than 5 False
for some natural numbers x,x is greater than 5
predicate
True
x is greater than 5F(x) =
2 is greater than 5
6 is greater than 5F(6) =
F(2) = False
True
for all natural numbers x,x is greater than 5 False
for some natural numbers x,x is greater than 5
predicate
quantifier
True
x is greater than 5F(x) =
2 is greater than 5
6 is greater than 5F(6) =
F(2) = False
True
for all natural numbers x,x is greater than 5 False
for some natural numbers x,x is greater than 5
predicate
quantifier
quantifier
True
x is greater than 5F(x) =
2 is greater than 5
6 is greater than 5F(6) =
F(2) = False
True
for all natural numbers x,x is greater than 5 False
for some natural numbers x,x is greater than 5
predicate
quantifier
quantifier
universe
Existential quantifiers ∃ :Universal quantifier ∀ :
∀x: U(x): F(x) ∃x: U(x): F(x)
∀x:x∈N:x>5 ∃x:x∈N:x>5for all natural numbers x,x is greater than 5
for some natural numbers x,x is greater than 5
Gottlob Frege1848—1925
no appeal to intuition
Distributivity of ∀ ∧∀x: U(x): (P(x) ∧ Q(x))
Distributivity of ∃ ∨∃x: U(x): (P(x) ∨ Q(x))
Non-distributivity of ∀ ∨(∀x: U(x): P(x)) ∨ (∀x: U(x): Q(x))
Non-distributivity of ∃ ∧∃x: U(x): (P(x) ∧ Q(x))
⇔ (∀x: U(x): P(x)) ∧ (∀ x: U(x): Q(x))
⇔ (∃x: U(x): P(x)) ∨ (∃ x: U(x): Q(x))
⇒ ∀x: U(x): (P(x) ∨ Q(x))
⇒ (∃x: U(x): P(x)) ∧ (∃x: U(x): Q(x))
Examples
∀ i: 0≤i<N: ai=0
Examples
∀ i: 0≤i<N: ai=0all elements ai of array a (of length N) are zero
Examples
∀ i: 0≤i<N: ai=0all elements ai of array a (of length N) are zero
∀ i: 1≤i<N: ai-1 ≤ ai
Examples
∀ i: 0≤i<N: ai=0all elements ai of array a (of length N) are zero
∀ i: 1≤i<N: ai-1 ≤ aielements of array a are monotonically increasing
Examples
∀ i: 0≤i<N: ai=0all elements ai of array a (of length N) are zero
∀ i: 1≤i<N: ai-1 ≤ aielements of array a are monotonically increasing
∀ i,j: 0≤i<j<N: ai ≤ aj
Examples
∀ i: 0≤i<N: ai=0all elements ai of array a (of length N) are zero
∀ i: 1≤i<N: ai-1 ≤ aielements of array a are monotonically increasing
∀ i,j: 0≤i<j<N: ai ≤ ajelements of array a are monotonically increasing
Examples
∀ i: 0≤i<N: ai=0all elements ai of array a (of length N) are zero
∀ i: 1≤i<N: ai-1 ≤ aielements of array a are monotonically increasing
∀ i,j: 0≤i<j<N: ai ≤ ajelements of array a are monotonically increasing
∀ i,j: 0≤i,j<N: ai = aj
Examples
∀ i: 0≤i<N: ai=0all elements ai of array a (of length N) are zero
∀ i: 1≤i<N: ai-1 ≤ aielements of array a are monotonically increasing
∀ i,j: 0≤i<j<N: ai ≤ ajelements of array a are monotonically increasing
∀ i,j: 0≤i,j<N: ai = ajall elements of array a are equal
Examples
∀ i: 0≤i<N: ai=0all elements ai of array a (of length N) are zero
∀ i: 1≤i<N: ai-1 ≤ aielements of array a are monotonically increasing
∀ i,j: 0≤i<j<N: ai ≤ ajelements of array a are monotonically increasing
∀ i,j: 0≤i,j<N: ai = ajall elements of array a are equal
∀ i: 0<i<N: ai ≤ a0
Examples
∀ i: 0≤i<N: ai=0all elements ai of array a (of length N) are zero
∀ i: 1≤i<N: ai-1 ≤ aielements of array a are monotonically increasing
∀ i,j: 0≤i<j<N: ai ≤ ajelements of array a are monotonically increasing
∀ i,j: 0≤i,j<N: ai = ajall elements of array a are equal
∀ i: 0<i<N: ai ≤ a0a0 is the greatest element of array a
Examples
∀ i: 0≤i<N: ai=0all elements ai of array a (of length N) are zero
∀ i: 1≤i<N: ai-1 ≤ aielements of array a are monotonically increasing
∀ i,j: 0≤i<j<N: ai ≤ ajelements of array a are monotonically increasing
∀ i,j: 0≤i,j<N: ai = ajall elements of array a are equal
∀ i: 0<i<N: ai ≤ a0a0 is the greatest element of array a
∃ i: 0≤i<N: ai ≠ 0
Examples
∀ i: 0≤i<N: ai=0all elements ai of array a (of length N) are zero
∀ i: 1≤i<N: ai-1 ≤ aielements of array a are monotonically increasing
∀ i,j: 0≤i<j<N: ai ≤ ajelements of array a are monotonically increasing
∀ i,j: 0≤i,j<N: ai = ajall elements of array a are equal
∀ i: 0<i<N: ai ≤ a0a0 is the greatest element of array a
∃ i: 0≤i<N: ai ≠ 0at least one element of array a (of length N) is not zero
Examples
∀ i: 0≤i<N: ai=0all elements ai of array a (of length N) are zero
∀ i: 1≤i<N: ai-1 ≤ aielements of array a are monotonically increasing
∀ i,j: 0≤i<j<N: ai ≤ ajelements of array a are monotonically increasing
∀ i,j: 0≤i,j<N: ai = ajall elements of array a are equal
∀ i: 0<i<N: ai ≤ a0a0 is the greatest element of array a
∃ i: 0≤i<N: ai ≠ 0at least one element of array a (of length N) is not zero
∃ i: 1≤i<N: ai-1 > ai
Examples
∀ i: 0≤i<N: ai=0all elements ai of array a (of length N) are zero
∀ i: 1≤i<N: ai-1 ≤ aielements of array a are monotonically increasing
∀ i,j: 0≤i<j<N: ai ≤ ajelements of array a are monotonically increasing
∀ i,j: 0≤i,j<N: ai = ajall elements of array a are equal
∀ i: 0<i<N: ai ≤ a0a0 is the greatest element of array a
∃ i: 0≤i<N: ai ≠ 0at least one element of array a (of length N) is not zero
∃ i: 1≤i<N: ai-1 > aielements of array a are not monotonically increasing
Examples
∀ i: 0≤i<N: ai=0all elements ai of array a (of length N) are zero
∀ i: 1≤i<N: ai-1 ≤ aielements of array a are monotonically increasing
∀ i,j: 0≤i<j<N: ai ≤ ajelements of array a are monotonically increasing
∀ i,j: 0≤i,j<N: ai = ajall elements of array a are equal
∀ i: 0<i<N: ai ≤ a0a0 is the greatest element of array a
∃ i: 0≤i<N: ai ≠ 0at least one element of array a (of length N) is not zero
∃ i: 1≤i<N: ai-1 > aielements of array a are not monotonically increasing
∃ i,j: 0≤i<j<N: ai > aj
Examples
∀ i: 0≤i<N: ai=0all elements ai of array a (of length N) are zero
∀ i: 1≤i<N: ai-1 ≤ aielements of array a are monotonically increasing
∀ i,j: 0≤i<j<N: ai ≤ ajelements of array a are monotonically increasing
∀ i,j: 0≤i,j<N: ai = ajall elements of array a are equal
∀ i: 0<i<N: ai ≤ a0a0 is the greatest element of array a
∃ i: 0≤i<N: ai ≠ 0at least one element of array a (of length N) is not zero
∃ i: 1≤i<N: ai-1 > aielements of array a are not monotonically increasing
∃ i,j: 0≤i<j<N: ai > ajelements of array a are not monotonically increasing
Examples
∀ i: 0≤i<N: ai=0all elements ai of array a (of length N) are zero
∀ i: 1≤i<N: ai-1 ≤ aielements of array a are monotonically increasing
∀ i,j: 0≤i<j<N: ai ≤ ajelements of array a are monotonically increasing
∀ i,j: 0≤i,j<N: ai = ajall elements of array a are equal
∀ i: 0<i<N: ai ≤ a0a0 is the greatest element of array a
∃ i: 0≤i<N: ai ≠ 0at least one element of array a (of length N) is not zero
∃ i: 1≤i<N: ai-1 > aielements of array a are not monotonically increasing
∃ i,j: 0≤i<j<N: ai > ajelements of array a are not monotonically increasing
∃ i,j: 0≤i<j<N: ai ≠ aj
Examples
∀ i: 0≤i<N: ai=0all elements ai of array a (of length N) are zero
∀ i: 1≤i<N: ai-1 ≤ aielements of array a are monotonically increasing
∀ i,j: 0≤i<j<N: ai ≤ ajelements of array a are monotonically increasing
∀ i,j: 0≤i,j<N: ai = ajall elements of array a are equal
∀ i: 0<i<N: ai ≤ a0a0 is the greatest element of array a
∃ i: 0≤i<N: ai ≠ 0at least one element of array a (of length N) is not zero
∃ i: 1≤i<N: ai-1 > aielements of array a are not monotonically increasing
∃ i,j: 0≤i<j<N: ai > ajelements of array a are not monotonically increasing
∃ i,j: 0≤i<j<N: ai ≠ ajnot all elements of array a are equal
Examples
∀ i: 0≤i<N: ai=0all elements ai of array a (of length N) are zero
∀ i: 1≤i<N: ai-1 ≤ aielements of array a are monotonically increasing
∀ i,j: 0≤i<j<N: ai ≤ ajelements of array a are monotonically increasing
∀ i,j: 0≤i,j<N: ai = ajall elements of array a are equal
∀ i: 0<i<N: ai ≤ a0a0 is the greatest element of array a
∃ i: 0≤i<N: ai ≠ 0at least one element of array a (of length N) is not zero
∃ i: 1≤i<N: ai-1 > aielements of array a are not monotonically increasing
∃ i,j: 0≤i<j<N: ai > ajelements of array a are not monotonically increasing
∃ i,j: 0≤i<j<N: ai ≠ ajnot all elements of array a are equal
∃ i: 0<i<N: ai > a0
Examples
∀ i: 0≤i<N: ai=0all elements ai of array a (of length N) are zero
∀ i: 1≤i<N: ai-1 ≤ aielements of array a are monotonically increasing
∀ i,j: 0≤i<j<N: ai ≤ ajelements of array a are monotonically increasing
∀ i,j: 0≤i,j<N: ai = ajall elements of array a are equal
∀ i: 0<i<N: ai ≤ a0a0 is the greatest element of array a
∃ i: 0≤i<N: ai ≠ 0at least one element of array a (of length N) is not zero
∃ i: 1≤i<N: ai-1 > aielements of array a are not monotonically increasing
∃ i,j: 0≤i<j<N: ai > ajelements of array a are not monotonically increasing
∃ i,j: 0≤i<j<N: ai ≠ ajnot all elements of array a are equal
∃ i: 0<i<N: ai > a0a0 is not the greatest element of array a
Examples
∀ i: 0≤i<N: ai=0all elements ai of array a (of length N) are zero
∀ i: 1≤i<N: ai-1 ≤ aielements of array a are monotonically increasing
∀ i,j: 0≤i<j<N: ai ≤ ajelements of array a are monotonically increasing
∀ i,j: 0≤i,j<N: ai = ajall elements of array a are equal
∀ i: 0<i<N: ai ≤ a0a0 is the greatest element of array a
∃ i: 0≤i<N: ai ≠ 0at least one element of array a (of length N) is not zero
∃ i: 1≤i<N: ai-1 > aielements of array a are not monotonically increasing
∃ i,j: 0≤i<j<N: ai > ajelements of array a are not monotonically increasing
∃ i,j: 0≤i<j<N: ai ≠ ajnot all elements of array a are equal
∃ i: 0<i<N: ai > a0a0 is not the greatest element of array a
Examples
¬(∃ x: U(x): F(x)) ⇔ ∀ x: U(x): ¬ F(x)
¬(∀ x: U(x): F(x)) ⇔ ∃ x: U(x): ¬ F(x)
De Morgan’s Axiom ¬∃ :
De Morgan’s Axiom ¬∀ :
Example
What is the negation of the statement“Always, when he drives then he is sober.”
Example
What is the negation of the statement“Always, when he drives then he is sober.”
D(t): He drives at moment t.
Example
What is the negation of the statement“Always, when he drives then he is sober.”
D(t): He drives at moment t.S(t): He is sober at moment t.
Example
What is the negation of the statement“Always, when he drives then he is sober.”
D(t): He drives at moment t.S(t): He is sober at moment t.∀t : D(t)->S(t)
Example
What is the negation of the statement“Always, when he drives then he is sober.”
D(t): He drives at moment t.S(t): He is sober at moment t.∀t : D(t)->S(t)
¬(∀t :: D(t)->S(t)) ⇔
Example
What is the negation of the statement“Always, when he drives then he is sober.”
D(t): He drives at moment t.S(t): He is sober at moment t.∀t : D(t)->S(t)
¬(∀t :: D(t)->S(t)) ⇔¬(∀t :: ¬D(t)∨S(t)) ⇔
Example
What is the negation of the statement“Always, when he drives then he is sober.”
D(t): He drives at moment t.S(t): He is sober at moment t.∀t : D(t)->S(t)
¬(∀t :: D(t)->S(t)) ⇔¬(∀t :: ¬D(t)∨S(t)) ⇔ ∃t :: ¬(¬D(t)∨S(t)) ⇔
Example
What is the negation of the statement“Always, when he drives then he is sober.”
D(t): He drives at moment t.S(t): He is sober at moment t.∀t : D(t)->S(t)
¬(∀t :: D(t)->S(t)) ⇔¬(∀t :: ¬D(t)∨S(t)) ⇔ ∃t :: ¬(¬D(t)∨S(t)) ⇔∃t :: D(t)∧¬S(t))
computerinformation information
computation
True, False are WFFs.
Propositional variables are WFFs.
Predicates with variables are WFFs.
If A and B are WFFs, then ¬A, A∧B, A∨B, A⇒B, A⇔B are also WFFs.
If x is a variable in universe U and A is a WFF, then∀x:U(x):A(x) and ∃x:U(x):A(x) are also WFFs.
Well formed formulas (WFF)
Bounded variables
(∃j: 0<j<N: P(i,j) ∨ Q(i,j))
Free variablesIf a variable is not bound in a WFF thenit is free.
An appearance of variable is bound in a WFF ifa specific value is assigned to it, or it is quantified.
∃i: 0<i<N: (
∃i,j: 0<i,j<N: P(i,j) ∨ Q(i,j)
Bounded variables
(∃j: 0<j<N: P(i,j) ∨ Q(i,j))
Free variablesIf a variable is not bound in a WFF thenit is free.
An appearance of variable is bound in a WFF ifa specific value is assigned to it, or it is quantified.
∃i: 0<i<N: ( )
∃i,j: 0<i,j<N: P(i,j) ∨ Q(i,j)
∃x: U1(x): (∀y: U2(y): Q(x,y)) ⇔ ∀y: U2(y): (∃x: U1(x): Q(x,y))∃x: U1(x): (∀y: U2(y): Q(x,y)) ⇒ ∀y: U2(y): (∃x: U1(x): Q(x,y))∀y: U2(y): (∃x: U1(x): Q(x,y)) ⇒ ∃x: U1(y): (∀y: U2(y): Q(x,y))
Swapping ∀ and ∃∀x: U1(x): (∀y: U2(y): Q(x,y)) ⇔ ∀y: U2(y): (∀x: U1(x): Q(x,y))∃x: U1(x): (∃y: U2(y): Q(x,y))⇔ ∃y: U2(y): (∃x: U1(x): Q(x,y))
However
∃x: U1(x): (∀y: U2(y): Q(x,y)) ⇔ ∀y: U2(y): (∃x: U1(x): Q(x,y))∃x: U1(x): (∀y: U2(y): Q(x,y)) ⇒ ∀y: U2(y): (∃x: U1(x): Q(x,y))∀y: U2(y): (∃x: U1(x): Q(x,y)) ⇒ ∃x: U1(y): (∀y: U2(y): Q(x,y))
Swapping ∀ and ∃∀x: U1(x): (∀y: U2(y): Q(x,y)) ⇔ ∀y: U2(y): (∀x: U1(x): Q(x,y))∃x: U1(x): (∃y: U2(y): Q(x,y))⇔ ∃y: U2(y): (∃x: U1(x): Q(x,y))
However
Example
Every boy loves some girl does not imply thatsome girl is loved by every boy.
U1 - the universe of boys.U2 - the universe of girls.Q(x,y) - boy x loves girl y.
∀y: U2(y): (∃x: U1(x): Q(x,y)) ⇒ ∃x: U1(y): (∀y: U2(y): Q(x,y))
∀x: U(x): (Q(x) ∨ P) ⇔ (∀x: U(x): Q(x)) ∨ P∀x: U(x): (Q(x) ∧ P) ⇔ (∀x: U(x): Q(x)) ∧ P
∃x: U(x): (Q(x) ∨ P) ⇔ (∃x: U(x): Q(x)) ∨ P∃x: U(x): (Q(x) ∧ P) ⇔ (∃x: U(x): Q(x)) ∧ P
If P does not contain x as a free variable
Example
Given: an array a[0..N-1] of length N≥3
Find: i, j, k such that:
i is the index of the greatest element of a;
j is the index of the 2nd greatest element of a;
k is the index of the 3rd greatest element of a.
Example
Given: an array a[0..N-1] of length N≥3
Find: i, j, k such that:
i is the index of the greatest element of a;
j is the index of the 2nd greatest element of a;
k is the index of the 3rd greatest element of a.
∃ i,j,k: (0≤i,j,k<N)∧(i≠j)∧(i≠k)∧(j≠k): ( (ai≥aj≥ak) ∧ (∀m: (0≤m<N)∧(m≠i)∧(m≠j)∧(m≠k): ak≥am) )
Example
All elements of an array a of length N are either zero or one
Example
All elements of an array a of length N are either zero or one
∀i: 0≤i<N: ( ai=0 ∨ ai=1 )
Example
All elements of an array a of length N are either zero or one
∀i: 0≤i<N: ( ai=0 ∨ ai=1 )
(∀i: 0≤i<N: ai=0) ∨ (∀i: 0≤i<N: ai=1)
(1)
(2)
Example
All elements of an array a of length N are either zero or one
∀i: 0≤i<N: ( ai=0 ∨ ai=1 )
(∀i: 0≤i<N: ai=0) ∨ (∀i: 0≤i<N: ai=1)
(1)
(2)
ambiguous
Example
The elements of arrays a and b are the same (both arrays of length N).
Example
The elements of arrays a and b are the same (both arrays of length N).
∀i: 0≤i<N: (ai=bi)(1)
Example
The elements of arrays a and b are the same (both arrays of length N).
∀i: 0≤i<N: (ai=bi)
∀i: 1≤i<N: ((ai=ai-1) ∧ (bi=bi-1))
(1)
(2)
Example
The elements of arrays a and b are the same (both arrays of length N).
∀i: 0≤i<N: (ai=bi)
∀i: 1≤i<N: ((ai=ai-1) ∧ (bi=bi-1))
(1)
(2)
(∀i: 1≤i<N: (ai=ai-1)) ∧ (∀i: 0≤i<N: (ai=bi))(3)
Example
The elements of arrays a and b are the same (both arrays of length N).
∀i: 0≤i<N: (ai=bi)
∀i: 1≤i<N: ((ai=ai-1) ∧ (bi=bi-1))
(1)
(2)
(∀i: 1≤i<N: (ai=ai-1)) ∧ (∀i: 0≤i<N: (ai=bi))(3)
∀i: 0≤i<N: (∃ j: 0≤j<N: (ai=bi) )(4)
Example
The elements of arrays a and b are the same (both arrays of length N).
∀i: 0≤i<N: (ai=bi)
∀i: 1≤i<N: ((ai=ai-1) ∧ (bi=bi-1))
(1)
(2)
ambiguous
(∀i: 1≤i<N: (ai=ai-1)) ∧ (∀i: 0≤i<N: (ai=bi))(3)
∀i: 0≤i<N: (∃ j: 0≤j<N: (ai=bi) )(4)
Example
They drank two cups of tea because they were warm.
Example
They drank two cups of tea because they were warm.
They drank two cups of tea because they were cold.
Example
Go to the shop and buy bread.If they have eggs, buy 10.
Example
Go to the shop and buy bread.If they have eggs, buy 10.
...Do you have eggs?Yes.Then give me 10 pieces of bread.
Example
Min x: U(x): T(x)gives the “smallest value of terms T(x)for all objects x from the universe U“
Min x: U(x): T(x)gives the “smallest value of terms T(x)for all objects x from the universe U“
Min x: False: T(x) is +∞.
Min x: U(x): T(x)gives the “smallest value of terms T(x)for all objects x from the universe U“
Min x: False: T(x) is +∞.
( m = (Min i: 0≤i<N: a[i]) ) ⇔
Min x: U(x): T(x)gives the “smallest value of terms T(x)for all objects x from the universe U“
Min x: False: T(x) is +∞.
( m = (Min i: 0≤i<N: a[i]) ) ⇔((∃ i: 0≤i<N: m=a[i]) ∧ (∀ i: 0≤i<N: m≤a[i]))
Max x: U(x): T(x)gives the “greatest value of terms T(x)for all objects x from the universe U“
Max x: U(x): T(x)gives the “greatest value of terms T(x)for all objects x from the universe U“
Max x: False: T(x) is -∞.
Max x: U(x): T(x)gives the “greatest value of terms T(x)for all objects x from the universe U“
Max x: False: T(x) is -∞.
Max x: U(x): T(x) = - (Min x: U(x): - T(x))
Max x: U(x): T(x)gives the “greatest value of terms T(x)for all objects x from the universe U“
Max x: False: T(x) is -∞.
Max x: U(x): T(x) = - (Min x: U(x): - T(x))Min x: U(x): T(x) = - (Max x: U(x): - T(x))
Anz x: U(x): F(x)gives the “number of all those objects xfrom the universe U for which F(x) holds“
Anz x: U(x): F(x)gives the “number of all those objects xfrom the universe U for which F(x) holds“
Anz x: False: F(x) is 0.
Anz x: U(x): F(x)gives the “number of all those objects xfrom the universe U for which F(x) holds“
Anz x: False: F(x) is 0.
((Anz x: U(x): F(x)) = 0) ⇔ ∀x: U(x):¬F(x)
Anz x: U(x): F(x)gives the “number of all those objects xfrom the universe U for which F(x) holds“
Anz x: False: F(x) is 0.
((Anz x: U(x): F(x)) = 0) ⇔ ∀x: U(x):¬F(x)((Anz x: U(x): F(x)) ≥ 0) ⇔ ∃x: U(x): F(x)
Given arrays a and b.Both arrays are of length N.The elements of both arrays are natural numbers.
Example
Given arrays a and b.Both arrays are of length N.The elements of both arrays are natural numbers.
(Anz i: 0≤i<N: ai=0) = 0
Example
Given arrays a and b.Both arrays are of length N.The elements of both arrays are natural numbers.
(Anz i: 0≤i<N: ai=0) = 0all elements ai of a are different than 0
Example
Given arrays a and b.Both arrays are of length N.The elements of both arrays are natural numbers.
(Anz i: 0≤i<N: ai=0) = 0all elements ai of a are different than 0
(Anz i: 0≤i<N: ai=x) > 0
Example
Given arrays a and b.Both arrays are of length N.The elements of both arrays are natural numbers.
(Anz i: 0≤i<N: ai=0) = 0all elements ai of a are different than 0
(Anz i: 0≤i<N: ai=x) > 0at least one element ai has the value x (x∈N)
Example
Given arrays a and b.Both arrays are of length N.The elements of both arrays are natural numbers.
(Anz i: 0≤i<N: ai=0) = 0all elements ai of a are different than 0
(Anz i: 0≤i<N: ai=x) > 0at least one element ai has the value x (x∈N)
(Anz i: 0≤i<N: ai<x) = (Anz i: 0≤i<N: ai>x)
Example
Given arrays a and b.Both arrays are of length N.The elements of both arrays are natural numbers.
(Anz i: 0≤i<N: ai=0) = 0all elements ai of a are different than 0
(Anz i: 0≤i<N: ai=x) > 0at least one element ai has the value x (x∈N)
(Anz i: 0≤i<N: ai<x) = (Anz i: 0≤i<N: ai>x)x is the median value of a
Example
Given arrays a and b.Both arrays are of length N.The elements of both arrays are natural numbers.
(Anz i: 0≤i<N: ai=0) = 0all elements ai of a are different than 0
(Anz i: 0≤i<N: ai=x) > 0at least one element ai has the value x (x∈N)
(Anz i: 0≤i<N: ai<x) = (Anz i: 0≤i<N: ai>x)x is the median value of a
∀x:: ( (Anz i: 0≤i<N: ai=x) = (Anz i: 0≤i<N: bi=x) )
Example
Given arrays a and b.Both arrays are of length N.The elements of both arrays are natural numbers.
(Anz i: 0≤i<N: ai=0) = 0all elements ai of a are different than 0
(Anz i: 0≤i<N: ai=x) > 0at least one element ai has the value x (x∈N)
(Anz i: 0≤i<N: ai<x) = (Anz i: 0≤i<N: ai>x)x is the median value of a
∀x:: ( (Anz i: 0≤i<N: ai=x) = (Anz i: 0≤i<N: bi=x) )a is a permutation of b
Example
computerinformation information
computation
Tudor Gîrbawww.tudorgirba.com
creativecommons.org/licenses/by/3.0/
top related