Module mathcomp.analysis.derive.differential
From HB Require Import structures.From mathcomp Require Import boot order ssralg ssrnum matrix interval
interval_inference.
From mathcomp Require Import poly sesquilinear.
#[warning="-warn-library-file-internal-analysis"]
From mathcomp Require Import unstable.
From mathcomp Require Import boolp contra classical_sets functions reals.
From mathcomp Require Import topology tvs normedtype landau.
# Differentiation
This file provides basics of a theory of differentiation. It includes the
standard rules of differentiation (differential of a sum, of a product, of
exponentiation, of the inverse, etc.).
Parsable notations (in all of the following, f is not supposed to be
differentiable):
`'d f x`
: the differential of a function `f` at a point `x`
`differentiable f x`
: the function `f` is differentiable at a point `x`
`is_diff x f df`
: the differential of a function `f` at point `x` is `df` and `f` is
: differentiable at point `x`
Naming convention in this directory:
- lemmas of the form `... -> is_diff x f df` are named `is_diff*`
(e.g., `is_diff_cst`)
## Automatic differentiation and derivation with `is_diff` and `is_derive`
NB: documentation below also applies to `derivative.v`
Statements of the form `is_diff` and `is_derive` are typeclasses
registered via `Instance` declarations with a proof `ex_derive`/`ex_diff`
of derivability/differentiability of the expression and a proof
`derive_val`/`diff_val` of the value of the derivative/differential
of the function; so that typeclass resolution can automatically synthesize
the differential/derivative of a compound expression from the
differentials/derivatives of its parts, instead of requiring the user to
prove and compute derivatives by hand.
## Lemmas of the form `is_diff` and `is_derive`
For a compound expression, e.g., built from f and g, state the goal with
the expected differential/derivative and let typeclass resolution fill the
proof by `apply: is_diff_eq` or `apply: is_derive_eq`:
```coq
Lemma is_derive_example (W : normedModType R)
(t : R^o) (f g : R^o -> W) (f' g' : W) v :
is_derive t v f f' ->
is_derive t v g g' ->
is_derive t v (f + g) (f' + g').
Proof. move => is_der_f is_der_g. by apply: is_derive_eq. Qed.
```
The proof is inferred structurally by chaining declared `is_diff` or
`is_derive` instances matching the pattern of the goal stated.
To verify if a given expression is differentiable or derivable, you can
use `apply: ex_diff` or `apply: ex_derive`, given the right
`is_diff _` or `is_derive _` instances are defined such as:
```coq
Hypothesis derivable_f : forall t, derivable f t 1.
Hypothesis derivable_h : forall t, derivable h t 1.
Local Instance is_derive_f t : is_derive t 1 f ('D_1 f t).
by apply: derivableP. Qed.
Local Instance is_derive_h t : is_derive t 1 h ('D_1 h t).
by apply: derivableP. Qed.
Lemma is_derivable_example (t : R^o) : derivable (f + h) t 1.
Proof. apply/ex_derive. Qed.
```
To verify the value of a given function you can apply `derive_val` or
`diff_val`, given the right `is_derive/diff` instances are defined, e.g.:
```coq
Lemma is_derive_val_example t :
'D_1 (f + h) t = 'D_1 f t + 'D_1 h t.
Proof. by apply/derive_val. Qed.
```
Set Implicit Arguments.
Unset Strict Implicit.
Unset Printing Implicit Defensive.
Import Order.TTheory GRing.Theory Num.Theory.
Import numFieldNormedType.Exports.
Local Open Scope ring_scope.
Local Open Scope classical_set_scope.
Reserved Notation "''d' f x" (at level 0, f at level 0, x at level 0,
format "''d' f x").
Reserved Notation "'is_diff' F" (at level 0, F at level 0,
format "'is_diff' F").
Section Differential.
Context {dSource code} {KSource code : numDomainType} {VSource code : normedModType d K}
{d'Source code} {WSource code : normedModType d' K}.
Definition diff
Source code (FSource code : filter_on V) (_ : phantom (set_system V) F) (fSource code : V -> W) :=
(get (fun (dfSource code : {linear V -> W}) => continuous df /\ forall xSource code,
f x = f (lim F) + df (x - lim F) +o_(xSource code \near F) (x - lim F))).
Local Notation "''d' f x"Source code := (@diff _ (Phantom _ (nbhs x)) f).
Fact diff_keySource code : forall TSource code, T -> unit
Variant differentiable_defSource code (fSource code : V -> W) (xSource code : filter_on V)
(phFSource code : phantom (set_system V) x) : Prop := DifferentiableDefSource code of
(continuous ('d f x) /\
f = cst (f (lim x)) + 'd f x \o center (lim x) +o_x (center (lim x))).
Local Notation differentiableUsed by
Source code f F :=
(@differentiable_def f _ (Phantom _ (nbhs F))).
Class is_diff_defSource code (xSource code : filter_on V) (FphSource code : phantom (set_system V) x) (fSource code : V -> W)
(dfSource code : V -> W) := DiffDef {
ex_diffSource code : differentiable f x ;
diff_valUsed by
Source code : 'd f x = df :> (V -> W)
}.
Hint Mode is_diff_def - - ! - : typeclass_instances.
Lemma diffPSource code (FSource code : filter_on V) (fSource code : V -> W) :
differentiable f F <->
continuous ('d f F) /\
(forall xSource code, f x = f (lim F) + 'd f F (x - lim F) +o_(xSource code \near F) (x - lim F)).
Lemma diff_continuousUsed by
Source code (xSource code : filter_on V) (fSource code : V -> W) :
differentiable f x -> continuous ('d f x).
Hint Extern 0 (continuous _) => solve[apply: diff_continuous] : core.
Lemma diffESource code (FSource code : filter_on V) (fSource code : V -> W) :
differentiable f F ->
forall xSource code, f x = f (lim F) + 'd f F (x - lim F) +o_(xSource code \near F) (x - lim F).
Lemma littleo_center0Source code (xSource code : V) (fSource code : V -> W) (eSource code : V -> V) :
[o_x e of f] = [o_ 0 (e \o shift x) of f \o shift x] \o center x.
End Differential.
Context {dSource code} {KSource code : numDomainType} {VSource code : normedModType d K}
{d'Source code} {WSource code : normedModType d' K}.
Definition diff
diff : forall {d : filter.filter_display} {K : numDomainType} {V : normedModType d K} {d' : filter.filter_display} {W : normedModType d' K} [F : filter.filter_on V], phantom (set_system V) (filter.filter F) -> (V -> W) -> Linear_type__canonical__classical_sets_Pointed (R:=K) V W diff is not universe polymorphic Arguments diff {d}%_fdisp_scope {K V} {d'}%_fdisp_scope {W} [F] _ f%_function_scope diff is transparent Expands to: Constant mathcomp.analysis.derive.differential.diff Declared in library mathcomp.analysis.derive.differential, line 108, characters 11-15
Source code (FSource code : filter_on V) (_ : phantom (set_system V) F) (fSource code : V -> W) :=
(get (fun (dfSource code : {linear V -> W}) => continuous df /\ forall xSource code,
f x = f (lim F) + df (x - lim F) +o_(xSource code \near F) (x - lim F))).
Local Notation "''d' f x"Source code := (@diff _ (Phantom _ (nbhs x)) f).
Fact diff_keySource code : forall TSource code, T -> unit
Proof.
by constructor. Qed.
(phFSource code : phantom (set_system V) x) : Prop := DifferentiableDefSource code of
(continuous ('d f x) /\
f = cst (f (lim x)) + 'd f x \o center (lim x) +o_x (center (lim x))).
Local Notation differentiableUsed by
- mathcomp.analysis.derive.derive_matrix
- mathcomp.analysis.derive.derivative
Source code f F :=
(@differentiable_def f _ (Phantom _ (nbhs F))).
Class is_diff_defSource code (xSource code : filter_on V) (FphSource code : phantom (set_system V) x) (fSource code : V -> W)
(dfSource code : V -> W) := DiffDef {
ex_diffSource code : differentiable f x ;
diff_valUsed by
- mathcomp.analysis.derive.derive_matrix
- mathcomp.analysis.derive.derivative_lemmas
Source code : 'd f x = df :> (V -> W)
}.
Hint Mode is_diff_def - - ! - : typeclass_instances.
Lemma diffPSource code (FSource code : filter_on V) (fSource code : V -> W) :
differentiable f F <->
continuous ('d f F) /\
(forall xSource code, f x = f (lim F) + 'd f F (x - lim F) +o_(xSource code \near F) (x - lim F)).
Proof.
Lemma diff_continuousUsed by
- mathcomp.analysis.derive.derive_matrix
Source code (xSource code : filter_on V) (fSource code : V -> W) :
differentiable f x -> continuous ('d f x).
Proof.
Lemma diffESource code (FSource code : filter_on V) (fSource code : V -> W) :
differentiable f F ->
forall xSource code, f x = f (lim F) + 'd f F (x - lim F) +o_(xSource code \near F) (x - lim F).
Proof.
Lemma littleo_center0Source code (xSource code : V) (fSource code : V -> W) (eSource code : V -> V) :
[o_x e of f] = [o_ 0 (e \o shift x) of f \o shift x] \o center x.
Proof.
rewrite /the_littleo /insubd /=; have [g /= _ <-{f}|/asboolP Nfe] /= := insubP.
rewrite insubT //= ?comp_shiftK //; apply/asboolP => _/posnumP[eps].
rewrite [\forall xSource code \near _, _ <= _](near_shift x) sub0r; near=> y.
by rewrite /= subrK; near: y; have /eqoP := littleo_eqo g; apply.
rewrite insubF //; apply/asboolP => fe; apply: Nfe => _/posnumP[eps].
by rewrite [\forall xSource code \near _, _ <= _](near_shift 0) subr0; apply: fe.
Unshelve. all: by end_near. Qed.
rewrite insubT //= ?comp_shiftK //; apply/asboolP => _/posnumP[eps].
rewrite [\forall xSource code \near _, _ <= _](near_shift x) sub0r; near=> y.
by rewrite /= subrK; near: y; have /eqoP := littleo_eqo g; apply.
rewrite insubF //; apply/asboolP => fe; apply: Nfe => _/posnumP[eps].
by rewrite [\forall xSource code \near _, _ <= _](near_shift 0) subr0; apply: fe.
Unshelve. all: by end_near. Qed.
End Differential.
Section Differential_numFieldType.
Context {dSource code} {KSource code : numFieldType }
{VSource code : normedModType d K} {d'Source code} {WSource code : normedModType d' K}.
Local Notation differentiableUsed by
Source code f F :=
(@differentiable_def _ _ _ _ _ f _ (Phantom _ (nbhs F))).
Local Notation "''d' f x"Source code := (@diff _ _ _ _ _ _ (Phantom _ (nbhs x)) f).
Hint Extern 0 (continuous _) => solve[now apply: diff_continuous] : core.
Lemma diff_locallyxPSource code (xSource code : V) (fSource code : V -> W) :
differentiable f x <-> continuous ('d f x) /\
forall hSource code, f (h + x) = f x + 'd f x h +o_(hSource code \near 0) h.
Lemma diff_locallyxUsed by
Source code (xSource code : V) (fSource code : V -> W) : differentiable f x ->
forall hSource code, f (h + x) = f x + 'd f x h +o_(hSource code \near 0) h.
Lemma diff_locallyxCSource code (xSource code : V) (fSource code : V -> W) : differentiable f x ->
forall hSource code, f (x + h) = f x + 'd f x h +o_(hSource code \near 0) h.
Lemma diff_locallyPUsed by
Source code (xSource code : V) (fSource code : V -> W) :
differentiable f x <->
continuous ('d f x) /\ (f \o shift x = cst (f x) + 'd f x +o_ 0 id).
Lemma diff_locallyUsed by
Source code (xSource code : V) (fSource code : V -> W) : differentiable f x ->
(f \o shift x = cst (f x) + 'd f x +o_ 0 id).
End Differential_numFieldType.
Context {dSource code} {KSource code : numFieldType }
{VSource code : normedModType d K} {d'Source code} {WSource code : normedModType d' K}.
Local Notation differentiableUsed by
- mathcomp.analysis.derive.derive_matrix
- mathcomp.analysis.derive.derivative
Source code f F :=
(@differentiable_def _ _ _ _ _ f _ (Phantom _ (nbhs F))).
Local Notation "''d' f x"Source code := (@diff _ _ _ _ _ _ (Phantom _ (nbhs x)) f).
Hint Extern 0 (continuous _) => solve[now apply: diff_continuous] : core.
Lemma diff_locallyxPSource code (xSource code : V) (fSource code : V -> W) :
differentiable f x <-> continuous ('d f x) /\
forall hSource code, f (h + x) = f x + 'd f x h +o_(hSource code \near 0) h.
Proof.
split=> [dxf|[dfc dxf]].
split => //; apply: eqaddoEx => h; have /diffE -> := dxf.
rewrite lim_id // addrK; congr (_ + _); rewrite littleo_center0 /= addrK.
by congr ('o); rewrite funeqE => k /=; rewrite addrK.
apply/diffP; split=> //; apply: eqaddoEx; move=> y.
rewrite lim_id // -[in LHS](subrK x y) dxf; congr (_ + _).
rewrite -(comp_centerK x id) -[X in the_littleo _ _ _ X](comp_centerK x).
by rewrite -[_ (y - x)]/((_ \o (center x)) y) -littleo_center0.
Qed.
split => //; apply: eqaddoEx => h; have /diffE -> := dxf.
rewrite lim_id // addrK; congr (_ + _); rewrite littleo_center0 /= addrK.
by congr ('o); rewrite funeqE => k /=; rewrite addrK.
apply/diffP; split=> //; apply: eqaddoEx; move=> y.
rewrite lim_id // -[in LHS](subrK x y) dxf; congr (_ + _).
rewrite -(comp_centerK x id) -[X in the_littleo _ _ _ X](comp_centerK x).
by rewrite -[_ (y - x)]/((_ \o (center x)) y) -littleo_center0.
Qed.
Lemma diff_locallyxUsed by
- mathcomp.analysis.derive.derive_matrix
Source code (xSource code : V) (fSource code : V -> W) : differentiable f x ->
forall hSource code, f (h + x) = f x + 'd f x h +o_(hSource code \near 0) h.
Proof.
Lemma diff_locallyxCSource code (xSource code : V) (fSource code : V -> W) : differentiable f x ->
forall hSource code, f (x + h) = f x + 'd f x h +o_(hSource code \near 0) h.
Proof.
Lemma diff_locallyPUsed by
- mathcomp.analysis.derive.derive_matrix
- mathcomp.analysis.derive.derivative
Source code (xSource code : V) (fSource code : V -> W) :
differentiable f x <->
continuous ('d f x) /\ (f \o shift x = cst (f x) + 'd f x +o_ 0 id).
Proof.
Lemma diff_locallyUsed by
- mathcomp.analysis.derive.derivative
Source code (xSource code : V) (fSource code : V -> W) : differentiable f x ->
(f \o shift x = cst (f x) + 'd f x +o_ 0 id).
Proof.
End Differential_numFieldType.
Notation "''d' f F"Used by
- mathcomp.analysis.derive.derive_matrix
- mathcomp.analysis.derive.derivative_lemmas
- mathcomp.analysis.derive.derivative
Source code := (@diff _ _ _ _ _ _ (Phantom _ (nbhs F)) f).
Notation differentiableUsed by
- mathcomp.analysis.derive.derive_matrix
- mathcomp.analysis.derive.derivative
Source code f F :=
(@differentiable_def _ _ _ _ _ f _ (Phantom _ (nbhs F))).
Notation "'is_diff' F"Used by
- mathcomp.analysis.derive.derive_matrix
Source code := (is_diff_def (Phantom _ (nbhs F))).
#[global] Hint Extern 0 (differentiable _ _) => solve[apply: ex_diff] : core.
#[global] Hint Extern 0 ({for _, continuous _}) =>
solve[now apply: diff_continuous] : core.
Lemma differentiablePSource code (RSource code : numDomainType) dSource code (VSource code : normedModType d R)
d'Source code (WSource code : normedModType d' R) (fSource code : V -> W) xSource code :
differentiable f x -> is_diff x f ('d f x).
Proof.
Section DifferentialR.
Context {dSource code} {RSource code : numFieldType} {VSource code : normedModType d R}
{d'Source code} {WSource code : normedModType d' R}.
Lemma differentiable_continuousUsed by
Source code (xSource code : V) (fSource code : V -> W) :
differentiable f x -> {for x, continuous f}.
End DifferentialR.
Context {dSource code} {RSource code : numFieldType} {VSource code : normedModType d R}
{d'Source code} {WSource code : normedModType d' R}.
Lemma differentiable_continuousUsed by
- mathcomp.analysis.elementary_functions.trigonometry_functions
- mathcomp.analysis.realfun
- mathcomp.analysis.derive.derivative_lemmas
- mathcomp.analysis.ftc
- mathcomp.analysis.exp
Source code (xSource code : V) (fSource code : V -> W) :
differentiable f x -> {for x, continuous f}.
Proof.
move=> /diff_locallyP [dfc]; rewrite -addrA.
rewrite (littleo_bigO_eqo (cst (1 : R))).
by apply/eqOP; near=> k; rewrite /cst [`|1|]normr1 mulr1; near do by [].
rewrite addfo; last by move=> /eqolim; rewrite cvg_comp_shift add0r.
by apply/eqolim0P; apply: (cvg_trans (dfc 0)); rewrite linear0.
Unshelve. all: by end_near. Qed.
rewrite (littleo_bigO_eqo (cst (1 : R))).
by apply/eqOP; near=> k; rewrite /cst [`|1|]normr1 mulr1; near do by [].
rewrite addfo; last by move=> /eqolim; rewrite cvg_comp_shift add0r.
by apply/eqolim0P; apply: (cvg_trans (dfc 0)); rewrite linear0.
Unshelve. all: by end_near. Qed.
Section littleo_lemmas.
Context {d1Source code} {XSource code : normedModType d1 R}
{d2Source code} {YSource code : normedModType d2 R} {d3Source code} {ZSource code : normedModType d3 R}.
Lemma normm_littleoSource code xSource code (fSource code : X -> Y) : `| [o_(xSource code \near x) (1 : R) of f x]| = 0.
Lemma littleo_lim0Used by
Source code (fSource code : X -> Y) (hSource code : _ -> Z) (xSource code : X) :
f @ x --> 0 -> [o_x f of h] x = 0.
End littleo_lemmas.
Context {d1Source code} {XSource code : normedModType d1 R}
{d2Source code} {YSource code : normedModType d2 R} {d3Source code} {ZSource code : normedModType d3 R}.
Lemma normm_littleoSource code xSource code (fSource code : X -> Y) : `| [o_(xSource code \near x) (1 : R) of f x]| = 0.
Proof.
rewrite /cst /=; have [e /(_ (`|e x|/2) _)/nbhs_singleton /=] := littleo.
rewrite pmulr_lgt0 // [`|1|]normr1 mulr1 [leLHS]splitr gerDr pmulr_lle0 //.
by move=> /implyP; case : real_ltgtP; rewrite ?realE ?normrE //= lexx.
Qed.
rewrite pmulr_lgt0 // [`|1|]normr1 mulr1 [leLHS]splitr gerDr pmulr_lle0 //.
by move=> /implyP; case : real_ltgtP; rewrite ?realE ?normrE //= lexx.
Qed.
Lemma littleo_lim0Used by
- mathcomp.analysis.derive.derivative
Source code (fSource code : X -> Y) (hSource code : _ -> Z) (xSource code : X) :
f @ x --> 0 -> [o_x f of h] x = 0.
Proof.
End littleo_lemmas.
Section diff_locally_converse_tentative.
Lemma diff_locally_converse_part1Source code (fSource code : R -> R) (aSource code bSource code xSource code : R) :
f \o shift x = cst a + b *: idfun +o_ 0 id -> f x = a.
End diff_locally_converse_tentative.
Lemma diff_locally_converse_part1Source code (fSource code : R -> R) (aSource code bSource code xSource code : R) :
f \o shift x = cst a + b *: idfun +o_ 0 id -> f x = a.
Proof.
End diff_locally_converse_tentative.
End DifferentialR.
Section DifferentialR3.
Context {RSource code : numFieldType}.
Generalizable Variable d.
Fact dcstSource code `{VSource code : normedModType dSource code R} `{WSource code : normedModType d'Source code R} (aSource code : W) (xSource code : V) :
continuous (0 : V -> W) /\
cst a \o shift x = cst (cst a x) + \0 +o_ 0 id.
Fact daddSource code `{VSource code : normedModType dSource code R} `{WSource code : normedModType d'Source code R} (fSource code gSource code : V -> W) xSource code :
differentiable f x -> differentiable g x ->
continuous ('d f x \+ 'd g x) /\
(f + g) \o shift x = cst ((f + g) x) + ('d f x \+ 'd g x) +o_ 0 id.
Fact doppSource code `{VSource code : normedModType dSource code R} `{WSource code : normedModType d'Source code R} (fSource code : V -> W) xSource code :
differentiable f x -> continuous (- ('d f x : V -> W)) /\
(- f) \o shift x = cst (- f x) \- 'd f x +o_ 0 id.
Lemma is_diff_eqSource code `{VSource code : normedModType dSource code R} `{WSource code : normedModType d'Source code R}
(fSource code f'Source code gSource code : V -> W) (xSource code : V) :
is_diff x f f' -> f' = g -> is_diff x f g.
Fact dscaleSource code `{VSource code : normedModType dSource code R} `{WSource code : normedModType d'Source code R}
(fSource code : V -> W) kSource code xSource code :
differentiable f x -> continuous (k \*: 'd f x) /\
(k *: f) \o shift x = cst ((k *: f) x) + k \*: 'd f x +o_ 0 id.
Fact dscalelSource code `{VSource code : normedModType dSource code R} `{WSource code : normedModType d'Source code R}
(kSource code : V -> R) (fSource code : W) xSource code :
differentiable k x ->
continuous (fun zSource code : V => 'd k x z *: f) /\
(fun zSource code => k z *: f) \o shift x =
cst (k x *: f) + (fun zSource code => 'd k x z *: f) +o_ 0 id.
Fact dlinSource code `{VSource code : normedModType dSource code R} `{WSource code : normedModType d'Source code R}
(fSource code : {linear V -> W}) xSource code :
continuous f -> f \o shift x = cst (f x) + f +o_ 0 id.
Lemma compoO_eqoSource code `{USource code : normedModType d1Source code R} `{VSource code : normedModType d2Source code R}
`{WSource code : normedModType d3Source code R} (fSource code : U -> V) (gSource code : V -> W) :
[o_ 0 id of g] \o [O_ 0 id of f] =o_ 0 id.
Lemma compoO_eqoxSource code `{USource code : normedModType d1Source code R} `{VSource code : normedModType d2Source code R}
`{WSource code : normedModType d3Source code R} (fSource code : U -> V) (gSource code : V -> W) :
forall xSource code : U, [o_ 0 id of g] ([O_ 0 id of f] x) =o_(xSource code \near 0) x.
Lemma compOo_eqoSource code `{USource code : normedModType d1Source code R} `{VSource code : normedModType d2Source code R}
`{WSource code : normedModType d3Source code R} (fSource code : U -> V) (gSource code : V -> W) :
[O_ 0 id of g] \o [o_ 0 id of f] =o_ 0 id.
End DifferentialR3.
Context {RSource code : numFieldType}.
Generalizable Variable d.
Fact dcstSource code `{VSource code : normedModType dSource code R} `{WSource code : normedModType d'Source code R} (aSource code : W) (xSource code : V) :
continuous (0 : V -> W) /\
cst a \o shift x = cst (cst a x) + \0 +o_ 0 id.
Proof.
split; first exact: cst_continuous.
apply/eqaddoE; rewrite addr0 funeqE => ? /=; rewrite -[LHS]addr0; congr (_ + _).
by rewrite littleoE; first exact: littleo0_subproof.
Qed.
apply/eqaddoE; rewrite addr0 funeqE => ? /=; rewrite -[LHS]addr0; congr (_ + _).
by rewrite littleoE; first exact: littleo0_subproof.
Qed.
Fact daddSource code `{VSource code : normedModType dSource code R} `{WSource code : normedModType d'Source code R} (fSource code gSource code : V -> W) xSource code :
differentiable f x -> differentiable g x ->
continuous ('d f x \+ 'd g x) /\
(f + g) \o shift x = cst ((f + g) x) + ('d f x \+ 'd g x) +o_ 0 id.
Proof.
move=> df dg; split => [?|]; do ?exact: continuousD.
apply/(@eqaddoE _ _ R); rewrite funeqE => y /=.
by rewrite !fctE ![_ (_ + x)]diff_locallyx// addrACA addox addrACA.
Qed.
apply/(@eqaddoE _ _ R); rewrite funeqE => y /=.
by rewrite !fctE ![_ (_ + x)]diff_locallyx// addrACA addox addrACA.
Qed.
Fact doppSource code `{VSource code : normedModType dSource code R} `{WSource code : normedModType d'Source code R} (fSource code : V -> W) xSource code :
differentiable f x -> continuous (- ('d f x : V -> W)) /\
(- f) \o shift x = cst (- f x) \- 'd f x +o_ 0 id.
Proof.
move=> df; split; first by move=> ?; apply: continuousN.
apply/eqaddoE; rewrite funeqE => y /=.
by rewrite -[(- f) _]/(- (_ _)) diff_locallyx// !opprD oppox.
Qed.
apply/eqaddoE; rewrite funeqE => y /=.
by rewrite -[(- f) _]/(- (_ _)) diff_locallyx// !opprD oppox.
Qed.
Lemma is_diff_eqSource code `{VSource code : normedModType dSource code R} `{WSource code : normedModType d'Source code R}
(fSource code f'Source code gSource code : V -> W) (xSource code : V) :
is_diff x f f' -> f' = g -> is_diff x f g.
Proof.
by move=> ? <-. Qed.
Fact dscaleSource code `{VSource code : normedModType dSource code R} `{WSource code : normedModType d'Source code R}
(fSource code : V -> W) kSource code xSource code :
differentiable f x -> continuous (k \*: 'd f x) /\
(k *: f) \o shift x = cst ((k *: f) x) + k \*: 'd f x +o_ 0 id.
Proof.
move=> df; split; first by move=> ?; exact: continuousZl_tmp.
apply/eqaddoE; rewrite funeqE => y /=.
by rewrite -[(k *: f) _]/(_ *: _) diff_locallyx // !scalerDr scaleox.
Qed.
apply/eqaddoE; rewrite funeqE => y /=.
by rewrite -[(k *: f) _]/(_ *: _) diff_locallyx // !scalerDr scaleox.
Qed.
Fact dscalelSource code `{VSource code : normedModType dSource code R} `{WSource code : normedModType d'Source code R}
(kSource code : V -> R) (fSource code : W) xSource code :
differentiable k x ->
continuous (fun zSource code : V => 'd k x z *: f) /\
(fun zSource code => k z *: f) \o shift x =
cst (k x *: f) + (fun zSource code => 'd k x z *: f) +o_ 0 id.
Proof.
move=> df; split.
move=> ?; exact/continuousZr_tmp/diff_continuous.
apply/eqaddoE; rewrite funeqE => y /=.
by rewrite diff_locallyx //= !scalerDl scaleolx.
Qed.
move=> ?; exact/continuousZr_tmp/diff_continuous.
apply/eqaddoE; rewrite funeqE => y /=.
by rewrite diff_locallyx //= !scalerDl scaleolx.
Qed.
Fact dlinSource code `{VSource code : normedModType dSource code R} `{WSource code : normedModType d'Source code R}
(fSource code : {linear V -> W}) xSource code :
continuous f -> f \o shift x = cst (f x) + f +o_ 0 id.
Proof.
Lemma compoO_eqoSource code `{USource code : normedModType d1Source code R} `{VSource code : normedModType d2Source code R}
`{WSource code : normedModType d3Source code R} (fSource code : U -> V) (gSource code : V -> W) :
[o_ 0 id of g] \o [O_ 0 id of f] =o_ 0 id.
Proof.
apply/eqoP => _ /posnumP[e].
have /bigO_exP [_ /posnumP[k]] := bigOP [bigO of [O_ 0 id of f]].
have := littleoP [littleo of [o_ 0 id of g]].
move=> /(_ (e%:num / k%:num)) /(_ _) /nbhs_ballP [//|_ /posnumP[e'] he'].
apply: filter_app; near=> x => leOxkx; apply: le_trans (he' _ _) _; last first.
by rewrite -ler_pdivlMl // invf_div mulrA divfK.
by rewrite -ball_normE /= distrC subr0 (le_lt_trans leOxkx) // -ltr_pdivlMl.
Unshelve. all: by end_near. Qed.
have /bigO_exP [_ /posnumP[k]] := bigOP [bigO of [O_ 0 id of f]].
have := littleoP [littleo of [o_ 0 id of g]].
move=> /(_ (e%:num / k%:num)) /(_ _) /nbhs_ballP [//|_ /posnumP[e'] he'].
apply: filter_app; near=> x => leOxkx; apply: le_trans (he' _ _) _; last first.
by rewrite -ler_pdivlMl // invf_div mulrA divfK.
by rewrite -ball_normE /= distrC subr0 (le_lt_trans leOxkx) // -ltr_pdivlMl.
Unshelve. all: by end_near. Qed.
Lemma compoO_eqoxSource code `{USource code : normedModType d1Source code R} `{VSource code : normedModType d2Source code R}
`{WSource code : normedModType d3Source code R} (fSource code : U -> V) (gSource code : V -> W) :
forall xSource code : U, [o_ 0 id of g] ([O_ 0 id of f] x) =o_(xSource code \near 0) x.
Proof.
Lemma compOo_eqoSource code `{USource code : normedModType d1Source code R} `{VSource code : normedModType d2Source code R}
`{WSource code : normedModType d3Source code R} (fSource code : U -> V) (gSource code : V -> W) :
[O_ 0 id of g] \o [o_ 0 id of f] =o_ 0 id.
Proof.
apply/eqoP => _ /posnumP[e].
have /bigO_exP [_ /posnumP[k]] := bigOP [bigO of [O_ 0 id of g]].
move=> /nbhs_ballP [_ /posnumP[e'] he'].
have ekgt0 : e%:num / k%:num > 0 by [].
have /(_ _ ekgt0) := littleoP [littleo of [o_ 0 id of f]].
apply: filter_app; near=> x => leoxekx; apply: le_trans (he' _ _) _; last first.
by rewrite -ler_pdivlMl // mulrA [_^-1 * _]mulrC.
by rewrite -ball_normE /= distrC subr0 (le_lt_trans leoxekx)// -ltr_pdivlMl //.
Unshelve. all: by end_near. Qed.
have /bigO_exP [_ /posnumP[k]] := bigOP [bigO of [O_ 0 id of g]].
move=> /nbhs_ballP [_ /posnumP[e'] he'].
have ekgt0 : e%:num / k%:num > 0 by [].
have /(_ _ ekgt0) := littleoP [littleo of [o_ 0 id of f]].
apply: filter_app; near=> x => leoxekx; apply: le_trans (he' _ _) _; last first.
by rewrite -ler_pdivlMl // mulrA [_^-1 * _]mulrC.
by rewrite -ball_normE /= distrC subr0 (le_lt_trans leoxekx)// -ltr_pdivlMl //.
Unshelve. all: by end_near. Qed.
End DifferentialR3.
Section DifferentialR3_numFieldType.
Context {RSource code : numFieldType}.
Generalizable Variables d.
Lemma littleo_linear0Source code `(VSource code : normedModType dSource code R) `(WSource code : normedModType d'Source code R)
(fSource code : {linear V -> W}) :
(f : V -> W) =o_ 0 id -> f = cst 0 :> (V -> W).
Lemma diff_uniqueUsed by
Source code `(VSource code : normedModType dSource code R) `(WSource code : normedModType d'Source code R)
(fSource code : V -> W) (dfSource code : {linear V -> W}) xSource code :
continuous df -> f \o shift x = cst (f x) + df +o_ 0 id ->
'd f x = df :> (V -> W).
Lemma diff_cstSource code `(VSource code : normedModType dSource code R) `(WSource code : normedModType d'Source code R) aSource code xSource code :
('d (cst a) x : V -> W) = 0.
Lemma differentiable_cstSource code `(VSource code : normedModType dSource code R) `(WSource code : normedModType d'Source code R)
(aSource code : W) (xSource code : V) :
differentiable (cst a) x.
Global Instance is_diff_cstSource code `(VSource code : normedModType dSource code R) `(WSource code : normedModType d'Source code R)
(aSource code : W) (xSource code : V) :
is_diff x (cst a) 0.
Lemma diffDSource code `(VSource code : normedModType dSource code R) `(WSource code : normedModType d'Source code R)
(fSource code gSource code : V -> W) xSource code :
differentiable f x -> differentiable g x ->
'd (f + g) x = 'd f x \+ 'd g x :> (V -> W).
Lemma differentiableDSource code `(VSource code : normedModType dSource code R) `(WSource code : normedModType d'Source code R)
(fSource code gSource code : V -> W) xSource code :
differentiable f x -> differentiable g x -> differentiable (f + g) x.
Global Instance is_diffDSource code `(VSource code : normedModType dSource code R) `(WSource code : normedModType d'Source code R)
(fSource code gSource code dfSource code dgSource code : V -> W) xSource code :
is_diff x f df -> is_diff x g dg -> is_diff x (f + g) (df + dg).
Lemma differentiable_sumSource code `(VSource code : normedModType dSource code R) `(WSource code : normedModType d'Source code R)
nSource code (fSource code : 'I_n -> V -> W) (xSource code : V) :
(forall iSource code, differentiable (f i) x) -> differentiable (\sum_(iSource code < n) f i) x.
Lemma diffNSource code `(VSource code : normedModType dSource code R) `(WSource code : normedModType d'Source code R) (fSource code : V -> W) xSource code :
differentiable f x -> 'd (- f) x = - ('d f x : V -> W) :> (V -> W).
Lemma differentiableNSource code `(VSource code : normedModType dSource code R) `(WSource code : normedModType d'Source code R)
(fSource code : V -> W) xSource code :
differentiable f x -> differentiable (- f) x.
Global Instance is_diffNSource code `(VSource code : normedModType dSource code R) `(WSource code : normedModType d'Source code R)
(fSource code dfSource code : V -> W) xSource code :
is_diff x f df -> is_diff x (- f) (- df).
Global Instance is_diffBSource code `(VSource code : normedModType dSource code R) `(WSource code : normedModType d'Source code R)
(fSource code gSource code dfSource code dgSource code : V -> W) xSource code :
is_diff x f df -> is_diff x g dg -> is_diff x (f - g) (df - dg).
Lemma diffBSource code `(VSource code : normedModType dSource code R) `(WSource code : normedModType d'Source code R)
(fSource code gSource code : V -> W) xSource code :
differentiable f x -> differentiable g x ->
'd (f - g) x = 'd f x \- 'd g x :> (V -> W).
Lemma differentiableBSource code `(VSource code : normedModType dSource code R) `(WSource code : normedModType d'Source code R)
(fSource code gSource code : V -> W) xSource code :
differentiable f x -> differentiable g x -> differentiable (f \- g) x.
Lemma diffZSource code `(VSource code : normedModType dSource code R) `(WSource code : normedModType d'Source code R)
(fSource code : V -> W) kSource code xSource code :
differentiable f x -> 'd (k *: f) x = k \*: 'd f x :> (V -> W).
Lemma differentiableZSource code `(VSource code : normedModType dSource code R) `(WSource code : normedModType d'Source code R)
(fSource code : V -> W) kSource code xSource code :
differentiable f x -> differentiable (k *: f) x.
Global Instance is_diffZSource code `(VSource code : normedModType dSource code R) `(WSource code : normedModType d'Source code R)
(fSource code dfSource code : V -> W) kSource code xSource code :
is_diff x f df -> is_diff x (k *: f) (k *: df).
Lemma diffZlSource code `(VSource code : normedModType dSource code R) `(WSource code : normedModType d'Source code R)
(kSource code : V -> R) (fSource code : W) xSource code :
differentiable k x ->
'd (fun zSource code => k z *: f) x = (fun zSource code => 'd k x z *: f) :> (_ -> _).
Lemma differentiableZlSource code `(VSource code : normedModType dSource code R) `(WSource code : normedModType d'Source code R)
(kSource code : V -> R) (fSource code : W) xSource code :
differentiable k x -> differentiable (fun zSource code => k z *: f) x.
Lemma diff_linUsed by
Source code `(VSource code : normedModType dSource code R) `(WSource code : normedModType d'Source code R)
(fSource code : {linear V -> W}) xSource code :
continuous f -> 'd f x = f :> (V -> W).
Lemma linear_differentiableUsed by
Source code `(VSource code : normedModType dSource code R) `(WSource code : normedModType d'Source code R)
(fSource code : {linear V -> W}) xSource code :
continuous f -> differentiable f x.
Global Instance is_diff_idSource code `(VSource code : normedModType dSource code R) (xSource code : V) : is_diff x id id.
Global Instance is_diff_scalerSource code `(VSource code : normedModType dSource code R) (kSource code : R) (xSource code : V) :
is_diff x ( *:%R k) ( *:%R k).
Global Instance is_diff_scalelSource code `(VSource code : normedModType dSource code R) (kSource code : R) (xSource code : V) :
is_diff k ( *:%R ^~ x) ( *:%R ^~ x).
Lemma linear_lipschitzSource code `(VSource code : normedModType dSource code R) `(WSource code : normedModType d'Source code R)
(fSource code : {linear V -> W}) :
continuous f -> exists2 kSource code, k > 0 & forall xSource code, `|f x| <= k * `|x|.
Lemma linear_eqOSource code `(VSource code : normedModType dSource code R) `(WSource code : normedModType d'Source code R)
(fSource code : {linear V -> W}) :
continuous f -> (f : V -> W) =O_ 0 id.
Lemma diff_eqOSource code `(VSource code : normedModType dSource code R) `(WSource code : normedModType d'Source code R)
(xSource code : filter_on V) (fSource code : V -> W) :
differentiable f x -> ('d f x : V -> W) =O_ 0 id.
Lemma compOo_eqoxSource code `(USource code : normedModType d1Source code R) `(VSource code : normedModType d2Source code R)
`(WSource code : normedModType d3Source code R) (fSource code : U -> V) (gSource code : V -> W) xSource code :
[O_ 0 id of g] ([o_ 0 id of f] x) =o_(xSource code \near 0) x.
Fact dcompSource code `(USource code : normedModType d1Source code R) `(VSource code : normedModType d2Source code R)
`(WSource code : normedModType d3Source code R) (fSource code : U -> V) (gSource code : V -> W) xSource code :
differentiable f x -> differentiable g (f x) ->
continuous ('d g (f x) \o 'd f x) /\ forall ySource code,
g (f (y + x)) = g (f x) + ('d g (f x) \o 'd f x) y +o_(ySource code \near 0) y.
Lemma diff_compUsed by
Source code `(USource code : normedModType d1Source code R) `(VSource code : normedModType d2Source code R)
`(WSource code : normedModType d3Source code R) (fSource code : U -> V) (gSource code : V -> W) xSource code :
differentiable f x -> differentiable g (f x) ->
'd (g \o f) x = 'd g (f x) \o 'd f x :> (U -> W).
Lemma differentiable_compUsed by
Source code `(USource code : normedModType d1Source code R)
`(VSource code : normedModType d2Source code R) `(WSource code : normedModType d3Source code R)
(fSource code : U -> V) (gSource code : V -> W) xSource code :
differentiable f x -> differentiable g (f x) -> differentiable (g \o f) x.
Global Instance is_diff_compSource code `(USource code : normedModType d1Source code R)
`(VSource code : normedModType d2Source code R) `(WSource code : normedModType d3Source code R)
(fSource code dfSource code : U -> V) (gSource code dgSource code : V -> W) xSource code :
is_diff x f df -> is_diff (f x) g dg -> is_diff x (g \o f) (dg \o df) | 99.
Lemma bilinear_schwarzSource code `(USource code : normedModType d1Source code R) `(VSource code : normedModType d2Source code R)
`(WSource code : normedModType d3Source code R) (fSource code : {bilinear U -> V -> W}) :
continuous (fun pSource code => f p.1 p.2) ->
exists2 kSource code, k > 0 & forall uSource code vSource code, `|f u v| <= k * `|u| * `|v|.
Lemma bilinear_eqoSource code `(USource code : normedModType d1Source code R) `(VSource code : normedModType d2Source code R)
`(WSource code : normedModType d3Source code R) (fSource code : {bilinear U -> V -> W}) :
continuous (fun pSource code => f p.1 p.2) -> (fun pSource code => f p.1 p.2) =o_ (0 : U * V) id.
Fact dbilinSource code `(USource code : normedModType d1Source code R) `(VSource code : normedModType d2Source code R)
`(WSource code : normedModType d3Source code R) (fSource code : {bilinear U -> V -> W}) pSource code :
continuous (fun pSource code => f p.1 p.2) ->
continuous (fun qSource code => (f p.1 q.2 + f q.1 p.2)) /\
(fun qSource code => f q.1 q.2) \o shift p = cst (f p.1 p.2) +
(fun qSource code => f p.1 q.2 + f q.1 p.2) +o_ (0 : U * V) id.
Lemma diff_bilinSource code `(USource code : normedModType d1Source code R) `(VSource code : normedModType d2Source code R)
`(WSource code : normedModType d3Source code R) (fSource code : {bilinear U -> V -> W}) pSource code :
continuous (fun pSource code => f p.1 p.2) -> 'd (fun qSource code => f q.1 q.2) p =
(fun qSource code => f p.1 q.2 + f q.1 p.2) :> (U * V -> W).
Lemma differentiable_bilinSource code `(USource code : normedModType d1Source code R) `(VSource code : normedModType d2Source code R)
`(WSource code : normedModType d3Source code R) (fSource code : {bilinear U -> V -> W}) pSource code :
continuous (fun pSource code => f p.1 p.2) -> differentiable (fun pSource code => f p.1 p.2) p.
Lemma mulr_is_bilinearSource code :
bilinear_for
(GRing.Scale.Law.clone _ _ *:%R _) (GRing.Scale.Law.clone _ _ *:%R _)
(@GRing.mul R).
HBSource code.instanceSource code DefinitionSource code _Source code :=Source code bilinear_isBilinearSource code.Build R R R R _ _ (@GRing.mul R)
mulr_is_bilinear.
Global Instance is_diff_mulrSource code (pSource code : R * R) :
is_diff p (fun q => q.1 * q.2) (fun qSource code => p.1 * q.2 + q.1 * p.2).
Lemma eqo_pairSource code `(USource code : normedModType d1Source code R) `(VSource code : normedModType d2Source code R)
`(WSource code : normedModType d3Source code R) (FSource code : filter_on U) (fSource code : U -> V) (gSource code : U -> W) :
(fun tSource code => ([o_F id of f] t, [o_F id of g] t)) =o_F id.
Fact dpairSource code `(USource code : normedModType d1Source code R) `(VSource code : normedModType d2Source code R)
`(WSource code : normedModType d3Source code R) (fSource code : U -> V) (gSource code : U -> W) xSource code :
differentiable f x -> differentiable g x ->
continuous (fun ySource code => ('d f x y, 'd g x y)) /\
(fun ySource code => (f y, g y)) \o shift x = cst (f x, g x) +
(fun ySource code => ('d f x y, 'd g x y)) +o_ 0 id.
Lemma diff_pairSource code `(USource code : normedModType d1Source code R) `(VSource code : normedModType d2Source code R)
`(WSource code : normedModType d3Source code R) (fSource code : U -> V) (gSource code : U -> W) xSource code :
differentiable f x -> differentiable g x -> 'd (fun ySource code => (f y, g y)) x =
(fun ySource code => ('d f x y, 'd g x y)) :> (U -> V * W).
Lemma differentiable_pairSource code `(USource code : normedModType d1Source code R) `(VSource code : normedModType d2Source code R)
`(WSource code : normedModType d3Source code R) (fSource code : U -> V) (gSource code : U -> W) xSource code :
differentiable f x -> differentiable g x ->
differentiable (fun ySource code => (f y, g y)) x.
Global Instance is_diff_pairSource code `(USource code : normedModType d1Source code R) `(VSource code : normedModType d2Source code R)
`(WSource code : normedModType d3Source code R) (fSource code dfSource code : U -> V) (gSource code dgSource code : U -> W) xSource code :
is_diff x f df -> is_diff x g dg ->
is_diff x (fun y => (f y, g y)) (fun ySource code => (df y, dg y)).
Global Instance is_diffMSource code `(VSource code : normedModType dSource code R) (fSource code gSource code dfSource code dgSource code : V -> R) xSource code :
is_diff x f df -> is_diff x g dg -> is_diff x (f * g) (f x *: dg + g x *: df).
Lemma diffMSource code `(VSource code : normedModType dSource code R) (fSource code gSource code : V -> R) xSource code :
differentiable f x -> differentiable g x ->
'd (f * g) x = f x \*: 'd g x + g x \*: 'd f x :> (V -> R).
Lemma differentiableMUsed by
Source code `(VSource code : normedModType dSource code R) (fSource code gSource code : V -> R) xSource code :
differentiable f x -> differentiable g x -> differentiable (f * g) x.
Fact dinvSource code (xSource code : R) :
x != 0 -> continuous (fun hSource code : R => - x ^- 2 *: h) /\
(fun xSource code => x^-1)%R \o shift x = cst (x^-1)%R +
(fun hSource code : R => - x ^- 2 *: h) +o_ 0 id.
Lemma diff_RinvSource code (xSource code : R) : x != 0 ->
'd GRing.inv x = (fun hSource code : R => - x ^- 2 *: h) :> (R -> R).
Lemma differentiable_RinvSource code (xSource code : R) : x != 0 ->
differentiable (GRing.inv : R -> R) x.
Lemma diffVSource code `(VSource code : normedModType dSource code R) (fSource code : V -> R) xSource code :
differentiable f x -> f x != 0 ->
'd (fun ySource code => (f y)^-1) x = - (f x) ^- 2 \*: 'd f x :> (V -> R).
Lemma differentiableVSource code `(VSource code : normedModType dSource code R) (fSource code : V -> R) xSource code :
differentiable f x -> f x != 0 -> differentiable (fun ySource code => (f y)^-1) x.
Global Instance is_diffXSource code `(VSource code : normedModType dSource code R) (fSource code dfSource code : V -> R) nSource code xSource code :
is_diff x f df -> is_diff x (f ^+ n.+1) (n.+1%:R * f x ^+ n *: df).
Lemma differentiableXSource code `(VSource code : normedModType dSource code R) (fSource code : V -> R) nSource code xSource code :
differentiable f x -> differentiable (f ^+ n.+1) x.
Lemma diffXSource code `(VSource code : normedModType dSource code R) (fSource code : V -> R) nSource code xSource code :
differentiable f x ->
'd (f ^+ n.+1) x = n.+1%:R * f x ^+ n \*: 'd f x :> (V -> R).
End DifferentialR3_numFieldType.
Arguments differentiable_comp {R d1 U d2 V d3 W} f g {x}.Context {RSource code : numFieldType}.
Generalizable Variables d.
Lemma littleo_linear0Source code `(VSource code : normedModType dSource code R) `(WSource code : normedModType d'Source code R)
(fSource code : {linear V -> W}) :
(f : V -> W) =o_ 0 id -> f = cst 0 :> (V -> W).
Proof.
move/eqoP => oid.
rewrite funeqE => x; apply/eqP; have [|xn0] := real_le0P (normr_real x).
by rewrite normr_le0 => /eqP ->; rewrite linear0.
rewrite -normr_le0 -(mul0r `|x|) -ler_pdivrMr //.
apply/ler_gtP => _ /posnumP[e]; rewrite ler_pdivrMr //.
have /oid /nbhs_ballP [_ /posnumP[e'] dfe] := [elaborate gt0 e].
set k := ((e'%:num / 2) / (PosNum xn0)%:num)^-1.
rewrite -{1}(@scalerKV _ _ k _ x) /k // linearZZ normrZ.
rewrite -ler_pdivlMl; first by rewrite gtr0_norm.
rewrite mulrCA (@le_trans _ _ (e%:num * `|k^-1 *: x|)) //; last first.
by rewrite ler_pM // normrZ normfV.
apply: dfe; rewrite -ball_normE /= sub0r normrN normrZ.
rewrite invrK -ltr_pdivlMr // ger0_norm // ltr_pdivrMr //.
by rewrite divfK ?lt0r_neq0// [ltRHS]splitr ltrDl.
Qed.
rewrite funeqE => x; apply/eqP; have [|xn0] := real_le0P (normr_real x).
by rewrite normr_le0 => /eqP ->; rewrite linear0.
rewrite -normr_le0 -(mul0r `|x|) -ler_pdivrMr //.
apply/ler_gtP => _ /posnumP[e]; rewrite ler_pdivrMr //.
have /oid /nbhs_ballP [_ /posnumP[e'] dfe] := [elaborate gt0 e].
set k := ((e'%:num / 2) / (PosNum xn0)%:num)^-1.
rewrite -{1}(@scalerKV _ _ k _ x) /k // linearZZ normrZ.
rewrite -ler_pdivlMl; first by rewrite gtr0_norm.
rewrite mulrCA (@le_trans _ _ (e%:num * `|k^-1 *: x|)) //; last first.
by rewrite ler_pM // normrZ normfV.
apply: dfe; rewrite -ball_normE /= sub0r normrN normrZ.
rewrite invrK -ltr_pdivlMr // ger0_norm // ltr_pdivrMr //.
by rewrite divfK ?lt0r_neq0// [ltRHS]splitr ltrDl.
Qed.
Lemma diff_uniqueUsed by
- mathcomp.analysis.derive.derive_matrix
- mathcomp.analysis.derive.derivative
Source code `(VSource code : normedModType dSource code R) `(WSource code : normedModType d'Source code R)
(fSource code : V -> W) (dfSource code : {linear V -> W}) xSource code :
continuous df -> f \o shift x = cst (f x) + df +o_ 0 id ->
'd f x = df :> (V -> W).
Proof.
move=> dfc dxf; apply/subr0_eq; rewrite -[LHS]/(_ \- _).
apply/littleo_linear0/eqoP/eq_some_oP => /=; rewrite funeqE => y /=.
have hdf h : (f \o shift x = cst (f x) + h +o_ 0 id) ->
h = f \o shift x - cst (f x) +o_ 0 id.
move=> hdf; apply: eqaddoE.
rewrite hdf addrAC -!addrA addrC !addrA subrK.
rewrite -[LHS]addr0 -addrA; congr (_ + _).
by apply/eqP; rewrite eq_sym addrC addr_eq0 oppo.
rewrite (hdf _ dxf).
suff /diff_locally /hdf -> : differentiable f x.
by rewrite [_ - _ + _]addrC addrKA oppox addox.
apply/diffP => /=.
apply: (@getPex _ (fun (dfSource code : {linear V -> W}) => continuous df /\
forall ySource code, f y = f (lim (nbhs x)) + df (y - lim (nbhs x))
+o_(ySource code \near x) (y - lim (nbhs x)))).
exists df; split=> //; apply: eqaddoEx => z.
rewrite (hdf _ dxf) !addrA lim_id // /(_ \o _) /= subrK [f _ + _]addrC addrK.
rewrite -addrA -[LHS]addr0; congr (_ + _).
apply/eqP; rewrite eq_sym addrC addr_eq0 oppox; apply/eqP.
rewrite [in LHS]littleo_center0 (comp_centerK x id).
by rewrite -[- _ in RHS](comp_centerK x).
Qed.
apply/littleo_linear0/eqoP/eq_some_oP => /=; rewrite funeqE => y /=.
have hdf h : (f \o shift x = cst (f x) + h +o_ 0 id) ->
h = f \o shift x - cst (f x) +o_ 0 id.
move=> hdf; apply: eqaddoE.
rewrite hdf addrAC -!addrA addrC !addrA subrK.
rewrite -[LHS]addr0 -addrA; congr (_ + _).
by apply/eqP; rewrite eq_sym addrC addr_eq0 oppo.
rewrite (hdf _ dxf).
suff /diff_locally /hdf -> : differentiable f x.
by rewrite [_ - _ + _]addrC addrKA oppox addox.
apply/diffP => /=.
apply: (@getPex _ (fun (dfSource code : {linear V -> W}) => continuous df /\
forall ySource code, f y = f (lim (nbhs x)) + df (y - lim (nbhs x))
+o_(ySource code \near x) (y - lim (nbhs x)))).
exists df; split=> //; apply: eqaddoEx => z.
rewrite (hdf _ dxf) !addrA lim_id // /(_ \o _) /= subrK [f _ + _]addrC addrK.
rewrite -addrA -[LHS]addr0; congr (_ + _).
apply/eqP; rewrite eq_sym addrC addr_eq0 oppox; apply/eqP.
rewrite [in LHS]littleo_center0 (comp_centerK x id).
by rewrite -[- _ in RHS](comp_centerK x).
Qed.
Lemma diff_cstSource code `(VSource code : normedModType dSource code R) `(WSource code : normedModType d'Source code R) aSource code xSource code :
('d (cst a) x : V -> W) = 0.
Proof.
Lemma differentiable_cstSource code `(VSource code : normedModType dSource code R) `(WSource code : normedModType d'Source code R)
(aSource code : W) (xSource code : V) :
differentiable (cst a) x.
Proof.
Global Instance is_diff_cstSource code `(VSource code : normedModType dSource code R) `(WSource code : normedModType d'Source code R)
(aSource code : W) (xSource code : V) :
is_diff x (cst a) 0.
Proof.
Lemma diffDSource code `(VSource code : normedModType dSource code R) `(WSource code : normedModType d'Source code R)
(fSource code gSource code : V -> W) xSource code :
differentiable f x -> differentiable g x ->
'd (f + g) x = 'd f x \+ 'd g x :> (V -> W).
Proof.
Lemma differentiableDSource code `(VSource code : normedModType dSource code R) `(WSource code : normedModType d'Source code R)
(fSource code gSource code : V -> W) xSource code :
differentiable f x -> differentiable g x -> differentiable (f + g) x.
Proof.
Global Instance is_diffDSource code `(VSource code : normedModType dSource code R) `(WSource code : normedModType d'Source code R)
(fSource code gSource code dfSource code dgSource code : V -> W) xSource code :
is_diff x f df -> is_diff x g dg -> is_diff x (f + g) (df + dg).
Proof.
move=> dfx dgx; apply: DiffDef; first exact: differentiableD.
by rewrite diffD; last (congr (_ + _); apply: diff_val).
Qed.
by rewrite diffD; last (congr (_ + _); apply: diff_val).
Qed.
Lemma differentiable_sumSource code `(VSource code : normedModType dSource code R) `(WSource code : normedModType d'Source code R)
nSource code (fSource code : 'I_n -> V -> W) (xSource code : V) :
(forall iSource code, differentiable (f i) x) -> differentiable (\sum_(iSource code < n) f i) x.
Proof.
Lemma diffNSource code `(VSource code : normedModType dSource code R) `(WSource code : normedModType d'Source code R) (fSource code : V -> W) xSource code :
differentiable f x -> 'd (- f) x = - ('d f x : V -> W) :> (V -> W).
Proof.
Lemma differentiableNSource code `(VSource code : normedModType dSource code R) `(WSource code : normedModType d'Source code R)
(fSource code : V -> W) xSource code :
differentiable f x -> differentiable (- f) x.
Proof.
Global Instance is_diffNSource code `(VSource code : normedModType dSource code R) `(WSource code : normedModType d'Source code R)
(fSource code dfSource code : V -> W) xSource code :
is_diff x f df -> is_diff x (- f) (- df).
Proof.
Global Instance is_diffBSource code `(VSource code : normedModType dSource code R) `(WSource code : normedModType d'Source code R)
(fSource code gSource code dfSource code dgSource code : V -> W) xSource code :
is_diff x f df -> is_diff x g dg -> is_diff x (f - g) (df - dg).
Proof.
Lemma diffBSource code `(VSource code : normedModType dSource code R) `(WSource code : normedModType d'Source code R)
(fSource code gSource code : V -> W) xSource code :
differentiable f x -> differentiable g x ->
'd (f - g) x = 'd f x \- 'd g x :> (V -> W).
Proof.
Lemma differentiableBSource code `(VSource code : normedModType dSource code R) `(WSource code : normedModType d'Source code R)
(fSource code gSource code : V -> W) xSource code :
differentiable f x -> differentiable g x -> differentiable (f \- g) x.
Proof.
Lemma diffZSource code `(VSource code : normedModType dSource code R) `(WSource code : normedModType d'Source code R)
(fSource code : V -> W) kSource code xSource code :
differentiable f x -> 'd (k *: f) x = k \*: 'd f x :> (V -> W).
Proof.
Lemma differentiableZSource code `(VSource code : normedModType dSource code R) `(WSource code : normedModType d'Source code R)
(fSource code : V -> W) kSource code xSource code :
differentiable f x -> differentiable (k *: f) x.
Proof.
Global Instance is_diffZSource code `(VSource code : normedModType dSource code R) `(WSource code : normedModType d'Source code R)
(fSource code dfSource code : V -> W) kSource code xSource code :
is_diff x f df -> is_diff x (k *: f) (k *: df).
Proof.
Lemma diffZlSource code `(VSource code : normedModType dSource code R) `(WSource code : normedModType d'Source code R)
(kSource code : V -> R) (fSource code : W) xSource code :
differentiable k x ->
'd (fun zSource code => k z *: f) x = (fun zSource code => 'd k x z *: f) :> (_ -> _).
Proof.
Lemma differentiableZlSource code `(VSource code : normedModType dSource code R) `(WSource code : normedModType d'Source code R)
(kSource code : V -> R) (fSource code : W) xSource code :
differentiable k x -> differentiable (fun zSource code => k z *: f) x.
Proof.
Lemma diff_linUsed by
- mathcomp.analysis.derive.derivative_lemmas
Source code `(VSource code : normedModType dSource code R) `(WSource code : normedModType d'Source code R)
(fSource code : {linear V -> W}) xSource code :
continuous f -> 'd f x = f :> (V -> W).
Proof.
Lemma linear_differentiableUsed by
- mathcomp.analysis.derive.derive_matrix
Source code `(VSource code : normedModType dSource code R) `(WSource code : normedModType d'Source code R)
(fSource code : {linear V -> W}) xSource code :
continuous f -> differentiable f x.
Proof.
Global Instance is_diff_idSource code `(VSource code : normedModType dSource code R) (xSource code : V) : is_diff x id id.
Proof.
apply: DiffDef.
by apply: (@linear_differentiable _ _ _ _ idfun) => ? //.
by rewrite (@diff_lin _ _ _ _ idfun) // => ? //.
Qed.
by apply: (@linear_differentiable _ _ _ _ idfun) => ? //.
by rewrite (@diff_lin _ _ _ _ idfun) // => ? //.
Qed.
Global Instance is_diff_scalerSource code `(VSource code : normedModType dSource code R) (kSource code : R) (xSource code : V) :
is_diff x ( *:%R k) ( *:%R k).
Proof.
apply: DiffDef; first exact/linear_differentiable/scaler_continuous.
by rewrite diff_lin //; apply: scaler_continuous.
Qed.
by rewrite diff_lin //; apply: scaler_continuous.
Qed.
Global Instance is_diff_scalelSource code `(VSource code : normedModType dSource code R) (kSource code : R) (xSource code : V) :
is_diff k ( *:%R ^~ x) ( *:%R ^~ x).
Proof.
have sx_lin : linear ( *:%R ^~ x : R -> _).
by move=> u y z; rewrite scalerDl scalerA.
pose sxlM := GRing.isLinear.Build _ _ _ _ _ sx_lin.
pose sxL : {linear _ -> _} := HB.pack ( *:%R ^~ x) sxlM.
have -> : *:%R ^~ x = sxL by rewrite funeqE.
apply: DiffDef; first exact/linear_differentiable/scalel_continuous.
by rewrite diff_lin //; apply: scalel_continuous.
Qed.
by move=> u y z; rewrite scalerDl scalerA.
pose sxlM := GRing.isLinear.Build _ _ _ _ _ sx_lin.
pose sxL : {linear _ -> _} := HB.pack ( *:%R ^~ x) sxlM.
have -> : *:%R ^~ x = sxL by rewrite funeqE.
apply: DiffDef; first exact/linear_differentiable/scalel_continuous.
by rewrite diff_lin //; apply: scalel_continuous.
Qed.
Lemma linear_lipschitzSource code `(VSource code : normedModType dSource code R) `(WSource code : normedModType d'Source code R)
(fSource code : {linear V -> W}) :
continuous f -> exists2 kSource code, k > 0 & forall xSource code, `|f x| <= k * `|x|.
Proof.
move=> /(_ 0); rewrite /continuous_at linear0 => /(_ _ (nbhsx_ballx _ _ ltr01)).
move=> /nbhs_ballP [_ /posnumP[e] he]; exists (2 / e%:num) => // x.
have [|xn0] := real_le0P (normr_real x).
by rewrite normr_le0 => /eqP->; rewrite linear0 !normr0 mulr0.
set k := 2 / e%:num * (PosNum xn0)%:num.
have kn0 : k != 0 by rewrite /k.
have abskgt0 : `|k| > 0 by rewrite normr_gt0.
rewrite -[x in leLHS](scalerKV kn0) linearZZ normrZ -ler_pdivlMl //.
suff /he : ball 0 e%:num (k^-1 *: x).
rewrite -ball_normE /= distrC subr0 => /ltW /le_trans; apply.
by rewrite ger0_norm /k // mulVf.
rewrite -ball_normE /= distrC subr0 normrZ.
rewrite normfV ger0_norm /k // invfM/= divfK ?gt_eqF//.
by rewrite invf_div gtr_pMr// invf_lt1// ltr1n.
Qed.
move=> /nbhs_ballP [_ /posnumP[e] he]; exists (2 / e%:num) => // x.
have [|xn0] := real_le0P (normr_real x).
by rewrite normr_le0 => /eqP->; rewrite linear0 !normr0 mulr0.
set k := 2 / e%:num * (PosNum xn0)%:num.
have kn0 : k != 0 by rewrite /k.
have abskgt0 : `|k| > 0 by rewrite normr_gt0.
rewrite -[x in leLHS](scalerKV kn0) linearZZ normrZ -ler_pdivlMl //.
suff /he : ball 0 e%:num (k^-1 *: x).
rewrite -ball_normE /= distrC subr0 => /ltW /le_trans; apply.
by rewrite ger0_norm /k // mulVf.
rewrite -ball_normE /= distrC subr0 normrZ.
rewrite normfV ger0_norm /k // invfM/= divfK ?gt_eqF//.
by rewrite invf_div gtr_pMr// invf_lt1// ltr1n.
Qed.
Lemma linear_eqOSource code `(VSource code : normedModType dSource code R) `(WSource code : normedModType d'Source code R)
(fSource code : {linear V -> W}) :
continuous f -> (f : V -> W) =O_ 0 id.
Proof.
Lemma diff_eqOSource code `(VSource code : normedModType dSource code R) `(WSource code : normedModType d'Source code R)
(xSource code : filter_on V) (fSource code : V -> W) :
differentiable f x -> ('d f x : V -> W) =O_ 0 id.
Proof.
Lemma compOo_eqoxSource code `(USource code : normedModType d1Source code R) `(VSource code : normedModType d2Source code R)
`(WSource code : normedModType d3Source code R) (fSource code : U -> V) (gSource code : V -> W) xSource code :
[O_ 0 id of g] ([o_ 0 id of f] x) =o_(xSource code \near 0) x.
Proof.
Fact dcompSource code `(USource code : normedModType d1Source code R) `(VSource code : normedModType d2Source code R)
`(WSource code : normedModType d3Source code R) (fSource code : U -> V) (gSource code : V -> W) xSource code :
differentiable f x -> differentiable g (f x) ->
continuous ('d g (f x) \o 'd f x) /\ forall ySource code,
g (f (y + x)) = g (f x) + ('d g (f x) \o 'd f x) y +o_(ySource code \near 0) y.
Proof.
move=> df dg; split; first by move=> ?; apply: continuous_comp.
apply: eqaddoEx => y; rewrite diff_locallyx// -addrA diff_locallyxC// linearD.
rewrite addrA -[LHS]addrA; congr (_ + _ + _).
rewrite diff_eqO // ['d f x : _ -> _]diff_eqO //.
by rewrite {2}eqoO addOx compOo_eqox compoO_eqox addox.
Qed.
apply: eqaddoEx => y; rewrite diff_locallyx// -addrA diff_locallyxC// linearD.
rewrite addrA -[LHS]addrA; congr (_ + _ + _).
rewrite diff_eqO // ['d f x : _ -> _]diff_eqO //.
by rewrite {2}eqoO addOx compOo_eqox compoO_eqox addox.
Qed.
Lemma diff_compUsed by
- mathcomp.analysis.derive.derivative_lemmas
Source code `(USource code : normedModType d1Source code R) `(VSource code : normedModType d2Source code R)
`(WSource code : normedModType d3Source code R) (fSource code : U -> V) (gSource code : V -> W) xSource code :
differentiable f x -> differentiable g (f x) ->
'd (g \o f) x = 'd g (f x) \o 'd f x :> (U -> W).
Proof.
Lemma differentiable_compUsed by
- mathcomp.analysis.gauss_integral
- mathcomp.analysis.derive.derivative_lemmas
- mathcomp.analysis.derive.derivative
- mathcomp.analysis.ftc
- mathcomp.analysis.exp
Source code `(USource code : normedModType d1Source code R)
`(VSource code : normedModType d2Source code R) `(WSource code : normedModType d3Source code R)
(fSource code : U -> V) (gSource code : V -> W) xSource code :
differentiable f x -> differentiable g (f x) -> differentiable (g \o f) x.
Proof.
Global Instance is_diff_compSource code `(USource code : normedModType d1Source code R)
`(VSource code : normedModType d2Source code R) `(WSource code : normedModType d3Source code R)
(fSource code dfSource code : U -> V) (gSource code dgSource code : V -> W) xSource code :
is_diff x f df -> is_diff (f x) g dg -> is_diff x (g \o f) (dg \o df) | 99.
Proof.
move=> dfx dgfx; apply: DiffDef; first exact: differentiable_comp.
by rewrite diff_comp // !diff_val.
Qed.
by rewrite diff_comp // !diff_val.
Qed.
Lemma bilinear_schwarzSource code `(USource code : normedModType d1Source code R) `(VSource code : normedModType d2Source code R)
`(WSource code : normedModType d3Source code R) (fSource code : {bilinear U -> V -> W}) :
continuous (fun pSource code => f p.1 p.2) ->
exists2 kSource code, k > 0 & forall uSource code vSource code, `|f u v| <= k * `|u| * `|v|.
Proof.
move=> /(_ 0); rewrite /continuous_at linear0r => /(_ _ (nbhsx_ballx _ _ ltr01)).
move=> /nbhs_ballP [_ /posnumP[e] he]; exists ((2 / e%:num) ^+2) => // u v.
have [|un0] := real_le0P (normr_real u).
by rewrite normr_le0 => /eqP->; rewrite linear0l !normr0 mulr0 mul0r.
have [|vn0] := real_le0P (normr_real v).
by rewrite normr_le0 => /eqP->; rewrite linear0r !normr0 mulr0.
rewrite -[`|u|]/((PosNum un0)%:num) -[`|v|]/((PosNum vn0)%:num).
set ku := 2 / e%:num * (PosNum un0)%:num.
set kv := 2 / e%:num * (PosNum vn0)%:num.
rewrite -[X in f X](@scalerKV _ _ ku) /ku // linearZl_LR normrZ.
rewrite gtr0_norm // -ler_pdivlMl //.
rewrite -[X in f _ X](@scalerKV _ _ kv) /kv // linearZr_LR normrZ.
rewrite gtr0_norm // -ler_pdivlMl //.
suff /he : ball 0 e%:num (ku^-1 *: u, kv^-1 *: v).
rewrite -ball_normE /= distrC subr0 => /ltW /le_trans; apply.
rewrite ler_pdivlMl 1?pmulr_lgt0// mulr1 ler_pdivlMl 1?pmulr_lgt0//.
by rewrite mulrA [ku * _]mulrAC expr2.
rewrite -ball_normE /= distrC subr0.
have -> : (ku^-1 *: u, kv^-1 *: v) =
(e%:num / 2) *: ((PosNum un0)%:num ^-1 *: u, (PosNum vn0)%:num ^-1 *: v).
by rewrite invfM [kv ^-1]invfM invf_div -[_ *: u]scalerA -[_ *: v]scalerA.
rewrite normrZ ger0_norm // -mulrA gtr_pMr // ltr_pdivrMl // mulr1.
by rewrite prod_normE/= !normrZ !normfV !normr_id !mulVf ?gt_eqF// maxxx ltr1n.
Qed.
move=> /nbhs_ballP [_ /posnumP[e] he]; exists ((2 / e%:num) ^+2) => // u v.
have [|un0] := real_le0P (normr_real u).
by rewrite normr_le0 => /eqP->; rewrite linear0l !normr0 mulr0 mul0r.
have [|vn0] := real_le0P (normr_real v).
by rewrite normr_le0 => /eqP->; rewrite linear0r !normr0 mulr0.
rewrite -[`|u|]/((PosNum un0)%:num) -[`|v|]/((PosNum vn0)%:num).
set ku := 2 / e%:num * (PosNum un0)%:num.
set kv := 2 / e%:num * (PosNum vn0)%:num.
rewrite -[X in f X](@scalerKV _ _ ku) /ku // linearZl_LR normrZ.
rewrite gtr0_norm // -ler_pdivlMl //.
rewrite -[X in f _ X](@scalerKV _ _ kv) /kv // linearZr_LR normrZ.
rewrite gtr0_norm // -ler_pdivlMl //.
suff /he : ball 0 e%:num (ku^-1 *: u, kv^-1 *: v).
rewrite -ball_normE /= distrC subr0 => /ltW /le_trans; apply.
rewrite ler_pdivlMl 1?pmulr_lgt0// mulr1 ler_pdivlMl 1?pmulr_lgt0//.
by rewrite mulrA [ku * _]mulrAC expr2.
rewrite -ball_normE /= distrC subr0.
have -> : (ku^-1 *: u, kv^-1 *: v) =
(e%:num / 2) *: ((PosNum un0)%:num ^-1 *: u, (PosNum vn0)%:num ^-1 *: v).
by rewrite invfM [kv ^-1]invfM invf_div -[_ *: u]scalerA -[_ *: v]scalerA.
rewrite normrZ ger0_norm // -mulrA gtr_pMr // ltr_pdivrMl // mulr1.
by rewrite prod_normE/= !normrZ !normfV !normr_id !mulVf ?gt_eqF// maxxx ltr1n.
Qed.
Lemma bilinear_eqoSource code `(USource code : normedModType d1Source code R) `(VSource code : normedModType d2Source code R)
`(WSource code : normedModType d3Source code R) (fSource code : {bilinear U -> V -> W}) :
continuous (fun pSource code => f p.1 p.2) -> (fun pSource code => f p.1 p.2) =o_ (0 : U * V) id.
Proof.
move=> fc; have [_ /posnumP[k] fschwarz] := bilinear_schwarz fc.
apply/eqoP=> _ /posnumP[e]; near=> x; rewrite (le_trans (fschwarz _ _))//.
rewrite ler_pM ?pmulr_rge0 //; last by rewrite num_le_max /= lexx orbT.
rewrite -ler_pdivlMl //.
suff : `|x| <= k%:num ^-1 * e%:num.
by apply: le_trans; rewrite num_le_max /= lexx.
near: x; apply/nbhs_le_nbhs_norm.
by exists (k%:num ^-1 * e%:num) => //= ? /=; rewrite /= distrC subr0 => /ltW.
Unshelve. all: by end_near. Qed.
apply/eqoP=> _ /posnumP[e]; near=> x; rewrite (le_trans (fschwarz _ _))//.
rewrite ler_pM ?pmulr_rge0 //; last by rewrite num_le_max /= lexx orbT.
rewrite -ler_pdivlMl //.
suff : `|x| <= k%:num ^-1 * e%:num.
by apply: le_trans; rewrite num_le_max /= lexx.
near: x; apply/nbhs_le_nbhs_norm.
by exists (k%:num ^-1 * e%:num) => //= ? /=; rewrite /= distrC subr0 => /ltW.
Unshelve. all: by end_near. Qed.
Fact dbilinSource code `(USource code : normedModType d1Source code R) `(VSource code : normedModType d2Source code R)
`(WSource code : normedModType d3Source code R) (fSource code : {bilinear U -> V -> W}) pSource code :
continuous (fun pSource code => f p.1 p.2) ->
continuous (fun qSource code => (f p.1 q.2 + f q.1 p.2)) /\
(fun qSource code => f q.1 q.2) \o shift p = cst (f p.1 p.2) +
(fun qSource code => f p.1 q.2 + f q.1 p.2) +o_ (0 : U * V) id.
Proof.
move=> fc; split=> [q|].
by apply: (@continuousD _ _ _ _ _ (fun qSource code => f p.1 q.2) (fun qSource code => f q.1 p.2));
move=> A /(fc (_.1, _.2)) /= /nbhs_ballP [_ /posnumP[e] fpqe_A];
apply/nbhs_ballP; exists e%:num => //= r [? ?]; exact: (fpqe_A (_.1, _.2)).
apply/eqaddoE; rewrite funeqE => q /=.
rewrite linearDr !linearDl -addrA addrC addrA [_ + f p.1 p.2]addrC.
by congr (_ + _); rewrite -[LHS]/((fun pSource code => f p.1 p.2) q) bilinear_eqo.
Qed.
by apply: (@continuousD _ _ _ _ _ (fun qSource code => f p.1 q.2) (fun qSource code => f q.1 p.2));
move=> A /(fc (_.1, _.2)) /= /nbhs_ballP [_ /posnumP[e] fpqe_A];
apply/nbhs_ballP; exists e%:num => //= r [? ?]; exact: (fpqe_A (_.1, _.2)).
apply/eqaddoE; rewrite funeqE => q /=.
rewrite linearDr !linearDl -addrA addrC addrA [_ + f p.1 p.2]addrC.
by congr (_ + _); rewrite -[LHS]/((fun pSource code => f p.1 p.2) q) bilinear_eqo.
Qed.
Lemma diff_bilinSource code `(USource code : normedModType d1Source code R) `(VSource code : normedModType d2Source code R)
`(WSource code : normedModType d3Source code R) (fSource code : {bilinear U -> V -> W}) pSource code :
continuous (fun pSource code => f p.1 p.2) -> 'd (fun qSource code => f q.1 q.2) p =
(fun qSource code => f p.1 q.2 + f q.1 p.2) :> (U * V -> W).
Proof.
pose s qSource code := f p.1 q.2 + f q.1 p.2.
move=> fc; have lind : linear s.
by move=> ? ? ?; rewrite /s linearPr linearPl scalerDr addrACA.
pose slM := GRing.isLinear.Build _ _ _ _ _ lind.
pose sL : {linear _ -> _} := HB.pack s slM.
rewrite -/s -[s]/(sL : _ -> _).
by apply/diff_unique; have [] := dbilin p fc.
Qed.
move=> fc; have lind : linear s.
by move=> ? ? ?; rewrite /s linearPr linearPl scalerDr addrACA.
pose slM := GRing.isLinear.Build _ _ _ _ _ lind.
pose sL : {linear _ -> _} := HB.pack s slM.
rewrite -/s -[s]/(sL : _ -> _).
by apply/diff_unique; have [] := dbilin p fc.
Qed.
Lemma differentiable_bilinSource code `(USource code : normedModType d1Source code R) `(VSource code : normedModType d2Source code R)
`(WSource code : normedModType d3Source code R) (fSource code : {bilinear U -> V -> W}) pSource code :
continuous (fun pSource code => f p.1 p.2) -> differentiable (fun pSource code => f p.1 p.2) p.
Proof.
Lemma mulr_is_bilinearSource code :
bilinear_for
(GRing.Scale.Law.clone _ _ *:%R _) (GRing.Scale.Law.clone _ _ *:%R _)
(@GRing.mul R).
HBSource code.instanceSource code DefinitionSource code _Source code :=Source code bilinear_isBilinearSource code.Build R R R R _ _ (@GRing.mul R)
mulr_is_bilinear.
Global Instance is_diff_mulrSource code (pSource code : R * R) :
is_diff p (fun q => q.1 * q.2) (fun qSource code => p.1 * q.2 + q.1 * p.2).
Proof.
apply: DiffDef; last by rewrite diff_bilin // => ?; apply: mul_continuous.
by apply: differentiable_bilin =>?; apply: mul_continuous.
Qed.
by apply: differentiable_bilin =>?; apply: mul_continuous.
Qed.
Lemma eqo_pairSource code `(USource code : normedModType d1Source code R) `(VSource code : normedModType d2Source code R)
`(WSource code : normedModType d3Source code R) (FSource code : filter_on U) (fSource code : U -> V) (gSource code : U -> W) :
(fun tSource code => ([o_F id of f] t, [o_F id of g] t)) =o_F id.
Proof.
apply/eqoP => _/posnumP[e]; near=> x; rewrite num_ge_max /=.
by apply/andP; split; near: x; apply: littleoP.
Unshelve. all: by end_near. Qed.
by apply/andP; split; near: x; apply: littleoP.
Unshelve. all: by end_near. Qed.
Fact dpairSource code `(USource code : normedModType d1Source code R) `(VSource code : normedModType d2Source code R)
`(WSource code : normedModType d3Source code R) (fSource code : U -> V) (gSource code : U -> W) xSource code :
differentiable f x -> differentiable g x ->
continuous (fun ySource code => ('d f x y, 'd g x y)) /\
(fun ySource code => (f y, g y)) \o shift x = cst (f x, g x) +
(fun ySource code => ('d f x y, 'd g x y)) +o_ 0 id.
Proof.
move=> df dg; split=> [?|]; first by apply: cvg_pair; apply: diff_continuous.
apply/eqaddoE; rewrite funeqE => y /=.
rewrite ![_ (_ + x)]diff_locallyx//.
(* fixme *)
have -> : forall hSource code eSource code, (f x + 'd f x y + [o_ 0 id of h] y,
g x + 'd g x y + [o_ 0 id of e] y) =
(f x, g x) + ('d f x y, 'd g x y) +
([o_ 0 id of h] y, [o_ 0id of e] y) by [].
by congr (_ + _); rewrite -[LHS]/((fun ySource code => (_ y, _ y)) y) eqo_pair.
Qed.
apply/eqaddoE; rewrite funeqE => y /=.
rewrite ![_ (_ + x)]diff_locallyx//.
(* fixme *)
have -> : forall hSource code eSource code, (f x + 'd f x y + [o_ 0 id of h] y,
g x + 'd g x y + [o_ 0 id of e] y) =
(f x, g x) + ('d f x y, 'd g x y) +
([o_ 0 id of h] y, [o_ 0id of e] y) by [].
by congr (_ + _); rewrite -[LHS]/((fun ySource code => (_ y, _ y)) y) eqo_pair.
Qed.
Lemma diff_pairSource code `(USource code : normedModType d1Source code R) `(VSource code : normedModType d2Source code R)
`(WSource code : normedModType d3Source code R) (fSource code : U -> V) (gSource code : U -> W) xSource code :
differentiable f x -> differentiable g x -> 'd (fun ySource code => (f y, g y)) x =
(fun ySource code => ('d f x y, 'd g x y)) :> (U -> V * W).
Proof.
move=> df dg.
pose p ySource code := ('d f x y, 'd g x y).
have lin_pair : linear p by move=> ???; rewrite /p !linearPZ.
pose pairlM := GRing.isLinear.Build _ _ _ _ _ lin_pair.
pose pairL : {linear _ -> _} := HB.pack p pairlM.
rewrite -/p -[p]/(pairL : _ -> _).
by apply: diff_unique; have [] := dpair df dg.
Qed.
pose p ySource code := ('d f x y, 'd g x y).
have lin_pair : linear p by move=> ???; rewrite /p !linearPZ.
pose pairlM := GRing.isLinear.Build _ _ _ _ _ lin_pair.
pose pairL : {linear _ -> _} := HB.pack p pairlM.
rewrite -/p -[p]/(pairL : _ -> _).
by apply: diff_unique; have [] := dpair df dg.
Qed.
Lemma differentiable_pairSource code `(USource code : normedModType d1Source code R) `(VSource code : normedModType d2Source code R)
`(WSource code : normedModType d3Source code R) (fSource code : U -> V) (gSource code : U -> W) xSource code :
differentiable f x -> differentiable g x ->
differentiable (fun ySource code => (f y, g y)) x.
Proof.
Global Instance is_diff_pairSource code `(USource code : normedModType d1Source code R) `(VSource code : normedModType d2Source code R)
`(WSource code : normedModType d3Source code R) (fSource code dfSource code : U -> V) (gSource code dgSource code : U -> W) xSource code :
is_diff x f df -> is_diff x g dg ->
is_diff x (fun y => (f y, g y)) (fun ySource code => (df y, dg y)).
Proof.
move=> dfx dgx; apply: DiffDef; first exact: differentiable_pair.
by rewrite diff_pair // !diff_val.
Qed.
by rewrite diff_pair // !diff_val.
Qed.
Global Instance is_diffMSource code `(VSource code : normedModType dSource code R) (fSource code gSource code dfSource code dgSource code : V -> R) xSource code :
is_diff x f df -> is_diff x g dg -> is_diff x (f * g) (f x *: dg + g x *: df).
Proof.
Lemma diffMSource code `(VSource code : normedModType dSource code R) (fSource code gSource code : V -> R) xSource code :
differentiable f x -> differentiable g x ->
'd (f * g) x = f x \*: 'd g x + g x \*: 'd f x :> (V -> R).
Proof.
Lemma differentiableMUsed by
- mathcomp.analysis.exp
Source code `(VSource code : normedModType dSource code R) (fSource code gSource code : V -> R) xSource code :
differentiable f x -> differentiable g x -> differentiable (f * g) x.
Proof.
Fact dinvSource code (xSource code : R) :
x != 0 -> continuous (fun hSource code : R => - x ^- 2 *: h) /\
(fun xSource code => x^-1)%R \o shift x = cst (x^-1)%R +
(fun hSource code : R => - x ^- 2 *: h) +o_ 0 id.
Proof.
move=> xn0; split; first by move=> ?; exact: continuousZl_tmp.
apply/eqaddoP => _ /posnumP[e]; near=> h.
have hDx_neq0 : h + x != 0.
near: h; rewrite !nbhs_simpl; apply/nbhs_normP.
exists `|x|; first by rewrite /= normr_gt0.
move=> h /=; rewrite /= distrC subr0 -subr_gt0 => lthx.
rewrite -(normr_gt0 (h + x)) addrC -[h]opprK.
apply: lt_le_trans (ler_dist_dist _ _).
by rewrite ger0_norm normrN //; apply: ltW.
rewrite !fctE/= opprD scaleNr opprK.
suff: `|h * h| / `|h + x| / `|x * x| <= e%:num * `|h|.
rewrite -2!normf_div -mulrA -invfM; congr (`|_| <= _).
apply/(canLR (mulfK _)); rewrite ?mulf_neq0//.
rewrite mulrDl mulKf// [(_ + _) * _]mulrC mulrDr mulrN.
rewrite -mulrA mulfK// -mulrA mulVKf ?mulf_neq0//.
by rewrite [- _ + _]addrC !mulrDl [x * h]mulrC addrKA subrKC.
rewrite ler_pdivrMr ?normr_gt0 ?mulf_neq0 // mulrAC ler_pdivrMr ?normr_gt0 //.
have : `|h * h| <= `|x / 2| * (e%:num * `|x * x| * `|h|).
rewrite !mulrA; near: h; exists (`|x / 2| * e%:num * `|x * x|).
by rewrite /= !pmulr_rgt0 // normr_gt0 mulf_neq0.
by move=> h /ltW; rewrite distrC subr0 [`|h * _|]normrM => /ler_pM; apply.
move=> /le_trans -> //; rewrite [leLHS]mulrC ler_pM ?mulr_ge0 //.
near: h; exists (`|x| / 2); first by rewrite /= divr_gt0 ?normr_gt0.
move=> h; rewrite /= distrC subr0 => lthhx; rewrite addrC -[h]opprK.
apply: le_trans (@ler_dist_dist _ R _ _).
rewrite normrN [leRHS]ger0_norm.
rewrite subr_ge0; apply: ltW; apply: lt_le_trans lthhx _.
by rewrite ler_pdivrMr // -{1}(mulr1 `|x|) ler_pM // ler1n.
rewrite lerBrDr -lerBrDl (splitr `|x|).
rewrite normf_div (@ger0_norm _ 2) // addrK; apply/ltW.
Unshelve. all: by end_near. Qed.
apply/eqaddoP => _ /posnumP[e]; near=> h.
have hDx_neq0 : h + x != 0.
near: h; rewrite !nbhs_simpl; apply/nbhs_normP.
exists `|x|; first by rewrite /= normr_gt0.
move=> h /=; rewrite /= distrC subr0 -subr_gt0 => lthx.
rewrite -(normr_gt0 (h + x)) addrC -[h]opprK.
apply: lt_le_trans (ler_dist_dist _ _).
by rewrite ger0_norm normrN //; apply: ltW.
rewrite !fctE/= opprD scaleNr opprK.
suff: `|h * h| / `|h + x| / `|x * x| <= e%:num * `|h|.
rewrite -2!normf_div -mulrA -invfM; congr (`|_| <= _).
apply/(canLR (mulfK _)); rewrite ?mulf_neq0//.
rewrite mulrDl mulKf// [(_ + _) * _]mulrC mulrDr mulrN.
rewrite -mulrA mulfK// -mulrA mulVKf ?mulf_neq0//.
by rewrite [- _ + _]addrC !mulrDl [x * h]mulrC addrKA subrKC.
rewrite ler_pdivrMr ?normr_gt0 ?mulf_neq0 // mulrAC ler_pdivrMr ?normr_gt0 //.
have : `|h * h| <= `|x / 2| * (e%:num * `|x * x| * `|h|).
rewrite !mulrA; near: h; exists (`|x / 2| * e%:num * `|x * x|).
by rewrite /= !pmulr_rgt0 // normr_gt0 mulf_neq0.
by move=> h /ltW; rewrite distrC subr0 [`|h * _|]normrM => /ler_pM; apply.
move=> /le_trans -> //; rewrite [leLHS]mulrC ler_pM ?mulr_ge0 //.
near: h; exists (`|x| / 2); first by rewrite /= divr_gt0 ?normr_gt0.
move=> h; rewrite /= distrC subr0 => lthhx; rewrite addrC -[h]opprK.
apply: le_trans (@ler_dist_dist _ R _ _).
rewrite normrN [leRHS]ger0_norm.
rewrite subr_ge0; apply: ltW; apply: lt_le_trans lthhx _.
by rewrite ler_pdivrMr // -{1}(mulr1 `|x|) ler_pM // ler1n.
rewrite lerBrDr -lerBrDl (splitr `|x|).
rewrite normf_div (@ger0_norm _ 2) // addrK; apply/ltW.
Unshelve. all: by end_near. Qed.
Lemma diff_RinvSource code (xSource code : R) : x != 0 ->
'd GRing.inv x = (fun hSource code : R => - x ^- 2 *: h) :> (R -> R).
Proof.
Lemma differentiable_RinvSource code (xSource code : R) : x != 0 ->
differentiable (GRing.inv : R -> R) x.
Proof.
Lemma diffVSource code `(VSource code : normedModType dSource code R) (fSource code : V -> R) xSource code :
differentiable f x -> f x != 0 ->
'd (fun ySource code => (f y)^-1) x = - (f x) ^- 2 \*: 'd f x :> (V -> R).
Proof.
Lemma differentiableVSource code `(VSource code : normedModType dSource code R) (fSource code : V -> R) xSource code :
differentiable f x -> f x != 0 -> differentiable (fun ySource code => (f y)^-1) x.
Proof.
Global Instance is_diffXSource code `(VSource code : normedModType dSource code R) (fSource code dfSource code : V -> R) nSource code xSource code :
is_diff x f df -> is_diff x (f ^+ n.+1) (n.+1%:R * f x ^+ n *: df).
Proof.
Lemma differentiableXSource code `(VSource code : normedModType dSource code R) (fSource code : V -> R) nSource code xSource code :
differentiable f x -> differentiable (f ^+ n.+1) x.
Proof.
Lemma diffXSource code `(VSource code : normedModType dSource code R) (fSource code : V -> R) nSource code xSource code :
differentiable f x ->
'd (f ^+ n.+1) x = n.+1%:R * f x ^+ n \*: 'd f x :> (V -> R).
Proof.
End DifferentialR3_numFieldType.