A constructive Coq library for the mechanisation of undecidability - - PowerPoint PPT Presentation

a constructive coq library for the mechanisation of
SMART_READER_LITE
LIVE PREVIEW

A constructive Coq library for the mechanisation of undecidability - - PowerPoint PPT Presentation

A constructive Coq library for the mechanisation of undecidability Yannick Forster and Dominique Larchey-Wendling MLA 2019 March 13 saarland university computer science Y. Forster and D. Larchey-Wendling Coq library of undecidability MLA


slide-1
SLIDE 1

A constructive Coq library for the mechanisation of undecidability

Yannick Forster and Dominique Larchey-Wendling MLA 2019 March 13

computer science

saarland

university

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 1

slide-2
SLIDE 2

Decidability

A problem P : X → P is decidable if . . . Classically Fix a model of computation M: there is a decider in M For the cbv λ-calculus ∃u : T.∀x : X. (ux ⊲ T ∧ Px) ∨ (ux ⊲ F ∧ ¬Px)

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 2

slide-3
SLIDE 3

Decidability

A problem P : X → P is decidable if . . . Classically Fix a model of computation M: there is a decider in M For the cbv λ-calculus ∃u : T.∀x : X. (ux ⊲ T ∧ Px) ∨ (ux ⊲ F ∧ ¬Px) Type Theory ∃f : X → B. ∀x : X. Px ↔ fx = true

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 2

slide-4
SLIDE 4

Decidability

A problem P : X → P is decidable if . . . Classically Fix a model of computation M: there is a decider in M For the cbv λ-calculus ∃u : T.∀x : X. (ux ⊲ T ∧ Px) ∨ (ux ⊲ F ∧ ¬Px) Type Theory ∃f : X → B. ∀x : X. Px ↔ fx = true dependent version (Coq, Agda, Lean, . . . ) dec P := ∀x : X. {P x} + {¬P x}

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 2

slide-5
SLIDE 5

Undecidability

A problem P : X → P is undecidable if . . . Classically If there is no decider u in M

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 3

slide-6
SLIDE 6

Undecidability

A problem P : X → P is undecidable if . . . Classically If there is no decider u in M For the cbv λ-calculus ¬∃u : T.∀x : X. (ux ⊲ T ∧ Px) ∨ (ux ⊲ F ∧ ¬Px)

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 3

slide-7
SLIDE 7

Undecidability

A problem P : X → P is undecidable if . . . Classically If there is no decider u in M For the cbv λ-calculus ¬∃u : T.∀x : X. (ux ⊲ T ∧ Px) ∨ (ux ⊲ F ∧ ¬Px) Type Theory ¬(∀x : X. {Px} + {¬Px})

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 3

slide-8
SLIDE 8

Undecidability

A problem P : X → P is undecidable if . . . Classically If there is no decider u in M For the cbv λ-calculus ¬∃u : T.∀x : X. (ux ⊲ T ∧ Px) ∨ (ux ⊲ F ∧ ¬Px) Type Theory

✭✭✭✭✭✭✭✭✭✭✭ ✭

¬(∀x : X. {Px} + {¬Px})

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 3

slide-9
SLIDE 9

Undecidability

A problem P : X → P is undecidable if . . . Classically If there is no decider u in M For the cbv λ-calculus ¬∃u : T.∀x : X. (ux ⊲ T ∧ Px) ∨ (ux ⊲ F ∧ ¬Px) Type Theory

✭✭✭✭✭✭✭✭✭✭✭ ✭

¬(∀x : X. {Px} + {¬Px}) In reality: most proofs are by reduction

Definition (Synthetic undecidability)

P undecidable := Halting problem reduces to P

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 3

slide-10
SLIDE 10

The library

https://github.com/uds-psl/coq-library-undecidability Halting problems

◮ Turing machines ◮ Minsky machines ◮ µ-recursive functions ◮ call-by-value lambda-calculus

Post correspondence problem Provability in linear logic and first-order logic Solvability of Diophantine equations, including a formalisation of the DPRM theorem

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 4

slide-11
SLIDE 11

Today

1 Overview over PCP and H10 as entry points 2 Exemplary undecidability proof for intuitionistic linear logic 3 Overview over the library and future work

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 5

slide-12
SLIDE 12
  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 6

slide-13
SLIDE 13

PCPX

Na 19in MLA M y cy xuz

  • fze

19i LA n c Nan

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 7

slide-14
SLIDE 14

PCPX

Na 19in MLA M y cy xuz

  • fze

19i LA n c Nan MLA M

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 7

slide-15
SLIDE 15

PCPX

Na 19in MLA M y cy xuz

  • fze

19i LA n c Nan MLA M 19i LA

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 7

slide-16
SLIDE 16

PCPX

Na 19in MLA M y cy xuz

  • fze

19i LA n c Nan MLA M 19i LA n

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 7

slide-17
SLIDE 17

