logical formalismsmpri 6 3 what is lambda-calculus ? • an intentional theory of functions. • a...

27
MPRI 6 1 Logical Formalisms

Upload: others

Post on 21-Jan-2021

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Logical FormalismsMPRI 6 3 What is lambda-calculus ? • An intentional theory of functions. • A simple functional programming language. • A theory of free- and bound-variables,

MPRI 6 1

Logical Formalisms

Page 2: Logical FormalismsMPRI 6 3 What is lambda-calculus ? • An intentional theory of functions. • A simple functional programming language. • A theory of free- and bound-variables,

MPRI 6 2

I. Lambda-Calculus(a crash review)

Page 3: Logical FormalismsMPRI 6 3 What is lambda-calculus ? • An intentional theory of functions. • A simple functional programming language. • A theory of free- and bound-variables,

MPRI 6 3

What is lambda-calculus ?

• An intentional theory of functions.

• A simple functional programming language.

• A theory of free- and bound-variables, of scope andsubstitution.

• The keystone of higher-order syntax and higher-order logic.

• The algebra of natural-deduction proofs.

Page 4: Logical FormalismsMPRI 6 3 What is lambda-calculus ? • An intentional theory of functions. • A simple functional programming language. • A theory of free- and bound-variables,

MPRI 6 4

Syntax:T ::= x | λx. T | (T T )

λ is a binder: thre free occurrences of x in t are bound in λx. t.

Warning: You should solve, once and for all, any problem you could havewith the notions of free and bound occurrences of variables.

Reduction rule: (λx. t)u →β t[x:=u]

Church-Rosser Theorem: For all λ-terms t, u, and v such that:

t→→β u and t→→β v

there exists a λ-term w such that:

u→→β w and v →→β w

Corollary: Uniqueness of normal forms.

Turing Completeness: Every recursive function is λ-definable.

Page 5: Logical FormalismsMPRI 6 3 What is lambda-calculus ? • An intentional theory of functions. • A simple functional programming language. • A theory of free- and bound-variables,

MPRI 6 5

Sense and Denotation

F.L.G. Frege(1848–1925)

Sense/Denotation (Frege)Intension/Extension (Carnap)

According to Frege, the sense of an expression isits “mode of presentation”, while the denotationof an expression is the object it refers to.

For instance, both expressions “1 + 1” and “2”have the same denotation but not the samesense.

An intensional proposition is a proposition whosevalidity is not invariant under extensional substi-tution.

Frege gives the example of the “morning star” and the “evening star” whichboth refer to the planet Venus.

Compare “the morning star is the evening star” with “John does not knowthat the morning star is the evening star”.

Page 6: Logical FormalismsMPRI 6 3 What is lambda-calculus ? • An intentional theory of functions. • A simple functional programming language. • A theory of free- and bound-variables,

MPRI 6 6

Paradoxes and Type-Theory

B. Russell(1872–1970)

Compare:

Ω = δ δ where δ = λx. x x

with:X = x |x 6∈ x

Page 7: Logical FormalismsMPRI 6 3 What is lambda-calculus ? • An intentional theory of functions. • A simple functional programming language. • A theory of free- and bound-variables,

MPRI 6 7

Simply Typed Lambda-Calculus

Γ, x : A − x : A

x : A, Γ − t : B

Γ − λx. t : A→ B

Γ − t : A→ B Γ − u : A

Γ − (t u) : B

Strong-Normalisation Theorem: There is no infinite reduction se-quence.

Page 8: Logical FormalismsMPRI 6 3 What is lambda-calculus ? • An intentional theory of functions. • A simple functional programming language. • A theory of free- and bound-variables,

MPRI 6 8

Curry-Howard Isomorphism

Natural deduction λ-calculus

propositions typesconnectives type constructors

proofs termsintroduction rules term constructorselimination rules term destructorsactive hypotheses free variables

discarded hypotheses bound variables

detour redexdetour elimination reduction stepproof normalization term evaluation

Page 9: Logical FormalismsMPRI 6 3 What is lambda-calculus ? • An intentional theory of functions. • A simple functional programming language. • A theory of free- and bound-variables,

MPRI 6 9

II. Higher-Order Logic

Page 10: Logical FormalismsMPRI 6 3 What is lambda-calculus ? • An intentional theory of functions. • A simple functional programming language. • A theory of free- and bound-variables,

MPRI 6 10

Church’s Simple Theory of Types

A. Church(1903–1995)

Two atomic types:

ι, o

Logical constants:

⊥ : o⊃ : o→ o→ o∀α : (α→ o) → o (at each type α)

ι is the type of individuals and o is the type ofpropositions.

Formulas are defined to be well-typed λ-terms of type o. We write P ⊃Q and ∀x. P for ⊃P Q and ∀α (λx. P ), respectively. Similarly for the otherconnectives (¬,∧,∨,≡, ∃), which are defined in the usual way — the systemis classical!

