• No results found

The Semantics and Complexity of Successor-free Nondeterministic G¨odel’s T

N/A
N/A
Protected

Academic year: 2022

Share "The Semantics and Complexity of Successor-free Nondeterministic G¨odel’s T"

Copied!
54
0
0

Laster.... (Se fulltekst nå)

Fulltekst

(1)

The Semantics and Complexity of Successor-free Nondeterministic G¨odel’s T

Bedeho Mesghina Wolde Mender

May 4, 2009

(2)

Acknowledgements

I would like to extend my gratitude to my thesis advisor Professor Lars Kris- tiansen for introducing me to his work and for our uncountably many talks which I enjoyed so much. Thank you for having the wisdom to know that any- thing worthwhile takes time, especially mathematics. Thank you to Professor Dag Normann for his brave efforts in explaining domain theory to me, and his never ending patience with my many inquiries. Thank you to Professor Herman Ruge Jervell for agreeing to be my secondary adviser, and always making me feel so welcome at the logic meetings. Thank you to my love Camilla for all her encouragement and support, and for our lovely vacation where I discovered the model in this thesis. But most importantly, I owe everything I have and am to my family, especially my mother and father, of whom I am so immeasurably proud.

I dedicate this to you Hibret and Mesghina.

(3)

Contents

1 Introduction 3

1.1 Introduction . . . 3

1.2 Overview . . . 4

2 Successor free G¨odel’s T 5 2.1 The Calculus . . . 5

3 Denotational semantics of Tv 8 3.1 The domainDσb . . . 8

3.2 InterpretingTvb inDb+1σ . . . 10

3.3 MappingDbσ toNbσ . . . 16

3.4 InterpretingTvb inNb+1σ . . . 18

4 Successor free computation in T 24 4.1 InterpretingTb inNσb+1 . . . 24

4.2 Computation withvalAb+1 . . . 27

5 Computing nvalAb in T 34 5.1 Relating|σ|b and||σ||b . . . 34

5.2 Computing||σ||b, ξb, βb, µb, θσb, λσb, ρσb, δbσ,Υσb, M ergeσb . . . 36

5.3 ModellingAb . . . 42

5.4 ComputingnvalAb+1 . . . 44

6 Complexity classesFi and Fiv 48

(4)

Chapter 1

Introduction

1.1 Introduction

L. Kristiansen, P. Voda, N. Jones and M. Barra have in several papers studied the computational power of fragments of various successor-free computational models, such as G¨odel’s T in [1, 2], an imperative language in [1], PCF in [4] and function algebras in [3, 5]. In these papers they have demonstrated surprising computational power such models, and successfully captured well known complexity classes defined by explicit time and space bounds on Turing machines. In particular, L. Kristiansen and P. Voda showed in [1] that certain neat successor-free fragments of G¨odel’s T, perfectly match the well known alternating space-time hierarchy1

SPACE2LIN0 TIME2LIN1 SPACE2LIN2 TIME2LIN3 SPACE2LIN4 ⊆...

The three classes at the bottom of the hierarchy are called respectivelyLINSPACE,

EXPandEXPSPACEin the literature. A natural direction of continued research is to study the nondeterminstic counterpart to this model, and that is the sub- ject of this thesis. We develop a model for a successor-free nondeterministic flavour of G¨odel’s T, which is built with particular consideration made to keep it as convenient to compute as possible, while still being adequate2. We desire this convenience since we will use deterministic programs to compute the inter- pretation of nondeterministic programs, and from this establish a relationship between deterministic and nondeterminstic complexity classes. This was the motivating goal for this thesis.

1LetLINdenotec|x|for somec, and let 2x0 =xand 2xi+1= 22xi.SPACE(f) andTIME(f) denote the set of problems decidable by a Turing machine working inO(f) space and time respectively.

2A model is adequate when the interpretation of any closed termM of base type contains exactly those elements corresponding to canonical termsM reduces to.

(5)

1.2 Overview

In chapter 2 we define a deterministic and a nondeterministic successor-free flavour of G¨odel’s T, called T and Tv respectively. We establish that Tv is strongly normalizing, and define some concepts required later.

In chapter 3 we provide a denotational semantic for Tv and demonstrate its adequacy. This proof also gives a reduction strategy which preserves the interpretation of a running program3 in a desirable way. The model itself is based on interpreting terms in domains with total functionals over power sets, and the domains are also equipped with an order relation and a binary operator.

