Extracting nested relational queries from implicit definitions - - PowerPoint PPT Presentation

extracting nested relational queries from implicit
SMART_READER_LITE
LIVE PREVIEW

Extracting nested relational queries from implicit definitions - - PowerPoint PPT Presentation

Extracting nested relational queries from implicit definitions Pierre Pradic (j.w.w. Michael Benedikt) University of Oxford December 4 th , 2020 1 / 1 Plan of the talk The nested relational calculus (NRC) Implicit definability, implicit


slide-1
SLIDE 1

Extracting nested relational queries from implicit definitions

Pierre Pradic

(j.w.w. Michael Benedikt)

University of Oxford

December 4th, 2020

1 / 1

slide-2
SLIDE 2

Plan of the talk

◮ The nested relational calculus (NRC) ◮ Implicit definability, implicit → explicit for the flat case ◮ Our contribution: implicit → explicit for NRC

2 / 1

slide-3
SLIDE 3

Outline

3 / 1

slide-4
SLIDE 4

The nested relational calculus (NRC)

Syntax

Types: T, U ::= U | Set(T) | 1 | T × U Terms: Q, R ::= x | ∅ | Q ∪ R | Q \ R | {Q} | {Q | x ∈ R} | Q, . . . , R | πi

every variable x carries a type T

Terms represent nested queries of some given type T → U ◮ Cartesian structure

πi, . . .

◮ Monad structure on Set

{−},

◮ Idempotent monoid Set(T)

∅, ∪

◮ Set difference Q \ R Generalizes flat relational queries with higher-order types

flat ∼ = Set(Ui1) × . . . × Set(Uik ) → Set(Um)

4 / 1

slide-5
SLIDE 5

Examples

A flat query

The fiber of a relation f at some point x fib : U × Set(U × U) → Set(U) (x, f ) → f −1(x)

◮ “concrete instance”: U contains names, f =“is the parent of” ◮ can be written as (x, f ) → {case(π2(p) =U x, {π1(p)}, ∅) | p ∈ f }

syntactic sugar: case, =U

5 / 1

slide-6
SLIDE 6

Examples

A flat query

The fiber of a relation f at some point x fib : U × Set(U × U) → Set(U) (x, f ) → f −1(x)

◮ “concrete instance”: U contains names, f =“is the parent of” ◮ can be written as (x, f ) → {case(π2(p) =U x, {π1(p)}, ∅) | p ∈ f }

syntactic sugar: case, =U

A genuine nested query

Collect all fibers of f fibs : Set(U × U) → Set(U × Set(U)) f → {(a, f −1(a)) | a ∈ cod(f )}

◮ can be written as f → {{fib(x, f )} | x ∈ {π1(p) | p ∈ f }}

5 / 1

slide-7
SLIDE 7

Expressiveness of NRC

From now on, set Bool := Set(1). Derivable constructs: ◮ maps {Q(x) | x ∈ R} ◮ set intersection Q ∩ R ◮ case analyses

if the output is some Set(T)

◮ basic predicates =T: T × T → Bool, ∈T: T × Set(T) → Bool

6 / 1

slide-8
SLIDE 8

Expressiveness of NRC

From now on, set Bool := Set(1). Derivable constructs: ◮ maps {Q(x) | x ∈ R} ◮ set intersection Q ∩ R ◮ case analyses

if the output is some Set(T)

◮ basic predicates =T: T × T → Bool, ∈T: T × Set(T) → Bool

Proposition

NRC queries Q(xT) : T → Bool correspond exactly to ∆0 formulas ϕ(xT).

6 / 1

slide-9
SLIDE 9

Expressiveness of NRC

From now on, set Bool := Set(1). Derivable constructs: ◮ maps {Q(x) | x ∈ R} ◮ set intersection Q ∩ R ◮ case analyses

if the output is some Set(T)

◮ basic predicates =T: T × T → Bool, ∈T: T × Set(T) → Bool

Proposition

