Fixpoint repeat_op_table_nat{T: Type}(n: nat)(start: T)(op: T -> T): list T := match n with
| O => []
| S m => (repeat_op_table_nat m start op) ++ [repeat_op_nat m start op]
end.
Definition repeat_op_table{T: Type}(n: Z)(start: T)(op: T -> T): list T :=
repeat_op_table_nat (Z.to_nat n) start op.

(* Specifications: *)
Lemma repeat_op_table_step: forall {T: Type} (i: Z) (start: T) (op: T -> T),
0 <= i ->
repeat_op_table (i + 1) start op = (repeat_op_table i start op) ++ [repeat_op i start op].
Lemma repeat_op_table_nat_length: forall {T: Type} (i: nat) (x: T) (f: T -> T),
length (repeat_op_table_nat i x f) = i.
Lemma repeat_op_table_length: forall {T: Type} (i: Z) (x: T) (f: T -> T),
0 <= i ->
Zlength (repeat_op_table i x f) = i.
Lemma repeat_op_nat_id: forall {T: Type} (n: nat) (v: T),
repeat_op_nat n v id = v.
Lemma repeat_op_table_nat_id_app: forall {T: Type} (len1 len2: nat) (v: T),
repeat_op_table_nat (len1 + len2) v id
= repeat_op_table_nat len1 v id ++ repeat_op_table_nat len2 v id.
Lemma sublist_repeat_op_table_id: forall {T: Type} (lo n: Z) (v: T),
0 <= lo ->
0 <= n ->
sublist lo (lo + n) (repeat_op_table (lo + n) v id) = repeat_op_table n v id.