List operations with bounds of given degrees #
Operations on lists encoded by Turing.MultiTapeTM.encList, with explicit degrees
(Turing.MultiTapeTM.ComputableTidilyInDegree): adding an element at either end and concatenation
in linear time; finding the first element that passes a test and keeping the elements that pass a
test, one degree above the test. The tests may depend on a parameter.
Main results #
Turing.MultiTapeTM.ComputableTidilyInDegree.cons,.snoc,.listAppend.Turing.MultiTapeTM.ComputableTidilyInDegree.findWith: the first element passing a test.Turing.MultiTapeTM.ComputableTidilyInDegree.filterWith: the elements passing a test.
Finding and filtering #
theorem Turing.MultiTapeTM.ComputableTidilyInDegree.findWith {α γ : Type} {encIn : γ ↪ List Bool} {π : Type} {encP : π ↪ List Bool} {enc : α ↪ List Bool} {dt et dP eP dL : ℕ} {t : π × α → Bool} {par : γ → π} {list : γ → List α} (ht : ComputableTidilyInDegree t (encPair encP enc) encBool dt et) (hpar : ComputableTidilyInDegree par encIn encP dP eP) (hlist : ComputableTidilyInDegree list encIn (encList enc) dL 1) :
The first element of list x passing the test t with the parameter par x, for a list of
linear size.
theorem Turing.MultiTapeTM.ComputableTidilyInDegree.foldl_filterStep {α π : Type} (t : π × α → Bool) (p : π) (l acc : List α) :
theorem Turing.MultiTapeTM.ComputableTidilyInDegree.filterWith {α γ : Type} {encIn : γ ↪ List Bool} {π : Type} {encP : π ↪ List Bool} {enc : α ↪ List Bool} {dt et dP eP dL : ℕ} {t : π × α → Bool} {par : γ → π} {list : γ → List α} (ht : ComputableTidilyInDegree t (encPair encP enc) encBool dt et) (hpar : ComputableTidilyInDegree par encIn encP dP eP) (hlist : ComputableTidilyInDegree list encIn (encList enc) dL 1) :
The elements of list x passing the test t with the parameter par x, for a list of linear
size.
theorem Turing.MultiTapeTM.ComputableTidilyInDegree.mapWith {α γ : Type} {encIn : γ ↪ List Bool} {π : Type} {encP : π ↪ List Bool} {enc : α ↪ List Bool} {dP dL : ℕ} {β : Type} {encB : β ↪ List Bool} {f : π × α → β} {par : γ → π} {list : γ → List α} {df ef : ℕ} (hf : ComputableTidilyInDegree f (encPair encP enc) encB df ef) (hpar : ComputableTidilyInDegree par encIn encP dP 1) (hlist : ComputableTidilyInDegree list encIn (encList enc) dL 1) :
Mapping f with the parameter par x over list x, for a parameter and a list of linear
size.
Arithmetic on unary numbers and integers #
theorem Turing.MultiTapeTM.ComputableTidilyInDegree.int_pos :
ComputableTidilyInDegree (fun (z : ℤ) => decide (0 < z)) encIntUnary encBool 1 0
Whether an integer is positive.
theorem Turing.MultiTapeTM.ComputableTidilyInDegree.int_neg :
ComputableTidilyInDegree (fun (z : ℤ) => decide (z < 0)) encIntUnary encBool 1 1
Whether an integer is negative.
theorem Turing.MultiTapeTM.ComputableTidilyInDegree.replicate {α : Type} (enc : α ↪ List Bool) :
ComputableTidilyInDegree (fun (p : ℕ × α) => List.replicate p.1 p.2) (encPair encUnary enc) (encList enc) 3 2
A list of n copies of an element.