[英]What does IH cannot be used as a hint. in Coq mean when using eauto giving it the induction hypothesis directly?
看到相關問題Lemma 不能用作提示,但似乎不是超級有用 + 似乎更好地向那里的海報提出不相關問題的新問題。 我試着做簡單的引理:
From mathcomp Require Import all_ssreflect.
Require Import ZArith.
From Hammer Require Import Tactics.
From Hammer Require Import Hammer.
Theorem n_plus_0_eq_n_sketch1:
forall n:nat,
n + 0 = n.
Proof.
have IH: forall P : nat -> Prop, P 0 -> (forall n : nat, P n -> P n.+1) -> forall n : nat, P n. by apply nat_ind. (* succeeds *)
(* close target with guessed lemmas **)
(* by sauto use: IH. *) (* fails *)
by eauto using IH. (* Gives error, IH cannot be used as a hint. *)
但是eauto
策略給出了錯誤:
IH cannot be used as a hint.
這是為什么? 我給它的引理有什么問題?
我已經在其他情況下使用過它,所以我很困惑:
Theorem add_comm_eauto_using:
forall n m: nat,
n + m = m + n.
Proof.
intros.
assert (H: forall n, n + 0 = n) by eauto using n_plus_zero_eq_n.
assert (H': forall n m, S (n + m) = n + S m) by eauto using Sn_plus_m_eq_n_plus_Sm.
induction n.
- eauto using H, H'.
-
(* auto using IHn, H, H'. *)
simpl.
(* auto using IHn, H, H'. *)
rewrite IHn.
auto using H, H'.
Qed.
它是關於 eauto 如何無法統一目標和我的引理之類的一些細節嗎?
參考:
eauto
通過匹配頭部符號來工作。 不幸的是IH
的頭部符號是一個變量P
所以這就是你得到錯誤的原因(見這里)
這被接受但沒有解決目標
have IH1 := IH (fun n => n + 0 = n).
eauto using IH1.
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.