Documentation

CslibFrontier.Computability.GenericRAM.Native.Degree

Native certificates with explicit polynomial degrees #

NativeCertificate.IsPolynomial says that a certificate's time and space bounds are polynomial in the encoded input length, without naming a degree. NativeCertificate.HasDegree c d names it: the time and space bounds are at most a constant times (n + 1) ^ d on encoded inputs of length n, and the encoded output has linear length. Linear output is what keeps the degree from growing under composition: a degree-d bound evaluated at a linearly long intermediate value is again of degree d. This is the discipline of Turing.MultiTapeTM.ComputableInDegree with output degree one, applied to the input-dependent bounds that certificates carry.

Every certificate combinator preserves HasDegree, so a simulation assembled from them inherits an explicit degree from its primitives. Model.NativePrimitives.HasDegree asks the same of all primitive certificates of a RAM model.

Main definitions #

Main results #

structure Cslib.GenericRAM.NativeCertificate.HasDegree {α β : Type} {ei : α ↪ List Bool} {em : β ↪ List Bool} {f : α → β} (c : NativeCertificate f ei em) (d : ℕ) :

Time and space bounds of degree d, and encoded output of linear length, in the encoded input length.

theorem Cslib.GenericRAM.NativeCertificate.HasDegree.mono {α β : Type} {ei : α ↪ List Bool} {em : β ↪ List Bool} {f : α → β} {d d' : ℕ} {c : NativeCertificate f ei em} (h : c.HasDegree d) (hd : d ≤ d') :

Raising the degree keeps the bound.

theorem Cslib.GenericRAM.NativeCertificate.HasDegree.isPolynomial {α β : Type} {ei : α ↪ List Bool} {em : β ↪ List Bool} {f : α → β} {d : ℕ} {c : NativeCertificate f ei em} (h : c.HasDegree d) :

A certificate of some degree is polynomial.

theorem Cslib.GenericRAM.NativeCertificate.HasDegree.of_eq {α β : Type} {ei : α ↪ List Bool} {em : β ↪ List Bool} {f : α → β} {d : ℕ} {c : NativeCertificate f ei em} {f' : α → β} (c' : NativeCertificate f' ei em) (h : c.HasDegree d) (ht : c'.time = c.time) (hs : c'.space = c.space) (hf : ∀ (a : α), f a = f' a) :

Transfer a degree to a certificate with the same bounds for a pointwise equal function. This sees through certificates defined by case analysis, whose casts block unification.

theorem Cslib.GenericRAM.NativeCertificate.degreeBounded_comp {α β : Type} {em : β ↪ List Bool} {f : α → β} {d : ℕ} {size : α → ℕ} {u : β → ℕ} (hu : Turing.MultiTapeTM.DegreeBounded (fun (b : β) => (em b).length) u d) (hf : Turing.MultiTapeTM.DegreeBounded size (fun (a : α) => (em (f a)).length) 1) :
Turing.MultiTapeTM.DegreeBounded size (fun (a : α) => u (f a)) d

A degree-d bound evaluated at an intermediate value of linear length has degree d.

theorem Cslib.GenericRAM.NativeCertificate.length_of_linear {β γ : Type} {em : β ↪ List Bool} {eo : γ ↪ List Bool} {h : β → γ} (hh : Turing.MultiTapeTM.ComputableInO h em eo (fun (b : β) => (em b).length) fun (b : β) => (em b).length) :
Turing.MultiTapeTM.DegreeBounded (fun (b : β) => (em b).length) (fun (b : β) => (eo (h b)).length) 1

A linear-time, linear-space computation has encoded output of linear length.

theorem Cslib.GenericRAM.NativeCertificate.length_of_space {α β : Type} {ei : α ↪ List Bool} {em : β ↪ List Bool} {f : α → β} (c : NativeCertificate f ei em) (hs : Turing.MultiTapeTM.DegreeBounded (fun (a : α) => (ei a).length) c.space 1) :
Turing.MultiTapeTM.DegreeBounded (fun (a : α) => (ei a).length) (fun (a : α) => (em (f a)).length) 1

A certificate with linear space has encoded output of linear length.

