-
Notifications
You must be signed in to change notification settings - Fork 60
Instances for dependent function types #1383
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Tragicus
wants to merge
1
commit into
math-comp:master
Choose a base branch
from
Tragicus:dep-inst
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -224,7 +224,7 @@ Section diff_locally_converse_tentative. | |
(* and thus a littleo of 1, and so is id *) | ||
(* This can be generalized to any dimension *) | ||
Lemma diff_locally_converse_part1 (f : R -> R) (a b x : R) : | ||
f \o shift x = cst a + b *: idfun +o_ 0 id -> f x = a. | ||
f \o shift x = cst a + b *: (@idfun R) +o_ 0 id -> f x = a. | ||
Proof. | ||
rewrite funeqE => /(_ 0) /=; rewrite add0r => ->. | ||
by rewrite -[LHS]/(_ 0 + _ 0 + _ 0) /cst [X in a + X]scaler0 littleo_lim0 ?addr0. | ||
|
@@ -253,12 +253,12 @@ Lemma derivable_nbhs (f : V -> W) a v : | |
Proof. | ||
move=> df; apply/eqaddoP => _/posnumP[e]. | ||
rewrite -nbhs_nearE nbhs_simpl /= dnbhsE; split; last first. | ||
rewrite /at_point opprD -![(_ + _ : _ -> _) _]/(_ + _) scale0r add0r. | ||
rewrite /at_point opprD !add_funE !opp_funE/= scale0r add0r. | ||
by rewrite addrA subrr add0r normrN scale0r !normr0 mulr0. | ||
have /eqolimP := df. | ||
move=> /eqaddoP /(_ e%:num) /(_ [gt0 of e%:num]). | ||
apply: filter_app; rewrite /= !near_simpl near_withinE; near=> h => hN0. | ||
rewrite /= opprD -![(_ + _ : _ -> _) _]/(_ + _) -![(- _ : _ -> _) _]/(- _). | ||
rewrite /= opprD !add_funE !opp_funE. | ||
rewrite /cst /= [`|1|]normr1 mulr1 => dfv. | ||
rewrite addrA -[X in X + _]scale1r -(@mulVf _ h) //. | ||
rewrite mulrC -scalerA -scalerBr normrZ. | ||
|
@@ -276,7 +276,7 @@ move=> df; apply/cvg_ex; exists ('D_v f a). | |
apply/(@eqolimP _ _ _ (dnbhs_filter_on _))/eqaddoP => _/posnumP[e]. | ||
have /eqaddoP /(_ e%:num) /(_ [gt0 of e%:num]) := df. | ||
rewrite /= !(near_simpl, near_withinE); apply: filter_app; near=> h. | ||
rewrite /= opprD -![(_ + _ : _ -> _) _]/(_ + _) -![(- _ : _ -> _) _]/(- _). | ||
rewrite /= opprD !add_funE !opp_funE. | ||
rewrite /cst /= [`|1|]normr1 mulr1 addrA => dfv hN0. | ||
rewrite -[X in _ - X]scale1r -(@mulVf _ h) //. | ||
rewrite -scalerA -scalerBr normrZ normfV ler_pdivrMl ?normr_gt0 //. | ||
|
@@ -398,7 +398,7 @@ Variable R : numFieldType. | |
Fact dcst (V W : normedModType R) (a : W) (x : V) : continuous (0 : V -> W) /\ | ||
cst a \o shift x = cst (cst a x) + \0 +o_ 0 id. | ||
Proof. | ||
split; first exact: cst_continuous. | ||
split; first exact: (@cst_continuous _ _ 0). | ||
apply/eqaddoE; rewrite addr0 funeqE => ? /=; rewrite -[LHS]addr0; congr (_ + _). | ||
by rewrite littleoE; last exact: littleo0_subproof. | ||
Qed. | ||
|
@@ -412,7 +412,7 @@ Fact dadd (f g : V -> W) x : | |
Proof. | ||
move=> df dg; split => [?|]; do ?exact: continuousD. | ||
apply/(@eqaddoE R); rewrite funeqE => y /=; rewrite -[(f + g) _]/(_ + _). | ||
by rewrite ![_ (_ + x)]diff_locallyx// addrACA addox addrACA. | ||
by rewrite add_funE ![_ (_ + x)]diff_locallyx// addrACA addox addrACA. | ||
Qed. | ||
|
||
Fact dopp (f : V -> W) x : | ||
|
@@ -521,8 +521,8 @@ Lemma diff_unique (V W : normedModType R) (f : V -> W) | |
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 /=. | ||
move=> dfc dxf; apply/subr0_eq/(@littleo_linear0 _ _ (GRing.sub_fun _ _))/eqoP. | ||
apply/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. | ||
|
@@ -544,7 +544,7 @@ by rewrite littleo_center0 (comp_centerK x id) -[- _ in RHS](comp_centerK x). | |
Qed. | ||
|
||
Lemma diff_cst (V W : normedModType R) a x : ('d (cst a) x : V -> W) = 0. | ||
Proof. by apply/diff_unique; have [] := dcst a x. Qed. | ||
Proof. by apply/(@diff_unique _ _ _ \0); have [] := dcst a x. Qed. | ||
|
||
Variables (V W : normedModType R). | ||
|
||
|
@@ -558,7 +558,10 @@ Proof. exact: DiffDef (differentiable_cst _ _) (diff_cst _ _). Qed. | |
Lemma diffD (f g : V -> W) x : | ||
differentiable f x -> differentiable g x -> | ||
'd (f + g) x = 'd f x \+ 'd g x :> (V -> W). | ||
Proof. by move=> df dg; apply/diff_unique; have [] := dadd df dg. Qed. | ||
Proof. | ||
move=> df dg. | ||
by apply/(@diff_unique _ _ _ (GRing.add_fun _ _)); have [] := dadd df dg. | ||
Qed. | ||
|
||
Lemma differentiableD (f g : V -> W) x : | ||
differentiable f x -> differentiable g x -> differentiable (f + g) x. | ||
|
@@ -576,7 +579,8 @@ Qed. | |
Lemma differentiable_sum n (f : 'I_n -> V -> W) (x : V) : | ||
(forall i, differentiable (f i) x) -> differentiable (\sum_(i < n) f i) x. | ||
Proof. | ||
by elim/big_ind : _ => // ? ? g h ?; apply: differentiableD; [exact:g|exact:h]. | ||
elim/big_ind : _ => //[_|? ? g h ?]; first exact/(@differentiable_cst _ 0). | ||
by apply: differentiableD; [exact:g|exact:h]. | ||
Qed. | ||
|
||
Lemma diffN (f : V -> W) x : | ||
|
@@ -614,7 +618,10 @@ Proof. by move=> /differentiableP df /differentiableP dg. Qed. | |
|
||
Lemma diffZ (f : V -> W) k x : | ||
differentiable f x -> 'd (k *: f) x = k \*: 'd f x :> (V -> W). | ||
Proof. by move=> df; apply/diff_unique; have [] := dscale k df. Qed. | ||
Proof. | ||
move=> df. | ||
by apply/(@diff_unique _ _ _ (GRing.scale_fun _ _)); have [] := dscale k df. | ||
Qed. | ||
|
||
Lemma differentiableZ (f : V -> W) k x : | ||
differentiable f x -> differentiable (k *: f) x. | ||
|
@@ -1152,7 +1159,7 @@ Global Instance is_derive_sum n (h : 'I_n -> V -> W) (x v : V) | |
(dh : 'I_n -> W) : (forall i, is_derive x v (h i) (dh i)) -> | ||
is_derive x v (\sum_(i < n) h i) (\sum_(i < n) dh i). | ||
Proof. | ||
by elim/big_ind2 : _ => // [|] *; [exact: is_derive_cst|exact: is_deriveD]. | ||
by elim/big_ind2 : _ => // [|] *; [exact/(is_derive_cst 0)|exact: is_deriveD]. | ||
Qed. | ||
|
||
Lemma derivable_sum n (h : 'I_n -> V -> W) (x v : V) : | ||
|
@@ -1324,7 +1331,10 @@ by rewrite [in LHS]mulr_natl exprfctE -mulrSr mulr_natl. | |
Qed. | ||
|
||
Lemma derivableX f n (x v : V) : derivable f x v -> derivable (f ^+ n) x v. | ||
Proof. by case: n => [_|n /derivableP]; [rewrite expr0|]. Qed. | ||
Proof. | ||
case: n => [_|n /derivableP]; last by []. | ||
by rewrite expr0; apply/(derivable_cst (1 : R)). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed, if I remove the |
||
Qed. | ||
|
||
Lemma deriveX f n (x v : V) : derivable f x v -> | ||
'D_v (f ^+ n.+1) x = (n.+1%:R * f x ^+ n) *: 'D_v f x. | ||
|
@@ -1378,7 +1388,7 @@ Proof. by rewrite derive1E derive_cst. Qed. | |
Lemma exprn_derivable {R : numFieldType} n (x : R) v : | ||
derivable (@GRing.exp R ^~ n) x v. | ||
Proof. | ||
elim: n => [/=|n ih]; first by rewrite (_ : _ ^~ _ = 1). | ||
elim: n => [/=|n ih]; first by rewrite (_ : _ ^~ _ = cst 1). | ||
rewrite (_ : _ ^~ _ = (fun x => x * x ^+ n)); last first. | ||
by apply/funext => y; rewrite exprS. | ||
by apply: derivableM; first exact: derivable_id. | ||
|
@@ -1573,7 +1583,7 @@ have gcont : {within `[a, b], continuous g}. | |
move=> x; apply: continuousD _ ; first by move=>?; exact: fcont. | ||
by apply/continuousN/continuous_subspaceT=> ?; exact: scalel_continuous. | ||
have gaegb : g a = g b. | ||
rewrite /g -![(_ - _ : _ -> _) _]/(_ - _). | ||
rewrite /g !add_funE !opp_funE. | ||
apply/eqP; rewrite -subr_eq /= opprK addrAC -addrA -scalerBl. | ||
rewrite [_ *: _]mulrA mulrC mulrA mulVf. | ||
by rewrite mul1r addrCA subrr addr0. | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -839,7 +839,8 @@ set f := fun x => if x == a then r else if x == b then l else F^`() x. | |
have fE : {in `]a, b[, F^`() =1 f}. | ||
by move=> x; rewrite in_itv/= => /andP[ax xb]; rewrite /f gt_eqF// lt_eqF. | ||
have DPGFE : {in `]a, b[, (- (PG \o F))%R^`() =1 ((G \o F) * (- f))%R}. | ||
move=> x /[dup]xab /andP[ax xb]; rewrite derive1_comp //; last first. | ||
move=> x /[dup]xab /andP[ax xb]. | ||
rewrite (@derive1_comp _ _ (@GRing.opp R)) //; last first. | ||
apply: diff_derivable; apply: differentiable_comp; apply/derivable1_diffP. | ||
by case: Fab => + _ _; exact. | ||
by case: PGFbFa => + _ _; apply; exact: decreasing_image_oo. | ||
|
@@ -886,7 +887,8 @@ rewrite oppeD//= -(continuous_FTC2 ab _ _ DPGFE); last 2 first. | |
- have [/= dF rF lF] := Fab. | ||
have := derivable_oo_continuous_bnd_within PGFbFa. | ||
move=> /(continuous_within_itvP _ FbFa)[_ PGFb PGFa]; split => /=. | ||
- move=> x xab; apply/derivable1_diffP; apply: differentiable_comp => //. | ||
- move=> x xab; apply/derivable1_diffP. | ||
apply: (differentiable_comp (g:[email protected] R)) => //. | ||
apply: differentiable_comp; apply/derivable1_diffP. | ||
by case: Fab => + _ _; exact. | ||
by case: PGFbFa => + _ _; apply; exact: decreasing_image_oo. | ||
|
@@ -909,7 +911,7 @@ rewrite oppeD//= -(continuous_FTC2 ab _ _ DPGFE); last 2 first. | |
rewrite gtr0_norm// ?subr_gt0//. | ||
by near: t; exact: nbhs_left_ltBl. | ||
apply: eq_integral_itv_bounded. | ||
- rewrite mulrN; apply: measurableT_comp => //. | ||
- rewrite mulrN; apply: (measurableT_comp (f:[email protected] R)) => //. | ||
apply: (eq_measurable_fun ((G \o F) * F^`())%R) => //. | ||
by move=> x; rewrite inE/= => xab; rewrite !fctE fE. | ||
by move: mGFF'; apply: measurable_funS => //; exact: subset_itv_oo_cc. | ||
|
@@ -994,13 +996,14 @@ have mF' : measurable_fun `]a, b[ F^`(). | |
apply: subspace_continuous_measurable_fun => //. | ||
by apply: continuous_in_subspaceT => x /[!inE] xab; exact: cF'. | ||
rewrite integral_itv_bndoo//; last first. | ||
rewrite compA -(compA G -%R) (_ : -%R \o -%R = id); last first. | ||
rewrite (compA _ -%R) -(compA G -%R) (_ : -%R \o -%R = id); last first. | ||
by apply/funext => y; rewrite /= opprK. | ||
apply: measurable_funM => //; apply: measurableT_comp => //. | ||
apply: measurable_funM => //. | ||
apply: (measurableT_comp (f:[email protected] R)) => //. | ||
apply: (@eq_measurable_fun _ _ _ _ _ (- F^`())%R). | ||
move=> x /[!inE] xab; rewrite [in RHS]derive1E deriveN -?derive1E//. | ||
by case: Fab => + _ _; apply. | ||
exact: measurableT_comp. | ||
exact: (measurableT_comp (f:[email protected] R)). | ||
rewrite [in RHS]integral_itv_bndoo//; last exact: measurable_funM. | ||
apply: eq_integral => x /[!inE] xab; rewrite !fctE !opprK derive1E deriveN. | ||
- by rewrite opprK -derive1E. | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks indeed a bit better ^_^.