Professional Documents
Culture Documents
INTELLIGENCE
AND EXPERT
SYSTEMS
MODULE 4
LECTURE 5
Kamanasish Bhattacharjee
Assistant Professor
Dept. of Analytics, SCOPE, VIT
ASSERTIONS AND QUERIES
ASKVARS: a function to know the values rather than just true or false.
ASKVARS(KB, Person(x))
{x/John}, {x/Richard}
THE KINSHIP DOMAIN
Objects – People/Persons
Property/Unary Relations/Unary Predicates – Male, Female
Binary Relations/Binary Predicates - Parent, Father, Mother, Sibling, Brother, Sister, Child,
Daughter, Son, Spouse, Wife, Husband, Grandparent, Grandchild, Cousin, Aunt, and Uncle.
THE KINSHIP DOMAIN
Circuit’s functionality
If all the inputs are high, what is the output of gate A2?
Circuit’s structure
What are all the gates connected to the first input terminal?
Does the circuit contain feedback loops?
ASSEMBLE THE RELEVANT KNOWLEDGE
First, we need to be able to distinguish gates from each other and from other
objects.
Each gate is represented as an object named by a constant, about which we assert
that it is a gate with, say, Gate(X1).
The behavior of each gate is determined by its type: one of the constants AND, OR,
XOR, or NOT.
Because a gate has exactly one type, a function is appropriate: Type(X1) = XOR.
Circuits, like gates, are identified by a predicate: Circuit(C1).
DECIDE ON VOCABULARY
1. If two terminals are connected, then they have the same signal:
∀ t1, t2 Terminal(t1) ∧ Terminal(t2) ∧ Connected(t1, t2) ⇒ Signal(t1) = Signal(t2)
3. Connected is commutative:
∀ t1, t2 Connected(t1, t2) ⇔ Connected(t2, t1)
4. There are four types of gates:
∀ g Gate(g) ∧ k = Type(g) ⇒ k = AND ∨ k = OR ∨ k = XOR ∨ k = NOT .
5. An AND gate’s output is 0 if and only if any of its inputs is 0:
∀ g Gate(g) ∧ Type(g) = AND ⇒ Signal(Out(1, g)) = 0 ⇔ ∃ n Signal(In(n, g)) = 0 .
6. An OR gate’s output is 1 if and only if any of its inputs is 1:
∀ g Gate(g) ∧ Type(g) = OR ⇒ Signal(Out(1, g)) = 1 ⇔ ∃ n Signal(In(n, g)) = 1 .
7. An XOR gate’s output is 1 if and only if its inputs are different:
∀ g Gate(g) ∧ Type(g) = XOR ⇒ Signal(Out(1, g)) = 1 ⇔ Signal(In(1, g)) = Signal(In(2, g)) .
8. A NOT gate’s output is different from its input:
∀ g Gate(g) ∧ (Type(g) = NOT) ⇒ Signal(Out(1, g)) = Signal(In(1, g)) .
9. The gates (except for NOT) have two inputs and one output:
∀ g Gate(g) ∧ Type(g) = NOT ⇒ Arity(g, 1, 1)
∀ g Gate(g) ∧ k = Type(g) ∧ (k = AND ∨ k = OR ∨ k = XOR) ⇒ Arity(g, 2, 1)
10. A circuit has terminals, up to its input and output arity, and nothing beyond
its arity:
∀ c, i, j Circuit(c) ∧ Arity(c, i, j) ⇒
∀ n (n ≤ i ⇒ Terminal(In(c, n))) ∧ (n > i ⇒ In(c, n) = Nothing) ∧
∀ n (n ≤ j ⇒ Terminal(Out(c, n))) ∧ (n > j ⇒ Out(c, n) = Nothing)
11. Gates, terminals, signals, gate types, and Nothing are all distinct:
∀ g, t Gate(g) ∧ Terminal(t) ⇒ g = t = 1 = 0 = OR = AND = XOR = NOT = Nothing .
12. Gates are circuits:
∀ g Gate(g) ⇒ Circuit(g)
ENCODE THE SPECIFIC PROBLEM INSTANCES
Connections:
Connected(Out(1, X1), In(1, X2)) Connected(In(1, C1), In(1, X1))
Connected(Out(1, X1), In(2, A2)) Connected(In(1, C1), In(1, A1))
Connected(Out(1, A2), In(1, O1)) Connected(In(2, C1), In(2, X1))
Connected(Out(1, A1), In(2, O1)) Connected(In(2, C1), In(2, A1))
Connected(Out(1, X2), Out(1, C1)) Connected(In(3, C1), In(2, X2))
Connected(Out(1, O1), Out(2, C1)) Connected(In(3, C1), In(1, A2))
POSE QUERIES TO THE INFERENCE
PROCEDURE AND GET ANSWERS
What combinations of inputs would cause the first output of C1 (the sum bit) to
be 0 and the second output of C1 (the carry bit) to be 1?
∃ i1, i2, i3 Signal(In(1, C1)) = i1 ∧ Signal(In(2, C1)) = i2 ∧ Signal(In(3, C1)) = i3
∧ Signal(Out(1, C1)) = 0 ∧ Signal(Out(2, C1)) = 1