A proof-theoretic foundation for tabled higher-order logic - - PowerPoint PPT Presentation

a proof theoretic foundation for tabled higher order
SMART_READER_LITE
LIVE PREVIEW

A proof-theoretic foundation for tabled higher-order logic - - PowerPoint PPT Presentation

A proof-theoretic foundation for tabled higher-order logic programming Brigitte Pientka Department of Computer Science Carnegie Mellon University Pittsburgh, PA, 15217, USA A proof-theoretic foundation for tabled higher-order logic programming


slide-1
SLIDE 1

A proof-theoretic foundation for tabled higher-order logic programming

Brigitte Pientka Department of Computer Science Carnegie Mellon University Pittsburgh, PA, 15217, USA

A proof-theoretic foundation for tabled higher-order logic programming – p.1/31

slide-2
SLIDE 2

Outline

  • What is higher-order logic programming?
  • Example: Type-system using subtyping
  • Tabled higher-order logic programming

– How higher-order tabling works – Characterization based on uniform proofs – Soundness proof

  • Related and future work

A proof-theoretic foundation for tabled higher-order logic programming – p.2/31

slide-3
SLIDE 3

Higher-order logic programming

What means higher-order?

  • Terms: (dependently) typed λ-calculus
  • Clauses: implication, universal quantification

A proof-theoretic foundation for tabled higher-order logic programming – p.3/31

slide-4
SLIDE 4

Higher-order logic programming

What means higher-order?

  • Terms: (dependently) typed λ-calculus
  • Clauses: implication, universal quantification

Framework for specifying and implementing

  • logical systems
  • proofs about them

A proof-theoretic foundation for tabled higher-order logic programming – p.3/31

slide-5
SLIDE 5

Higher-order logic programming

What means higher-order?

  • Terms: (dependently) typed λ-calculus
  • Clauses: implication, universal quantification

Framework for specifying and implementing

  • logical systems (safety logics, type system . . . )
  • proofs about them

A proof-theoretic foundation for tabled higher-order logic programming – p.3/31

slide-6
SLIDE 6

Higher-order logic programming

What means higher-order?

  • Terms: (dependently) typed λ-calculus
  • Clauses: implication, universal quantification

Framework for specifying and implementing

  • logical systems (safety logics, type system . . . )
  • proofs about them (correctness, soundness . . . )

A proof-theoretic foundation for tabled higher-order logic programming – p.3/31

slide-7
SLIDE 7

Higher-order logic programming

What means higher-order?

  • Terms: (dependently) typed λ-calculus
  • Clauses: implication, universal quantification

Framework for specifying and implementing

  • logical systems (safety logics, type system . . . )
  • proofs about them (correctness, soundness . . . )

Languages:

  • λProlog[Miller91], Isabelle[Paulson86]
  • Elf [Pfenning91]

A proof-theoretic foundation for tabled higher-order logic programming – p.3/31

slide-8
SLIDE 8

Proof search via logic programming

Generic proof search over logical systems

  • factor effort for each particular logical system

Infinite computation leads to non-termination.

  • Many specifications are not executable.

Redundant computation hampers performance.

  • Sub-proofs may be repeated.
  • There may be many ways to prove a query.

A proof-theoretic foundation for tabled higher-order logic programming – p.4/31

slide-9
SLIDE 9

First-order tabled computation

  • Resolution with memoization [Tamaki,Sato86]
  • Memoize atomic subgoals and re-use results
  • Finds all possible answers to a query
  • Terminates for programs in a finite domain
  • Combine tabled and non-tabled execution
  • Very successful: XSB system [Warren et.al.]

A proof-theoretic foundation for tabled higher-order logic programming – p.5/31

slide-10
SLIDE 10

This talk

  • 1. Tabled higher-order logic programming
  • Term: (dependently) typed λ-calculus
  • Clauses: universal quantification, implication
  • 2. High-level description based on uniform proofs
  • 3. Soundness proof

A proof-theoretic foundation for tabled higher-order logic programming – p.6/31

