Section list_in.
Variable (X : Type).
Variable (eqb : X -> X -> bool).
Variable eqb_correct : forall a b,  a = b <-> eqb a b = true.
Definition list_in_decb := fix rec (l : list X) (x : X) : bool :=
match l with [] => false
| (l :: ls) => eqb l x || rec ls x
end.
Proof using eqb_correct.
intros x. induction l.
- cbn. firstorder.
- split.
+ intros [H1 | H1]%orb_true_elim. left. now apply eqb_correct.
apply IHl in H1. now right.
+ intros [H | H].
cbn. apply orb_true_intro; left; now apply eqb_correct.
cbn. apply orb_true_intro; right; now apply IHl.
Qed.
Proof using eqb_correct.
intros x. split.
- intros H H'. apply list_in_decb_iff in H'. congruence.
- intros H'. destruct (list_in_decb l x) eqn:H.
+ now apply list_in_decb_iff in H.
+ reflexivity.
Qed.
Fixpoint list_incl_decb (a b : list X) :=
match a with
| [] => true
| (x::a) => list_in_decb b x && list_incl_decb a b
end.
Proof using eqb_correct.
induction a; cbn; [firstorder | ].
split; intros.
- rewrite andb_true_iff. split; [ | apply IHa; firstorder].
apply list_in_decb_iff; firstorder.
- apply andb_true_iff in H as (H1 & H2). intros x [-> | H3].
+ now apply list_in_decb_iff.
+ apply IHa in H2. apply H2, H3.
Qed.

Lemma list_incl_decb_iff' (a b : list X) : not (a <<= b) <-> list_incl_decb a b = false.