Presentation is loading. Please wait.

Presentation is loading. Please wait.

Data and Knowledge Representation Lecture 2 Qing Zeng, Ph.D.

Similar presentations


Presentation on theme: "Data and Knowledge Representation Lecture 2 Qing Zeng, Ph.D."— Presentation transcript:

1 Data and Knowledge Representation Lecture 2 Qing Zeng, Ph.D.

2 Last Time We Talked About Why is knowledge/data representation important Why is knowledge/data representation important Propositional Logic Propositional Logic Operators Operators WFF WFF Truth table Truth table

3 Today We Will Talk About Boolean Algebra Boolean Algebra Predicate Logic (First order logic) Predicate Logic (First order logic)

4 Exercise Generate a truth table for Generate a truth table for

5 Boolean Algebra Named in honor of George Boole Named in honor of George Boole http://www.digitalcentury.com/encyclo/updat e/boole.html http://www.digitalcentury.com/encyclo/updat e/boole.html Another way of reasoning with proposition logic Another way of reasoning with proposition logic Is a form of equational reasoning Is a form of equational reasoning

6 Laws of Boolean Algebra Operations with Constants a Λ False = False a Λ False = False a V True = True a V True = True a Λ True = a a Λ True = a a V False = a a V False = a

7 Laws of Boolean Algebra Basic properties of Λ and V a → a V b a → a V b a Λ b → a a Λ b → a a Λ a = a a Λ a = a a V a = a a V a = a a Λ b = b Λ a a Λ b = b Λ a a V b = b V a a V b = b V a (a Λ b) Λ c = a Λ (b Λ c) (a Λ b) Λ c = a Λ (b Λ c) (a V b) V c = a V (b V c) (a V b) V c = a V (b V c) Note the difference between “→” and “=“

8 a → a V b ab a V b a → a V b 0001 0111 1011 1111

9 a Λ b → a ab a Λ b a Λ b → a 0001 0101 1001 1111

10 Laws of Boolean Algebra Distributive and DeMorgan ’ s Laws a Λ (b V c) = (a Λ b) V (a Λ c) a Λ (b V c) = (a Λ b) V (a Λ c) a V (b Λ c) = (a V b) Λ (a V c) a V (b Λ c) = (a V b) Λ (a V c) ¬ (a Λ b) = ¬ a V ¬ b ¬ (a Λ b) = ¬ a V ¬ b ¬ (a V b) = ¬ a Λ ¬ b ¬ (a V b) = ¬ a Λ ¬ b

11 Laws of Boolean Algebra Laws on Negation ¬True = False ¬True = False ¬False = True ¬False = True a Λ ¬a = False a Λ ¬a = False a V ¬a = True a V ¬a = True ¬(¬a) = a ¬(¬a) = a

12 Laws of Boolean Algebra Laws on Implication (a Λ (a → b)) → b (a Λ (a → b)) → b ((a → b) Λ ¬b) → ¬a ((a → b) Λ ¬b) → ¬a ((a V b) Λ ¬a) → b ((a V b) Λ ¬a) → b ((a → b) Λ (b → c)) → (a → c) ((a → b) Λ (b → c)) → (a → c) ((a → b) Λ (c → d)) → ((a Λ c) → (b Λ d)) ((a → b) Λ (c → d)) → ((a Λ c) → (b Λ d)) ((a → b) → c) → ( a → (b → c)) ((a → b) → c) → ( a → (b → c)) ((a Λ b) → c) = ( a → (b → c)) ((a Λ b) → c) = ( a → (b → c)) a → b = ¬a V b a → b = ¬a V b a → b = ¬b → ¬a a → b = ¬b → ¬a (a → b) Λ (a → ¬ b) = ¬a (a → b) Λ (a → ¬ b) = ¬a

13 a → b = ¬aVb ab a→ba→ba→ba→b¬a¬aVb 001111 011111 100001 111011

14 (a → b) Λ (a → ¬ b) = ¬a

15 Laws of Boolean Algebra Equivalence a ↔ b = (a → b) Λ (b → a)

16 Examples Please write a propositional logic WFF for the following eligibility criteria: Please write a propositional logic WFF for the following eligibility criteria: “a women over 50-year old and not on hormonal therapy” w Λ old Λ ¬ (hrt) Need to define w, old, and hrt

