Minimal logic for computable functionals Helmut Schwichtenberg - - PowerPoint PPT Presentation

minimal logic for computable functionals
SMART_READER_LITE
LIVE PREVIEW

Minimal logic for computable functionals Helmut Schwichtenberg - - PowerPoint PPT Presentation

Minimal logic for computable functionals Helmut Schwichtenberg Mathematisches Institut der Universit at M unchen Motivation Proof carrying code (Lee, Necula) Why? Proofs are machine checkable (easily) Need: code carrying proofs


slide-1
SLIDE 1

Minimal logic for computable functionals

Helmut Schwichtenberg

Mathematisches Institut der Universit¨ at M¨ unchen

slide-2
SLIDE 2

Motivation

Proof carrying code (Lee, Necula) Why? Proofs are machine checkable (easily) Need: “code carrying proofs” Prospects:

◮ Mathematics as a numerical language (Bishop) ◮ Program development by proof transformation (adapt to

special situations, computed function can change)

◮ Unexpected algorithms in classical proofs

Here: Unexpected algorithms even in (clever) constructive proofs: existence of normal forms in typed lambda calculus, using computability predicates (a.k.a. logical relations). Needed for a proper treatment: computability in higer types based

  • n the Scott-Ershov partial continuous functionals
slide-3
SLIDE 3

Motivation

Proof carrying code (Lee, Necula) Why? Proofs are machine checkable (easily) Need: “code carrying proofs” Prospects:

◮ Mathematics as a numerical language (Bishop) ◮ Program development by proof transformation (adapt to

special situations, computed function can change)

◮ Unexpected algorithms in classical proofs

Here: Unexpected algorithms even in (clever) constructive proofs: existence of normal forms in typed lambda calculus, using computability predicates (a.k.a. logical relations). Needed for a proper treatment: computability in higer types based

  • n the Scott-Ershov partial continuous functionals
slide-4
SLIDE 4

Motivation

Proof carrying code (Lee, Necula) Why? Proofs are machine checkable (easily) Need: “code carrying proofs” Prospects:

◮ Mathematics as a numerical language (Bishop) ◮ Program development by proof transformation (adapt to

special situations, computed function can change)

◮ Unexpected algorithms in classical proofs

Here: Unexpected algorithms even in (clever) constructive proofs: existence of normal forms in typed lambda calculus, using computability predicates (a.k.a. logical relations). Needed for a proper treatment: computability in higer types based

  • n the Scott-Ershov partial continuous functionals
slide-5
SLIDE 5

Motivation

Proof carrying code (Lee, Necula) Why? Proofs are machine checkable (easily) Need: “code carrying proofs” Prospects:

◮ Mathematics as a numerical language (Bishop) ◮ Program development by proof transformation (adapt to

special situations, computed function can change)

◮ Unexpected algorithms in classical proofs

Here: Unexpected algorithms even in (clever) constructive proofs: existence of normal forms in typed lambda calculus, using computability predicates (a.k.a. logical relations). Needed for a proper treatment: computability in higer types based

  • n the Scott-Ershov partial continuous functionals
slide-6
SLIDE 6

Formulas and their types

Formulas: P( r ) | A ∧ B | A → B | ∀xρA | ∃xρA. τ(A) := type of the program to be extracted from a proof of A, or := ε if A has no “computational content” (e.g. ∀n f (n) = 0). τ(P( r )) := ε (P a predicate constant) τ(∃xρA) :=

  • ρ

if τ(A) = ε ρ × τ(A)

  • therwise

τ(∀xρA) :=

  • ε

if τ(A) = ε ρ ⇒ τ(A)

  • therwise

τ(A0 ∧ A1) :=

  • τ(Ai)

if τ(A1−i) = ε τ(A0) × τ(A1)

  • therwise

τ(A → B) :=      τ(B) if τ(A) = ε ε if τ(B) = ε τ(A) ⇒ τ(B)

  • therwise
slide-7
SLIDE 7

Computational content of a proof

[ [M] ]: τ(A), for M : A derivation (natural deduction style, written as a λ-term), and τ(A) = ε. [ [uA] ] := xτ(A)