t = u is defined as ∀P.P t ⊃ P u.

Page 11: Logical FormalismsMPRI 6 3 What is lambda-calculus ? • An intentional theory of functions. • A simple functional programming language. • A theory of free- and bound-variables,

MPRI 6 11

Logical rules:

Γ, A − A

Γ, A − B

Γ − A ⊃ B

Γ − A ⊃ B Γ − A

Γ − B

Γ − Ax of type α, x 6∈ FV (Γ)

Γ − ∀α (λxα. A)

Γ − ∀αAB of type α

Γ − AB

Γ,¬A − ⊥

Γ − A

Conversion rule:

Γ − Awhere A =β B

Γ − B

Page 12: Logical FormalismsMPRI 6 3 What is lambda-calculus ? • An intentional theory of functions. • A simple functional programming language. • A theory of free- and bound-variables,

MPRI 6 12

Extensionality axioms:

Γ − (∀αx.Ax = B x) ⊃ (A = B)

Γ − (A ≡ B) ⊃ (A = B)

Page 13: Logical FormalismsMPRI 6 3 What is lambda-calculus ? • An intentional theory of functions. • A simple functional programming language. • A theory of free- and bound-variables,

MPRI 6 13

Higher-order logic as a set theory

x | P as λx. P

t ∈ A as At

Expressive Power

S4= (∀x. s x 6= 0) ∧ (∀xy. s x = s y ⊃ x = y)

N4= λx. (∀R.R0 ∧ (∀y.R y ⊃ R (s y)) ⊃ Rx)

The only model of S ∧ ∀x.Nx is the set of natural numbers.

Page 14: Logical FormalismsMPRI 6 3 What is lambda-calculus ? • An intentional theory of functions. • A simple functional programming language. • A theory of free- and bound-variables,

MPRI 6 14

Let φ be a formula of Peano’s Arithmetic, and define φN as follows:

• φN = φ, for φ an atomic formula,

• (¬φ)N = ¬φN,

• (φ ∗ ψ)N = φN ∗ ψN, for ∗ ∈ ∧,∨,⊃,≡,

• (∀x. φ)N = ∀x.(Nx ⊃ φN),

• (∃x. φ)N = ∃x.(Nx ∧ φN).

Let D be the conjunction of the universal closures of the defining equationsfor addition and multiplication, and let PA be S ∧ ∀x.Nx ∧ D.

Then, the formula PA ⊃ φ is valid if and only if φ is true in the standardmodel of Peano’s arithmetic.

Corollary: incompleteness of higher-order logic.

Page 15: Logical FormalismsMPRI 6 3 What is lambda-calculus ? • An intentional theory of functions. • A simple functional programming language. • A theory of free- and bound-variables,

MPRI 6 15

III. Modal Logic

Page 16: Logical FormalismsMPRI 6 3 What is lambda-calculus ? • An intentional theory of functions. • A simple functional programming language. • A theory of free- and bound-variables,

MPRI 6 16

Necessity and Possibility

G.W. von Leibniz(1646–1716)

A proposition is necessarily true if it is true in allpossible worlds.

A proposition is possibly true if it is true in atleast one possible world.

Dr. Pangloss in Voltaire’s Candide.

Page 17: Logical FormalismsMPRI 6 3 What is lambda-calculus ? • An intentional theory of functions. • A simple functional programming language. • A theory of free- and bound-variables,

MPRI 6 17

Syntax:F ::= a | ¬F | F ∨ F | F

Define the other connectives in the usual way. Define ♦A as ¬¬A.

A stands for “necessarily A”. ♦A stands for “possibly A”.

Validity:

let M = 〈W,P 〉, where W is a set of “possible worlds”, and P is a functionthat asigns to each atomic proposition a subset of W .

M, s |= a iff s ∈ P (a).

M, s |= ¬A iff not M, s |= A.

M, s |= A ∨B iff either M, s |= A or M, s |= B, or both.

M, s |= A iff for every t ∈W, M, t |= A.

It is easy to establish that:

M, s |= ♦A iff for some t ∈W, M, t |= A.

Page 18: Logical FormalismsMPRI 6 3 What is lambda-calculus ? • An intentional theory of functions. • A simple functional programming language. • A theory of free- and bound-variables,

MPRI 6 18

System S5:

(P) all propositional tautologies

(K) (A ⊃ B) ⊃ (A ⊃ B)

(T) A ⊃ A

(5) ♦A ⊃ ♦A

Modus ponens:A ⊃ B A

B

Rule of necessitation:A

A

Page 19: Logical FormalismsMPRI 6 3 What is lambda-calculus ? • An intentional theory of functions. • A simple functional programming language. • A theory of free- and bound-variables,

MPRI 6 19

Kripke Semantics:

let M = 〈W,R,P 〉, where W is a set of “possible worlds”, R is a binaryrelation over W , and P is a function that asigns to each atomic propositiona subset of W .

M, s |= A iff for every t ∈W such that sRt, M, t |= A.