17 Examples Please write a propositional logic WFF for the following guideline: Please write a propositional logic WFF for the following guideline: “All women over 30 years old should have pap smear every year” w Λ Over30 → pap_yearly How to convey “all”?

18 Predicate Logic Extension to propositional logic Extension to propositional logic Augmented with variables, predicates and quantifiers Augmented with variables, predicates and quantifiers

19 Predicate A predicate is a statement that an object x has certain property A predicate is a statement that an object x has certain property E.g. F (x): F is the predicate and x is the variable F applies to E.g. F (x): F is the predicate and x is the variable F applies to Any term in the form F(x), where F is a predicate name and x is a variable name, is a well-formed formula. Similarly, F(X 1, X 2 ………X k ) is a well-formed formula; this is a predicate containing k variables Any term in the form F(x), where F is a predicate name and x is a variable name, is a well-formed formula. Similarly, F(X 1, X 2 ………X k ) is a well-formed formula; this is a predicate containing k variables

20 Examples Women over 70 years old Women over 70 years old Women (x) Ξ x is female senior (x) Ξ x is over 70 years old

21 Quantifiers There are two quantifiers in predicate logic: There are two quantifiers in predicate logic: The universal quantification: The universal quantification: The existential quantification: The existential quantification:

22 Universal Quantification If F(x) is a well-formed formula containing the variable x, then is a well- formed called a universal quantification. For all x in the universe, the predicate F(x) holds. In other words: every x has the property F. If F(x) is a well-formed formula containing the variable x, then is a well- formed called a universal quantification. For all x in the universe, the predicate F(x) holds. In other words: every x has the property F.

23 Existential Quantification If F(x) is a well-formed formula containing the variable x, then is a well- formed called a existential quantification. For one or more x in the universe, the predicate F(x) holds. In other words: some x has the property F. If F(x) is a well-formed formula containing the variable x, then is a well- formed called a existential quantification. For one or more x in the universe, the predicate F(x) holds. In other words: some x has the property F.

24 Universe of Discourse Also called universe or U Also called universe or U A set of possible values that the variables can have A set of possible values that the variables can have Let U be all female, C (x, “xx”) mean x has XX chromosomes, then is true Let U be all female, C (x, “xx”) mean x has XX chromosomes, then is true Let U be all patients, C (x, “xx”) mean x has XX chromosomes, then is false Let U be all patients, C (x, “xx”) mean x has XX chromosomes, then is false

25 Scope of Variables Bindings Quantifiers bind variables by assigning them values from a universe Quantifiers bind variables by assigning them values from a universe This formula This formula Can be interpreted as Or Use parentheses if not clear Use parentheses if not clear

26 Translation What does B → A mean? What does A Λ C → B mean? But is C a test the patient in A took?

27 Translation What does mean? Can we say some pregnant female does not have positive pregnancy test results?

28 Algebraic Laws of Predicate Logic x is any element in the universe. The element c is any fixed element of the universe.

29 Algebraic Laws of Predicate Logic q is a proposition that does not contain x

30 Algebraic Laws of Predicate Logic Please note the difference between “ →” and “=“

31 Equational Reasoning Showing two values are the same by building up chains of equalities Showing two values are the same by building up chains of equalities Substitute equals for equals Substitute equals for equals

32 Example

33 Example

34 Exercise Prove Pˬ(QVP) = False Prove Pˬ(QVP) = False

35 Exercise Prove Prove

36 Exercise Translate the following into Predicate Logic: Translate the following into Predicate Logic: Some patients only speak Spanish. Some patients only speak Spanish. All doctors speak English, while some can also speak Spanish. All doctors speak English, while some can also speak Spanish. Spanish speaking doctors should be assigned to patients who only speak Spanish Spanish speaking doctors should be assigned to patients who only speak Spanish

37 Alternatives in Modeling X has Diabetes: X has Diabetes: Diabetes (x) Diabetes (x) Has_Diagnosis (x, “Diabetes”) Has_Diagnosis (x, “Diabetes”) Has (x, “Diagnosis”, “Diabetes”) Has (x, “Diagnosis”, “Diabetes”) Trade off between efficiency and expressiveness Trade off between efficiency and expressiveness Has (x, y, “Diabetes”) Has (x, y, “Diabetes”)