NRC queries Q(xT) : T → Bool correspond exactly to ∆0 formulas ϕ(xT). ∆0-separation is encodable in NRC {x ∈ Q | ϕ(x)}

6 / 1

slide-10
SLIDE 10

Limits to the expressiveness of NRC

For practical purposes, NRC is not be too expressive ◮ NRC is conservative over idealized SQL i.e., for flat queries ◮ for finite inputs, the output has polynomial size

Consequences

◮ rules out x → P(x) ◮ rules out curryfication!

Consider (x, y) → tt

[T → Set(U)] ≃ [T × U → Bool]

[T → Set(U)] ֒ → [T × U → Bool]

(For the rest of the talk: no finiteness assumptions)

7 / 1

slide-11
SLIDE 11

Outline

8 / 1

slide-12
SLIDE 12

Implicit definitions

Implicit definability

ϕ(i, o) is a functional definition of o in terms of i if ϕ(i, o) ∧ ϕ(i, o′) ⇒

  • = o′

Defines a partial function I → O

9 / 1

slide-13
SLIDE 13

Implicit definitions

Implicit definability

ϕ(i, o) is a functional definition of o in terms of i if ϕ(i, o) ∧ ϕ(i, o′) ⇒

  • = o′

Defines a partial function I → O

Main theorem

Expressible in NRC ⇐ ⇒ Has an implicit definition ◮ We call a NRC term an explicit definition ◮ Partial implicit definitions → compatible total explicit definitions ◮ (Orthogonal to C-H approaches, where totality proofs are used) ⇒: easy to map a NRC expression to an implicit definition

9 / 1

slide-14
SLIDE 14

Use-case for implicit→explicit

Main theorem

Expressible in NRC ⇐ ⇒ Has an implicit definition Implicit definitions might arguably be more convenient for users at times.

10 / 1

slide-15
SLIDE 15

Use-case for implicit→explicit

Main theorem

Expressible in NRC ⇐ ⇒ Has an implicit definition Implicit definitions might arguably be more convenient for users at times.

Use-case: inverting a query

Consider an injective NRC query such as fibs fibs : Set(U × U) → Set(U × Set(U)) f → {(a, f −1(a)) | a ∈ cod(f )}

10 / 1

slide-16
SLIDE 16

Use-case for implicit→explicit

Main theorem

Expressible in NRC ⇐ ⇒ Has an implicit definition Implicit definitions might arguably be more convenient for users at times.

Use-case: inverting a query

Consider an injective NRC query such as fibs fibs : Set(U × U) → Set(U × Set(U)) f → {(a, f −1(a)) | a ∈ cod(f )} ◮ can be converted to an implicit ϕ(f , F)

10 / 1

slide-17
SLIDE 17

Use-case for implicit→explicit

Main theorem

Expressible in NRC ⇐ ⇒ Has an implicit definition Implicit definitions might arguably be more convenient for users at times.

Use-case: inverting a query

Consider an injective NRC query such as fibs fibs : Set(U × U) → Set(U × Set(U)) f → {(a, f −1(a)) | a ∈ cod(f )} ◮ can be converted to an implicit ϕ(f , F) ◮ ϕ(f , F) defines a partial function F → f

10 / 1

slide-18
SLIDE 18

Use-case for implicit→explicit

Main theorem

Expressible in NRC ⇐ ⇒ Has an implicit definition Implicit definitions might arguably be more convenient for users at times.

Use-case: inverting a query

Consider an injective NRC query such as fibs fibs : Set(U × U) → Set(U × Set(U)) f → {(a, f −1(a)) | a ∈ cod(f )} ◮ can be converted to an implicit ϕ(f , F) ◮ ϕ(f , F) defines a partial function F → f a NRC-definable retract of fibs

10 / 1

slide-19
SLIDE 19

Interpolation

The result was already known for the flat case.

Beth definability

Let ϕ(R) be a first-order formula. If ϕ(R) ∧ ϕ(R′) ⇒ R ≡ R′, then there is a FO ψ( x) such that ϕ(ψ).

