Skip to content
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

Adding some trigonometry in realType #383

Merged
merged 45 commits into from
Dec 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
acaba84
exp0
thery May 27, 2021
7f821b7
1 + x <= exp x
thery May 27, 2021
1b4b1c1
1 < exp x
thery May 27, 2021
4db299f
differentiation
thery May 28, 2021
1515c43
deriv of exp
thery May 30, 2021
b01d47c
expD
thery May 31, 2021
ad1d3ca
cos and sin
thery May 31, 2021
1cc2d9f
cos^2 + sin^2 = 1
thery May 31, 2021
ffb9520
definition of pi and more trigonometry
thery Jun 1, 2021
073d75c
simplify `cvg_extra`
affeldt-aist Jun 1, 2021
5b47c0c
remove Locate
thery Jun 1, 2021
b3733ac
simplify `cvg_series_bounded`
affeldt-aist Jun 1, 2021
6bd84b9
improved rcfE
thery Jun 1, 2021
f8d2b80
simplify `Section Cvg` and `continuous_withinNshiftx`
affeldt-aist Jun 1, 2021
534fd74
simplify derivation
thery Jun 1, 2021
00c0a80
define `pi` using `get`
affeldt-aist Jun 1, 2021
d870b4f
more theorems about exp, ln, cos/sin
thery Jun 1, 2021
f2f9d54
proof of cos 2 < 0
affeldt-aist Jun 3, 2021
2139a00
only one value such that 0 <= x < 2 et cos x = 0
thery Jun 3, 2021
752f729
cos pi = - 1
affeldt-aist Jun 4, 2021
0ee42fd
starting with tan
thery Jun 4, 2021
7c32dbe
periodicity lemmas and De Moivre
affeldt-aist Jun 4, 2021
d8d3d73
more on tan
thery Jun 4, 2021
9103c1b
exponential functions
affeldt-aist Jun 4, 2021
f7f871f
definition of acos
thery Jun 4, 2021
b97af95
generalization of periodicity lemmas
affeldt-aist Jun 5, 2021
7a9de16
acos, asin, and atan
thery Jun 6, 2021
084f05f
shorter proofs
affeldt-aist Jun 7, 2021
acb6f30
minor fixes
thery Jun 7, 2021
1c85ddd
use more notations and changelog
affeldt-aist Jun 8, 2021
951c733
typo
thery Jun 8, 2021
d9b22cf
doc, changelog, shorter proofs
affeldt-aist Jun 8, 2021
aaf0e76
derivation results
thery Jun 8, 2021
5b59d1f
complete changelog
affeldt-aist Jun 9, 2021
b8431ac
Thanks to Yves no admit!
thery Jul 8, 2021
290206f
minor improvements and fixes
affeldt-aist Jun 9, 2021
2b6ea0f
Add multi rule for unfolding functional expression
thery Oct 14, 2021
1bc5787
minor improvements
affeldt-aist Oct 15, 2021
3faf423
update changelog
thery Oct 15, 2021
b3e81d7
remove *_group2 lemma
affeldt-aist Oct 15, 2021
8483da7
fixes and simplification
thery Oct 16, 2021
3c332e7
introduction of formal series
thery Oct 18, 2021
d64c4b6
fix is_derive automation
thery Oct 20, 2021
4fc2788
fixes
affeldt-aist Dec 21, 2021
fec7949
some cleaning
thery Dec 22, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 89 additions & 1 deletion CHANGELOG_UNRELEASED.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,102 @@
+ lemma `EFinB`
+ lemmas `mule_eq0`, `mule_lt0_lt0`, `mule_gt0_lt0`, `mule_lt0_gt0`,
`pmule_rge0`, `pmule_lge0`, `nmule_lge0`, `nmule_rge0`,
`pmule_rgt0`, `pmule_lgt0`, `nmule_lgt0`, `nmule_rgt0`,
`pmule_rgt0`, `pmule_lgt0`, `nmule_lgt0`, `nmule_rgt0`
- in `measure.v`:
+ hints for `measurable0` and `measurableT`
- in `ereal.v`:
+ lemmas `muleBr`, `muleBl`
+ lemma `eqe_absl`
+ lemma `lee_pmul`
+ lemmas `cover_restr`, `eqcover_r`
- in `topology.v` :
+ lemmas `cstE`, `compE`, `opprfunE`, `addrfunE`, `mulrfunE`, `scalrfunE`, `exprfunE`
+ multi-rule `fctE`
- in `normedtype.v`
+ lemmas `continuous_shift`, `continuous_withinNshiftx`
- in `derive.v`
+ lemmas `derive1_comp`, `derivable_cst`, `derivable_id`, trigger_derive`
+ instances `is_derive_id`, `is_derive_Nid`
- in `sequences.v`:
+ lemmas `cvg_series_bounded`, `cvg_to_0_linear`, `lim_cvg_to_0_linear`.
+ lemma `cvg_sub0`
+ lemma `cvg_zero`
- file `realfun.v`:
+ lemma `is_derive1_caratheodory`, `is_derive_0_is_cst`
+ instance `is_derive1_comp`
+ lemmas `is_deriveV`, `is_derive_inverse`
- new file `nsatz_realType`
- new file `exp.v`
+ lemma `normr_nneg` (hint)
+ definitions `pseries`, `pseries_diffs`
+ facts `is_cvg_pseries_inside_norm`, `is_cvg_pseries_inside`
+ lemmas `pseries_diffsN`, `pseries_diffs_inv_fact`, `pseries_diffs_sumE`,
`pseries_diffs_equiv`, `is_cvg_pseries_diffs_equiv`,
`pseries_snd_diffs`
+ lemmas `expR0`, `expR_ge1Dx`, `exp_coeffE`, `expRE`
+ instance `is_derive_expR`
+ lemmas `derivable_expR`, `continuous_expR`, `expRxDyMexpx`, `expRxMexpNx_1`
+ lemmas `pexpR_gt1`, `expR_gt0`, `expRN`, `expRD`, `expRMm`
+ lemmas `expR_gt1`, `expR_lt1`, `expRB`, `ltr_expR`, `ler_expR`, `expR_inj`,
`expR_total_gt1`, `expR_total`
+ definition `ln`
+ fact `ln0`
+ lemmas `expK`, `lnK`, `ln1`, `lnM`, `ln_inj`, `lnV`, `ln_div`, `ltr_ln`, `ler_ln`, `lnX`
+ lemmas `le_ln1Dx`, `ln_sublinear`, `ln_ge0`, `ln_gt0`
+ lemma `continuous_ln`
+ instance `is_derive1_ln`
+ definition `exp_fun`, notation `` `^ ``
+ lemmas `exp_fun_gt0`, `exp_funr1`, `exp_funr0`, `exp_fun1`, `ler_exp_fun`,
`exp_funD`, `exp_fun_inv`, `exp_fun_mulrn`
+ definition `riemannR`, lemmas `riemannR_gt0`, `dvg_riemannR`
- new file `trigo.v`
+ lemmas `sqrtvR`, `eqr_div`, `big_nat_mul`, `cvg_series_cvg_series_group`,
`lt_sum_lim_series`
+ definitions `periodic`, `alternating`
+ lemmas `periodicn`, `alternatingn`
+ definition `sin_coeff`
+ lemmas `sin_coeffE`, `sin_coeff_even`, `is_cvg_series_sin_coeff`
+ definition `sin`
+ lemmas `sinE`
+ definition `sin_coeff'`
+ lemmas `sin_coeff'E`, `cvg_sin_coeff'`, `diffs_sin`, `series_sin_coeff0`, `sin0`
+ definition `cos_coeff`
+ lemmas `cos_ceff_2_0`, `cos_coeff_2_2`, `cos_coeff_2_4`, `cos_coeffE`, `is_cvg_series_cos_coeff`
+ definition `cos`
+ lemma `cosE`
+ definition `cos_coeff'`
+ lemmas `cos_coeff'E`, `cvg_cos_coeff'`, `diffs_cos`, `series_cos_coeff0`, `cos0`
+ instance `is_derive_sin`
+ lemmas `derivable_sin`, `continuous_sin`, `is_derive_cos`, `derivable_cos`, `continuous_cos`
+ lemmas `cos2Dsin2`, `cos_max`, `cos_geN1`, `cos_le1`, `sin_max`, `sin_geN1`, `sin_le1`
+ fact `sinD_cosD`
+ lemmas `sinD`, `cosD`
+ lemmas `sin2cos2`, `cos2sin2`, `sin_mulr2n`, `cos_mulr2n`
+ fact `sinN_cosN`
+ lemmas `sinN`, `cosN`
+ lemmas `sin_sg`, `cos_sg`, `cosB`, `sinB`
+ lemmas `norm_cos_eq1`, `norm_sin_eq1`, `cos1sin0`, `sin0cos1`, `cos_norm`
+ definition `pi`
+ lemmas `pihalfE`, `cos2_lt0`, `cos_exists`
+ lemmas `sin2_gt0`, `cos_pihalf_uniq`, `pihalf_02_cos_pihalf`, `pihalf_02`, `pi_gt0`, `pi_ge0`
+ lemmas `sin_gt0_pihalf`, `cos_gt0_pihalf`, `cos_pihalf`, `sin_pihalf`, `cos_ge0_pihalf`, `cospi`, `sinpi`
+ lemmas `cos2pi`, `sin2pi`, `sinDpi`, `cosDpi`, `sinD2pi`, `cosD2pi`
+ lemmas `cosDpihalf`, `cosBpihalf`, `sinDpihalf`, `sinBpihalf`, `sin_ge0_pi`
+ lemmas `ltr_cos`, `ltr_sin`, `cos_inj`, `sin_inj`
+ definition `tan`
+ lemmas `tan0`, `tanpi`, `tanN`, `tanD`, `tan_mulr2n`, `cos2_tan2`
+ lemmas `tan_pihalf`, `tan_piquarter`, `tanDpi`, `continuous_tan`
+ lemmas `is_derive_tan`, `derivable_tan`, `ltr_tan`, `tan_inj`
+ definition `acos`
+ lemmas `acos_def`, `acos_ge0`, `acos_lepi`, `acosK`, `acos_gt0`, `acos_ltpi`
+ lemmas `cosK`, `sin_acos`, `near_lift`, `continuous_acos`, `is_derive1_acos`
+ definition `asin`
+ lemmas `asin_def`, `asin_geNpi2`, `asin_lepi2`, `asinK`, `asin_ltpi2`, `asin_gtNpi2`
+ lemmas `sinK`, `cos_asin`, `continuous_asin`, `is_derive1_asin`
+ definition `atan`
+ lemmas `atan_def`, `atan_gtNpi2`, `atan_ltpi2`, `atanK`, `tanK`
+ lemmas `continuous_atan`, `cos_atan`
+ instance `is_derive1_atan`

