12

有什么类似s的策略simplProgram Fixpoint

特别是,如何证明以下琐碎的陈述?

Program Fixpoint bla (n:nat) {measure n} :=
match n with
| 0 => 0
| S n' => S (bla n')
end.

Lemma obvious: forall n, bla n = n. 
induction n. reflexivity.
(* I'm stuck here. For a normal fixpoint, I could for instance use 
simpl. rewrite IHn. reflexivity. But here, I couldn't find a tactic 
transforming bla (S n) to S (bla n).*)

显然,这个玩具示例没有Program Fixpoint必要,但我在更复杂的设置中面临同样的问题,我需要证明Program Fixpoint手动终止。

4

1 回答 1

7

我不习惯使用,Program所以可能有更好的解决方案,但这是我通过展开得出的bla,看到它是使用内部定义Fix_sub的,并通过使用查看关于该函数的定理SearchAbout Fix_sub

Lemma obvious: forall n, bla n = n.
Proof.
intro n ; induction n.
 reflexivity.
 unfold bla ; rewrite fix_sub_eq ; simpl ; fold (bla n).
 rewrite IHn ; reflexivity.

(* This can probably be automated using Ltac *)
 intros x f g Heq.
  destruct x.
  reflexivity.
  f_equal ; apply Heq.
Qed.

在您的实际示例中,您可能希望引入归约引理,这样您就不必每次都做同样的工作。例如:

Lemma blaS_red : forall n, bla (S n) = S (bla n).
Proof.
intro n.
 unfold bla ; rewrite fix_sub_eq ; simpl ; fold (bla n).
 reflexivity.

(* This can probably be automated using Ltac *)
 intros x f g Heq.
  destruct x.
  reflexivity.
  f_equal ; apply Heq.
Qed.

这样,下次你有一个bla (S _),你可以简单的rewrite blaS_red

于 2016-03-31T11:32:41.900 回答