i.e., R first-order definable

11 / 1

slide-20
SLIDE 20

Interpolation

The result was already known for the flat case.

Beth definability

Let ϕ(R) be a first-order formula. If ϕ(R) ∧ ϕ(R′) ⇒ R ≡ R′, then there is a FO ψ( x) such that ϕ(ψ).

i.e., R first-order definable

◮ Model-theoretic proof using amalgamation

11 / 1

slide-21
SLIDE 21

Interpolation

The result was already known for the flat case.

Beth definability

Let ϕ(R) be a first-order formula. If ϕ(R) ∧ ϕ(R′) ⇒ R ≡ R′, then there is a FO ψ( x) such that ϕ(ψ).

i.e., R first-order definable

◮ Model-theoretic proof using amalgamation ◮ Proof-theoretic effective proof using interpolation

11 / 1

slide-22
SLIDE 22

Interpolation

The result was already known for the flat case.

Beth definability

Let ϕ(R) be a first-order formula. If ϕ(R) ∧ ϕ(R′) ⇒ R ≡ R′, then there is a FO ψ( x) such that ϕ(ψ).

i.e., R first-order definable

◮ Model-theoretic proof using amalgamation ◮ Proof-theoretic effective proof using interpolation

ϕ(C, L) ψ(C, R) θ(C)

C L R

Craig interpolation

If ϕ ⇒ ψ, there exists θ such that ϕ ⇒ θ and θ ⇒ ψ and Vocabulary(θ) ⊆ Vocabulary(ϕ) ∩ Vocabulary(ψ)

11 / 1

slide-23
SLIDE 23

Interpolation

The result was already known for the flat case.

Beth definability

Let ϕ(R) be a first-order formula. If ϕ(R) ∧ ϕ(R′) ⇒ R ≡ R′, then there is a FO ψ( x) such that ϕ(ψ).

i.e., R first-order definable

◮ Model-theoretic proof using amalgamation ◮ Proof-theoretic effective proof using interpolation

ϕ(C, L) ψ(C, R) θ(C)

C L R

Craig interpolation

If ϕ ⇒ ψ, there exists θ such that ϕ ⇒ θ and θ ⇒ ψ and Vocabulary(θ) ⊆ Vocabulary(ϕ) ∩ Vocabulary(ψ) ◮ θ linear-time computable from a cut-free derivation ◮ Rather robust result

∆0-interpolation, intuitionistic/linear logic. . .

11 / 1

slide-24
SLIDE 24

Proof idea for the flat case

Fix an implicit definition ϕ(I, O) with I : Set(Uk) and O : Set(Um).

Effective proof sketch

12 / 1

slide-25
SLIDE 25

Proof idea for the flat case

Fix an implicit definition ϕ(I, O) with I : Set(Uk) and O : Set(Um).

Effective proof sketch

  • 1. Apply interpolation to

ϕ(I, O) ∧ O( x) ⊢ ϕ(I, O′) ⇒ O′( x) to obtain an explicit ∆0 definition θ(I, x).

12 / 1

slide-26
SLIDE 26

Proof idea for the flat case

Fix an implicit definition ϕ(I, O) with I : Set(Uk) and O : Set(Um).

Effective proof sketch

  • 1. Apply interpolation to

ϕ(I, O) ∧ O( x) ⊢ ϕ(I, O′) ⇒ O′( x) to obtain an explicit ∆0 definition θ(I, x).

  • 2. There is a NRC term M : Set(Uk) → Set(Um) maximal for ⊆

12 / 1

slide-27
SLIDE 27

Proof idea for the flat case

Fix an implicit definition ϕ(I, O) with I : Set(Uk) and O : Set(Um).

Effective proof sketch

  • 1. Apply interpolation to

ϕ(I, O) ∧ O( x) ⊢ ϕ(I, O′) ⇒ O′( x) to obtain an explicit ∆0 definition θ(I, x).

  • 2. There is a NRC term M : Set(Uk) → Set(Um) maximal for ⊆

