)]}'
{
  "commit": "64e3938faa77de9306b09648b13d820fc020d597",
  "tree": "656bba45f5165a14c73c232f2001034f5842055f",
  "parents": [
    "9981b66f87c0705b2123de637454603c46823da9"
  ],
  "author": {
    "name": "Leonardo de Moura",
    "email": "leomoura@amazon.com",
    "time": "Wed Oct 21 15:52:44 2026 +0000"
  },
  "committer": {
    "name": "Leonardo de Moura",
    "email": "leomoura@amazon.com",
    "time": "Wed Oct 21 15:52:44 2026 +0000"
  },
  "message": "fix: `grind` order solver internalizing an in-progress `Nat` cast\n\nThis PR fixes the `grind.debug` internal error \"`internalize` reached an application whose arguments are still being internalized\" on casts such as `((n - m : Nat) : Int)`.\n\nThe order solver translated `Nat` terms to `Int` before checking for a forbidden parent. For `n - m` under `↑(n - m)`, the translation built and internalized `↑(n - m)`, which was still being internalized. `Order.internalize` now checks `isForbiddenParent` first.\n\nThose translations were also how the order solver mapped nodes such as `↑a + ↑b` (from `a + b ≤ c`) back to `Nat` terms such as `a + b`. `mkNode` now computes this map on demand: `toNatTerm?` inverts `natToInt`, and the candidate is used only if it is internalized and `natToInt` translates it to the node. This also maps nodes the old code missed (e.g., `2 * ↑a`), which changes the expected output of `grind_lint_1` and `grind_cutsat_toint_1`.\n\nCloses #15621\n\nCo-Authored-By: Claude Opus 5.5 \u003cnoreply@anthropic.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "fed5307e77dafbc437a79f6c9a5803495764c64a",
      "old_mode": 33188,
      "old_path": "src/Lean/Expr.lean",
      "new_id": "a77685269828154012e17e5de6c3ca28e0e1c0ca",
      "new_mode": 33188,
      "new_path": "src/Lean/Expr.lean"
    },
    {
      "type": "modify",
      "old_id": "9142f7290234872fc791904f8ce2bb36964c299c",
      "old_mode": 33188,
      "old_path": "src/Lean/Meta/Tactic/Grind/Homomorphism.lean",
      "new_id": "1c87698037483b30f6fa0877c623c1668a145cce",
      "new_mode": 33188,
      "new_path": "src/Lean/Meta/Tactic/Grind/Homomorphism.lean"
    },
    {
      "type": "modify",
      "old_id": "9a18308ae294572365a0be23eea147bd23007b81",
      "old_mode": 33188,
      "old_path": "src/Lean/Meta/Tactic/Grind/Order/Internalize.lean",
      "new_id": "84ff59006bc244141198baf23a298061e5db404e",
      "new_mode": 33188,
      "new_path": "src/Lean/Meta/Tactic/Grind/Order/Internalize.lean"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "2a3b6492db26958d297207a3923e1bb633ce7284",
      "new_mode": 33188,
      "new_path": "tests/elab/grind_15621.lean"
    },
    {
      "type": "modify",
      "old_id": "0a84b8d02de85c7cd22d8a4f6e08222758864bb0",
      "old_mode": 33188,
      "old_path": "tests/elab/grind_cutsat_toint_1.lean",
      "new_id": "464b8256c73315018eb47cb99b68c8b3fa4e26a9",
      "new_mode": 33188,
      "new_path": "tests/elab/grind_cutsat_toint_1.lean"
    },
    {
      "type": "modify",
      "old_id": "b3fa0584901d667511a739f180d5b4e91f2ee185",
      "old_mode": 33188,
      "old_path": "tests/elab/grind_lint_1.lean",
      "new_id": "a49488ac7db1188180a8cfcaff549690ac51f848",
      "new_mode": 33188,
      "new_path": "tests/elab/grind_lint_1.lean"
    }
  ]
}