PCPX

Na 19in MLA M y cy xuz

  • fze

19i LA n c Nan MLA M 19i LA n Na 19in

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 7

slide-18
SLIDE 18

PCPX

Na 19in MLA M y cy xuz

  • fze

19i LA n c Nan MLA M 19i LA n Na 19in n

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 7

slide-19
SLIDE 19

PCPX

Na 19in MLA M y cy xuz

  • fze

19i LA n c Nan MLA M 19i LA n Na 19in n c Nan

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 7

slide-20
SLIDE 20

PCPX

Na 19in MLA M y cy xuz

  • fze

19i LA n c Nan MLA M 19i LA n Na 19in n c Nan y cy

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 7

slide-21
SLIDE 21

PCPX

Na 19in MLA M y cy xuz

  • fze

19i LA n c Nan MLA M 19i LA n Na 19in n c Nan y cy MLA19inNancy MLA19inNancy

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 7

slide-22
SLIDE 22

PCPX

Na 19in MLA M y cy xuz

  • fze

19i LA n c Nan MLA M 19i LA n Na 19in n c Nan y cy MLA19inNancy MLA19inNancy

Symbols a, b, c: symbols of type X Strings x, y, z: lists of symbols Card x/y: pairs of strings Card set R: finite set of cards Stacks A: lists of cards

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 7

slide-23
SLIDE 23

PCPX

Na 19in MLA M y cy xuz

  • fze

19i LA n c Nan MLA M 19i LA n Na 19in n c Nan y cy MLA19inNancy MLA19inNancy

Symbols a, b, c: symbols of type X Strings x, y, z: lists of symbols Card x/y: pairs of strings Card set R: finite set of cards Stacks A: lists of cards []1 := ǫ []2 := ǫ (x/y :: A)1 := x(A1) (x/y :: A)2 := y(A2) PCP (R) := ∃A ⊆ R. A = [] ∧ A1 = A2

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 7

slide-24
SLIDE 24

PCP BPCP

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 7

slide-25
SLIDE 25

PCP BPCP

PCP is PCPN BPCP is PCPB

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 8

slide-26
SLIDE 26

PCP BPCP

PCP is PCPN BPCP is PCPB f : N∗ → B∗ f (a1 . . . an : N∗) := 1a10 . . . 1an0 Lift f to cards, card sets and stack by pointwise application

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 8

slide-27
SLIDE 27

PCP BPCP

PCP is PCPN BPCP is PCPB f : N∗ → B∗ f (a1 . . . an : N∗) := 1a10 . . . 1an0 Lift f to cards, card sets and stack by pointwise application To prove: PCP R ↔ BPCP(f R)

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 8

slide-28
SLIDE 28

PCP BPCP

PCP is PCPN BPCP is PCPB f : N∗ → B∗ f (a1 . . . an : N∗) := 1a10 . . . 1an0 Lift f to cards, card sets and stack by pointwise application To prove: PCP R ↔ BPCP(f R) Define inverse function g, easy

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 8

slide-29
SLIDE 29

Hilbert’s tenth problem, constraints version

c : constr ::= x ˙ + y ˙ = z | x ˙ × y ˙ = z | x ˙ = 1 [[x ˙ + y ˙ = z]]ρ := ρ x + ρ y = ρ z [[x ˙ × y ˙ = z]]ρ := ρ x · ρ y = ρ z [[x ˙ = 1]]ρ := ρ x = 1 H10c(L : L constr) := ∃ρ, ∀c ∈ L, [[c]]ρ

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 9

slide-30
SLIDE 30

Undecidability of Intuitionistic Linear Logic (CPP ’19)

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 10

slide-31
SLIDE 31

Undecidability of Intuitionistic Linear Logic (CPP ’19)

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 10

slide-32
SLIDE 32

Undecidability of Intuitionistic Linear Logic (CPP ’19)

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 10

slide-33
SLIDE 33

Undecidability of Intuitionistic Linear Logic (CPP ’19)

TM PCP BPCP BSM MM eILL ILL

ITP18 LICS10 LICS10

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 10

slide-34
SLIDE 34

Undecidability of Intuitionistic Linear Logic (CPP ’19)

TM PCP BPCP BSM MM eILL ILL

ITP18 1 2 3 4 LICS10 5 LICS10

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 10

slide-35
SLIDE 35

Low-level Code

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 10

slide-36
SLIDE 36

Code and subcode

Given a type I of instructions Codes are N-indexed programs: (i, P = [ρ0; . . . ; ρn−1]) of type N × L I i : ρ0; i + 1 : ρ1; . . . i + n − 1 : ρn−1; labels i, . . . , i + n − 1 identify PC values inside the program Subcode relation (i, P) <sc (j, Q) (i, P) <sc (j, Q) := ∃ L R, ∧ Q = L + + P + + R i = j + |L| instruction ρ occurs at pos. i in (j, Q): (i, [ρ]) <sc (j, Q) “Sub-programs” are contiguous segments

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 11

