Apply this tactic to a goal via Pantograph.
(self, goal: Goal)
| 83 | self._name = name |
| 84 | |
| 85 | def apply(self, goal: Goal) -> ApplyResult: |
| 86 | """Apply this tactic to a goal via Pantograph.""" |
| 87 | expr = goal.as_expr() |
| 88 | k = _get_kernel() |
| 89 | lib = k._lib |
| 90 | |
| 91 | ast = _wrap_free_vars(expr) |
| 92 | z3_expr = _marshal_expr(lib, ast) |
| 93 | lean_expr = lib.z3_compile(z3_expr) |
| 94 | gs = k.goal_create_expr(lean_expr) |
| 95 | |
| 96 | result = gs.try_tactic(self._name) |
| 97 | if result.ok and result.state is not None and result.state.is_solved(): |
| 98 | return ApplyResult([]) # proved |
| 99 | # Tactic produced subgoals or failed |
| 100 | return ApplyResult([goal]) # unchanged |
| 101 | |
| 102 | def solver(self): |
| 103 | """Create a Solver that uses this tactic.""" |