proposition: Lemma Vector_split_lt {A} : forall m n (lt_m_n : (m <= n)%nat) (v : Vector.t A n), exists k (v1 : Vector.t A m) (v2 : Vector.t A k) (H : m + k = n), v = eq_rect _ (Vector.t A) (Vector.append v1 v2) _ H.
proof: Proof. intros ? ? lt_m_n; induction lt_m_n; intros. - eexists 0, v, (Vector.nil _), _; apply Vector_append_nil_r. - revert IHlt_m_n; pattern m0, v; eapply Vector.caseS; intros. destruct (IHlt_m_n t) as [? [? [? [? ?] ] ] ]; subst; simpl; clear IHlt_m_n. eexists _, (fst (Vector_split _ _ (eq_rect _ _ (Vector.cons A h _ x0) _ (plus_comm 1 m)))), (Vector.append (snd (Vector_split _ _ (eq_rect _ _ (Vector.cons A h _ x0) _ (plus_comm 1 m)))) x1), (eq_sym (plus_n_Sm _ _)). erewrite Vector_append_assoc, <- Equality.transport_pp, <- Vector_split_append. pose proof (fun z H H' => Vector_append_assoc'' _ _ _ z H H' (Vector.cons A h _ (Vector.nil _)) x0 x1). simpl in *. erewrite H. rewrite <- Equality.transport_pp. erewrite (UIP_dec _ _ (eq_refl _)); simpl. reflexivity. Unshelve. omega. omega. decide equality. Qed.
imports: Fiat.Common.Coq__8_4__8_5__Compat Bedrock.Word Coq.ZArith.ZArith Coq.NArith.NArith Coq.Arith.Arith Coq.Numbers.Natural.Peano.NPeano Coq.Logic.Eqdep_dec Fiat.Narcissus.Common.Specs Fiat.Narcissus.BinLib.Core Fiat.Narcissus.Formats.ByteBuffer Coq.Strings.String Coq.Vectors.Vector Fiat.Narcissus.Formats.WordOpt Fiat.Common.Equality