slide-11
SLIDE 11

Outline

  • What is higher-order logic programming?
  • Example: Type-system using subtyping
  • Tabled higher-order logic programming

– How higher-order tabling works – Characterization based on uniform proofs – Soundness proof

  • Related and future work

A proof-theoretic foundation for tabled higher-order logic programming – p.7/31

slide-12
SLIDE 12

Declarative description of subtyping

types τ :: =

zero | pos | nat | bit | τ1 ⇒ τ2 | . . .

Example: 6 = 110 and 110 ∈ nat

A proof-theoretic foundation for tabled higher-order logic programming – p.8/31

slide-13
SLIDE 13

Declarative description of subtyping

types τ :: =

zero | pos | nat | bit | τ1 ⇒ τ2 | . . .

Example: 6 = 110 and 110 ∈ nat

zn zero nat pn pos nat nb nat bit

A proof-theoretic foundation for tabled higher-order logic programming – p.8/31

slide-14
SLIDE 14

Declarative description of subtyping

types τ :: =

zero | pos | nat | bit | τ1 ⇒ τ2 | . . .

Example: 6 = 110 and 110 ∈ nat

zn zero nat pn pos nat nb nat bit refl

T T T R R S

tr

T S

A proof-theoretic foundation for tabled higher-order logic programming – p.8/31

slide-15
SLIDE 15

Typing rules for Mini-ML

expressions e ::= ǫ | e 0 | e 1 | lam x.e | app e1 e2 Γ ⊢ e : τ ′ τ ′ τ tp-sub Γ ⊢ e : τ Γ, x : τ1 ⊢ e : τ2

tp-lamx

Γ ⊢ lam x.e : τ1 ⇒ τ2

A proof-theoretic foundation for tabled higher-order logic programming – p.9/31

slide-16
SLIDE 16

Implementation of subtyping

zn: sub zero nat. pn: sub pos nat. nb: sub nat bit. refl: sub T T. tr: sub T S <- sub T R <- sub R S.

A proof-theoretic foundation for tabled higher-order logic programming – p.10/31

slide-17
SLIDE 17

Implementation of subtyping

zn: sub zero nat. pn: sub pos nat. nb: sub nat bit. refl: sub T T. tr: sub T S <- sub T R <- sub R S. Not executable!

A proof-theoretic foundation for tabled higher-order logic programming – p.10/31

slide-18
SLIDE 18

Implementation of typing rules

tp sub:

  • f E T

<- of E T’ <- sub T’ T. tp lam:

  • f (lam λ x.E x) (T1 => T2)

<-(Π x:exp.of x T1 -> of (E x) T2). “forall x:exp, assume of x T1 and show of (E x) T2”

A proof-theoretic foundation for tabled higher-order logic programming – p.11/31

slide-19
SLIDE 19

Implementation of typing rules

tp sub:

  • f E T

<- of E T’ <- sub T’ T. tp lam:

  • f (lam λ x.E x) (T1 => T2)

<-(Π x:exp.of x T1 -> of (E x) T2). “forall x:exp, assume of x T1 and show of (E x) T2” Redundancy: tp sub is always applicable!

A proof-theoretic foundation for tabled higher-order logic programming – p.11/31

slide-20
SLIDE 20

Outline

  • What is higher-order logic programming?
  • Example: Type-system using subtyping
  • Tabled higher-order logic programming

– How higher-order tabling works – Characterization based on uniform proofs – Soundness proof

  • Related and future work

A proof-theoretic foundation for tabled higher-order logic programming – p.12/31

slide-21
SLIDE 21

Outline

  • What is higher-order logic programming?
  • Example: Type-system using subtyping
  • Tabled higher-order logic programming

– How higher-order tabling works – Characterization based on uniform proofs – Soundness proof

  • Related and future work

A proof-theoretic foundation for tabled higher-order logic programming – p.12/31

slide-22
SLIDE 22

Tabled higher-order logic programming

  • Eliminate redundant and infinite paths from

