-
Notifications
You must be signed in to change notification settings - Fork 47
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
Instances for dependent function types #1383
base: master
Are you sure you want to change the base?
Conversation
altreals/realseq.v
Outdated
@@ -303,7 +303,7 @@ Lemma ncvgM u v lu lv : ncvg u lu%:E -> ncvg v lv%:E -> | |||
Proof. | |||
move=> cu cv; pose a := u \- lu%:S; pose b := v \- lv%:S. | |||
have eq: (u \* v) =1 (lu * lv)%:S \+ ((lu%:S \* b) \+ (a \* v)). | |||
move=> n; rewrite {}/a {}/b /= [u n+_]addrC [(_+_)*(v n)]mulrDl. | |||
move=> n; rewrite {}/a {}/b /= [u n+_]addrC [(_+_)*(v n)]mulrDl. |
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.
move=> n; rewrite {}/a {}/b /= [u n+_]addrC [(_+_)*(v n)]mulrDl. | |
move=> n; rewrite {}/a {}/b /= [u n+_]addrC [(_+_)*(v n)]mulrDl. |
classical/functions.v
Outdated
Next Obligation. | ||
by move=> T M ; apply/eqP; rewrite funeqE => /(_ point) /eqP; rewrite oner_eq0. | ||
by move=> T M f g h; apply/functional_extensionality_dep => x /=; rewrite addrA. |
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.
We have funext
for non-dependent functional extensionality.
Maybe we should introduce funext_dep
for uniformity and to save some typing.
classical/functions.v
Outdated
Proof. | ||
by apply/funext => x/=; rewrite mulrC. Qed. |
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.
Proof. | |
by apply/funext => x/=; rewrite mulrC. Qed. | |
Proof. by apply/funext => x/=; rewrite mulrC. Qed. |
@@ -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. |
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 ^_^.
theories/derive.v
Outdated
@@ -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 (f:=GRing.sub_fun _ _))/eqoP. |
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.
It is desirable to avoid using (f:= ...)
because it relies on the naming of a variable that is likely to change. (There are instances of this issue below with df:=
.)
theories/derive.v
Outdated
@@ -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). | |||
apply: differentiableD; [exact:g|exact:h]. |
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.
apply: differentiableD; [exact:g|exact:h]. | |
by apply: differentiableD; [exact:g|exact:h]. |
theories/ftc.v
Outdated
@@ -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 (g:[email protected] R)) //; last first. |
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.
Maybe avoid the (g:= ...)
syntax if possible.
theories/lebesgue_measure.v
Outdated
@@ -1002,7 +1002,9 @@ Qed. | |||
|
|||
Lemma measurable_funB D f g : measurable_fun D f -> | |||
measurable_fun D g -> measurable_fun D (f \- g). | |||
Proof. by move=> ? ?; apply: measurable_funD =>//; exact: measurableT_comp. Qed. | |||
Proof. | |||
move=> ? ?; apply: measurable_funD =>//; exact: measurableT_comp. |
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.
move=> ? ?; apply: measurable_funD =>//; exact: measurableT_comp. | |
by move=> ? ?; apply: measurable_funD =>//; exact: measurableT_comp. |
@@ -251,7 +251,7 @@ Context d (aT : measurableType d) (rT : realType). | |||
Lemma mfun_subring_closed : subring_closed (@mfun _ _ aT rT). | |||
Proof. | |||
split=> [|f g|f g]; rewrite !inE/=. | |||
- exact: measurable_cst. | |||
- exact: measurable_cst (1 : rT). |
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.
Mmmhhh... There are now plenty of lemma applications with blah_cst
lemmas that now require an explicit mention of the constant in question. This looks problematic.
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 comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, if I remove the (1 : R)
type checking does not seem to terminate. Do you know why?
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.
What is the justification for the mandatory addition of constants for the application of blah_cst
lemmas? Do we know where the problem comes from?
I observe that this PS shares similarities with PR #1379 while the latter is marked as draft. Maybe you intended this one as well to be a draft? |
|
I extracted this from the other PR and extended it when I realized I needed to generalize things here first. It is ready for review. |
Motivation for this change
Generalizes the instances on function types to dependent function types. The same generalization is happening in mathcomp (see math-comp/math-comp#1256) and it needs to be done here first for backwards compatibility.
Checklist
CHANGELOG_UNRELEASED.md
Reference: How to document
Reminder to reviewers