Skip to content

Commit 889f0c1

Browse files
committed
linting
1 parent 614b628 commit 889f0c1

3 files changed

Lines changed: 55 additions & 72 deletions

File tree

CHANGELOG_UNRELEASED.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
- in `derive.v`:
1717
+ lemmas `derivable_max`, `derive_maxl`, `derive_maxr` `derivable_min`, `derive_minl`, `derive_minr`
18+
+ lemmas `derivable0`, `derive0`, `is_derive0`
1819

1920
### Renamed
2021
- in set_interval.v
@@ -23,6 +24,10 @@
2324

2425
### Generalized
2526

27+
- in `derive.v`:
28+
+ lemmas `near_eq_growth_rate`, `near_eq_derivable`, `near_eq_derive`,
29+
`near_eq_is_derive`
30+
2631
### Deprecated
2732

2833
### Removed

classical/functions.v

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2679,19 +2679,17 @@ Proof. by apply/funext => x/=; rewrite mulrC. Qed.
26792679

26802680
Lemma min_fun_to_max (T : Type) (T' : numDomainType) (f g : T -> T') :
26812681
(f \min g) = (f + g) - (f \max g).
2682-
Proof.
2683-
apply/funext=> x /=; by rewrite Num.Theory.minr_to_max. Qed.
2682+
Proof. by apply/funext=> x/=; rewrite Num.Theory.minr_to_max. Qed.
26842683

26852684
Lemma max_fun_to_min (T : Type) (T' : numDomainType) (f g : T -> T') :
26862685
(f \max g) = (f + g) - (f \min g).
2687-
Proof.
2688-
apply/funext => x /=; by rewrite Num.Theory.maxr_to_min. Qed.
2686+
Proof. by apply/funext => x/=; rewrite Num.Theory.maxr_to_min. Qed.
26892687

2690-
Lemma fun_maxC d (T : Type) (T' : orderType d) (f g : T -> T') :
2688+
Lemma fun_maxC (T : Type) d (T' : orderType d) (f g : T -> T') :
26912689
f \max g = g \max f.
26922690
Proof. by apply/funext => z/=; rewrite Order.TotalTheory.maxC. Qed.
26932691

2694-
Lemma fun_minC d (T : Type) (T' : orderType d) (f g : T -> T') :
2692+
Lemma fun_minC (T : Type) d (T' : orderType d) (f g : T -> T') :
26952693
f \min g = g \min f.
26962694
Proof. by apply/funext => z/=; rewrite Order.TotalTheory.minC. Qed.
26972695

theories/derive.v

Lines changed: 46 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ From mathcomp Require Import all_ssreflect ssralg ssrnum matrix interval poly.
44
From mathcomp Require Import sesquilinear.
55
#[warning="-warn-library-file-internal-analysis"]
66
From mathcomp Require Import unstable.
7-
From mathcomp Require Import mathcomp_extra boolp classical_sets functions.
8-
From mathcomp Require Import reals interval_inference topology.
7+
From mathcomp Require Import mathcomp_extra boolp contra classical_sets.
8+
From mathcomp Require Import functions reals interval_inference topology.
99
From mathcomp Require Import prodnormedzmodule tvs normedtype landau.
1010

1111
(**md**************************************************************************)
@@ -306,24 +306,20 @@ Qed.
306306

307307
Lemma derivable0 (f : V -> W) (x : V) : derivable f x 0.
308308
Proof.
309-
apply:is_cvg_near_cst => //=.
310-
near=>h.
309+
apply: (is_cvg_near_cst 0) => //=.
310+
near=> h.
311311
by rewrite scaler0 add0r subrr scaler0.
312-
Unshelve.
313-
end_near.
314-
Qed.
312+
Unshelve. all: by end_near. Qed.
315313

316314
Lemma derive0 (f : V -> W) (x : V) : 'D_0 f x = 0.
317315
Proof.
318316
apply/lim_near_cst => //=.
319317
near=> h.
320318
by rewrite scaler0 add0r subrr scaler0.
321-
Unshelve.
322-
end_near.
323-
Qed.
319+
Unshelve. all: by end_near. Qed.
324320

325321
Lemma is_derive0 (f : V -> W) (x : V) : is_derive x 0 f 0.
326-
Proof. split; [by apply/derivable0 | by rewrite derive0]. Qed.
322+
Proof. by split; [exact/derivable0|rewrite derive0]. Qed.
327323

328324
End DifferentialR.
329325