theorem Cslib.GenericRAM.NativeCertificate.hasDegree_of_space_linear {α β : Type} {ei : α ↪ List Bool} {em : β ↪ List Bool} {f : α → β} {d : ℕ} (c : NativeCertificate f ei em) (ht : Turing.MultiTapeTM.DegreeBounded (fun (a : α) => (ei a).length) c.time d) (hs : Turing.MultiTapeTM.DegreeBounded (fun (a : α) => (ei a).length) c.space 1) (hd : 1 ≤ d) :

A certificate whose time has degree d ≥ 1 and whose space is linear has degree d.

def Cslib.GenericRAM.NativeCertificate.ofDegree {α β : Type} {ei : α ↪ List Bool} {em : β ↪ List Bool} {f : α → β} {d : ℕ} (h : Turing.MultiTapeTM.ComputableInDegree f ei em d 1) :

The certificate of a computation in time and space degree d with linear output.

@[simp]
theorem Cslib.GenericRAM.NativeCertificate.ofDegree_time {α β : Type} {ei : α ↪ List Bool} {em : β ↪ List Bool} {f : α → β} {d : ℕ} (h : Turing.MultiTapeTM.ComputableInDegree f ei em d 1) (a : α) :
(ofDegree h).time a = ((ei a).length + 1) ^ d
@[simp]
theorem Cslib.GenericRAM.NativeCertificate.ofDegree_space {α β : Type} {ei : α ↪ List Bool} {em : β ↪ List Bool} {f : α → β} {d : ℕ} (h : Turing.MultiTapeTM.ComputableInDegree f ei em d 1) (a : α) :
(ofDegree h).space a = ((ei a).length + 1) ^ d
theorem Cslib.GenericRAM.NativeCertificate.ofDegree_hasDegree {α β : Type} {ei : α ↪ List Bool} {em : β ↪ List Bool} {f : α → β} {d : ℕ} (h : Turing.MultiTapeTM.ComputableInDegree f ei em d 1) :

ofDegree keeps the degree of the computation.

The combinators preserve the degree #