slide-37
SLIDE 37

Small Step Semantics for Code

Instructions as state transformers states (i, v): i is PC value and v : C a configuration a step relation ρ / / (i1, v1) ≻ (i2, v2)

◮ instruction ρ at position i1 transforms state (i1, v1) into (i2, v2)

extends to codes: (i, P) / / (i1, v1) ≻n (i2, v2) means

◮ Code (i, P) transforms state (i1, v1) into (i2, v2) ◮

(i1, [ρ]) <sc (i, P) ρ / / (i1, v1) ≻ (i2, v2) (i, P) / / (i1, v1) ≻ (i2, v2)

◮ Reflexive transitive closure: P /

/ s ≻∗ s ′

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 12

slide-38
SLIDE 38

Terminating computations and Big Step Semantics

denote P for codes like (i, P) and s for states like (j, v) which termination condition: out j P

◮ no instruction at j in P, computation is blocked (sufficient) ◮ P /

/ (j, v) ≻n s ∧ out j P implies n = 0 ∧ s = (j, v)

Terminating computations P / / s (j, w) := P / / s ≻∗ (j, w) ∧ out j P Termination P / / s ↓ := ∃s ′, P / / s s ′

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 13

slide-39
SLIDE 39

Contribution

PCP BPCP BSM MM eILL ILL

2

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 13

slide-40
SLIDE 40

BPCP BSM

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 13

slide-41
SLIDE 41

Binary stack machines (BSM)

n stacks of 0s and 1s (L B) for a fixed n state of type (PC, v) ∈ N × (L B)n instructions (with α ∈ [0, n − 1] and b ∈ B and p, q ∈ N) bsm instr ::= POP α p q | PUSH α b Step semantics for POP and PUSH (pseudo code) POP α p q : if α = [] then PC ← q if α = 0 :: β then α ← β; PC ← p if α = 1 :: β then α ← β; PC ← PC + 1 PUSH α b : α ← b :: α; PC ← PC + 1

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 14

slide-42
SLIDE 42

Binary stack machines (BSM)

n stacks of 0s and 1s (L B) for a fixed n state of type (PC, v) ∈ N × (L B)n instructions (with α ∈ [0, n − 1] and b ∈ B and p, q ∈ N) bsm instr ::= POP α p q | PUSH α b Step semantics for POP and PUSH (pseudo code) POP α p q : if α = [] then PC ← q if α = 0 :: β then α ← β; PC ← p if α = 1 :: β then α ← β; PC ← PC + 1 PUSH α b : α ← b :: α; PC ← PC + 1 BSM termination problem: BSM(n, i, B, v) := (i, B) / / (i, v) ↓

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 14

slide-43
SLIDE 43

Binary stack machines (BSM)

n stacks of 0s and 1s (L B) for a fixed n state of type (PC, v) ∈ N × (L B)n instructions (with α ∈ [0, n − 1] and b ∈ B and p, q ∈ N) bsm instr ::= POP α p q | PUSH α b Step semantics for POP and PUSH (pseudo code) POP α p q : if α = [] then PC ← q if α = 0 :: β then α ← β; PC ← p if α = 1 :: β then α ← β; PC ← PC + 1 PUSH α b : α ← b :: α; PC ← PC + 1 BSM termination problem: BSM(n, i, B, v) := (i, B) / / (i, v) ↓

Example (emptying stack α in 3 instructions)

i : POP α i (i + 3) i + 1 : PUSH α 0 i + 2 : POP α i i

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 14

slide-44
SLIDE 44

BPCP BSM

Iterate all possible lists of card (indices) Hard code every card as PUSH instructions Given a list of cards, compute top and bottom words in two stacks Check for those two stacks equality

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 15

slide-45
SLIDE 45

BPCP BSM

Iterate all possible lists of card (indices) Hard code every card as PUSH instructions Given a list of cards, compute top and bottom words in two stacks Check for those two stacks equality

Definition compare_stacks x y i p q := (* i *) [ POP x (4+i) (7+i) ; (* 1+i *) POP y q q ; (* 2+i *) PUSH x Zero ; POP x i i ; (* JMP i *) (* 4+i *) POP y i q ; (* 5+i *) PUSH y Zero ; POP y q i ; (* JMP q *) (* 7+i *) POP y q p ; (* 8+i *) PUSH x Zero ; POP x q q ]. (* JMP q *)

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 15

slide-46
SLIDE 46

BPCP BSM

Iterate all possible lists of card (indices) Hard code every card as PUSH instructions Given a list of cards, compute top and bottom words in two stacks Check for those two stacks equality

