comparison_tree_finds_guaranteed_rollercoaster
A comparison decision tree T on n elements correctly finds a guaranteed-length k-rollercoaster if for every permutation σ of Fin n, the index subsequence returned by evaluating T on σ is a valid guaranteed-length k-rollercoaster.
Statement
def comparison_tree_finds_guaranteed_rollercoaster (k n : ℕ) (T : ComparisonDecisionTree n (List (Fin n))) : Prop
- Defined in
- arXiv:2611.26297 Sec. 4
- Verified
- 22 Nov 2026
- Axioms
- none listed
- Built on 3
- comparison_decision_tree_evalEvaluation of a comparison decision tree on an input sequence v : Fin n → α over a linear order α, branching left if v i < v j and right…
- is_valid_guaranteed_rollercoasterA strictly increasing list of indices ans is a valid guaranteed-length k-rollercoaster for a sequence v of length n if its length is at…
- ComparisonDecisionTreeA binary comparison decision tree on n elements whose leaves return a value of type β.
Read back from the Lean
The declaration comparison_tree_finds_guaranteed_rollercoaster k n T asserts that for every permutation σ of Fin n, evaluating the comparison decision tree T on σ (branching left at a node comparing indices i and j if σ i < σ j, and right otherwise) produces a list of indices ans : List (Fin n) such that:
1. ans is strictly increasing under the standard ordering on Fin n (i.e., ans.Pairwise (· < ·));
2. The length of ans is at least guaranteed_rollercoaster_length k n;
3. If guaranteed_rollercoaster_length k n > 0, then the sequence of values ans.map σ is a k-rollercoaster.
Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.
Lean source view module on GitHub
/-- A comparison tree finds a guaranteed k-rollercoaster if it outputs a valid guaranteed subsequence for every permutation. -/ def comparison_tree_finds_guaranteed_rollercoaster (k n : ℕ) (T : ComparisonDecisionTree n (List (Fin n))) : Prop := ∀ σ : Equiv.Perm (Fin n), is_valid_guaranteed_rollercoaster k n (fun i => σ i) (comparison_decision_tree_eval (fun i => σ i) T)