kripke-style semantics for full simply typed lambda calculus

Post on 04-Nov-2021

7 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Kripke-style semantics for Full Simply Typed LambdaCalculus

Simona Kasterovic1 Silvia Ghilezan1, 2

1Faculty of Technical Sciences, University of Novi Sad2Mathematical Institute SASA, Belgrade, Serbia

Logic and Applications 2020September 21-25, 2020

Kasterovic, Ghilezan Full Simply Typed Lambda Calculus LAP 2020 1 / 11

LAP 2019 (reminder)

Full simply typed lambda calculus

Mitchell, J. C., Foundations for programming languages, Foundation ofcomputing series. MIT Press, 1996.

Kripke-style semantics

Kripke applicative structure

valuation ρ - partial mapping, ρ : V ×W →⋃

σ∈Type,w∈W

Aσw ,

If ρ(x ,w) ∈ Aσw and w ≤ w ′ then ρ(x ,w ′) = iσw ,w ′(ρ(x ,w)).

Kripke lambda model Kρ = 〈K, ρ〉

w |= x : σ if and only if ρ(x ,w) ∈ Aσw

Soundness (proved)

Completeness (conjectured)

Kasterovic, Ghilezan Full Simply Typed Lambda Calculus LAP 2020 2 / 11

LAP 2019 (reminder)

Full simply typed lambda calculus

Mitchell, J. C., Foundations for programming languages, Foundation ofcomputing series. MIT Press, 1996.

Kripke-style semantics

Kripke applicative structure

valuation ρ - partial mapping, ρ : V ×W →⋃

σ∈Type,w∈W

Aσw ,

If ρ(x ,w) ∈ Aσw and w ≤ w ′ then ρ(x ,w ′) = iσw ,w ′(ρ(x ,w)).

Kripke lambda model Kρ = 〈K, ρ〉

w |= x : σ if and only if ρ(x ,w) ∈ Aσw

Soundness (proved)

Completeness (conjectured)

Kasterovic, Ghilezan Full Simply Typed Lambda Calculus LAP 2020 2 / 11

LAP 2019 (reminder)

Full simply typed lambda calculus

Mitchell, J. C., Foundations for programming languages, Foundation ofcomputing series. MIT Press, 1996.

Terms M,N ::=x|λx .M|MN|π1(M)|π2(M)|〈M,N〉|in1(M)|in2(M)||case M of in1(x)⇒ N | in2(y)⇒ L|〈〉|abort(M)

Types σ, τ ::=a | σ → τ | σ × τ | σ + τ | 0 | 1

Kripke-style semantics

Kripke applicative structure

valuation ρ - partial mapping, ρ : V ×W →⋃

σ∈Type,w∈W

Aσw ,

If ρ(x ,w) ∈ Aσw and w ≤ w ′ then ρ(x ,w ′) = iσw ,w ′(ρ(x ,w)).

Kripke lambda model Kρ = 〈K, ρ〉

w |= x : σ if and only if ρ(x ,w) ∈ Aσw

Soundness (proved)Completeness (conjectured)

Kasterovic, Ghilezan Full Simply Typed Lambda Calculus LAP 2020 2 / 11

LAP 2019 (reminder)

Full simply typed lambda calculus

Mitchell, J. C., Foundations for programming languages, Foundation ofcomputing series. MIT Press, 1996.

x : σ ∈ ΓΓ ` x : σ

Γ, x : σ ` M : τ

Γ ` λx .M : σ → τ

Γ ` M : σ → τ Γ ` N : σΓ ` MN : τ

Γ ` M : σ Γ ` N : τΓ ` 〈M,N〉 : σ × τ

Γ ` M : σ × τΓ ` π1(M) : σ

Γ ` M : σ × τΓ ` π2(M) : τ

Γ ` M : σΓ ` in1(M) : σ + τ

Γ ` M : τΓ ` in2(M) : σ + τ

Γ ` M : σ + τ Γ, x : σ ` N : ρ Γ, y : τ ` L : ρ

