我有一个场景,我想证明一个包含许多字符串和列表变量的引理。可能它需要“归纳”,但任何人都可以帮助我证明下面给出的引理。如果需要其余的代码,我也可以提供。
Definition DLVRI (IA IT : string)
(FA ICL FCL IUL FUL FTL : strlist) : bool :=
match (TestA IA FA),
(TestC ICL FCL),
(TestD IT IUL FUL FTL) with
| true, true, true => true
| _ , _ , _ => false
end.
(**
Lemma TestDL : forall (IA IT : string),
forall (FA ICL FCL IUL FUL FTL : strlist),
(TestA IA FA) = true /\
(TestC ICL FCL) = true /\
(TestD IT IUL FUL FTL) = true.
Proof.
*)
(* OR *)
Lemma TestDL : forall (IA IT : string),
forall (FA ICL FCL IUL FUL FTL : strlist),
(TestA IA FA) = true /\
(TestC ICL FCL) = true /\
(TestD IT IUL FUL FTL) = true
-> DLVRI IA IT FA ICL FCL IUL FUL FTL = true.
答案 0 :(得分:0)
以下是一个片段,展示了如何解决类似目标。
Require Import String.
Parameter TestA: string -> list string -> bool.
Parameter TestC: list string -> list string -> bool.
Parameter TestD: string -> list string -> list string -> list string -> bool.
Definition DLVRI (IA IT : string)
(FA ICL FCL IUL FUL FTL : list string) : bool :=
match (TestA IA FA), (TestC ICL FCL), (TestD IT IUL FUL FTL) with
| true, true, true => true
| _ , _ , _ => false
end.
Lemma TestDL:
forall
(IA IT : string)
(FA ICL FCL IUL FUL FTL : list string),
TestA IA FA = true ->
TestC ICL FCL = true ->
TestD IT IUL FUL FTL = true ->
DLVRI IA IT FA ICL FCL IUL FUL FTL = true.
Proof.
intros ???????? TA TC TD. unfold DLVRI. rewrite TA, TC, TD. reflexivity.
Qed.
这是一个非常简单的证据:展开DLVRI的定义,并用假设重写。
没有我用三个假设代替假设(TestA IA FA) = true /\ (TestC ICL FCL) = true /\ (TestD IT IUL FUL FTL) = true
。如果您不希望这样做,则证明变为:
intros ???????? HYP. destruct HYP as [TA [TC TD]]. unfold DLVRI. rewrite TA, TC, TD. reflexivity.
然而,除非你经常操纵这样的结合,否则将我的假设分开可能是更好的风格。否则,连词会妨碍证明,你总是要破坏/构造它们。