(************************************************************************)
(*         *   The Coq Proof Assistant / The Coq Development Team       *)
(*  v      *   INRIA, CNRS and contributors - Copyright 1999-2018       *)
(* <O___,, *       (see CREDITS file for the list of authors)           *)
(*   \VV/  **************************************************************)
(*    //   *    This file is distributed under the terms of the         *)
(*         *     GNU Lesser General Public License Version 2.1          *)
(*         *     (see LICENSE file for the text of the license)         *)
(************************************************************************)
Local Open Scope R_scope.
Inductive Rlist : Type :=
| nil : Rlist
| cons : R -> Rlist -> Rlist.
Fixpoint In (x:R) (l:Rlist) : Prop :=
match l with
| nil => False
| cons a l' => x = a \/ In x l'
end.
Fixpoint Rlength (l:Rlist) : nat :=
match l with
| nil => 0%nat
| cons a l' => S (Rlength l')
end.
Fixpoint MaxRlist (l:Rlist) : R :=
match l with
| nil => 0
| cons a l1 =>
match l1 with
| nil => a
| cons a' l2 => Rmax a (MaxRlist l1)
end
end.
Fixpoint MinRlist (l:Rlist) : R :=
match l with
| nil => 1
| cons a l1 =>
match l1 with
| nil => a
| cons a' l2 => Rmin a (MinRlist l1)
end
end.
Fixpoint AbsList (l:Rlist) (x:R) : Rlist :=
match l with
| nil => nil
| cons a l' => cons (Rabs (a - x) / 2) (AbsList l' x)
end.

Lemma AbsList_P1 :
forall (l:Rlist) (x y:R), In y l -> In (Rabs (y - x) / 2) (AbsList l x).