Additionally, θ(I, x) ⇔ θM(I, x) for any θ ∈ ∆0.

12 / 1

slide-28
SLIDE 28

Proof idea for the flat case

Fix an implicit definition ϕ(I, O) with I : Set(Uk) and O : Set(Um).

Effective proof sketch

  • 1. Apply interpolation to

ϕ(I, O) ∧ O( x) ⊢ ϕ(I, O′) ⇒ O′( x) to obtain an explicit ∆0 definition θ(I, x).

  • 2. There is a NRC term M : Set(Uk) → Set(Um) maximal for ⊆

Additionally, θ(I, x) ⇔ θM(I, x) for any θ ∈ ∆0.

  • 3. Conclude using ∆0-comprehension in NRC

{ x ∈ M | θ(I, x)}

12 / 1

slide-29
SLIDE 29

Proof idea for the flat case

Fix an implicit definition ϕ(I, O) with I : Set(Uk) and O : Set(Um).

Effective proof sketch

  • 1. Apply interpolation to

ϕ(I, O) ∧ O( x) ⊢ ϕ(I, O′) ⇒ O′( x) to obtain an explicit ∆0 definition θ(I, x).

  • 2. There is a NRC term M : Set(Uk) → Set(Um) maximal for ⊆

Additionally, θ(I, x) ⇔ θM(I, x) for any θ ∈ ∆0.

  • 3. Conclude using ∆0-comprehension in NRC

{ x ∈ M | θ(I, x)} Difficulty with the nested case: there is no M!

12 / 1

slide-30
SLIDE 30

Outline

13 / 1

slide-31
SLIDE 31

Main ineffective result

Main theorem

Expressible in NRC ⇐ ⇒ Has a ∆0 implicit definition automatic translation of implicit definitions to NRC?

14 / 1

slide-32
SLIDE 32

Main ineffective result

Main theorem

Expressible in NRC ⇐ ⇒ Has a ∆0 implicit definition automatic translation of implicit definitions to NRC? Problem: a non-constructive proof ◮ Model-theoretic argument

  • mitting types, . . .

◮ a generalization of Beth for multi-sorted structures

14 / 1

slide-33
SLIDE 33

Main ineffective result

Main theorem

Expressible in NRC ⇐ ⇒ Has a ∆0 implicit definition automatic translation of implicit definitions to NRC? Problem: a non-constructive proof ◮ Model-theoretic argument

  • mitting types, . . .

◮ a generalization of Beth for multi-sorted structures

Partial effective result

Expressible in NRC ⇐ ⇒ Has an intuitionistic ∆0 implicit definition

14 / 1

slide-34
SLIDE 34

Main effective result

Partial effective result

Expressible in NRC ⇐ ⇒ Has an intuitionistic ∆0 implicit definition

15 / 1

slide-35
SLIDE 35

Main effective result

Partial effective result

Expressible in NRC ⇐ ⇒ Has an intuitionistic ∆0 implicit definition

Algorithmic content

Input: ◮ An implicit definition ϕ(i, o) ◮ An intuitionistic (cut-free) proof π of functionality of ϕ Output: ◮ A NRC query Q(i) such that ϕ(i, o) ⇒ Q(i) = o ◮ Linear-time

Caveat: cut-elimination

15 / 1

slide-36
SLIDE 36

Main effective result

Partial effective result

Expressible in NRC ⇐ ⇒ Has an intuitionistic ∆0 implicit definition

Algorithmic content

Input: ◮ An implicit definition ϕ(i, o) ◮ An intuitionistic (cut-free) proof π of functionality of ϕ Output: ◮ A NRC query Q(i) such that ϕ(i, o) ⇒ Q(i) = o ◮ Linear-time

Caveat: cut-elimination

◮ Let’s look at the details. . .

15 / 1

slide-37
SLIDE 37

∆0 formulas and intuitionistic sequents