Γ ` case M of in1(x)⇒ N | in2(y)⇒ L : ρ

Γ ` 〈〉 : 1Γ ` M : 0

Γ ` abort(M) : σ

Kripke-style semantics

Kripke applicative structure

valuation ρ - partial mapping, ρ : V ×W →⋃

σ∈Type,w∈W

Aσw ,

If ρ(x ,w) ∈ Aσw and w ≤ w ′ then ρ(x ,w ′) = iσw ,w ′(ρ(x ,w)).

Kripke lambda model Kρ = 〈K, ρ〉

w |= x : σ if and only if ρ(x ,w) ∈ Aσw

Soundness (proved)Completeness (conjectured)

Kasterovic, Ghilezan Full Simply Typed Lambda Calculus LAP 2020 2 / 11

LAP 2019 (reminder)

Full simply typed lambda calculus

Mitchell, J. C., Foundations for programming languages, Foundation ofcomputing series. MIT Press, 1996.

Kripke-style semantics

Kripke applicative structure

valuation ρ - partial mapping, ρ : V ×W →⋃

σ∈Type,w∈W

Aσw ,

If ρ(x ,w) ∈ Aσw and w ≤ w ′ then ρ(x ,w ′) = iσw ,w ′(ρ(x ,w)).

Kripke lambda model Kρ = 〈K, ρ〉

w |= x : σ if and only if ρ(x ,w) ∈ Aσw

Soundness (proved)

Completeness (conjectured)

Kasterovic, Ghilezan Full Simply Typed Lambda Calculus LAP 2020 2 / 11

LAP 2019 (reminder)

Full simply typed lambda calculus

Mitchell, J. C., Foundations for programming languages, Foundation ofcomputing series. MIT Press, 1996.

Kripke-style semantics

Kripke applicative structure

K = 〈W ,≤, {Aσw}, {iσw ,w ′}〉

valuation ρ - partial mapping, ρ : V ×W →⋃

σ∈Type,w∈W

Aσw ,

If ρ(x ,w) ∈ Aσw and w ≤ w ′ then ρ(x ,w ′) = iσw ,w ′(ρ(x ,w)).

Kripke lambda model Kρ = 〈K, ρ〉

w |= x : σ if and only if ρ(x ,w) ∈ Aσw

Soundness (proved)

Completeness (conjectured)

Kasterovic, Ghilezan Full Simply Typed Lambda Calculus LAP 2020 2 / 11

LAP 2019 (reminder)

Full simply typed lambda calculus

Mitchell, J. C., Foundations for programming languages, Foundation ofcomputing series. MIT Press, 1996.

Kripke-style semantics

Kripke applicative structure

K = 〈W ,≤, {Aσw}, {iσw ,w ′}〉

W is a setof “possible

worlds” partiallyordered by ≤

valuation ρ - partial mapping, ρ : V ×W →⋃

σ∈Type,w∈W

Aσw ,

If ρ(x ,w) ∈ Aσw and w ≤ w ′ then ρ(x ,w ′) = iσw ,w ′(ρ(x ,w)).

Kripke lambda model Kρ = 〈K, ρ〉

w |= x : σ if and only if ρ(x ,w) ∈ Aσw

Soundness (proved)

Completeness (conjectured)

Kasterovic, Ghilezan Full Simply Typed Lambda Calculus LAP 2020 2 / 11

LAP 2019 (reminder)

Full simply typed lambda calculus

Mitchell, J. C., Foundations for programming languages, Foundation ofcomputing series. MIT Press, 1996.

Kripke-style semantics

Kripke applicative structure

K = 〈W ,≤, {Aσw}, {iσw ,w ′}〉

{Aσw} is a familyof sets indexed

by types σand worlds w

valuation ρ - partial mapping, ρ : V ×W →⋃

σ∈Type,w∈W

Aσw ,