proof search using a memo-table

  • Table entry: (Γ → a , A)
  • Γ : context of assumptions (i.e.x:exp, u:of x T1)
  • a : atomic goal (i.e. of (lam λx. x) T)
  • A : list of answer substitutions for all free

variables in Γ and a

  • Depth-first multi-stage strategy

adopted from first-order strategy [Tamaki,Sato89]

A proof-theoretic foundation for tabled higher-order logic programming – p.13/31

slide-23
SLIDE 23

How higher-order tabling works...

Stage 1 Entry Answers

· → of (lam λx.x) T

A proof-theoretic foundation for tabled higher-order logic programming – p.14/31

slide-24
SLIDE 24

How higher-order tabling works...

Stage 1 Entry Answers

· → of (lam λx.x) T · → of (lam λx.x) T

A proof-theoretic foundation for tabled higher-order logic programming – p.14/31

slide-25
SLIDE 25

How higher-order tabling works...

tp_sub

Stage 1 Entry Answers

· → of (lam λx.x) T · → of (lam λx.x) T · → of (lam λx.x) R,

sub R T

A proof-theoretic foundation for tabled higher-order logic programming – p.14/31

slide-26
SLIDE 26

How higher-order tabling works...

Suspend

tp_sub

Stage 1 Entry Answers

· → of (lam λx.x) T · → of (lam λx.x) T · → of (lam λx.x) R,

sub R T

A proof-theoretic foundation for tabled higher-order logic programming – p.14/31

slide-27
SLIDE 27

How higher-order tabling works...

tp_lam

Suspend

tp_sub

Stage 1 Entry Answers

· → of (lam λx.x) T · → of (lam λx.x) T · → of (lam λx.x) R,

x:exp, u:of x T1 → of x T2 sub R T

A proof-theoretic foundation for tabled higher-order logic programming – p.14/31

slide-28
SLIDE 28

How higher-order tabling works...

tp_lam

Suspend

tp_sub

Stage 1 Entry Answers

· → of (lam λx.x) T · → of (lam λx.x) T · → of (lam λx.x) R,

x:exp, u:of x T1 → of x T2 x:exp, u:of x T1 → of x T2 sub R T

A proof-theoretic foundation for tabled higher-order logic programming – p.14/31

slide-29
SLIDE 29

How higher-order tabling works...

u tp_lam

Suspend

tp_sub

Stage 1 Entry Answers

· → of (lam λx.x) T · → of (lam λx.x) T · → of (lam λx.x) R,

x:exp, u:of x T1 → of x T2 x:exp, u:of x T1 → of x T2 sub R T T1 = S, T2 = S, T = (S ⇒ S)

A proof-theoretic foundation for tabled higher-order logic programming – p.14/31

slide-30
SLIDE 30

How higher-order tabling works...

u tp_lam

Suspend

tp_sub

Stage 1 Entry Answers

· → of (lam λx.x) T · → of (lam λx.x) T · → of (lam λx.x) R,

x:exp, u:of x T1 → of x T2 x:exp, u:of x T1 → of x T2 sub R T T1 = S, T2 = S, T = (S ⇒ S) T = (S ⇒ S) T1 = S, T2 = S

A proof-theoretic foundation for tabled higher-order logic programming – p.14/31

slide-31
SLIDE 31

How higher-order tabling works...

tp_sub u tp_lam

Suspend

tp_sub

Stage 1 Entry Answers

· → of (lam λx.x) T · → of (lam λx.x) T · → of (lam λx.x) R,

x:exp, u:of x T1 → of x T2 x:exp, u:of x T1 → of x T2 x:exp, u:of x T1 → of x R, sub R T sub R T2 T1 = S, T2 = S, T = (S ⇒ S) T = (S ⇒ S) T1 = S, T2 = S

A proof-theoretic foundation for tabled higher-order logic programming – p.14/31

slide-32
SLIDE 32

How higher-order tabling works...

Suspend

Stage 1 finished

tp_sub u tp_lam