u

(xτ(A)

u

uniquely associated with uA) [ [λuAM] ] :=

  • [

[M] ] if τ(A) = ε λxτ(A)

u

[ [M] ]

  • therwise

[ [MA→BN] ] :=

  • [

[M] ] if τ(A) = ε [ [M] ][ [N] ]

  • therwise

[ [(λxρM)∀xA] ] := λxρ[ [M] ] [ [M∀xAr] ] := [ [M] ]r. [ [MA0

0 , MA1 1 ]

] and [ [MA0∧A1i] ] are define in a similar way. Also: extracted terms for induction, cases, ∃-axioms. For M : A where τ(A) = ε let [ [M] ] := ε (new symbol).

slide-8
SLIDE 8

Realizability

r mr A, where r is a term of type τ(A) (or = ε). ε mr P( r ) = P( r ), r mr (∃xA) =

  • ε mr Ax[r]

if τ(A) = ε r1 mr Ax[r0]

  • therwise

r mr (∀xA) =

  • ∀x.ε mr A

if τ(A) = ε ∀x.rx mr A

  • therwise

r mr (A→B) =      ε mr A → r mr B if τ(A) = ε ∀x.x mr A → ε mr B if τ(A)=ε= τ(B) ∀x.x mr A → rx mr B

  • therwise

r mr (A0∧A1) =      ε mr A0 ∧ r mr A1 if τ(A0) = ε r mr A0 ∧ ε mr A1 if τ(A1) = ε r0 mr A0 ∧ r1 mr A1

  • therwise
slide-9
SLIDE 9

Soundness

Let xu := ε if uA is an assumption variable with τ(A) = ε.

Theorem

If M is a derivation of a formula B, then there is a derivation µ(M) of [ [M] ] mr B from assumptions { xu mr C | uC ∈ FA(M) }.

Proof.

Induction on M.

slide-10
SLIDE 10

Quantifiers without computational content

Problem: Redundant variables in extracted terms. Cure (Berger 1993): Add formulas ∀ncxA | ∃ncxA, with τ(∃ncxρA) := τ(A), τ(∀ncxρA) := τ(A). For ∃nc: existence introduction and elimination axioms: (∃nc)+

x,B :

∀ncx.B → ∃ncxB (∃nc)−

x,A,B : ∃ncxA → (∀ncx.A → B) → B

with x / ∈ FV(B) Uniformity axiom: ∀ncx∃yA → ∃y∀ncxA. Can define “nc-correct proof”, w.r.t. “computational variables”.

slide-11
SLIDE 11

Information systems

Let A and B be information systems. Then the objects u of A → B are in bijective correspondence with the continuous functions f from |A| to |B|:

◮ For u : A → B define |u|: |A| → |B| by

|u|(z) := { b ∈ B | u(X, b) for some X ⊆fin z }.

◮ For f : |A| → |B| define ˆ

f : A → B by ˆ f (X, b) := b ∈ f (X). Moreover, f = |ˆ f | and u = |u|.

slide-12
SLIDE 12

A universal information system

Cι := N → Λ Cρ⇒σ := Cρ → Cσ Cω :=

  • ρ

Cρ Have injections and projections inρ : |Cρ| → |Cω|, in−1

ρ : |Cω| → |Cρ|.

Every a ∈ |Cω| has the form inρ(u) for some u ∈ |Cρ|,

  • r else is ∅.

Call { inρ(u) | u ∈ |Cρ| } the ρ-part of |Cω|. Let Pρ(a) mean that a is in the ρ-part of |Cω|.

slide-13
SLIDE 13

Administrative functions: ModIota, HatIota

Define ModIota: |Cω| → |N| → |Λ| by ModIota

  • inι(u)
  • := |u|

ModIota

  • inτ(u)
  • (k) := ∅ for τ = ι, ModIota
  • (k) := ∅.

For g : |N| → |Λ| we have ˆ g ∈ |N → Λ| = |Cι|, hence inι(ˆ g) ∈ |Cω|. Define HatIota:

  • |N| → |Λ|
  • → |Cω| by