If ρ(x ,w) ∈ Aσw and w ≤ w ′ then ρ(x ,w ′) = iσw ,w ′(ρ(x ,w)).

Kripke lambda model Kρ = 〈K, ρ〉

w |= x : σ if and only if ρ(x ,w) ∈ Aσw

Soundness (proved)

Completeness (conjectured)

Kasterovic, Ghilezan Full Simply Typed Lambda Calculus LAP 2020 2 / 11

LAP 2019 (reminder)

Full simply typed lambda calculus

Mitchell, J. C., Foundations for programming languages, Foundation ofcomputing series. MIT Press, 1996.

Kripke-style semantics

Kripke applicative structure

K = 〈W ,≤, {Aσw}, {iσw ,w ′}〉

a family {iσw ,w ′} of “transition functions” iσw ,w ′ :Aσw → Aσw ′ indexed by types of σ and pairs of worlds

w ≤ w ′, which satisfy the following conditions:

iσw ,w : Aσw → Aσw is identity (id)

iσw ′,w ′′ ◦ iσw ,w ′ = iσw ,w ′′ for all w ≤ w ′ ≤ w ′′ (comp)

valuation ρ - partial mapping, ρ : V ×W →⋃

σ∈Type,w∈W

Aσw ,

If ρ(x ,w) ∈ Aσw and w ≤ w ′ then ρ(x ,w ′) = iσw ,w ′(ρ(x ,w)).

Kripke lambda model Kρ = 〈K, ρ〉

w |= x : σ if and only if ρ(x ,w) ∈ Aσw

Soundness (proved)

Completeness (conjectured)

Kasterovic, Ghilezan Full Simply Typed Lambda Calculus LAP 2020 2 / 11

LAP 2019 (reminder)

Full simply typed lambda calculus

Mitchell, J. C., Foundations for programming languages, Foundation ofcomputing series. MIT Press, 1996.

Kripke-style semantics

Kripke applicative structure

K = 〈W ,≤, {Aσw}, {iσw ,w ′}〉valuation ρ - partial mapping, ρ : V ×W →

⋃σ∈Type,w∈W

Aσw ,

If ρ(x ,w) ∈ Aσw and w ≤ w ′ then ρ(x ,w ′) = iσw ,w ′(ρ(x ,w)).

Kripke lambda model Kρ = 〈K, ρ〉

w |= x : σ if and only if ρ(x ,w) ∈ Aσw

Soundness (proved)

Completeness (conjectured)

Kasterovic, Ghilezan Full Simply Typed Lambda Calculus LAP 2020 2 / 11

LAP 2019 (reminder)

Full simply typed lambda calculus

Mitchell, J. C., Foundations for programming languages, Foundation ofcomputing series. MIT Press, 1996.

Kripke-style semantics

Kripke applicative structure

K = 〈W ,≤, {Aσw}, {iσw ,w ′}〉valuation ρ - partial mapping, ρ : V ×W →

⋃σ∈Type,w∈W

Aσw ,

If ρ(x ,w) ∈ Aσw and w ≤ w ′ then ρ(x ,w ′) = iσw ,w ′(ρ(x ,w)).

Kripke lambda model Kρ = 〈K, ρ〉

w |= x : σ if and only if ρ(x ,w) ∈ Aσw

Soundness (proved)

Completeness (conjectured)

Kasterovic, Ghilezan Full Simply Typed Lambda Calculus LAP 2020 2 / 11

LAP 2019 (reminder)

Full simply typed lambda calculus

Mitchell, J. C., Foundations for programming languages, Foundation ofcomputing series. MIT Press, 1996.

Kripke-style semantics

Kripke applicative structure

K = 〈W ,≤, {Aσw}, {iσw ,w ′}〉valuation ρ - partial mapping, ρ : V ×W →

⋃σ∈Type,w∈W

Aσw ,

If ρ(x ,w) ∈ Aσw and w ≤ w ′ then ρ(x ,w ′) = iσw ,w ′(ρ(x ,w)).

