proposition: Lemma substring_length {s n m} : length (substring n m s) = (min (length s) (m + n)) - n.
proof: Proof. revert n m; induction s; intros. { destruct n, m; reflexivity. } { simpl. destruct n, m; simpl; trivial; rewrite IHs; simpl; try omega; rewrite (plus_comm m (S n)); simpl; rewrite (plus_comm n m); simpl; reflexivity. } Qed.
imports: Fiat.Common.Coq__8_4__8_5__Compat Coq.ZArith.ZArith Coq.Arith.PeanoNat Coq.Strings.Ascii Coq.Strings.String Fiat.Common.List.Operations Fiat.Common.StringOperations