HatIota(g) := inι(ˆ g). for g : |N| → |Λ|, and := ∅ else. Then ModIota(HatIota(g)) = g.

slide-14
SLIDE 14

Administrative functions: Mod, Hatρ,σ

Define Mod: |Cω| → |Cω| → |Cω| by Mod

  • inρ⇒σ(u)
  • := inσ ◦ |u| ◦ in−1

ρ ,

Mod

  • inτ(u)
  • (a) := ∅ for τ not of arrow form, and

Mod

  • (a) := ∅.

Define Hatρ,σ :

  • |Cω| → |Cω|
  • → |Cω| by

Hatρ,σ(h) := inρ⇒σ(ˆ f ) for f := in−1

σ

  • h ◦ inρ : |Cρ| → |Cσ|. Then

Mod(Hatρ,σ(h)) = inσ ◦ in−1

σ

  • h ◦ inρ ◦ in−1

ρ .

slide-15
SLIDE 15

β-reduction, η-expansion

(λxr)s → rx[s] β-conversion, r → λx. rx η-expansion (x / ∈ FV(r)).

Definition

r is in β-normal form if no (inner) β-conversion is possible.

Definition

Let r be in β-normal form. r is in η-long normal form if no (inner) η-expansion is possible without creating a new β-convertible subterm.

slide-16
SLIDE 16

β-reduction, η-expansion

(λxr)s → rx[s] β-conversion, r → λx. rx η-expansion (x / ∈ FV(r)).

Definition

r is in β-normal form if no (inner) β-conversion is possible.

Definition

Let r be in β-normal form. r is in η-long normal form if no (inner) η-expansion is possible without creating a new β-convertible subterm.

slide-17
SLIDE 17

β-reduction, η-expansion

(λxr)s → rx[s] β-conversion, r → λx. rx η-expansion (x / ∈ FV(r)).

Definition

r is in β-normal form if no (inner) β-conversion is possible.

Definition

Let r be in β-normal form. r is in η-long normal form if no (inner) η-expansion is possible without creating a new β-convertible subterm.

slide-18
SLIDE 18

Long normal forms

Terms in long normal form (i.e. normal w.r.t. β-reduction and η-expansion) are inductively defined by λxr | (xr1 . . . rn)ι.

Definition

Let r be in β-normal form. With lnf(r) we denote the result of maximally η-expanding r.

slide-19
SLIDE 19

Long normal forms

Terms in long normal form (i.e. normal w.r.t. β-reduction and η-expansion) are inductively defined by λxr | (xr1 . . . rn)ι.

Definition

Let r be in β-normal form. With lnf(r) we denote the result of maximally η-expanding r.

slide-20
SLIDE 20

Predicates

N(r, s) :⇔ for some term t, r → · · · → t β-normal, and lnf(t)=s A(r, s) :⇔ r = xr1 . . . rn and s = xs1 . . . sn with N(ri, si) for i = 1, . . . , n H(r, s) :⇔ r = (λx.t)u t and s = tx[u] t F(r, k) :⇔ every index of a variable free in r is < k Abbreviations: FN(r) := ∀k.F(r, k) → ∃s N(r, s), FA(r) := ∀k.F(r, k) → ∃s A(r, s).

slide-21
SLIDE 21

Predicates

N(r, s) :⇔ for some term t, r → · · · → t β-normal, and lnf(t)=s A(r, s) :⇔ r = xr1 . . . rn and s = xs1 . . . sn with N(ri, si) for i = 1, . . . , n H(r, s) :⇔ r = (λx.t)u t and s = tx[u] t F(r, k) :⇔ every index of a variable free in r is < k Abbreviations: FN(r) := ∀k.F(r, k) → ∃s N(r, s), FA(r) := ∀k.F(r, k) → ∃s A(r, s).

slide-22
SLIDE 22

Computability predicates

C ι(r) := FNι(r), C ρ⇒σ(r) := ∀ncs.C ρ(s) → C σ(rs). C ρ(r) must have computational content (because FN has). We will later make it explicit. We freely use properties of N, A, H, F as axioms, provided they have no computational content.