Definition compare_stacks x y i p q := (* i *) [ POP x (4+i) (7+i) ; (* 1+i *) POP y q q ; (* 2+i *) PUSH x Zero ; POP x i i ; (* JMP i *) (* 4+i *) POP y i q ; (* 5+i *) PUSH y Zero ; POP y q i ; (* JMP q *) (* 7+i *) POP y q p ; (* 8+i *) PUSH x Zero ; POP x q q ]. (* JMP q *)

Lemma (Comparing two distinct stacks for identical content)

When x = y, for any stack configuration v, there exists j and w s.t.

(i, compare stacks x y p q i) / / (i, v) ≻∗ (j, w)

where j = p if v[x] = v[y] and j = q otherwise. For any α ∈ {x, y} we have w[α] = v[α].

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 15

slide-47
SLIDE 47

Certified Low-Level Compiler

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 15

slide-48
SLIDE 48

Certified compilation (assumptions)

model X (resp. Y ): language + step semantics a simulation: ⊲ ⊳ : CX → CY → P a certified compiler from model X to model Y

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 16

slide-49
SLIDE 49

Certified compilation (assumptions)

model X (resp. Y ): language + step semantics a simulation: ⊲ ⊳ : CX → CY → P a certified compiler from model X to model Y given a Single Instruction Compiler (SIC):

◮ transforms a single X instructions ◮ into a list of Y instructions ◮ needs a linker remapping PC values

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 16

slide-50
SLIDE 50

Certified compilation (assumptions)

model X (resp. Y ): language + step semantics a simulation: ⊲ ⊳ : CX → CY → P a certified compiler from model X to model Y given a Single Instruction Compiler (SIC):

◮ transforms a single X instructions ◮ into a list of Y instructions ◮ needs a linker remapping PC values

with the following assumptions:

◮ X has total step sem.; Y has deterministic step sem. ◮ length of SIC compiled instruction does not depend on linker ◮ SIC is sound with respect to ⊲

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 16

slide-51
SLIDE 51

Certified compilation (results)

INPUT: X program P and start target PC value j : N

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 17

slide-52
SLIDE 52

Certified compilation (results)

INPUT: X program P and start target PC value j : N OUTPUT: a linker lnk and Y program Q

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 17

slide-53
SLIDE 53

Certified compilation (results)

INPUT: X program P and start target PC value j : N OUTPUT: a linker lnk and Y program Q such that j = start Q = lnk(start P); ∀i, out i P → lnk i = end Q;

Lemma (Soundness)

v1 ⊲ ⊳ w1 ∧ P / /X (i1, v1) (i2, v2) → ∃w2, v2 ⊲ ⊳ w2 ∧ Q / /Y (lnk i1, w1) (lnk i2, w2)

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 17

slide-54
SLIDE 54

Certified compilation (results)

INPUT: X program P and start target PC value j : N OUTPUT: a linker lnk and Y program Q such that j = start Q = lnk(start P); ∀i, out i P → lnk i = end Q;

Lemma (Soundness)

v1 ⊲ ⊳ w1 ∧ P / /X (i1, v1) (i2, v2) → ∃w2, v2 ⊲ ⊳ w2 ∧ Q / /Y (lnk i1, w1) (lnk i2, w2)

Lemma (Completeness)

v1 ⊲ ⊳ w1 ∧ Q / /Y (lnk i1, w1) (j2, w2) → ∃ i2 v2, v2 ⊲ ⊳ w2 ∧ P / /X (i1, v1) (i2, v2) ∧ j2 = lnk i2. Completeness essential for non-termination

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 17

slide-55
SLIDE 55

Contribution

PCP BPCP BSM MM eILL ILL

3

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 17

slide-56
SLIDE 56

BSM MM

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 17

slide-57
SLIDE 57

Minsky Machines (N valued register machines)

n registers of value in N for a fixed n state: (PC, v) ∈ N × Nn instructions (with α ∈ [0, n − 1] and p ∈ N) mm instr ::= INC α | DEC α p Step semantics for INC and DEC (pseudo code) INC α : α ← α + 1; PC ← PC + 1 DEC α p : if α = 0 then PC ← p if α > 0 then α ← α − 1; PC ← PC + 1

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 18

slide-58
SLIDE 58

Minsky Machines (N valued register machines)

n registers of value in N for a fixed n state: (PC, v) ∈ N × Nn instructions (with α ∈ [0, n − 1] and p ∈ N) mm instr ::= INC α | DEC α p Step semantics for INC and DEC (pseudo code) INC α : α ← α + 1; PC ← PC + 1 DEC α p : if α = 0 then PC ← p if α > 0 then α ← α − 1; PC ← PC + 1 MM(n, M, v) := (1, M) / / (1, v) (0, 0) (termination at zero)

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 18

slide-59
SLIDE 59

Minsky Machines (N valued register machines)