Let’s make several quality-of-life adjustments t, u ::= x | (t, u) | π1(t) | π2(t) | () ϕ, ψ ::= t =U u | t =U u | ∃x ∈ t ϕ | ∀x ∈ t ϕ | ϕ ∧ ψ | ϕ ∨ ψ

16 / 1

slide-38
SLIDE 38

∆0 formulas and intuitionistic sequents

Let’s make several quality-of-life adjustments t, u ::= x | (t, u) | π1(t) | π2(t) | () ϕ, ψ ::= t =U u | t =U u | ∃x ∈ t ϕ | ∀x ∈ t ϕ | ϕ ∧ ψ | ϕ ∨ ψ We use a cut-free version of LJ as our proof system.

Cut is admissible

16 / 1

slide-39
SLIDE 39

∆0 formulas and intuitionistic sequents

Let’s make several quality-of-life adjustments t, u ::= x | (t, u) | π1(t) | π2(t) | () ϕ, ψ ::= t =U u | t =U u | ∃x ∈ t ϕ | ∀x ∈ t ϕ | ϕ ∧ ψ | ϕ ∨ ψ We use a cut-free version of LJ as our proof system.

Cut is admissible

Derived formulas

t =Set(T) u := t ⊆T u ∧ u ⊆T t t ⊆T u := ∀x ∈ t. x ∈T u t ∈T u := ∃x ∈ u. t =T u

16 / 1

slide-40
SLIDE 40

∆0 formulas and intuitionistic sequents

Let’s make several quality-of-life adjustments t, u ::= x | (t, u) | π1(t) | π2(t) | () ϕ, ψ ::= t =U u | t =U u | ∃x ∈ t ϕ | ∀x ∈ t ϕ | ϕ ∧ ψ | ϕ ∨ ψ We use a cut-free version of LJ as our proof system.

Cut is admissible

Derived formulas

t =Set(T) u := t ⊆T u ∧ u ⊆T t t ⊆T u := ∀x ∈ t. x ∈T u t ∈T u := ∃x ∈ u. t =T u ◮ Allows to suppress the axiom of extensionality ◮ No further set-theoretic axioms!

16 / 1

slide-41
SLIDE 41

∆0 formulas and intuitionistic sequents

Let’s make several quality-of-life adjustments t, u ::= x | (t, u) | π1(t) | π2(t) | () ϕ, ψ ::= t =U u | t =U u | ∃x ∈ t ϕ | ∀x ∈ t ϕ | ϕ ∧ ψ | ϕ ∨ ψ We use a cut-free version of LJ as our proof system.

Cut is admissible

Derived formulas

t =Set(T) u := t ⊆T u ∧ u ⊆T t t ⊆T u := ∀x ∈ t. x ∈T u t ∈T u := ∃x ∈ u. t =T u ◮ Allows to suppress the axiom of extensionality ◮ No further set-theoretic axioms! ◮ Subformula property, for functionality proofs in LJ, sequents have shape Γ ⊢ t ∈T u

  • r

Γ ⊢ t ⊆T u

  • r

Γ ⊢ t =T u

16 / 1

slide-42
SLIDE 42

Extraction of terms from proofs

ϕ(C, L) ψ(C, R) θ(C)

C L R

Inspired by interpolation Suppose Γ(c, l), ∆(c, r) ⊢ l r.

17 / 1

slide-43
SLIDE 43

Extraction of terms from proofs

ϕ(C, L) ψ(C, R) θ(C)

C L R

Inspired by interpolation Suppose Γ(c, l), ∆(c, r) ⊢ l r. Then we can compute E(c) in NRC such that

17 / 1

slide-44
SLIDE 44

Extraction of terms from proofs

ϕ(C, L) ψ(C, R) θ(C)

C L R

Inspired by interpolation Suppose Γ(c, l), ∆(c, r) ⊢ l r. Then we can compute E(c) in NRC such that

Inductive invariant

◮ if is =T, then Γ, ∆ | = l = E ∧ r = E

17 / 1

slide-45
SLIDE 45

Extraction of terms from proofs

