I am trying to prove the following lemma.
Inductive bool : Type :=
| true
| false.
Lemma andb_true_iff : forall b1 b2 : bool,
b1 && b2 = true <-> b1 = true /\ b2 = true.
Proof.
intros.
split.
- intros. split.
+ destruct b1.
* reflexivity.
* discriminate.
+ destruct b2.
* reflexivity.
* simpl.
And now I get
1 goal
b1 : bool
H : b1 && false = true
______________________________________(1/1)
false = true
This is very absurd, since false = true is never True. However, I can't discriminate this goal.
OK, maybe we should prove H to be False, which is exact false = true. We can't reject to prove a goal which we believe to be False. However, why can't I even rewrite this goal to False? Is it because we have not proved it yet? So I prove the following
Lemma false_true: (false = true) -> False.
Proof.
intros.
simpl in H.
discriminate H.
Qed.
And seems the Lemma false_true can't be applied to this goal. Instead, I know I can write the following lemma to perform a rewrite
Lemma false_true2: (false = true) = False.
Proof. Admitted.
However, I think false_true and false_true2 are somehow very similar. Is there any way that instead of rewrite by false_true2, we can just apply false_true?
Or must I write the following to apply?
Lemma false_true3: False -> (false = true).
Proof.
intros.
destruct H.
Qed.
== NOTE ==
I have solved this problem by destructing b1 either. However, I want to know is there any way to resolve false = true, since it looks weird to me.
If you have something that you cannot prove in the goal, but contradictions in the assumptions, such as False, then you can just ignore the goal, and use the contradictions, because "ex falso quodlibet", from False follows anything.
In Coq's logic, falsehood is usually represented as assuming that you have a value from an empty set, a value that cannot possibly be created, or that two values with different constructors are the same (the latter is false because constructors are defined to be injective).
The proof is usually done by considering the cases that could have caused those (impossible) values end up as assumptions, and since there are zero ways for that, you dont have any cases to consider, and the goal is proved.
For example, if you have a term
H : Falsein your assumptions you can just dodestruct H. If you havefalse = true(which are two different constructors of values of typebool) then you can useinversion.Also check out How to prove False from obviously contradictory assumptions and How do I prove false from a false hypothesis?
By the way, note that
false(a value) is not the same asFalse(a type or proposition),and it is not possible to prove
(false = true) = False. However you can provefalse = true <-> False.