This operator is the key to understanding the calculus, since it precisely models the nondeterminstic term. We also embed the model of Tv into the natural numbers by way of a computable isomorphism, and this embedded model is later computed in chapter 5.

In chapter 4 we quickly present L. Kristiansens model for T embedded in natural numbers from [1]. We dramatically extend the computing machinery he develops, by demonstrating terms for input-bounded repetition and higher-level arithmetic. These are used in chapter 5 to compute the interpretation of terms.

In chapter 5 we finally compute the functions defining the model in chapter 2. We decide certain type requirements for doing this by relating the sizes of the deterministic and nondeterministic domains.

In chapter 6 we define complexity classes for T and Tv, and use the main result from chapter 5 to relate them by computing the interpretation of nonde- terministic programs with deterministic programs.

3We later define a progam to be any closed term of typeιι, so a running program is understood to be such a term when given a closed term of typeιas input.

(6)

Chapter 2

Successor free G¨ odel’s T

2.1 The Calculus

Definition 2.1. We define the type space as the least setT satisfying (i)ι∈ T (ii)σ×τ∈ T whenσ, τ ∈ T (iii)σ→τ ∈ T whenσ, τ ∈ T. For convenience let the shorthandsσ1×...×σn andσ1, ..., σn−1→σn denote typesσ1×(...(σn−1× σn))andσ12→...(σn−1→σn))respectively.

For each type σ∈ T we have an infinite countable supply of symbols Vσ = {xσ0, xσ1, xσ2, ...} called the variables of type σ, and the set of all variables of all types is V=S

σ∈T Vσ. Likewise we haveHσ ={[]σ0,[]σ1,[]σ2, ...} called the holes of typeσ, and the set of all holes of all types is H=S

σ∈T Hσ. We also have an infinite countable supply of symbolsK={k0, k1, k2, ...} called numerals.

We inductively define C as the set of all deterministic successor-free con- texts. All contexts C ∈ C are said to be of some type σ ∈ T, and we may clarify the type ofC by writingCσ or C:σ.

(NUM). ki is a context of typeι for allki∈ K (HOLE).[]σi is a context of typeσ for all[]σi ∈ H (VAR). xσi is a context of typeσfor all xσi ∈ V

(APP). (C1σ→τC2σ)is a context of typeτ for all contextsC1σ→τ,C2σ

(ABS).λxσi.Cτ is a context of typeσ→τ for any xσi ∈ V and all contexts Cτ (PAIR).hC1σ,C2τi is a context of typeσ×τ for all contextsC1σ,Cτ2

(L-PRJ). f st.Cσ×τ is a term of typeσ for all contextsCσ×τ (R-PRJ).snd.Cσ×τ is a term of typeτ for all contextsCσ×τ

(REC).Rσ(Cι1,C2ι,σ→σ,C3σ)is a context of typeσfor all contextsC1ι,C2ι,σ→σ,C3σ We define Cv as the set of nondeterministic successor-free contexts by nat- urally extending the induction schema above with

(7)

(NDT).(C1σ|C2σ)is a context of typeσ for all contextsC1σ,Cσ2

We say that a context is simple when it has at most one hole in it. Let C be a simple context, then for any simple contextC which has the same type as any hole inC, letC[C] denote replacingC with any hole in C.1

We define the set of deterministic successor-free terms, denoted T, as all contextsC ∈C which have no hole. We defineTv the same way. LetCσCv be a simpleTvcontext, and letsbe aTv-term of appropriate type, observe then that C[s] is also a Tv-term. Given Tv-termsM :σ andt:τ, if there exists a contextC:σsuch that M =C[t] then we say thatt is a subterm ofM.

For any b 0 let Tb denote the set of T-terms such that all numerals occurring in them are no greater thenkb, and we define Tvb the same way.

When we simply refer to something as a term, then it may be either a T orTv term. For convenience we allow some syntactic sugar; for a term of the form(M) we may write M, for a term of the form((((M)N1)...)Nk)we may writeM(N1, ..., Nk), for a term of the form N(N(...(M)...))whereN occurs k times we may write(Nk(M)), for a term of the formλx1.(λx2.(...λxk.M))we may write(λx1x2...xk.M), and in most situations concerning variables we will drop the subscript and sometimes also type.

