(** This file is part of the Coquelicot formalization of real analysis in Coq: http://coquelicot.saclay.inria.fr/  Copyright (C) 2011-2015 Sylvie Boldo #<br /># Copyright (C) 2011-2015 Catherine Lelay #<br /># Copyright (C) 2011-2015 Guillaume Melquiond  This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.  This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the COPYING file for more details. *)
Open Scope R_scope.
(** This file describes results about differentiability on a generic normed module. Specific results are also given on [R] with a total function [Derive]. It ends with the Taylor-Lagrange formula. *)
Section LinearFct.
(** * Linear functions *)
Context {K : AbsRing} {U V : NormedModule K}.
Record is_linear (l : U -> V) := {
linear_plus : forall (x y : U), l (plus x y) = plus (l x) (l y) ;
linear_scal : forall (k : K) (x : U), l (scal k x) = scal k (l x) ;
linear_norm : exists M : R, 0 < M /\ (forall x : U, norm (l x) <= M * norm x) }.

(* Specifications: *)
Lemma linear_zero (l : U -> V) : is_linear l ->
l zero = zero.
Lemma linear_opp (l : U -> V) (x : U) : is_linear l ->
l (opp x) = opp (l x).
Lemma linear_cont (l : U -> V) (x : U) :
is_linear l -> continuous l x.
Lemma is_linear_ext (l1 l2 : U -> V) :
(forall x, l1 x = l2 x) -> is_linear l1 -> is_linear l2.
(** zero in a linear function *)
Lemma is_linear_zero : is_linear (fun _ => zero).
End LinearFct.
Lemma is_linear_comp {K : AbsRing} {U V W : NormedModule K}
(l1 : U -> V) (l2 : V -> W) :
is_linear l1 -> is_linear l2 -> is_linear (fun x => l2 (l1 x)).