Section Fin.
Global Coercion fin_to_nat (n : nat) (i : Fin.t n) : nat := proj1_sig (Fin.to_nat i).
Global Set Printing Coercions.
Fixpoint finMax (n : nat) {struct n} : n <> 0 -> Fin.t n.
(* Arguments finMax (n) H : clear implicits. *)
(* Compute finMax (ltac:(congruence) : 1 <> 0). *)
(* Compute finMax (ltac:(congruence) : 10 <> 0). *)
(* Compute finMax' 99. *)
Definition finMin (n : nat) : n <> 0 -> Fin.t n.
Definition finMin_opt (n : nat) : option (Fin.t n).
End Fin.
Fixpoint map_vect_list (X Y : Type) (f : X -> Y -> X) (n : nat) (vs : Vector.t Y n) (ls : list X) {struct ls} : list X :=
match ls with
| nil => nil
| x :: ls' =>
match vs with
| [| |] => ls
| y ::: vs' =>
f x y :: map_vect_list f vs' ls'
end
end.
Definition insertKnownSymbol {n : nat} (readSymbols : Vector.t (option sig) n) (i : Fin.t n) (s : option sig) : Vector.t (option sig) n :=
Vector.replace readSymbols i s.
Fixpoint insertKnownSymbols {n : nat} (readSymbols : Vector.t (option sig) n) (i : Fin.t n) (newSymbols : list (option sig)) :
Vector.t (option sig) n :=
match newSymbols with
| nil => readSymbols
| s :: newSymbols' =>
match finSucc_opt i with
| Some i' => insertKnownSymbols (insertKnownSymbol readSymbols i s) i' newSymbols'
| None => insertKnownSymbol readSymbols i s
end
end.
(* H : knowsFirstSymbols (insertKnownSymbols (current tp ::: Vector.const None n) Fin0 (map (current (sig:=sig)) (tp :: vector_to_list T))) ([] ++ tp :: vector_to_list T) ============================ insertKnownSymbols (current tp ::: Vector.const None n) Fin0 (vector_to_list (current_chars T)) = current_chars (tp ::: T) *)

Lemma knowsFirstSymbols_all n (tps : list (tape sig)) (symbols : Vector.t (option sig) n) :
length tps = n ->
knowsFirstSymbols symbols tps ->
vector_to_list symbols = map (@current _) tps.