n registers of value in N for a fixed n state: (PC, v) ∈ N × Nn instructions (with α ∈ [0, n − 1] and p ∈ N) mm instr ::= INC α | DEC α p Step semantics for INC and DEC (pseudo code) INC α : α ← α + 1; PC ← PC + 1 DEC α p : if α = 0 then PC ← p if α > 0 then α ← α − 1; PC ← PC + 1 MM(n, M, v) := (1, M) / / (1, v) (0, 0) (termination at zero)

Example (transfers α to β in 3 instructions, γ0 spare register)

i : DEC α (3 + i) i + 1 : INC β i + 2 : DEC γ0 i

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 18

slide-60
SLIDE 60

BSM MM (simulating stacks)

Simulation ⊲ ⊳ between stacks (L B) and N

◮ stack 100010 simulated by 1 · 010001 ◮ s2n l : N using:

s2n [] := 1 s2n (b :: l) := b + 2 · s2n l

v ⊲ ⊳ w iff for any α, s2n( v[α]) = w[α]

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 19

slide-61
SLIDE 61

BSM MM (simulating stacks)

Simulation ⊲ ⊳ between stacks (L B) and N

◮ stack 100010 simulated by 1 · 010001 ◮ s2n l : N using:

s2n [] := 1 s2n (b :: l) := b + 2 · s2n l

v ⊲ ⊳ w iff for any α, s2n( v[α]) = w[α]

Definition mm_div2 := (* i *) [ DEC src (6+i) ; (* 1+i *) INC rem ; (* 2+i *) DEC src (i+6) ; (* 3+i *) DEC rem (4+i) ; (* 4+i *) INC quo ; (* 5+i *) DEC rem i ].

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 19

slide-62
SLIDE 62

BSM MM (simulating stacks)

Simulation ⊲ ⊳ between stacks (L B) and N

◮ stack 100010 simulated by 1 · 010001 ◮ s2n l : N using:

s2n [] := 1 s2n (b :: l) := b + 2 · s2n l

v ⊲ ⊳ w iff for any α, s2n( v[α]) = w[α]

Definition mm_div2 := (* i *) [ DEC src (6+i) ; (* 1+i *) INC rem ; (* 2+i *) DEC src (i+6) ; (* 3+i *) DEC rem (4+i) ; (* 4+i *) INC quo ; (* 5+i *) DEC rem i ].

Lemma (Euclidian division by 2 of register src)

When quo = rem = src, b ∈ {0, 1} and k ∈ N

  • v[quo] = 0 ∧

v[rem] = 0 ∧ v[src] = b + 2.k → (i, mm div2) / / (i, v) ≻∗ (6 + i, v[src := 0, quo := k, rem := b])

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 19

slide-63
SLIDE 63

BSM MM (simulating instructions)

We implement an instruction compiler (BSM SIC)

◮ simulating PUSH and POP operations ◮ using mm div2, mm mul2, . . . ◮ we need two spare MM registers ◮ n stacks, 2 + n registers

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 20

slide-64
SLIDE 64

BSM MM (simulating instructions)

We implement an instruction compiler (BSM SIC)

◮ simulating PUSH and POP operations ◮ using mm div2, mm mul2, . . . ◮ we need two spare MM registers ◮ n stacks, 2 + n registers

As input for our certified low-level compiler

◮ from (i, P), a n stacks BSM-program ◮ we compute a 2 + n registers MM-program bsm mm ◮ which simulates termination

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 20

slide-65
SLIDE 65

BSM MM (simulating instructions)

We implement an instruction compiler (BSM SIC)

◮ simulating PUSH and POP operations ◮ using mm div2, mm mul2, . . . ◮ we need two spare MM registers ◮ n stacks, 2 + n registers

As input for our certified low-level compiler

◮ from (i, P), a n stacks BSM-program ◮ we compute a 2 + n registers MM-program bsm mm ◮ which simulates termination

Lemma (BSM termination simulated by MM termination)

for any v ∈ Nn, (i, P) / / (i, v) ↓ ↔ (1, bsm mm) / / (1, 0 :: 0 :: w) (0, 0) where w = vec map s2n v

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 20

slide-66
SLIDE 66

Contribution

PCP BPCP BSM MM eILL ILL

4 5

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 20

slide-67
SLIDE 67

MM eILL ILL

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 20

slide-68
SLIDE 68

Intuitionistic Linear Logic

Definition (SILL sequent calculus for the (!, ⊸, &) fragment)

A ⊢ A [id] Γ ⊢ A A, ∆ ⊢ B Γ, ∆ ⊢ B [cut] Γ, A ⊢ B Γ, ! A ⊢ B [!L] ! Γ ⊢ B ! Γ ⊢ ! B [!R] Γ ⊢ B Γ, ! A ⊢ B [w] Γ, ! A, ! A ⊢ B Γ, ! A ⊢ B [c] Γ, A ⊢ C Γ, A & B ⊢ C [&1

L]

Γ, B ⊢ C Γ, A & B ⊢ C [&2

L]