Example

(Ax1): F(r, k) → Nσ(rx, s) → Nρ⇒σ(r, λxρs).

slide-23
SLIDE 23

Computability predicates

C ι(r) := FNι(r), C ρ⇒σ(r) := ∀ncs.C ρ(s) → C σ(rs). C ρ(r) must have computational content (because FN has). We will later make it explicit. We freely use properties of N, A, H, F as axioms, provided they have no computational content.

Example

(Ax1): F(r, k) → Nσ(rx, s) → Nρ⇒σ(r, λxρs).

slide-24
SLIDE 24

Computability predicates

C ι(r) := FNι(r), C ρ⇒σ(r) := ∀ncs.C ρ(s) → C σ(rs). C ρ(r) must have computational content (because FN has). We will later make it explicit. We freely use properties of N, A, H, F as axioms, provided they have no computational content.

Example

(Ax1): F(r, k) → Nσ(rx, s) → Nρ⇒σ(r, λxρs).

slide-25
SLIDE 25

Computability predicates

C ι(r) := FNι(r), C ρ⇒σ(r) := ∀ncs.C ρ(s) → C σ(rs). C ρ(r) must have computational content (because FN has). We will later make it explicit. We freely use properties of N, A, H, F as axioms, provided they have no computational content.

Example

(Ax1): F(r, k) → Nσ(rx, s) → Nρ⇒σ(r, λxρs).

slide-26
SLIDE 26

Existence of normal forms

Lemma 1: (a) C ρ(r) → FNρ(r), (b) FAρ(r) → C ρ(r) Lemma 2: C ρ(r′) → H(r, r′) → C ρ(r) Lemma 3:

  • C

ρ(

s ) → C ρ(r[ s ]) NTheorem: ∃s Nρ(r, s)

slide-27
SLIDE 27

Existence of normal forms

Lemma 1: (a) C ρ(r) → FNρ(r), (b) FAρ(r) → C ρ(r) Lemma 2: C ρ(r′) → H(r, r′) → C ρ(r) Lemma 3:

  • C

ρ(

s ) → C ρ(r[ s ]) NTheorem: ∃s Nρ(r, s)

slide-28
SLIDE 28

Existence of normal forms

Lemma 1: (a) C ρ(r) → FNρ(r), (b) FAρ(r) → C ρ(r) Lemma 2: C ρ(r′) → H(r, r′) → C ρ(r) Lemma 3:

  • C

ρ(

s ) → C ρ(r[ s ]) NTheorem: ∃s Nρ(r, s)

slide-29
SLIDE 29

Predicates

In our formalization, N, A and H are inductively defined by BetaNf(r, t) → EtaExpρ

  • ρ(t, s) → Nρ
  • ρ(r, s),

AVar: ( ρ ⊢ xk : ρ) → Aρ

  • ρ(xk, xk)

(writing xk for k), AApp: Aρ⇒σ

  • ρ

(r, r1) → ( ρ ⊢ s : ρ) → Nρ

  • ρ(s, s1) → Aσ
  • ρ(rs, r1s1),

H

  • (λρr)[

s ]s, r[s, s ]

  • .

Abbreviations: F ρ

  • ρ (r, k) := (

ρ ⊢ r : ρ) ∧ Lh( ρ ) ≤ k, FNρ

  • ρ(r) := ∀k.F ρ
  • ρ (r, k) → ∃s Nρ
  • ρ(r, s),

FAρ

  • ρ(r) := ∀k.F ρ
  • ρ (r, k) → ∃s Aρ
  • ρ(r, s),
slide-30
SLIDE 30

Predicates

In our formalization, N, A and H are inductively defined by BetaNf(r, t) → EtaExpρ

  • ρ(t, s) → Nρ
  • ρ(r, s),

AVar: ( ρ ⊢ xk : ρ) → Aρ

  • ρ(xk, xk)

(writing xk for k), AApp: Aρ⇒σ

  • ρ