Kripke lambda model Kρ = 〈K, ρ〉

w |= x : σ if and only if ρ(x ,w) ∈ Aσw

Soundness (proved)

Completeness (conjectured)

Kasterovic, Ghilezan Full Simply Typed Lambda Calculus LAP 2020 2 / 11

LAP 2019 (reminder)

Full simply typed lambda calculus

Mitchell, J. C., Foundations for programming languages, Foundation ofcomputing series. MIT Press, 1996.

Kripke-style semantics

Kripke applicative structure

K = 〈W ,≤, {Aσw}, {iσw ,w ′}〉valuation ρ - partial mapping, ρ : V ×W →

⋃σ∈Type,w∈W

Aσw ,

If ρ(x ,w) ∈ Aσw and w ≤ w ′ then ρ(x ,w ′) = iσw ,w ′(ρ(x ,w)).

Kripke lambda model Kρ = 〈K, ρ〉

w |= x : σ if and only if ρ(x ,w) ∈ Aσw

Soundness (proved)

Completeness (conjectured)

Kasterovic, Ghilezan Full Simply Typed Lambda Calculus LAP 2020 2 / 11

Failure

Goal:

Inconsistent basis is unsatisfiable.

7

Γ is inconsistent if Γ ` M : 0 for some M.

Kasterovic, Ghilezan Full Simply Typed Lambda Calculus LAP 2020 3 / 11

Failure

Goal:

Inconsistent basis is unsatisfiable. 7Γ is inconsistent if Γ ` M : 0 for some M.

Kasterovic, Ghilezan Full Simply Typed Lambda Calculus LAP 2020 3 / 11

NEW Kripke-style semantics

Kasterovic, S., Ghilezan, S., Kripke semantics and completeness for fullsimply typed lambda calculus, to appear in Journal of Logic andComputation Volume 30, issue 8 (2020).

Kasterovic, Ghilezan Full Simply Typed Lambda Calculus LAP 2020 4 / 11

NEW Kripke-style semantics

K = 〈W ,≤, {Dw}, {Aσw}, {Appw}, {Proj1,w}, {Proj2,w}, {Inlw}, {Inrw}, {iw ,w ′}〉

Kasterovic, Ghilezan Full Simply Typed Lambda Calculus LAP 2020 4 / 11

NEW Kripke-style semantics

K = 〈W , ≤,{Dw}, {Aσw}, {Appw}, {Proj1,w}, {Proj2,w}, {Inlw}, {Inrw}, {iw ,w ′}〉

W is a setof possible

worldspartiallyordered

by ≤

Kasterovic, Ghilezan Full Simply Typed Lambda Calculus LAP 2020 4 / 11

NEW Kripke-style semantics

K = 〈W ,≤, {Dw},{Aσw}, {Appw}, {Proj1,w}, {Proj2,w}, {Inlw}, {Inrw}, {iw ,w ′}〉

a family {Dw}w∈Wof sets, indexed by

worlds w , where theset Dw represents thedomain of a world w ,

Kasterovic, Ghilezan Full Simply Typed Lambda Calculus LAP 2020 4 / 11

NEW Kripke-style semantics

K = 〈W ,≤, {Dw}, {Aσw},{Appw}, {Proj1,w}, {Proj2,w}, {Inlw}, {Inrw}, {iw ,w ′}〉

a family {Aσw} ofsets indexed by typesσ and worlds w

Sets Aσw satisfy conditions:

for all w ∈W , for all σ ∈ Type, Aσw ⊆ Dw ,A0w is empty, i.e. A0

w = ∅, and A1w has one

element, i.e. A1w = {1w}, 1w ∈ Dw ,

there exists an injection functionH : Dw ] Dw → Dw , such that for allσ, τ ∈ Type, H : Aσw ] Aτw → Aσ+τ

w ,

there exists an injection functionG : Dw → Dw × Dw such that for allσ, τ ∈ Type, G : Aσ×τw → Aσw × Aτw ,