Γ ⊢ A Γ ⊢ B Γ ⊢ A & B [&R] Γ ⊢ A ∆, B ⊢ C Γ, ∆, A ⊸ B ⊢ C [⊸L] Γ, A ⊢ B Γ ⊢ A ⊸ B [⊸R]

ILL(Γ, A) := provable(Γ ⊢ A) the reduction for MM occurs in the eILL sub-fragment

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 21

slide-69
SLIDE 69

Elementary ILL (eILL)

Elementary sequents: ! Σ, g1, . . . , gk ⊢ d (gi, a, b, c, d variables) Σ contains commands:

◮ (a ⊸ b) ⊸ c, correponding to INC ◮ a ⊸ (b ⊸ c), correponding to DEC ◮ (a & b) ⊸ c, correponding to FORK

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 22

slide-70
SLIDE 70

Elementary ILL (eILL)

Elementary sequents: ! Σ, g1, . . . , gk ⊢ d (gi, a, b, c, d variables) Σ contains commands:

◮ (a ⊸ b) ⊸ c, correponding to INC ◮ a ⊸ (b ⊸ c), correponding to DEC ◮ (a & b) ⊸ c, correponding to FORK

Definition (GeILL goal directed rules for eILL)

! Σ, a ⊢ a Ax ! Σ, Γ ⊢ a ! Σ, ∆ ⊢ b ! Σ, Γ, ∆ ⊢ c a ⊸ (b ⊸ c) ∈ Σ ! Σ, a, Γ ⊢ b ! Σ, Γ ⊢ c (a ⊸ b) ⊸ c ∈ Σ ! Σ, Γ ⊢ a ! Σ, Γ ⊢ b ! Σ, Γ ⊢ c (a & b) ⊸ c ∈ Σ

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 22

slide-71
SLIDE 71

Elementary ILL (eILL)

Elementary sequents: ! Σ, g1, . . . , gk ⊢ d (gi, a, b, c, d variables) Σ contains commands:

◮ (a ⊸ b) ⊸ c, correponding to INC ◮ a ⊸ (b ⊸ c), correponding to DEC ◮ (a & b) ⊸ c, correponding to FORK

Definition (GeILL goal directed rules for eILL)

! Σ, a ⊢ a Ax ! Σ, Γ ⊢ a ! Σ, ∆ ⊢ b ! Σ, Γ, ∆ ⊢ c a ⊸ (b ⊸ c) ∈ Σ ! Σ, a, Γ ⊢ b ! Σ, Γ ⊢ c (a ⊸ b) ⊸ c ∈ Σ ! Σ, Γ ⊢ a ! Σ, Γ ⊢ b ! Σ, Γ ⊢ c (a & b) ⊸ c ∈ Σ

Sound and complete w.r.t. SILL for eILL sequents

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 22

slide-72
SLIDE 72

Elementary ILL (eILL)

Elementary sequents: ! Σ, g1, . . . , gk ⊢ d (gi, a, b, c, d variables) Σ contains commands:

◮ (a ⊸ b) ⊸ c, correponding to INC ◮ a ⊸ (b ⊸ c), correponding to DEC ◮ (a & b) ⊸ c, correponding to FORK

Definition (GeILL goal directed rules for eILL)

! Σ, a ⊢ a Ax ! Σ, Γ ⊢ a ! Σ, ∆ ⊢ b ! Σ, Γ, ∆ ⊢ c a ⊸ (b ⊸ c) ∈ Σ ! Σ, a, Γ ⊢ b ! Σ, Γ ⊢ c (a ⊸ b) ⊸ c ∈ Σ ! Σ, Γ ⊢ a ! Σ, Γ ⊢ b ! Σ, Γ ⊢ c (a & b) ⊸ c ∈ Σ

Sound and complete w.r.t. SILL for eILL sequents Trivial Phase Semantics (commutative monoid, closure is identity)

◮ SILL and GeILL sound for TPS

The reduction eILL ILL is the identity map

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 22

slide-73
SLIDE 73

Encoding Minsky machines in eILL

Given M as a list of MM instructions

◮ for every register i ∈ [0, n − 1] in M, two logical variables xi and xi ◮ for every position/state (PC = i) in M, a variable qi

{x0, . . . , xn−1} ⊎ {x0, . . . , xn−1} ⊎ {q0, q1, . . .}

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 23

slide-74
SLIDE 74

Encoding Minsky machines in eILL

Given M as a list of MM instructions

◮ for every register i ∈ [0, n − 1] in M, two logical variables xi and xi ◮ for every position/state (PC = i) in M, a variable qi

{x0, . . . , xn−1} ⊎ {x0, . . . , xn−1} ⊎ {q0, q1, . . .} a computation M / / (i, v) (0, 0) is represented by ! ΣM; ∆

v ⊢ qi

◮ where if

v = (p0, . . . , pn−1) then ∆

v = p0.x0, . . . , pn−1.xn−1

◮ the commands in ΣM are determined by instructions in M

