(**************************************************************)
(*   Copyright Dominique Larchey-Wendling [*]                 *)
(*                                                            *)
(*                             [*] Affiliation LORIA -- CNRS  *)
(**************************************************************)
(*      This file is distributed under the terms of the       *)
(*         CeCILL v2 FREE SOFTWARE LICENSE AGREEMENT          *)
(**************************************************************)
Set Implicit Arguments.
Notation Zero := false.
Notation One  := true.
Fact list_bool_dec (l m : list bool) : { l = m } + { l <> m }.
(* {0,1}* = 1*0{0,1}* + 1* *)
Fact list_bool_choose_sym lb : { k : _ & { tl | lb = list_repeat One k ++ Zero :: tl } }
+ { k            | lb = list_repeat One k }.
(* [n1,...,nk] ---> 0...{n1}...01 0{n2}1 ... 0{nk}1 *)
Fixpoint list_nat_bool ln :=
match ln with
| nil   => nil
| x::ll => list_repeat Zero x ++ One :: list_nat_bool ll
end.

(* Specifications: *)
Lemma list_bool_decomp k lb : { ln : _ & { lc | lb = list_nat_bool ln ++ lc
/\ Exists (fun x => k <= x) ln } }
+ { ln : _ & { r  | lb = list_nat_bool ln ++ list_repeat Zero r
/\ Forall (fun x => x < k) ln } }.