(r, r1) → ( ρ ⊢ s : ρ) → Nρ

  • ρ(s, s1) → Aσ
  • ρ(rs, r1s1),

H

  • (λρr)[

s ]s, r[s, s ]

  • .

Abbreviations: F ρ

  • ρ (r, k) := (

ρ ⊢ r : ρ) ∧ Lh( ρ ) ≤ k, FNρ

  • ρ(r) := ∀k.F ρ
  • ρ (r, k) → ∃s Nρ
  • ρ(r, s),

FAρ

  • ρ(r) := ∀k.F ρ
  • ρ (r, k) → ∃s Aρ
  • ρ(r, s),
slide-31
SLIDE 31

Axioms

Usual logical axioms, and induction axioms for the free algebras involved (boole, nat, type, term). Write xk for k, and λxρ

k r for

λρr[1, . . . , k, 0].

  • Ax1. F ρ⇒σ
  • ρ

(r, k) → Nσ

  • ρ,e(

ρ,k,ρ)(rxk, s) → Nρ⇒σ

  • ρ

(r, λxρ

k s).

  • Ax2. Aι
  • ρ(r, s) → Nι
  • ρ(r, s).
  • Ax3. H(r, s) → Nρ
  • ρ(s, t) → Nρ
  • ρ(r, t).
  • Ax4. H(r, s) → H(rt, st).
slide-32
SLIDE 32

Axioms

Usual logical axioms, and induction axioms for the free algebras involved (boole, nat, type, term). Write xk for k, and λxρ

k r for

λρr[1, . . . , k, 0].

  • Ax1. F ρ⇒σ
  • ρ

(r, k) → Nσ

  • ρ,e(

ρ,k,ρ)(rxk, s) → Nρ⇒σ

  • ρ

(r, λxρ

k s).

  • Ax2. Aι
  • ρ(r, s) → Nι
  • ρ(r, s).
  • Ax3. H(r, s) → Nρ
  • ρ(s, t) → Nρ
  • ρ(r, t).
  • Ax4. H(r, s) → H(rt, st).
slide-33
SLIDE 33

Axioms

Usual logical axioms, and induction axioms for the free algebras involved (boole, nat, type, term). Write xk for k, and λxρ

k r for

λρr[1, . . . , k, 0].

  • Ax1. F ρ⇒σ
  • ρ

(r, k) → Nσ

  • ρ,e(

ρ,k,ρ)(rxk, s) → Nρ⇒σ

  • ρ

(r, λxρ

k s).

  • Ax2. Aι
  • ρ(r, s) → Nι
  • ρ(r, s).
  • Ax3. H(r, s) → Nρ
  • ρ(s, t) → Nρ
  • ρ(r, t).
  • Ax4. H(r, s) → H(rt, st).
slide-34
SLIDE 34

Axioms

Usual logical axioms, and induction axioms for the free algebras involved (boole, nat, type, term). Write xk for k, and λxρ

k r for

λρr[1, . . . , k, 0].

  • Ax1. F ρ⇒σ
  • ρ

(r, k) → Nσ

  • ρ,e(

ρ,k,ρ)(rxk, s) → Nρ⇒σ

  • ρ

(r, λxρ

k s).

  • Ax2. Aι
  • ρ(r, s) → Nι
  • ρ(r, s).
  • Ax3. H(r, s) → Nρ
  • ρ(s, t) → Nρ
  • ρ(r, t).
  • Ax4. H(r, s) → H(rt, st).
slide-35
SLIDE 35

Axioms

Usual logical axioms, and induction axioms for the free algebras involved (boole, nat, type, term). Write xk for k, and λxρ

k r for

λρr[1, . . . , k, 0].

  • Ax1. F ρ⇒σ
  • ρ

(r, k) → Nσ

  • ρ,e(

ρ,k,ρ)(rxk, s) → Nρ⇒σ

  • ρ

(r, λxρ

k s).

  • Ax2. Aι
  • ρ(r, s) → Nι
  • ρ(r, s).
  • Ax3. H(r, s) → Nρ
  • ρ(s, t) → Nρ
  • ρ(r, t).
  • Ax4. H(r, s) → H(rt, st).
