How can I prove the following statement in Coq?
forall x: nat,
x >= 1 -> 2 * 2 ^ (x - 1) = 2 ^ x.
I found lemma pow_add_r
in module NZPow
but for some reason I canĀ“t use it.
Thanks, Marcus.
How can I prove the following statement in Coq?
forall x: nat,
x >= 1 -> 2 * 2 ^ (x - 1) = 2 ^ x.
I found lemma pow_add_r
in module NZPow
but for some reason I canĀ“t use it.
Thanks, Marcus.
Just managed to build a proof, in case anyone is interested:
Lemma add_exp:
forall n: nat,
n >= 1 -> 2 * 2 ^ (n - 1) = 2 ^ n.
Proof.
destruct n.
- intros H.
omega.
- intros H.
assert (H1: n = 0 \/ n >= 1) by omega.
destruct H1 as [H1 | H1].
+ subst.
simpl.
reflexivity.
+ simpl.
rewrite <- minus_n_O.
rewrite <- plus_n_O.
reflexivity.
Qed.
Best Regards, Marcus.
I just saw your answer, but here is an explanation why your initial attempt didn't work, and how to make it run:
You can't directly use
Nat.pow_add_r
because your goal neither contains a term of the shapea ^ (b + c)
nora ^ b * a ^ c
. You have to help Coq to recognize this pattern. In the following script, I first change2
into2 ^ 1
, then use the lemma you provided.PS: you can
Require Import Nat
if you don't want to prefix the lemmas like I did.