0
$\begingroup$

How do I prove the following trivial theorem?

Theorem hmm : forall {A:Type} (b:bool) (x:A),
  (if b then Some x else None) = None -> b = false.
Proof.
intros A b x H.
inversion H. (* duplicates the hypothesis? *)
Fail assumption.
Admitted

I was expecting inversion H to infer that b = false, but instead it duplicates the hypothesis.

$\endgroup$

1 Answer 1

1
$\begingroup$

You must first do a proof by cases on b

Theorem hmm : forall {A:Type} (b:bool) (x:A),
  (if b then Some x else None) = None -> b = false.
Proof.
intros A b x H.
destruct b.
- inversion H.
- trivial.
Qed.
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.