22c181: Formal Methods in Software Engineering. The University of Iowa Spring Propositional Logic

Similar documents
5.4 Imperfect, Real-Time Decisions

Logical Agents (AIMA - Chapter 7)

11/18/2015. Outline. Logical Agents. The Wumpus World. 1. Automating Hunt the Wumpus : A different kind of problem

Formal Verification. Lecture 5: Computation Tree Logic (CTL)

5.4 Imperfect, Real-Time Decisions

Modal logic. Benzmüller/Rojas, 2014 Artificial Intelligence 2

Intensionalisation of Logical Operators

CIS/CSE 774 Principles of Distributed Access Control Exam 1 October 3, Points Possible. Total 60

Propositional attitudes

2 Logic Gates THE INVERTER. A logic gate is an electronic circuit which makes logic decisions. It has one output and one or more inputs.

Scrabble is PSPACE-Complete

Goal-Directed Tableaux

Coverage Metrics. UC Berkeley EECS 219C. Wenchao Li

A Complete Approximation Theory for Weighted Transition Systems

STRATEGY AND COMPLEXITY OF THE GAME OF SQUARES

Knights, Knaves, and Logical Reasoning

bus waveforms transport delta and simulation

CS 202, section 2 Final Exam 13 December Pledge: Signature:

From: AAAI Technical Report FS Compilation copyright 1994, AAAI ( All rights reserved.

DVA325 Formal Languages, Automata and Models of Computation (FABER)

Your Name and ID. (a) ( 3 points) Breadth First Search is complete even if zero step-costs are allowed.

MATH 225: Foundations of Higher Matheamatics. Dr. Morton. Chapter 2: Logic (This is where we begin setting the stage for proofs!)

1.6 Congruence Modulo m

1. MacBride s description of reductionist theories of modality

Midterm Examination. CSCI 561: Artificial Intelligence

Universiteit Leiden Opleiding Informatica

KARO logic (Van Linder et al.) Epistemic logic. Dynamic Logic. Dynamic Logic KARO. Dynamic Logic. knowledge. belief. Interpretation formulas

Theorem Proving and Model Checking

A Logic for Social Influence through Communication

1 Modal logic. 2 Tableaux in modal logic

Logic and Artificial Intelligence Lecture 18

Logic and Artificial Intelligence Lecture 16

Presented By: Bikash Chandra ( ) Kaustav Das ( ) 14 November 2010

Scrabble is PSPACE-Complete

From ProbLog to ProLogic

Two Perspectives on Logic

37 Game Theory. Bebe b1 b2 b3. a Abe a a A Two-Person Zero-Sum Game

HIROIMONO is N P-complete

arxiv: v1 [math.co] 16 Aug 2018

On game semantics of the affine and intuitionistic logics (Extended abstract)

Permutation Groups. Definition and Notation

Logic and the Sizes of Sets

22c:145 Artificial Intelligence

Objective Questions. (a) Light (b) Temperature (c) Sound (d) all of these

17. Symmetries. Thus, the example above corresponds to the matrix: We shall now look at how permutations relate to trees.

Tiling Problems. This document supersedes the earlier notes posted about the tiling problem. 1 An Undecidable Problem about Tilings of the Plane

First Order Logic. Dr. Richard J. Povinelli. Copyright Richard J. Povinelli rev 1.0, 10/1/2001 Page 1

Lecture 20 November 13, 2014

CSE 21 Mathematics for Algorithm and System Analysis

depth parallel time width hardware number of gates computational work sequential time Theorem: For all, CRAM AC AC ThC NC L NL sac AC ThC NC sac

Math 127: Equivalence Relations

A Model-Theoretic Approach to the Verification of Situated Reasoning Systems

Logic Circuit Design

Computer Science Faculty Publications

Launchpad Maths. Arithmetic II

Wilson s Theorem and Fermat s Theorem

CSEP 573 Adversarial Search & Logic and Reasoning

Super Mario. Martin Ivanov ETH Zürich 5/27/2015 1

Planning and Optimization

Positive and Negative Logic

ADVANCES in electronics technology have made the transition

Complex-Network Modelling and Inference

Formal Foundation of Digital Design

This Figure here illustrates the operation for a 2-input OR gate for all four possible input combinations.

SOLUTIONS TO PROBLEM SET 5. Section 9.1

Distributed Synthesis of Control Protocols for Smart Camera Networks

Mathematics Explorers Club Fall 2012 Number Theory and Cryptography

CS:4420 Artificial Intelligence

DIGITAL LOGIC CIRCUITS

AI Day on Knowledge Representation and Automated Reasoning

Citation for published version (APA): Nutma, T. A. (2010). Kac-Moody Symmetries and Gauged Supergravity Groningen: s.n.

Synthesizing Interpretable Strategies for Solving Puzzle Games

Primitive Roots. Chapter Orders and Primitive Roots

Chapter 1: Digital logic

8. You Won t Want To Play Sudoku Again

Section 2.1 Factors and Multiples

Remarks on Dialogical Meaning: A Case Study Shahid Rahman 1 (Université de Lille, UMR: 8163, STL)

Outline. Sets of Gluing Data. Constructing Manifolds. Lecture 3 - February 3, PM

Digital Systems Principles and Applications TWELFTH EDITION. 3-3 OR Operation With OR Gates. 3-4 AND Operations with AND gates

1 = 3 2 = 3 ( ) = = = 33( ) 98 = = =

EMT1250 LABORATORY EXPERIMENT. EXPERIMENT # 4: Combinational Logic Circuits. Name: Date:

Static Program Analysis

Sample Spaces, Events, Probability

General Game Playing (GGP) Winter term 2013/ Summary

Congruence. Solving linear congruences. A linear congruence is an expression in the form. ax b (modm)

Alessandro Cincotti School of Information Science, Japan Advanced Institute of Science and Technology, Japan

EA 3.0 Chapter 3 Architecture and Design

Managing Time-Variant Data. Graham Witt

Where s Waldo? Sensor-Based Temporal Logic Motion Planning

10/5/2015. Constraint Satisfaction Problems. Example: Cryptarithmetic. Example: Map-coloring. Example: Map-coloring. Constraint Satisfaction Problems

Oracle Turing Machine. Kaixiang Wang

Digital Logic Circuits

18 Completeness and Compactness of First-Order Tableaux

Introduction to Computational Manifolds and Applications

COEN7501: Formal Hardware Verification

Purpose Restrictions on Information Use

"Shape Grammars and the Generative Specification of Painting and Sculpture" by George Stiny and James Gips.

Sets. Definition A set is an unordered collection of objects called elements or members of the set.

UMBC CMSC 671 Midterm Exam 22 October 2012

and problem sheet 7

Transcription:

22c181: Formal Methods in Software Engineering The University of Iowa Spring 2010 Propositional Logic Copyright 2010 Cesare Tinelli. These notes are copyrighted materials and may not be used in other course settings outside of the University of Iowa in their current form or modified form without the express written permission of one of the copyright holders. 22c181: Formal Methods in Software Engineering p.1/19

Mathematical Logic A discipline that studies the precise formalization of knowledge and reasoning Provides the foundations of Formal Methods In this field the word logic is also use to denote specific formal reasoning systems there are several logics in that sense: propositional, first-order, higher-order, modal, temporal, intuitionistic, linear, non-monotonic,... We will concentrate on propositional logic and first-order logic (But we ll also work in some temporal logic in disguise) 22c181: Formal Methods in Software Engineering p.2/19

Logics A logic is a triple L, S, R where L, the logic s language, is a class of sentences described by a formal grammar. S, the logic s semantics is a formal specification of how to assign meaning in the real world to the elements of L. R, the logic s inference system, is a set of formal inference rules over L. 22c181: Formal Methods in Software Engineering p.3/19

Propositional Logic Each sentence (called a formula) is made of propositional variables, a,b,...,p,q,... logical constants,, logical connectives,,,... Every propositional variable stands for a basic fact Examples: I m hungry, Apples are red, Joe and Jill are married 22c181: Formal Methods in Software Engineering p.4/19

Propositional Logic Ontological Commitments Propositional Logic is about facts, statements that are either true or false, nothing else. Semantics of Propositional Logic Since each propositional variable stands for a fact about the world, its meaning ranges over the Boolean values {True, False}. Same for more complex formulas. Remark: Note the difference between True, False, semantical entities here, with,, syntactical entities standing for them. 22c181: Formal Methods in Software Engineering p.5/19

Formulas of Propositional Logic Each propositional variable (a,b,...,p,q,...) is a formula Each logical constant (, ) is a formula If ϕ and ψ are formulas, all of the following are also formulas ϕ ϕ ψ ϕ ψ (ϕ) ϕ ψ ϕ ψ Nothing else is a formula 22c181: Formal Methods in Software Engineering p.6/19

The Language of Propositional Logic Formally, it is the language generated by the following grammar. Symbols: Propositional variables: a,b,...,p,q,... Logical symbols: (true) (and) (implies) (not) (false) (or) (equivalent) Grammar Rules: Conn ::= AtomicF ::= a b... p q... Formula ::= AtomicF Formula Formula Conn Formula (Formula) 22c181: Formal Methods in Software Engineering p.7/19

Semantics of Propositional Logic The meaning (value) of is always True. The meaning of is always False. The meaning of the other formulas depends on the meaning of the propositional variables. Base cases: Truth Tables P Q :P P ^ Q P _ Q P ) Q P, Q False False True False False True True False True True False True True False True False False False True False False True True False True True True True Non-base Cases: Given by reduction to the base cases Example: the meaning of (p q) r is the same as the meaning of a r where a has the same meaning as p q. 22c181: Formal Methods in Software Engineering p.8/19