@@ -2058,8 +2054,7 @@ Lemma near_eq_derivable (R : numFieldType) (V W : normedModType R)
20582054
(f g : V -> W) (a v : V) :
20592055
{near a, f =1 g} -> derivable f a v -> derivable g a v.
20602056
Proof.
2061-
case: (eqVneq v 0)=> [-> _ _| ].
2062-
by apply/derivable0.
2057+
have [-> _ _|] := eqVneq v 0; first exact/derivable0.
20632058
move=> vn0 nfg /cvg_ex[/= l fl]; apply/cvg_ex; exists l => /=.
20642059
exact/(cvg_trans _ fl)/near_eq_cvg/cvg_within/near_eq_growth_rate.
20652060
Qed.
@@ -2068,10 +2063,9 @@ Lemma near_eq_derive (R : numFieldType) (V W : normedModType R)
20682063
(f g : V -> W) (a v : V) :
20692064
(\near a, f a = g a) -> 'D_v f a = 'D_v g a.
20702065
Proof.
2071-
case: (eqVneq v 0)=> [-> _ | ].
2072-
by rewrite !derive0.
2066+
have [-> _|] := eqVneq v 0; first by rewrite !derive0.
20732067
move=> v0 fg; rewrite /derive; congr (lim _).
2074-
rewrite eqEsubset; split; apply/near_eq_cvg/cvg_within/near_eq_growth_rate => //.
2068+
rewrite eqEsubset; split; apply/near_eq_cvg/cvg_within/near_eq_growth_rate =>//.
20752069
by near do apply/esym.
20762070
Unshelve. all: by end_near. Qed.
20772071

@@ -2088,65 +2082,53 @@ Context {K : realType} {V W : normedModType K}.
20882082
Implicit Types f g : V -> K^o.
20892083
Implicit Type x : V.
20902084

