I just finished the exercises in here: https://softwarefoundations.cis.upenn.edu/lf-current/Basics.html; however I came up with 2 different proofs for following exercise https://softwarefoundations.cis.upenn.edu/lf-current/Basics.html#andb_true_elim2, and i would like to know
- is my first attempt is completely non-sensical? While it works, it requires introducing hypothesis
H : b && false = truewhich is obviously wrong. How come I am not stopped from introducing such statement?
Definition andb (b1:bool) (b2:bool) : bool :=
match b1 with
| true => b2
| false => false
end.
Theorem andb_true_elim2 : forall b c : bool,
andb b c = true -> c = true.
Proof.
intros b c.
destruct c.
reflexivity.
intro H.
rewrite <- H.
destruct b.
reflexivity.
reflexivity.
Qed.
- second attempt: No dubious hypothesis, and works.
Theorem andb_true_elim2 : forall b c : bool,
andb b c = true -> c = true.
Proof.
intros b c.
destruct b eqn:Eb.
intro H.
rewrite <- H.
reflexivity.
destruct c.
reflexivity.
discriminate.
Qed.
Since Coq is happy with both proofs, they are equally good (I doubt this)?