slide-36
SLIDE 36

Axioms

Usual logical axioms, and induction axioms for the free algebras involved (boole, nat, type, term). Write xk for k, and λxρ

k r for

λρr[1, . . . , k, 0].

  • Ax1. F ρ⇒σ
  • ρ

(r, k) → Nσ

  • ρ,e(

ρ,k,ρ)(rxk, s) → Nρ⇒σ

  • ρ

(r, λxρ

k s).

  • Ax2. Aι
  • ρ(r, s) → Nι
  • ρ(r, s).
  • Ax3. H(r, s) → Nρ
  • ρ(s, t) → Nρ
  • ρ(r, t).
  • Ax4. H(r, s) → H(rt, st).
slide-37
SLIDE 37

Computability predicates with explicit realizers

¯ C ι

  • ρ(a, r)

:= ( ρ ⊢ r : ι) ∧ Pι(a) ∧ ∀k.F ι

  • ρ(r, k) → Nι
  • ρ(r, ModIota(a, k)),

¯ C ρ⇒σ

  • ρ

(a, r) := ( ρ ⊢ r : ρ ⇒ σ) ∧ Pρ⇒σ(a) ∧ ∀ σ, b, s.¯ C ρ

  • ρ,

σ(b, s) → ¯

C σ

  • ρ,

σ(Mod(a, b), rs).

¯ C ρ

  • ρ (a, r) has no computational content (because N hasn’t).

Then define the computability predicates by C ρ

  • ρ (r) := ∃a ¯

C ρ

  • ρ (a, r),

and prove (the ∀nc-closures of) their properties above.

slide-38
SLIDE 38

Computability predicates with explicit realizers

¯ C ι

  • ρ(a, r)

:= ( ρ ⊢ r : ι) ∧ Pι(a) ∧ ∀k.F ι

  • ρ(r, k) → Nι
  • ρ(r, ModIota(a, k)),

¯ C ρ⇒σ

  • ρ

(a, r) := ( ρ ⊢ r : ρ ⇒ σ) ∧ Pρ⇒σ(a) ∧ ∀ σ, b, s.¯ C ρ

  • ρ,

σ(b, s) → ¯

C σ

  • ρ,

σ(Mod(a, b), rs).

¯ C ρ

  • ρ (a, r) has no computational content (because N hasn’t).

Then define the computability predicates by C ρ

  • ρ (r) := ∃a ¯

C ρ

  • ρ (a, r),

and prove (the ∀nc-closures of) their properties above.

slide-39
SLIDE 39

Computability predicates with explicit realizers

¯ C ι

  • ρ(a, r)

:= ( ρ ⊢ r : ι) ∧ Pι(a) ∧ ∀k.F ι

  • ρ(r, k) → Nι
  • ρ(r, ModIota(a, k)),

¯ C ρ⇒σ

  • ρ

(a, r) := ( ρ ⊢ r : ρ ⇒ σ) ∧ Pρ⇒σ(a) ∧ ∀ σ, b, s.¯ C ρ

  • ρ,

σ(b, s) → ¯

C σ

  • ρ,

σ(Mod(a, b), rs).

¯ C ρ

  • ρ (a, r) has no computational content (because N hasn’t).

Then define the computability predicates by C ρ

  • ρ (r) := ∃a ¯

C ρ

  • ρ (a, r),

and prove (the ∀nc-closures of) their properties above.

slide-40
SLIDE 40

Computability predicates

Lemma

C ι

  • ρ(r)

:= ( ρ ⊢ r : ι) ∧ FNι

  • ρ(r),

C ρ⇒σ

  • ρ

(r) := ( ρ ⊢ r : ρ ⇒ σ) ∧ ∀ncs, σ.C ρ

  • ρ,

σ(s) → C σ

  • ρ,

σ(rs).

The proof uses (AC) ∀x∃y A(x, y) → ∃f ∀x A(x, f (x)) (A(x, y) arbitrary), (IP) (A → ∃x B(x)) → ∃x.A → B(x), where τ(A) = ε, (UNC) ∀ncx∃yA(x, y) → ∃y∀ncxA(x, y), which are realized by identity functions.

