From Undecidability.L.Tactics Require Import LTactics.
From Undecidability.L Require Import UpToC.
From Undecidability.L.Datatypes Require Export List.List_enc LBool LNat.
From Undecidability.Shared.Libs.PSL.Lists Require Export Filter.
Set Default Proof Using "Type".
Definition c__app := 16.
Instance termT_append X {intX : registered X} : computableTime' (@List.app X) (fun A _ => (5,fun B _ => (length A * c__app + c__app,tt))).
Definition c__map := 12.
Fixpoint map_time {X} (fT:X -> nat) xs :=
match xs with
[] => c__map
| x :: xs => fT x + map_time fT xs + c__map
end.
Instance term_map (X Y:Type) (Hx : registered X) (Hy:registered Y): computableTime' (@map X Y) (fun _ fT => (1,fun l _ => (map_time (fun x => fst (fT x tt)) l,tt))).

Lemma mapTime_upTo X (t__f : X -> nat):
map_time t__f <=c (fun l => length l + sumn (map t__f l) + 1 ).