280 likes | 449 Views
Explanation and Diagnoses Thomas Thomas & Jansen Orfan. Previously. Deduction P → Q P Therefore Q. Induction Every P seen comes with a Q Qs sometimes occur without P. Maybe P → Q . And now. Abduction P → Q Q Posit: P? Example. If it rained, the grass is wet. The grass is wet.
E N D
Explanation and Diagnoses Thomas Thomas & Jansen Orfan
Previously... • Deduction • P → Q • P • Therefore Q. • Induction • Every P seen comes with a Q • Qs sometimes occur without P. • Maybe P → Q
And now... • Abduction • P → Q • Q • Posit: P? • Example. • If it rained, the grass is wet. • The grass is wet. • I bet it rained.
Diagnosis • Might have: • DiseaseA ^ someQualifiers → SymptomsA • The following is unlikely: • SymptomsA ^ someQualifiers → DiseaseA • We want an explanation for symtoms, we won't be able to know for certain a disease.
Explanation So, what do we want in an explanation? • A is sufficient to account for B. • KB U {A} |= B or KB |= (A → B) • A is consistent with the KB • A is as simple and parsimonious as possible • A is in the the appropriate vocabulary • The abducibles
Prime Implicates So how do we get an explanation out of a KB? • A clauce c is a prime implicate of a KB iff • KB |= c • For every proper subset c' of c, it is not the case that KB |= c' • We can use these implicates to form explanations for facts.
Prime Implicates Continued KB: [(p ^ q ^ r > g), (~p ^ q > g), (~q ^ r > g)] • Convert to CNF... • [(~p v ~q v ~r v g), (p v ~q v g), (q v ~r v g)] • Resolve to get • (p v ~q v g), and (~r v g) • These are entailed by the KB but no subset of them are entailed. So they are among our prime implicants.
Prime Implicants Continued. So if we want an explanation for g. • Find all the prime implicates containing g. • (p v ~q v g), (~r v g), (g v ~g) • Remove the atom g. • (p v ~q), (~r), (~g) • Negate the remaining clauses. • (~p ^ q), (r), (g)
Unfortunately • Exponentially many prime implicants. • Worst case it's every possible combination of terms. • (a v b) (a v c) (a v d) (b v c) (b v d) (c v d) • Could all be prime implicants. • So we can't realistically precompute them without knowing what we're trying to explain.
Drinks Example 1 • KB • Vodka_Tonic → Vodka ^ Tonic • Black_Russian → Vodka ^ Coffee_Liqueur • White_Russian → Vodka ^ Coffee_Liqueur ^ Cream • Whiskey_Sour → Whiskey ^ Lemon • Irish_Coffee → Whiskey ^ Coffee • Rum&Coke → Rum ^ Cola • I know I will be drinking a mixed drink tonight and my bar is currently stocked with Whiskey, Lemon, Coffee, and Rum. Given only these recopies, what might I be able to make?
Drinks Example 1 • β= Whiskey V Lime V Lemon V Coffee • I will be drinking something • Start by finding the relevant prime implicants • ~Irish_Coffee V (Whiskey ^ Coffee) • ~Whiskey_Sour V (Whiskey ^ Lemon) • ~Rum&Coke V (Rum ^ Cola) • {Whiskey V ~Whiskey}, {Rum V ~Rum} etc. • Remove anything that implies β • ~Irish_Coffee • ~Whiskey_Sour • ~Rum&Coke V Cola • {~Whiskey}, {~Rum}, etc
Drinks Example 1 • Negate • Irish_Coffee • Whiskey_Sour • Rum&Coke ^ ~Cola • Contradiction! (Rum&Coke → Cola) • {Whiskey}, {Rum}, etc • Remove any explanation not conforming to the vocabulary H • Since I plan on drinking a mixed drink, H is all of the mixed drinks • Irish_Coffee • Whiskey_Sour
Drinks Example 2 • KB • Vodka_Tonic → Vodka ^ Tonic • Black_Russian → Vodka ^ Coffee_Liqueur • White_Russian → Vodka ^ Coffee_Liqueur ^ Cream • Whiskey_Sour → Whiskey ^ Lemon • Irish_Coffee → Whiskey ^ Coffee • Rum&Coke → Rum ^ Cola • β= Vodka V Coffee_Liqueur V Cream V Coffee
Drinks Example 2 • Start by finding the relevant prime implicants • Vodka_Tonic → Vodka ^ Tonic • Black_Russian → Vodka ^ Coffee_Liqueur • White_Russian → Vodka ^ Coffee_Liqueur ^ Cream • Irish_Coffee → Whiskey ^ Coffee • {Vodka V ~Vodka}, etc. • Remove anything that implies β • ~Irish_Coffee V Whiskey • ~Vodka_Tonic V Tonic • ~Black_Russian • ~White_Russian • ~Irish_Coffee V Whiskey • {~Vodka}, etc.
Drinks Example 2 • Negate • Irish_Coffee ^ ~Whiskey • Vodka_Tonic ^ ~Tonic • Black_Russian • White_Russian • Irish_Coffee ^ ~Whiskey • {Vodka}, etc. • Remove any explanation not consistent with KB or conforming to the vocabulary H • Black_Russian • White_Russian
Circuits in Logic • Components • AndGate(a1), XorGate(b1), OrGate(o1) • fullAdder(f) • Connectives • In1(b1) = in1(f), in1(b2) = out(b1) • Normal behavior • AndGate(x) ^ ~Abnormal(X) => out(x) == and(in1(x), in2(x))
Fault Model Then we might have a model for abnormal behavior. • Short Circuit: • [OrGate(x) v XorGate(x)] ^ Abnormal(x) => • out(x) = in2(x)
Abductive Diagnosis • So we're given. • The previous KB • Some input settings • in1(f) = 1, in2(f) = 0, in3(f) = 1 • Some output observations • out1(f) = 1, out2(f) = 0 • We want an A such that • KB U settings U {A} |= observations
Consistency-Based Diagnosis • As before, we're given... • The KB, some input settings, and some output observations • This time we want a set of components D such that the following two sets are consistent. • {ab(c) | c is in D} U {~ab(c) | c is not in D} • What does this mean? • KB U settings U observations
Differences • Abductive diagnosis requires a fault model • Only finds those errors that are in the fault model. • Consistency based can use a fault model, but doesn't require it. • Checks every fault model that is consistent with the given one. • Abductive diagnosis gives a much stronger claim. But how to calculate?
Calculation Continued. • All gates behaving abnormally is always consistent with the output but not helpful. • Remember that we're interested in minimal sets. • By default, nothing is wrong. • So we would prefer just b2 being abnormal • As given, we only have a fault model for short circuits on 'or' and 'xor' gates. So we cannot entail anything about other faults or about other gates.
Possible Extensions • Variables and Quantifiers • Could we return variables or predicates rather than atoms? • ie. All canaries rather than Tweety Bird. • Propabilities • Could simpler be a part that is more likely to fail than some other part? • Could X make Y likely?
Extensions Continued • Negative Evidence • So far we've insisted that explanations entail the thing to be explained. • Could we accept an explanation that does not entail fever as long as it didn't entail ~fever. • IE bird(x) explains flies(x)
Other Applications • Object Recognition • Model ^ camera → image. • Would like to recover model. • Hypothetical Reasoning • What would I have to be told to believe that B is true? • What would I learn if I were told that A is true?
Exercise • Probem 3, pg 283. • Consider the binary circuit for logical AND. • Figure 13.3 on page 284.
Exersise • Write sentences describing this circuit – its coomponents, connectivity, and normal behavior. • Write a sentence for a fauilt model saying that a faulty inverter has it's output the same as its input. • Assuming the fault model and that the output is 1 given inputs of 0 and 1, generate the three abductive explanations for this behavior. • Generate the three consistency based diagnoses for thie circuit under the same conditions. • Compare the abductive and consistency based diagnoses and explain informally why they are different.