Fixpoint before_func {A: Type} (f : A -> bool) (g : A -> bool) (l : list A) : Prop :=
  match l with
  | [] => False
  | a :: l' =>
    f a = true \/
    (g a = false /\ before_func f g l')
  end.Definition before_func_dec : forall l, {before_func f g l} + {~ before_func f g l}.

(* Specifications: *)
Lemma before_func_app : forall l x, before_func f g l -> before_func f g (l ++ x).
Lemma before_func_antisymmetric : forall l, (forall x, f x = true -> g x = true -> False) -> before_func f g l -> before_func g f l -> False.
Lemma before_func_prepend : forall l l', before_func f g l -> (forall x, In x l' -> g x = false) -> before_func f g (l' ++ l).
Lemma before_func_before : forall l, before_func f g l -> forall y, g y = true -> exists x : A, f x = true /\ before x y l.
Lemma before_func_prefix : forall l l', Prefix l l' -> before_func f g l -> before_func f g l'.
Lemma before_func_app_necessary : forall l l', ~ before_func f g l -> before_func f g (l ++ l') -> (forall x, In x l -> g x = false) /\ before_func f g l'.