Suspend

tp_sub

Stage 1 Entry Answers

· → of (lam λx.x) T · → of (lam λx.x) T · → of (lam λx.x) R,

x:exp, u:of x T1 → of x T2 x:exp, u:of x T1 → of x T2 x:exp, u:of x T1 → of x R, sub R T sub R T2 T1 = S, T2 = S, T = (S ⇒ S) T = (S ⇒ S) T1 = S, T2 = S

A proof-theoretic foundation for tabled higher-order logic programming – p.14/31

slide-33
SLIDE 33

How higher-order tabling works...

Resume Suspend

Stage 1 finished

tp_sub u tp_lam

Suspend

tp_sub

Stage 1 Entry Answers

· → of (lam λx.x) T · → of (lam λx.x) T · → of (lam λx.x) R,

x:exp, u:of x T1 → of x T2 x:exp, u:of x T1 → of x T2 x:exp, u:of x T1 → of x R, sub R T sub R T2 T1 = S, T2 = S, T = (S ⇒ S) T = (S ⇒ S) T1 = S, T2 = S

A proof-theoretic foundation for tabled higher-order logic programming – p.14/31

slide-34
SLIDE 34

How higher-order tabling works...

Resume Resume Suspend

Stage 1 finished

tp_sub u tp_lam

Suspend

tp_sub

Stage 1 Entry Answers

· → of (lam λx.x) T · → of (lam λx.x) T · → of (lam λx.x) R,

x:exp, u:of x T1 → of x T2 x:exp, u:of x T1 → of x T2 x:exp, u:of x T1 → of x R, sub R T sub R T2 T1 = S, T2 = S, T = (S ⇒ S) T = (S ⇒ S) T1 = S, T2 = S

A proof-theoretic foundation for tabled higher-order logic programming – p.14/31

slide-35
SLIDE 35

Higher-order issues

  • Dependencies among propositions

x:exp, u:of x P → sub P R

A proof-theoretic foundation for tabled higher-order logic programming – p.15/31

slide-36
SLIDE 36

Higher-order issues

  • Dependencies among propositions

x:exp, u:of x P → sub P R,

strengthen: → sub P R

A proof-theoretic foundation for tabled higher-order logic programming – p.15/31

slide-37
SLIDE 37

Higher-order issues

  • Dependencies among propositions

x:exp, u:of x P → sub P R,

strengthen: → sub P R

  • Dependencies among terms

x:exp, u:of x T1 → of x (R x u),

A proof-theoretic foundation for tabled higher-order logic programming – p.15/31

slide-38
SLIDE 38

Higher-order issues

  • Dependencies among propositions

x:exp, u:of x P → sub P R,

strengthen: → sub P R

  • Dependencies among terms

x:exp, u:of x T1 → of x (R x u),

strengthen

x:exp, u:of x T1 → of x R

A proof-theoretic foundation for tabled higher-order logic programming – p.15/31

slide-39
SLIDE 39

Higher-order issues

  • Dependencies among propositions

x:exp, u:of x P → sub P R,

strengthen: → sub P R

  • Dependencies among terms

x:exp, u:of x T1 → of x (R x u),

strengthen

x:exp, u:of x T1 → of x R

  • Subordination analysis [Virga99]

A proof-theoretic foundation for tabled higher-order logic programming – p.15/31

slide-40
SLIDE 40

Outline

  • What is higher-order logic programming?
  • Example: Type-system using subtyping
  • Tabled higher-order logic programming

– How higher-order tabling works – Characterization based on uniform proofs – Soundness proof

  • Related and future work

A proof-theoretic foundation for tabled higher-order logic programming – p.16/31

slide-41
SLIDE 41

Types and Programs

Types A ::= a | A1 → A2 | Πx : A1.A2 Programs Γ ::= · | Γ, x : A Logic programming view: tr:sub T S <- sub T R <- sub R S. Type-theoretic view:

tr:ΠT:tp.ΠS:tp.ΠR:tp. sub R S → (sub T R → sub T S)