The Meaning of Logical Connectives: A Warning Disjunction φ ψ is true when φ or ψ or both are true (inclusive or). Implication φ ψ does not require a causal connection between φ and ψ. Ex: Sky-is-blue Snow-is-white When φ is false, φ ψ is true regardless of the value of ψ. Ex: p Beware of negations in implications. Ex: Is-bird Lays-eggs Is-bird Lays-eggs 22c181: Formal Methods in Software Engineering p.9/19

Semantics of Propositional Logic An assignment of Boolean values to the propositional variables of a formula is an interpretation of the formula. P H P _ H (P _ H) ^ :H ((P _ H) ^ :H) ) P False False False False True False True True False True True False True True True True True True False True Interpretations: {P False,H False}, {P False,H True},... The semantics of Propositional logic is compositional: the meaning of a formula is defined recursively in terms of the meaning of the formula s components. 22c181: Formal Methods in Software Engineering p.10/19

Semantics of Propositional Logic The meaning of a formula in general depends on its interpretation. Some formulas, however, have always the same meaning. P H P _ H (P _ H) ^ :H ((P _ H) ^ :H) ) P False False False False True False True True False True True False True True True True True True False True A formula is (un)satisfiable if it is true in some (no) interpretation, valid if it is true in every possible interpretation. 22c181: Formal Methods in Software Engineering p.11/19

