Skip to content

Go: three differential failures on random seeds ​

Date: 2026-12-05

Context ​

Several seeds of tests/go/differential failed on main after #374:

  • Seed 193470665: "the operator '/' is not supported". The proved path refused P4F2, so the function went to the legacy translator, which has no /. The proved path refused it because of the statement v83, _ := P4F0(-(v80[:][p0]), "Go", true). #374 refused a slice next to another check when both sat inside the arguments of one call. Seed 103 failed in the same way. gc tests the slice first here too, and the interpreter agrees, so the translator was wrong.
  • Seed 31337: go run failed with "declared and not used". The generator wrote a computed bound for xs[a:], which marked a local as used, and then dropped that bound. The generator was wrong.
  • Seed 110, once the generator changed: p.X = … printed as let p := { p with X := … }, and a later decide (p ≠ p) left Lean with a stuck Decidable instance. Lean did not know the type of p yet. The printer was wrong.

Before this change, seed 110 passed on main. Its earlier failures came from a stale local binary.

Decision ​

  • Pure.slicesFirst keeps only the order rule, which is that a slice and its checks come first and no slice comes later. The mixing rule stays in orderKnown, as before #374: checks inside the arguments of a call, len or append may not be mixed with checks outside them. A slice counts as a check where it sits.
  • The generator keeps the computed bound it wrote. When it writes int(s[i]), it now generates s before i, in printed order, so its count of checks sees the outer index before a slice in i.
  • PrintTy has a new structUpdate method. Its default keeps { b with … }, so TypeScript output is unchanged. Go prints ({ b with … } : type_of% b).

translate_sound is unchanged. The proved path now refuses less, and its proof does not depend on the order rule.

Refused ​

These statements are still refused:

  • a slice inside the arguments of a call, len or append together with a check outside them, or the reverse, such as len(s[2:]) + s[0] or G(t[0], len(s[2:]) > 0).

tests/go/EvalOrder.lean and tests/go/Structs.lean hold the regressions.

This page is docs/decisions/2026-12-05-go-differential-seeds.md at commit 5f1d031.