2091-
Fact der_max f g x v :
2092-
f x <> g x -> derivable f x v -> derivable g x v ->
2085+
Fact der_max f g x v : f x != g x ->
2086+
derivable f x v -> derivable g x v ->
20932087
{for x, continuous f} -> {for x, continuous g} ->
2094-
(fun h => h^-1 *: (((f \max g) \o shift x) (h *: v) - (f \max g) x)) @
2095-
0^' --> if f x < g x then 'D_v g x else 'D_v f x.
2088+
(fun h => h^-1 *: (((f \max g) \o shift x) (h *: v) - (f \max g) x))
2089+
@ 0^' --> if f x < g x then 'D_v g x else 'D_v f x.
20962090
Proof.
20972091
wlog: f g x / f x < g x.
2098-
move=> wlg fx_neq_gx.
2099-
move: (fx_neq_gx) => /eqP.
2100-
rewrite neq_lt => /orP[fg|gf].
2101-
move: fg fx_neq_gx.
2102-
by apply:wlg.
2103-
move=> df dg cf cg.
2104-
move: dg df cg cf.
2105-
rewrite fun_maxC ltNge if_neg le_eqVlt.
2106-
move: fx_neq_gx => /nesym/[dup] fx_neq_gx /eqP/negPf -> /=.
2107-
by apply:(wlg g f).
2108-
move=> fx_lt_gx fg_neq df dg cf cg.
2109-
case: ifPn => fg /=.
2110-
rewrite /Num.max fg => t Ht.
2111-
apply:(@near_eq_cvg _ _ _ _ (fun h => h^-1 *: (g (h *: v + x) - g x))).
2112-
near=> h.
2113-
rewrite ifT // -subr_lt0 (_ : f _ - _ = ((f - g) \o shift x) (h *: v)) //.
2114-
near: h.
2115-
have Hf : forall f : V -> K^o,
2116-
continuous_at x f -> f (shift x (x0 *: v)) @[x0 --> nbhs 0^'] --> f x.
2117-
move=> f' cf'.
2118-
apply:cvg_comp; last by apply:cf'.
2092+
move=> wlg; rewrite neq_lt => /orP[fg|gf df dg fxv gxv].
2093+
- by apply: wlg => //; rewrite lt_eqF.
2094+
- rewrite fun_maxC ltNge if_neg le_eqVlt eq_sym gt_eqF//=.
2095+
by apply: wlg => //; rewrite lt_eqF.
2096+
move=> fx_lt_gx fg_neq df dg cf cg; case: ifPn => fg /=.
2097+
- rewrite /Num.max fg => A DgxA.
2098+
apply: (@near_eq_cvg _ _ _ _ (fun h => h^-1 *: (g (h *: v + x) - g x))).
2099+
+ near do rewrite ifT// -subr_lt0 -[ltLHS]/(((f - g) \o shift x) (_ *: v)).
2100+
have Hf (h : V -> K^o) : continuous_at x h ->
2101+
h (shift x (k *: v)) @[k --> nbhs 0^'] --> h x.
2102+
move=> ch.
2103+
apply: cvg_comp; last exact: ch.
21192104
rewrite -[in nbhs x](add0r x).
2120-
apply:cvgD; last by apply:cvg_cst.
2121-
rewrite -(scale0r v).
2122-
apply:cvgZ; last by apply:cvg_cst.
2123-
by apply:nbhs_dnbhs.
2124-
apply/cvgr_lt; last by move: fg; rewrite -subr_lt0; apply.
2125-
by apply:cvgB; apply:Hf.
2126-
by apply:dg.
2127-
exfalso.
2128-
by apply: (negP fg).
2129-
Unshelve.
2130-
end_near.
2131-
Qed.
2105+
apply: cvgD; last exact: cvg_cst.
2106+
rewrite -(scale0r v); apply: cvgZ; last exact: cvg_cst.
2107+
exact: nbhs_dnbhs.
2108+
apply/(cvgr_lt (f x - g x)); last by rewrite subr_lt0.
2109+
by apply: cvgB; exact: Hf.
2110+
+ exact: dg.
2111+
- absurd.
2112+
by rewrite fx_lt_gx in fg.
2113+
Unshelve. all: by end_near. Qed.
21322114

21332115
Lemma derivable_max f g x v :
2134-
f x <> g x -> derivable f x v -> derivable g x v ->
2116+
f x != g x -> derivable f x v -> derivable g x v ->
21352117
{for x, continuous f} -> {for x, continuous g} ->
21362118
derivable (f \max g) x v.
21372119
Proof.
2138-
move=> fx_gx df dg cf cg; apply/cvg_ex.
2139-
exists(if f x < g x then 'D_v g x else 'D_v f x).
2120+
move=> fx_gx df dg cf cg; apply/cvg_ex => /=.
2121+
exists (if f x < g x then 'D_v g x else 'D_v f x).
21402122
exact: der_max.
21412123
Qed.
21422124

21432125
Lemma derive_maxl f g x v : f x > g x ->
21442126
{for x, continuous f} -> {for x, continuous g} ->
21452127
'D_v (f \max g) x = 'D_v f x.
21462128
Proof.
2147-
case: (boolP (v == 0)) => [/eqP -> //= gx_fx cf cg | v0].
2129+
have [-> gx_fx cf cg|v0 fg cf cg]:= eqVneq v 0.
21482130
by rewrite !derive0.
2149-
move=> fg cf cg; apply: near_eq_derive => //.
2131+
apply: near_eq_derive => //.
21502132
near do rewrite /Order.max_fun /Num.max ifN// -leNgt -subr_le0.
21512133
by move: fg; rewrite -subr_lt0; apply: cvgr_le; exact: cvgB.
21522134
Unshelve. all: by end_near. Qed.
@@ -2157,23 +2139,21 @@ Lemma derive_maxr f g x v : f x < g x ->
21572139
Proof. by move=> fg cf cg; rewrite fun_maxC derive_maxl. Qed.
21582140

21592141
Lemma derivable_min f g x v :
2160-
f x <> g x -> derivable f x v -> derivable g x v ->
2142+
f x != g x -> derivable f x v -> derivable g x v ->
21612143
{for x, continuous f} -> {for x, continuous g} ->
21622144
derivable (f \min g) x v.
21632145
Proof.
2164-
case: (boolP (v == 0)) => [/eqP -> /= _ _ _ _ _| v0].
2165-
by apply/derivable0.
2166-
rewrite min_fun_to_max=> fx_gx df dg cf cg.
2167-
apply/derivableB; [by apply/(derivableD df dg) | by apply/derivable_max].
2146+
have [-> *|x0] := eqVneq v 0; first exact/derivable0.
2147+
rewrite min_fun_to_max => fx_gx df dg cf cg.
2148+
by apply/derivableB; [apply/(derivableD df dg) |apply/derivable_max].
21682149
Qed.
21692150

21702151
Lemma derive_minr f g x v : f x > g x ->
21712152
{for x, continuous f} -> {for x, continuous g} ->
21722153
'D_v (f \min g) x = 'D_v g x.
21732154
Proof.
2174-
case: (boolP (v == 0)) => [/eqP -> //= gx_fx cf cg | v0].
2175-
by rewrite !derive0.
2176-
move=> fg cf cg; apply: near_eq_derive => //.
2155+
have [-> *|v0 fg cf cg] := eqVneq v 0; first by rewrite !derive0.
2156+
apply: near_eq_derive => //.
21772157
near do rewrite /Order.min_fun /Num.min ifN// -leNgt -subr_le0.
21782158
by move: fg; rewrite -subr_lt0; apply: cvgr_le; exact: cvgB.
21792159
Unshelve. all: by end_near. Qed.

0 commit comments

Comments
 (0)