A variable is said to be bound in a term M if each occurrence of it in M is within the scope of an abstraction for it, otherwise we say that each occurrence outside of the scope of an abstraction is free inM. A term is said to be closed when all variables are bound, otherwise it is said to be open.

For terms M and N : τ and variable x: τ, we say that N is substitutable forxinM if substituting all freexinM withN does not result in binding free variables inN. LetMNx denote such a substitution whenever N is substitutable forxin M.

We define the one step reduction relation 1 forT (α). C[λx.M]1C[λy.Myx] wheny is not free inM (β). C[(λx.M)N]1C[MNx]

(LPRJ). C[f st.hM, Ni]→1C[M] (RPRJ).C[snd.hM, Ni]→1C[N]

(0-REC).C[Rσ(k0, M, N)]→1C[N]

(REC).C[Rσ(kn+1, M, N)]→1C[M(kn, Rσ(kn, M, N))]

for any simple context and suitably typed M,N. We define the one step reduction relation¤1 forTv by naturally extending the list above with

(γ). C[(M|N)]¤1C[M]andC[(M|N)]¤1C[N]

1Notice that using [C∗] respects the inductive structure ofC. By this we mean that for example given the simple C = C1C2 we have C[C] = C1[C]C2[C]. This allows us to do convenient induction on the structure ofC[C].

(8)

We make the distinction between theT andTv reduction relation by using the symbols→1 and¤1respectivley. Let the relations→andBbe the symmet- ric,transitive closures of→1and¤1. A term is said to be on normal form when no non-α-reduction can be applied to it, and it is said to be on γ-normal form when no non-α-γ-reduction is available.

Definition 2.2. We definelv(σ)as the level ofσby (i)lv(ι) = 0(i)lv(σ×τ) = max{lv(σ), lv(τ)} (iii) lv(σ τ) = max{lv(σ) + 1, lv(τ)}. Let Rσ1, ..., Rσn

be an exact list of all recursors occurring in a term M, we define the re- cursor rank of M as Rk(M) = max{0, lv(σ1), ..., lv(σn)}. We also define T r(M) as the term rank of M by (i) T r(kn) = 0 (ii) T r(xσ) = lv(σ) (iii) T r(λxσ.Pτ) = max{lv(σ τ), T r(P)} (iv) T r(P Q) = max{T r(P), T r(Q)}

(v) T r(P|Q) = max{T r(P), T r(Q)} (vi) T r(hP, Qi) = max{T r(P), T r(Q)}

(vii) T r(f st.P) =T r(P) (viii) T r(snd.P) =T r(P) (viiii) T r(Rσ(P, Q, R)) = max{T r(P), T r(Q), T r(R)}

Lemma 2.3. For any termM :σwe have (i) T r(M)≥lv(σ)

(ii) T r(M)≥T r(R)for any subtermR of M

(iii) T r(M) =lv(τ) =T r(R)for some subterm R:τ ofM Proof. All are proven by simple induction on structure ofM.

Definition 2.4. We say that an infinite reduction of a term normalizes if it ends with an infinite use of onlyα-reductions, and a term is said to be strongly normalizable if all infinite reductions normalize.

Theorem 2.5. AllTv-terms are strongly normalizable

Proof. In [7] Berger U. demonstrates that natural extensions of G¨odels T are strongly normalizing by using W.W. Tait’s method of strong computability for simply typed lambda calculus from [8]. However we cannot directly apply his result to our calculus because of a superficial discrepancy. In Tv we do not considerRσ, f st., snd.and|σ as independent constants and terms on their own, as is customary and done in [7]. To overcome this we simply construct a new calculus TC where for all typesσandτ we have constants

Rσ:ι,→σ), σ→σ,|σ:σ, σ→σ, f stσ×τ:σ×τ→σ, sndσ×τ:σ×τ→τ and the same reduction rules as before. It is obvious that Tv TC, and any reduction of a Tv-term is also a reduction of the same term in TC. Therefor since the reduction sequence is normalizing by strong normalization of TC, then Tv is also strongly normalizing.

(9)

Chapter 3

Denotational semantics of T v

3.1 The domain D

bσ

