480 likes | 895 Views
Modal Logic A Friendly Introduction. First-Order Modal Logic M. Fitting and Richard L. Mendelson A New Introduction to Modal Logic G.E. Hughes and M.J. Cresswell. Presented By Eran Yahav yahave@post.tau.ac.il http://www.cs.tau.ac.il/~yahave. Why Study Modal Logic.
E N D
Modal LogicA Friendly Introduction First-Order Modal Logic M. Fitting and Richard L. Mendelson A New Introduction to Modal Logic G.E. Hughes and M.J. Cresswell Presented By Eran Yahav yahave@post.tau.ac.il http://www.cs.tau.ac.il/~yahave
Why Study Modal Logic • Generalizes important logics • Temporal logics • Dynamic logic • Logic of knowledge • And more... • Applications in • Program semantics • Verification and Model Checking • Artificial intelligence • And more…
What is a Modal? Classical propositional logic P Q R Jonathan is happy It is true that Jonathan is happy
Alethic Temporal Deontic Epistemic What is a Modal? Qualification over the truth of claim Necessarily Possibly Will be Was Has been Will have been May Can Must Certainly Probably Perhaps Surely Jonathan is _____ happy It is _____ true that Jonathan is happy
Outline • Propositional Modal Logic • Possible world semantics (Kripke Semantics) • Temporal logic, epistemic logic • First-Order Modal Logic • What the quantifiers quantify over • Constant and Varying Domains • Applications in program semantics • Summary
Propositional Modal Logic • Syntax • Propositional logic • Modal operators • - necessarily (box) • - possibly (diamond) (PQ)(PQ) PQ
Informal Interpretations Jonathan is happy Jonathan is happy under interpretation i0 Jonathan is happy Jonathan is happy i Jonathan is happy under interpretation i i Jonathan is happy under interpretation i PP PP
Possible World Semantics • Possible interpretation = possible world • Accessibility relation Jonathan is happy w w0Rw Jonathan is happy at w PP (w w0Rw P at w) P at w0
Possible World Semantics • Valid propositional formula • True for every possible assignment to propositions • “all lines of the truth table” • Quantify over possible worlds P Q (PQ)P FF FT F F T F T T T F T TF TT T T T
Frames and Models • Frame • G – non-empty set of possible worlds • R – binary accessibility relation • Model • A frame <G,R> with an assignment V • V - which propositions are true at which worlds • Also denoted
Truth in a Model • w X w X • w (XY) w X and w Y • w X for every w’G, if (w,w’)R then w’ X • w X for some w’G, if (w,w’)R then w’ X
Example a b c P Q b PQ a P c PQ a Q a (P Q) a P Q
Example a b c P a P a P
More General Examples • Given a model G,R,, aG • a (PQ) a P Q • Under what terms • P P for each world aG • P P • P P • P P transitive reflexive symmetric symmetric and transitive
Important Modal Logics S5 B S4 T K4 D K
Logical Consequence • Set of formulae formula • Classically • S X when X must be true whenever members of S are true • Modal setting • X is true at each world in which members of S are true? (local) • X is valid in every model in which members of S are valid? (global)
Logical Consequence • Answer: both • S U X • S – set of formulae – global assumptions • U – set of formulae – local assumptions • X – single formula • X is consequence of S and U when • For every model in which all members of S are valid • and for every world w in which satisfies U • we have w X
Example a {PP} (P P) a P a PP b P a P a P P At world a local assumptions are true but P P is not b P
Example {PP} P P assume a P Let a world b, aRb Then b P But PP is valid in the model b P And thus a P And therefore P P follows from the global assumption
Temporal Logic Jonathan is happy at time t Jonathan is happy in March 1999 Jonathan is happy in June 2000 t Jonathan is happy at time t t Jonathan is happy at time t Jonathan is happy t Jonathan is happy at time t Jonathan is happy t Jonathan is happy at time t
Temporal Logic • F P – will sometime be the case that P • P P – was sometime be the case that P • G P – will always be the case that P • H P – has always been P • In common temporal logic • P = P G P • P = P F P
Epistemic Logic • Logic of knowledge • Ka P – a knows that P • Pa P – it is possible, for all that a knows, that P • Logic of belief • Ba P – a believes that P • Ca P – it is compatible with everything a believes in that P
Epistemic Logic Ka (P Q) (Ka P Ka Q) Ka P P Ka P Ka Ka P Ka P Ka Ka P Ka Kb P Ka P Ka P Pa P
Epistemic Logic Example Ka (P Q) (Ka P Ka Q) E = I see my hand S = I’m dreaming (1) Ka(E S) (2) KaS Ka (E S) (Ka E Ka S) Ka (E S) (KaS Ka E) By (1) and (2) Ka E
First-Order Modal Logic • , – quantify over possible worlds • , – quantify over individuals • Complications • What quantifiers quantify over? • Mixing modal operators and quantifiers
It is a necessary truththat everything is F Each thing is such thatit has F necessarily xF(x) xF(x) de re de dicto Necessity de re & de dicto Everything is necessarily F
What the Quantifiers Quantify Over • Universal Instantiation (classical logic) • x (x) (y) • First order modal logic • object need not exist in more than one world • Free variables take values from the domain of the model, not domain of world we are in • Validity depends on possible-world semantics • Holds in constant domain semantics • Does not hold in varying domain semantics
Constant Domains • Augmented Frame G,R,D • G,R as in PML • D – domain of the frame • Model G,R,D,L • L – interpretation assigning to each n-ary predicate P and each world w some n-ary relation on D • Valuation • Assign a member v(x) D to each free variable x
Constant Domains • Quantification over objects of the model • Universal instantiation holds • x (x) (y) • Possiblist quantification • Simpler to handle • yx(x=y) • If pigs could fly
Varying Domains • Augmented Frame G,R,D • G,R as in PML • D – domain function, mapping worlds to non-empty sets • Model G,R,D,L • L – interpretation assigning to each n-ary predicate P and each world w some n-ary relation on DF • Valuation • Assign a member v(x) DF to each free variable x • Simulate constant domain model • For all w D(w) = DF
Varying Domains • Two ways for individual e to have at w • e is at w and e is in w • e is at w but e not in w • Something does not exist in this world • But still has the property • Quantification only over objects in world’s domain --- actualist quantification • Pigs cannot fly
Existence Relativization • Define a special unary predicate • For a formula , we define • If a is atomic A = A • (X) = (X) • (XY) = (X Y) • (X) = X • (x ) = x (x) • (x ) = x (x) • A sentence is valid in every varying domain model iff is valid in every constant domain model
Barcan & Converse Barcan Formulae • Modal operators = FO quantifiers of different sort • In classical FO • xy yx • yx xy • xy yx • Any of these translate to FOML?
Barcan & Converse Barcan Formulae x x x x Barcan • x x x x Converse Barcan Barcan is valid Anti-monotonic Converse Barcan is valid Monotonic Barcan and Converse Barcan are valid Locally constant
a b a Varying Domain Example P = { b } x P(x) x P(x)
Equality • What do we want? • keep equality across worlds • ( x = y ) ( x = y ) • Normal Model G,R,D,L • For each w G, L(=,w) is the equality relation on the domain of the model DM • = is the same across worlds
Existence in Varying Domains • E(x) = (y y=x) • Fixing universal instantiation • x (x) E(y) (y) • When y exists, it has the property • In classical logic E(y) is always true
x y x y x y x y x y x y x y x y x y x y x y x y Program Semantics as Kripke Structure y = x while (y != NULL && y->data != d) { y = y->n } … …
Finite State Programs • Propositional Kripke Structure • Possible worlds = global states • Accessibility relation = transition relation • May fold Kripke-Structure • Merge states that have same labeling • Result with abstraction of all computations • Check temporal properties over this model (rather than over infinite computations) • Results with what MC community calls Kripke Structure
Program Semantics in Modal Perspective • Propositional modal logic • propositions = properties of interest • Program global states = possible worlds • Transition relation = accessibility relation • Modal claims = properties of computations • First-Order modal logic • Global states are first-order logical structures • Closer to concrete semantic
Summary • Propositional modal logic • It is all about the accessibility relation • Generalizes other common logics • Wide range of applications in CS • First order modal logic • All about quantification domains • Constant/varying semantics models are equivalent • Should choose what’s more suitable for you • Closer to concrete program semantics • Currently no common applications in CS
References • M. Fitting, First Order Modal Logic • And his homepage http://comet.lehman.cuny.edu/fitting/ • G.E. Hughes and M.J. Cresswell, A New Introduction to Modal Logic • http://plato.stanford.edu/entries/logic-modal/ • Some theorem provers and tools • http://www.cs.man.ac.uk/~schmidt/tools/
The End http://www.cs.tau.ac.il/~yahave
A A A A A A A A A Traces • Linear paths of program execution • Program semantic = set of all program traces • A Kripke-structure is an abstraction of traces A A …
Common Wisdom • Assumption on program behavior = limit the set of traces considered • How? • Algorithmically --- e.g., Streett acceptance • Augmenting LTL property --- verify assumption goal • Disadvantages • assumption may be non-observable under abstraction • Pay more to express an assumed knowledge
Fairness Reduction Program • Advantages • Pay for verification of simplified properties • Simplified properties may be observable under abstraction even when original goal is not Simpler claims Modular Decomposition CFGDecomposition Progress Reduction GoalProperty Assumptions