MCPcopy Create free account
hub / github.com/BasisResearch/lean.py / _verify_expr

Function _verify_expr

examples/06_effectful_verifier/python/refine.py:242–255  ·  view source on GitHub ↗

Create a goal from a ``Lean.Expr`` and close it. Uses ``simp [Int.ofNat]`` to normalise the fully-elaborated Int literals before ``omega`` decides the linear arithmetic.

(lib, kernel, lean_expr)

Source from the content-addressed store, hash-verified

240
241
242def _verify_expr(lib, kernel, lean_expr) -> bool:
243 """Create a goal from a ``Lean.Expr`` and close it.
244
245 Uses ``simp [Int.ofNat]`` to normalise the fully-elaborated Int
246 literals before ``omega`` decides the linear arithmetic.
247 """
248 try:
249 gs_handle = lib.effectful_goal_from_expr(lean_expr)
250 gs = GoalState(kernel, gs_handle)
251 result = gs.try_tactic("intros; simp [Int.ofNat] at *; omega")
252 return result.ok and result.state is not None and result.state.is_solved()
253 except Exception as exc:
254 print(f" [verify error: {exc}]")
255 return False

Callers 1

verify_functionFunction · 0.85

Calls 3

try_tacticMethod · 0.95
GoalStateClass · 0.90
is_solvedMethod · 0.80

Tested by

no test coverage detected