def all_once
import bendtorch@1.3.0.0/tensor.bend as Tensorimport Base
482# every axis 0..n-1 exactly once, from axis i
483def all_once(left: Nat, +p: List<&2, Nat>, +i: Nat) -> Bool:
484 match left:
485 case 0n:
486 True{}
487 case 1n+r:
488 # bend-lint: disable-next bend-lint-rules/performance/eager_branch -- a shape predicate over a list of rank <= 4, once per operation; the types and LAWS.bend read its Bool form not-expected-because: a match would change the definition the proofs reduce, for no measurable gain
489 Bool.and(Nat.is_eq(count(i, p), 1n), all_once(r, p, 1n+i))