word_proj
The projection of a word under a binary mask keeps only the letters at positions where the mask equals a given target boolean.
Statement
def word_proj {α : Type*} (target : Bool) : List α → List Bool → List α
- Defined in
- arXiv:2610.39941, Section 3
- Verified
- 31 Oct 2026
- Axioms
- none listed
- Used by 3
- is_word_maskA binary mask of a word with respect to sources u and v has the same length as the word and projects to u on true and to v on false.
- word_block_exchange_is_commutingA mask N of XBAY is commuting for exchange E if its U-projections and V-projections on the exchanged blocks satisfy A_U B_U = B_U A_U and…
- word_block_exchange_transport_back_is_mask_iffFor an exchange E and a mask N satisfying is_word_mask u v (word_block_exchange_after E) N, the backward-transported mask…
Read back from the Lean
For any type α and boolean target : Bool, word_proj target is a function taking a list of elements of α and a list of booleans, returning a list of elements of α. It is defined by recursion on the two lists:
- If either list is empty, it returns the empty list [].
- If the first list is x :: xs and the second list is b :: bs, then if b == target it returns x :: word_proj target xs bs; otherwise, it returns word_proj target xs bs.
In other words, it retains the elements of the first list at positions where the corresponding element of the second list equals target, stopping when either list is exhausted.
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
/-- Projection of a word onto the positions where the binary mask equals target. -/ def word_proj {α : Type*} (target : Bool) : List α → List Bool → List α | [], _ => [] | _, [] => [] | x :: xs, b :: bs => if b == target then x :: word_proj target xs bs else word_proj target xs bs