A proof-theoretic foundation for tabled higher-order logic programming – p.17/31

slide-42
SLIDE 42

Uniform Proofs[Miller et al.91]

Two judgements Γ

u

− → A uniform proof decompose goal A until atomic Γ ≫ A

f

− → a focused proof pick a program clause A and decompose A until atomic

A proof-theoretic foundation for tabled higher-order logic programming – p.18/31

slide-43
SLIDE 43

Uniform Proofs

Γ, x : A1

u

− → A2

u∀x

Γ

u

− → Πx : A1.A2 Γ ≫ [M/x]A2

f

− → a M has type A1 in Γ

f∀

Γ ≫ Πx : A1.A2

f

− → a

A proof-theoretic foundation for tabled higher-order logic programming – p.19/31

slide-44
SLIDE 44

Uniform Proofs

Γ, x : A1

u

− → A2

u∀x

Γ

u

− → Πx : A1.A2 Γ ≫ [M/x]A2

f

− → a M has type A1 in Γ

f∀

Γ ≫ Πx : A1.A2

f

− → a Γ, u : A1

u

− → A2

u →u

Γ

u

− → A1 → A2 Γ ≫ A1

f

− → a Γ

u

− → A2 f → Γ ≫ A2 → A1

f

− → a

A proof-theoretic foundation for tabled higher-order logic programming – p.19/31

slide-45
SLIDE 45

Uniform Proofs

Γ, x : A1

u

− → A2

u∀x

Γ

u

− → Πx : A1.A2 Γ ≫ [M/x]A2

f

− → a M has type A1 in Γ

f∀

Γ ≫ Πx : A1.A2

f

− → a Γ, u : A1

u

− → A2

u →u

Γ

u

− → A1 → A2 Γ ≫ A1

f

− → a Γ

u

− → A2 f → Γ ≫ A2 → A1

f

− → a Γ, u : A, Γ′ ≫ A

f

− → a

uAtom

Γ, u : A, Γ′

u

− → a

A proof-theoretic foundation for tabled higher-order logic programming – p.19/31

slide-46
SLIDE 46

Uniform Proofs

Γ, x : A1

u

− → A2

u∀x

Γ

u

− → Πx : A1.A2 Γ ≫ [M/x]A2

f

− → a M has type A1 in Γ

f∀

Γ ≫ Πx : A1.A2

f

− → a Γ, u : A1

u

− → A2

u →u

Γ

u

− → A1 → A2 Γ ≫ A1

f

− → a Γ

u

− → A2 f → Γ ≫ A2 → A1

f

− → a Γ, u : A, Γ′ ≫ A

f

− → a

uAtom

Γ, u : A, Γ′

u

− → a

A proof-theoretic foundation for tabled higher-order logic programming – p.19/31

slide-47
SLIDE 47

Uniform Proofs

Γ, x : A1

u

− → A2

u∀x

Γ

u

− → Πx : A1.A2 Γ ≫ [M/x]A2

f

− → a M has type A1 in Γ

f∀

Γ ≫ Πx : A1.A2

f

− → a Γ, u : A1

u

− → A2

u →u

Γ

u

− → A1 → A2 Γ ≫ A1

f

− → a Γ

u

− → A2 f → Γ ≫ A2 → A1

f

− → a Γ, u : A, Γ′ ≫ A

f

− → a

uAtom

Γ, u : A, Γ′

u

− → a

A proof-theoretic foundation for tabled higher-order logic programming – p.19/31

slide-48
SLIDE 48

Uniform Proofs

Γ, x : A1

u

− → A2

u∀x

Γ

u

− → Πx : A1.A2 Γ ≫ [M/x]A2

f

− → a M has type A1 in Γ

f∀

Γ ≫ Πx : A1.A2

f

− → a Γ, u : A1

u

− → A2

u →u

Γ

u

− → A1 → A2 Γ ≫ A1

f

− → a Γ

u

− → A2 f → Γ ≫ A2 → A1