ϕ(C, L) ψ(C, R) θ(C)

C L R

Inspired by interpolation Suppose Γ(c, l), ∆(c, r) ⊢ l r. Then we can compute E(c) in NRC such that

Inductive invariant

◮ if is =T, then Γ, ∆ | = l = E ∧ r = E ◮ if is ⊆T, then Γ, ∆ | = l ⊆ E ∧ E ⊆ r

17 / 1

slide-46
SLIDE 46

Extraction of terms from proofs

ϕ(C, L) ψ(C, R) θ(C)

C L R

Inspired by interpolation Suppose Γ(c, l), ∆(c, r) ⊢ l r. Then we can compute E(c) in NRC such that

Inductive invariant

◮ if is =T, then Γ, ∆ | = l = E ∧ r = E ◮ if is ⊆T, then Γ, ∆ | = l ⊆ E ∧ E ⊆ r ◮ if is ∈T, then Γ, ∆ | = l ∈ E

17 / 1

slide-47
SLIDE 47

Extraction of terms from proofs

ϕ(C, L) ψ(C, R) θ(C)

C L R

Inspired by interpolation Suppose Γ(c, l), ∆(c, r) ⊢ l r. Then we can compute E(c) in NRC such that

Inductive invariant

◮ if is =T, then Γ, ∆ | = l = E ∧ r = E ◮ if is ⊆T, then Γ, ∆ | = l ⊆ E ∧ E ⊆ r ◮ if is ∈T, then Γ, ∆ | = l ∈ E Not quite interpolation

RHS depends on l

17 / 1

slide-48
SLIDE 48

Extraction of terms from proofs

ϕ(C, L) ψ(C, R) θ(C)

C L R

Inspired by interpolation Suppose Γ(c, l), ∆(c, r) ⊢ l r. Then we can compute E(c) in NRC such that

Inductive invariant

◮ if is =T, then Γ, ∆ | = l = E ∧ r = E ◮ if is ⊆T, then Γ, ∆ | = l ⊆ E ∧ E ⊆ r ◮ if is ∈T, then Γ, ∆ | = l ∈ E Not quite interpolation

RHS depends on l

Going from 3. to 2.

If is ∈T, then we can compute E ′(c) such that Γ, ∆ | = l ∈ E ′ ∧ E ′ ⊆ r

17 / 1

slide-49
SLIDE 49

Extraction of terms from proofs

ϕ(C, L) ψ(C, R) θ(C)

C L R

Inspired by interpolation Suppose Γ(c, l), ∆(c, r) ⊢ l r. Then we can compute E(c) in NRC such that

Inductive invariant

◮ if is =T, then Γ, ∆ | = l = E ∧ r = E ◮ if is ⊆T, then Γ, ∆ | = l ⊆ E ∧ E ⊆ r ◮ if is ∈T, then Γ, ∆ | = l ∈ E Not quite interpolation

RHS depends on l

Going from 3. to 2.

If is ∈T, then we can compute E ′(c) such that Γ, ∆ | = l ∈ E ′ ∧ E ′ ⊆ r ◮ apply ∆0 interpolation to Γ ⊢ ∆ ⇒ l ∈T r to obtain θ(c, l) Γ, ∆ jointly imply l ∈ {x ∈ E | θ(c, l)} ⊆ r

17 / 1

slide-50
SLIDE 50

Outline

18 / 1

slide-51
SLIDE 51

Towards classical proofs

LJ is not complete for functionality proofs wrt classical Tarskian semantics. w ∈ r; ∀x ∈ l. l ∈ r, ∀y ∈ w. l ∈ r ⊢ l ∈ r

19 / 1

slide-52
SLIDE 52

Towards classical proofs

LJ is not complete for functionality proofs wrt classical Tarskian semantics. w ∈ r; ∀x ∈ l. l ∈ r, ∀y ∈ w. l ∈ r ⊢ l ∈ r generalize the argument for LK?

While keeping a reasonable algorithmic complexity?