ΣM = {(q0 ⊸ q0) ⊸ q0} ∪ {xβ ⊸ (xα ⊸ xα), (xα ⊸ xα) ⊸ xα | α = β ∈ [0, n − 1]} ∪ {(xα ⊸ qi+1) ⊸ qi | i : INC α ∈ M} ∪ {(xα & qj) ⊸ qi, xα ⊸ (qi+1 ⊸ qi) | i : DEC α j ∈ M}

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 23

slide-75
SLIDE 75

Encoding Minsky machines in eILL

Given M as a list of MM instructions

◮ for every register i ∈ [0, n − 1] in M, two logical variables xi and xi ◮ for every position/state (PC = i) in M, a variable qi

{x0, . . . , xn−1} ⊎ {x0, . . . , xn−1} ⊎ {q0, q1, . . .} a computation M / / (i, v) (0, 0) is represented by ! ΣM; ∆

v ⊢ qi

◮ where if

v = (p0, . . . , pn−1) then ∆

v = p0.x0, . . . , pn−1.xn−1

◮ the commands in ΣM are determined by instructions in M

ΣM = {(q0 ⊸ q0) ⊸ q0} ∪ {xβ ⊸ (xα ⊸ xα), (xα ⊸ xα) ⊸ xα | α = β ∈ [0, n − 1]} ∪ {(xα ⊸ qi+1) ⊸ qi | i : INC α ∈ M} ∪ {(xα & qj) ⊸ qi, xα ⊸ (qi+1 ⊸ qi) | i : DEC α j ∈ M}

Theorem (Simulating MM termination at zero with GeILL entailment)

M / / (i, v) (0, 0) ↔ ! ΣM, ∆

v ⊢ qi

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 23

slide-76
SLIDE 76

Encoding Minsky machines in eILL

Given M as a list of MM instructions

◮ for every register i ∈ [0, n − 1] in M, two logical variables xi and xi ◮ for every position/state (PC = i) in M, a variable qi

{x0, . . . , xn−1} ⊎ {x0, . . . , xn−1} ⊎ {q0, q1, . . .} a computation M / / (i, v) (0, 0) is represented by ! ΣM; ∆

v ⊢ qi

◮ where if

v = (p0, . . . , pn−1) then ∆

v = p0.x0, . . . , pn−1.xn−1

◮ the commands in ΣM are determined by instructions in M

ΣM = {(q0 ⊸ q0) ⊸ q0} ∪ {xβ ⊸ (xα ⊸ xα), (xα ⊸ xα) ⊸ xα | α = β ∈ [0, n − 1]} ∪ {(xα ⊸ qi+1) ⊸ qi | i : INC α ∈ M} ∪ {(xα & qj) ⊸ qi, xα ⊸ (qi+1 ⊸ qi) | i : DEC α j ∈ M}

Theorem (Simulating MM termination at zero with GeILL entailment)

M / / (i, v) (0, 0) ↔ ! ΣM, ∆

v ⊢ qi

Hence the reduction MM eILL

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 23

slide-77
SLIDE 77

MM to eILL, (continued)

Increment: i : INC x ∈ M x ← x + 1 PC ← i + 1 . . . ! Σ, x, ∆ ⊢ qi+1 ((x ⊸ qi+1) ⊸ qi ∈ Σ) ! Σ, ∆ ⊢ qi

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 24

slide-78
SLIDE 78

MM to eILL, (continued)

Decrement i : DEC x j ∈ M if x = 0 then PC ← j else x ← x − 1; PC ← i + 1 corresponds to two proofs x > 0 and x = 0: (Ax) ! Σ, x ⊢ x . . . ! Σ, ∆ ⊢ qi+1 (x ⊸ (qi+1 ⊸ qi) ∈ Σ) ! Σ, x, ∆ ⊢ qi . . . (x ∈ ∆) ! Σ, ∆ ⊢ x . . . ! Σ, ∆ ⊢ qj ((x & qj) ⊸ qi ∈ Σ) ! Σ, ∆ ⊢ qi

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 25

slide-79
SLIDE 79

Zero test x ∈ ∆ in eILL

! Σ; ∆ ⊢ x provable iff x ∈ ∆ Proof for y, ∆ with y = x: (Ax) ! Σ, y ⊢ y . . . ! Σ, ∆ ⊢ x (y ⊸ (x ⊸ x) ∈ Σ) ! Σ, y, ∆ ⊢ x Proof for empty context ∆ = ∅: (Ax) ! Σ, x ⊢ x ((x ⊸ x) ⊸ x ∈ Σ) ! Σ, ∅ ⊢ x

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 26

slide-80
SLIDE 80

Full reduction

Theorem

M : (i, v) − →∗ (0, 0) ⇒ ! ΣM, ∆

v ⊢ qi

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 27

slide-81
SLIDE 81

Full reduction

Theorem

