(* map a n-ary string to a binary string *)
Definition bin (x: list nat) : list bool :=
flat_map (fun (a : nat) => true :: (repeat false a) ++ [true])  x.
Definition bin_map A := map (fun '(x, y) => (bin x, bin y)) A.

(* preimage of a mapped list  *)
Lemma debin {A: list (list bool * list bool)} {P : list (list nat * list nat)} :
incl A (bin_map P) -> exists B, A = bin_map B /\ incl B P.