Module mathcomp.reals_stdlib.nsatz_realtype

From Stdlib Require Import NsatzTactic.
From mathcomp Require Import boot order ssralg ssrint ssrnum.
From mathcomp Require Import boolp reals constructive_ereal.

# nsatz for realType This file registers the ring corresponding to the MathComp-Analysis type realType to the tactic nsatz of Coq. This enables some automation used for example in the file trigo.v. Reference: - https://coq.inria.fr/refman/addendum/nsatz.html

Import GRing.Theory Num.Theory.

Unset SsrOldRewriteGoalsOrder.  

Local Open Scope ring_scope.

Section Nsatz_realType.
Variable TSource code : realType.

Lemma Nsatz_realType_Setoid_TheorySource code : Setoid.Setoid_Theory T (@eq T).
Proof.
by constructor => [x //|x y //|x y z ->]. Qed.

Definition Nsatz_realType0
Source code
:= (0%:R : T).
Definition Nsatz_realType1
Source code
:= (1%:R : T).
Definition Nsatz_realType_add
Source code
 (xSource code ySource code : T) := (x + y)%R.
Definition Nsatz_realType_mul

pseries : forall {R : realType}, (nat -> R) -> R -> (join_GRing_Ring_between_GRing_SemiRing_and_Algebra_Zmodule R) ^nat pseries is not universe polymorphic Arguments pseries {R} f%_function_scope x%_ring_scope _ pseries is transparent Expands to: Constant mathcomp.analysis.exp.pseries Declared in library mathcomp.analysis.exp, line 71, characters 11-18


Source code
 (xSource code ySource code : T) := (x * y)%R.
Definition Nsatz_realType_sub

pseries_diffs : forall {R : realType}, (nat -> R) -> nat -> R pseries_diffs is not universe polymorphic Arguments pseries_diffs {R} f%_function_scope i%_nat_scope pseries_diffs is transparent Expands to: Constant mathcomp.analysis.exp.pseries_diffs Declared in library mathcomp.analysis.exp, line 103, characters 11-24


Source code
 (xSource code ySource code : T) := (x - y)%R.
Definition Nsatz_realType_opp

expR_itv_boundl : itv_bound int -> interval_itv_bound__canonical__Order_Preorder ssrint_int__canonical__Order_Preorder expR_itv_boundl is not universe polymorphic Arguments expR_itv_boundl b expR_itv_boundl is transparent Expands to: Constant mathcomp.analysis.exp.expR_itv_boundl Declared in library mathcomp.analysis.exp, line 589, characters 11-26


Source code
 (xSource code  : T) := (- x)%R.

#[global]
Instance Nsatz_realType_Ring_opsSource code:
   (@Ncring.Ring_ops T Nsatz_realType0 Nsatz_realType1
  Nsatz_realType_add
  Nsatz_realType_mul
  Nsatz_realType_sub
  Nsatz_realType_opp (@eq T)).
Proof.
Defined.

#[global]
Instance Nsatz_realType_RingSource code : (Ncring.Ring (Ro:=Nsatz_realType_Ring_ops)).
Proof.
constructor => //.
- exact: Nsatz_realType_Setoid_Theory.
- by move=> x y -> x1 y1 ->.
- by move=> x y -> x1 y1 ->.
- by move=> x y -> x1 y1 ->.
- by move=> x y ->.
- exact: add0r.
- exact: addrC.
- exact: addrA.
- exact: mul1r.
- exact: mulr1.
- exact: mulrA.
- exact: mulrDl.
- move=> x y z; exact: mulrDr.
- exact: subrr.
Defined.

#[global]
Instance Nsatz_realType_CringSource code: (Cring.Cring (Rr:=Nsatz_realType_Ring)).
Proof.
exact: mulrC. Defined.

#[global]
Instance Nsatz_realType_Integral_domainSource code :
   (Integral_domain.Integral_domain (Rcr:=Nsatz_realType_Cring)).
Proof.
constructor.
  move=> x y.
  rewrite -[_ _ Algebra_syntax.zero]/(x * y = 0)%R => /eqP.
  by rewrite mulf_eq0 => /orP[] /eqP->; [left | right].
rewrite -[_ _ Algebra_syntax.zero]/(1 = 0)%R; apply/eqP.
by rewrite (eqr_nat T 1 0).
Defined.

End Nsatz_realType.

Tactic Notation "nsatz" := nsatz_default.