39
CMSC 630 January 26, 2015 1 Propositional and Predicate Logic Sources J. Gallier. Logic for Computer Science, John Wiley and Sons, Hoboken NJ, 1986. 2003 revised edition available on line at http://www.cis.upenn.edu/˜jean/gbooks/logic.html J.-Y. Girard, J.-Y., Y. Lafont and P. Taylor. Proofs and Types, volume 7 of Cambridge Tracts in Theoretical Computer Science. Cambridge University Press, Cambridge, England, 1989. c 2015 Rance Cleaveland. All rights reserved.

Propositional and Predicate Logic - University Of … 630 January 26, 2015 1 Propositional and Predicate Logic Sources • J. Gallier. Logic for Computer Science, John Wiley and Sons,

  • Upload
    vothu

  • View
    219

  • Download
    3

Embed Size (px)

Citation preview

CMSC 630 January 26, 2015 1'

&

$

%

Propositional and Predicate Logic

Sources

• J. Gallier. Logic for Computer Science, John Wiley and Sons, Hoboken NJ, 1986. 2003

revised edition available on line at

http://www.cis.upenn.edu/˜jean/gbooks/logic.html

• J.-Y. Girard, J.-Y., Y. Lafont and P. Taylor. Proofs and Types, volume 7 of Cambridge Tracts in

Theoretical Computer Science. Cambridge University Press, Cambridge, England, 1989.

c©2015 Rance Cleaveland. All rights reserved.

CMSC 630 January 26, 2015 2'

&

$

%

Formal Logic

... the study of truth and inference.

Aristotle: syllogisms

“All humans are mortal. Socrates is a human. Therefore Socrates is mortal.”

Frege, Peirce, et al.: symbolic logic

• Propositional calculus

• Predicate calculus

This course: applications of symbolic logic to software verification

c©2015 Rance Cleaveland. All rights reserved.

CMSC 630 January 26, 2015 3'

&

$

%

Components of Symbolic Logic

Syntax. Defines the form of formulas

Semantics. Defines how formulas should be interpreted

Axioms. Defines what formulas are assumed to be true

Inference Rules. Defines how truth of formulas may be inferred from truth of other statements

c©2015 Rance Cleaveland. All rights reserved.

CMSC 630 January 26, 2015 4'

&

$

%

Propositional Calculus: Syntax

Syntax Let (p, q, . . . ∈)P be a (non-empty) set of propositional variables. Then the set Φ of

propositions (= formulas) is defined inductively as follows.

φ ::= p if p ∈ P atomic

| (¬φ) negation

| (φ ∨ φ) disjunction

Note Parentheses often omitted, with assumption that ¬ binds more tightly than ∨. So

¬p ∨ q

is equivalent to

((¬p) ∨ q).

c©2015 Rance Cleaveland. All rights reserved.

CMSC 630 January 26, 2015 5'

&

$

%

Derived Operators

tt∆= p ∨ ¬p true

ff∆= ¬tt false

φ1 ∧ φ2

∆= ¬((¬φ1) ∨ (¬φ2)) conjunction

φ1 ⇒ φ2

∆= (¬φ1) ∨ φ2 implication

φ1 ⇔ φ2

∆= (φ1 ⇒ φ2) ∧ (φ2 ⇒ φ1) bi-implication

c©2015 Rance Cleaveland. All rights reserved.

CMSC 630 January 26, 2015 6'

&

$

%

Propositional Calculus: Semantics

Semantics of logics involve models.

• Models are structures used to assign meaning to formulas.

• Semantics then indicates when a model satisfies a formula, i.e. makes it true.

Models for propositional calculus are often called states, or truth assignments.

Definition Let

• B = {0, 1} be the set of boolean truth values, and

• P be a set of propositional variables.

Then a state σ is any function in P → B. Define Σ = P → B to be the set of all states.

Note Σ is isomorphic to 2P = the set of subsets of P .

• Define f ∈ Σ → 2P by f(σ) = { p ∈ P | σ(p) = 1 }.

• Define g ∈ 2P → Σ by g(S)(p) = 1 iff p ∈ S.