### Changed

Expand Down
3 changes: 3 additions & 0 deletions _CoqProject
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ theories/prodnormedzmodule.v
theories/normedtype.v
theories/realfun.v
theories/sequences.v
theories/exp.v
theories/trigo.v
theories/nsatz_realtype.v
theories/cardinality.v
theories/csum.v
theories/forms.v
Expand Down
53 changes: 42 additions & 11 deletions theories/derive.v
Original file line number Diff line number Diff line change
Expand Up @@ -895,17 +895,16 @@ move=> dfx dgx; apply: DiffDef; first exact: differentiable_pair.
by rewrite diff_pair // !diff_val.
Qed.

Global Instance is_diffM (f g df dg : V -> R) x :
Global Instance is_diffM (f g df dg : V -> R) x :
is_diff x f df -> is_diff x g dg -> is_diff x (f * g) (f x *: dg + g x *: df).
Proof.
move=> dfx dgx.
have -> : f * g = (fun p => p.1 * p.2) \o (fun y => (f y, g y)) by [].
(* TODO: type class inference should succeed or fail, not leave an evar *)
apply: is_diff_eq; do ?exact: is_diff_comp.
by rewrite funeqE => ?; rewrite /= [_ * g _]mulrC.
(* TODO: type class inference should succeed or fail, not leave an evar *)
apply: is_diff_eq; do ?exact: is_diff_comp.
by rewrite funeqE => ?; rewrite /= [_ * g _]mulrC.
Qed.


