Module Tolk_uop.Divandmod

Integer division and modulo simplification.

Pattern matcher that folds expressions built from Ops.t.Floordiv and Ops.t.Floormod. Rewrites preserve Python-style floor division and modulo semantics and run before these ops lower to truncating division and modulo.

Matcher

val div_and_mod_symbolic : Upat.Pattern_matcher.t

div_and_mod_symbolic bundles the div/mod simplification rules into a single Upat.Pattern_matcher. It raises Division_by_zero when the denominator is provably zero; unsupported or ambiguous cases are left unchanged.