Entailment in Propositional Logic Given a set Γ of formulas and a formula ϕ, we write Γ = ϕ iff every interpretation that makes all formulas in Γ true makes ϕ also true. Γ = ϕ is read as Γ entails ϕ or ϕ logically follows from Γ. 22c181: Formal Methods in Software Engineering p.12/19

Entailment in Propositional Logic: Examples {A,A B} = B {A} = A B {A,B} = A B {} = A A {A} = A B {A A} = A A B A B A B A B A A 1. False False True False False True 2. False True True True False True 3. True False False True False True 4. True True True True True True 22c181: Formal Methods in Software Engineering p.13/19

Properties of Entailment Γ = ϕ, for all ϕ Γ (inclusion property of =) if Γ = ϕ, then Γ = ϕ for all Γ Γ (monotonicity of =) ϕ is valid iff {} = ϕ (also written as = ϕ) ϕ = iff ϕ is unsatisfiable Γ = ϕ iff the set Γ { ϕ} is unsatisfiable 22c181: Formal Methods in Software Engineering p.14/19

Logical Equivalence Two formulas ϕ 1 and ϕ 2 are logically equivalent, written ϕ 1 ϕ 2, if ϕ 1 = ϕ 2 and ϕ 2 = ϕ 1. Note: ϕ 1 ϕ 2 if and only if every interpretation assigns the same Boolean value to ϕ 1 and ϕ 2. Implication and equivalence (, ), which are syntactical entities, are intimately related to entailment and logical equivalence ( =, ), which are semantical notions: ϕ 1 = ϕ 2 iff = ϕ 1 ϕ 2 ϕ 1 ϕ 2 iff = ϕ 1 ϕ 2 22c181: Formal Methods in Software Engineering p.15/19

