Presentation is loading. Please wait.

Presentation is loading. Please wait.

Semantic Web Logic.

Similar presentations


Presentation on theme: "Semantic Web Logic."— Presentation transcript:

1 Semantic Web Logic

2 Knowledge Representation
The subjects presented so far were related to the representation of knowledge Knowledge Representation was studied long before the emergence of WWW in AI Logic is still the foundation of KR, particularly in the form of predicate logic (first-order logic)

3 The Importance of Logic
High-level language for expressing knowledge High expressive power Well-understood formal semantics Precise notion of logical consequence Proof systems that can automatically derive statements syntactically from a set of premises

4 What is logic? The branch of philosophy concerned with analysing the patterns of reasoning by which a conclusion is drawn from a set of premises, without reference to meaning or context (Collins English Dictionary)

5 Digital Logic

6 Propositional logic Simple types of statements, called propositions, are treated as atomic building blocks for more complex statements 1) Alexandria is a port or a holiday resort. 2) Alexandria is not a port. Therefore, Alexandria is a holiday resort

7 Basic connectives and truth tables
statements (propositions): declarative sentences that are either true or false--but not both. Eg. Ahmed Hassan wrote Gone with the Wind. 2+3=5. not statements: What a beautiful morning! Get up and do your exercises.

8 Propositional connectives
Propositional logic has four connectives Name Read as Symbol negation ‘not’ conjunction ‘and’ disjunction ‘or’ implication ‘if…then…’

9 Logical Operators About a dozen logical operators
Similar to algebraic operators + * - / In the following examples, p = “Today is Friday” q = “Today is my birthday”

10 Logical operators: Not
A “not” operation switches (negates) the truth value Symbol:  or ~ p = “Today is not Friday” p p T F

11 Logical operators: And
An “and” operation is true if both operands are true Symbol:  It’s like the ‘A’ in And pq = “Today is Friday and today is my birthday” p q pq T F

12 Logical operators: Or An “or” operation is true if either operands are true Symbol:  pq = “Today is Friday or today is my birthday (or possibly both)” p q pq T F

13 Logical operators: Conditional
A conditional means “if p then q” Symbol:  pq = “If today is Friday, then today is my birthday” p→q=¬pq p q pq T F

14 Logical operators: Bi-conditional
A bi-conditional means “p if and only if q” Symbol:  Alternatively, it means “(if p then q) and (if q then p)” Note that a bi-conditional has the opposite truth values of the exclusive or p q pq T F

15 Boolean operators summary
not and or xor conditional Bi-conditional p q p q pq pq pq pq pq T F Learn what they mean, don’t just memorize the table!

16 Example s: Aya goes out for a walk. t: The moon is out.
u: It is snowing. : If the moon is out and it is not snowing, then Aya goes out for a walk. If it is snowing and the moon is not out, then Aya will not go out for a walk.

17 Translating English Sentences
p = “It is below freezing” q = “It is snowing” It is below freezing and it is snowing It is below freezing but not snowing It is not below freezing and it is not snowing It is either snowing or below freezing (or both) If it is below freezing, it is also snowing It is either below freezing or it is snowing, but it is not snowing if it is below freezing That it is below freezing is necessary and sufficient for it to be snowing pq p¬q ¬p¬q pq p→q ((pq)¬(pq))(p→¬q) p↔q

18 Tables of Logical Equivalences
Identity laws Like adding 0 Domination laws Like multiplying by 0 Idempotent laws Delete redundancies Double negation “I don’t like you, not” Commutativity Like “x+y = y+x” Associativity Like “(x+y)+z = y+(x+z)” Distributivity Like “(x+y)z = xz+yz” De Morgan L3

19 Fundamentals of Logic A compound statement is called a tautology(T0) if it is true for all truth value assignments for its component statements. If a compound statement is false for all such assignments, then it is called a contradiction(F0). : tautology : contradiction

20 Tautology example Demonstrate that [¬p (p q )]q
is a tautology in two ways: Using a truth table – show that [¬p (p q )]q is always true Using a proof (will get to this later).

21 Tautology by truth table
p q ¬p p q ¬p (p q ) [¬p (p q )]q T F

22 Derivational Proof Techniques
A: Part of it is a tautology (p p ) and the disjunction of True with any other compound proposition is still True: (p p )  ((sr)t ))  (qr ) T  ((sr)t ))  (qr ) T Derivational techniques formalize the intuition of this example. L3

23 Propositional Logic - an unfamous 
if NOT (blue AND NOT red) OR red then… (p  q)  q  p  q (p  q)  q (p  q)  q DeMorgan’s (p  q)  q Double negation p  (q  q) Associativity p  q Idempotent

24 Decide whether the following statements are tautologies or contradictions or neither
1. (p  q)  (q  p). 2. (p  q)  (q  ¬p). 3. p  ¬p. 4. (p  ¬q)  (q  ¬p).

25 … Predicates Ahmed eats pizza at least once a week. Define:
EP(x) = “x eats pizza at least once a week.” Universe of Discourse - x is a student in CS203 A predicate is a function that takes some variable(s) as arguments and returns True or False. Note that EP(x) is not a proposition, EP(Hassan) is.

26 Predicates A predicate is a property or description of subjects in the universe of discourse. The following predicates are all italicized : Johnny is tall. The bridge is structurally sound. 17 is a prime number. Java: predicates are boolean-valued method calls- someLinkedList.isEmpty() isPrime(17)

27 Quantifiers There are two quantifiers Existential Quantifier
“” reads “there exists” Universal Quantifier “” reads “for all” Each is placed in front of a propositional function and binds it to obtain a proposition with semantic value. Mnemonics:  -- reverse E signifies “there Exists”  -- upside-down A signifies “for All”