38 Relationship to OO model Representing patient X has Diabetes in OO model: Representing patient X has Diabetes in OO model: Diabetes (x) Diabetes (x) Object x has an attribute called Diabetes Object x has an attribute called Diabetes Has_Diagnosis (x, “Diabetes”) Has_Diagnosis (x, “Diabetes”) Object x has an attribute called Has_Diagnosis which can have value “Diabetes” Object x has an attribute called Has_Diagnosis which can have value “Diabetes” Has (x, “Diagnosis”, “Diabetes”) Has (x, “Diagnosis”, “Diabetes”) Object x has an attribute called Has which can have value observation, which is an object with attributes observation type “Diagnosis” and observation value “Diabetes” Object x has an attribute called Has which can have value observation, which is an object with attributes observation type “Diagnosis” and observation value “Diabetes”

39 Relationship to DB Representing patient X has Diabetes in a table: Representing patient X has Diabetes in a table: Diabetes (x) Diabetes (x) A table called Diabetes with column (s) identifying patient x and a column of the value of Diabetes (x) A table called Diabetes with column (s) identifying patient x and a column of the value of Diabetes (x) Has_Diagnosis (x, “Diabetes”) Has_Diagnosis (x, “Diabetes”) A table called Diagnosis with column (s) identifying patient x, and diagnosis y and a column of the value of Has_Diagnosis (x, y) A table called Diagnosis with column (s) identifying patient x, and diagnosis y and a column of the value of Has_Diagnosis (x, y) Has (x, “Diagnosis”, “Diabetes”) Has (x, “Diagnosis”, “Diabetes”) A table called observation with column (s) identifying patient x, observation type y and observation value z and a column of the value of Has (x, y, z) A table called observation with column (s) identifying patient x, observation type y and observation value z and a column of the value of Has (x, y, z)

40 Different Representation of First- Order Logic Conceptual Graph (CG) Conceptual Graph (CG) Knowledge Interchange Format (KIF) Knowledge Interchange Format (KIF) Conceptual Graph Interchange Format (CDIF) Conceptual Graph Interchange Format (CDIF) ……….. ………..

41 Examples of Medical Knowledge Nitrates are a safe and effective treatment that can be used in patients with angina and left ventricular systolic dysfunction. Nitrates are a safe and effective treatment that can be used in patients with angina and left ventricular systolic dysfunction. On the basis of currently published evidence, amlodipine is the calcium channel antagonist that it is safest to use in patients with heart failure and left ventricular systolic dysfunction. On the basis of currently published evidence, amlodipine is the calcium channel antagonist that it is safest to use in patients with heart failure and left ventricular systolic dysfunction. Coronary artery bypass grafting may be indicated, in some, for relief of angina Coronary artery bypass grafting may be indicated, in some, for relief of angina All patients with heart failure and angina should be referred for specialist assessment. All patients with heart failure and angina should be referred for specialist assessment. Patients with angina and mild to moderately symptomatically severe heart failure that is well controlled, and who have no other contraindications to major surgery, should be considered for coronary artery bypass grafting on prognostic (as well as symptomatic) grounds. Patients with angina and mild to moderately symptomatically severe heart failure that is well controlled, and who have no other contraindications to major surgery, should be considered for coronary artery bypass grafting on prognostic (as well as symptomatic) grounds.

42 Limitation Real world sometimes can not be represented using logic Real world sometimes can not be represented using logic Induction and deduction model Induction and deduction model Uncertainty and probability Uncertainty and probability Context and exception Context and exception

43 Alternatives Case-based reasoning (Analogy) Case-based reasoning (Analogy) Fuzzy logic Fuzzy logic Nonmonotonic logic Nonmonotonic logic

44 Extra Reading Aho’s book chapter 14 Aho’s book chapter 14 Sowa’s book p467-488 Sowa’s book p467-488


Download ppt "Data and Knowledge Representation Lecture 2 Qing Zeng, Ph.D."

Similar presentations


Ads by Google