M : (i, v) − →∗ (0, 0) ⇒ ! ΣM, ∆

v ⊢ qi

  • ther direction by soundness of TPS ([[A]] : Nn → P):

[[x]] v ⇐ ⇒ v = 1.x (i.e. vy = δx,y) [[x]] v ⇐ ⇒ vx = 0 [[qi]] v ⇐ ⇒ M : (i, v) − →∗ (0, 0)

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 27

slide-82
SLIDE 82

Wrap-up of this chain of reduction

Reductions: PCP to BPCP: trivial binary encoding BPCP to BSM: verified exhaustive search BSM to MM: certified compiler between low-level languages MM to eILL: elegant encoding of computational model in logics eILL to ILL: faithfull embedding

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 28

slide-83
SLIDE 83

Wrap-up of this chain of reduction

Reductions: PCP to BPCP: trivial binary encoding BPCP to BSM: verified exhaustive search BSM to MM: certified compiler between low-level languages MM to eILL: elegant encoding of computational model in logics eILL to ILL: faithfull embedding Low verification overhead

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 28

slide-84
SLIDE 84

Wrap-up of this chain of reduction

Reductions: PCP to BPCP: trivial binary encoding BPCP to BSM: verified exhaustive search BSM to MM: certified compiler between low-level languages MM to eILL: elegant encoding of computational model in logics eILL to ILL: faithfull embedding Low verification overhead

(compared to detailed paper proofs)

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 28

slide-85
SLIDE 85

A library of undecidable problems in Coq

H10C H10 µ rec. DIO SINGLE sTM MM DIO ELEM SR BSM DIO LOGIC MPCP MM0 FRACTRAN PCP MM2 FOL ILL

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 29

slide-86
SLIDE 86

A library of undecidable problems in Coq

2oUnif WCBV H10C H10 mTM µ rec. DIO SINGLE sTM MM DIO ELEM SR BSM DIO LOGIC 3oUnif MPCP MM0 FRACTRAN PCP MM2 FOL ILL

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 29

slide-87
SLIDE 87

A library of undecidable problems in Coq

2oUnif WCBV H10C H10 Γ ⊢F ? : A Γ ⊢∩? : A mTM µ rec. DIO SINGLE SSTS sTM MM DIO ELEM Tiling SR BSM DIO LOGIC 3oUnif MPCP MM0 FRACTRAN Tag systems PCP MM2 Sys F sub. FOL ILL MELL3

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 29

slide-88
SLIDE 88

Papers

Hilbert’s Tenth Problem in Coq. Dominique Larchey-Wendling and Yannick Forster. Technical report (2019). Certified Undecidability of Intuitionistic Linear Logic via Binary Stack Machines and Minsky Machines. Yannick Forster and Dominique Larchey-Wendling. CPP ’19. On Synthetic Undecidability in Coq, with an Application to the

  • Entscheidungsproblem. Yannick Forster, Dominik Kirst, and Gert
  • Smolka. CPP ’19.

Verification of PCP-Related Computational Reductions in Coq. Yannick Forster, Edith Heiter, and Gert Smolka. ITP 2018. Call-by-Value Lambda Calculus as a Model of Computation in Coq. Yannick Forster and Gert Smolka. Journal of Automated Reasoning (2018)

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 30

slide-89
SLIDE 89

Conclusion

More future work: Realisability model of the calculus of inductive constructions witnessing (the propositional version) of excluded middle Automated translation of Coq function definitions into a concrete model of computation (e.g. call-by-value lambda calculus)

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 31

slide-90
SLIDE 90

Conclusion

More future work: Realisability model of the calculus of inductive constructions witnessing (the propositional version) of excluded middle Automated translation of Coq function definitions into a concrete model of computation (e.g. call-by-value lambda calculus) A constructive library of undecidable problems Exemplary undecidability proof for provability in linear logic Enabling loads of future work. Attach your own undecidable problems!

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 31

slide-91
SLIDE 91

Conclusion

More future work: Realisability model of the calculus of inductive constructions witnessing (the propositional version) of excluded middle Automated translation of Coq function definitions into a concrete model of computation (e.g. call-by-value lambda calculus) A constructive library of undecidable problems Exemplary undecidability proof for provability in linear logic Enabling loads of future work. Attach your own undecidable problems! https://github.com/uds-psl/coq-library-undecidability

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 31

slide-92
SLIDE 92

Conclusion

More future work: Realisability model of the calculus of inductive constructions witnessing (the propositional version) of excluded middle Automated translation of Coq function definitions into a concrete model of computation (e.g. call-by-value lambda calculus) A constructive library of undecidable problems Exemplary undecidability proof for provability in linear logic Enabling loads of future work. Attach your own undecidable problems! https://github.com/uds-psl/coq-library-undecidability

Questions?

  • Y. Forster and D. Larchey-Wendling

Coq library of undecidability MLA 2019 – Mar 13 31