120 likes | 255 Views
CIA2326 Week4: Predicate Logic : introduction. Lee McCluskey, room 2/07 Email lee@hud.ac.uk http://scom.hud.ac.uk/scomtlm/cia2326/. Propositional logic.
E N D
CIA2326 Week4:Predicate Logic: introduction Lee McCluskey, room 2/07 Email lee@hud.ac.uk http://scom.hud.ac.uk/scomtlm/cia2326/
Propositional logic ..usually means a language where propositional variables denote true and false. The language is made up of these variables and “logical connectives”. If X and Y are propositional variables then… ~X means "not X" X v Y " means "X or Y" X & Y " means "X and Y" X -> Y " means "X implies Y" or "X only if Y" X <- Y " means "X if Y" X <-> Y " means "X if and only if Y"
First - order (predicate) logic FOL (FOPL) is MORE EXPRESSIVE than propositional logic. It is a notation used widely in computing for • giving meaning to systems eg relational calculus in data bases • model of computation (with computational forms such as Prolog) • to help prove program correctness • To formalise requirements in EG safety-critical systems • expressing and manipulating knowledge
FOPL – grammar Syntax ClassesExample Syntax constants .. a,b,c ... functions .. f,g,h... - apply to constants/vars predicates .. p,q,r... - unary, binary, .. variables .. x,y,z... quantifiers .. A, E (A is upside down, and E back to front) connectives .. V, &, =>, <=>, <= Other bits .. Brackets Wffs – well formed formulae Eg Ax(p(x) => Ey q(x,y)&p(y))
FOPL – grammar WFF ::= ATOM | ~ ATOM | (WFF) | WFF connective WFF | quantifier variable WFF ATOM ::= predicate | predicate(ARG-LIST) ARG-LIST ::= TERM | TERM, ARG-LIST TERM ::= constant | variable | function(ARG-LIST)
Giving Meaning to FOPL • constants denote object names and data-type values in the world • unary predicates represent properties/classes eg cat(x), person(x), .. • other predicates represent relations between objects, and values of attributes eg brother(bill,ben), status(tank, full), between(X,Y,Z) • Wffs represent logical structure
Relation of FOPL with Prolog Conversion of Prolog into FOPL: Prolog clauses can be directly translated into FOPL, except for the so-called "extra logical" and "meta-logical" built in predicates. The three simple rules for conversion are: - 1. "," corresponds to "&" – 2. ":-" corresponds to "<-" 3. All variables are universally quantified. Examples grandfather(X,Y) :- father(X,Z),parent(Z,Y). In FOPC: Ax,Ax,Az (grandfather(x,y) <- (father(x,z)&parent(z,y))) uncle(X,Y) :- parent(Z,Y),brother(X,Z). In FOPC: Ax,Ay,Az ( uncle(x,y) <- (parent(z,y)&brother(x,z)))
FOPL: interpretation Given Wffs in FOPL, an interpretation I is given by mapping the constants, function and predicate symbols to elements in the conceptualisation Eg consider the set of wffs a., b. and c. a. Ax (P(x) -> R(x)) b. P(a) c. not (Ex P(x) & Q(x)) We may give this set many interpretations, for example: 1. Universe = people; P = "is a man", Q = "is a woman", R = "is mortal", a = "Socates". We say that Wff W is true in an interpretation I if W evaluates to true under I. The evaluation uses the “well known” meaning of connectives and quantifiers
FOPL: interpretation – another example Universe = persons Wffs Ax,Ax,Az g(x,y) <= (f(x,z)&p(z,y)) Ax,Ay,Az u(x,y) <= (p(z,y)&b(x,z)) Ax m(x) => p(x) Ax f(x) => p(x) Example Interpretation is: g = grandfather, f = father, p = parent, b = brother, u = uncle, m = mother Are the wffs true?
FOPL – reasoning IN fopl we are fundamentally interested in if a wff w LOGICALLY FOLLOWS from another wff W (usually written as “..a set of WFFs”) W |= w Definition: w logically follows from W if and only if every interpretation that makes W true also makes w true
FOPL – more definitions A Wff is Satisfiable – at least one interpretation makes it true Unsatisfiable – no interpretation makes it true Tautological or Valid – all interpretations makes it true
Conclusion: • FOPL is more expressive that Propositional Logic • We have introduced some definitions (which apply to FOPL and Propositional Logic) eg “Interpretation”, “Logically Follows”, “(Un)satisfiable” • See first 3 sections of http://scom.hud.ac.uk/scomtlm/cam326/logic/logic.html