从Coq中的记录类型获取字段

从Coq中的记录类型获取字段,coq,coq-tactic,coqide,Coq,Coq Tactic,Coqide,我是Coq的新手。 我有一个记录类型和一个定义: Record t : Type := T { width : nat; }. Definition indent shift f := match f with | T w => T (w + shift) end. 我想证明一个平凡的引理: Lemma lemma : forall (a:t) n, width a <= width (indent n a). 如何简化术语?解构

我是Coq的新手。 我有一个记录类型和一个定义:

Record t : Type := T {
  width           : nat;
}.

Definition indent shift f :=
  match f with
  | T w => T
    (w + shift)
  end.
我想证明一个平凡的引理:

Lemma lemma :
  forall (a:t) n, width a <= width (indent n a).
如何简化术语?

解构a。简单


在该归纳之后。

使用不同的定义,
siml
将完成以下工作:

Definition indent shift f := T (f.(width) + shift).

当您看到带有
的术语时,请将其与匹配。。。结束
在它中,您可以通过执行析构函数a来简化它。另外,如果你需要去除
让a:=b进入…
如果你需要记住
a
是什么,那么使用
归纳法
销毁a方程:Ha

在这里是不正确的;应该使用
Nat.le\u add\r
引理,或者在最坏的情况下,应该调用一些算术过程。
Definition indent shift f := T (f.(width) + shift).