f

− → a Γ, u : A, Γ′ ≫ A

f

− → a

uAtom

Γ, u : A, Γ′

u

− → a

fAtom

Γ ≫ a

f

− → a

A proof-theoretic foundation for tabled higher-order logic programming – p.19/31

slide-49
SLIDE 49

Uniform Proofs

Γ, x : A1

u

− → A2

u∀x

Γ

u

− → Πx : A1.A2 Γ ≫ [M/x]A2

f

− → a M has type A1 in Γ

f∀

Γ ≫ Πx : A1.A2

f

− → a Γ, u : A1

u

− → A2

u →u

Γ

u

− → A1 → A2 Γ ≫ A1

f

− → a Γ

u

− → A2 f → Γ ≫ A2 → A1

f

− → a Γ, u : A, Γ′ ≫ A

f

− → a

uAtom

Γ, u : A, Γ′

u

− → a

fAtom

Γ ≫ a

f

− → a

A proof-theoretic foundation for tabled higher-order logic programming – p.19/31

slide-50
SLIDE 50

Uniform Proofs

Γ, x : A1

u

− → A2

u∀x

Γ

u

− → Πx : A1.A2 Γ ≫ [M/x]A2

f

− → a M has type A1 in Γ

f∀

Γ ≫ Πx : A1.A2

f

− → a Γ, u : A1

u

− → A2

u →u

Γ

u

− → A1 → A2 Γ ≫ A1

f

− → a Γ

u

− → A2 f → Γ ≫ A2 → A1

f

− → a Γ, u : A, Γ′ ≫ A

f

− → a

uAtom

Γ, u : A, Γ′

u

− → a

fAtom

Γ ≫ a

f

− → a

A proof-theoretic foundation for tabled higher-order logic programming – p.19/31

slide-51
SLIDE 51

Computing answer substitutions

Γ ≫ [M/x]A2

f

− → a M has type A1 in Γ

f∀

Γ ≫ Πx : A1.A2

f

− → a

  • Idea: replace M with an existential variable X,

which is instantiated using unification

A proof-theoretic foundation for tabled higher-order logic programming – p.20/31

slide-52
SLIDE 52

Computing answer substitutions

Γ ≫ [M/x]A2

f

− → a M has type A1 in Γ

f∀

Γ ≫ Πx : A1.A2

f

− → a

  • Idea: replace M with an existential variable X,

which is instantiated using unification

  • Problem
  • Higher-order unification is undecidable

restriction to higher-order patterns [Miller92,Pfenning91]

  • Instantiation for X may only depend on Γ

A proof-theoretic foundation for tabled higher-order logic programming – p.20/31

slide-53
SLIDE 53

Computing answer substitutions

Γ ≫ [M/x]A2

f

− → a M has type A1 in Γ

f∀

Γ ≫ Πx : A1.A2

f

− → a

  • 1. Raise M [Miller92,Pfenning91]
  • replace M with (λΓ.M) Γ
  • (λΓ.M) has type ΠΓ.A1
  • 2. Replace (λΓ.M) with existential variable XΠΓ.A1

A proof-theoretic foundation for tabled higher-order logic programming – p.20/31

slide-54
SLIDE 54

Computing answer substitutions

Γ ≫ [XΠΓ.A1 Γ/x]A2

f

− → a/θ XΠΓ.A1 is new Γ ≫ Πx : A1.A2

f

− → a/θ Unify(Γ, a′, a) = θ Γ ≫ a′

f

− → a/θ

  • Annotate existential variables X with its type A
  • Compute answer substitution θ as a result
  • Substitution: θ ::= · | θ, XA = M

A proof-theoretic foundation for tabled higher-order logic programming – p.20/31

slide-55
SLIDE 55

Uniform Proofs with substitutions

Γ, x : A1

u

− → A2/θ Γ

u

− → Πx : A1.A2/θ Γ ≫ [XΠΓ.A1 Γ/x]A2

f

