fact: Fixpoint well_formed_bool (t:term) : bool := match t with | Var _ => true | Term f l => let well_formed_list := (fix well_formed_list (l:list term) : bool := match l with | nil => true | h :: tl => andb (well_formed_bool h) (well_formed_list tl) end) in andb (well_formed_list l) (match arity f with | Free n => Nat.eqb (length l) n | _ => Nat.eqb (length l) 2 end) end.
imports: Coq(Recdef List Arith Setoid) CoLoR(closure more_list list_permut list_set decidable_set)