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

时间:2019-12-29 09:38:35

标签: 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).

展开indent子目标后变为:

(width a <= width match a with
                   | {| width := w |} => {| width := w + n |}
                   end)

如何简化术语?

3 个答案:

答案 0 :(得分:0)

破坏简单。

那次归纳之后。

答案 1 :(得分:0)

使用其他定义,simpl将完成工作:

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

答案 2 :(得分:0)

当您看到其中带有match a with ... end的术语时,可以通过执行destruct a来简化它。另外,如果您需要摆脱let a := b in ...,并且需要记住a是什么,请执行destruct a eqn:Ha