def cat_eq
import bendtorch@1.3.0.0/tensor.bend as Tensorimport Base
563# a and b have the same rank, and the same sizes on every axis but d
564def cat_eq(a: List<&2, Nat>, b: List<&2, Nat>, d: Nat) -> Bool:
565 match a b d:
566 case Nil{} Nil{} _:
567 True{}
568 case Con{x, ra} Con{y, rb} 0n:
569 same(ra, rb)
570 case Con{+x, ra} Con{+y, rb} 1n+p:
571 # 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
572 Bool.and(Nat.is_eq(x, y), cat_eq(ra, rb, p))
573 case _ _ _:
574 False{}