Definition 3.1. For any type σ and b >0 we define Dbσ as the domain over typeσin base b and a binary relationvσb overDbσ

(i) Dbι =P({0, ..., b1})anddvιbe⇔d⊆efor alld, e∈Dbσ1

(ii) Dbσ×τ =Dσb ×Dτb anddvσ×τb e⇔f st(d)vσb f st(e)∧ snd(d)vτb snd(e) for alld∈Dσb,e∈Dτb2

(iii) Dbσ→τ is the set of all functions f :Dσb →Dτb and f vσ→τb g ⇔f(d)vτb g(d)for all d∈Dbσ

These domains are simple in structure and rich in elements not corresponding to any term, e.g. Dbι contains the empty set. The domains also contain non- monotonic functions which also do not correspond to any term, given certain natural conditions on open terms. As mentioned in the introduction, the reason no refinements have been made is because we want the domains to be of easily computable size, namely||σ||b as seen later.

We experience that our terms behave monotonically with respect to vσb, so one would expect that an accurate interpretation would be monotonic as well. Also, when [[N : σ→τ]]A is given input which is monotonic,e.g the in- terpretation of a term, we expect monotonic output. The complication is that monotonicity is usually defined for functions over domains which are them self’s restricted to only monotonic elements. We overcome this by introducing a suit- able extension of the notion of monotonicity.

1P(S) denotes the set of all subsets ofS

2fst and snd refers to functions taking the first and second component of a 2-tuple respec- tively, not to be confused withf st.andsnd.which are part of the term language.

(10)

Definition 3.2. We define a unary relation for all domains, called deep mono- tonicity

(i) g∈Dbι is deeply monotonic

(ii) g∈Dσ×τb is deeply monotonic when f st(g) andsnd(g) are deeply mono- tonic

(iii) g∈Dbσ→τ is deeply monotonic when

- g(e)is deeply monotonic for all deeply monotonic e∈Dbσ - dvσb e⇒g(d)vτb g(e)for all deeply monotonic d, e∈Dσb

Proposition 3.3. Let M :σ be aTvb-term, and Ab+1 be an assignment map- ping all free variables inM to deeply monotonic elements, then[[M]]Ais deeply monotonic.

Proof. We omit a detailed proof since this proposition si no more then an ob- servation. We prove this by induction on the structure ofM. In each induction case we rely on the fact that the functions defining [[·]]A, such asσb and Ψσb+1, preserve deep monotonicity.

Proposition 3.4. hDσb,vσbiis a partial order.

Proof. We prove this by induction on the structure ofσ.

Definition 3.5. For any type σ and b > 0 we define the binary operator σb overDσb as the merge operator for type σin baseb

(i) d∨ιbe=d∪efor alld, e∈Dbι

(ii) d∨σ×τb e= (f st(d)σb f st(e), snd(e)∨τb snd(e))for alld, e∈Dbσ×τ (iii) f σ→τb g = h for all f, g Dσ→τb , where h(x) = f(x)τ g(x) for all

x∈Dbσ

Lemma 3.6. For anyd, e, f ∈Dσb (i) d∨σb e∈Dσb

(ii) d∨σb e=e∨σb d

(iii) (dσb e)∨σb f =d∨σb (eσb f) (iv) dvσb e∨σb d

(v) d∨σb d=d

(vi) d=e⇔evσb danddvσb e

(vii) evσb dandf vσb d⇒(eσb f)vσb d

(11)

Proof. All are easily proved by a standard induction on the structure σ, and some may also be derived from the others.

For convenience we define a shorthand for merging the elements of any finite setS⊆Dbσ. LetWσ,b

d∈Sddenote the merging of alld∈Sin some arbitrary order.

This is well-defined, since merging is both commutative and associative by(ii) and (iii) in Lemma 3.6 respectively. Throughout the text we may use slight variations off this shorthand, but it will always be clear that we are merging over some finite subset of our domains.

3.2 Interpreting T

vb

in D

b+1σ

Definition 3.7. For anyσ andb >0 we define ψbσ:Nb×Dι,σ→σb ×Dσb →Dσb andΨσb :Dbι\{∅} ×Dι,σ→σb ×Dσb →Dσb by

(i) ψσb(0, f, g) =g

(ii) ψσb(i+ 1, f, g) =f({i}, ψbσ(i, f, g)) (iii) Ψσb(S, f, g) =Wσ,b