Lemma diffM (f g : V -> R) x :
differentiable f x -> differentiable g x ->
'd (f * g) x = f x \*: 'd g x + g x \*: 'd f x :> (V -> R).
Expand Down Expand Up @@ -994,12 +993,6 @@ Proof.
by move=> df fxn0; apply: differentiable_comp _ (differentiable_Rinv fxn0).
Qed.

Lemma exprfunE (T : pointedType) (K : ringType) (f : T -> K) n :
f ^+ n = (fun x => f x ^+ n).
Proof.
by elim: n => [|n ihn]; rewrite funeqE=> ?; [rewrite !expr0|rewrite !exprS ihn].
Qed.

Global Instance is_diffX (f df : V -> R) n x :
is_diff x f df -> is_diff x (f ^+ n.+1) (n.+1%:R * f x ^+ n *: df).
Proof.
Expand Down Expand Up @@ -1554,3 +1547,41 @@ apply: (@ler0_derive1_nincr _ (- f)) => t tab; first exact/derivableN/fdrvbl.
rewrite derive1E deriveN; last exact: fdrvbl.
by rewrite oppr_le0 -derive1E; apply: dfge0.
Qed.

Lemma derive1_comp (R : realFieldType) (f g : R -> R) x :
derivable f x 1 -> derivable g (f x) 1 ->
(g \o f)^`() x = g^`() (f x) * f^`() x.
Proof.
move=> /derivable1_diffP df /derivable1_diffP dg.
rewrite derive1E'; last exact/differentiable_comp.
rewrite diff_comp // !derive1E' //= -[X in 'd _ _ X = _]mulr1.
by rewrite [LHS]linearZ mulrC.
Qed.

Section is_derive_instances.
Variables (R : numFieldType) (V : normedModType R).

Lemma derivable_cst (x : V) : derivable (fun=> x) 0 1.
Proof. exact/derivable1_diffP/differentiable_cst. Qed.

Lemma derivable_id (x v : V) : derivable id x v.
Proof.
apply/derivable1P/derivableD; last exact/derivable_cst.
exact/derivable1_diffP/differentiableZl.
Qed.

Global Instance is_derive_id (x v : V) : is_derive x v id v.
Proof.
apply: (DeriveDef (@derivable_id _ _)).
by rewrite deriveE// (@diff_lin _ _ _ [linear of idfun]).
Qed.

Global Instance is_deriveNid (x v : V) : is_derive x v -%R (- v).
Proof. by apply: is_deriveN. Qed.

End is_derive_instances.

(* Trick to trigger type class resolution *)
Lemma trigger_derive (R : realType) (f : R -> R) x x1 y1 :
is_derive x 1 f x1 -> x1 = y1 -> is_derive x 1 f y1.
Proof. by move=> Hi <-. Qed.
Loading