I have to show that :
Lemma bsuccOK: forall l, value (bsucc l) = S (value l).
with an induction proof, but I don't understand how to do it.
Here is the bsucc function:
Fixpoint bsucc (l: list bool): list bool := match l with
|[]=>[]
|r::true=>(bsucc r)::false
|r::false=>r::true
end.
Lemma bsucc_test1: bsucc [false;true;false;true] = [true;true;false;true].
Proof.
easy.
Admitted.
It gives the successor of a list of booleans representing a binary number.
Any help would be very appreciated!
Which binary representation do you use ? If you consider Least significant bits first, then for instance
4
is represented as[false;false;true]
.Here is a definition of
bsucc
andvalue
. Note the order of arguments in list notations, and a slight change inbsucc []
. Hope it's OK.Then, your goal is solvable, by induction on
l
. Tactics you may also use arecbn
orsimpl
,case
,rewrite
, andlia
(for linear arithmetic).