n∈Sψbσ(n, f, g)

Lemma 3.8. For anyS1, S2∈Dbι,f ∈Dbι,σ→σ and g∈Dσb Ψσb(S1∪S2, f, g) = Ψσb(S1, f, g)∨σb Ψσb(S1, f, g) Proof.

Ψσb(S1∪S2, f, g) =

σ,b_

n∈S1∪S2

ψbσ(n, f, g) Ψσb def.

= Ã σ,b

_

n∈S1

ψbσ(n, f, g)

!

σb à σ,b

_

n∈S2

ψbσ(n, f, g)

!

= Ψσb(S1, f, g)∨σb Ψσb(S2, f, g) Ψσb def.

Definition 3.9. We define a domain assignment A in base b as a total map from V into S

σDσb such that A(xσ) Dbσ, occasionally we may write Ab to clarify the base, or only refer to it as an assignment if the context allows this.

LetAbe a domain assignment in baseb+ 1, then we define[[·]]Aas the domain interpretation ofTv-terms under assignmentA

[[kn]]A={n}

[[x]]A=A(x)

[[M N]]A= [[M]]A[[N]]A

(12)

[[λxσ.Mτ]]A=f where f(u) = [[M]]Ax u

3 for allu∈Db+1σ [[Mσ|Nσ]]A= [[M]]Aσb [[N]]A

[[hM, Ni]]A= ([[M]]A,[[N]]A) [[f st.Mσ×τ]]A=f st([[M]]A) [[snd.Mσ×τ]]A=snd([[M]]A)

[[Rσ(N, F, G)]]A= Ψσb+1([[N]]A,[[F]]A,[[G]]A)

Lemma 3.10. For any Tvb-termM :σ and assignmentAb+1

(i) [[M]]A∈Dσb+1

(ii) [[M]]U= [[M]]Afor any assignmentUb+1 if M is closed (iii) [[M]]Ax

[[R]]A

= [[MRx]]A for anyTvb-termR:τ and variablex:τ such thatR is substitutable forxinM.

Proof. All are easily proved by a standard induction on structure of M. We will for closed terms often omit the domain assignment and write [[M]]

instead of [[M]]A, this is possible since (ii) in the lemma above shows that assignments are irrelevant for closed terms.

Lemma 3.11. For any context C : σ and terms sτ, tτ such that C[s],C[t] are Tvb -terms and assignmentAb+1

(i) [[s]]Avτb+1[[t]]A[[C[s]]]Avσb+1[[C[t]]]A (ii) [[s]]A= [[t]]A[[C[s]]]A= [[C[t]]]A

Proof. (i)is easily proved by induction on the structure ofC,(ii) follows imme- diately.

Lemma 3.12. For any Tvb-termM :σwhere 1N and assignment Ab+1, then[[N]]Avσb+1[[M]]Awhen theγ-reduction was used, otherwise[[N]]A= [[M]]A. Proof. Lets:τ be the subterm ofM to which the reduction is directly applied, resulting in some termt:τ, so there exists a contextC :σsuch that M =C[s]

and N = C[t]. We now consider each reduction rule and demonstrate that [[s]]Avτb+1[[t]]Aif theγ-reduction was used, otherwise [[s]]A= [[t]]A.

3Axuis standard notation for the map sendingxtou, and otherwise behaving likeA. It is used throughout this thesis.

(13)

(α). By definition of [[·]]A we have [[λyρ.Myx]]A=gwhereg(u) = [[Myx]]Ayu, and [[λxρ.M]]A=f where f(u) = [[M]]Ax

u. So for allu∈Dρb+1 g(u) = [[Myx]]Ayu = [[M]]Ay,x

u,Ay u(y)

(iii)Lemma 3.10

= [[M]]Ay,x

u,u Ayu(y) =u

= [[M]]Ax

u yis not free inM

=f(u)

Thereforf =g, that is [[λxρ.M]]A= [[λyρ.Myx]]A. (β).

[[(λx.R)S]]A= [[λx.R]]A[[S]]A= [[R]]Ax [[S]]A

= [[RxS]]A The last equality holds by(iii)in Lemma 3.10

(γ). By definition of [[·]]A we have

[[R|S]]A= [[R]]Aσb+1[[S]]A and