theorem Cslib.GenericRAM.NativeCertificate.linear_hasDegree {α β : Type} {ei : α ↪ List Bool} {em : β ↪ List Bool} {f : α → β} {d : ℕ} (h : Turing.MultiTapeTM.ComputableInO f ei em (fun (a : α) => (ei a).length) fun (a : α) => (ei a).length) (hd : 1 ≤ d) :
theorem Cslib.GenericRAM.NativeCertificate.const_hasDegree {α β : Type} {ei : α ↪ List Bool} {em : β ↪ List Bool} {d : ℕ} (b : β) (hd : 1 ≤ d) :
theorem Cslib.GenericRAM.NativeCertificate.comp_hasDegree {α β γ : Type} {ei : α ↪ List Bool} {em : β ↪ List Bool} {eo : γ ↪ List Bool} {f : α → β} {d : ℕ} {h : β → γ} (c' : NativeCertificate h em eo) (c : NativeCertificate f ei em) (hc' : c'.HasDegree d) (hc : c.HasDegree d) :
(c'.comp c).HasDegree d
theorem Cslib.GenericRAM.NativeCertificate.prod_hasDegree {α β γ : Type} {ei : α ↪ List Bool} {em : β ↪ List Bool} {eo : γ ↪ List Bool} {f : α → β} {g : α → γ} {d : ℕ} (c : NativeCertificate f ei em) (c' : NativeCertificate g ei eo) (hc : c.HasDegree d) (hc' : c'.HasDegree d) :
(c.prod c').HasDegree d
theorem Cslib.GenericRAM.NativeCertificate.post_hasDegree {α β γ : Type} {ei : α ↪ List Bool} {em : β ↪ List Bool} {eo : γ ↪ List Bool} {f : α → β} {d : ℕ} {h : β → γ} (c : NativeCertificate f ei em) (hh : Turing.MultiTapeTM.ComputableInO h em eo (fun (b : β) => (em b).length) fun (b : β) => (em b).length) (hc : c.HasDegree d) :
(c.post hh).HasDegree d
theorem Cslib.GenericRAM.NativeCertificate.fst_hasDegree {α β γ : Type} {ei : α ↪ List Bool} {em : β ↪ List Bool} {eo : γ ↪ List Bool} {d : ℕ} {f : α → β × γ} (c : NativeCertificate f ei (Turing.MultiTapeTM.encPair em eo)) (hc : c.HasDegree d) :
theorem Cslib.GenericRAM.NativeCertificate.snd_hasDegree {α β γ : Type} {ei : α ↪ List Bool} {em : β ↪ List Bool} {eo : γ ↪ List Bool} {d : ℕ} {f : α → β × γ} (c : NativeCertificate f ei (Turing.MultiTapeTM.encPair em eo)) (hc : c.HasDegree d) :
theorem Cslib.GenericRAM.NativeCertificate.some_hasDegree {α β : Type} {ei : α ↪ List Bool} {em : β ↪ List Bool} {f : α → β} {d : ℕ} (c : NativeCertificate f ei em) (hc : c.HasDegree d) :
theorem Cslib.GenericRAM.NativeCertificate.inl_hasDegree {α β γ : Type} {ei : α ↪ List Bool} {em : β ↪ List Bool} {f : α → β} {d : ℕ} (c : NativeCertificate f ei em) (right : γ ↪ List Bool) (hc : c.HasDegree d) :
(c.inl right).HasDegree d
theorem Cslib.GenericRAM.NativeCertificate.inr_hasDegree {α β γ : Type} {ei : α ↪ List Bool} {em : β ↪ List Bool} {f : α → β} {d : ℕ} (left : γ ↪ List Bool) (c : NativeCertificate f ei em) (hc : c.HasDegree d) :
(inr left c).HasDegree d
theorem Cslib.GenericRAM.NativeCertificate.congr_hasDegree {α β : Type} {ei : α ↪ List Bool} {em : β ↪ List Bool} {f : α → β} {d : ℕ} {f' : α → β} (c : NativeCertificate f ei em) (h : ∀ (a : α), f a = f' a) (hc : c.HasDegree d) :
theorem Cslib.GenericRAM.NativeCertificate.pull_hasDegree {α β δ : Type} {ei : α ↪ List Bool} {em : β ↪ List Bool} {f : α → β} {d : ℕ} {ed : δ ↪ List Bool} (c : NativeCertificate f ei em) (hc : c.HasDegree d) (hd : 1 ≤ d) :
(c.pull ed).HasDegree d
theorem Cslib.GenericRAM.NativeCertificate.payload_hasDegree {α β : Type} {d : ℕ} (input : α ↪ List Bool) (out : β ↪ List Bool) (hd : 1 ≤ d) :
(payload input out).HasDegree d
theorem Cslib.GenericRAM.NativeCertificate.branch_hasDegree {α β : Type} {ei : α ↪ List Bool} {em : β ↪ List Bool} {d : ℕ} {condition : α → Bool} {f₁ f₂ : α → β} (test : NativeCertificate condition ei Turing.MultiTapeTM.encBool) (yes : NativeCertificate f₁ ei em) (no : NativeCertificate f₂ ei em) (ht : test.HasDegree d) (hy : yes.HasDegree d) (hn : no.HasDegree d) :
(test.branch yes no).HasDegree d
theorem Cslib.GenericRAM.NativeCertificate.option_hasDegree {α β γ : Type} {ei : α ↪ List Bool} {em : β ↪ List Bool} {eo : γ ↪ List Bool} {d : ℕ} {value : α → Option β} {fallback : α → γ} {body : α × β → γ} (c : NativeCertificate value ei (Turing.MultiTapeTM.encOption em)) (no : NativeCertificate fallback ei eo) (yes : NativeCertificate body (Turing.MultiTapeTM.encPair ei em) eo) (hc : c.HasDegree d) (hno : no.HasDegree d) (hyes : yes.HasDegree d) (hd : 1 ≤ d) :
(c.option no yes).HasDegree d

Every primitive certificate of the bundle has degree d.

theorem Cslib.GenericRAM.Model.NativePrimitives.HasDegree.mono {M : Model} {enc : M.Encoding} {N : M.NativePrimitives enc} {d d' : ℕ} (h : N.HasDegree d) (hd : d ≤ d') :

Raising the degree of a primitive bundle keeps the bound.