− → a/θ XΠΓ.A1 is new Γ ≫ Πx : A1.A2

f

− → a/θ Γ, u : A1

u

− → A2/θ Γ

u

− → A1 → A2/θ Γ ≫ A1

f

− → a/θ1 Γ[θ1]

u

− → A2[θ1]/θ2 Γ ≫ A2 → A1

f

− → a/θ1 ◦ θ2 Γ, x : A, Γ′ ≫ A

f

− → a/θ Γ, x : A, Γ′

u

− → a/θ

A proof-theoretic foundation for tabled higher-order logic programming – p.21/31

slide-56
SLIDE 56

Uniform Proofs with substitutions

Γ, x : A1

u

− → A2/θ Γ

u

− → Πx : A1.A2/θ Γ ≫ [XΠΓ.A1 · Γ/x]A2

f

− → a/θ XΠΓ.A1 is new Γ ≫ Πx : A1.A2

f

− → a/θ Γ, u : A1

u

− → A2/θ Γ

u

− → A1 → A2/θ Γ ≫ A1

f

− → a/θ1 Γ[θ1]

u

− → A2[θ1]/θ2 Γ ≫ A2 → A1

f

− → a/θ1 ◦ θ2 Γ, x : A, Γ′ ≫ A

f

− → a/θ Γ, x : A, Γ′

u

− → a/θ

A proof-theoretic foundation for tabled higher-order logic programming – p.21/31

slide-57
SLIDE 57

Uniform Proofs with substitutions

Γ, x : A1

u

− → A2/θ Γ

u

− → Πx : A1.A2/θ Γ ≫ [XΠΓ.A1 · Γ/x]A2

f

− → a/θ XΠΓ.A1 is new Γ ≫ Πx : A1.A2

f

− → a/θ Γ, u : A1

u

− → A2/θ Γ

u

− → A1 → A2/θ Γ ≫ A1

f

− → a/θ1 Γ[θ1]

u

− → A2[θ1]/θ2 Γ ≫ A2 → A1

f

− → a/θ1 ◦ θ2 Γ, x : A, Γ′ ≫ A

f

− → a/θ Γ, x : A, Γ′

u

− → a/θ

A proof-theoretic foundation for tabled higher-order logic programming – p.21/31

slide-58
SLIDE 58

Uniform Proofs with substitutions

Γ, x : A1

u

− → A2/θ Γ

u

− → Πx : A1.A2/θ Γ ≫ [XΠΓ.A1 · Γ/x]A2

f

− → a/θ XΠΓ.A1 is new Γ ≫ Πx : A1.A2

f

− → a/θ Γ, u : A1

u

− → A2/θ Γ

u

− → A1 → A2/θ Γ ≫ A1

f

− → a/θ1 Γ[θ1]

u

− → A2[θ1]/θ2 Γ ≫ A2 → A1

f

− → a/θ1 ◦ θ2 Γ, x : A, Γ′ ≫ A

f

− → a/θ Γ, x : A, Γ′

u

− → a/θ Unify(Γ, a′, a) = θ Γ ≫ a′

f

− → a/θ

A proof-theoretic foundation for tabled higher-order logic programming – p.21/31

slide-59
SLIDE 59

Uniform Proofs with substitutions

Γ, x : A1

u

− → A2/θ Γ

u

− → Πx : A1.A2/θ Γ ≫ [XΠΓ.A1 · Γ/x]A2

f

− → a/θ XΠΓ.A1 is new Γ ≫ Πx : A1.A2

f

− → a/θ Γ, u : A1

u

− → A2/θ Γ

u

− → A1 → A2/θ Γ ≫ A1

f

− → a/θ1 Γ[θ1]

u

− → A2[θ1]/θ2 Γ ≫ A2 → A1

f

− → a/θ1 ◦ θ2 Γ, x : A, Γ′ ≫ A

f

− → a/θ Γ, x : A, Γ′

u

− → a/θ Unify(Γ, a′, a) = θ Γ ≫ a′

f

− → a/θ

