Skip to content

Commit 5ed721a

Browse files
committed
Render the code snippet working
1 parent f2b6c24 commit 5ed721a

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

posts/how-to-write-a-simproc.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,9 @@ Often, when applying a theorem, we may need to provide additional proof terms fo
336336
In the following example, we implement a simproc that simplifies expressions of the form `(a * b).factorization ` to `a.factorization + b.factorization` whenever a proof that `a` and `b` are both non-zero can be found by the discharger.
337337

338338
```lean
339-
open Qq
339+
import Mathlib
340+
341+
open Qq Lean.Meta.Simp
340342
341343
simproc_decl factorizationMul (Nat.factorization (_ * _)) := fun e => do
342344
let ⟨1, ~q(ℕ →₀ ℕ), ~q(Nat.factorization ($a * $b))⟩ ← inferTypeQ e | return .continue
@@ -353,14 +355,10 @@ simproc_decl factorizationMul (Nat.factorization (_ * _)) := fun e => do
353355
return .visit { expr := e', proof? := pf }
354356
355357
set_option trace.Meta.Tactic.simp true in
356-
example : Nat.factorization (2 * 3) = Nat.factorization 2 + Nat.factorization 3 := by
357-
/-
358-
[Meta.Tactic.simp.rewrite] eq_self:1000:
359-
Nat.factorization 2 + Nat.factorization 3 = Nat.factorization 2 + Nat.factorization 3
360-
==>
361-
True
362-
-/
358+
example : Nat.factorization (2 * 3) = fun₀ | 2 => 1 | 3 => 1 := by
363359
simp (disch := decide) only [factorizationMul]
360+
guard_target = Nat.factorization 2 + Nat.factorization 3 = fun₀ | 2 => 1 | 3 => 1
361+
sorry
364362
```
365363

366364
<span style="color:red">**TODO(Paul)**</span>

0 commit comments

Comments
 (0)