120 likes | 282 Views
Transition from Propositional Calculus. We used Propositional Calculus to study and manipulate propositions where each proposition was viewed as an entire entity . (we cheated a bit with “V-Q-E” substitution within a post condition in correctness proof)
E N D
Transition from Propositional Calculus • We used Propositional Calculus to study and manipulate propositions where each proposition was viewed as an entire entity. (we cheated a bit with “V-Q-E” substitution within a post condition in correctness proof) • Working with the internal parts of a proposition was not possible; although propositions may be“combined with operators,” internal composition and structure of the proposition was not considered. • The notion of quantification (collection of things) was not included • e. g. ( try getting P3 from P1 /\ P2 by replacement rule or truth table) • P1: Every dog has a tail • P2: Spot is dog • P3: Spot has a tail
Example of “Spot” P1 : Every dog has a tail P2 : Spot is a dog P3 : Spot has a tail What does forward chaining or backward chaining tell us? Is the compound proposition, (P1 /\ P2) -> P3, a tautology? Note this Not a tautology! A tautology, but of course! P1 P2 P3 P1/\P2 P1/\P2 -> P3 (P1/\P2) /\ (P1/\P2 -> P3) (P1/\P2) /\ (P1/\P2 -> P3) -> P3 T good T T T T T T Not good T T T F T F F T F T F T F T T F F F T F T F T T F T F T F T F F T T F F T F F T F T F F F F T F T
Example of “Spot” • But we “know” we can “reason” that Spot has a tail! • Predicate Calculus allows us to “reason” through this example as follows: • (1) every animal that has the property of dog has the property tail • (2) Spot is an animal that has the property dog • going back to the statement (1) above we will get • Spot has the property of dog and thus has the property tail • In this set of reasoning we used several of the capabilities from predicate calculus, which will be discussed later
Could Propositional Calculus Deal with “Spot?” • Consider the following propositions about a small domain of specific dogs: • P1 : Arf has a tail • P2 : Ace has a tail • P3 : JoJo has a tail • P4 : Spot has a tail • P5 : Bounce has a tail • Then we can show that P1/\P2/\P3/\P4/\P5 -> P4 • Making a statement about every element in the domain of dogs does allow us to conclude whether “Spot has a tail.” But we can not do this when the number of elements in the domain of dogs is “very large” or “infinite.” (Inconvenience in the case of very large; not possible in the case of infinite.) • We definitely need some way to deal with this infinite domain situation.
Another Example of Problem • Consider the following : • If (Fred lives in Marietta) then (it is not the case that Fred lives in Athens). • Fred lives in Marietta • Then it is not the case that Fred lives in Athens • This is all “logical” and looks as follows : • P1 -> P2 • P1 • therefore P2 or P1 -> P2, P1 => P2 (modus ponens) (Not a problem ------- but see the next slide ---)
Continuation of “Problem” example • Replace Fred with “someone” in the previous example: • If (someone lives in Marietta) then (it is not the case that someone lives in Athens). • someone lives in Marietta • It is not the case that someone lives in Athens • This line of reasoning is perfectly fine when using Propositional Calculus, but something doesn’t sound right because we know that there is “someone” that lives in Athens ! Replacing a constant, Fred, with a variablesomeone seems to create this anomaly. • What about the following ?: • If someone lives in Marietta then it is not the case that that same someone lives in Athens • Someone lives in Marietta • It is not the case that that same someone lives in Athens. • Note that when we cross referenced with “that same”, then the logical reasoning seemed to make sense. • Propositional Calculus does not handle the “internals” of a proposition; it only relates the propositional values at the “external” level!
Predicate Calculus • From the previous examples of Propositional Calculus’s limitation inhandling the internals of propositionsand potentially infinite domain, a more powerful logical system, called Predicate Calculus is introduced. • Along with the notion of “variable” and “constant,” it has two major characteristics: • Predicate • Quantification
Introduction to Predicate • Consider a proposition “generalized” to an expression which can be evaluated to be either true or false • An expression that contains 1) variables, 2)constants, 3)relational operators, and 4)arithmetic operators ( in some domain) • e.g.Length-of-logon-id < 9 (assumed domain is integers ) where Length-of-logon-id is a variable, < is the relational operator, 9 is an integer constant. • Can this expression be evaluated for its T or F value? what’s needed? ask class ?
Predicates • A proposition can be written to include a “relationshipconstruct” called predicate. • PRED (x1, x2, - - - , xn) where x1, - - - xn is the argument list and PRED is the predicate. • A predicate with n-arguments is called n-place predicate. • e.g. 2-place predicate: • Less_than (5, 8) • Mother_of (Sandy, Tom) • *** Note that the order of the arguments is extremely important here ! • e.g. 1-place predicate (has a property) • is-_21(Sam) • Is_running (MS Word) • Note that these predicates in the above examples can all be evaluated for its Truth/False value. ( because ?)
Constants and Variables - If all the arguments of a predicate are individual constants, then the resulting expression or formula must be either True or False. e.g, mother_of(person1, person2) has variables as arguments, but when replaced with mother-of(Jane, Joseph) then we can determine if the specific predicate is True or False. - With “Finite Universe” of discourse, we can represent the truth value of an n-place predicate with an n-dimensional array. e.g. with a 2-place predicate we can use a 2-dimensional array (or a table) to show the truth value of the finite universe. “mother_of” Jane Joseph Carol Sally assume that the total list of constants in the discourse is composed of: Jane, Joseph, Carol, and Sally Jane F T F T Joseph F F F F Carol T F F F Sally F F F F
Complex Expression (Formula) • Just as in propositional calculus where we combined propositions with operators, we can do the same with predicates • This concept of composition may be captured by the notion of a formula : • An atomic formula is a predicate name followed by an argument list. • e.g. Calls(module_x, module_z) • A complex formula is a combination of atomic formulae created with connectors such as ~, \/. /\, ->, <-> (introduced in the propositional calculus section). We will later introduce some more connectors (e.g. existential operators). • e.g. Calls(module_x, module_y) /\ Calls(module_x, module_w)
Examples of Predicate Expressions or Formulae • A transaction is invalid if its amount is less than $0. ( trans_amt < $0 ) -> ( is_invalid(trans) ) or $_amt_of(trans_amt, trans) /\ trans_amt < $0 -> state_is (trans, “invalid”) • There will never be more than 7 active on-line nodes on the system on_line_nodes < 8 or is_number_active_on( on_line_nodes, system) /\ on_line_nodes < 8