[[R]]Avσb+1[[R]]Aσb+1[[S]]A by(iii)in Lemma 3.6, hence

[[R]]Avσb+1[[R|S]]A The argument is symmetric inS.

(PRJ).

[[f st.hR, Si]]A=f st([[hR, Si]]A) =f st([[R]]A,[[S]]A) = [[R]]A snd.hR, Siis analogous.

(0-REC).

[[Rσ(k0, F, G)]]A= Ψσb+1([[k0]]A,[[F]]A,[[G]]A) [[·]]Adef.

=

σ,b+1_

n∈[[k0]]A

ψσb+1(n,[[F]]A,[[G]]A) Ψσb+1def.

=ψb+1σ (0,[[F]]A,[[G]]A) [[k0]]A={0}def.

= [[G]]A ψb+1σ def.

(14)

(REC).

[[Rσ(kn+1, F, G)]]A

= Ψσb+1([[kn+1]]A,[[F]]A,[[G]]A) [[·]]Adef.

=

σ,b+1_

m∈[[kn+1]]A

ψσb+1(m,[[F]]A,[[G]]A) Ψσb+1def.

=ψσb+1(n+ 1,[[F]]A,[[G]]A) [[kn+1]]A={n+ 1}

= [[F]]A({n}, ψσb+1(n,[[F]]A,[[G]]A)) ψb+1σ def.

= [[F]]A

[[kn]]A,

σ,b+1_

m∈[[kn]]A

ψσb+1(m,[[F]]A,[[G]]A)

= [[F]]A¡