Γ ⊢ t1 ∈T1 u1 ∨ . . . ∨ tk ∈Tk uk

19 / 1

slide-53
SLIDE 53

Towards classical proofs

LJ is not complete for functionality proofs wrt classical Tarskian semantics. w ∈ r; ∀x ∈ l. l ∈ r, ∀y ∈ w. l ∈ r ⊢ l ∈ r generalize the argument for LK?

While keeping a reasonable algorithmic complexity?

Γ ⊢ t1 ∈T1 u1 ∨ . . . ∨ tk ∈Tk uk

Issues

◮ What inductive invariant? ◮ Naive attempts fail because we cannot adapt the above l ∈ E − → l ∈ E ′ ∧ E ′ ⊆ r

19 / 1

slide-54
SLIDE 54

Towards classical proofs

LJ is not complete for functionality proofs wrt classical Tarskian semantics. w ∈ r; ∀x ∈ l. l ∈ r, ∀y ∈ w. l ∈ r ⊢ l ∈ r generalize the argument for LK?

While keeping a reasonable algorithmic complexity?

Γ ⊢ t1 ∈T1 u1 ∨ . . . ∨ tk ∈Tk uk

Issues

◮ What inductive invariant? ◮ Naive attempts fail because we cannot adapt the above l ∈ E − → l ∈ E ′ ∧ E ′ ⊆ r ◮ Unclear how to constructivize the model-theoretic arguments

19 / 1

slide-55
SLIDE 55

The model-theoretic argument

◮ First, an effective correspondence between NRC and interpretations, regarding nested collections as models for ∈

interpretations: maps between models defined by FO formulas

◮ Then, reduction to a model-theoretic result:

τ τ σ σ ∼ ∼ M M′ Multi-sorted implicit definability

Let Σ be a theory with a multisorted signature {τ, σ}. Say that σ is implicitly definable from τ when, for every M, M′ | = Σ and bijective homomorphism M

  • τ ∼

= M′

  • τ,

there is a unique extension M ∼ = M′.

Theorem

If σ is implicitly definable from τ, then there is an interpretation of Σ into Σ

  • τ.

◮ Is there an effective version?

20 / 1

slide-56
SLIDE 56

The inductive invariant, classically

Last slide: deals only with functionality. What about Γ(c, l), ∆(c, r) | = l ∈ r = ⇒ ∃E ′ l ∈ E ′ ⊆ r ?

21 / 1

slide-57
SLIDE 57

The inductive invariant, classically

Last slide: deals only with functionality. What about Γ(c, l), ∆(c, r) | = l ∈ r = ⇒ ∃E ′ l ∈ E ′ ⊆ r ? Model-theoretic proof sketch based on a generalization of Beth definability

Generalized Beth definability (Makkai, Chang)

Consider a theory Σ over a single-sorted relational signature S ⊔ {R}. If for every model M = (M, . . .) of Σ, there are < 2|M| bijections f : M → M such that ◮ f is an homomorphism over S ◮ f (M) | = Σ then there is a parameterized definition ϕ of R over S: ∃ y.∀ x.R( x) ⇔ ϕ( x, y) R /

∈ FV (ϕ)

21 / 1

slide-58
SLIDE 58

The inductive invariant, classically

Last slide: deals only with functionality. What about Γ(c, l), ∆(c, r) | = l ∈ r = ⇒ ∃E ′ l ∈ E ′ ⊆ r ? Model-theoretic proof sketch based on a generalization of Beth definability

Generalized Beth definability (Makkai, Chang)

Consider a theory Σ over a single-sorted relational signature S ⊔ {R}. If for every model M = (M, . . .) of Σ, there are < 2|M| bijections f : M → M such that ◮ f is an homomorphism over S ◮ f (M) | = Σ then there is a parameterized definition ϕ of R over S: ∃ y.∀ x.R( x) ⇔ ϕ( x, y) R /

∈ FV (ϕ)