Example A = (A B) holds and A (A B) is valid. A B A B A (A B) 1. False False False True 2. False True True True 3. True False True True 4. True True True True 22c181: Formal Methods in Software Engineering p.16/19

Properties of Logical Connectives and are: commutative ϕ 1 ϕ 2 ϕ 2 ϕ 1 ϕ 1 ϕ 2 ϕ 2 ϕ 1 associative ϕ 1 (ϕ 2 ϕ 3 ) (ϕ 1 ϕ 2 ) ϕ 3 ϕ 1 (ϕ 2 ϕ 3 ) (ϕ 1 ϕ 2 ) ϕ 3 mutually distributive ϕ 1 (ϕ 2 ϕ 3 ) (ϕ 1 ϕ 2 ) (ϕ 1 ϕ 3 ) ϕ 1 (ϕ 2 ϕ 3 ) (ϕ 1 ϕ 2 ) (ϕ 1 ϕ 3 ) related by (DeMorgan s Laws) (ϕ 1 ϕ 2 ) ϕ 1 ϕ 2 (ϕ 1 ϕ 2 ) ϕ 1 ϕ 2 22c181: Formal Methods in Software Engineering p.17/19

Properties of Logical Connectives,, and are actually redundant: ϕ 1 ϕ 2 ( ϕ 1 ϕ 2 ) ϕ 1 ϕ 2 ϕ 1 ϕ 2 ϕ 1 ϕ 2 (ϕ 1 ϕ 2 ) (ϕ 2 ϕ 1 ) We keep them all mainly for convenience. Exercise. Use the truth tables to verify all the logical equivalences seen so far. 22c181: Formal Methods in Software Engineering p.18/19

Computational Properties of Propositional Logic Satisfiability in PL is decidable (hence, so are entailment, validity, and equivalence). That is, there is a general algorithm that given any PL formula ϕ can always determine whether ϕ is satisfiable or not. However, satisfiability is NP-complete (and the rest are co-np-complete). 22c181: Formal Methods in Software Engineering p.19/19

Computational Properties of Propositional Logic Satisfiability in PL is decidable (hence, so are entailment, validity, and equivalence). That is, there is a general algorithm that given any PL formula ϕ can always determine whether ϕ is satisfiable or not. However, satisfiability is NP-complete (and the rest are co-np-complete). Note Many problems in formal verification can be reduced to checking the satisfiability of a propositional formula. Despite NO-completeness, many realistic instances can be checked very efficiently by state-of-the-art SAT solvers. 22c181: Formal Methods in Software Engineering p.19/19