让“auto”执行案例分析的惯用方法是什么?

时间:2018-01-07 16:11:00

标签: coq coq-tactic

Inductive Foo : nat -> Type :=
  | a : Foo 1.

(* ... *)

Goal forall m, Foo m -> m = 1.
Proof.
  auto.
Fail Qed.

这样做有直接的方法吗?

2 个答案:

答案 0 :(得分:2)

您可以将Hint Extern与执行案例分析的策略脚本一起使用。例如,如果参数是变量,那么这个将使用destruct,否则使用inversion_clear

Inductive Foo : nat -> Type :=
| a : Foo 1.

Hint Extern 1 => match goal with
                 | [ H : Foo ?m |- _ ]
                   => first [ is_var m; destruct H | inversion_clear H ]
                 end.

Goal forall m, Foo m -> m = 1.
Proof.
  auto.
Qed.

答案 1 :(得分:1)

通过编程语言基础,第Theory and Practice of Automation in Coq Proofs章:

  

请注意,证明搜索策略从不执行任何重写步骤(策略rewritesubst),也不执行任意数据结构或属性的任何案例分析(策略destruct和{{1 }}),也没有任何归纳证明(战术inversion)。因此,证明搜索真正旨在自动化证明的各个分支的最终步骤。它无法发现证明的整体结构。

所以真的没办法做到这一点;这个目标应该手动解决,然后添加到提示数据库(induction)。

相关问题