◮ Non-constructive proof, using saturated models. ◮ Analogy with Beth: replace “unique” by “few”. ◮ To the best of my knowledge, no proof-theoretic counterpart.

21 / 1

slide-59
SLIDE 59

Further work

Besides the aforementioned problems: ◮ Coq formalization with extraction

j.w.w. Armaël Guéneau

◮ Curry-Howard approach to the extraction of NRC terms

untyped case already implicit in the literature (Sazonov)

◮ Asymmetric version of the multi-sorted result?

22 / 1

slide-60
SLIDE 60

Further work

Besides the aforementioned problems: ◮ Coq formalization with extraction

j.w.w. Armaël Guéneau

◮ Curry-Howard approach to the extraction of NRC terms

untyped case already implicit in the literature (Sazonov)

◮ Asymmetric version of the multi-sorted result?

Thanks for listening! Further questions?

22 / 1

slide-61
SLIDE 61

Challenges toward an implementation

Effective (polytime) algorithm

Input: ◮ An implicit definition ϕ(i, o) ◮ An intuitionistic (cut-free) proof π of functionality of ϕ Output: ◮ A NRC query Q(i) such that ϕ(i, o) ⇒ Q(i) = o

  • 1. Code the algorithm?

◮ Informal description, no pseudocode

  • 2. Proof object π?

◮ Produced by an automated tool Issue: intuitionistic logic? ◮ Produced by the user Issue: convenient encoding?

1 / 0

slide-62
SLIDE 62

Formalization in Coq

Formalize the main statement in an interactive theorem prover ∃π proof of functionality of ϕ ⇒ ∃Q NRC expression implementing ϕ

2 / 0

slide-63
SLIDE 63

Formalization in Coq

Formalize the main statement in an interactive theorem prover ∃π proof of functionality of ϕ ⇒ ∃Q NRC expression implementing ϕ

Requires

Formal definition of ∆0 formulas, proof derivation, NRC, their semantics ◮ Inductive families and dependent types

◮ Bureaucratic paint point: binding construct

α-conversion, de Brujin

Proving both interpolation and its higher-order variants ◮ Literature: only one formalization in Isabelle of interpolation

◮ Induction with many (bureaucratic) subcases

2 / 0

slide-64
SLIDE 64

Formalization in Coq

Formalize the main statement in an interactive theorem prover ∃π proof of functionality of ϕ ⇒ ∃Q NRC expression implementing ϕ

Requires

Formal definition of ∆0 formulas, proof derivation, NRC, their semantics ◮ Inductive families and dependent types

◮ Bureaucratic paint point: binding construct

α-conversion, de Brujin

Proving both interpolation and its higher-order variants ◮ Literature: only one formalization in Isabelle of interpolation

◮ Induction with many (bureaucratic) subcases

Benefits of formalizing in Coq

Implementation: proving ≡ implementing the algorithm Safety: guarantee that the resulting implementation is bug-free

2 / 0

slide-65
SLIDE 65

Encoding of proof objects

Recall that an input is a formula ϕ(i, o) and a proof Inductive type of proofs

(deep embedding)

◮ Strongly typed ◮ Not human-readable Inputing proof objects directly inconvenient for users

3 / 0

slide-66
SLIDE 66

Tactics

Building complicated objects/functions/proofs in Coq in an interactive mode ◮ Easier for complex goals

4 / 0

slide-67
SLIDE 67

Tactics

Building complicated objects/functions/proofs in Coq in an interactive mode ◮ Easier for complex goals ◮ Still inconvenient here

◮ Formalized formal proof = formal proof ◮ Exposes de Brujin notation to users

4 / 0

slide-68
SLIDE 68

Tactics

Building complicated objects/functions/proofs in Coq in an interactive mode ◮ Easier for complex goals ◮ Still inconvenient here

◮ Formalized formal proof = formal proof ◮ Exposes de Brujin notation to users

Second part of our implementation: special purpose tactics/notations ◮ Manipulate formulas with actual variables ∼ small Domain Specific Language

inspired by the Iris proof-mode

4 / 0