Require Import List Arith Max Omega Wellfounded Bool.

From Undecidability.Shared.Libs.DLW Require Import Utils.utils.
From Undecidability.ILL.Bsm Require Import list_bool.

Set Implicit Arguments.

Fixpoint tile_concat ln lt : (list bool) * list bool:=
  match ln with
    | nil => (nil,nil)
    | x::ln => match nth x lt (nil,nil), tile_concat ln lt with
                 | (th,tl), (hh,ll) => (hh++th,ll++tl)
               end
  end.

Definition tiles_solvable lt :=
   exists ln, ln <> nil
           /\ Forall (fun x => x < length lt) ln
           /\ let (hh,ll) := tile_concat ln lt in hh = ll.