Rational hitting lists: list procedures #
Adapted from OpenAI's formalization at revision adc7f1241b42e322a6451854ab7e4b4c146bf78a.
Source: https://github.com/openai/math/blob/adc7f1241b42e322a6451854ab7e4b4c146bf78a/lean/OAI/Computability/RationalHitting/ListProcedures.lean
Imports, namespaces, module visibility, documentation, and formatting are adapted for complexitylib. The source theorem statements and mathematical arguments are retained.
Append an empty list component to a coded value.
Equations
- One or more equations did not get rendered due to their size.
Instances For
theorem
Complexity.RationalHitting.StackLanguage.Feasible.listEmpty
{A : Type}
(ca : A → List Bool)
:
Count record delimiters, skipping both the escape bit and payload bit.
Equations
- Complexity.RationalHitting.StackLanguage.recordCount [] = 0
- Complexity.RationalHitting.StackLanguage.recordCount (true :: w) = Complexity.RationalHitting.StackLanguage.recordCount w + 1
- Complexity.RationalHitting.StackLanguage.recordCount [false] = 0
- Complexity.RationalHitting.StackLanguage.recordCount (false :: head :: w) = Complexity.RationalHitting.StackLanguage.recordCount w
Instances For
@[simp]
Consume one encoded record and increment a unary length counter.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Count all records in an encoded list.
Equations
Instances For
theorem
Complexity.RationalHitting.StackLanguage.drop_both_left
(w v : List Bool)
:
Eval (Program.drop 0) (both 0 1 w v) (both 0 1 w.tail v) 1
theorem
Complexity.RationalHitting.StackLanguage.push_both_right
(w v : List Bool)
(b : Bool)
:
Eval (Program.push 1 b) (both 0 1 w v) (both 0 1 w (b :: v)) 1
theorem
Complexity.RationalHitting.StackLanguage.eval_countRecords
(w v : List Bool)
:
∃ t ≤ 5 * w.length + 1, Eval countRecords (both 0 1 w v) (single 1 (unaryCode (recordCount w) ++ v)) t
theorem
Complexity.RationalHitting.StackLanguage.recordCount_listCode
{A : Type}
(ca : A → List Bool)
(l : List A)
:
A polynomially bounded procedure computing encoded list length in unary.
Equations
- One or more equations did not get rendered due to their size.