(** * Coq codes *)
(** ** Dependencies *)
Require Export Ascii.
Require Export String.
Require Export List.
Require Export Relation_Definitions.
(** ** Equality and equivalence *)
Definition bool_eq (a a':bool) : Prop := a = a'.
Definition ascii_eq (a a':ascii) : Prop := a = a'.
Definition string_eq (a a':string) : Prop := a = a'.
(** ** Lemmas for string *)
Fixpoint str_length (s:string) : nat :=
match s with
| ""%string => O
| String _ s' => S (str_length s')
end.
Definition bneq_empty_string(s:string):bool :=
match (string_dec s ""%string) with
| left _ => false
| right _ => true
end.
(** ** Lemmas for list *)
Definition concat_list_string(xs:list string) :=
fold_right (fun s s' : string => (s ++ s')%string) ""%string xs.
(* Other useful lemmas are: Lemma forallb_forall : forall l, forallb l = true <-> (forall x, In x l -> f x = true). Lemma forallb_app : forall l1 l2, forallb (l1++l2) = forallb l1 && forallb l2. *)

Lemma forallb_divide_left : forall (A:Type)(f:A -> bool) (l l':list A),
forallb f (l ++ l') = true -> forallb f l = true.