Closed soonhokong closed 8 years ago
Having set_option unifier.max_steps 40000
is a solution (but maybe not a good one). Another possibility is to introduce an intermediate step as follows:
import data.nat
open nat eq.ops algebra
example (x y : ℕ) : (x + y) * (x + y) = x * x + y * x + x * y + y * y :=
have H1 : (x + y) * (x + y) = (x + y) * x + (x + y) * y, from (left_distrib (x + y) x y),
have H2 : (x + y) * (x + y) = x * x + y * x + (x + y) * y, from !right_distrib ▸ H1,
have H3 : (x + y) * (x + y) = x * x + y * x + (x * y + y * y), from !right_distrib ▸ H2,
!add.assoc⁻¹ ▸ H3
@avigad @soonhokong I think we should avoid examples that use ▸.
This is an anti-pattern. It generates fragile proofs that are hard to maintain.
In the future, I want to completely disallow terms such as !right_distrib ▸ !right_distrib ▸ H1
.
I know that in Chapter 4, tactics were not introduced yet.
But, we can introduce just the rewrite
tactic.
Another option is to provide the argument to right_distrib
explicitly, and avoid the !
notation.
Closed by d9aa276de23086f70db5065297309e668baaa1a2