lean2/tests/lean/extra/show_goal.lean
Leonardo de Moura 42fbc63bb6 fix(library/tc_multigraph): avoid name collisions
@avigad, @fpvandoorn, @rlewis1988, @dselsam

I changed how transitive instances are named.
The motivation is to avoid a naming collision problem found by Daniel.
Before this commit, we were getting an error on the following file
tests/lean/run/collision_bug.lean.

Now, transitive instances contain the prefix "_trans_".
It makes it clear this is an internal definition and it should not be used
by users.

This change also demonstrates (again) how the `rewrite` tactic is
fragile. The problem is that the matching procedure used by it has
very little support for solving matching constraints that involving type
class instances. Eventually, we will need to reimplement `rewrite`
using the new unification procedure used in blast.

In the meantime, the workaround is to use `krewrite` (as usual).
2016-02-04 13:15:42 -08:00

25 lines
570 B
Text

import data.nat
open nat algebra
example (a b c d : nat) : a + b = 0 → b = 0 → c + 1 + a = 1 → d = c - 1 → d = 0 :=
begin
intro h₁ h₂,
have aeq0 : a = 0, begin
rewrite h₂ at h₁,
exact h₁
end,
intro h₃ h₄,
have deq0 : d = 0, begin
have ceq : c = 0, begin
rewrite aeq0 at h₃,
rewrite add_zero at h₃,
krewrite add_succ at h₃,
krewrite add_zero at h₃,
injection h₃, exact a_1
end,
rewrite ceq at h₄,
repeat (esimp [sub, pred] at h₄),
exact h₄
end,
exact deq0
end