Kasterovic, Ghilezan Full Simply Typed Lambda Calculus LAP 2020 4 / 11

NEW Kripke-style semantics

K = 〈W ,≤, {Dw}, {Aσw}, {Appw},{Proj1,w}, {Proj2,w}, {Inlw}, {Inrw}, {iw ,w ′}〉

a family {Appw} ofapplication functions

Appw : Dw × Dw → Dw

indexed by worlds w

Appw � (Aσ→τw × Aσw ) : Aσ→τw × Aσw → Aτw

Kasterovic, Ghilezan Full Simply Typed Lambda Calculus LAP 2020 4 / 11

NEW Kripke-style semantics

K = 〈W ,≤, {Dw}, {Aσw}, {Appw}, {Proj1,w},{Proj2,w}, {Inlw}, {Inrw}, {iw ,w ′}〉

a family {Proj1,w} offirst projection functionsProj1,w : Dw → Dw

indexed by worlds w

Proj1,w � Aσ×τw : Aσ×τw → Aσw

Kasterovic, Ghilezan Full Simply Typed Lambda Calculus LAP 2020 4 / 11

NEW Kripke-style semantics

K = 〈W ,≤, {Dw}, {Aσw}, {Appw}, {Proj1,w}, {Proj2,w},{Inlw}, {Inrw}, {iw ,w ′}〉

a family {Proj2,w}of second pro-

jection functionsProj2,w : Dw → Dw

indexed by worlds w

Proj2,w � Aσ×τw : Aσ×τw → Aτw

Kasterovic, Ghilezan Full Simply Typed Lambda Calculus LAP 2020 4 / 11

NEW Kripke-style semantics

K = 〈W ,≤, {Dw}, {Aσw}, {Appw}, {Proj1,w}, {Proj2,w}, {Inlw},{Inrw}, {iw ,w ′}〉

a family {Inlw} of leftinjection functionsInlw : Dw → Dw

indexed by worlds w

Inlw � Aσw : Aσw → Aσ+τw

Kasterovic, Ghilezan Full Simply Typed Lambda Calculus LAP 2020 4 / 11

NEW Kripke-style semantics

K = 〈W ,≤, {Dw}, {Aσw}, {Appw}, {Proj1,w}, {Proj2,w}, {Inlw}, {Inrw},{iw ,w ′}〉

a family {Inrw} of rightinjection functionsInrw : Dw → Dw

indexed by worlds w

Inrw � Aτw : Aτw → Aσ+τw

Kasterovic, Ghilezan Full Simply Typed Lambda Calculus LAP 2020 4 / 11

NEW Kripke-style semantics

K = 〈W ,≤, {Dw}, {Aσw}, {Appw}, {Proj1,w}, {Proj2,w}, {Inlw}, {Inrw}, {iw ,w ′}〉

a family {iw ,w ′} oftransition functionsiw ,w ′ : Dw → Dw ′

indexed by pairsof worlds w ≤ w ′iw ,w ′ � Aσw : Aσw → Aσw ′ and all transition

functions satisfy the following conditions:

iw ,w : Dw → Dw is the identity (id)

iw ′,w ′′ ◦ iw ,w ′ = iw ,w ′′ for all w ≤ w ′ ≤ w ′′

(comp)

Kasterovic, Ghilezan Full Simply Typed Lambda Calculus LAP 2020 4 / 11

We also require that the application functions, the projection functionsand the injection functions commute with the transition in a natural way:

(∀f ∈ Dw ) (∀a ∈ Dw ) (∀w ′ ∈W ,w ≤ w ′)

iw ,w ′(Appw (f , a)) = Appw ′(iw ,w ′(f ), iw ,w ′(a)) (comm1)

iw ,w ′(Proj1,w (a)) = Proj1,w ′(iw ,w ′(a)) (comm2)

iw ,w ′(Proj2,w (a)) = Proj2,w ′(iw ,w ′(a)) (comm3)

