Documente Academic
Documente Profesional
Documente Cultură
TOPIC 4
Set Theory
Set Theory: A branch of mathematics or of symbolic
logic that deals with the nature and relations of sets
Note
Any set is a subset of itself
Any set is a subset of the universal
set
The empty set is a subset of every
set including itself
Boolean Logic
A Boolean function has:
At least one Boolean variable,
At least one Boolean operator, and
At least one input from the set {0,1}.
Note: Why should we say False implies True (See line 2 of truth table at above)
This follows that: if P = FALSE, it doesn’t matter what Q is, Q will retain it’s status.
Going by our earlier Example: if P “is hot” but wrongly denoted as “is Cold”, Q “is humid”
would still hold true.
A complex sentence:
(whatever is not P)
James Isagara Kisoro BIST 1 CoCIS
Logic & Set Theory
Inference Rules
Logical inference is used to create new sentences
that logically follow from a given set of Knowledge
Base (KB) sentences.
An inference rule is sound if every sentence X
produced by an inference rule operating on a KB
logically follows from the KB. (That is, the inference
rule does not create any contradictions)
An inference rule is complete if it is able to produce
every expression that logically follows from (is
entailed by) the KB. (Note the analogy to complete
search algorithms.)
Inference Rules
A proof is a sequence of sentences, where each sentence is either a
premise or a sentence derived from earlier sentences in the proof by one
of the rules of inference.
The last sentence is the theorem (also called goal or query) that we want
to prove.
First-Order Logic
First-order logic (FOL) models the world in terms of
Objects, which are things with individual identities
color-of(Sky) = Blue
green(Grass)
color(Grass, Green)
Connectives
Same as in PL: not (), and (), or (), implies (), if and only
if (biconditional )
Quantifiers
Universal x or (Ax)
It is usually denoted by the turned A (∀) logical operator symbol, which,
when used together with a predicate variable, is called a universal
quantifier ("∀x", "∀(x)"
Existential x or (Ex)
It is usually denoted by the turned E (∃) logical operator symbol, which,
when used together with a predicate variable, is called an existential
quantifier ("∃x" or "∃(x)")
James Isagara Kisoro BIST 1 CoCIS
Logic & Set Theory
Semantics of FOL
Domain M: the set of all objects in the world (of interest)
Interpretation I: includes
Assign each constant to an object in M
S(x) is a P(x)
necessary and (x) P(x) <=> S(x)
sufficient S(x)
condition of P(x)
James Isagara Kisoro BIST 1 CoCIS
Logic & Set Theory
Expressing Uniqueness
Sometimes we want to say that there is a single, unique object
that satisfies a certain condition
“There exists a unique x such that king(x) is true”
x king(x) y (king(y) x=y)
! x king(x)
dead( x ruler(freedonia,x))
Notational Differences
Different symbols for and, or, not, implies, ...
p v (q r) p + (q * r)
etc
Prolog
cat(X) :- furry(X), meows (X), has(X, claws)
Lispy notations
(forall ?x (implies (and (furry ?x)
(meows ?x)
(has ?x claws))
(cat ?x)))