Insert into a sorted list, returning `None` if already present.
(a: u64, list: &[u64])
| 352 | |
| 353 | /// Insert `(idx, k)` into the var list at `path`, taking the max of offsets |
| 354 | /// when `idx` is already present. Mirrors Lean4Lean's |
| 355 | /// `NormLevel.addNode v k path'` (`refs/lean4lean/Lean4Lean/Level.lean:92`); |
| 356 | /// `k` must be the current succ-accumulator from `normalize_aux`. |
| 357 | /// |
| 358 | /// An earlier port of this function dropped `k` and always inserted |
| 359 | /// `(idx, 0)`, which silently mis-normalized `Succ^n(imax(u, Param v))` |
| 360 | /// shapes for `n > 0`. Keep the `k` parameter. |
| 361 | fn norm_add_node(s: &mut NormLevel, idx: u64, k: u64, path: &[u64]) { |
| 362 | s.entry(path.to_vec()).or_default().add_var(idx, k); |
| 363 | } |
| 364 | |
| 365 | fn norm_add_const(s: &mut NormLevel, k: u64, path: &[u64]) { |
| 366 | if k == 0 || (k == 1 && !path.is_empty()) { |
no test coverage detected