这是我在此练习的进展:https://github.com/userhr/MIT-6.826-2017
(** **** Exercise: 2 stars (andb_true_elim2) *)
(** Prove the following claim, marking cases (and subcases) with
bullets when you use [destruct]. *)
Theorem andb_true_elim2 : forall b c : bool,
andb b c = true -> c = true.
Proof.
intros c.
(** Prove anything && false == false. *)
assert (forall x : bool, andb x false = false) as H.
destruct x.
-reflexivity.
-reflexivity.
(** Obviously true at this point since we have shown that no
matter what, andb b c will be false if one of them is
false. My idea is to use H to show that if it is to be
true, than both arguments must be true.
*)
Qed.
我之所以有必要表明(forall x : bool, andb x false = false)
是因为我无法通过证明(forall a b : bool, andb a b = true -> a = true, b = true)
答案 0 :(得分:0)
我已经在https://github.com/hckkid/sfsol
托管了大多数软件基础问题的解决方案至于这个特定的练习,请参考https://github.com/hckkid/sfsol/blob/master/Chap1.v#L385
自从我解决了软件基础以来,章节发生了变化。
此代码段是
Theorem andb_true_elim2 : forall b c : bool,
andb b c = true -> c = true.
Proof.
intros b c H.
destruct c.
Case "c = true".
reflexivity.
Case "c = false".
rewrite <- H.
destruct b.
SCase "b = true".
reflexivity.
SCase "b = false".
reflexivity.
Qed.