M, s |= ♦A iff for some t ∈W such that sRt, M, t |= A.

System K:

(P) all propositional tautologies

(K) (A ⊃ B) ⊃ (A ⊃ B)

Modus ponens:A ⊃ B A

B

Rule of necessitation:A

A

Page 20: Logical FormalismsMPRI 6 3 What is lambda-calculus ? • An intentional theory of functions. • A simple functional programming language. • A theory of free- and bound-variables,

MPRI 6 20

The following theorems of S5 are not valid in the class of all Kripke models:

(D) A ⊃ ♦A

(T) A ⊃ A

(B) A ⊃ ♦A

(4) A ⊃ A

(5) ♦A ⊃ ♦A

A binary relation R ∈ W ×W is serial if and only if for every s ∈ W thereexists t ∈W such that sRt.

Page 21: Logical FormalismsMPRI 6 3 What is lambda-calculus ? • An intentional theory of functions. • A simple functional programming language. • A theory of free- and bound-variables,

MPRI 6 21

Some well-known systems

KD basic deontic logic serialKT basic alethic logic reflexiveKTB Brouwersche system reflexive, symmetricKT4 Lewis’ S4 reflexive, transitiveKT5 Lewis’ S5 reflexive, symmetric, transitive

Page 22: Logical FormalismsMPRI 6 3 What is lambda-calculus ? • An intentional theory of functions. • A simple functional programming language. • A theory of free- and bound-variables,

MPRI 6 22

IV. Hybrid Logic

Page 23: Logical FormalismsMPRI 6 3 What is lambda-calculus ? • An intentional theory of functions. • A simple functional programming language. • A theory of free- and bound-variables,

MPRI 6 23

Key idea: provide the formula language with explicitmeans of speaking about worlds!

Syntax:

Two sorts of atoms: usual atomic propositions (a, b, c, . . .), and nominals(i, j, k, . . .). Nominals will be used for naming worlds.

F ::= a | i | ¬F | F ∨ F | F | ↓i. F | @iF

↓ is a binder: the free occurrences of i in A are bound in ↓i. F . On the, otherhand, @ is simply a binary connectives whose first term must be a nominal.

Intuition: ↓ is used for naming the “here-and-now”. It allows a nominalto be bound to the current world. @iA asserts that proposition A holds atworld i.

Page 24: Logical FormalismsMPRI 6 3 What is lambda-calculus ? • An intentional theory of functions. • A simple functional programming language. • A theory of free- and bound-variables,

MPRI 6 24

Semantics:

Let M = 〈W,R,P 〉 be a Kripke model, and let η be a valuation that assignsto each nominal an element of W .

M, η, s |= a iff s ∈ P (a).

M, η, s |= i iff s = η(i).

M, η, s |= ¬A iff not M, η, s |= A.

M, η, s |= A ∨B iff either M, η, s |= A or M, η, s |= B, or both.

M, η, s |= A iff for every t ∈W such that sRt, M, η, t |= A.

M, η, s |= ↓i. A iff M, η[i:=s], s |= A.

M, η, s |= @iA iff M, η, η(i) |= A.

Page 25: Logical FormalismsMPRI 6 3 What is lambda-calculus ? • An intentional theory of functions. • A simple functional programming language. • A theory of free- and bound-variables,

MPRI 6 25

Axiomatization:

1. ↓i. (A ⊃ B) ⊃ (A ⊃ ↓i. B), where i does not occur free in A

2. ↓i. A ⊃ (j ⊃ A[i:=j])

3. ↓i. (i ⊃ A) ⊃ ↓i. A

4. ↓i. A ≡ ¬↓i.¬A

5. @i(A ⊃ B) ⊃ (@iA ⊃ @iB)

6. @iA ≡ ¬@i¬A

7. i ∧A ⊃ @iA

Page 26: Logical FormalismsMPRI 6 3 What is lambda-calculus ? • An intentional theory of functions. • A simple functional programming language. • A theory of free- and bound-variables,

MPRI 6 26

8. @ii

9. @ij ⊃ (@jA ⊃ @iA)

10. @ij ≡ @ji

11. @i@jA ≡ @jA

12. ♦@iA ⊃ @iA

13. ♦i ∧@iA ⊃ ♦A

A ⊃ B A

B

A

A

A

↓ i. AA

@iA

@i(j ∧A) ⊃ B(*)

@iA ⊃ B

@i♦(j ∧A) ⊃ B(*)

@i♦A ⊃ B

(*) j is distinct from i and does not occur free in A or B.

Page 27: Logical FormalismsMPRI 6 3 What is lambda-calculus ? • An intentional theory of functions. • A simple functional programming language. • A theory of free- and bound-variables,

MPRI 6 27

An example:

The binary operator of temporal logic:

A until B

may be defined as:

↓i.♦↓j.@i(♦(j ∧B) ∧ (♦j ⊃ A))

http://hylo.loria.fr/