• Then g(f(σ)) = σ, and f(g(S)) = S all σ ∈ Σ, S ∈ 2P .

c©2015 Rance Cleaveland. All rights reserved.

CMSC 630 January 26, 2015 7'

&

$

%

Propositional Calculus: Semantics (cont.)

The semantics of the propositional calculus is given in terms of a relation |= ⊆ Σ× Φ.

Notation Write:

• σ |= φ instead of 〈σ, φ〉 ∈ |=

• σ 6|= φ instead of 〈σ, φ〉 6∈ |=.

Intuition σ |= φ: “σ satisfies φ”

Definition |= is defined inductively as follows.

• σ |= p ∈ P if and only if σ(p) = 1

• σ |= ¬φ if and only if σ 6|= φ

• σ |= φ1 ∨ φ2 if and only if σ |= φ1 or σ |= φ2

c©2015 Rance Cleaveland. All rights reserved.

CMSC 630 January 26, 2015 8'

&

$

%

Terminology

Definition Let φ ∈ Φ be a proposition.

• φ is satisfiable if there is a σ ∈ Σ such that σ |= φ.

• φ is a tautology if for every σ ∈ Σ, σ |= φ.

• φ is falsifiable if there is a σ ∈ Σ such that σ 6|= φ.

• φ is inconsistent if for every σ ∈ Σ, σ 6|= φ.

c©2015 Rance Cleaveland. All rights reserved.

CMSC 630 January 26, 2015 9'

&

$

%

Truth Tables

What are they?

p q q ⇒ p p ⇒ (q ⇒ p)

0 0 1 1

0 1 0 1

1 0 1 1

1 1 1 1

• A means of enumerating (proposition-relevant parts of) states

• A technique for computing satisfiability / tautology / falsifiability / inconsistency information

c©2015 Rance Cleaveland. All rights reserved.

CMSC 630 January 26, 2015 10'

&

$

%

SAT Solvers

... tools for determining whether or not a proposition is satisfiable, and if so computing a satisfying

state / truth assignment.

Most SAT solvers use variants of the Davis-Putnam-Logemann-Loveland (DPLL) algorithm

developed in 1962, which uses backtracking to search for satisfying states of formulas in

conjunctive normal form (CNF).

Literal. Atomic proposition (positive literal) or negation. (negative literal) of atomic proposition

Clause. Disjunction of multiple literals.

CNF. Conjunction of clauses.

Fact Every proposition may be converted into CNF (why?)

Fact The satisfiability problem (SAT) is NP-complete.

Stephen Cook proved this in 1971 and won the 1982 Turing Award as a result. (He still did not get

tenure at Berkeley in 1970.)

c©2015 Rance Cleaveland. All rights reserved.

CMSC 630 January 26, 2015 11'

&

$

%

Davis-Putnam-Logemann-Loveland

Basic step of DPLL:

1. Pick a variable, assign it 0.

2. Remove positive literal from all clauses (why?)

3. Remove clauses containing negative literal for that variable (why?)

4. Recurse

5. If no satisfying instance found, reassign variable value 1

6. Remove clauses containing variable as positive literal

7. Remove negative literals for that variable

8. Recurse

9. If no satisfying assignment found, report “unsatisfiable”

Step 5 involves backtracking.

c©2015 Rance Cleaveland. All rights reserved.

CMSC 630 January 26, 2015 12'

&

$

%

DPLL Optimizations

Definition