28 Predicates - the universal quantifier
Suppose P(x) is a predicate on some universe of discourse. Ex. B(x) = “x is carrying a backpack,” x is set of CS203 students. The universal quantifier of P(x) is the proposition: “P(x) is true for all x in the universe of discourse.” We write it x P(x), and say “for all x, P(x)” x P(x) is TRUE if P(x) is true for every single x. x P(x) is FALSE if there is an x for which P(x) is false. x B(x)?

29 Predicates - the existential quantifier
Suppose P(x) is a predicate on some universe of discourse. Ex. C(x) = “x has a cat,” x is set of CS203 students. The existential quantifier of P(x) is the proposition: “P(x) is true for some x in the universe of discourse.” We write it x P(x), and say “for some x, P(x)” x P(x) is TRUE if there is an x for which P(x) is true. x P(x) is FALSE if P(x) is false for every single x. x C(x)?

30 Predicates - the existential quantifier
Universe of discourse is people in this room. B(x) = “x is wearing sneakers.” L(x) = “x is at least 16 years old.” Y(x)= “x is less than 24 years old.” Are either of these propositions true? x B(x) x (Y(x)  L(x)) A: only a is true B: only b is true C: both are true D: neither is true

31 Predicates - more examples
Universe of discourse is all creatures. L(x) = “x is a lion.” F(x) = “x is fierce.” C(x) = “x drinks coffee.” All lions are fierce. Some lions don’t drink coffee. Some fierce creatures don’t drink coffee. x (L(x)  F(x)) x (L(x)  C(x)) x (F(x)  C(x))

32 Predicates - more examples
B(x) = “x is a hummingbird.” L(x) = “x is a large bird.” H(x) = “x lives on honey.” R(x) = “x is richly colored.” All hummingbirds are richly colored. No large birds live on honey. Birds that do not live on honey are dully colored. Universe of discourse is all creatures. x (B(x)  R(x)) x (L(x)  H(x)) x (H(x)  R(x))

33 Fundamentals of Logic The Use of Quantifiers Ex universe: real numbers

34 Predicates - the universal quantifier
Universe of discourse is people in this Hall. B(x) = “x is wearing sneakers.” L(x) = “x is at least 18 years old.” Y(x)= “x is less than 24 years old.” Are either of these propositions true? x (Y(x)  B(x)) x (Y(x)  L(x)) A: only a is true B: only b is true C: both are true D: neither is true

35 Predicates - quantifier negation
x (L(x)  H(x)) Not all large birds live on honey. x P(x) means “P(x) is true for every x.” What about x P(x) ? Not [“P(x) is true for every x.”] “There is an x for which P(x) is not true.” x P(x) So, x P(x) is the same as x P(x). x (L(x)  H(x))

36 Predicates - quantifier negation
x (L(x)  H(x)) No large birds live on honey. x P(x) means “P(x) is true for some x.” What about x P(x) ? Not [“P(x) is true for some x.”] “P(x) is not true for all x.” x P(x) So, x P(x) is the same as x P(x). x (L(x)  H(x))

37 Fundamentals of Logic Ex. p(x): x is odd. q(x): x2-1 is even. Negate
(If x is odd, then x2-1 is even.) There exists an integer x such that x is odd and x2-1 is odd. (a false statement, the original is true)

38 Predicates - quantifier negation
No large birds live on honey. x (L(x)  H(x))  x (L(x)  H(x)) Negation rule  x (L(x)  H(x)) DeMorgan’s  x (L(x)  H(x)) Subst for  What’s wrong with this proof?

39 Fundamentals of Logic multiple variables

40 Order matters Set the universe of discourse to be all natural numbers {0, 1, 2, 3, … }. Let R (x,y ) = “x < y”. Q1: What does x y R (x,y ) mean? Q2: What does y x R (x,y ) mean?

41 Order matters R (x,y ) = “x < y” A1: x y R (x,y ):
“All numbers x admit a bigger number y ” A2: y x R (x,y ): “Some number y is bigger than all x” Q: What’s the true value of each expression?

42 Using FOL Brothers are siblings One's mother is one's female parent
 x,y Brother(x,y)  Sibling(x,y) One's mother is one's female parent  m,c Mother(c) = m  (Female(m)  Parent(m,c)) “Sibling” is symmetric  x,y Sibling(x,y)  Sibling(y,x) A first cousin is a child of a parent’s sibling  x,y FirstCousin(x,y)   p,ps Parent(p,x)  Sibling(ps,p)  Parent(ps,y)

43 An example Sameh is a lawyer. Lawyers are rich.
Rich people have big houses. Big houses are a lot of work. We would like to conclude that Sameh’s house is a lot of work. Natural languages are ambiguous so we can have different axiomatizations.

44 Axiomatization 1 lawyer(Sameh) x lawyer(x)  rich(x)
x rich(x)  y house(x,y) x,y rich(x)  house(x,y)  big(y) x,y ( house(x,y)  big(y)  work(y) ) 3 and 4, say that rich people do have at least one house and all their houses are big. Conclusion we want to show: house(Sameh, S_house)  work(Sameh, S_house) Or, do we want to conclude that John has at least one house that needs a lot of work? I.e. y house(Sameh,y)  work(y)

45 Amir and the cat Everyone who loves all animals is loved by someone.
Anyone who kills an animal is loved by no one. Mohamed loves all animals. Either Mohamed or Amir killed the cat, who is named SoSo. Did Amir kill the cat?


Download ppt "Semantic Web Logic."

Similar presentations


Ads by Google