[[kn]]A,Ψσb+1([[kn]]A,[[F]]A,[[G]]A

Ψσb+1def.

= [[F]]A([[kn]]A,[[Rσ(kn, F, G)]]A) [[·]]Adef.

= [[F kn]]A[[Rσ(kn, F, G)]]A [[·]]Adef.

= [[F(kn, Rσ(kn, F, G))]]A [[·]]Adef.

We see from the relations above, if aγ-reduction was applied then [[s]]A= [[t]]A, so by(ii) in Lemma 3.11 [[M]]A= [[N]]Aas desired. Otherwise [[s]]Avτb+1[[t]]A, so by(i)in Lemma 3.11 [[N]]Avσb [[M]]A.

Corollary 3.13. For any Tvb-termM :σand assignment Ab+1 whereM ¤N [[N]]Avσb [[M]]A

Proof. There is a sequence of Tvb-terms R1 : σ, ..., Rk : σ where M = R1

and N = Rk and Ri ¤1 Ri+1 for all i < k. By Lemma 3.12 we know that [[Ri]]Avσb+1[[Ri+1]]A, and combined with transitivity ofvσb+1 from Proposition 3.4 we get that [[Ri]]A vσb+1 [[Rj]]A for all i, j ≤k. Hence [[R1]]A vσb+1 [[Rk]]A, that is [[N]]Avσb+1[[M]]A.

Lemma 3.14. Let M be a closed term on normal form of typeσ (i) σ=ι thenM is a numeral

(ii) σ=τ→ρ thenM is a lambda abstraction (iii) σ=τ×ρ thenM is a pair

Proof. We do a simultaneous induction proof on the structure ofM for all three claims, and keep in mind that any subterm ofM must also be on normal form.

In each claim we will argue that M cannot have certain forms, and some of these forms occur in all claims, therefor we argue these outside the claims to avoid repetition.

Since M is closed it cannot be a variable, and since it is on normal form it

(15)

can obviously not be on form (A|B). It cannot be on form R(N, F, G) since N : ι by the induction hypothesis must be a numeral, and this allows us to apply the recursor reduction onM, contradicting it being on normal form. It cannot be on form (Aτ→ρBτ),f st.Aτ×ρ orsnd.Aτ×ρ, since either one would by the induction hypothesis onAallow us to apply a reduction,β- and projection respectively, onM directly. Observe now that the only remaining possible forms are the numeral, lambda abstraction and pairing.

M :ι: Since M is of type ι it cannot be on form λx.A or hA, Bi, so the only remaining form is numeral, soM is a numeral term.

M :τ →ρ: SinceM is of typeτ →ρit cannot be a numeral or on formhA, Bi, so the only remaining form is lambda abstraction, soM is a lambda ab- straction term.

M :τ×ρ: Since M is of type τ×ρ it cannot be a numeral or a lambda ab- straction , so the only remaining form is pairing, soM is a pairing term.

Lemma 3.15. A choice term is a closed Tv term where the γ-reduction is available, but no other non-α-reduction.4 Let M : σ be a closed choice term not of the form λx.Q and hP, Qi, then there exists a context C : σ such that M =C[p|q] and

[[C[p|q]]] = [[C[p]]]σb+1[[C[q]]]

Proof. We demonstrate this by induction on the structure of M.

Case M =kn, x. Neither of these cases are possible sinceM is a choice term.

Case M = Pτ→σQτ. P is a closed term since M is closed. P must be a choice term, otherwise it would have to be on normal form, which by(ii) in Lemma 3.14 puts it on form λx.u, contradicting that M is a choice term. P cannot be on formhu, visince it is of the arrow type, and not on formλx.usince this as mentioned contradicts thatM is choice term. This allows the induction hypothesis to be applied on P, giving us a context C1:σ→τ such thatP=C1[p|q].

LetC=C1Qand observe thatM =C[p|q] and

[[C[p|q]]] = [[C1[p|q]Q]] C[] def.

= [[C1[p|q]]][[Q]] [[·]] def.

[[C1[p]]]τ→σb+1 [[C1[q]]]ª

[[Q]] IH.

= [[C1[p]]]([[Q]])σb+1[[C1[q]]]([[Q]]) τb+1→σ.def

= [[C1[p]Q]]σb+1[[C1[q]Q]] [[·]] def.

= [[C[p]]]σb+1[[C[q]]] C

4Not to be confused with a term onγ-normal form, which does not guarantee having a nondeterministic reduction available. So a choice term is onγ-normal form, but the converse does not hold.

(16)

Case M =λx.P,hP, Qi. These cases are not possible by assumption.

Case M =f st.Pσ×τ, snd.Pτ×σ. We only consider the first case. P is clearly a choice term, and cannot be on formλx.usince it is of the product type, and not of formhu, visince this as contradicts thatM is choice term. This allows the induction hypothesis to be applied toP, giving us a contextC1

such thatP =C1[p|q]. LetC=f st.C1 and observe thatM =C[p|q] and [[C[p|q]]] = [[f st.C1[p|q]]] C[] def.

=f st([[C1[p|q]]]) [[·]] def.

=f st([[C1[p]]]σ×τb+1 [[C1[q]]]) IH.

=f st([[C1[p]]])σb+1f st([[C1[q]]]) σ×τb+1 def.

= [[f st.C1[p]]]σb+1[[f st.C1[q]]] [[·]] def.

= [[C[p]]]σb+1[[C[q]]] Cdef.

Case M = (P|Q). LetC = [] and observe thatM = C[P|Q] and the desired result.

Case M =Rσ(Nι, Fι,σ→σ, Gσ). Terms N, F, Gmust all be closed. The term N must be a choice term, otherwise it would be on normal form and therefore by(ii) in Lemma 3.14 also on numeral form, contradicting that M is a choice term. N cannot be on formhu, viorλx.usince it is of the ι type. This allows the induction hypothesis to be applied to N, giving us a contextC1 such thatN =C1[p|q]. Let C=Rσ(C1, F, G) and observe thatM =C[p|q] and

[[Cσ,ρ[p|q]]] = [[Rσ(C1[p|q], F, G)]] C[] def.

= Ψσb+1([[C1[p|q]]],[[F]],[[G]]) [[·]] def.

= Ψσb+1([[C1[p]]]ιb+1[[C1[q]]],[[F]],[[G]]) IH.

= Ψσb+1([[C1[p]]][[C1[q]]],[[F]],[[G]]) ιb+1def.

= Ψσb+1([[C1[p]]],[[F]],[[G]])σb+1Ψσb+1([[C1[q]]],[[F]],[[G]]) Lemma 3.8

= [[Rσ(C1[p], F, G)]]σb+1[[Rσ(C1[q], F, G)]] [[·]] def.

= [[C[p]]]σb+1[[C[q]]] Cdef.

This induction reveals that if a term has a nondeterministic choice as its only remaining non-α-reduction, then we will always find such a choice outside the scope of a recursor, meaningF orGfor anyRσ(N, F, G). We may however, find it completely outside a recursor, or alternatively inN. For example we may haveR([A|B], F, G) or evenR(...R([A|B], F0, G0)..., F1, G0), and so on. This is a fundamental ingredient in the adequacy proof, and it actually provides us with a guarantee of how we can suitably reduce a term to preserve its interpretation.

(17)

Corollary 3.16. For any closed Tvb-term M : ι not on normal form with n [[M]], there exists a term N : ι such that M ¤1N by way of a non α- reduction andn∈[[N]]

Proof. If M is not a choice term, then it must have a deterministic reduction available, and applying any such reduction preserves the interpretation and thus n∈[[N]]. Assume now that M is a choice term, and observe that it cannot be on formλx.P orhP, Qisince it it of typeι.

By Lemma 3.15M =C[p|q] where

[[C[p|q]]] = [[C[p]]]ιb+1[[C[q]]]

alternatively

[[M]] = [[C[p]]][[C[q]]]

which demonstrates the existence of an available nondeterministic reduction, moreover we must have n [[C[p]]] or n [[C[q]]]. So picking the appropriate reduction will provide the desired result.

Theorem 3.17. For any closed Tvb-termM :ι n∈[[M]]⇔M ¤kn

Proof. First observe that

M ¤kn[[kn]]vιb+1[[M]] corollary 3.13

⇒ {n} vιb+1[[M]] [[·]]Adef.

⇒ {n} ⊆ [[M]] vιb+1def.

⇒n∈[[M]]

For the converse implication letn∈[[M]]. By Lemma 3.16 we can do a reduction 1M1¤1M2¤1... consisting of only nonα-reductions such that

[[M]] = [[M1]] = [[M2]] =...

This reduction sequence must normalize since it otherwise would constitute a counterexample to Theorem 2.5. So there is a termMiin the sequence on normal form. Mi must also be closed and of typeιsince reductions preserves this, and soMi=kmfor somemby Lemma 3.14. Since andn∈[[Mi]] = [[km]] ={m}, so Mi=kn and thusM¤kn as desired.

3.3 Mapping D

bσ

to N

bσ

In this section we show how to map Dbσ into it’s isomorphic counterpart and subset of the natural numbersNbσ, by way of a bijectionπσb.

(18)

Definition 3.18. For any type σ and b > 0 we define kσkb as the nondeter- ministic cardinality of σ by (i) kιkb = 2b (ii) kσ×τkb = kσkb× kτkb (iii) kσ→τkb=kτkkσkb b. For any typeσandb >0 we defineNbσ ={0, ...,kσkb−1}

This following lemma is necessary for following functions onNbσto be well- defined

Lemma 3.19. For any number a∈ Nbσ where

(i) σ=ι there are unique numbersd0, ..., db−1∈ {0,1} such that a=d0+d12 +...+db−12b−1

(ii) σ=ρ×τ there are unique numbersd0∈ Nbτ,d1∈ Nbρ such that a=d0+d1||τ||b

(iii) σ=ρ→τ there are unique numbers d0, ..., d` ∈ Nbτ where `=||ρ||b1 such that

a=d0+d1||τ||b+...+d`||τ||b`

Proof. (i)is proven the same way as(iii), and both(ii) and(iii) are analogous to Lemma 4.2.

Lemma 3.20. For all b >0 we define

- ξb:Nbι →Dbι byξb(d0+...+db−12b−1) ={i|di= 1}

- βb :Nbι× Nb→ {0,1} by βb(d0+...+db−12b−1, i) =di

- µb:Dιb→ Nbι by µb(S) =X

i∈S

2i

Then (i) ξb is a bijection (ii) µb is the inverse of ξb (iii)µb is a bijection (iv) β(n, m) = 1⇔ {m} ⊆ξb(n)for any n∈ Nbι andm∈ Nb.

Proof. For surjectivity ofξb fixS∈Dιb and let di=

(

1 i∈ S

0 else for alli < b then

ξb(d0+...+db−12b−1) ={i|di= 1}=S Injectivity ofξb follows from(ii) , so or anya∈ Nbι

µbb(a)) =µbb(d0+...+db−12b−1))

=µb({i|di = 1})

= X

i∈{i|di=1}

2i

=d0+...+db−12b−1

=a

Referanser

RELATERTE DOKUMENTER