Definition list_bool_valid   k lb ln := lb = list_nat_bool ln /\ Forall (fun x => x < k) ln.
Definition list_bool_invalid k lb ln := exists lc, lb = list_nat_bool ln ++ lc
/\ (   Exists (fun x => k <= x) ln
\/  Forall (fun x => x < k) ln
/\ exists p, lc = list_repeat Zero (S p)).
Fact list_bool_valid_dec k lb : { ln | list_bool_valid k lb ln } + { ln | list_bool_invalid k lb ln }.
Fixpoint list_bool_nat l :=
match l with
| nil     => 1
| Zero::l => 0 + 2*list_bool_nat l
| One::l  => 1 + 2*list_bool_nat l
end.
Fact list_bool_nat_ge_1 l : 1 <= list_bool_nat l.
Fact list_One_Zero_not a b l : list_repeat One a ++ Zero :: l <> list_repeat One b.
Fact list_One_inj a b : list_repeat One a = list_repeat One b -> a = b.
Fact list_bool_succ_fun l m1 m2 : list_bool_succ l m1 -> list_bool_succ l m2 -> m1 = m2.
Fact list_bool_succ_nil l : list_bool_succ nil l -> l = Zero::nil.
Fact list_bool_succ_neq : forall l m, list_bool_succ l m -> l <> m.
Fact list_bool_succ_neq_nil l : ~ list_bool_succ l nil.
End list_bool_succ_props.
Section list_bool_next.
Let list_bool_next_def l : { m | list_bool_succ l m }.
Definition list_bool_next l := proj1_sig (list_bool_next_def l).
Definition list_bool_next_spec l : list_bool_succ l (list_bool_next l).
Fact iter_list_bool_next_nil l n : iter list_bool_next l n = nil -> n = 0 /\ l = nil.
End list_bool_next.
Fact list_bool_succ_nat l m : list_bool_succ l m -> 1 + list_bool_nat l = list_bool_nat m.
Section list_bool_succ_rect.
Variable (P : list bool -> Type)
(HP0 : P nil)
(HPS : forall l m, list_bool_succ l m -> P l -> P m).
Let list_bool_succ_rec n : forall l, list_bool_nat l = n -> P l.

Theorem list_bool_succ_rect : forall l, P l.