slide-41
SLIDE 41

Computability predicates

Lemma

C ι

  • ρ(r)

:= ( ρ ⊢ r : ι) ∧ FNι

  • ρ(r),

C ρ⇒σ

  • ρ

(r) := ( ρ ⊢ r : ρ ⇒ σ) ∧ ∀ncs, σ.C ρ

  • ρ,

σ(s) → C σ

  • ρ,

σ(rs).

The proof uses (AC) ∀x∃y A(x, y) → ∃f ∀x A(x, f (x)) (A(x, y) arbitrary), (IP) (A → ∃x B(x)) → ∃x.A → B(x), where τ(A) = ε, (UNC) ∀ncx∃yA(x, y) → ∃y∀ncxA(x, y), which are realized by identity functions.

slide-42
SLIDE 42

Computability predicates

Lemma

C ι

  • ρ(r)

:= ( ρ ⊢ r : ι) ∧ FNι

  • ρ(r),

C ρ⇒σ

  • ρ

(r) := ( ρ ⊢ r : ρ ⇒ σ) ∧ ∀ncs, σ.C ρ

  • ρ,

σ(s) → C σ

  • ρ,

σ(rs).

The proof uses (AC) ∀x∃y A(x, y) → ∃f ∀x A(x, f (x)) (A(x, y) arbitrary), (IP) (A → ∃x B(x)) → ∃x.A → B(x), where τ(A) = ε, (UNC) ∀ncx∃yA(x, y) → ∃y∀ncxA(x, y), which are realized by identity functions.

slide-43
SLIDE 43

Computability predicates

Lemma

C ι

  • ρ(r)

:= ( ρ ⊢ r : ι) ∧ FNι

  • ρ(r),

C ρ⇒σ

  • ρ

(r) := ( ρ ⊢ r : ρ ⇒ σ) ∧ ∀ncs, σ.C ρ

  • ρ,

σ(s) → C σ

  • ρ,

σ(rs).

The proof uses (AC) ∀x∃y A(x, y) → ∃f ∀x A(x, f (x)) (A(x, y) arbitrary), (IP) (A → ∃x B(x)) → ∃x.A → B(x), where τ(A) = ε, (UNC) ∀ncx∃yA(x, y) → ∃y∀ncxA(x, y), which are realized by identity functions.

slide-44
SLIDE 44

Computability predicates

Lemma

C ι

  • ρ(r)

:= ( ρ ⊢ r : ι) ∧ FNι

  • ρ(r),

C ρ⇒σ

  • ρ

(r) := ( ρ ⊢ r : ρ ⇒ σ) ∧ ∀ncs, σ.C ρ

  • ρ,

σ(s) → C σ

  • ρ,

σ(rs).

The proof uses (AC) ∀x∃y A(x, y) → ∃f ∀x A(x, f (x)) (A(x, y) arbitrary), (IP) (A → ∃x B(x)) → ∃x.A → B(x), where τ(A) = ε, (UNC) ∀ncx∃yA(x, y) → ∃y∀ncxA(x, y), which are realized by identity functions.

slide-45
SLIDE 45

Computability predicates

Lemma

C ι

  • ρ(r)

:= ( ρ ⊢ r : ι) ∧ FNι

  • ρ(r),

C ρ⇒σ

  • ρ

(r) := ( ρ ⊢ r : ρ ⇒ σ) ∧ ∀ncs, σ.C ρ

  • ρ,

σ(s) → C σ

  • ρ,

σ(rs).

The proof uses (AC) ∀x∃y A(x, y) → ∃f ∀x A(x, f (x)) (A(x, y) arbitrary), (IP) (A → ∃x B(x)) → ∃x.A → B(x), where τ(A) = ε, (UNC) ∀ncx∃yA(x, y) → ∃y∀ncxA(x, y), which are realized by identity functions.

slide-46
SLIDE 46

Extracted term: lemma 1

