1 / 20

Propositional Calculus: Basics and Semantics

This lecture provides an introduction to propositional calculus, focusing on the fundamentals and semantics. It covers topics such as well-formed formulas, truth values, connectives, and equivalence. The lecture also discusses the semantics of propositional calculus, including interpretations and truth assignments.

jenningsj
Download Presentation

Propositional Calculus: Basics and Semantics

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Artificial Intelligence Lecture 3 Department of Computer Science, International Islamic Unveristy Islamabad

  2. Propositional calculus is based onpropositionswhich are statements that may or may not be true. • Propositional Calculus Sentences are made up of propositional symbols (P, Q, R, S, T, … i.e. uppercase letters near the end of the English alphabet), truth symbols (true, false) and connectives ( ^, v, ~, a, =). • Legal sentences are also calledwell-formed formulas(WFFs). • In the sentences of the form P^Q, P and Q are called the conjuncts. • In PvQ, P and Q are referred as disjuncts. • In an implication, PaQ, P is the premise or antecendent and Q is the conclusion or consequent. The Propositional Calculus

  3. In propositional calculus sentences, the symbols ( ) and [ ] are used to group symbols into sub-expressions and so control their order of evaluation and meaning. For example (PvQ)=R is quite different from Pv(Q=R). • Aninterpretationof a set of propositions is the assignment of a truth value, either T or F, to each propositional symbol. • Formally, an interpretation is a mapping from the propositional symbols into the set {T, F}. • Two expressions in the propositional calculus are equivalent if they have the same truth value under all truth value assignments. This may be proved using truth tables. • For example we have seen that (PaQ) = (~PvQ) i.e. the two expressions are equivalent. The Propositional Calculus

  4. Semantics of propositional Calculus • An interpretation of a sentence is the assignment of a truth value in some possible world. • The symbol true is always assigned T, and the symbol false is assigned F. • The truth assignment of negation, ~P, where P is any propositional symbol, is F if the assignment to P is T, and T if the assignment to P is F. • The truth assignment of conjunction, ^, is T only when both conjuncts have truth value T; otherwise it is F. • The truth assignment of disjunction, v, is F only when both disjuncts have truth value F; otherwise it is T. • The truth assignment of implication, a , is F only when the premise is T and the truth value of the consequent is F; otherwise it is always T. • The truth assignment of equivalence, =, is T only both expressions have the same truth assignment for all possible interpretations; otherwise it is F. • Precedence: ~, ^ & v, a , () left to right

  5. For propositional expressions P, Q and R: • ~(~P)=P • (PvQ)=(~PaQ) • de Morgan’s Law: ~(PvQ)=(~P^~Q) • de Morgan’s Law: ~(P^Q)=(~Pv~Q) • Distributive Law: Pv(Q^R)=(PvQ)^(PvR) • Distributive Law: P^(QvR)=(P^Q)v(P^R) • Commutative Law: Distributive Law: (PvQ)=(QvP) • Commutative Law: Distributive Law: (P^Q)=(Q^P) • Associative Law: (P^(Q^R))=((P^Q)^R) • Associative Law: (Pv(QvR))=((PvQ)vR) • Contrapositive Law: (PaQ)=(~Qa~P) • Identities such as above can be used to change predicate calculus expressions into a syntactically different but logically equivalent form. • An early AI program, the Logic Theorist (Newell & Simon, 1956) was based on this idea to prove many of the theorem in Russell and Whitehead’s Principia Mathematica. The Propositional Calculus

  6. In propositional calculus, each symbol (P, Q etc.) denotes a proposition of some complexity. There is no way to access the components of an individual assertion. Predicate calculus provides this ability. • Predicate calculus provides this capability. For example: P = “it rained on Tuesday” weather(tuesday,rain) • So we can create a predicate “weather” that describes a relationship between a date and the weather. • Through “inference rules”, we can manipulate predicate calculus expressions, accessing their individual components and inferring new sentences. The Predicate Calculus Propositional calculus Predicate calculus

  7. Predicate Calculus Symbols • The alphabets that make up the symbols of the predicate calculus consists of: • The set of letters, both upper- and lowercase, of English alphabet. • The set of digits, 0, 1, …, 9. • The underscore, _. • Symbols in the predicate calculus begin with a letter and are followed by any sequence of these legal characters. • Parentheses “( )”, commas “,”, and periods “.” are used solely to construct well-formed formulas (WFFs) and do not denote objects or relations in world. These are called improper symbols. The Predicate Calculus Symbols !!!

  8. Symbols and Terms Predicate calculus symbols include: • Truth symbols true and false (these are reserved symbols). • Constant symbols, which are symbol expressions having the first character lowercase. • Variable symbols, which are symbol expressions beginning with an uppercase character. • Function symbols, which are symbol expressions having the first character lowercase. Functions have an attached arity indicating the number of elements of the domain mapped onto each element of the range. • A function expression consists of a function constant of arity n, followed by n terms t1, t2, …, tn, enclosed in parentheses and separated by commas. • A term is either a constant, variable or function expression. The Predicate Calculus

  9. Symbols and Terms (Examples) • Legitimate predicate calculus symbols include George fire3 tom_and_jerry bill XFiles friends_of • Examples of strings that are not legal symbols are 3jack “no blanks allowed” ab%cd ***71 duck!!! • Constant symbol must begin with a lowercase letter: tree tall ahmad blue aSIF • Variable symbol must begin with an uppercase letter: Tree Tall Ahmad Blue SHAWAIZ • Following are examples of valid functions: f(X,Y) father(rehman) price(orange) • Following are examples of invalid functions: F(X,Y) FATHER(rehman) p%rice(orange) The Predicate Calculus

  10. Predicates and Atomic Sentences Predicate calculus symbols include: • Predicate symbols are symbols beginning with a lowercase letter. • Predicates have an associated positive integer referred to as the arity or “argument number” for the predicate. Predicates with the same name but different arities are considered distinct. • An atomic sentence is a predicate constant of arity n, followed by n terms t1, t2, …, tn, enclosed in parentheses and separated by commas. • The truth values, true and false are also atomic sentences. • Every atomic sentence is a predicate calculus sentence. • Predicate calculus sentences are delimited by a period. The Predicate Calculus

  11. Predicates and Atomic Sentences (examples) • friends(amir, ali) is an atomic sentence. • friends(father(amir), father(ali)) is an atomic sentence. • plus(two,three) is a function and thus not an atomic sentence. • equal(plus(two,three)) is an atomic sentence. • equal(plus(2,3),seven) is an atomic sentence. Note that this sentence, given the standard interpretation of plus and equal, is false. Well-formedness and truth value are independent issues. • likes(X,ali) is an atomic sentence (i.e. X likes ali) where X is any variable. • Likes(X,Y) is an atomic sentence (X likes Y) where X and Y are variables The Predicate Calculus

  12. Variable Quantifiers • When a variable appears as an argument in a sentence, it refers to unspecified objects in the domain. • Two variable quantifiers " and $ are used to constrain the meaning of the sentence containing a variable. • The universal quantifier, ", indicates that the sentence is true for all values of its variable. "X likes(X, ice_cream). • The existential quantifier, $, indicates that the sentence is true for some value(s) in the domain. $Y friends(Y, ahmad) • The following is another valid example of a predicate calculus sentence: $Y friends(Y, ahmad) ^ "X likes(X, ice_cream). The Predicate Calculus

  13. Automatic Checking of Expressions procedure verify_sentence(expression); begin case expression is an atomic sentence; return(success); expression is of the form Q X s, where Q is either or , X is a variable, and s is a sentence; if verify_sentence(s) returns success then return(success); expression is of the form ~s; if verify_sentence(s) returns success then return(success); expression is of the form s1 op s2, where op is a binary logical operator; if verify_sentence(s1) returns success and verfiy_sentence(s2) returns success then return(success); otherwise; return(fail); end; end. The Predicate Calculus

  14. Interpretation • Let the domain D be a nonempty set. An interpretation over D is an assignment of the entities of D to each of the constant, variable, predicate and function symbols of a predicate calculus expression, such that: • Each constant is assigned an element of D. • Each variable is assigned to a nonempty subset of D; these are allowable substitutions for that variable. • Each function of arity m is defined on m arguments of D and defines a mapping from Dm into D. • Each predicate p of arity n is defined on n arguments of D and defines a mapping from Dn into {T,F}. The Predicate Calculus

  15. Truth Value of Predicate Calculus Expressions • Assume an expression E and an interpretation I for E over a nonempty domain D. The truth-value of E is determined by: • The value of a constant is the element of D it is assigned to, by I. • The value of a variable is the set of elements of D it is assigned to, by I. • The value of a function expression is that element of D obtained by evaluating the function for the parameter values assigned by the interpretation I. • The value of truth symbol “true” is T and “false” is F. • The value of an atomic sentence is either T or F, as determined by the interpretation. • The value of the negation of a sentence is T if the value of the sentence is F and vice versa. • The value of the expressions involving ^, v, a and = is determined according to their definitions. • The value of "X S is T, if S is true for all assignments to X under I, and it is F otherwise. • The value of $X S is T, if there is an assignment to X in the interpretation under which S is T, and it is F otherwise.

  16. Examples of English Sentences Represented in Predicate Calculus • If it does not rain tomorrow, Tom will go to the mountains. ~weather(rain,tomorrow) ago(tom,mountains) • All basketball players are tall. "X (basketball_player(X) atall(X)) • Some people like mangoes. $ X (person(X) ^ likes(X,mangoes)) • Nobody likes taxes. ~$ X likes(X,taxes) The Predicate Calculus

  17. Blocks c b Robotic Arm a d Fixed Base Designing of an AI control Algorithm for a Robot Arm Objective • To model the block’s world shown in the figure above to design a control algorithm for a robotic arm. Assumptions • The computer has knowledge of the locations of the blocks (may be in the form of three dimensional coordinates). • It is able to keep track of these locations as the hand moves about the table.

  18. Predicate Calculus Description of the Block’s World on(c,a). Block ‘c’ is ‘on’ block ‘a’ on(b,d). Block ‘b’ is ‘on’ block ‘d’ ontable(a). Block ‘a’ is on table ontable(d). Block ‘d’ is on table clear(c). Block ‘c’ is clear on top clear(b). Block ‘b’ is clear on top hand_empty. Robot arm is empty Predicate Calculus Rules to Operate on the Block’s World • To pick up a block and stack it on another block, both blocks must be clear. • Because the arm can move blocks, it can change the state of the world and clear a block. • Suppose it removes block ‘c’ from block ‘a’. Thus the knowledge base is updated to reflect this, by deleting the assertion on(c,a). Designing of an AI control Algorithm for a Robot Arm

  19. Predicate Calculus Rules to Operate on the Block’s World • The program needs to be able to infer that the block ‘a’ has become clear. • The following rule describes when a block is clear” "X (~ $ Y on(Y,X) a clear(X)). For all X, X is clear, if there does not exist a Y such that Y is on X. • This rule not only defines ‘what it means for block to be clear’, but also provides a basis for determining ‘how to clear blocks that are not’. • For example, “block d is not clear”: • Because if variable X is give value d, substituting ‘b’ for Y will make the statement false. • Therefore, to make this definition true, block ‘b’ must be removed from block ‘d’. • This is easily done because the computer has a record of all the blcoks and their locations. Designing of an AI control Algorithm for a Robot Arm

  20. Predicate Calculus Rules to Operate on the Block’s World • Other rules such as describing the operation of stacking one block on another can also be defined. • For example: to stack X on Y, first empty the hand, then clear Y and then pick up X and put won X on Y. "X "Y (hand_empty ^ clear(X) ^ clear(Y) ^ pick_up(X) ^ put_down(X,Y) a stack(X,Y) ). • It must be noted that in implementation of the above description, it is necessary to “attach” an action of the robot arm to each predicate such as pick_up(X). Designing of an AI control Algorithm for a Robot Arm

More Related