"failed to synthesize type class instance" 重写子证明

"failed to synthesize type class instance" in rewrite subproof

下面的代码验证失败 “无法合成类型 class 实例... ⊢ has_pow R R.

这看起来很奇怪,因为我在封闭范围内的相同类型上使用了相同的运算符 (^),而且没有问题!第二个定理,具有相同的签名,类型检查很好。

为什么它只在重写内部失败?如何在不更改定理类型签名的情况下修复它?

import algebra.group_power

theorem pow_eq_zero_1 {R : Type} [domain R] {r : R} {n : ℕ} : r ^ (n + 1) = 0 → r = 0
:= begin
  rw (show r ^ (n + 1) = r ^ n * r,
      by { have rn := λ x : R, r ^ x,
           sorry, }),
  sorry,
end

theorem pow_eq_zero_2  {R : Type} [domain R] {r : R} {n : ℕ} : r ^ (n + 1) = 0 → r = 0
:= pow_eq_zero  -- it's in mathlib

它失败了,因为你试图将 r^xx : R 一起使用,但你需要 x : ℕ 才能工作。