(Rec type=>(omega=>nat=>term)@@((nat=>term)=>omega)) (ModIota@([g3]OmegaInIota(cACL g3))) ([rho3,rho4,p5,p6] ([a7,n8] Abs rho3 (Sub(left p6(Mod a7(right p5([n9]Var n8)))(Succ n8)) ((Var map Seq 1 n8):+:(Var 0):)))@ ([g7] Hat rho3 rho4 ((cAC omega omega) ([a9] (cUNC omega) ((cUNC omega)((cIP omega) (right p6([n10]g7 n10(left p5 a9 n10)))))))))

slide-47
SLIDE 47

Lemma 1 ∼ reify & reflect

Disregarding administrative functions and translating via rho4 rho5 left p5 right p5 left p6 right p6 ρ σ ↓ρ ↑ρ ↓σ ↑σ gives ↓ρ : Cω → (N → Λ) (“reify”) ↑ρ : (N → Λ) → Cω (“reflect”), with the recursion equations ↓ι(r):=r, ↑ι(r):=r, ↓ρ⇒σ(a)(k):=λxρ

k .↓σ

  • a(↑ρ(x∞

k ))

  • (k+1),

↑ρ⇒σ(r)(b):=↑σ(r ↓ρ(b)).

slide-48
SLIDE 48

Extracted term: lemma 3

(Rec term=>list type=>list omega=>omega) ([n3,rhos4](ListRef omega)n3) ([r3,r4,q5,q6,rhos7,as8] Mod(q5 rhos7 as8)(q6 rhos7 as8)) ([rho3,r4,q5,rhos6,as7] Hat rho3(Typ(rho3::rhos6)r4) ((cAC omega omega) ([a9](cUNC omega)((cUNC omega)((cIP omega) (q5(rho3::rhos6)(a9::as7)))))))

slide-49
SLIDE 49

Lemma 3 ∼ evaluation

For cLemmaThree(r, ρ, a) write [ [r] ](xρ0

0 →a0,...,x ρk−1 k−1 →ak−1)

with k := Lh( ρ )

  • r [

[r] ](

x→ a). Disregarding administrative functions gives

[ [xi] ](

x→ a)

= ai [ [rs] ](

x→ a)

= [ [r] ](

x→ a)[

[s] ](

x→ a)

[ [λxρ

k r]

](

x→ a)(b) = [

[r] ](

x,xρ

k →

a,b)

slide-50
SLIDE 50

NThm ∼ normalization by evaluation

Extracted term: NThm: [rhos0,r1] left(cLemmaOne(Typ rhos0 r1)) (cLemmaThree r1 rhos0(cSCrsSeq rhos0 0)) Lh rhos0 Let ↑ denote the variable assignment xρ

k → ↑ρ(xk). Then

cNThm( ρ, r) computes the long normal form of r as ↓ρ([ [r] ]↑)(k) with k = Lh( ρ ). This is “normalization by evaluation”.

slide-51
SLIDE 51

Conclusion

◮ Program extraction from proofs not only gives certified code

(“no logical errors”), but (in case of clever proofs) can even give unexpected new algorithms.

◮ Analyzing computability in finite types over the Scott-Ershov

partial continuous functionals can be indispensible for an appropriate formulation.

◮ Formalization of proofs involving the latter is necessary and

needs to be developed.

slide-52
SLIDE 52

Conclusion

◮ Program extraction from proofs not only gives certified code

(“no logical errors”), but (in case of clever proofs) can even give unexpected new algorithms.

◮ Analyzing computability in finite types over the Scott-Ershov

partial continuous functionals can be indispensible for an appropriate formulation.

◮ Formalization of proofs involving the latter is necessary and

needs to be developed.

slide-53
SLIDE 53

Conclusion

◮ Program extraction from proofs not only gives certified code

(“no logical errors”), but (in case of clever proofs) can even give unexpected new algorithms.

◮ Analyzing computability in finite types over the Scott-Ershov

partial continuous functionals can be indispensible for an appropriate formulation.

◮ Formalization of proofs involving the latter is necessary and

needs to be developed.