From Undecidability.Shared.Libs.PSL Require Import Vectors.
From Undecidability.L Require Import L LTactics L_facts Functions.Eval Functions.Decoding Functions.Encoding.
From Undecidability.L.Datatypes Require Import LBool Lists LVector List.List_fold.
From Undecidability.L.Complexity.LinDecode Require Import LTDbool LTDlist LTDnat.
From Undecidability.TM.L.CompilerBoolFuns Require Import Compiler_spec NaryApp ClosedLAdmissible Compiler_facts.
(* Section Fix_X. Variable (X:Type). Context {intX : registered X}.  Global Instance term_repeat: computable (@repeat X). Proof using intX. extract. Qed.  Global Instance term_length: computable (@length X). Proof using intX. extract. Qed.  End Fix_X. *)
Fixpoint gen_list {k} {X} {Hr : registered X} (v : Vector.t nat k) : term :=
match v with
| [] => ext (@nil X)
| n :: v => ext (@Datatypes.cons X) (var n) (@gen_list _ X Hr v)
end.
Definition validate (l : list (list bool)) := forallb (forallb (fun x => x)) l.

Lemma validate_spec_help (l : list bool) : forallb (fun x => x) l <-> exists l', l = List.repeat true l'.