iw ,w ′(Inlw (a)) = Inlw ′(iw ,w ′(a)) (comm4)

iw ,w ′(Inrw (a)) = Inrw ′(iw ,w ′(a)) (comm5)

;

Kasterovic, S., Ghilezan, S., Kripke semantics and completeness for fullsimply typed lambda calculus, to appear in Journal of Logic andComputation Volume 30, issue 8 (2020).

Kasterovic, Ghilezan Full Simply Typed Lambda Calculus LAP 2020 5 / 11

Kripke lambda model

Kρ = 〈K, ρ〉

K is a Kripke applicative structure which is extensional and hascombinators

ρ - partial mapping, for x ∈ V , w ∈W , if ρ(x ,w) is defined, thenρ(x ,w) ∈ Dw ,

if ρ(x ,w) ∈ Dw and w ≤ w ′, then ρ(x ,w ′) = iw ,w ′(ρ(x ,w)).

Kasterovic, Ghilezan Full Simply Typed Lambda Calculus LAP 2020 6 / 11

[[M]]wρ - meaning of the term M

[[x ]]wρ = ρ(x ,w);

[[λx .M]]wρ = a unique element d ∈ Dw , such that

(∀w ′ ≥ w)(∀a ∈ Dw ′) (Appw ′(iw ,w ′(f ), a) = [[M]]w′

ρ(x :=a))

[[MN]]wρ = Appw ([[M]]wρ , [[N]]wρ );

[[π1(M)]]wρ = Proj1,w ([[M]]wρ );

[[π2(M)]]wρ = Proj2,w ([[M]]wρ );

[[〈M,N〉]]wρ = a unique p ∈ Dw such that

Proj1,w (p) = [[M]]wρ

Proj2,w (p) = [[N]]wρ

Kasterovic, Ghilezan Full Simply Typed Lambda Calculus LAP 2020 7 / 11

[[M]]wρ - meaning of the term M ...

[[in1(M)]]wρ = Inlw ([[M]]wρ );

[[in2(M)]]wρ = Inrw ([[M]]wρ );

[[case M of in1(x)⇒ N | in2(y)⇒ L]]wρ = Appw (f , [[M]]wρ ), where fis a unique element of Dw such that

(∀w ′ ≥ w)(∀a ∈ Dw ′)(∀b ∈ Dw ′)

Appw ′(iw ,w ′(f ), Inlw ′(a)) = [[N]]w′

ρ(x :=a)

Appw ′(iw ,w ′(f ), Inrw ′(b)) = [[L]]w′

ρ(y :=b)

[[〈 〉]]wρ = 1w a unique element of A1w ;

[[abort(M)]]wρ = Appw (Zw , [[M]]wρ ).

Kasterovic, Ghilezan Full Simply Typed Lambda Calculus LAP 2020 8 / 11

Satisfiability

w |= M : σ if and only if [[M]]wρ ∈ Aσw .

Kρ |= M : σ if and only if w |= M : σ for all w .

Theorem (Soundness)

If Γ ` M : σ, then Γ |= M : σ.

Kasterovic, Ghilezan Full Simply Typed Lambda Calculus LAP 2020 9 / 11

Satisfiability

w |= M : σ if and only if [[M]]wρ ∈ Aσw .

Kρ |= M : σ if and only if w |= M : σ for all w .

Theorem (Soundness)

If Γ ` M : σ, then Γ |= M : σ.

Kasterovic, Ghilezan Full Simply Typed Lambda Calculus LAP 2020 9 / 11

Completeness 3

We defined a canonical model KΓ such that KΓ |= M : σ if and only ifΓ ` M : σ.

Completeness

If Γ |= M : σ, then Γ ` M : σ.

Kasterovic, Ghilezan Full Simply Typed Lambda Calculus LAP 2020 10 / 11

Kasterovic, Ghilezan Full Simply Typed Lambda Calculus LAP 2020 11 / 11

top related