I have simplified my situation to the following piece of code, hopefully this makes it easier to understand.
I would like to prove the following Lemma:
Require Import Arith.
Lemma example: forall a b,
if a<=?b then a<=b else a > b.
Doing the following step in the proof
Proof.
intros.
Gives me the result
1 subgoal
a, b : nat
______________________________________(1/1)
if a <=? b then a <= b else a > b
It seems trivial that either a
is smaller than or equal to b
, in which case I could prove a<=b
. In the other case that b
is larger than a
I could prove that a>b
.
I've tried to prove this with induction(a<=?b)
or case (a<=?b)
but both give me the following result.
2 subgoals
a, b : nat
______________________________________(1/2)
a <= b
______________________________________(2/2)
a > b
Now I have no way to prove these goals. I expected to gain an hypothesis such as H: a <= b
and H: a > b
in the second case. This way, I would be able to prove my goals.
Could anybody tell me how I could this issue of the non-appearing hypothesis?
Edit: The whole lemma can be proven as follows:
Require Import Arith.
Lemma example: forall a b,
if a<=?b then a<=b else a > b.
Proof.
intros.
Check Nat.leb_spec.
case (Nat.leb_spec a b);intuition.