(** *Even length*)
Inductive even : nat -> Prop :=
| EvenO : even 0
| EvenS : forall n, even n -> even (S (S n)).
Function length_of_even (ls:list nat) : option nat :=
match ls with
| nil => Some 0
| cons x1 (cons x2 ls') =>
match length_of_even ls' with
| Some n' => Some ( 2 + n')
| _ => None
end
| cons x nil => None
end.

Lemma LOE_correct:
forall ls n,
length_of_even ls = Some n ->
even (length ls).