Section before_func.
Variable A : Type.
Variables f g : A -> bool.
Definition before_func_dec : forall l, {before_func f g l} + {~ before_func f g l}.
intros; induction l; simpl in *.
- intuition.
- destruct (f a); destruct (g a); intuition.
Defined.
Proof using.
intros. induction l; simpl in *; intuition.
Qed.
Proof using.
induction l; simpl; intuition.
- eauto.
- congruence.
- congruence.
Qed.
Proof using.
induction l'; intros; simpl in *; intuition.
Qed.
Proof using.
induction l; intros; simpl in *; intuition.
- eauto.
- find_copy_apply_hyp_hyp. break_exists_exists. intuition.
right. intuition. congruence.
Qed.
Proof using.
intros.
find_apply_lem_hyp Prefix_exists_rest.
break_exists; subst.
eauto using before_func_app.
Qed.

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'.