Section Lists_compl.
Variable A B : Set.
auto with arith. Qed.
auto with arith. Qed.
auto with arith. Qed.
auto with arith. Qed.
Inductive len : list A -> nat -> Prop :=
(************)
| len_nil : len nil 0
| len_cons :
forall (b : A) (v : list A) (l : nat), len v l -> len (b :: v) (S l).
Hint Resolve len_nil len_cons.
(*************)
intros. discriminate.
Qed.
(****************)
simple induction v. intro. discriminate.
intros. injection. intros. absurd (l = a :: l). apply H.
exact H1.
Qed.
(**************)
intro.
rewrite <- app_nil_end; trivial with arith.
Qed. Hint Resolve app_v_nil.
(********************)
intros. inversion H. apply app_v_nil.
Qed.
(******************)
simple induction v1. simpl in |- *. trivial with arith.
intros. generalize H0. rewrite app_eq2. intros. injection H1. intro. apply H. exact H2.
Qed.
(******************)
simple induction v2. intro. rewrite H. trivial with arith.
intros. rewrite H0. auto with arith.
Qed.
Definition app_assoc_r := app_ass.
(*********************)
Definition app_assoc_l := ass_app.
(*********************)
(*******************)
simple induction v. intros. inversion H. discriminate.
intros. inversion H0. discriminate.
Qed.
(****************)
intros; inversion H; trivial with arith.
Qed.
(*******************)
simple induction l. red in |- *. intro. inversion H. unfold not in |- *. intros. inversion H0.
Qed.
(************)
simple induction l1. simpl in |- *. intros. inversion H. simpl in |- *. assumption.
intros. inversion H0. simpl in |- *. apply len_cons. apply H. exact H4.
exact H1.
Qed.
(***************)
simple induction v. auto with arith.
intros. rewrite length_eq2. apply len_cons. exact H.
Qed. Hint Resolve len_length.
(**************)
intros. rewrite H. trivial with arith.
Qed.
(************)
simple induction v. simpl in |- *; intro. absurd (0 <> 0). unfold not in |- *; auto with arith. exact H.
simpl in |- *. intros. discriminate.
Qed.
(***************)
simple induction v1. simpl in |- *. trivial with arith.
intros. simpl in |- *. rewrite H. trivial with arith.
Qed.
(*********************)
simple induction v. intro. absurd (nil <> nil :>list A). unfold not in |- *. auto with arith.
exact H.
intros. simpl in |- *. apply le_n_S. auto with arith.
Qed.
(*******************)
intros. apply v_not_nil_length. apply not_nil. exact H.
Qed.
(****************************************************************)
(* Rend une liste de longueur n dont tous les elements sont x *)
Fixpoint list_const (n : nat) : A -> list A :=
(*****************)
fun x : A =>
match n return (list A) with
| O => nil
| S n' => x :: list_const n' x
end.
auto with arith. Qed.
auto with arith. Qed.
(*******************)
simple induction n. auto with arith. intros. simpl in |- *. auto with arith.
Qed. Hint Resolve len_list_const.
(**********************)
simple induction n. auto with arith. intros. simpl in |- *. auto with arith.
Qed. Hint Resolve length_list_const.
(****************************************************************)
(* rev: renverse une liste *)
Fixpoint rev (l : list A) : list A :=
(************************)
match l return (list A) with
| nil => nil
| b :: l' => rev l' ++ b :: nil
end.
auto with arith. Qed.

Lemma rev_eq2 :
forall (b : A) (l' : list A), rev (b :: l') = rev l' ++ b :: nil.