A proof-theoretic foundation for tabled higher-order logic programming – p.21/31

slide-60
SLIDE 60

Uniform Proofs with Tables

  • Table T to store conjectures and their answers
  • Main judgments:
  • 1. T ; Γ

u

− → A/(θ, T ′)

  • 2. T ; Γ ≫ A

f

− → a/(θ, T ′).

  • To prove: T ; (Γ, x : A)

u

− → a/(θ, T ′)

  • Pick program clause A from Γ
  • Retrieve answers from T , if there are any

A proof-theoretic foundation for tabled higher-order logic programming – p.22/31

slide-61
SLIDE 61

Operations

extend add Γ

u

− → a to T , if it is not already in T

insert insert answer substitution θ to A of Γ

u

− → a, if θ is not already in A.

retrieve : retrieve an answer substitution θ for Γ

u

− → a from its answer list A in T

A proof-theoretic foundation for tabled higher-order logic programming – p.23/31

slide-62
SLIDE 62

Extensions

extend(T , (Γ, u : A, Γ′)

u

− → a) = T1 T1; (Γ, u : A, Γ′) ≫ A

f

− → a/(θ, T2)

insert(T2, (Γ, u : A, Γ′)

u

− → a, θ) = T3 T ; (Γ, u : A, Γ′)

u

− → a/(θ, T3)

extend retrieve(T ; Γ

u

− → a) = θ

retrieve

T ; Γ

u

− → a/(θ, T )

A proof-theoretic foundation for tabled higher-order logic programming – p.24/31

slide-63
SLIDE 63

Outline

  • What is higher-order logic programming?
  • Example: Type-system using subtyping
  • Tabled higher-order logic programming

– How higher-order tabling works – Characterization based on uniform proofs – Soundness proof

  • Related and future work

A proof-theoretic foundation for tabled higher-order logic programming – p.25/31

slide-64
SLIDE 64

Main results

Soundness Any uniform proof with answer substitution

has a uniform proof.

Completeness Any uniform proofs has a uniform proofs

with answer substitution.

Soundness Any tabled uniform proof with an answer

substitution has a uniform proof with the same answer substitution.

A proof-theoretic foundation for tabled higher-order logic programming – p.26/31

slide-65
SLIDE 65

Contributions

  • Tabled higher-order logic programming

Memoize and retrieve goals together with context

  • High-level description of tabling

based on uniform proofs

  • Soundness of higher-order tabled search
  • Implementation of a prototype
  • Tabeling offers a more efficient and flexible proof

search engine (see experiments [Pientka02])

A proof-theoretic foundation for tabled higher-order logic programming – p.27/31

slide-66
SLIDE 66

Outline

  • What is higher-order logic programming?
  • Example: Type-system using subtyping
  • Tabled higher-order logic programming

– How higher-order tabling works – Characterization based on uniform proofs – Soundness proof

  • Related and future work

A proof-theoretic foundation for tabled higher-order logic programming – p.28/31

slide-67
SLIDE 67

Related work

  • Tabled search is incomplete:
  • With tabelling we find only one proof for Γ

u

− → A

  • Proof irrelevance[Pfenning01]: all proofs for

Γ

u

− → a are considered equivalent

  • Other higher-order logic programming languages:
  • λProlog[Miller91]
  • Isabelle[Paulson86]

A proof-theoretic foundation for tabled higher-order logic programming – p.29/31

slide-68
SLIDE 68

Future work

  • Implementation issues:
  • Higher-order indexing
  • Different tabled search strategies
  • Apply tabelling to linear logic programming:
  • Lolli[Miller,Hodas91]
  • LLF[Cervesato,Pfenning96]

A proof-theoretic foundation for tabled higher-order logic programming – p.30/31

slide-69
SLIDE 69

Finally ...

Acknowledgements: Frank Pfenning if you want to find out more: http://www.cs.cmu.edu/˜bp email: bp@cs.cmu.edu

A proof-theoretic foundation for tabled higher-order logic programming – p.31/31