• A clause is a unit clause if it contains only one literal, i.e. has form {`} for some literal `.

• If ` is a literal then define not(l) to be the negation of `: not(p) = ¬p, and not(¬p) = p.

The original DPLL algorithm also uses two optimizations before each application of the basic step.

Unit propagation. If a set of clauses contains unit clause {`}, then any satisfying assignment

must make ` true. All other clauses containing ` may be removed, and all instances of not(`)

can be removed from the remaining clauses. (Why?)

Pure literal elimination. A literal ` appears purely in a set of clauses if it appears in at least one

clause and not(p) does not appear in any clause. All clauses containing any pure literal may

be removed (why?).

c©2015 Rance Cleaveland. All rights reserved.

CMSC 630 January 26, 2015 13'

&

$

%

Propositional Calculus: Axioms and Inference Rules

Recall

• Formal logics deal with truth and inference.

• Symbolic logics consist of syntax, semantics, axioms and inference rules.

• For the propositional calculus, we have defined:

– Syntax: Φ

– Semantics: |=

What about axioms, inference rules (= proof system) for the propositional calculus?

• First, need to identify judgments (i.e. what statements proofs manipulate)

• Then axioms, inference rules specify true judgments, how judgments can be inferred

c©2015 Rance Cleaveland. All rights reserved.

CMSC 630 January 26, 2015 14'

&

$

%

The (Propositional) Sequent Calculus

... a proof system for propositional (and predicate) calculus

• Invented by Gerhard Gentzen, German mathematician and logician, in 1934 as part of his

program to formalize natural deduction [Gentzen died at age 36 in 1945 from malnutrition in

the wake of World War II.]

• Intended to prove tautologies

Judgments. In the sequent calculus, judgments have form

Γ ` ∆

where Γ,∆ ∈ Φ∗ are sequences of propositions; ` is called “turnstile.”

Intuition In Γ ` ∆, Γ is a list of “assumptions”, and ∆ is a list of (hoped for) “conclusions”.

c©2015 Rance Cleaveland. All rights reserved.

CMSC 630 January 26, 2015 15'

&

$

%

Sequent Notation

Notation

∅ empty sequence

Γ1,Γ2 sequence concatenation

φ,Γ prefixing

Γ, φ postfixing

|Γ| length (number of elements in Γ)∧

Γ,∨

Γ conjunction, disjunction of Γ

Aside Formally:

Γ =

tt if Γ = ∅

φ if Γ = φ ∈ Φ

φ ∧ (∧

Γ′) if Γ = φ,Γ′ and φ ∈ Φ, |Γ′| ≥ 1

c©2015 Rance Cleaveland. All rights reserved.

CMSC 630 January 26, 2015 16'

&

$

%

Semantics of Sequents

Semantics of sequents given in terms of validity.

Definition A sequent Γ ` ∆ is valid if and only if (∧

Γ) ⇒ (∨

∆) is a tautology.

Note Since∧

∅ = tt, ∅ ` φ for φ ∈ Φ is valid iff φ is a tautology. So sequent calculus’s

intended use includes proving that individual formulas are tautologies.

c©2015 Rance Cleaveland. All rights reserved.

CMSC 630 January 26, 2015 17'

&

$

%

Axioms and Inference Rules for Propositional Sequent Calculus

The sequent calculus uses a uniform format for both axioms and inference rules:

premises

conclusion(name)

• premises is a finite set of sequent templates

• conclusion is a single sequent template

• name is name of rule (no semantic content)

Idea

• If (instance) of each premise has been proved, then rule may be used to prove conclusion.

• Axiom(s): empty premise list

We will focus first on sequents whose propositions only involve atomic propositions, ¬, ∨ (no

derived operators).

c©2015 Rance Cleaveland. All rights reserved.

CMSC 630 January 26, 2015 18'

&

$

%

Rules Classification, and Identity / Cut

There are also two miscellaneous rules / axioms:

Identity axiom.φ ` φ

(I)

Cut rule.Γ1 ` ∆1, φ φ,Γ2 ` ∆2

Γ1,Γ2 ` ∆1,∆2

(Cut)

The rest of the rules are classified along two dimensions.

Left / Right. Which side of ` does the rule focus on?

Logical / Structural. Does the rule introduce logical operators or re-arrange lists of propositions?

c©2015 Rance Cleaveland. All rights reserved.

CMSC 630 January 26, 2015 19'

&

$

%

Left and Right Logical Rules

Γ1, φ1 ` ∆1 Γ2, φ2 ` ∆2

Γ1,Γ2, φ1 ∨ φ2 ` ∆1,∆2

(∨L)Γ ` φ1,∆

Γ ` φ1 ∨ φ2,∆(∨R1)

Γ ` φ2,∆

Γ ` φ1 ∨ φ2,∆(∨R2)

Γ ` φ,∆

Γ,¬φ ` ∆(¬L)

Γ, φ ` ∆

Γ ` ¬φ,∆(¬R)

c©2015 Rance Cleaveland. All rights reserved.

CMSC 630 January 26, 2015 20'

&

$

%

Left and Right Structural Rules

Γ ` ∆

Γ, φ ` ∆(WL)

Γ ` ∆

Γ ` φ,∆(WR)

Γ, φ, φ ` ∆

Γ, φ ` ∆(CL)

Γ ` φ, φ,∆

Γ ` φ,∆(CR)

Γ1, φ1, φ2,Γ2 ` ∆

Γ1, φ2, φ1,Γ2 ` ∆(PL)

Γ ` ∆1, φ1, φ2,∆2

Γ ` ∆1, φ2, φ1,∆2

(PR)

Notes

• W = “Weaken”• C = “Contract”• P = “Permute”

c©2015 Rance Cleaveland. All rights reserved.

CMSC 630 January 26, 2015 21'

&

$

%

Proofs in Sequent Calculus

... are trees.

• Nodes are sequents

• Leaves are instances of axiom (I)

• Parent is result of applying proof rule to children

Trees sometimes grow “up” (math style), with parents below children, or “down” (CS style), with

parents above children. Confusingly, the former proof-construction method is often called “bottom

up”; the latter is called “top down”.

Proofs often annotated with proof rules used to establish parenthood.

Definition

1. A sequent is provable is there is a proof whose root is labeled with the sequent.

2. A proposition φ is provable if the sequent ∅ ` φ is provable.

c©2015 Rance Cleaveland. All rights reserved.

CMSC 630 January 26, 2015 22'

&

$

%

Sample Proof (Bottom-up, Leaves at Top)

Here is a proof of ∅ ` p ∨ ¬p.

CR

p ` p

p ` p ∨ ¬p

I

∅ ` ¬p, p ∨ ¬p

∅ ` p ∨ ¬p, p ∨ ¬p

∅ ` p ∨ ¬p

∨R1

¬R

∨R2

c©2015 Rance Cleaveland. All rights reserved.

CMSC 630 January 26, 2015 23'

&

$

%

Sample Proof (Top-Down, Root at Top)

Here is a proof of ∅ ` (p ∧ q) ⇒ p. Because proof rules only work on ∨,¬, (p ∧ q) ⇒ p must

be translated to ¬¬(¬p ∨ ¬q) ∨ p.

∅ ` p ∨ ¬p

∅ ` ¬¬(¬p ∨ ¬q) ∨ p

∅ ` p ∨ ¬p, p ∨ ¬p

∅ ` ¬p, p ∨ ¬p

p ` p

∨R1

p ` p ∨ ¬p¬R

∨R1

CR

p ` ¬¬(¬p ∨ ¬q) ∨ p

p ` p

I

∨R2

p ∨ ¬p ` ¬¬(¬p ∨ ¬q) ∨ p

¬p ` ¬¬(¬p ∨ ¬q) ∨ p

I

Cut

¬p ` ¬p ∨ ¬q∨R1

¬p ` ¬pI

¬p ∨ ¬q ` ¬¬(¬p ∨ ¬q)

¬p ∨ ¬q,¬(¬p ∨ ¬q) ` ∅

¬p ∨ ¬q ` ¬p ∨ ¬q

∨L

¬R

¬L

I

Cut

c©2015 Rance Cleaveland. All rights reserved.

CMSC 630 January 26, 2015 24'

&

$

%

Observations about Proofs

1. Proof in symbolic logic is very mechanistic: small steps of reasoning using rigid rules. This is

hard for humans, easier for machines.

2. The proof system just given is for a small language (atomic propositions, ¬, ∨), so interesting

statements get big.

3. Big statements require big (tedious) proofs!

4. (Partial) solution: add derived operators, derived rules.

c©2015 Rance Cleaveland. All rights reserved.

CMSC 630 January 26, 2015 25'

&

$

%

(Derived) Logical Rules for ∨, ⇒

Γ, φ1 ` ∆

Γ, φ1 ∧ φ2 ` ∆(∧L1)

Γ1 ` φ1,∆1 Γ2 ` φ2,∆2

Γ1,Γ2 ` φ1 ∧ φ2,∆1,∆2

(∧R)

Γ, φ2 ` ∆

Γ, φ1 ∧ φ2 ` ∆(∧L2)

Γ1 ` φ1,∆1 Γ2, φ2 ` ∆2

Γ1,Γ2, φ1 ⇒ φ2 ` ∆1,∆2

(⇒ L)Γ, φ1 ` φ2,∆

Γ ` φ1 ⇒ φ2,∆(⇒ R)

Note There are similarities between:

• ∧L1 and ∨R1

• ∧L2 and ∨L2

• ∨L and ∧R

c©2015 Rance Cleaveland. All rights reserved.

CMSC 630 January 26, 2015 26'

&

$

%

Relating Proofs and Semantics

Recall Sequent Γ ` ∆ is valid iff (∧

Γ) ⇒ (∨

∆) is a tautology.

Validity is a semantic notion (why?).

Provability is a syntactic one: application of proof rules requires only syntactic manipulations.

Logicians identify two notions when studying the relationship between validity and provability.

Soundness. Is everything that is provable also valid?

Completeness. Is everything that is valid also provable?

c©2015 Rance Cleaveland. All rights reserved.

CMSC 630 January 26, 2015 27'

&

$

%

Soundness, Completeness of Sequent Calculus

Theorem (Soundess)

Let Γ ` ∆ be a provable sequent. Then Γ ` ∆ is valid.

Proof Proof relies on showing that each axiom is valid and each proof rule preserves validity: if

the premises are valid, then the conclusion is guaranteed to be valid.

Theorem (Completeness of Sequent Calculus)

Let Γ ` ∆ be a valid sequent. Then Γ ` ∆ is provable.

Proof Harder. Usually relies on induction over sequents.

In studying completeness, Gentzen proved one of his famous results: the Cut elimination theorem.

Theorem (Cut Elimination (Hauptstatz))

Let Γ ` ∆ be provable. Then there is a proof of Γ ` ∆ that does not use the Cut rule.

Note the following corollary to the Completeness Theorem.

Corollary Every tautology in the propositional calculus is provable!

c©2015 Rance Cleaveland. All rights reserved.

CMSC 630 January 26, 2015 28'

&

$

%

The Predicate Calculus

• The second symbolic logic in this review

• Sometimes also called first-order logic

• Extends the propositional calculus with data and quantification (existential / universal)

Like the propositional calculus, we will define the predicate calculus via a syntax, semantics and

proof system.

First, the notion of data theory (a.k.a. “first-order structure”, “structure”) needs defining: these

provide the “mathematical API” for the data used in the predicate calculus.

c©2015 Rance Cleaveland. All rights reserved.

CMSC 630 January 26, 2015 29'

&

$

%

Data Theories: Syntax

The syntactic specification of a data theory consists of:

Constants. A set (c, c1, . . . ∈)C of data values (sometimes called the carrier set)

Example For natural numbers, C = N = {0, 1, 2, . . .}

Variables. A countably infinite set (x, x1, . . .) ∈ X of data variables

Terms. A set (t, t1, . . . ∈)T of data terms such that C ∪ X ⊆ T

Example For natural numbers: 3x+ y, etc. (expressions that can evaluate to numbers)

Predicates. A set (A,A1, . . . ∈)A of atomic predicates

Syntactic functions. Two functions for computing free variables and substitutions.

1. FVT,A ∈ (T ∪ A) → 2X computes free variables of predicates, terms

2. subst ∈ (T ∪ A)× T× X → (T ∪ A) where subst(A, t, x) ∈ A if and only if A ∈ A.

subst(A, t, x) returns the result of replacing x by t in A, and similarly for subst(t′, t, x).

Example For natural numbers, x ≤ y + 3, etc. Taking A to be x ≤ y + 3:

• FVT,A(A) = {x, y}

• subst(A,w + 1, y) is x ≤ w + 1 + 3.

c©2015 Rance Cleaveland. All rights reserved.

CMSC 630 January 26, 2015 30'

&

$

%

Data Theory Semantics

The semantics of a data theory interprets terms and atomic predicates with respect to data states.

Definition The set of data states is defined as (σ, . . . ∈)Σ = X → C.

The semantics of a data theory consists of:

Term Evaluation. A function [[−]]− ∈ T× Σ → C. [[t]]σ ∈ C is the result of evaluating t in σ.

Example Suppose σ(x) = 4, σ(y) = 6. Then [[x+ 3]]σ = 7.

Predicate Satisfaction. A relation |=A ⊆ Σ× A. σ |=A A holds if state σ satisfies A.

Example Take σ as before. Then σ |=A x ≤ y, σ 6|=A x > y − 1.

These operations are also required to respect substitution.

Definition Let x be a data variable, t, t′ be terms, and A be an atomic proposition in a given

data theory. Then [[−]]− and |=A respect substitution if and only if, for every data state σ:

• [[subst(t′, t, x)]]σ = [[t′]](σ[x 7→ [[t]]σ])• σ |=A subst(A, t, x) if and only if σ[x 7→ [[t]]σ] |=A A

c©2015 Rance Cleaveland. All rights reserved.

CMSC 630 January 26, 2015 31'

&

$

%

Notation for Data Theories

We will write a data theory D as 〈F , I〉, where F (“formulas”) is the syntax part:

F = 〈C,X,T,A, FVT,A, subst〉

and I (“interpretation”) is the semantic part:

I = 〈[[−]]−, |=A〉

c©2015 Rance Cleaveland. All rights reserved.

CMSC 630 January 26, 2015 32'

&

$

%

Predicate Calculus: Syntax

Suppose we have a data theory D = 〈F , I〉 as described previously. Then the formulas ΦF of

the predicate calculus are as follows.

φ ::= A atomic predicate

| ¬φ negation

| φ ∨ φ disjunction

| ∃x. φ (x ∈ X) existential

• Derived operators include ∧,⇒ and ∀x. φ∆= ¬∃x.¬φ.

• In ∃x. φ, x is said to be bound (as opposed to free).

• ∃x. φ may be thought of as “indexed disjunction”, i.e.∨

x∈C φ; then x may be seen as the

index variable.

• ∀x. φ may similarly be interpreted as∧

x∈C φ.

c©2015 Rance Cleaveland. All rights reserved.

CMSC 630 January 26, 2015 33'

&

$

%

Predicate Calculus: Semantics

Let D = 〈F , I〉 be a data theory, and ΣF = X → C the associated data states. The semantics

of the predicate calculus is specified using a relation |=D ⊆ ΣF × ΦF . A notion of state

updating is handy.

Definition If σ ∈ ΣF , x ∈ X and c ∈ C, then σ[x 7→ c] ∈ ΣF is the state defined as:

σ[x 7→ c](y) =

c if y = x

σ(y) otherwise

Definition |=D is defined inductively as follows.

• σ |=D A if and only if σ |=A A

• σ |=D ¬φ if and only if σ 6|=D φ

• σ |=D φ1 ∨ φ2 if and only if σ |=D φ1 or σ |=D φ2.

• σ |=D ∃x. φ if and only if σ[x 7→ c] |=D φ for some c ∈ C.

A formula φ is a D-tautology if for every σ ∈ ΣF , σ |=D φ. The definitions of D-satisfiable, etc.,

carry over from the propositional calculus in the obvious way.

c©2015 Rance Cleaveland. All rights reserved.

CMSC 630 January 26, 2015 34'

&

$

%

Free and Bound Variables, and Substitution

To define a proof system for predicate calculus, we will need to be able to replace variables by

terms inside formulas. There are some subtleties:

• Some variables are bound in formulas, and should not be subject to these replacements (e.g.

the x occurrences in ∃x . φ).

Example Consider φ = ∃x . x ≤ y. Replacing y by 3 should yield

φ[3/y] = ∃x . x ≤ 3. Replacing x by 3 should have no effect: φ[3/x] = φ.

• Some terms have free variables that should not be captured by quantifiers.

Example Consider φ as above, t = x+ 3. Replacing y by t naively yields

φ[t/y] = ∃x . x ≤ x+ 3, but this is wrong (x “outside” ∃x is different than x “inside” ∃x).

Solutions

• Only substitute for free occurrences of a variable in a formula.

• When defining substitution, rename bound variables in order to avoid capture.

c©2015 Rance Cleaveland. All rights reserved.

CMSC 630 January 26, 2015 35'

&

$

%

Free Variables

A variable is free in a formula if its value can be affected by a state.

Definition Let φ ∈ ΦF be a formula. Then the set FV (φ) ⊆ X of free variables in φ is

defined inductively as follows.

FV (φ)∆=

FVT,A(φ) if φ ∈ A

FV (φ′) if φ = ¬φ′

FV (φ1) ∪ FV (φ2) if φ = φ1 ∨ φ2

FV (φ′)− {x} if φ = ∃x . φ′

FV can be extended to a sequence of formulas in the obvious manner: if Γ = φ1, . . . , φn then

FV (Γ) =n⋃

i=1

FV (φi).

The function new returns a “fresh variable” (i.e. one not in the set given as an argument).

Definition Let new ∈ (2X − {X}) → X be such that for any X ⊂ X, new(X) 6∈ X .

c©2015 Rance Cleaveland. All rights reserved.

CMSC 630 January 26, 2015 36'

&

$

%

Defining Substitution

Definition Let φ ∈ ΦF , t ∈ T and x ∈ X. Then the result, φ[t/x], of substituting t for x in φ

is as follows.

φ[t/x]∆=

subst(φ, t, x) if φ ∈ A

¬(φ′[t/x]) if φ = ¬φ′

(φ1[t/x]) ∨ (φ2[t/x]) if φ = φ1 ∨ φ2

∃z. ((φ′[z/y])[t/x]) if φ = ∃y. φ′ and z = new (FV (φ′) ∪ FVT,A(t))

c©2015 Rance Cleaveland. All rights reserved.

CMSC 630 January 26, 2015 37'

&

$

%

Predicate Calculus: Axioms and Inference Rules

The Sequent Calculus may be adapted!

• There need to be left and right logical rules for ∃.

Γ, φ ` ∆

Γ, ∃x. φ ` ∆(x 6∈ FV (Γ) ∪ FV (∆)) (∃L)

Γ ` φ[t/x],∆

Γ ` ∃x. φ,∆(∃R)

Note The ∃L rule has a side condition restricting its application.

• There needs to be a proof system (non-logical axioms / inference rules) for the data theory.

(The “regular rules” are, confusingly, called the logical axiom and inference rules, even though

we were using logical for a subset of these rules also.)

Relative Soundness The Sequent Calculus for predicate calculus is sound if the non-logical

axioms, inference rules are sound.

What about completeness?

c©2015 Rance Cleaveland. All rights reserved.

CMSC 630 January 26, 2015 38'

&

$

%

Logical Completeness

Some kind of “relative completeness” result would be nice, but is hard to formulate.

Kurt Goedel (he also has a famous Incompleteness Theorem) defined a notion of logical

completeness and in 1929 proved completeness of a proof system equivalent to the Sequent

Calculus.

Definition Let D = 〈F , I〉 be a data theory. Then a formula φ ∈ ΦF is logically valid if for all

states σ ∈ ΣF and all interpretations I ′, σ |=〈F,I′〉 φ.

Theorem (Goedel Completeness) Suppose φ is logically valid. Then ∅ ` φ is provable using

only the logical axiom and inference rules.

c©2015 Rance Cleaveland. All rights reserved.

CMSC 630 January 26, 2015 39'

&

$

%

Derived Rules for ∀

Γ, φ[t/x] ` ∆

Γ, ∀x. φ ` ∆(∀L)

Γ ` φ,∆

Γ ` ∀x. φ,∆(x 6∈ FV (Γ) ∪ FV (∆)) (∀R)

Note symmetries between (∀L) and (∃R), and between (∀R) and (∃L).

�Decidability

What about decision procedures (SAT solvers, etc.)? Alas, thanks to Church and Turing in 1936,

none can exist.

Theorem (Undecidability) Logical validity of formulas in the predicate calculus is undecidable.

c©2015 Rance Cleaveland. All rights reserved.