考慮以下發展:勒柯克:毀滅(共)歸納假設,而不會丟失信息
Require Import Relation RelationClasses.
Set Implicit Arguments.
CoInductive stream (A : Type) : Type :=
| scons : A -> stream A -> stream A.
CoInductive stream_le (A : Type) {eqA R : relation A}
`{PO : PartialOrder A eqA R} :
stream A -> stream A -> Prop :=
| le_step : forall h1 h2 t1 t2, R h1 h2 ->
(eqA h1 h2 -> stream_le t1 t2) ->
stream_le (scons h1 t1) (scons h2 t2).
如果我有一個假設stream_le (scons h1 t1) (scons h2 t2)
,這將是合理的destruct
戰術把它變成一對假說R h1 h2
的和eqA h1 h2 -> stream_le t1 t2
。但這不是什麼情況,因爲destruct
每當做任何不重要的事情都會丟失信息。相反,新術語h0
,h3
,t0
,t3
被引入到上下文中,但不記得它們分別等於h1
,h2
,t1
,t2
。
我想知道是否有快速簡單的方法來做這種「智能destruct
」。這是我現在所擁有的:
Theorem stream_le_destruct : forall (A : Type) eqA R
`{PO : PartialOrder A eqA R} (h1 h2 : A) (t1 t2 : stream A),
stream_le (scons h1 t1) (scons h2 t2) ->
R h1 h2 /\ (eqA h1 h2 -> stream_le t1 t2).
Proof.
intros.
destruct H eqn:Heq.
remember (scons h1 t1) as s1 eqn:Heqs1;
remember (scons h2 t2) as s2 eqn:Heqs2;
destruct H;
inversion Heqs1; subst; clear Heqs1;
inversion Heqs2; subst; clear Heqs2.
split; assumption.
Qed.
不錯的答案,我upvoted。恭喜擊中3K的方式。 – EJoshuaS