Skip to content

Improved handling of disabled VM #21677

Open
SkySkimmer wants to merge 5 commits intorocq-prover:masterfrom
SkySkimmer:fix-bytecode-off
Open

Improved handling of disabled VM #21677
SkySkimmer wants to merge 5 commits intorocq-prover:masterfrom
SkySkimmer:fix-bytecode-off

Conversation

@SkySkimmer
Copy link
Contributor

No description provided.

@SkySkimmer SkySkimmer added the request: full CI Use this label when you want your next push to trigger a full CI. label Feb 27, 2026
@coqbot-app coqbot-app bot removed the request: full CI Use this label when you want your next push to trigger a full CI. label Feb 27, 2026
@SkySkimmer SkySkimmer changed the title Imrpoved handling of disabled VM Improved handling of disabled VM Feb 27, 2026
@SkySkimmer SkySkimmer added this to the 9.3+rc1 milestone Feb 27, 2026
@SkySkimmer SkySkimmer added the needs: progress Work in progress: awaiting action from the author. label Feb 27, 2026
@SkySkimmer
Copy link
Contributor Author

@coqbot bench

@SkySkimmer
Copy link
Contributor Author

checker needs updating

@coqbot ci minimize ci-corn

@coqbot-app
Copy link
Contributor

coqbot-app bot commented Feb 27, 2026

I am now running minimization at commit 3661dfb on requested target ci-corn. I'll come back to you with the results once it's done.

@coqbot-app
Copy link
Contributor

coqbot-app bot commented Feb 27, 2026

Minimization interrupted by timeout, being automatically continued. Partially Minimized File /home/runner/work/run-coq-bug-minimizer/run-coq-bug-minimizer/builds/coq/coq-failing/_build_ci/corn/reals/fast/CRpi_fast.v in 5h 15m 7s (from ci-corn) (interrupted by timeout, being automatically continued) (full log on GitHub Actions - verbose log)
⭐ ⏱️ Partially Minimized Coq File (timeout)
(* -*- mode: coq; coq-prog-args: ("-emacs" "-q" "-w" "-deprecated-native-compiler-option" "-native-compiler" "no" "-coqlib" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq//" "-R" "/github/workspace/builds/coq/coq-failing/_build_ci/corn" "CoRN" "-Q" "/github/workspace/cwd" "Top" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq///user-contrib/Bignums" "Bignums" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq///user-contrib/HB" "HB" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq///user-contrib/Ltac2" "Ltac2" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq///user-contrib/MathClasses" "MathClasses" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq///user-contrib/Stdlib" "Stdlib" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq///user-contrib/elpi" "elpi" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq///user-contrib/elpi_elpi" "elpi_elpi" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq///user-contrib/elpi_examples" "elpi_examples" "-top" "CoRN.reals.fast.CRpi_fast") -*- *)
(* File reduced by coq-bug-minimizer from original input, then from 362 lines to 68 lines, then from 80 lines to 1074 lines, then from 1081 lines to 78 lines, then from 89 lines to 1725 lines, then from 1732 lines to 96 lines, then from 108 lines to 1195 lines, then from 1202 lines to 99 lines, then from 110 lines to 1587 lines, then from 1594 lines to 117 lines, then from 129 lines to 896 lines, then from 903 lines to 120 lines, then from 131 lines to 1147 lines, then from 1154 lines to 132 lines, then from 143 lines to 1154 lines, then from 1161 lines to 144 lines, then from 155 lines to 1086 lines, then from 1093 lines to 156 lines, then from 167 lines to 1191 lines, then from 1198 lines to 214 lines, then from 225 lines to 1320 lines, then from 1327 lines to 357 lines *)
(* coqc version 9.3+alpha compiled with OCaml 4.14.2
   coqtop version 9.3+alpha
   Expected coqc runtime on this file: 0.888 sec
   Expected coqc peak memory usage on this file: 514620.0 kb *)









Require CoRN.tactics.DiffTactics1.
Require CoRN.tactics.Step.
Require Corelib.BinNums.IntDef.
Require Corelib.Program.Tactics.
Require Corelib.Classes.Equivalence.
Require Corelib.Classes.Morphisms.
Require Corelib.Classes.RelationClasses.
Require Corelib.BinNums.PosDef.
Require Corelib.Classes.SetoidTactics.
Require Corelib.Setoids.Setoid.
Require Corelib.Lists.ListDef.
Require Corelib.Classes.Morphisms_Prop.
Require Corelib.Numbers.BinNums.
Require Corelib.Init.Sumbool.
Require Corelib.Init.Wf.
Require Corelib.Program.Utils.
Require Corelib.Init.Ltac.
Require Corelib.BinNums.NatDef.
Require Corelib.Relations.Relation_Definitions.
Require Corelib.Program.Basics.
Require Corelib.Program.Wf.
Require MathClasses.theory.CoqStreams.
Require Stdlib.Logic.Decidable.
Require Stdlib.Logic.EqdepFacts.
Require Stdlib.Logic.FunctionalExtensionality.
Require Stdlib.Logic.HLevelsBase.
Require Stdlib.Program.Syntax.
Require Stdlib.Unicode.Utf8_core.
Require Stdlib.micromega.ZifyClasses.
Require Stdlib.setoid_ring.Algebra_syntax.
Require Stdlib.BinNums.PosDef.
Require Stdlib.BinNums.NatDef.
Require Stdlib.BinNums.IntDef.
Require Stdlib.Classes.SetoidTactics.
Require Stdlib.Classes.RelationClasses.
Require Stdlib.Classes.Equivalence.
Require Stdlib.Classes.Morphisms_Prop.
Require Stdlib.Classes.Morphisms.
Require Stdlib.Classes.DecidableClass.
Require Stdlib.Init.Wf.
Require Stdlib.Init.Sumbool.
Require Stdlib.Lists.ListDef.
Require Stdlib.Logic.Eqdep.
Require Stdlib.Logic.Eqdep_dec.
Require Stdlib.Logic.ProofIrrelevanceFacts.
Require Stdlib.Numbers.BinNums.
Require Stdlib.Program.Basics.
Require Stdlib.Program.Tactics.
Require Stdlib.Program.Utils.
Require Stdlib.Program.Wf.
Require Stdlib.Relations.Relation_Definitions.
Require Stdlib.Setoids.Setoid.
Require Stdlib.Unicode.Utf8.
Require CoRN.tactics.CornTac.
Require Stdlib.Bool.Bool.
Require Stdlib.Logic.JMeq.
Require Stdlib.Logic.ProofIrrelevance.
Require Stdlib.Relations.Relation_Operators.
Require Stdlib.Program.Combinators.
Require Stdlib.Relations.Operators_Properties.
Require Stdlib.PArith.BinPosDef.
Require Stdlib.Relations.Relations.
Require Stdlib.Program.Equality.
Require Stdlib.Numbers.NumPrelude.
Require Stdlib.Program.WfExtensionality.
Require MathClasses.misc.stdlib_hints.
Require Stdlib.Structures.Equalities.
Require Stdlib.Program.Subset.
Require Stdlib.Structures.Orders.
Require Stdlib.Structures.OrdersTac.
Require Stdlib.Structures.OrdersFacts.
Require Stdlib.Structures.GenericMinMax.
Require Stdlib.Program.Program.
Require Stdlib.Numbers.NatInt.NZAxioms.
Require Stdlib.Numbers.NatInt.NZBase.
Require Stdlib.Numbers.NatInt.NZAdd.
Require Stdlib.Numbers.NatInt.NZMul.
Require Stdlib.Numbers.NatInt.NZOrder.
Require Stdlib.Numbers.NatInt.NZAddOrder.
Require Stdlib.Numbers.NatInt.NZMulOrder.
Require CoRN.model.totalorder.QMinMax.
Require CoRN.ftc.Integral.
Require CoRN.ftc.MoreFunctions.
Axiom proof_admitted : False.
Tactic Notation "admit" := abstract case proof_admitted.

Export CoRN.ftc.Integral.
Export CoRN.ftc.MoreFunctions.

Section Lemmas.

End Lemmas.

Section Definitions.



Variables a b : IR.
Hypothesis Hab : Min a b [<=] Max a b.
Variable F : PartIR.

Hypothesis HF : Continuous_I Hab F.

Lemma Integral_inc1 : Continuous_I (Min_leEq_lft a b) F.
Admitted.

Lemma Integral_inc2 : Continuous_I (Min_leEq_rht a b) F.
Admitted.

Definition Integral :=
  integral _ _ (Min_leEq_rht a b) F Integral_inc2[-]integral _ _ (Min_leEq_lft a b) _ Integral_inc1.

End Definitions.

Arguments Integral [a b Hab F].

Section Properties_of_Integral.

End Properties_of_Integral.

Section More_Properties.



End More_Properties.

Section Corollaries.

End Corollaries.
Module Export CoRN_DOT_ftc_DOT_MoreIntegrals.
Module Export CoRN.
Module Export ftc.
Module Export MoreIntegrals.
End MoreIntegrals.

End ftc.

End CoRN.

End CoRN_DOT_ftc_DOT_MoreIntegrals.

Section Indefinite_Integral.

Variable I : interval.
Variable F : PartIR.

Hypothesis contF : Continuous I F.

Variable a : IR.
Hypothesis Ha : I a.

Lemma prim_lemma : forall x : IR, I x -> Continuous_I (Min_leEq_Max a x) F.
Admitted.

Lemma Fprim_strext : forall x y Hx Hy,
 Integral (prim_lemma x Hx) [#] Integral (prim_lemma y Hy) -> x [#] y.
Admitted.

Definition Fprim : PartIR.
 apply Build_PartFunct with (pfpfun := fun (x : IR) (Hx : I x) => Integral (prim_lemma x Hx)).
Proof.
  apply iprop_wd.
 exact Fprim_strext.
Defined.

End Indefinite_Integral.

Arguments Fprim [I F].

Notation "[-S-] F" := (Fprim F) (at level 20).

Section Compact.

End Compact.

Section General.

End General.

Section Limit_of_Derivative_Seq.

End Limit_of_Derivative_Seq.

Section Derivative_Series.

End Derivative_Series.
Module Export CoRN_DOT_ftc_DOT_FTC.
Module Export CoRN.
Module Export ftc.
Module Export FTC.
End FTC.

End ftc.

End CoRN.

End CoRN_DOT_ftc_DOT_FTC.
Export CoRN.ftc.FTC.
Module Export CoRN_DOT_transc_DOT_PowerSeries.
Module Export CoRN.
Module Export transc.
Module Export PowerSeries.
End PowerSeries.

End transc.

End CoRN.

End CoRN_DOT_transc_DOT_PowerSeries.
Export CoRN.transc.PowerSeries.
Module Export CoRN_DOT_transc_DOT_TaylorSeries.
Module Export CoRN.
Module Export transc.
Module Export TaylorSeries.
End TaylorSeries.

End transc.

End CoRN.

End CoRN_DOT_transc_DOT_TaylorSeries.
Export CoRN.transc.TaylorSeries.
Module Export CoRN_DOT_transc_DOT_Trigonometric.
Module Export CoRN.
Module Export transc.
Module Export Trigonometric.
End Trigonometric.

End transc.

End CoRN.

End CoRN_DOT_transc_DOT_Trigonometric.
Export CoRN.transc.Trigonometric.
Module Export SinCos.
End SinCos.
Fixpoint pi_seq (n : nat) : IR.
Admitted.

Lemma pi_seq_Cauchy : Cauchy_prop pi_seq.
Admitted.

Definition Pi := Two[*]Lim (Build_CauchySeq _ _ pi_seq_Cauchy).
Module Export CoRN_DOT_transc_DOT_Pi.
Module Export CoRN.
Module Export transc.
Module Export Pi.
End Pi.

End transc.

End CoRN.

End CoRN_DOT_transc_DOT_Pi.
Export CoRN.transc.Pi.
Module Export TrigMon.
End TrigMon.

Lemma ArcTan_def_lemma : Continuous realline {1/} ( [-C-][1]{+}FId{^}2).
Admitted.

Definition ArcTang := ( [-S-]ArcTan_def_lemma) [0] I.

Definition ArcTan (x : IR) := ArcTang x I.
Module Export CoRN_DOT_transc_DOT_InvTrigonom.
Module Export CoRN.
Module Export transc.
Module Export InvTrigonom.
End InvTrigonom.

End transc.

End CoRN.

End CoRN_DOT_transc_DOT_InvTrigonom.
Export CoRN.transc.InvTrigonom.
Module Export CoRN.
Module Export transc.
Module Export MoreArcTan.
End MoreArcTan.

End transc.

End CoRN.
Import CoRN.model.totalorder.QMinMax.
Import CoRN.transc.MoreArcTan.
Import CoRN.stdlib_omissions.Q.

Set Implicit Arguments.

Section Pi.
Let f (a b:Q) : Q.
exact (let (x,y) := a in
 let (z,w) := b in
 Qred ((x*w + y*z)%Z/(y*w-x*z)%Z)).
Defined.

Definition ArcTan_multiple : forall x, -(1) <= x <= 1 -> forall n,
  sumbool True ((nring n)[*]ArcTan (inj_Q _ x)[=]ArcTan (inj_Q _ (iter_nat n _ (f x) 0))).
Proof.
 intros x Hx.
 induction n.
  right.
 admit.
 simpl.
 destruct (IHn) as [H|H].
  left; constructor.
 set (y:=(iter_nat n Q (f x) 0)) in *.
 destruct (Qlt_le_dec_fast 1 y) as [_|Y0].
  left; constructor.
 destruct (Qlt_le_dec_fast y (-(1))) as [_|Y1].
  left; constructor.
 destruct (Qeq_dec (1-x*y) 0) as [_|Y2].
  left; constructor.
 right.
 admit.
Defined.

Lemma reflect_right : forall A B (x:{A}+{B}), (match x with left _ => False | right _ => True end) -> B.
Admitted.

Lemma Pi_Formula :
(((nring 44)[*]ArcTan (inj_Q IR (1 /  57%Z))[-]
  (nring 12)[*]ArcTan (inj_Q IR (1 / 682%Z))[+]
  (nring  7)[*]ArcTan (inj_Q IR (1 / 239%Z))[+]
  (nring 24)[*]ArcTan (inj_Q IR (1 / 12943%Z)))[=]
 Pi[/]FourNZ).
Proof.
 assert (H0:-(1) <= (1/(57%Z)) <= 1).
  split; discriminate.
 assert (H1:-(1) <= (1/(239%Z)) <= 1).
  split; discriminate.
 assert (H2:-(1) <= (1/(682%Z)) <= 1).
  split; discriminate.
 assert (H3:-(1) <= (1/(12943%Z)) <= 1).
  split; discriminate.
 set (y0:=(iter_nat 44 _ (f (1/57%Z)) 0)).
 set (y1:=(iter_nat 7 _ (f (1/239%Z)) 0)).
 set (y2:=(iter_nat 12 _ (f (1/682%Z)) 0)).
 set (y3:=(iter_nat 24 _ (f (1/12943%Z)) 0)).
 rstepl (nring 44[*]ArcTan (inj_Q IR (1 / 57%Z))[+]
   [--](nring 12[*]ArcTan (inj_Q IR (1 / 682%Z)))[+]
     (nring 7[*]ArcTan (inj_Q IR (1 / 239%Z))[+]
       nring 24[*]ArcTan (inj_Q IR (1 / 12943%Z)))).
 csetoid_replace ((nring 44)[*]ArcTan (inj_Q IR (1 / 57%Z)))
   (ArcTan (inj_Q IR y0)); [|apply: (reflect_right (ArcTan_multiple H0 44)); now vm_compute].
🛠️ Intermediate Coq File (useful for debugging if minimization did not go as far as you wanted)
🛠️ 📜 Intermediate Coq File log (useful for debugging if minimization did not go as far as you wanted)
📜 Build Log (contains the Coq error message) (truncated to last 8.0KiB; full 7.7MiB file on GitHub Actions Artifacts under build.log)
2+flambda/bin:/github/workspace/.venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+++ export COQBIN=/github/workspace/builds/coq/coq-failing/_install_ci/bin/
+++ COQBIN=/github/workspace/builds/coq/coq-failing/_install_ci/bin/
++ CI_BUILD_DIR=/github/workspace/builds/coq/coq-failing/_build_ci
++ declare -A overlays
++ set +x
+ git_download corn
+ local project=corn
+ local dest=/github/workspace/builds/coq/coq-failing/_build_ci/corn
+ local giturl_var=corn_CI_GITURL
+ local giturl=https://github.com/coq-community/corn
+ local ref_var=corn_CI_REF
+ local ref=master
+ local parent_project_var=corn_CI_PARENT_PROJECT
+ local parent_project=
+ local submodule_folder_var=corn_CI_SUBMODULE_FOLDER
+ local submodule_folder=
+ local ov_url=
+ local ov_ref=
++ dirname /github/workspace/builds/coq/coq-failing/_build_ci/corn
+ local dest_prefix=/github/workspace/builds/coq/coq-failing/_build_ci/
+ '[' '' = '' ']'
+ local parent_project_dest=/github/workspace/builds/coq/coq-failing/_build_ci/
+ local parent_project_relative_dest=
+ '[' -d /github/workspace/builds/coq/coq-failing/_build_ci/corn ']'
+ echo 'Warning: download and unpacking of corn skipped because /github/workspace/builds/coq/coq-failing/_build_ci/corn already exists.'
Warning: download and unpacking of corn skipped because /github/workspace/builds/coq/coq-failing/_build_ci/corn already exists.
+ '[' '' ']'
+ export 'COQEXTRAFLAGS=-native-compiler no'
+ COQEXTRAFLAGS='-native-compiler no'
+ cd /github/workspace/builds/coq/coq-failing/_build_ci/corn
+ ./configure.sh
Deprecated environment variable COQLIB, use ROCQLIB instead.
Deprecated environment variable COQCORELIB, use ROCQRUNTIMELIB instead.
+ make
+ '[' -z x ']'
+ command make
ROCQ DEP VFILES
Warning: Deprecated environment variable COQLIB, use ROCQLIB instead.
         [deprecated-coq-env-var,deprecated-since-9.0,deprecated,default]
Warning: Deprecated environment variable COQCORELIB,
         use ROCQRUNTIMELIB instead.
         [deprecated-coq-env-var,deprecated-since-9.0,deprecated,default]
.Makefile.d (real: 0.37, user: 0.19, sys: 0.17, mem: 22576 ko)
ROCQ compile reals/fast/CRpi_fast.v
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin/////rocq
MINIMIZER_DEBUG_EXTRA: original invocation: '' 
MINIMIZER_DEBUG_EXTRA: new invocation: /github/workspace/builds/coq/coq-failing/_install_ci/bin/rocq.orig compile -q -w -deprecated-native-compiler-option -native-compiler no -R /github/workspace/builds/coq/coq-failing/_build_ci/corn CoRN reals/fast/CRpi_fast.v 
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: ocamlpath: /github/workspace/builds/coq/coq-failing/_install_ci/lib:
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/corn
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/rocq.orig compile -q -w -deprecated-native-compiler-option -native-compiler no -R /github/workspace/builds/coq/coq-failing/_build_ci/corn CoRN reals/fast/CRpi_fast.v 
MINIMIZER_DEBUG_EXTRA: coqlib: Warning: Deprecated environment variable COQLIB, use ROCQLIB instead.
/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq//
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.k8w5aJyRhS
MINIMIZER_DEBUG: files:  reals/fast/CRpi_fast.v /github/workspace/builds/coq/coq-failing/_build_ci/corn/reals/fast/CRpi_fast.vWarning, feedback message received but no listener to handle it!
Warning: Deprecated environment variable COQLIB, use ROCQLIB instead.
[deprecated-coq-env-var,deprecated-since-9.0,deprecated,default]Warning, feedback message received but no listener to handle it!
Warning: Deprecated environment variable COQLIB, use ROCQLIB instead.
[deprecated-coq-env-var,deprecated-since-9.0,deprecated,default]
Warning: Deprecated environment variable COQCORELIB,
use ROCQRUNTIMELIB instead.
[deprecated-coq-env-var,deprecated-since-9.0,deprecated,default]
File "./reals/fast/CRpi_fast.v", line 26, characters 0-36:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "./reals/fast/CRpi_fast.v", line 32, characters 0-55:
Warning: Notation "_ = _" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "./reals/fast/CRpi_fast.v", line 32, characters 0-55:
Warning: Notation "_ ≠ _" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "./reals/fast/CRpi_fast.v", line 94, characters 2-45:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 97, characters 3-8:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 100, characters 2-22:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 100, characters 2-22:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 100, characters 2-22:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 100, characters 2-22:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 100, characters 2-22:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 105, characters 1-7:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 105, characters 1-7:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 105, characters 1-7:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 105, characters 1-7:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 105, characters 1-7:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 110, characters 2-50:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 113, characters 2-7:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 120, characters 1-6:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 230, characters 1-154:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 230, characters 1-154:
Error: Stack overflow.

Command exited with non-zero status 1
reals/fast/CRpi_fast.vo (real: 3.66, user: 3.05, sys: 0.60, mem: 1729920 ko)
make[1]: *** [Makefile:815: reals/fast/CRpi_fast.vo] Error 1
make[1]: *** [reals/fast/CRpi_fast.vo] Deleting file 'reals/fast/CRpi_fast.glob'
make: *** [Makefile:411: all] Error 2
+ code=2
+ printf '\n%s exit code: %s\n' corn 2
+ '[' corn '!=' stdlib_test ']'
+ echo 'Aggregating timing log...'
Aggregating timing log...
+ echo

+ tools/make-one-time-file.py --real _build_ci/corn.log
    Time |   Peak Mem | File Name              
-----------------------------------------------
0m04.03s | 1729920 ko | Total Time / Peak Mem  
-----------------------------------------------
0m03.66s | 1729920 ko | reals/fast/CRpi_fast.vo
0m00.37s |   22576 ko | .Makefile.d            
+ '[' '' ']'
+ exit 2
/github/workspace/builds/coq /github/workspace
::endgroup::
📜 🔎 Minimization Log (truncated to last 8.0KiB; full 2.8MiB file on GitHub Actions Artifacts under bug.log)
axiom,vernacular,default]
File "/tmp/tmpgryy7kkd/CoRN/reals/fast/CRpi_fast.v", line 518, characters 0-9:
Warning: Let definition le_cb_c declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmpgryy7kkd/CoRN/reals/fast/CRpi_fast.v", line 521, characters 0-9:
Warning: Let definition le_ac_a declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmpgryy7kkd/CoRN/reals/fast/CRpi_fast.v", line 524, characters 0-9:
Warning: Let definition le_ab_b declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmpgryy7kkd/CoRN/reals/fast/CRpi_fast.v", line 527, characters 0-9:
Warning: Let definition le_cb_b declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmpgryy7kkd/CoRN/reals/fast/CRpi_fast.v", line 530, characters 0-9:
Warning: Let definition le_ac_c declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmpgryy7kkd/CoRN/reals/fast/CRpi_fast.v", line 533, characters 0-9:
Warning: Let definition Habc_abc declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmpgryy7kkd/CoRN/reals/fast/CRpi_fast.v", line 536, characters 0-9:
Warning: Let definition Habc_ab declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmpgryy7kkd/CoRN/reals/fast/CRpi_fast.v", line 539, characters 0-9:
Warning: Let definition Habc_ac declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmpgryy7kkd/CoRN/reals/fast/CRpi_fast.v", line 542, characters 0-9:
Warning: Let definition Habc_cb declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmpgryy7kkd/CoRN/reals/fast/CRpi_fast.v", line 545, characters 0-9:
Warning: Let definition Habc_a declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmpgryy7kkd/CoRN/reals/fast/CRpi_fast.v", line 548, characters 0-9:
Warning: Let definition Habc_b declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmpgryy7kkd/CoRN/reals/fast/CRpi_fast.v", line 551, characters 0-9:
Warning: Let definition Habc_c declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmpgryy7kkd/CoRN/reals/fast/CRpi_fast.v", line 604, characters 0-61:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "/tmp/tmpgryy7kkd/CoRN/reals/fast/CRpi_fast.v", line 612, characters 0-30:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
Error: The section Pi needs to be closed.


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Admitting lemmas unsuccessful.
No successful changes.

I will now attempt to admit definitions with admit. Defined with Proof using

Non-fatal error: Failed to admit definitions and preserve the error.  
The new error was:
Deprecated environment variable COQCORELIB, use ROCQRUNTIMELIB instead.
Warning: Deprecated environment variable COQCORELIB,
use ROCQRUNTIMELIB instead.
[deprecated-coq-env-var,deprecated-since-9.0,deprecated,default]
File "/tmp/tmp2b80wfqf/CoRN/reals/fast/CRpi_fast.v", line 225, characters 0-34:
Warning: Library File Stdlib.ZArith.ZArith_base is deprecated
since Stdlib 9.0. use ZArith instead
[deprecated-library-file-since-Stdlib-9.0,deprecated-since-Stdlib-9.0,deprecated-library-file,deprecated,default]
File "/tmp/tmp2b80wfqf/CoRN/reals/fast/CRpi_fast.v", line 350, characters 7-20:
Warning: Coq.Init.Ltac has been replaced by Corelib.Init.Ltac.
[deprecated-dirpath-Coq,deprecated-since-9.0,deprecated,default]
File "/tmp/tmp2b80wfqf/CoRN/reals/fast/CRpi_fast.v", line 357, characters 0-25:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "/tmp/tmp2b80wfqf/CoRN/reals/fast/CRpi_fast.v", line 497, characters 0-9:
Warning: Let definition le_abc_ab declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmp2b80wfqf/CoRN/reals/fast/CRpi_fast.v", line 500, characters 0-9:
Warning: Let definition le_abc_ac declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmp2b80wfqf/CoRN/reals/fast/CRpi_fast.v", line 503, characters 0-9:
Warning: Let definition le_abc_cb declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmp2b80wfqf/CoRN/reals/fast/CRpi_fast.v", line 506, characters 0-9:
Warning: Let definition le_abc_a declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmp2b80wfqf/CoRN/reals/fast/CRpi_fast.v", line 509, characters 0-9:
Warning: Let definition le_abc_b declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmp2b80wfqf/CoRN/reals/fast/CRpi_fast.v", line 512, characters 0-9:
Warning: Let definition le_abc_c declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmp2b80wfqf/CoRN/reals/fast/CRpi_fast.v", line 515, characters 0-9:
Warning: Let definition le_ab_a declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmp2b80wfqf/CoRN/reals/fast/CRpi_fast.v", line 518, characters 0-9:
Warning: Let definition le_cb_c declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmp2b80wfqf/CoRN/reals/fast/CRpi_fast.v", line 521, characters 0-9:
Warning: Let definition le_ac_a declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmp2b80wfqf/CoRN/reals/fast/CRpi_fast.v", line 524, characters 0-9:
Warning: Let definition le_ab_b declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmp2b80wfqf/CoRN/reals/fast/CRpi_fast.v", line 527, characters 0-9:
Warning: Let definition le_cb_b declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmp2b80wfqf/CoRN/reals/fast/CRpi_fast.v", line 530, characters 0-9:
Warning: Let definition le_ac_c declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmp2b80wfqf/CoRN/reals/fast/CRpi_fast.v", line 533, characters 0-9:
Warning: Let definition Habc_abc declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmp2b80wfqf/CoRN/reals/fast/CRpi_fast.v", line 536, characters 0-9:
Warning: Let definition Habc_ab declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmp2b80wfqf/CoRN/reals/fast/CRpi_fast.v", line 539, characters 0-9:
Warning: Let definition Habc_ac declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmp2b80wfqf/CoRN/reals/fast/CRpi_fast.v", line 542, characters 0-9:
Warning: Let definition Habc_cb declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmp2b80wfqf/CoRN/reals/fast/CRpi_fast.v", line 545, characters 0-9:
Warning: Let definition Habc_a declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmp2b80wfqf/CoRN/reals/fast/CRpi_fast.v", line 548, characters 0-9:
Warning: Let definition Habc_b declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmp2b80wfqf/CoRN/reals/fast/CRpi_fast.v", line 551, characters 0-9:
Warning: Let definition Habc_c declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmp2b80wfqf/CoRN/reals/fast/CRpi_fast.v", line 604, characters 0-61:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "/tmp/tmp2b80wfqf/CoRN/reals/fast/CRpi_fast.v", line 612, characters 0-30:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "/tmp/tmp2b80wfqf/CoRN/reals/fast/CRpi_fast.v", line 637, characters 0-22:
Error: Extra arguments: I, F.


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Admitting definitions unsuccessful.
No successful changes.

I will now attempt to add Proof using lines
�[92m
Adding Proof using lines successful.�[0m
Failed to do everything at once; trying one at a time.
Adding Proof using lines unsuccessful.
No successful changes.

I will now attempt to export modules
Module exportation successful

I will now attempt to split imports and exports
Import/Export splitting unsuccessful.

I will now attempt to split := definitions
One-line definition splitting unsuccessful.

I will now attempt to lift Requires to the top of the file while inserting option settings

I will now attempt to lift Requires to the top of the file while inserting option settings

I will now attempt to remove all lines, one at a time

If you have any comments on your experience of the minimizer, please share them in a reply (possibly tagging @JasonGross).
If you believe there's a bug in the bug minimizer, please report it on the bug minimizer issue tracker.

@coqbot-app
Copy link
Contributor

coqbot-app bot commented Feb 28, 2026

Minimization interrupted by timeout, being automatically continued. Partially Minimized File /home/runner/work/run-coq-bug-minimizer/run-coq-bug-minimizer/builds/coq/coq-failing/_build_ci/corn/reals/fast/CRpi_fast.v in 5h 15m 9s (from ci-corn) (interrupted by timeout, being automatically continued) (full log on GitHub Actions - verbose log)
⭐ ⏱️ Partially Minimized Coq File (timeout)
(* -*- mode: coq; coq-prog-args: ("-emacs" "-q" "-w" "-deprecated-native-compiler-option" "-native-compiler" "no" "-coqlib" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq//" "-R" "/github/workspace/builds/coq/coq-failing/_build_ci/corn" "CoRN" "-Q" "/github/workspace/cwd" "Top" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq///user-contrib/Bignums" "Bignums" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq///user-contrib/HB" "HB" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq///user-contrib/Ltac2" "Ltac2" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq///user-contrib/MathClasses" "MathClasses" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq///user-contrib/Stdlib" "Stdlib" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq///user-contrib/elpi" "elpi" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq///user-contrib/elpi_elpi" "elpi_elpi" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq///user-contrib/elpi_examples" "elpi_examples" "-top" "Top.bug_01") -*- *)
(* File reduced by coq-bug-minimizer from original input, then from 362 lines to 68 lines, then from 80 lines to 1074 lines, then from 1081 lines to 78 lines, then from 89 lines to 1725 lines, then from 1732 lines to 96 lines, then from 108 lines to 1195 lines, then from 1202 lines to 99 lines, then from 110 lines to 1587 lines, then from 1594 lines to 117 lines, then from 129 lines to 896 lines, then from 903 lines to 120 lines, then from 131 lines to 1147 lines, then from 1154 lines to 132 lines, then from 143 lines to 1154 lines, then from 1161 lines to 144 lines, then from 155 lines to 1086 lines, then from 1093 lines to 156 lines, then from 167 lines to 1191 lines, then from 1198 lines to 214 lines, then from 225 lines to 1320 lines, then from 1327 lines to 357 lines, then from 362 lines to 135 lines, then from 147 lines to 1975 lines, then from 1982 lines to 145 lines, then from 156 lines to 1770 lines, then from 1777 lines to 210 lines, then from 221 lines to 2049 lines, then from 2056 lines to 242 lines, then from 253 lines to 1745 lines, then from 1752 lines to 244 lines, then from 255 lines to 1816 lines, then from 1823 lines to 259 lines, then from 271 lines to 1478 lines, then from 1485 lines to 296 lines, then from 307 lines to 1721 lines, then from 1728 lines to 315 lines, then from 327 lines to 1175 lines, then from 1182 lines to 317 lines, then from 329 lines to 1252 lines, then from 1258 lines to 346 lines, then from 357 lines to 1685 lines, then from 1692 lines to 555 lines *)
(* coqc version 9.3+alpha compiled with OCaml 4.14.2
   coqtop version 9.3+alpha
   Expected coqc runtime on this file: 0.890 sec
   Expected coqc peak memory usage on this file: 508664.0 kb *)









Require CoRN.tactics.Step.
Require Corelib.Init.Wf.
Require Corelib.Init.Sumbool.
Require Corelib.BinNums.PosDef.
Require Corelib.Numbers.BinNums.
Require Corelib.Init.Ltac.
Require Corelib.Classes.SetoidTactics.
Require Corelib.Program.Utils.
Require Corelib.BinNums.NatDef.
Require Corelib.Lists.ListDef.
Require Corelib.Program.Tactics.
Require Corelib.Program.Basics.
Require Corelib.Setoids.Setoid.
Require Corelib.Classes.Morphisms_Prop.
Require Corelib.Classes.Equivalence.
Require Corelib.BinNums.IntDef.
Require Corelib.Classes.RelationClasses.
Require Corelib.Program.Wf.
Require Corelib.Classes.Morphisms.
Require Corelib.Relations.Relation_Definitions.
Require MathClasses.theory.CoqStreams.
Require Stdlib.Classes.DecidableClass.
Require Stdlib.Logic.Decidable.
Require Stdlib.Logic.EqdepFacts.
Require Stdlib.Logic.FunctionalExtensionality.
Require Stdlib.Logic.HLevelsBase.
Require Stdlib.Program.Syntax.
Require Stdlib.Unicode.Utf8_core.
Require Stdlib.micromega.ZifyClasses.
Require Stdlib.setoid_ring.Algebra_syntax.
Require Stdlib.BinNums.PosDef.
Require Stdlib.BinNums.IntDef.
Require Stdlib.BinNums.NatDef.
Require Stdlib.Classes.Morphisms_Prop.
Require Stdlib.Classes.SetoidTactics.
Require Stdlib.Classes.RelationClasses.
Require Stdlib.Classes.Morphisms.
Require Stdlib.Classes.Equivalence.
Require Stdlib.Init.Wf.
Require Stdlib.Init.Sumbool.
Require Stdlib.Lists.ListDef.
Require Stdlib.Logic.Eqdep.
Require Stdlib.Logic.Eqdep_dec.
Require Stdlib.Logic.ProofIrrelevanceFacts.
Require Stdlib.Numbers.BinNums.
Require Stdlib.Program.Basics.
Require Stdlib.Program.Tactics.
Require Stdlib.Program.Utils.
Require Stdlib.Program.Wf.
Require Stdlib.Relations.Relation_Definitions.
Require Stdlib.Setoids.Setoid.
Require Stdlib.Unicode.Utf8.
Require CoRN.tactics.CornTac.
Require Stdlib.Bool.Bool.
Require Stdlib.Logic.JMeq.
Require Stdlib.Logic.ProofIrrelevance.
Require Stdlib.Relations.Relation_Operators.
Require Stdlib.Program.Combinators.
Require Stdlib.Relations.Operators_Properties.
Require Stdlib.PArith.BinPosDef.
Require Stdlib.Relations.Relations.
Require Stdlib.Program.Equality.
Require Stdlib.Numbers.NumPrelude.
Require Stdlib.Program.WfExtensionality.
Require MathClasses.misc.stdlib_hints.
Require Stdlib.Structures.Equalities.
Require Stdlib.Program.Subset.
Require Stdlib.Structures.Orders.
Require Stdlib.Structures.OrdersTac.
Require Stdlib.Structures.OrdersFacts.
Require Stdlib.Structures.GenericMinMax.
Require Stdlib.Program.Program.
Require Stdlib.Numbers.NatInt.NZAxioms.
Require Stdlib.Numbers.NatInt.NZBase.
Require Stdlib.Numbers.NatInt.NZAdd.
Require Stdlib.Numbers.NatInt.NZMul.
Require Stdlib.Numbers.NatInt.NZOrder.
Require Stdlib.Numbers.NatInt.NZAddOrder.
Require Stdlib.Numbers.NatInt.NZMulOrder.
Require MathClasses.interfaces.canonical_names.
Require Stdlib.Numbers.NatInt.NZDiv.
Require Stdlib.Numbers.NatInt.NZGcd.
Require Stdlib.Numbers.NatInt.NZParity.
Require Stdlib.Numbers.NatInt.NZPow.
Require Stdlib.Numbers.NatInt.NZSqrt.
Require MathClasses.misc.propholds.
Require MathClasses.misc.setoid_tactics.
Require MathClasses.misc.util.
Require Stdlib.Numbers.NatInt.NZLog.
Require MathClasses.misc.workarounds.
Require Stdlib.Numbers.NatInt.NZBits.
Require MathClasses.misc.decision.
Require Stdlib.Numbers.Integer.Abstract.ZAxioms.
Require Stdlib.Numbers.Natural.Abstract.NAxioms.
Require Stdlib.Numbers.Integer.Abstract.ZBase.
Require Stdlib.Numbers.Natural.Abstract.NBase.
Require Stdlib.Numbers.Integer.Abstract.ZAdd.
Require Stdlib.Numbers.Natural.Abstract.NAdd.
Require Stdlib.Numbers.Integer.Abstract.ZMul.
Require Stdlib.Numbers.Natural.Abstract.NOrder.
Require MathClasses.interfaces.abstract_algebra.
Require Stdlib.Numbers.Integer.Abstract.ZLt.
Require Stdlib.Numbers.Natural.Abstract.NAddOrder.
Require MathClasses.interfaces.orders.
Require Stdlib.Numbers.Integer.Abstract.ZAddOrder.
Require Stdlib.Numbers.Natural.Abstract.NMulOrder.
Require CoRN.algebra.RSetoid.
Require Stdlib.Numbers.Integer.Abstract.ZMulOrder.
Require Stdlib.Numbers.Natural.Abstract.NSub.
Require CoRN.order.PartialOrder.
Require Stdlib.Numbers.Integer.Abstract.ZMaxMin.
Require Stdlib.Numbers.Integer.Abstract.ZParity.
Require Stdlib.Numbers.Integer.Abstract.ZSgnAbs.
Require Stdlib.Numbers.Natural.Abstract.NDiv.
Require Stdlib.Numbers.Natural.Abstract.NGcd.
Require Stdlib.Numbers.Natural.Abstract.NMaxMin.
Require Stdlib.Numbers.Natural.Abstract.NParity.
Require Stdlib.Numbers.Natural.Abstract.NSqrt.
Require CoRN.order.SemiLattice.
Require Stdlib.Numbers.Integer.Abstract.ZDivFloor.
Require Stdlib.Numbers.Integer.Abstract.ZDivTrunc.
Require Stdlib.Numbers.Integer.Abstract.ZGcd.
Require Stdlib.Numbers.Natural.Abstract.NDiv0.
Require Stdlib.Numbers.Natural.Abstract.NPow.
Require CoRN.order.Lattice.
Require Stdlib.Numbers.Integer.Abstract.ZPow.
Require Stdlib.Numbers.Natural.Abstract.NLcm.
Require Stdlib.Numbers.Natural.Abstract.NLog.
Require CoRN.order.TotalOrder.
Require Stdlib.Numbers.Integer.Abstract.ZBits.
Require Stdlib.Numbers.Integer.Abstract.ZLcm.
Require Stdlib.Numbers.Natural.Abstract.NBits.
Require Stdlib.Numbers.Natural.Abstract.NLcm0.
Require Stdlib.Numbers.Integer.Abstract.ZProperties.
Require Stdlib.Numbers.Natural.Abstract.NProperties.
Require Stdlib.Arith.PeanoNat.
Require Stdlib.Arith.Between.
Require Stdlib.Arith.Compare_dec.
Require Stdlib.Arith.EqNat.
Require Stdlib.Arith.Factorial.
Require Stdlib.Arith.Wf_nat.
Require Stdlib.Arith.Euclid.
Require Stdlib.Arith.Peano_dec.
Require Stdlib.Lists.List.
Require Stdlib.Lists.ListDec.
Require Stdlib.micromega.Refl.
Require Stdlib.Lists.Finite.
Require Stdlib.micromega.Tauto.
Require CoRN.stdlib_omissions.Pair.
Require Stdlib.Lists.ListTactics.
Require Stdlib.Sorting.Permutation.
Require Stdlib.PArith.BinPos.
Require Stdlib.Arith.Arith_base.
Require Stdlib.PArith.POrderedType.
Require Stdlib.PArith.Pnat.
Require MathClasses.implementations.ne_list.
Require Stdlib.NArith.BinNatDef.
Require Stdlib.PArith.PArith.
Require Stdlib.NArith.BinNat.
Require Stdlib.setoid_ring.BinList.
Require Stdlib.NArith.Ndiv_def.
Require Stdlib.NArith.Ngcd_def.
Require Stdlib.NArith.Nsqrt_def.
Require Stdlib.setoid_ring.Ring_theory.
Require Stdlib.NArith.Nnat.
Require Stdlib.ZArith.BinIntDef.
Require Stdlib.NArith.NArith_base.
Require Stdlib.ZArith.BinInt.
Require CoRN.model.totalorder.QMinMax.
Require CoRN.reals.RealLists.
Axiom proof_admitted : False.
Tactic Notation "admit" := abstract case proof_admitted.
Module Export Intervals.
Export CoRN.reals.RealLists.



Definition compact (a b : IR) (Hab : a [<=] b) (x : IR) := a [<=] x and x [<=] b.

End Intervals.

Notation Compact := (compact _ _).

Section More_Intervals.

End More_Intervals.

Section Totally_Bounded.

End Totally_Bounded.

Section Compact.

End Compact.
Module Export CoRN_DOT_reals_DOT_Intervals.
Module Export CoRN.
Module Export reals.
Module Export Intervals.
End Intervals.

End reals.

End CoRN.

End CoRN_DOT_reals_DOT_Intervals.
Export CoRN.reals.Intervals.

Section Feq_Equivalence.

End Feq_Equivalence.

Section Operations.

End Operations.

Section Nth_Power.

End Nth_Power.

Section Strong_Nth_Power.

End Strong_Nth_Power.
Module Export CoRN_DOT_ftc_DOT_PartFunEquality.
Module Export CoRN.
Module Export ftc.
Module Export PartFunEquality.
End PartFunEquality.

End ftc.

End CoRN.

End CoRN_DOT_ftc_DOT_PartFunEquality.
Export CoRN.ftc.PartFunEquality.
Module Export FunctSums.
End FunctSums.

Section Definitions_and_Basic_Results.

Variables a b : IR.
Hypothesis Hab : a [<=] b.

Let I := Compact Hab.

Variable F : PartIR.

Let P := Dom F.

Definition Continuous_I := included I P and (forall e, [0] [<] e -> {d : IR | [0] [<] d |
 forall x y, I x -> I y -> forall Hx Hy, AbsIR (x[-]y) [<=] d -> AbsIR (F x Hx[-]F y Hy) [<=] e}).

End Definitions_and_Basic_Results.

Arguments Continuous_I [a b].
Module Export Continuity.
End Continuity.

Section Refinements.

End Refinements.

Section Getting_Points.

End Getting_Points.

Section Lemmas.

End Lemmas.

Section Even_Partitions.

End Even_Partitions.

Section More_Definitions.

End More_Definitions.

Section Sep_Partitions.

End Sep_Partitions.
Module Export CoRN_DOT_ftc_DOT_Partitions.
Module Export CoRN.
Module Export ftc.
Module Export Partitions.
End Partitions.

End ftc.

End CoRN.

End CoRN_DOT_ftc_DOT_Partitions.
Export CoRN.ftc.Partitions.

Section Separating_Partition.

End Separating_Partition.
Module Export CoRN_DOT_ftc_DOT_RefSeparating.
Module Export CoRN.
Module Export ftc.
Module Export RefSeparating.
End RefSeparating.

End ftc.

End CoRN.

End CoRN_DOT_ftc_DOT_RefSeparating.
Export CoRN.ftc.RefSeparating.
Module Export RefLemma.
End RefLemma.

Section Integral.

Variables a b : IR.
Hypothesis Hab : a [<=] b.

Variable F : PartIR.
Hypothesis contF : Continuous_I Hab F.

Definition integral_seq : nat -> IR.
Admitted.

Lemma Cauchy_Darboux_Seq : Cauchy_prop integral_seq.
Admitted.

Definition integral := Lim (Build_CauchySeq _ _ Cauchy_Darboux_Seq).

End Integral.

Section Partition_Join.

End Partition_Join.
Module Export CoRN_DOT_ftc_DOT_Integral.
Module Export CoRN.
Module Export ftc.
Module Export Integral.
End Integral.

End ftc.

End CoRN.

End CoRN_DOT_ftc_DOT_Integral.

Inductive interval : Type :=
  | realline         : interval
  | openl      : IR -> interval
  | openr      : IR -> interval
  | closel     : IR -> interval
  | closer     : IR -> interval
  | olor : IR -> IR -> interval
  | olcr : IR -> IR -> interval
  | clor : IR -> IR -> interval
  | clcr : IR -> IR -> interval.
Definition iprop (I : interval) (x : IR) : CProp.
exact (match I with
  | realline => True
  | openr b  => x [<] b
  | openl a  => a [<] x
  | closer b => x [<=] b
  | closel a => a [<=] x
  | olor a b => a [<] x and x [<] b
  | olcr a b => a [<] x and x [<=] b
  | clor a b => a [<=] x and x [<] b
  | clcr a b => a [<=] x and x [<=] b
  end).
Defined.

Coercion iprop : interval >-> Funclass.

Lemma iprop_wd : forall I : interval, pred_wd _ I.
Admitted.

Section Single_Compact_Interval.

End Single_Compact_Interval.

Section Proper_Compact_with_One_or_Two_Points.

End Proper_Compact_with_One_or_Two_Points.

Section Functions.
Variable I : interval.

Definition Continuous F := included I (Dom F) and (forall a b (Hab : a [<=] b),
 included (Compact Hab) I -> Continuous_I Hab F).

End Functions.

Section Reflexivity_Properties.

End Reflexivity_Properties.

Section Lemmas.

End Lemmas.
Module Export CoRN_DOT_ftc_DOT_MoreIntervals.
Module Export CoRN.
Module Export ftc.
Module Export MoreIntervals.
End MoreIntervals.

End ftc.

End CoRN.

End CoRN_DOT_ftc_DOT_MoreIntervals.
Export CoRN.ftc.MoreIntervals.
Module Export CoRN.
Module Export ftc.
Module Export MoreFunctions.
End MoreFunctions.

End ftc.

End CoRN.
Export CoRN.ftc.Integral.
Export CoRN.ftc.MoreFunctions.

Section Definitions.

Variables a b : IR.
Hypothesis Hab : Min a b [<=] Max a b.
Variable F : PartIR.

Hypothesis HF : Continuous_I Hab F.

Lemma Integral_inc1 : Continuous_I (Min_leEq_lft a b) F.
Admitted.

Lemma Integral_inc2 : Continuous_I (Min_leEq_rht a b) F.
Admitted.

Definition Integral :=
  integral _ _ (Min_leEq_rht a b) F Integral_inc2[-]integral _ _ (Min_leEq_lft a b) _ Integral_inc1.

End Definitions.

Arguments Integral [a b Hab F].

Section Indefinite_Integral.

Variable I : interval.
Variable F : PartIR.

Hypothesis contF : Continuous I F.

Variable a : IR.
Hypothesis Ha : I a.

Lemma prim_lemma : forall x : IR, I x -> Continuous_I (Min_leEq_Max a x) F.
Admitted.

Lemma Fprim_strext : forall x y Hx Hy,
 Integral (prim_lemma x Hx) [#] Integral (prim_lemma y Hy) -> x [#] y.
Admitted.

Definition Fprim : PartIR.
 apply Build_PartFunct with (pfpfun := fun (x : IR) (Hx : I x) => Integral (prim_lemma x Hx)).
Proof.
  apply iprop_wd.
 exact Fprim_strext.
Defined.

End Indefinite_Integral.

Arguments Fprim [I F].

Notation "[-S-] F" := (Fprim F) (at level 20).
Fixpoint pi_seq (n : nat) : IR.
Admitted.

Lemma pi_seq_Cauchy : Cauchy_prop pi_seq.
Admitted.

Definition Pi := Two[*]Lim (Build_CauchySeq _ _ pi_seq_Cauchy).

Lemma ArcTan_def_lemma : Continuous realline {1/} ( [-C-][1]{+}FId{^}2).
Admitted.

Definition ArcTang := ( [-S-]ArcTan_def_lemma) [0] I.

Definition ArcTan (x : IR) := ArcTang x I.
Import CoRN.model.totalorder.QMinMax.
Import CoRN.stdlib_omissions.Q.

Set Implicit Arguments.

Section Pi.
Let f (a b:Q) : Q.
exact (let (x,y) := a in
 let (z,w) := b in
 Qred ((x*w + y*z)%Z/(y*w-x*z)%Z)).
Defined.

Definition ArcTan_multiple : forall x, -(1) <= x <= 1 -> forall n,
  sumbool True ((nring n)[*]ArcTan (inj_Q _ x)[=]ArcTan (inj_Q _ (iter_nat n _ (f x) 0))).
Proof.
 intros x Hx.
 induction n.
  right.
 admit.
 simpl.
 destruct (IHn) as [H|H].
  left; constructor.
 set (y:=(iter_nat n Q (f x) 0)) in *.
 destruct (Qlt_le_dec_fast 1 y) as [_|Y0].
  left; constructor.
 destruct (Qlt_le_dec_fast y (-(1))) as [_|Y1].
  left; constructor.
 destruct (Qeq_dec (1-x*y) 0) as [_|Y2].
  left; constructor.
 right.
 admit.
Defined.

Lemma reflect_right : forall A B (x:{A}+{B}), (match x with left _ => False | right _ => True end) -> B.
Admitted.

Lemma Pi_Formula :
(((nring 44)[*]ArcTan (inj_Q IR (1 /  57%Z))[-]
  (nring 12)[*]ArcTan (inj_Q IR (1 / 682%Z))[+]
  (nring  7)[*]ArcTan (inj_Q IR (1 / 239%Z))[+]
  (nring 24)[*]ArcTan (inj_Q IR (1 / 12943%Z)))[=]
 Pi[/]FourNZ).
Proof.
 assert (H0:-(1) <= (1/(57%Z)) <= 1).
  split; discriminate.
 assert (H1:-(1) <= (1/(239%Z)) <= 1).
  split; discriminate.
 assert (H2:-(1) <= (1/(682%Z)) <= 1).
  split; discriminate.
 assert (H3:-(1) <= (1/(12943%Z)) <= 1).
  split; discriminate.
 set (y0:=(iter_nat 44 _ (f (1/57%Z)) 0)).
 set (y1:=(iter_nat 7 _ (f (1/239%Z)) 0)).
 set (y2:=(iter_nat 12 _ (f (1/682%Z)) 0)).
 set (y3:=(iter_nat 24 _ (f (1/12943%Z)) 0)).
 rstepl (nring 44[*]ArcTan (inj_Q IR (1 / 57%Z))[+]
   [--](nring 12[*]ArcTan (inj_Q IR (1 / 682%Z)))[+]
     (nring 7[*]ArcTan (inj_Q IR (1 / 239%Z))[+]
       nring 24[*]ArcTan (inj_Q IR (1 / 12943%Z)))).
 csetoid_replace ((nring 44)[*]ArcTan (inj_Q IR (1 / 57%Z)))
   (ArcTan (inj_Q IR y0)); [|apply: (reflect_right (ArcTan_multiple H0 44)); now vm_compute].
🛠️ Intermediate Coq File (useful for debugging if minimization did not go as far as you wanted)
🛠️ 📜 Intermediate Coq File log (useful for debugging if minimization did not go as far as you wanted)
📜 Build Log (contains the Coq error message) (truncated to last 8.0KiB; full 7.7MiB file on GitHub Actions Artifacts under build.log)
2+flambda/bin:/github/workspace/.venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+++ export COQBIN=/github/workspace/builds/coq/coq-failing/_install_ci/bin/
+++ COQBIN=/github/workspace/builds/coq/coq-failing/_install_ci/bin/
++ CI_BUILD_DIR=/github/workspace/builds/coq/coq-failing/_build_ci
++ declare -A overlays
++ set +x
+ git_download corn
+ local project=corn
+ local dest=/github/workspace/builds/coq/coq-failing/_build_ci/corn
+ local giturl_var=corn_CI_GITURL
+ local giturl=https://github.com/coq-community/corn
+ local ref_var=corn_CI_REF
+ local ref=master
+ local parent_project_var=corn_CI_PARENT_PROJECT
+ local parent_project=
+ local submodule_folder_var=corn_CI_SUBMODULE_FOLDER
+ local submodule_folder=
+ local ov_url=
+ local ov_ref=
++ dirname /github/workspace/builds/coq/coq-failing/_build_ci/corn
+ local dest_prefix=/github/workspace/builds/coq/coq-failing/_build_ci/
+ '[' '' = '' ']'
+ local parent_project_dest=/github/workspace/builds/coq/coq-failing/_build_ci/
+ local parent_project_relative_dest=
+ '[' -d /github/workspace/builds/coq/coq-failing/_build_ci/corn ']'
+ echo 'Warning: download and unpacking of corn skipped because /github/workspace/builds/coq/coq-failing/_build_ci/corn already exists.'
Warning: download and unpacking of corn skipped because /github/workspace/builds/coq/coq-failing/_build_ci/corn already exists.
+ '[' '' ']'
+ export 'COQEXTRAFLAGS=-native-compiler no'
+ COQEXTRAFLAGS='-native-compiler no'
+ cd /github/workspace/builds/coq/coq-failing/_build_ci/corn
+ ./configure.sh
Deprecated environment variable COQLIB, use ROCQLIB instead.
Deprecated environment variable COQCORELIB, use ROCQRUNTIMELIB instead.
+ make
+ '[' -z x ']'
+ command make
ROCQ DEP VFILES
Warning: Deprecated environment variable COQLIB, use ROCQLIB instead.
         [deprecated-coq-env-var,deprecated-since-9.0,deprecated,default]
Warning: Deprecated environment variable COQCORELIB,
         use ROCQRUNTIMELIB instead.
         [deprecated-coq-env-var,deprecated-since-9.0,deprecated,default]
.Makefile.d (real: 0.39, user: 0.20, sys: 0.18, mem: 22524 ko)
ROCQ compile reals/fast/CRpi_fast.v
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin/////rocq
MINIMIZER_DEBUG_EXTRA: original invocation: '' 
MINIMIZER_DEBUG_EXTRA: new invocation: /github/workspace/builds/coq/coq-failing/_install_ci/bin/rocq.orig compile -q -w -deprecated-native-compiler-option -native-compiler no -R /github/workspace/builds/coq/coq-failing/_build_ci/corn CoRN reals/fast/CRpi_fast.v 
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: ocamlpath: /github/workspace/builds/coq/coq-failing/_install_ci/lib:
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/corn
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/rocq.orig compile -q -w -deprecated-native-compiler-option -native-compiler no -R /github/workspace/builds/coq/coq-failing/_build_ci/corn CoRN reals/fast/CRpi_fast.v 
MINIMIZER_DEBUG_EXTRA: coqlib: Warning: Deprecated environment variable COQLIB, use ROCQLIB instead.
/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq//
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.mJkzhHuGQt
MINIMIZER_DEBUG: files:  reals/fast/CRpi_fast.v /github/workspace/builds/coq/coq-failing/_build_ci/corn/reals/fast/CRpi_fast.vWarning, feedback message received but no listener to handle it!
Warning: Deprecated environment variable COQLIB, use ROCQLIB instead.
[deprecated-coq-env-var,deprecated-since-9.0,deprecated,default]Warning, feedback message received but no listener to handle it!
Warning: Deprecated environment variable COQLIB, use ROCQLIB instead.
[deprecated-coq-env-var,deprecated-since-9.0,deprecated,default]
Warning: Deprecated environment variable COQCORELIB,
use ROCQRUNTIMELIB instead.
[deprecated-coq-env-var,deprecated-since-9.0,deprecated,default]
File "./reals/fast/CRpi_fast.v", line 26, characters 0-36:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "./reals/fast/CRpi_fast.v", line 32, characters 0-55:
Warning: Notation "_ = _" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "./reals/fast/CRpi_fast.v", line 32, characters 0-55:
Warning: Notation "_ ≠ _" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "./reals/fast/CRpi_fast.v", line 94, characters 2-45:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 97, characters 3-8:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 100, characters 2-22:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 100, characters 2-22:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 100, characters 2-22:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 100, characters 2-22:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 100, characters 2-22:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 105, characters 1-7:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 105, characters 1-7:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 105, characters 1-7:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 105, characters 1-7:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 105, characters 1-7:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 110, characters 2-50:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 113, characters 2-7:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 120, characters 1-6:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 230, characters 1-154:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 230, characters 1-154:
Error: Stack overflow.

Command exited with non-zero status 1
reals/fast/CRpi_fast.vo (real: 3.71, user: 3.13, sys: 0.54, mem: 1727688 ko)
make[1]: *** [Makefile:815: reals/fast/CRpi_fast.vo] Error 1
make[1]: *** [reals/fast/CRpi_fast.vo] Deleting file 'reals/fast/CRpi_fast.glob'
make: *** [Makefile:411: all] Error 2
+ code=2
+ printf '\n%s exit code: %s\n' corn 2
+ '[' corn '!=' stdlib_test ']'
+ echo 'Aggregating timing log...'
Aggregating timing log...
+ echo

+ tools/make-one-time-file.py --real _build_ci/corn.log
    Time |   Peak Mem | File Name              
-----------------------------------------------
0m04.10s | 1727688 ko | Total Time / Peak Mem  
-----------------------------------------------
0m03.71s | 1727688 ko | reals/fast/CRpi_fast.vo
0m00.39s |   22524 ko | .Makefile.d            
+ '[' '' ']'
+ exit 2
/github/workspace/builds/coq /github/workspace
::endgroup::
📜 🔎 Minimization Log (truncated to last 8.0KiB; full 2.8MiB file on GitHub Actions Artifacts under bug.log)
ted,default]
File "/tmp/tmp7eoq2vw3/Top/bug_01.v", line 324, characters 7-20:
Warning: Coq.Init.Ltac has been replaced by Corelib.Init.Ltac.
[deprecated-dirpath-Coq,deprecated-since-9.0,deprecated,default]
File "/tmp/tmp7eoq2vw3/Top/bug_01.v", line 331, characters 0-31:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "/tmp/tmp7eoq2vw3/Top/bug_01.v", line 378, characters 0-8:
Warning: Use of "Notation" keyword for abbreviations is deprecated, use
"Abbreviation" instead.
[notation-for-abbreviation,deprecated-since-9.2,deprecated,default]
File "/tmp/tmp7eoq2vw3/Top/bug_01.v", line 380, characters 0-8:
Warning: Use of "Notation" keyword for abbreviations is deprecated, use
"Abbreviation" instead.
[notation-for-abbreviation,deprecated-since-9.2,deprecated,default]
File "/tmp/tmp7eoq2vw3/Top/bug_01.v", line 442, characters 0-9:
Warning: Let definition aux_seq_lub declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmp7eoq2vw3/Top/bug_01.v", line 449, characters 0-9:
Warning: Let definition aux_seq_lub_prop declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmp7eoq2vw3/Top/bug_01.v", line 464, characters 0-9:
Warning: Let definition aux_seq_glb declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmp7eoq2vw3/Top/bug_01.v", line 471, characters 0-9:
Warning: Let definition aux_seq_glb_prop declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmp7eoq2vw3/Top/bug_01.v", line 575, characters 0-55:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "/tmp/tmp7eoq2vw3/Top/bug_01.v", line 583, characters 0-28:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "/tmp/tmp7eoq2vw3/Top/bug_01.v", line 843, characters 51-52:
Error:
The term "I" has type "True" while it is expected to have type
 "realline [0]".


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Admitting definitions unsuccessful.
No successful changes.

I will now attempt to admit lemmas with admit. Defined with Proof using

Non-fatal error: Failed to admit lemmas and preserve the error.  
The new error was:
Deprecated environment variable COQCORELIB, use ROCQRUNTIMELIB instead.
Warning: Deprecated environment variable COQCORELIB,
use ROCQRUNTIMELIB instead.
[deprecated-coq-env-var,deprecated-since-9.0,deprecated,default]
File "/tmp/tmp3qdb3gy7/Top/bug_01.v", line 224, characters 0-34:
Warning: Library File Stdlib.ZArith.ZArith_base is deprecated
since Stdlib 9.0. use ZArith instead
[deprecated-library-file-since-Stdlib-9.0,deprecated-since-Stdlib-9.0,deprecated-library-file,deprecated,default]
File "/tmp/tmp3qdb3gy7/Top/bug_01.v", line 324, characters 7-20:
Warning: Coq.Init.Ltac has been replaced by Corelib.Init.Ltac.
[deprecated-dirpath-Coq,deprecated-since-9.0,deprecated,default]
File "/tmp/tmp3qdb3gy7/Top/bug_01.v", line 331, characters 0-31:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "/tmp/tmp3qdb3gy7/Top/bug_01.v", line 378, characters 0-8:
Warning: Use of "Notation" keyword for abbreviations is deprecated, use
"Abbreviation" instead.
[notation-for-abbreviation,deprecated-since-9.2,deprecated,default]
File "/tmp/tmp3qdb3gy7/Top/bug_01.v", line 380, characters 0-8:
Warning: Use of "Notation" keyword for abbreviations is deprecated, use
"Abbreviation" instead.
[notation-for-abbreviation,deprecated-since-9.2,deprecated,default]
File "/tmp/tmp3qdb3gy7/Top/bug_01.v", line 442, characters 0-9:
Warning: Let definition aux_seq_lub declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmp3qdb3gy7/Top/bug_01.v", line 449, characters 0-9:
Warning: Let definition aux_seq_lub_prop declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmp3qdb3gy7/Top/bug_01.v", line 464, characters 0-9:
Warning: Let definition aux_seq_glb declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmp3qdb3gy7/Top/bug_01.v", line 471, characters 0-9:
Warning: Let definition aux_seq_glb_prop declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmp3qdb3gy7/Top/bug_01.v", line 575, characters 0-55:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "/tmp/tmp3qdb3gy7/Top/bug_01.v", line 583, characters 0-28:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
Error: The section Pi needs to be closed.


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Admitting lemmas unsuccessful.
No successful changes.

I will now attempt to admit definitions with admit. Defined with Proof using

Non-fatal error: Failed to admit definitions and preserve the error.  
The new error was:
Deprecated environment variable COQCORELIB, use ROCQRUNTIMELIB instead.
Warning: Deprecated environment variable COQCORELIB,
use ROCQRUNTIMELIB instead.
[deprecated-coq-env-var,deprecated-since-9.0,deprecated,default]
File "/tmp/tmpqav2lx2c/Top/bug_01.v", line 224, characters 0-34:
Warning: Library File Stdlib.ZArith.ZArith_base is deprecated
since Stdlib 9.0. use ZArith instead
[deprecated-library-file-since-Stdlib-9.0,deprecated-since-Stdlib-9.0,deprecated-library-file,deprecated,default]
File "/tmp/tmpqav2lx2c/Top/bug_01.v", line 324, characters 7-20:
Warning: Coq.Init.Ltac has been replaced by Corelib.Init.Ltac.
[deprecated-dirpath-Coq,deprecated-since-9.0,deprecated,default]
File "/tmp/tmpqav2lx2c/Top/bug_01.v", line 331, characters 0-31:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "/tmp/tmpqav2lx2c/Top/bug_01.v", line 378, characters 0-8:
Warning: Use of "Notation" keyword for abbreviations is deprecated, use
"Abbreviation" instead.
[notation-for-abbreviation,deprecated-since-9.2,deprecated,default]
File "/tmp/tmpqav2lx2c/Top/bug_01.v", line 380, characters 0-8:
Warning: Use of "Notation" keyword for abbreviations is deprecated, use
"Abbreviation" instead.
[notation-for-abbreviation,deprecated-since-9.2,deprecated,default]
File "/tmp/tmpqav2lx2c/Top/bug_01.v", line 442, characters 0-9:
Warning: Let definition aux_seq_lub declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmpqav2lx2c/Top/bug_01.v", line 449, characters 0-9:
Warning: Let definition aux_seq_lub_prop declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmpqav2lx2c/Top/bug_01.v", line 464, characters 0-9:
Warning: Let definition aux_seq_glb declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmpqav2lx2c/Top/bug_01.v", line 471, characters 0-9:
Warning: Let definition aux_seq_glb_prop declared as an axiom.
[let-as-axiom,vernacular,default]
File "/tmp/tmpqav2lx2c/Top/bug_01.v", line 575, characters 0-55:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "/tmp/tmpqav2lx2c/Top/bug_01.v", line 583, characters 0-28:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "/tmp/tmpqav2lx2c/Top/bug_01.v", line 831, characters 0-22:
Error: Extra arguments: I, F.


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Admitting definitions unsuccessful.
No successful changes.

I will now attempt to add Proof using lines
�[92m
Adding Proof using lines successful.�[0m
Failed to do everything at once; trying one at a time.
Adding Proof using lines unsuccessful.
No successful changes.

I will now attempt to export modules
Module exportation successful

I will now attempt to split imports and exports
Import/Export splitting unsuccessful.

I will now attempt to split := definitions
One-line definition splitting successful

I will now attempt to lift Requires to the top of the file while inserting option settings

I will now attempt to lift Requires to the top of the file while inserting option settings

I will now attempt to remove all lines, one at a time

If you have any comments on your experience of the minimizer, please share them in a reply (possibly tagging @JasonGross).
If you believe there's a bug in the bug minimizer, please report it on the bug minimizer issue tracker.

@coqbot-app
Copy link
Contributor

coqbot-app bot commented Feb 28, 2026

Minimization interrupted by timeout, being automatically continued. Partially Minimized File /home/runner/work/run-coq-bug-minimizer/run-coq-bug-minimizer/builds/coq/coq-failing/_build_ci/corn/reals/fast/CRpi_fast.v in 5h 15m 7s (from ci-corn) (interrupted by timeout, being automatically continued) (full log on GitHub Actions - verbose log)
⭐ ⏱️ Partially Minimized Coq File (timeout)
(* -*- mode: coq; coq-prog-args: ("-emacs" "-q" "-w" "-deprecated-native-compiler-option" "-native-compiler" "no" "-coqlib" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq//" "-R" "/github/workspace/builds/coq/coq-failing/_build_ci/corn" "CoRN" "-Q" "/github/workspace/cwd" "Top" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq///user-contrib/Bignums" "Bignums" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq///user-contrib/HB" "HB" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq///user-contrib/Ltac2" "Ltac2" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq///user-contrib/MathClasses" "MathClasses" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq///user-contrib/Stdlib" "Stdlib" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq///user-contrib/elpi" "elpi" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq///user-contrib/elpi_elpi" "elpi_elpi" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq///user-contrib/elpi_examples" "elpi_examples" "-top" "Top.bug_01") -*- *)
(* File reduced by coq-bug-minimizer from original input, then from 362 lines to 68 lines, then from 80 lines to 1074 lines, then from 1081 lines to 78 lines, then from 89 lines to 1725 lines, then from 1732 lines to 96 lines, then from 108 lines to 1195 lines, then from 1202 lines to 99 lines, then from 110 lines to 1587 lines, then from 1594 lines to 117 lines, then from 129 lines to 896 lines, then from 903 lines to 120 lines, then from 131 lines to 1147 lines, then from 1154 lines to 132 lines, then from 143 lines to 1154 lines, then from 1161 lines to 144 lines, then from 155 lines to 1086 lines, then from 1093 lines to 156 lines, then from 167 lines to 1191 lines, then from 1198 lines to 214 lines, then from 225 lines to 1320 lines, then from 1327 lines to 357 lines, then from 362 lines to 135 lines, then from 147 lines to 1975 lines, then from 1982 lines to 145 lines, then from 156 lines to 1770 lines, then from 1777 lines to 210 lines, then from 221 lines to 2049 lines, then from 2056 lines to 242 lines, then from 253 lines to 1745 lines, then from 1752 lines to 244 lines, then from 255 lines to 1816 lines, then from 1823 lines to 259 lines, then from 271 lines to 1478 lines, then from 1485 lines to 296 lines, then from 307 lines to 1721 lines, then from 1728 lines to 315 lines, then from 327 lines to 1175 lines, then from 1182 lines to 317 lines, then from 329 lines to 1252 lines, then from 1258 lines to 346 lines, then from 357 lines to 1685 lines, then from 1692 lines to 555 lines, then from 563 lines to 210 lines, then from 222 lines to 972 lines, then from 978 lines to 220 lines, then from 231 lines to 1055 lines, then from 1062 lines to 248 lines, then from 259 lines to 2033 lines, then from 2038 lines to 311 lines, then from 322 lines to 1621 lines, then from 1627 lines to 331 lines, then from 342 lines to 1683 lines, then from 1690 lines to 368 lines, then from 379 lines to 730 lines, then from 737 lines to 384 lines, then from 395 lines to 750 lines, then from 757 lines to 410 lines, then from 421 lines to 763 lines, then from 770 lines to 418 lines, then from 429 lines to 840 lines, then from 847 lines to 426 lines, then from 437 lines to 767 lines, then from 774 lines to 447 lines, then from 458 lines to 780 lines, then from 787 lines to 455 lines, then from 466 lines to 812 lines, then from 819 lines to 469 lines, then from 480 lines to 1590 lines, then from 1596 lines to 594 lines *)
(* coqc version 9.3+alpha compiled with OCaml 4.14.2
   coqtop version 9.3+alpha
   Expected coqc runtime on this file: 0.953 sec
   Expected coqc peak memory usage on this file: 502764.0 kb *)









Require CoRN.tactics.Step.
Require Corelib.BinNums.PosDef.
Require Corelib.Relations.Relation_Definitions.
Require Corelib.Program.Wf.
Require Corelib.Program.Tactics.
Require Corelib.BinNums.NatDef.
Require Corelib.Classes.Morphisms.
Require Corelib.Init.Ltac.
Require Corelib.Lists.ListDef.
Require Corelib.Classes.Morphisms_Prop.
Require Corelib.BinNums.IntDef.
Require Corelib.Init.Sumbool.
Require Corelib.Classes.SetoidTactics.
Require Corelib.Init.Wf.
Require Corelib.Setoids.Setoid.
Require Corelib.Program.Utils.
Require Corelib.Classes.Equivalence.
Require Corelib.Program.Basics.
Require Corelib.Numbers.BinNums.
Require Corelib.Classes.RelationClasses.
Require MathClasses.theory.CoqStreams.
Require Stdlib.Classes.DecidableClass.
Require Stdlib.Logic.Decidable.
Require Stdlib.Logic.EqdepFacts.
Require Stdlib.Logic.FunctionalExtensionality.
Require Stdlib.Logic.HLevelsBase.
Require Stdlib.Program.Syntax.
Require Stdlib.Unicode.Utf8_core.
Require Stdlib.micromega.ZifyClasses.
Require Stdlib.setoid_ring.Algebra_syntax.
Require Stdlib.BinNums.IntDef.
Require Stdlib.BinNums.PosDef.
Require Stdlib.BinNums.NatDef.
Require Stdlib.Classes.Morphisms_Prop.
Require Stdlib.Classes.SetoidTactics.
Require Stdlib.Classes.Morphisms.
Require Stdlib.Classes.Equivalence.
Require Stdlib.Classes.RelationClasses.
Require Stdlib.Init.Wf.
Require Stdlib.Init.Sumbool.
Require Stdlib.Lists.ListDef.
Require Stdlib.Logic.Eqdep.
Require Stdlib.Logic.Eqdep_dec.
Require Stdlib.Logic.ProofIrrelevanceFacts.
Require Stdlib.Numbers.BinNums.
Require Stdlib.Program.Basics.
Require Stdlib.Program.Tactics.
Require Stdlib.Program.Utils.
Require Stdlib.Program.Wf.
Require Stdlib.Relations.Relation_Definitions.
Require Stdlib.Setoids.Setoid.
Require Stdlib.Unicode.Utf8.
Require CoRN.tactics.CornTac.
Require Stdlib.Bool.Bool.
Require Stdlib.Logic.JMeq.
Require Stdlib.Logic.ProofIrrelevance.
Require Stdlib.Relations.Relation_Operators.
Require Stdlib.Program.Combinators.
Require Stdlib.Relations.Operators_Properties.
Require Stdlib.PArith.BinPosDef.
Require Stdlib.Relations.Relations.
Require Stdlib.Program.Equality.
Require Stdlib.Numbers.NumPrelude.
Require Stdlib.Program.WfExtensionality.
Require MathClasses.misc.stdlib_hints.
Require Stdlib.Structures.Equalities.
Require Stdlib.Program.Subset.
Require Stdlib.Structures.Orders.
Require Stdlib.Structures.OrdersTac.
Require Stdlib.Structures.OrdersFacts.
Require Stdlib.Structures.GenericMinMax.
Require Stdlib.Program.Program.
Require Stdlib.Numbers.NatInt.NZAxioms.
Require Stdlib.Numbers.NatInt.NZBase.
Require Stdlib.Numbers.NatInt.NZAdd.
Require Stdlib.Numbers.NatInt.NZMul.
Require Stdlib.Numbers.NatInt.NZOrder.
Require Stdlib.Numbers.NatInt.NZAddOrder.
Require Stdlib.Numbers.NatInt.NZMulOrder.
Require MathClasses.interfaces.canonical_names.
Require Stdlib.Numbers.NatInt.NZDiv.
Require Stdlib.Numbers.NatInt.NZGcd.
Require Stdlib.Numbers.NatInt.NZParity.
Require Stdlib.Numbers.NatInt.NZPow.
Require Stdlib.Numbers.NatInt.NZSqrt.
Require MathClasses.misc.propholds.
Require MathClasses.misc.setoid_tactics.
Require MathClasses.misc.util.
Require Stdlib.Numbers.NatInt.NZLog.
Require MathClasses.misc.workarounds.
Require Stdlib.Numbers.NatInt.NZBits.
Require MathClasses.misc.decision.
Require Stdlib.Numbers.Integer.Abstract.ZAxioms.
Require Stdlib.Numbers.Natural.Abstract.NAxioms.
Require Stdlib.Numbers.Integer.Abstract.ZBase.
Require Stdlib.Numbers.Natural.Abstract.NBase.
Require Stdlib.Numbers.Integer.Abstract.ZAdd.
Require Stdlib.Numbers.Natural.Abstract.NAdd.
Require Stdlib.Numbers.Integer.Abstract.ZMul.
Require Stdlib.Numbers.Natural.Abstract.NOrder.
Require MathClasses.interfaces.abstract_algebra.
Require Stdlib.Numbers.Integer.Abstract.ZLt.
Require CoRN.model.totalorder.QMinMax.
Require CoRN.model.semigroups.Qsemigroup.
Require CoRN.reals.CReals.
Axiom proof_admitted : False.
Tactic Notation "admit" := abstract case proof_admitted.
Export CoRN.reals.CReals.

Section R_CReals.

End R_CReals.
Module Export CoRN_DOT_reals_DOT_Cauchy_CReals.
Module Export CoRN.
Module Export reals.
Module Export Cauchy_CReals.
End Cauchy_CReals.

End reals.

End CoRN.

End CoRN_DOT_reals_DOT_Cauchy_CReals.
Export CoRN.model.semigroups.Qsemigroup.

Lemma ZEROQ_as_rht_unit3 : is_rht_unit (S:=Q_as_CSetoid) Qplus_is_bin_fun 0.
Admitted.

Lemma ZEROQ_as_lft_unit3 : is_lft_unit (S:=Q_as_CSetoid) Qplus_is_bin_fun 0.
Admitted.

Definition Q_is_CMonoid := Build_is_CMonoid
 Q_as_CSemiGroup _ ZEROQ_as_rht_unit3 ZEROQ_as_lft_unit3.

Definition Q_as_CMonoid := Build_CMonoid Q_as_CSemiGroup _ Q_is_CMonoid.
Module Export Qmonoid.
End Qmonoid.
Import CoRN.algebra.CGroups.

Lemma Q_is_CGroup : is_CGroup Q_as_CMonoid Qopp_is_fun.
Admitted.

Definition Q_as_CGroup := Build_CGroup Q_as_CMonoid Qopp_is_fun Q_is_CGroup.
Module Export Qgroup.
End Qgroup.
Import CoRN.algebra.CAbGroups.

Lemma Q_is_CAbGroup : is_CAbGroup Q_as_CGroup.
Admitted.

Definition Q_as_CAbGroup := Build_CAbGroup Q_as_CGroup Q_is_CAbGroup.
Module Export CoRN_DOT_model_DOT_abgroups_DOT_Qabgroup.
Module Export CoRN.
Module Export model.
Module Export abgroups.
Module Export Qabgroup.
End Qabgroup.

End abgroups.

End model.

End CoRN.

End CoRN_DOT_model_DOT_abgroups_DOT_Qabgroup.
Export CoRN.model.abgroups.Qabgroup.
Import CoRN.algebra.CRings.

Definition Q_is_CRing : is_CRing Q_as_CAbGroup 1 Qmult_is_bin_fun.
Admitted.

Definition Q_as_CRing := Build_CRing _ _ _ Q_is_CRing.
Module Export Qring.
End Qring.
Import CoRN.algebra.CFields.

Lemma Q_is_CField : is_CField Q_as_CRing Qinv_dep.
Admitted.

Definition Q_as_CField := Build_CField _ _ Q_is_CField Qinv_strext.
Module Export Qfield.
End Qfield.
Import CoRN.algebra.COrdFields.

Definition Qlt_is_strict_order := Build_strictorder
 Qlt_trans Qlt_is_antisymmetric_unfolded.

Definition Q_is_COrdField := Build_is_COrdField Q_as_CField
 Qlt_is_CSetoid_relation Qle (default_greater Q_as_CField Qlt_is_CSetoid_relation)
 (default_grEq Q_as_CField Qle) Qlt_is_strict_order (fun x y E z => proj2 (Qplus_lt_l x y z) E)
 Qmult_lt_0_compat Qlt_gives_apartness Qle_is_not_lt Qgt_is_lt Qge_is_not_gt.

Definition Q_as_COrdField := Build_COrdField _ _ _ _ _ Q_is_COrdField.
Module Export CoRN_DOT_model_DOT_ordfields_DOT_Qordfield.
Module Export CoRN.
Module Export model.
Module Export ordfields.
Module Export Qordfield.
End Qordfield.

End ordfields.

End model.

End CoRN.

End CoRN_DOT_model_DOT_ordfields_DOT_Qordfield.
Export CoRN.model.ordfields.Qordfield.
Export CoRN.reals.Cauchy_CReals.
Module Export CoRN_DOT_model_DOT_reals_DOT_Cauchy_IR.
Module Export CoRN.
Module Export model.
Module Export reals.
Module Export Cauchy_IR.
End Cauchy_IR.

End reals.

End model.

End CoRN.

End CoRN_DOT_model_DOT_reals_DOT_Cauchy_IR.

Definition IR : CReals.
Admitted.

Notation PartIR := (PartFunct IR).

Section CReals_axioms.

End CReals_axioms.

Section Cauchy_Defs.

End Cauchy_Defs.

Section Inequalities.

End Inequalities.

Section Equiv_Cauchy.

End Equiv_Cauchy.

Section Cauchy_props.

End Cauchy_props.
Module Export CoRN_DOT_reals_DOT_CauchySeq.
Module Export CoRN.
Module Export reals.
Module Export CauchySeq.
End CauchySeq.

End reals.

End CoRN.

End CoRN_DOT_reals_DOT_CauchySeq.
Export CoRN.model.reals.Cauchy_IR.

Section Rational_sequence_prelogue.

Variable R1 : CReals.

Local Coercion nat_of_P : positive >-> nat.

Lemma den_is_nonzero : forall x : Q_as_COrdField, nring (R:=R1) (Qden x) [#] [0].
Admitted.

Definition inj_Q : Q_as_COrdField -> R1.
Proof.
 intro x.
 case x.
 intros num0 den0.
 exact (zring num0[/]nring (R:=R1) den0[//]den_is_nonzero (Qmake num0 den0)).
Defined.

End Rational_sequence_prelogue.
Module Export Q_in_CReals.
End Q_in_CReals.
Export CoRN.reals.CauchySeq.

Section Max_function.

Variables x y : IR.

Definition MAX : IR.
Admitted.

End Max_function.

Lemma MAX_strext : bin_op_strext _ MAX.
Admitted.

Definition Max := Build_CSetoid_bin_op _ MAX MAX_strext.

Section Minimum.
Definition Min : CSetoid_bin_op IR.
Admitted.

Lemma Min_leEq_lft : forall x y : IR, Min x y [<=] x.
Admitted.

Lemma Min_leEq_rht : forall x y : IR, Min x y [<=] y.
Admitted.

Variables a b : IR.

Lemma Min_leEq_Max : Min a b [<=] Max a b.
Admitted.

End Minimum.
Definition AbsIR : CSetoid_un_op IR.
Admitted.

Section SeqMax.

End SeqMax.

Section Part_Function_Max.

End Part_Function_Max.

Section Part_Function_Abs.

End Part_Function_Abs.

Section Inclusion.

End Inclusion.
Module Export CoRN_DOT_reals_DOT_Max_AbsIR.
Module Export CoRN.
Module Export reals.
Module Export Max_AbsIR.
End Max_AbsIR.

End reals.

End CoRN.

End CoRN_DOT_reals_DOT_Max_AbsIR.
Export CoRN.reals.Max_AbsIR.

Section More_Cauchy_Props.

End More_Cauchy_Props.

Section Subsequences.

End Subsequences.

Section Cauchy_Subsequences.

End Cauchy_Subsequences.

Section Properties_of_Exponentiation.

End Properties_of_Exponentiation.
Module Export CoRN_DOT_reals_DOT_CReals1.
Module Export CoRN.
Module Export reals.
Module Export CReals1.
End CReals1.

End reals.

End CoRN.

End CoRN_DOT_reals_DOT_CReals1.
Export CoRN.reals.CReals1.
Module Export CoRN.
Module Export reals.
Module Export RealLists.
End RealLists.

End reals.

End CoRN.
Export CoRN.reals.RealLists.

Definition compact (a b : IR) (Hab : a [<=] b) (x : IR) := a [<=] x and x [<=] b.

Notation Compact := (compact _ _).

Section Definitions_and_Basic_Results.

Variables a b : IR.
Hypothesis Hab : a [<=] b.

Let I := Compact Hab.

Variable F : PartIR.

Let P := Dom F.

Definition Continuous_I := included I P and (forall e, [0] [<] e -> {d : IR | [0] [<] d |
 forall x y, I x -> I y -> forall Hx Hy, AbsIR (x[-]y) [<=] d -> AbsIR (F x Hx[-]F y Hy) [<=] e}).

End Definitions_and_Basic_Results.

Arguments Continuous_I [a b].

Section Integral.

Variables a b : IR.
Hypothesis Hab : a [<=] b.

Variable F : PartIR.
Hypothesis contF : Continuous_I Hab F.

Definition integral_seq : nat -> IR.
Admitted.

Lemma Cauchy_Darboux_Seq : Cauchy_prop integral_seq.
Admitted.

Definition integral := Lim (Build_CauchySeq _ _ Cauchy_Darboux_Seq).

End Integral.

Inductive interval : Type :=
  | realline         : interval
  | openl      : IR -> interval
  | openr      : IR -> interval
  | closel     : IR -> interval
  | closer     : IR -> interval
  | olor : IR -> IR -> interval
  | olcr : IR -> IR -> interval
  | clor : IR -> IR -> interval
  | clcr : IR -> IR -> interval.
Definition iprop (I : interval) (x : IR) : CProp.
exact (match I with
  | realline => True
  | openr b  => x [<] b
  | openl a  => a [<] x
  | closer b => x [<=] b
  | closel a => a [<=] x
  | olor a b => a [<] x and x [<] b
  | olcr a b => a [<] x and x [<=] b
  | clor a b => a [<=] x and x [<] b
  | clcr a b => a [<=] x and x [<=] b
  end).
Defined.

Coercion iprop : interval >-> Funclass.

Lemma iprop_wd : forall I : interval, pred_wd _ I.
Admitted.

Section Functions.
Variable I : interval.

Definition Continuous F := included I (Dom F) and (forall a b (Hab : a [<=] b),
 included (Compact Hab) I -> Continuous_I Hab F).

End Functions.

Section Definitions.

Variables a b : IR.
Hypothesis Hab : Min a b [<=] Max a b.
Variable F : PartIR.

Hypothesis HF : Continuous_I Hab F.

Lemma Integral_inc1 : Continuous_I (Min_leEq_lft a b) F.
Admitted.

Lemma Integral_inc2 : Continuous_I (Min_leEq_rht a b) F.
Admitted.

Definition Integral :=
  integral _ _ (Min_leEq_rht a b) F Integral_inc2[-]integral _ _ (Min_leEq_lft a b) _ Integral_inc1.

End Definitions.

Arguments Integral [a b Hab F].

Section Indefinite_Integral.

Variable I : interval.
Variable F : PartIR.

Hypothesis contF : Continuous I F.

Variable a : IR.
Hypothesis Ha : I a.

Lemma prim_lemma : forall x : IR, I x -> Continuous_I (Min_leEq_Max a x) F.
Admitted.

Lemma Fprim_strext : forall x y Hx Hy,
 Integral (prim_lemma x Hx) [#] Integral (prim_lemma y Hy) -> x [#] y.
Admitted.

Definition Fprim : PartIR.
 apply Build_PartFunct with (pfpfun := fun (x : IR) (Hx : I x) => Integral (prim_lemma x Hx)).
Proof.
  apply iprop_wd.
 exact Fprim_strext.
Defined.

End Indefinite_Integral.

Arguments Fprim [I F].

Notation "[-S-] F" := (Fprim F) (at level 20).
Fixpoint pi_seq (n : nat) : IR.
Admitted.

Lemma pi_seq_Cauchy : Cauchy_prop pi_seq.
Admitted.

Definition Pi := Two[*]Lim (Build_CauchySeq _ _ pi_seq_Cauchy).

Lemma ArcTan_def_lemma : Continuous realline {1/} ( [-C-][1]{+}FId{^}2).
Admitted.

Definition ArcTang := ( [-S-]ArcTan_def_lemma) [0] I.

Definition ArcTan (x : IR) := ArcTang x I.
Import CoRN.model.totalorder.QMinMax.
Import CoRN.stdlib_omissions.Q.

Set Implicit Arguments.

Section Pi.
Let f (a b:Q) : Q.
exact (let (x,y) := a in
 let (z,w) := b in
 Qred ((x*w + y*z)%Z/(y*w-x*z)%Z)).
Defined.

Definition ArcTan_multiple : forall x, -(1) <= x <= 1 -> forall n,
  sumbool True ((nring n)[*]ArcTan (inj_Q _ x)[=]ArcTan (inj_Q _ (iter_nat n _ (f x) 0))).
Proof.
 intros x Hx.
 induction n.
  right.
 admit.
 simpl.
 destruct (IHn) as [H|H].
  left; constructor.
 set (y:=(iter_nat n Q (f x) 0)) in *.
 destruct (Qlt_le_dec_fast 1 y) as [_|Y0].
  left; constructor.
 destruct (Qlt_le_dec_fast y (-(1))) as [_|Y1].
  left; constructor.
 destruct (Qeq_dec (1-x*y) 0) as [_|Y2].
  left; constructor.
 right.
 admit.
Defined.

Lemma reflect_right : forall A B (x:{A}+{B}), (match x with left _ => False | right _ => True end) -> B.
Admitted.

Lemma Pi_Formula :
(((nring 44)[*]ArcTan (inj_Q IR (1 /  57%Z))[-]
  (nring 12)[*]ArcTan (inj_Q IR (1 / 682%Z))[+]
  (nring  7)[*]ArcTan (inj_Q IR (1 / 239%Z))[+]
  (nring 24)[*]ArcTan (inj_Q IR (1 / 12943%Z)))[=]
 Pi[/]FourNZ).
Proof.
 assert (H0:-(1) <= (1/(57%Z)) <= 1).
  split; discriminate.
 assert (H1:-(1) <= (1/(239%Z)) <= 1).
  split; discriminate.
 assert (H2:-(1) <= (1/(682%Z)) <= 1).
  split; discriminate.
 assert (H3:-(1) <= (1/(12943%Z)) <= 1).
  split; discriminate.
 set (y0:=(iter_nat 44 _ (f (1/57%Z)) 0)).
 set (y1:=(iter_nat 7 _ (f (1/239%Z)) 0)).
 set (y2:=(iter_nat 12 _ (f (1/682%Z)) 0)).
 set (y3:=(iter_nat 24 _ (f (1/12943%Z)) 0)).
 rstepl (nring 44[*]ArcTan (inj_Q IR (1 / 57%Z))[+]
   [--](nring 12[*]ArcTan (inj_Q IR (1 / 682%Z)))[+]
     (nring 7[*]ArcTan (inj_Q IR (1 / 239%Z))[+]
       nring 24[*]ArcTan (inj_Q IR (1 / 12943%Z)))).
 csetoid_replace ((nring 44)[*]ArcTan (inj_Q IR (1 / 57%Z)))
   (ArcTan (inj_Q IR y0)); [|apply: (reflect_right (ArcTan_multiple H0 44)); now vm_compute].
🛠️ Intermediate Coq File (useful for debugging if minimization did not go as far as you wanted)
🛠️ 📜 Intermediate Coq File log (useful for debugging if minimization did not go as far as you wanted)
📜 Build Log (contains the Coq error message) (truncated to last 8.0KiB; full 7.7MiB file on GitHub Actions Artifacts under build.log)
2+flambda/bin:/github/workspace/.venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+++ export COQBIN=/github/workspace/builds/coq/coq-failing/_install_ci/bin/
+++ COQBIN=/github/workspace/builds/coq/coq-failing/_install_ci/bin/
++ CI_BUILD_DIR=/github/workspace/builds/coq/coq-failing/_build_ci
++ declare -A overlays
++ set +x
+ git_download corn
+ local project=corn
+ local dest=/github/workspace/builds/coq/coq-failing/_build_ci/corn
+ local giturl_var=corn_CI_GITURL
+ local giturl=https://github.com/coq-community/corn
+ local ref_var=corn_CI_REF
+ local ref=master
+ local parent_project_var=corn_CI_PARENT_PROJECT
+ local parent_project=
+ local submodule_folder_var=corn_CI_SUBMODULE_FOLDER
+ local submodule_folder=
+ local ov_url=
+ local ov_ref=
++ dirname /github/workspace/builds/coq/coq-failing/_build_ci/corn
+ local dest_prefix=/github/workspace/builds/coq/coq-failing/_build_ci/
+ '[' '' = '' ']'
+ local parent_project_dest=/github/workspace/builds/coq/coq-failing/_build_ci/
+ local parent_project_relative_dest=
+ '[' -d /github/workspace/builds/coq/coq-failing/_build_ci/corn ']'
+ echo 'Warning: download and unpacking of corn skipped because /github/workspace/builds/coq/coq-failing/_build_ci/corn already exists.'
Warning: download and unpacking of corn skipped because /github/workspace/builds/coq/coq-failing/_build_ci/corn already exists.
+ '[' '' ']'
+ export 'COQEXTRAFLAGS=-native-compiler no'
+ COQEXTRAFLAGS='-native-compiler no'
+ cd /github/workspace/builds/coq/coq-failing/_build_ci/corn
+ ./configure.sh
Deprecated environment variable COQLIB, use ROCQLIB instead.
Deprecated environment variable COQCORELIB, use ROCQRUNTIMELIB instead.
+ make
+ '[' -z x ']'
+ command make
ROCQ DEP VFILES
Warning: Deprecated environment variable COQLIB, use ROCQLIB instead.
         [deprecated-coq-env-var,deprecated-since-9.0,deprecated,default]
Warning: Deprecated environment variable COQCORELIB,
         use ROCQRUNTIMELIB instead.
         [deprecated-coq-env-var,deprecated-since-9.0,deprecated,default]
.Makefile.d (real: 0.37, user: 0.20, sys: 0.16, mem: 22688 ko)
ROCQ compile reals/fast/CRpi_fast.v
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin/////rocq
MINIMIZER_DEBUG_EXTRA: original invocation: '' 
MINIMIZER_DEBUG_EXTRA: new invocation: /github/workspace/builds/coq/coq-failing/_install_ci/bin/rocq.orig compile -q -w -deprecated-native-compiler-option -native-compiler no -R /github/workspace/builds/coq/coq-failing/_build_ci/corn CoRN reals/fast/CRpi_fast.v 
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: ocamlpath: /github/workspace/builds/coq/coq-failing/_install_ci/lib:
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/corn
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/rocq.orig compile -q -w -deprecated-native-compiler-option -native-compiler no -R /github/workspace/builds/coq/coq-failing/_build_ci/corn CoRN reals/fast/CRpi_fast.v 
MINIMIZER_DEBUG_EXTRA: coqlib: Warning: Deprecated environment variable COQLIB, use ROCQLIB instead.
/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq//
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.G86fb5QGzV
MINIMIZER_DEBUG: files:  reals/fast/CRpi_fast.v /github/workspace/builds/coq/coq-failing/_build_ci/corn/reals/fast/CRpi_fast.vWarning, feedback message received but no listener to handle it!
Warning: Deprecated environment variable COQLIB, use ROCQLIB instead.
[deprecated-coq-env-var,deprecated-since-9.0,deprecated,default]Warning, feedback message received but no listener to handle it!
Warning: Deprecated environment variable COQLIB, use ROCQLIB instead.
[deprecated-coq-env-var,deprecated-since-9.0,deprecated,default]
Warning: Deprecated environment variable COQCORELIB,
use ROCQRUNTIMELIB instead.
[deprecated-coq-env-var,deprecated-since-9.0,deprecated,default]
File "./reals/fast/CRpi_fast.v", line 26, characters 0-36:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "./reals/fast/CRpi_fast.v", line 32, characters 0-55:
Warning: Notation "_ = _" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "./reals/fast/CRpi_fast.v", line 32, characters 0-55:
Warning: Notation "_ ≠ _" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "./reals/fast/CRpi_fast.v", line 94, characters 2-45:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 97, characters 3-8:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 100, characters 2-22:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 100, characters 2-22:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 100, characters 2-22:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 100, characters 2-22:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 100, characters 2-22:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 105, characters 1-7:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 105, characters 1-7:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 105, characters 1-7:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 105, characters 1-7:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 105, characters 1-7:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 110, characters 2-50:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 113, characters 2-7:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 120, characters 1-6:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 230, characters 1-154:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 230, characters 1-154:
Error: Stack overflow.

Command exited with non-zero status 1
reals/fast/CRpi_fast.vo (real: 3.28, user: 3.02, sys: 0.22, mem: 1732324 ko)
make[1]: *** [Makefile:815: reals/fast/CRpi_fast.vo] Error 1
make[1]: *** [reals/fast/CRpi_fast.vo] Deleting file 'reals/fast/CRpi_fast.glob'
make: *** [Makefile:411: all] Error 2
+ code=2
+ printf '\n%s exit code: %s\n' corn 2
+ '[' corn '!=' stdlib_test ']'
+ echo 'Aggregating timing log...'
Aggregating timing log...
+ echo

+ tools/make-one-time-file.py --real _build_ci/corn.log
    Time |   Peak Mem | File Name              
-----------------------------------------------
0m03.65s | 1732324 ko | Total Time / Peak Mem  
-----------------------------------------------
0m03.28s | 1732324 ko | reals/fast/CRpi_fast.vo
0m00.37s |   22688 ko | .Makefile.d            
+ '[' '' ']'
+ exit 2
/github/workspace/builds/coq /github/workspace
::endgroup::
📜 🔎 Minimization Log (truncated to last 8.0KiB; full 3.5MiB file on GitHub Actions Artifacts under bug.log)
 characters 0-43:
Warning:
New coercion path [Pos.to_nat; Z.of_nat] : positive >-> Z is ambiguous with existing 
[Zpos] : positive >-> Z. [ambiguous-paths,coercions,default]
File "/tmp/tmpc9bqbmve/Top/bug_01.v", line 709, characters 0-8:
Warning: Use of "Notation" keyword for abbreviations is deprecated, use
"Abbreviation" instead.
[notation-for-abbreviation,deprecated-since-9.2,deprecated,default]
Error: The section Pi needs to be closed.


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Admitting lemmas unsuccessful.
No successful changes.

I will now attempt to admit definitions with Admitted with Proof using

Non-fatal error: Failed to admit definitions and preserve the error.  
The new error was:
Deprecated environment variable COQCORELIB, use ROCQRUNTIMELIB instead.
Warning: Deprecated environment variable COQCORELIB,
use ROCQRUNTIMELIB instead.
[deprecated-coq-env-var,deprecated-since-9.0,deprecated,default]
File "/tmp/tmpvwqznon7/Top/bug_01.v", line 223, characters 0-34:
Warning: Library File Stdlib.ZArith.ZArith_base is deprecated
since Stdlib 9.0. use ZArith instead
[deprecated-library-file-since-Stdlib-9.0,deprecated-since-Stdlib-9.0,deprecated-library-file,deprecated,default]
File "/tmp/tmpvwqznon7/Top/bug_01.v", line 295, characters 7-20:
Warning: Coq.Init.Ltac has been replaced by Corelib.Init.Ltac.
[deprecated-dirpath-Coq,deprecated-since-9.0,deprecated,default]
File "/tmp/tmpvwqznon7/Top/bug_01.v", line 302, characters 0-31:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "/tmp/tmpvwqznon7/Top/bug_01.v", line 440, characters 0-63:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "/tmp/tmpvwqznon7/Top/bug_01.v", line 448, characters 0-40:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "/tmp/tmpvwqznon7/Top/bug_01.v", line 553, characters 0-8:
Warning: Use of "Notation" keyword for abbreviations is deprecated, use
"Abbreviation" instead.
[notation-for-abbreviation,deprecated-since-9.2,deprecated,default]
File "/tmp/tmpvwqznon7/Top/bug_01.v", line 591, characters 0-43:
Warning:
New coercion path [Pos.to_nat; Z.of_nat] : positive >-> Z is ambiguous with existing 
[Zpos] : positive >-> Z. [ambiguous-paths,coercions,default]
File "/tmp/tmpvwqznon7/Top/bug_01.v", line 704, characters 0-8:
Warning: Use of "Notation" keyword for abbreviations is deprecated, use
"Abbreviation" instead.
[notation-for-abbreviation,deprecated-since-9.2,deprecated,default]
File "/tmp/tmpvwqznon7/Top/bug_01.v", line 825, characters 51-52:
Error:
The term "I" has type "True" while it is expected to have type
 "realline [0]".


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Admitting definitions unsuccessful.
No successful changes.

I will now attempt to admit lemmas with admit. Defined with Proof using

Non-fatal error: Failed to admit lemmas and preserve the error.  
The new error was:
Deprecated environment variable COQCORELIB, use ROCQRUNTIMELIB instead.
Warning: Deprecated environment variable COQCORELIB,
use ROCQRUNTIMELIB instead.
[deprecated-coq-env-var,deprecated-since-9.0,deprecated,default]
File "/tmp/tmpjc5dd3s0/Top/bug_01.v", line 223, characters 0-34:
Warning: Library File Stdlib.ZArith.ZArith_base is deprecated
since Stdlib 9.0. use ZArith instead
[deprecated-library-file-since-Stdlib-9.0,deprecated-since-Stdlib-9.0,deprecated-library-file,deprecated,default]
File "/tmp/tmpjc5dd3s0/Top/bug_01.v", line 295, characters 7-20:
Warning: Coq.Init.Ltac has been replaced by Corelib.Init.Ltac.
[deprecated-dirpath-Coq,deprecated-since-9.0,deprecated,default]
File "/tmp/tmpjc5dd3s0/Top/bug_01.v", line 302, characters 0-31:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "/tmp/tmpjc5dd3s0/Top/bug_01.v", line 440, characters 0-63:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "/tmp/tmpjc5dd3s0/Top/bug_01.v", line 448, characters 0-40:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "/tmp/tmpjc5dd3s0/Top/bug_01.v", line 553, characters 0-8:
Warning: Use of "Notation" keyword for abbreviations is deprecated, use
"Abbreviation" instead.
[notation-for-abbreviation,deprecated-since-9.2,deprecated,default]
File "/tmp/tmpjc5dd3s0/Top/bug_01.v", line 591, characters 0-43:
Warning:
New coercion path [Pos.to_nat; Z.of_nat] : positive >-> Z is ambiguous with existing 
[Zpos] : positive >-> Z. [ambiguous-paths,coercions,default]
File "/tmp/tmpjc5dd3s0/Top/bug_01.v", line 709, characters 0-8:
Warning: Use of "Notation" keyword for abbreviations is deprecated, use
"Abbreviation" instead.
[notation-for-abbreviation,deprecated-since-9.2,deprecated,default]
Error: The section Pi needs to be closed.


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Admitting lemmas unsuccessful.
No successful changes.

I will now attempt to admit definitions with admit. Defined with Proof using

Non-fatal error: Failed to admit definitions and preserve the error.  
The new error was:
Deprecated environment variable COQCORELIB, use ROCQRUNTIMELIB instead.
Warning: Deprecated environment variable COQCORELIB,
use ROCQRUNTIMELIB instead.
[deprecated-coq-env-var,deprecated-since-9.0,deprecated,default]
File "/tmp/tmpq1doju7n/Top/bug_01.v", line 223, characters 0-34:
Warning: Library File Stdlib.ZArith.ZArith_base is deprecated
since Stdlib 9.0. use ZArith instead
[deprecated-library-file-since-Stdlib-9.0,deprecated-since-Stdlib-9.0,deprecated-library-file,deprecated,default]
File "/tmp/tmpq1doju7n/Top/bug_01.v", line 295, characters 7-20:
Warning: Coq.Init.Ltac has been replaced by Corelib.Init.Ltac.
[deprecated-dirpath-Coq,deprecated-since-9.0,deprecated,default]
File "/tmp/tmpq1doju7n/Top/bug_01.v", line 302, characters 0-31:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "/tmp/tmpq1doju7n/Top/bug_01.v", line 440, characters 0-63:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "/tmp/tmpq1doju7n/Top/bug_01.v", line 448, characters 0-40:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "/tmp/tmpq1doju7n/Top/bug_01.v", line 553, characters 0-8:
Warning: Use of "Notation" keyword for abbreviations is deprecated, use
"Abbreviation" instead.
[notation-for-abbreviation,deprecated-since-9.2,deprecated,default]
File "/tmp/tmpq1doju7n/Top/bug_01.v", line 591, characters 0-43:
Warning:
New coercion path [Pos.to_nat; Z.of_nat] : positive >-> Z is ambiguous with existing 
[Zpos] : positive >-> Z. [ambiguous-paths,coercions,default]
File "/tmp/tmpq1doju7n/Top/bug_01.v", line 705, characters 0-8:
Warning: Use of "Notation" keyword for abbreviations is deprecated, use
"Abbreviation" instead.
[notation-for-abbreviation,deprecated-since-9.2,deprecated,default]
File "/tmp/tmpq1doju7n/Top/bug_01.v", line 814, characters 0-22:
Error: Extra arguments: I, F.


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Admitting definitions unsuccessful.
No successful changes.

I will now attempt to add Proof using lines
�[92m
Adding Proof using lines successful.�[0m
Failed to do everything at once; trying one at a time.
Adding Proof using lines unsuccessful.
No successful changes.

I will now attempt to export modules
Module exportation successful

I will now attempt to split imports and exports
Import/Export splitting unsuccessful.

I will now attempt to split := definitions
One-line definition splitting successful

I will now attempt to lift Requires to the top of the file while inserting option settings

I will now attempt to lift Requires to the top of the file while inserting option settings

I will now attempt to remove all lines, one at a time

If you have any comments on your experience of the minimizer, please share them in a reply (possibly tagging @JasonGross).
If you believe there's a bug in the bug minimizer, please report it on the bug minimizer issue tracker.

@coqbot-app
Copy link
Contributor

coqbot-app bot commented Feb 28, 2026

Minimization interrupted by timeout, being automatically continued. Partially Minimized File /home/runner/work/run-coq-bug-minimizer/run-coq-bug-minimizer/builds/coq/coq-failing/_build_ci/corn/reals/fast/CRpi_fast.v in 5h 15m 7s (from ci-corn) (interrupted by timeout, being automatically continued) (full log on GitHub Actions - verbose log)
⭐ ⏱️ Partially Minimized Coq File (timeout) (truncated to first and last 32KiB; full 73KiB file on GitHub Actions Artifacts under bug.v)
(* -*- mode: coq; coq-prog-args: ("-emacs" "-q" "-w" "-deprecated-native-compiler-option" "-native-compiler" "no" "-coqlib" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq//" "-R" "/github/workspace/builds/coq/coq-failing/_build_ci/corn" "CoRN" "-Q" "/github/workspace/cwd" "Top" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq///user-contrib/Bignums" "Bignums" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq///user-contrib/HB" "HB" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq///user-contrib/Ltac2" "Ltac2" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq///user-contrib/MathClasses" "MathClasses" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq///user-contrib/Stdlib" "Stdlib" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq///user-contrib/elpi" "elpi" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq///user-contrib/elpi_elpi" "elpi_elpi" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq///user-contrib/elpi_examples" "elpi_examples" "-top" "Top.bug_01") -*- *)
(* File reduced by coq-bug-minimizer from original input, then from 362 lines to 68 lines, then from 80 lines to 1074 lines, then from 1081 lines to 78 lines, then from 89 lines to 1725 lines, then from 1732 lines to 96 lines, then from 108 lines to 1195 lines, then from 1202 lines to 99 lines, then from 110 lines to 1587 lines, then from 1594 lines to 117 lines, then from 129 lines to 896 lines, then from 903 lines to 120 lines, then from 131 lines to 1147 lines, then from 1154 lines to 132 lines, then from 143 lines to 1154 lines, then from 1161 lines to 144 lines, then from 155 lines to 1086 lines, then from 1093 lines to 156 lines, then from 167 lines to 1191 lines, then from 1198 lines to 214 lines, then from 225 lines to 1320 lines, then from 1327 lines to 357 lines, then from 362 lines to 135 lines, then from 147 lines to 1975 lines, then from 1982 lines to 145 lines, then from 156 lines to 1770 lines, then from 1777 lines to 210 lines, then from 221 lines to 2049 lines, then from 2056 lines to 242 lines, then from 253 lines to 1745 lines, then from 1752 lines to 244 lines, then from 255 lines to 1816 lines, then from 1823 lines to 259 lines, then from 271 lines to 1478 lines, then from 1485 lines to 296 lines, then from 307 lines to 1721 lines, then from 1728 lines to 315 lines, then from 327 lines to 1175 lines, then from 1182 lines to 317 lines, then from 329 lines to 1252 lines, then from 1258 lines to 346 lines, then from 357 lines to 1685 lines, then from 1692 lines to 555 lines, then from 563 lines to 210 lines, then from 222 lines to 972 lines, then from 978 lines to 220 lines, then from 231 lines to 1055 lines, then from 1062 lines to 248 lines, then from 259 lines to 2033 lines, then from 2038 lines to 311 lines, then from 322 lines to 1621 lines, then from 1627 lines to 331 lines, then from 342 lines to 1683 lines, then from 1690 lines to 368 lines, then from 379 lines to 730 lines, then from 737 lines to 384 lines, then from 395 lines to 750 lines, then from 757 lines to 410 lines, then from 421 lines to 763 lines, then from 770 lines to 418 lines, then from 429 lines to 840 lines, then from 847 lines to 426 lines, then from 437 lines to 767 lines, then from 774 lines to 447 lines, then from 458 lines to 780 lines, then from 787 lines to 455 lines, then from 466 lines to 812 lines, then from 819 lines to 469 lines, then from 480 lines to 1590 lines, then from 1596 lines to 594 lines, then from 604 lines to 310 lines, then from 322 lines to 646 lines, then from 653 lines to 333 lines, then from 344 lines to 1365 lines, then from 1372 lines to 357 lines, then from 368 lines to 680 lines, then from 687 lines to 375 lines, then from 386 lines to 1323 lines, then from 1327 lines to 1009 lines, then from 1020 lines to 2472 lines, then from 2478 lines to 1095 lines, then from 1106 lines to 3016 lines, then from 3017 lines to 2780 lines, then from 2791 lines to 3122 lines, then from 3129 lines to 2998 lines *)
(* coqc version 9.3+alpha compiled with OCaml 4.14.2
   coqtop version 9.3+alpha
   Expected coqc runtime on this file: 3.924 sec
   Expected coqc peak memory usage on this file: 2243060.0 kb *)









Require CoRN.tactics.Step.
Require Corelib.Classes.Morphisms_Prop.
Require Corelib.Lists.ListDef.
Require Corelib.Relations.Relation_Definitions.
Require Corelib.Classes.Equivalence.
Require Corelib.BinNums.PosDef.
Require Corelib.Classes.RelationClasses.
Require Corelib.Numbers.BinNums.
Require Corelib.BinNums.NatDef.
Require Corelib.Program.Basics.
Require Corelib.Init.Ltac.
Require Corelib.Classes.SetoidTactics.
Require Corelib.BinNums.IntDef.
Require Corelib.Classes.Morphisms.
Require Corelib.Program.Utils.
Require Corelib.Init.Wf.
Require Corelib.Program.Tactics.
Require Corelib.Init.Sumbool.
Require Corelib.Setoids.Setoid.
Require Corelib.Program.Wf.
Require MathClasses.theory.CoqStreams.
Require Stdlib.Logic.Decidable.
Require Stdlib.Logic.EqdepFacts.
Require Stdlib.Logic.FunctionalExtensionality.
Require Stdlib.Logic.HLevelsBase.
Require Stdlib.Program.Syntax.
Require Stdlib.Unicode.Utf8_core.
Require Stdlib.micromega.ZifyClasses.
Require Stdlib.setoid_ring.Algebra_syntax.
Require Stdlib.BinNums.IntDef.
Require Stdlib.BinNums.PosDef.
Require Stdlib.BinNums.NatDef.
Require Stdlib.Classes.Morphisms_Prop.
Require Stdlib.Classes.Morphisms.
Require Stdlib.Classes.DecidableClass.
Require Stdlib.Classes.RelationClasses.
Require Stdlib.Classes.SetoidTactics.
Require Stdlib.Classes.Equivalence.
Require Stdlib.Init.Wf.
Require Stdlib.Init.Sumbool.
Require Stdlib.Lists.ListDef.
Require Stdlib.Logic.Eqdep.
Require Stdlib.Logic.Eqdep_dec.
Require Stdlib.Logic.ProofIrrelevanceFacts.
Require Stdlib.Numbers.BinNums.
Require Stdlib.Program.Basics.
Require Stdlib.Program.Tactics.
Require Stdlib.Program.Utils.
Require Stdlib.Program.Wf.
Require Stdlib.Relations.Relation_Definitions.
Require Stdlib.Setoids.Setoid.
Require Stdlib.Unicode.Utf8.
Require CoRN.tactics.CornTac.
Require Stdlib.Bool.Bool.
Require Stdlib.Logic.JMeq.
Require Stdlib.Logic.ProofIrrelevance.
Require Stdlib.Relations.Relation_Operators.
Require Stdlib.Program.Combinators.
Require Stdlib.Relations.Operators_Properties.
Require Stdlib.PArith.BinPosDef.
Require Stdlib.Relations.Relations.
Require Stdlib.Program.Equality.
Require Stdlib.Numbers.NumPrelude.
Require Stdlib.Program.WfExtensionality.
Require MathClasses.misc.stdlib_hints.
Require Stdlib.Structures.Equalities.
Require Stdlib.Program.Subset.
Require Stdlib.Structures.Orders.
Require Stdlib.Structures.OrdersTac.
Require Stdlib.Structures.OrdersFacts.
Require Stdlib.Structures.GenericMinMax.
Require Stdlib.Program.Program.
Require Stdlib.Numbers.NatInt.NZAxioms.
Require Stdlib.Numbers.NatInt.NZBase.
Require Stdlib.Numbers.NatInt.NZAdd.
Require Stdlib.Numbers.NatInt.NZMul.
Require Stdlib.Numbers.NatInt.NZOrder.
Require Stdlib.Numbers.NatInt.NZAddOrder.
Require Stdlib.Numbers.NatInt.NZMulOrder.
Require MathClasses.interfaces.canonical_names.
Require Stdlib.Numbers.NatInt.NZDiv.
Require Stdlib.Numbers.NatInt.NZGcd.
Require Stdlib.Numbers.NatInt.NZParity.
Require Stdlib.Numbers.NatInt.NZPow.
Require Stdlib.Numbers.NatInt.NZSqrt.
Require MathClasses.misc.propholds.
Require MathClasses.misc.setoid_tactics.
Require MathClasses.misc.util.
Require Stdlib.Numbers.NatInt.NZLog.
Require MathClasses.misc.workarounds.
Require Stdlib.Numbers.NatInt.NZBits.
Require MathClasses.misc.decision.
Require Stdlib.Numbers.Integer.Abstract.ZAxioms.
Require Stdlib.Numbers.Natural.Abstract.NAxioms.
Require Stdlib.Numbers.Integer.Abstract.ZBase.
Require Stdlib.Numbers.Natural.Abstract.NBase.
Require Stdlib.Numbers.Integer.Abstract.ZAdd.
Require Stdlib.Numbers.Natural.Abstract.NAdd.
Require Stdlib.Numbers.Integer.Abstract.ZMul.
Require Stdlib.Numbers.Natural.Abstract.NOrder.
Require MathClasses.interfaces.abstract_algebra.
Require Stdlib.Numbers.Integer.Abstract.ZLt.
Require Stdlib.Numbers.Natural.Abstract.NAddOrder.
Require MathClasses.interfaces.orders.
Require Stdlib.Numbers.Integer.Abstract.ZAddOrder.
Require Stdlib.Numbers.Natural.Abstract.NMulOrder.
Require CoRN.algebra.RSetoid.
Require Stdlib.Numbers.Integer.Abstract.ZMulOrder.
Require Stdlib.Numbers.Natural.Abstract.NSub.
Require CoRN.order.PartialOrder.
Require Stdlib.Numbers.Integer.Abstract.ZMaxMin.
Require Stdlib.Numbers.Integer.Abstract.ZParity.
Require Stdlib.Numbers.Integer.Abstract.ZSgnAbs.
Require Stdlib.Numbers.Natural.Abstract.NDiv.
Require Stdlib.Numbers.Natural.Abstract.NGcd.
Require Stdlib.Numbers.Natural.Abstract.NMaxMin.
Require Stdlib.Numbers.Natural.Abstract.NParity.
Require Stdlib.Numbers.Natural.Abstract.NSqrt.
Require CoRN.order.SemiLattice.
Require Stdlib.Numbers.Integer.Abstract.ZDivFloor.
Require Stdlib.Numbers.Integer.Abstract.ZDivTrunc.
Require Stdlib.Numbers.Integer.Abstract.ZGcd.
Require Stdlib.Numbers.Natural.Abstract.NDiv0.
Require Stdlib.Numbers.Natural.Abstract.NPow.
Require CoRN.order.Lattice.
Require Stdlib.Numbers.Integer.Abstract.ZPow.
Require Stdlib.Numbers.Natural.Abstract.NLcm.
Require Stdlib.Numbers.Natural.Abstract.NLog.
Require CoRN.order.TotalOrder.
Require Stdlib.Numbers.Integer.Abstract.ZBits.
Require Stdlib.Numbers.Integer.Abstract.ZLcm.
Require Stdlib.Numbers.Natural.Abstract.NBits.
Require Stdlib.Numbers.Natural.Abstract.NLcm0.
Require Stdlib.Numbers.Integer.Abstract.ZProperties.
Require Stdlib.Numbers.Natural.Abstract.NProperties.
Require Stdlib.Arith.PeanoNat.
Require Stdlib.Arith.Between.
Require Stdlib.Arith.Compare_dec.
Require Stdlib.Arith.EqNat.
Require Stdlib.Arith.Factorial.
Require Stdlib.Arith.Wf_nat.
Require Stdlib.Arith.Euclid.
Require Stdlib.Arith.Peano_dec.
Require Stdlib.Lists.List.
Require Stdlib.Lists.ListDec.
Require Stdlib.micromega.Refl.
Require Stdlib.Lists.Finite.
Require Stdlib.micromega.Tauto.
Require CoRN.stdlib_omissions.Pair.
Require Stdlib.Lists.ListTactics.
Require Stdlib.Sorting.Permutation.
Require Stdlib.PArith.BinPos.
Require Stdlib.Arith.Arith_base.
Require Stdlib.PArith.POrderedType.
Require Stdlib.PArith.Pnat.
Require Stdlib.NArith.BinNatDef.
Require Stdlib.PArith.PArith.
Require Stdlib.NArith.BinNat.
Require Stdlib.setoid_ring.BinList.
Require Stdlib.NArith.Ndiv_def.
Require Stdlib.NArith.Ngcd_def.
Require Stdlib.NArith.Nsqrt_def.
Require Stdlib.setoid_ring.Ring_theory.
Require Stdlib.NArith.Nnat.
Require Stdlib.ZArith.BinIntDef.
Require Stdlib.NArith.NArith_base.
Require Stdlib.ZArith.BinInt.
Require Stdlib.ZArith.Zcompare.
Require Stdlib.ZArith.Zeven.
Require Stdlib.ZArith.auxiliary.
Require Stdlib.ZArith.Zpow_def.
Require Stdlib.setoid_ring.Ncring.
Require Stdlib.micromega.Env.
Require Stdlib.micromega.VarMap.
Require Stdlib.micromega.EnvRing.
Require Stdlib.setoid_ring.Ring_polynom.
Require Stdlib.setoid_ring.InitialRing.
Require Stdlib.ZArith.Znat.
Require Stdlib.ZArith.Zorder.
Require Stdlib.setoid_ring.Ncring_polynom.
Require Stdlib.setoid_ring.Ring_tac.
Require CoRN.model.totalorder.QMinMax.
Require CoRN.tactics.FieldReflection.
Require CoRN.model.setoids.Qsetoid.
Axiom proof_admitted : False.
Tactic Notation "admit" := abstract case proof_admitted.

Export CoRN.tactics.FieldReflection.

Inductive AlgebraName : Type :=
|cfield : CField -> AlgebraName
|cring : CRing -> AlgebraName.

Ltac GetStructureName t :=
match t with
| (csg_crr (cm_crr (cg_crr (cag_crr (cr_crr ?r))))) =>
  match r with
  | (cf_crr ?q) => constr:(cfield q)
  | _ => constr:(cring r)
 end
end.



Ltac rational :=
match goal with
[|-@cs_eq (cs_crr ?T) ?x ?y] =>
 match GetStructureName T with
 |(cfield ?F) => rationalF F x y
 |(cring ?R) => (repeat (try apply csf_fun_wd);simpl;ring)

 end
end.

Tactic Notation "rstepl" constr(c) :=  stepl c;[idtac|rational].
Tactic Notation "rstepr" constr(c) :=  stepr c;[idtac|rational].
Module Export CoRN_DOT_algebra_DOT_COrdFields_WRAPPED.
Module Export COrdFields.
Export CoRN.algebra.CSetoids.
Import Stdlib.micromega.Lia.

Record strictorder (A : Type)(R : A -> A -> CProp) : CProp :=
 {so_trans : Ctransitive R;
  so_asym  : antisymmetric R}.

Arguments strictorder [A].
Arguments Build_strictorder [A R].

Record is_COrdField (F : CField)
  (less : CCSetoid_relation F) (leEq : Relation F)
  (greater : CCSetoid_relation F) (grEq : Relation F) : CProp :=
  {ax_less_strorder  : strictorder less;
   ax_plus_resp_less : forall x y, less x y -> forall z, less (x[+]z) (y[+]z);
   ax_mult_resp_pos  : forall x y, less [0] x -> less [0] y -> less [0] (x[*]y);
   ax_less_conf_ap   : forall x y, Iff (x [#] y) (less x y or less y x);
   def_leEq : forall x y, (leEq x y) <-> (Not (less y x));
   def_greater : forall x y, Iff (greater x y) (less y x);
   def_grEq : forall x y, (grEq x y) <-> (leEq y x)}.

Record COrdField : Type :=
  {cof_crr   :> CField;
   cof_less  :  CCSetoid_relation cof_crr;
   cof_leEq :  cof_crr -> cof_crr -> Prop;
   cof_greater :  CCSetoid_relation cof_crr;
   cof_grEq : cof_crr -> cof_crr -> Prop;
   cof_proof :  is_COrdField cof_crr cof_less cof_leEq cof_greater cof_grEq}.

Arguments cof_less {c}.
Infix "[<]" := cof_less (at level 70, no associativity).

Arguments cof_greater {c}.
Infix "[>]" := cof_greater (at level 70, no associativity).

Arguments cof_leEq {c}.
Infix "[<=]" := cof_leEq (at level 70, no associativity).

Arguments cof_grEq {c}.
Infix "[>=]" := cof_grEq (at level 70, no associativity).

Definition default_greater (X:CField) (lt:CCSetoid_relation X) : CCSetoid_relation X.
Proof.
 intros.
 exists (fun x y => lt y x).
 destruct lt.
 unfold Crel_strext in *.
 simpl.
 intros.
 pose (Ccsr_strext _ y2 _ x2 X0).
 tauto.
Defined.
Definition default_grEq (X:CField) (le:Relation X) : Relation X.
exact ((fun x y => (le y x))).
Defined.

Section COrdField_axioms.

Variable F : COrdField.

Lemma COrdField_is_COrdField : is_COrdField F cof_less (@cof_leEq F) cof_greater (@cof_grEq F).
Admitted.

Lemma less_transitive_unfolded : forall x y z : F, x [<] y -> y [<] z -> x [<] z.
Admitted.

Lemma less_antisymmetric_unfolded : forall x y : F, x [<] y -> Not (y [<] x).
Admitted.

Lemma less_irreflexive : irreflexive (cof_less (c:=F)).
Admitted.

Lemma less_irreflexive_unfolded : forall x : F, Not (x [<] x).
Proof less_irreflexive.

Lemma plus_resp_less_rht : forall x y z : F, x [<] y -> x[+]z [<] y[+]z.
Proof.
 elim COrdField_is_COrdField; auto.
Qed.

Lemma mult_resp_pos : forall x y : F, [0] [<] x -> [0] [<] y -> [0] [<] x[*]y.
Proof.
 elim COrdField_is_COrdField; auto.
Qed.

Lemma less_conf_ap : forall x y : F, Iff (x [#] y) (x [<] y or y [<] x).
Proof.
 elim COrdField_is_COrdField; auto.
Qed.

Lemma leEq_def : forall x y : F, (x [<=] y) <-> (Not (y [<] x)).
Proof.
 elim COrdField_is_COrdField; auto.
Qed.

Lemma greater_def : forall x y : F, Iff (x [>] y) (y [<] x).
Proof.
 elim COrdField_is_COrdField; auto.
Qed.

Lemma grEq_def : forall x y : F, (x [>=] y) <-> (y [<=] x).
Proof.
 elim COrdField_is_COrdField; auto.
Qed.

Lemma less_wdr : forall x y z : F, x [<] y -> y [=] z -> x [<] z.
Proof Ccsr_wdr F cof_less.

Lemma less_wdl : forall x y z : F, x [<] y -> x [=] z -> z [<] y.
Proof Ccsr_wdl F cof_less.

End COrdField_axioms.

Declare Left Step less_wdl.
Declare Right Step less_wdr.

Section OrdField_basics.

Variable R : COrdField.

Lemma less_imp_ap : forall x y : R, x [<] y -> x [#] y.
Proof.
 intros x y H.
 elim (less_conf_ap _ x y); intros.
 apply b.
left.
auto.
Qed.

Lemma Greater_imp_ap : forall x y : R, y [<] x -> x [#] y.
Proof.
 intros x y H.
 elim (less_conf_ap _ x y); intros.
 apply b.
right.
auto.
Qed.

Lemma ap_imp_less : forall x y : R, x [#] y -> x [<] y or y [<] x.
Proof.
 intros x y.
 elim (less_conf_ap _ x y); auto.
Qed.

Lemma less_cotransitive : cotransitive (cof_less (c:=R)).
Proof.
 red in |- *.
 intros x y H z.
 generalize (less_imp_ap _ _ H); intro H0.
 elim (ap_cotransitive_unfolded _ _ _ H0 z); intro H1.
  elim (ap_imp_less _ _ H1).
   auto.
  intro H2.
  right.
  apply (less_transitive_unfolded _ _ _ _ H2 H).
 elim (ap_imp_less _ _ H1).
  auto.
 intro H2.
 left.
 apply (less_transitive_unfolded _ _ _ _ H H2).
Qed.

Lemma less_cotransitive_unfolded : forall x y : R, x [<] y -> forall z, x [<] z or z [<] y.
Proof less_cotransitive.

Lemma pos_ap_zero : forall x : R, [0] [<] x -> x [#] [0].
Proof.
 intros x H.
 apply Greater_imp_ap.
 assumption.
Defined.

Lemma leEq_not_eq : forall x y : R, x [<=] y -> x [#] y -> x [<] y.
Proof.
 intros x y H H0.
 elim (ap_imp_less _ _ H0); intro H1; auto.
 rewrite -> leEq_def in H.
 elim (H H1).
Qed.

End OrdField_basics.

Section Basic_Properties_of_leEq.

Variable R : COrdField.

Lemma leEq_wdr : forall x y z : R, x [<=] y -> y [=] z -> x [<=] z.
Proof.
 intros x y z H H0.
 rewrite -> leEq_def in *.
 intro H1.
 apply H.
 astepl z; assumption.
Qed.

Lemma leEq_wdl : forall x y z : R, x [<=] y -> x [=] z -> z [<=] y.
Proof.
 intros x y z H H0.
 rewrite -> leEq_def in *.
 intro H1.
 apply H.
 astepr z;auto.
Qed.

Lemma leEq_reflexive : forall x : R, x [<=] x.
Proof.
 intro x.
 rewrite -> leEq_def.
 apply less_irreflexive_unfolded.
Qed.

Declare Left Step leEq_wdl.
Declare Right Step leEq_wdr.

Lemma eq_imp_leEq : forall x y : R, x [=] y -> x [<=] y.
Proof.
 intros x y H.
 astepr x.
 exact (leEq_reflexive _).
Qed.

Lemma leEq_imp_eq : forall x y : R, x [<=] y -> y [<=] x -> x [=] y.
Proof.
 intros x y H H0.
rewrite -> leEq_def in *|-.
 apply not_ap_imp_eq.
intro H1.
apply H0.
 elim (ap_imp_less _ _ _ H1); intro H2.
auto.
  elim (H H2).
Qed.

Lemma lt_equiv_imp_eq : forall x x' : R,
 (forall y, x [<] y -> x' [<] y) -> (forall y, x' [<] y -> x [<] y) -> x [=] x'.
Proof.
 intros x x' H H0.
 apply leEq_imp_eq; rewrite -> leEq_def in |- *; intro H1.
  apply (less_irreflexive_unfolded _ x); auto.
 apply (less_irreflexive_unfolded _ x'); auto.
Qed.

Lemma less_leEq_trans : forall x y z : R, x [<] y -> y [<=] z -> x [<] z.
Proof.
 intros x y z.
 intros H H0.
 elim (less_cotransitive_unfolded _ _ _ H z); intro H1.
  assumption.
 destruct (leEq_def _ y z).
 elim ((H2 H0) H1).
Qed.

Lemma leEq_less_trans : forall x y z : R, x [<=] y -> y [<] z -> x [<] z.
Proof.
 intros x y z.
 intros H H0.
 elim (less_cotransitive_unfolded _ _ _ H0 x); intro H1; try assumption.
 destruct (leEq_def _ x y) as [H2 H3].
 elim ((H2 H) H1).
Qed.

Lemma leEq_transitive : forall x y z : R, x [<=] y -> y [<=] z -> x [<=] z.
Proof.
 intros x y z.
 repeat rewrite -> leEq_def.
 intros H H0 H1.
 apply H.
 apply leEq_less_trans with (y := z); firstorder using leEq_def.
Qed.

Lemma less_leEq : forall x y : R, x [<] y -> x [<=] y.
Proof.
 intros.
 rewrite -> leEq_def.
 apply less_antisymmetric_unfolded.
 assumption.
Qed.

Lemma leEq_or_leEq : forall x y:R, Not (Not (x[<=]y or y[<=]x)).
Proof.
 intros x y H.
 apply H.
 right.
 rewrite -> leEq_def.
 intros H0.
 apply H.
 left.
 apply less_leEq.
 assumption.
Qed.

Lemma leEq_less_or_equal : forall x y:R, x[<=]y -> Not (Not (x[<]y or x[=]y)).
Proof.
 intros x y Hxy H.
revert Hxy.
 rewrite -> leEq_def.
intro Hxy.
apply H.
 right.
 apply (not_ap_imp_eq).
 intros H0.
 destruct (ap_imp_less _ _ _ H0).
  apply H.
  left.
  assumption.
 apply Hxy.
 assumption.
Qed.

End Basic_Properties_of_leEq.

#[global]
Hint Resolve less_leEq : algebra.

Declare Left Step leEq_wdl.
Declare Right Step leEq_wdr.

Section infinity_of_cordfields.

Variable R : COrdField.

Lemma pos_one : ([0]:R) [<] [1].
Proof.

 elim (ap_imp_less _ _ _ (ring_non_triv R)).
  2: auto.
 intro H.
 exfalso.
 apply (less_irreflexive_unfolded R [1]).
 apply less_transitive_unfolded with ([0]:R).
  auto.

 cut (([0]:R) [<] [--][1]).
  2: astepl (([1]:R)[+][--][1]).
  2: astepr (([0]:R)[+][--][1]).
  2: apply plus_resp_less_rht; auto.
 intro H0.

 rstepr ([--]([1]:R)[*][--][1]).
 apply (mult_resp_pos _ _ _ H0 H0).
Qed.

Lemma nring_less_succ : forall m : nat, (nring m:R) [<] nring (S m).
Proof.
 intro m.
 simpl in |- *.
 astepr ([1][+]nring (R:=R) m).
 astepl ([0][+]nring (R:=R) m).
 apply plus_resp_less_rht.
 apply pos_one.
Qed.

Lemma nring_less : forall m n : nat, m < n -> (nring m:R) [<] nring n.
Proof.
 intros m n H.
 generalize (toCProp_lt _ _ H); intro H0.
 elim H0.
  apply nring_less_succ.
 clear H0 H n; intros n H H0.
 apply less_transitive_unfolded with (nring (R:=R) n).
  assumption.
 apply nring_less_succ.
Qed.

Lemma nring_leEq : forall m n : nat, m <= n -> (nring m:R) [<=] nring n.
Proof.
 intros m n H.
 elim (le_lt_eq_dec _ _ H); intro H1.
  rewrite -> leEq_def in |- *.
apply less_antisymmetric_unfolded.
  apply nring_less.
auto.
  rewrite H1.
 rewrite -> leEq_def in |- *.
apply less_irreflexive_unfolded.
Qed.

Lemma nring_apart : forall m n : nat, m <> n -> (nring m:R) [#] nring n.
Proof.
 intros m n H.
 elim (lt_eq_lt_dec m n); intro H0.
  elim H0; intro H1.
   apply less_imp_ap.
   apply nring_less.
   assumption.
  elim (H H1).
 apply Greater_imp_ap.
 apply nring_less.
 assumption.
Qed.

Lemma nring_ap_zero : forall n : nat, n <> 0 -> nring (R:=R) n [#] [0].
Proof.
 intros n H.
 exact (nring_apart _ _ H).
Qed.

Lemma nring_ap_zero' : forall n : nat, 0 <> n -> nring (R:=R) n [#] [0].
Proof.
 intros.
 apply nring_ap_zero; auto.
Qed.

Lemma nring_ap_zero_imp : forall n : nat, nring (R:=R) n [#] [0] -> 0 <> n.
Proof.
 intros n H.
 induction  n as [| n Hrecn].
  simpl in H.
  elim (ap_irreflexive_unfolded _ _ H).
 apply O_S.
Qed.

Definition Snring (n : nat) := nring (R:=R) (S n).

Load "Transparent_algebra".

Lemma pos_Snring : forall n : nat, ([0]:R) [<] Snring n.
Proof.
 intro n.
 apply less_leEq_trans with ([1]:R).
  apply pos_one.
 stepl (nring (R:=R) 1).
2: simpl in |- *; algebra.
  unfold Snring in |- *.
 apply nring_leEq.
 auto with arith.
Qed.

Lemma nringS_ap_zero : forall m : nat, nring (R:=R) (S m) [#] [0].
Proof.
 intros.
 apply pos_ap_zero.
 exact (pos_Snring m).
Qed.

Lemma nring_fac_ap_zero : forall n : nat, nring (R:=R) (fact n) [#] [0].
Proof.
 intro n; apply nring_ap_zero.
cut (0 < fact n).
 lia.
 apply lt_O_fact.
Qed.

Load "Opaque_algebra".

Section up_to_four.

Lemma less_plusOne : forall x : R, x [<] x[+][1].
Proof.

 intros x.
 astepl ([0][+]x); astepr ([1][+]x).
 apply plus_resp_less_rht.
 exact pos_one.
Qed.

Lemma zero_lt_posplus1 : forall x : R, [0] [<=] x -> [0] [<] x[+][1].
Proof.
 intros x zltx.
 apply leEq_less_trans with x.
  assumption.
 exact (less_plusOne x).
Qed.

Lemma plus_one_ext_less : forall x y : R, x [<] y -> x [<] y[+][1].
Proof.

 intros x y H.
 apply less_leEq_trans with y.
  assumption.
 apply less_leEq; apply less_plusOne.
Qed.

Lemma one_less_two : ([1]:R) [<] Two.
Proof.
 simpl in |- *.
 astepr (([1]:R)[+][1]).
 apply less_plusOne.
Qed.

Lemma two_less_three : (Two:R) [<] Three.
Proof.
 simpl in |- *.
 apply less_plusOne.
Qed.

Lemma three_less_four : (Three:R) [<] Four.
Proof.
 simpl in |- *.
 apply less_plusOne.
Qed.

Lemma pos_two : ([0]:R) [<] Two.
Proof.
 apply less_leEq_trans with ([1]:R).
  exact pos_one.
 apply less_leEq; exact one_less_two.
Qed.

Lemma one_less_three : ([1]:R) [<] Three.
Proof.
 apply less_leEq_trans with (Two:R).
  exact one_less_two.
 apply less_leEq; exact two_less_three.
Qed.

Lemma two_less_four : (Two:R) [<] Four.
Proof.
 apply less_leEq_trans with (Three:R).
  exact two_less_three.
 apply less_leEq; exact three_less_four.
Qed.

Lemma pos_three : ([0]:R) [<] Three.
Proof.
 apply less_leEq_trans with ([1]:R).
  exact pos_one.
 apply less_leEq; exact one_less_three.
Qed.

Lemma one_less_four : ([1]:R) [<] Four.
Proof.
 apply less_leEq_trans with (Three:R).
  exact one_less_three.
 apply less_leEq; exact three_less_four.
Qed.

Lemma pos_four : ([0]:R) [<] Four.
Proof.
 apply less_leEq_trans with ([1]:R).
  exact pos_one.
 apply less_leEq; exact one_less_four.
Qed.

Lemma two_ap_zero : Two [#] ([0]:R).
Proof.
 apply pos_ap_zero.
 apply pos_two.
Qed.

Lemma three_ap_zero : Three [#] ([0]:R).
Proof.
 apply pos_ap_zero.
 apply pos_three.
Qed.

Lemma four_ap_zero : Four [#] ([0]:R).
Proof.
 apply pos_ap_zero.
 apply pos_four.
Qed.

End up_to_four.

Section More_than_four.

Lemma pos_six : ([0]:R) [<] Six.
Proof.
 exact (pos_Snring 5).
Qed.

Lemma pos_eight : ([0]:R) [<] Eight.
Proof.
 exact (pos_Snring 7).
Qed.

Lemma pos_nine : ([0]:R) [<] Nine.
Proof.
 exact (pos_Snring 8).
Qed.

Lemma pos_twelve : ([0]:R) [<] Twelve.
Proof.
 exact (pos_Snring 11).
Qed.

Lemma pos_sixteen : ([0]:R) [<] Sixteen.
Proof.
 exact (pos_Snring 15).
Qed.

Lemma pos_eighteen : ([0]:R) [<] Eighteen.
Proof.
 exact (pos_Snring 17).
Qed.

Lemma pos_twentyfour : ([0]:R) [<] TwentyFour.
Proof.
 exact (pos_Snring 23).
Qed.

Lemma pos_fortyeight : ([0]:R) [<] FortyEight.
Proof.
 exact (pos_Snring 47).
Qed.

Lemma six_ap_zero : Six [#] ([0]:R).
Proof.
 apply pos_ap_zero; apply pos_six.
Qed.

Lemma eight_ap_zero : Eight [#] ([0]:R).
Proof.
 apply pos_ap_zero; apply pos_eight.
Qed.

Lemma nine_ap_zero : Nine [#] ([0]:R).
Proof.
 apply pos_ap_zero; apply pos_nine.
Qed.

Lemma twelve_ap_zero : Twelve [#] ([0]:R).
Proof.
 apply pos_ap_zero; apply pos_twelve.
Qed.

Lemma sixteen_ap_zero : Sixteen [#] ([0]:R).
Proof.
 apply pos_ap_zero; apply pos_sixteen.
Qed.

Lemma eighteen_ap_zero : Eighteen [#] ([0]:R).
Proof.
 apply pos_ap_zero; apply pos_eighteen.
Qed.

Lemma twentyfour_ap_zero : TwentyFour [#] ([0]:R).
Proof.
 apply pos_ap_zero; apply pos_twentyfour.
Qed.

Lemma fortyeight_ap_zero : FortyEight [#] ([0]:R).
Proof.
 apply pos_ap_zero; apply pos_fortyeight.
Qed.

End More_than_four.

End infinity_of_cordfields.

#[global]
Hint Resolve pos_one : algebra.

Declare Left Step leEq_wdl.
Declare Right Step leEq_wdr.

Notation " x [/]OneNZ" := (x[/] [1][//]ring_non_triv _) (at level 20).
Notation " x [/]TwoNZ" := (x[/] Two[//]two_ap_zero _) (at level 20).
Notation " x [/]ThreeNZ" := (x[/] Three[//]three_ap_zero _) (at level 20).
Notation " x [/]FourNZ" := (x[/] Four[//]four_ap_zero _) (at level 20).
Notation " x [/]SixNZ" := (x[/] Six[//]six_ap_zero _) (at level 20).
Notation " x [/]EightNZ" := (x[/] Eight[//]eight_ap_zero _) (at level 20).
Notation " x [/]NineNZ" := (x[/] Nine[//]nine_ap_zero _) (at level 20).
Notation " x [/]TwelveNZ" := (x[/] Twelve[//]twelve_ap_zero _) (at level 20).
Notation " x [/]SixteenNZ" := (x[/] Sixteen[//]sixteen_ap_zero _) (at level 20).
Notation " x [/]EighteenNZ" := (x[/] Eighteen[//]eighteen_ap_zero _) (at level 20).
Notation " x [/]TwentyFourNZ" := (x[/] TwentyFour[//]twentyfour_ap_zero _) (at level 20).
Notation " x [/]FortyEightNZ" := (x[/] FortyEight[//]fortyeight_ap_zero _) (at level 20).

Section consequences_of_infinity.

Variable F : COrdField.

Lemma square_eq : forall x a : F, a [#] [0] -> x[^]2 [=] a[^]2 -> {x [=] a} + {x [=] [--]a}.
Proof.
 intros x a a_ H.
 elim (cond_square_eq F x a); auto.
 apply two_ap_zero.
Qed.

Lemma char0_OrdField : Char0 F.
Proof.
 unfold Char0 in |- *.
 intros.
 apply nring_ap_zero.
 lia.
Qed.

End consequences_of_infinity.

Section Properties_of_Ordering.

Variable R : COrdField.

Section addition.

Lemma plus_resp_less_lft : forall x y z : R, x [<] y -> z[+]x [<] z[+]y.
Proof.
 intros x y z H.
 astepl (x[+]z).
 astepr (y[+]z).
 apply plus_resp_less_rht.
 assumption.
Qed.

Lemma inv_resp_less : forall x y : R, x [<] y -> [--]y [<] [--]x.
Proof.
 intros x y H.
 rstepl (x[+]([--]x[+][--]y)).
 rstepr (y[+]([--]x[+][--]y)).
 apply plus_resp_less_rht.
 assumption.
Qed.

Lemma minus_resp_less : forall x y z : R, x [<] y -> x[-]z [<] y[-]z.
Proof.
 Transparent cg_minus.
 unfold cg_minus in |- *.
 intros x y z H.
 apply plus_resp_less_rht.
 assumption.
Qed.

Lemma minus_resp_less_rht : forall x y z : R, y [<] x -> z[-]x [<] z[-]y.
Proof.
 intros.
 Transparent cg_minus.
 unfold cg_minus in |- *.
 apply plus_resp_less_lft.
 apply inv_resp_less.
 assumption.
Qed.

Lemma plus_resp_less_both : forall a b c d : R, a [<] b -> c [<] d -> a[+]c [<] b[+]d.
Proof.
 intros.
 apply less_leEq_trans with (a[+]d).
  apply plus_resp_less_lft.
  assumption.
 apply less_leEq.
 apply plus_resp_less_rht.
 assumption.
Qed.

Lemma plus_cancel_less : forall x y z : R, x[+]z [<] y[+]z -> x [<] y.
Proof.
 intros.

 rstepl (x[+]z[+][--]z).

 rstepr (y[+]z[+][--]z).
 apply plus_resp_less_rht.
 assumption.
Qed.

Lemma inv_cancel_less : forall x y : R, [--]x [<] [--]y -> y [<] x.
Proof.
 intros.
 apply plus_cancel_less with ([--]x[-]y).
 rstepl ([--]x).
 rstepr ([--]y).
 assumption.
Qed.

Lemma shift_less_plus : forall x y z : R, x[-]z [<] y -> x [<] y[+]z.
Proof.
 intros.
 rstepl (x[-]z[+]z).
 apply plus_resp_less_rht.
 assumption.
Qed.

Lemma shift_less_plus' : forall x y z : R, x[-]y [<] z -> x [<] y[+]z.
Proof.
 intros.
 astepr (z[+]y).
 apply shift_less_plus.
 assumption.
Qed.

Lemma shift_less_minus : forall x y z : R, x[+]z [<] y -> x [<] y[-]z.
Proof.
 intros.
 rstepl (x[+]z[-]z).
 apply minus_resp_less.
 assumption.
Qed.

Lemma shift_less_minus' : forall x y z : R, z[+]x [<] y -> x [<] y[-]z.
Proof.
 intros.
 apply shift_less_minus.
 astepl (z[+]x).
 assumption.
Qed.

Lemma shift_plus_less : forall x y z : R, x [<] z[-]y -> x[+]y [<] z.
Proof.
 intros.
 rstepr (z[-]y[+]y).
 apply plus_resp_less_rht.
 assumption.
Qed.

Lemma shift_plus_less' : forall x y z : R, y [<] z[-]x -> x[+]y [<] z.
Proof.
 intros.
 astepl (y[+]x).
 apply shift_plus_less.
 assumption.
Qed.

Lemma shift_minus_less : forall x y z : R, x [<] z[+]y -> x[-]y [<] z.
Proof.
 intros.
 astepr (z[+]y[-]y).
 apply minus_resp_less.
 assumption.
Qed.

Lemma shift_minus_less' : forall x y z : R, x [<] y[+]z -> x[-]y [<] z.
Proof.
 intros.
 apply shift_minus_less.
 astepr (y[+]z).
 assumption.
Qed.

Lemma shift_zero_less_minus : forall x y : R, x [<] y -> [0] [<] y[-]x.
Proof.
 intros.
 rstepl (x[-]x).
 apply minus_resp_less.
 assumption.
Qed.

Lemma shift_zero_less_minus' : forall x y : R, [0] [<] y[-]x -> x [<] y.
Proof.
 intros.
 apply plus_cancel_less with ([--]x).
 rstepl ([0]:R).
 assumption.
Qed.

Lemma qltone : forall q : R, q [<] [1] -> q[-][1] [#] [0].
Proof.
 intros.
 apply less_imp_ap.
 apply shift_minus_less.
 astepr ([1]:R).
 auto.
Qed.

End addition.

Section multiplication.

Lemma mult_resp_less : forall x y z : R, x [<] y -> [0] [<] z -> x[*]z [<] y[*]z.
Proof.
 intros.
 apply plus_cancel_less with ([--](x[*]z)).
 astepl ([0]:R).

 rstepr ((y[-]x)[*]z).
 apply mult_resp_pos.
  astepl (x[-]x).
  apply minus_resp_less.
  assumption.
 assumption.
Qed.

Lemma recip_resp_pos : forall (y : R) y_, [0] [<] y -> [0] [<] ([1][/] y[//]y_).
Proof.
 intros.
 cut ([0] [<] ([1][/] y[//]y_) or ([1][/] y[//]y_) [<] [0]).
  intros H0.
elim H0; clear H0; intros H0.
  auto.
  exfalso.
  apply (less_irreflexive_unfolded R [0]).
  eapply less_transitive_unfolded.
   2: apply H0.
  cut ([1] [<] ([0]:R)).
intro H1.
   elim (less_antisymmetric_unfolded _ _ _ (pos_one _) H1).
  astepl ([--]([--][1]:R)).
astepr ([--]([0]:R)).
  apply inv_resp_less.
  rstepr (y[*][--]([1][/] y[//]y_)).
  apply mult_resp_pos.
auto.
   astepl ([--]([0]:R)).
  apply inv_resp_less.
auto.
  apply ap_imp_less.
 apply ap_symmetric_unfolded.
apply div_resp_ap_zero_rev.
 apply ring_non_triv.
Qed.

Lemma div_resp_less_rht : forall (x y z : R) z_, x [<] y -> [0] [<] z -> (x[/] z[//]z_) [<] (y[/] z[//]z_).
Proof.
 intros.
 rstepl (x[*]([1][/] z[//]z_)).
 rstepr (y[*]([1][/] z[//]z_)).
 apply mult_resp_less.
auto.
  apply recip_resp_pos.
 auto.
Qed.

Lemma div_resp_pos : forall (x y : R) x_, [0] [<] x -> [0] [<] y -> [0] [<] (y[/] x[//]x_).
Proof.
 intros.
 astepl ([0][/] x[//]x_).
 apply div_resp_less_rht; auto.
Qed.

Lemma mult_resp_less_lft : forall x y z : R, x [<] y -> [0] [<] z -> z[*]x [<] z[*]y.
Proof.
 intros.
 astepl (x[*]z).
 astepr (y[*]z).
 apply mult_resp_less.
  assumption.
 assumption.
Qed.

Lemma mult_resp_less_both : forall x y u v : R,
 [0] [<=] x -> x [<] y -> [0] [<=] u -> u [<] v -> x[*]u [<] y[*]v.
Proof.
 cut (forall x y z : R, x [<=] y -> [0] [<=] z -> x[*]z [<=] y[*]z).
  intro resp_leEq.
  intros.
  apply leEq_less_trans with (y[*]u).
   apply resp_leEq; auto.
   apply less_leEq; auto.
  apply mult_resp_less_lft; auto.
  apply leEq_less_trans with x; auto.

 intros x y z.
 repeat rewrite -> leEq_def in |- *.
 intros H H0 H1.
 generalize (shift_zero_less_minus _ _ H1); intro H2.
 cut ([0] [<] (x[-]y)[*]z).
  intro H3.
  2: rstepr (x[*]z[-]y[*]z); auto.
 cut (forall a b : R, [0] [<] a[*]b -> [0] [<] a and [0] [<] b or a [<] [0] and b [<] [0]).
  intro H4.
  generalize (H4 _ _ H3); intro H5.
  elim H5; intro H6; elim H6; intros H7 H8.
   apply H.
   astepl ([0][+]y).
   apply shift_plus_less.
   assumption.
  apply H0.
  assumption.
 intros a b H4.
 generalize (Greater_imp_ap _ _ _ H4); intro H5.
 generalize (mult_cancel_ap_zero_lft _ _ _ H5); intro H6.
 generalize (mult_cancel_ap_zero_rht _ _ _ H5); intro H7.
 elim (ap_imp_less _ _ _ H6); intro H8.
  right.
  split; auto.
  elim (ap_imp_less _ _ _ H7); auto.
  int

[...]

ntros; simpl in |- *; exfalso; inversion H.
 simple induction n0.
  intros.
  clear H.
  simpl in |- *; apply plus_resp_less_lft.
  apply X0.
 intros.
 simpl in |- *.
 apply plus_resp_less_both.
  astepl (Sumx (fun (i : nat) (l : i < S n1) => f i (Nat.lt_lt_succ_r _ _ l))).
  astepr (Sumx (fun (i : nat) (l : i < S n1) => g i (Nat.lt_lt_succ_r _ _ l))).
  apply X0.
   auto with arith.
  intros.
apply X1.
  apply X1.
Qed.

Lemma positive_Sum_two : forall x y : R, [0] [<] x[+]y -> [0] [<] x or [0] [<] y.
Proof.
 intros.
 cut ([--]x [<] [0] or [0] [<] y).
  intro; inversion_clear X0.
   left; astepl ([--]([0]:R)); astepr ([--][--]x); apply inv_resp_less; assumption.
  right; assumption.
 apply less_cotransitive_unfolded.
 astepl ([0][-]x); apply shift_minus_less'; assumption.
Qed.

Lemma positive_Sumx : forall n (f : forall i, i < n -> R),
 nat_less_n_fun f -> [0] [<] Sumx f -> {i : nat | {H : i < n | [0] [<] f i H}}.
Proof.
 simple induction n.
  simpl in |- *.
  intros; exfalso; generalize X; apply less_irreflexive_unfolded.
 simple induction n0.
  simpl in |- *.
  intros.
  exists 0.
  exists (Nat.lt_succ_diag_r 0).
  eapply less_wdr.
   apply X0.
  astepl (f _ (Nat.lt_succ_diag_r 0)).
  apply H; auto.
 simpl in |- *; intros.
 clear X.
 cut ([0] [<] f _ (Nat.lt_succ_diag_r (S n1)) or [0] [<]
   Sumx (fun (i : nat) (l : i < n1) => f i (Nat.lt_lt_succ_r i (S n1) (Nat.lt_lt_succ_r i n1 l)))[+]
     f n1 (Nat.lt_lt_succ_r n1 (S n1) (Nat.lt_succ_diag_r n1))).
  intro X.
 inversion_clear X.
  exists (S n1).
   exists (Nat.lt_succ_diag_r (S n1)).
   eapply less_wdr.
    apply X2.
   apply H; auto.
  set (f' := fun (i : nat) (H : i < S n1) => f i (Nat.lt_lt_succ_r _ _ H)) in *.
  cut {i : nat | {H : i < S n1 | [0] [<] f' i H}}; intros.
   elim X; intros i Hi; elim Hi; clear X2 Hi; intros Hi Hi'.
   exists i.
   exists (Nat.lt_lt_succ_r _ _ Hi).
   eapply less_wdr.
    apply Hi'.
   unfold f' in |- *; simpl in |- *.
   apply H; auto.
  apply X0.
   red in |- *.
intros i j Hij.
rewrite Hij.
unfold f' in |- *.
   intros H0 H'.
   apply H; auto.
  apply X2; assumption.
 apply positive_Sum_two.
 eapply less_wdr.
  2: apply cag_commutes_unfolded.
 assumption.
Qed.

Lemma negative_Sumx : forall n (f : forall i, i < n -> R),
 nat_less_n_fun f -> Sumx f [<] [0] -> {i : nat | {H : i < n | f i H [<] [0]}}.
Proof.
 intros.
 cut {i : nat | {H : i < n | [0] [<] [--](f i H)}}.
  intro H1.
  elim H1; intros i Hi; elim Hi; clear X Hi; intros Hi Hi'.
  exists i; exists Hi.
  astepl ([--][--](f i Hi)); astepr ([--]([0]:R)); apply inv_resp_less; assumption.
 apply positive_Sumx with (f := fun (i : nat) (H : i < n) => [--](f i H)).
  red in |- *; intros.
  apply un_op_wd_unfolded; apply H; assumption.
 astepl ([--]([0]:R)); apply less_wdr with ([--](Sumx f)).
  apply inv_resp_less; assumption.
 generalize f H; clear X H f.
 induction  n as [| n Hrecn].
  simpl in |- *.
  intros; algebra.
 intros.
 simpl in |- *.
 rstepl ([--](Sumx (fun (i : nat) (l : i < n) => f i (Nat.lt_lt_succ_r i n l)))[+] [--](f n (Nat.lt_succ_diag_r n))).
 apply bin_op_wd_unfolded.
  2: algebra.
 apply Hrecn with (f := fun (i : nat) (l : i < n) => f i (Nat.lt_lt_succ_r i n l)).
 red in |- *; intros; apply H; auto.
Qed.

End misc.

End Properties_of_Ordering.

Add Parametric Morphism c : (@cof_leEq c) with signature (@cs_eq (cof_crr c)) ==> (@cs_eq c) ==> iff as cof_leEq_wd.
Proof with try assumption.
 intros x1 x2 Hx y1 y2 Hy.
 split; intros.
  stepl x1...
  stepr y1...
 symmetry in Hx, Hy.
 stepl x2...
 stepr y2...
Qed.

End COrdFields.

End CoRN_DOT_algebra_DOT_COrdFields_WRAPPED.
Module Export CoRN_DOT_algebra_DOT_COrdFields.
Module Export CoRN.
Module Export algebra.
Module COrdFields.
Include CoRN_DOT_algebra_DOT_COrdFields_WRAPPED.COrdFields.
End COrdFields.

End algebra.

End CoRN.

End CoRN_DOT_algebra_DOT_COrdFields.
Export CoRN.algebra.COrdFields.

Section Properties_of_leEq.

Variable R : COrdField.

Lemma plus_resp_leEq_lft : forall x y z : R, x [<=] y -> z[+]x [<=] z[+]y.
Admitted.

Lemma inv_resp_leEq : forall x y : R, x [<=] y -> [--]y [<=] [--]x.
Admitted.

Lemma minus_resp_leEq_rht : forall x y z : R, y [<=] x -> z[-]x [<=] z[-]y.
Admitted.

Lemma plus_resp_leEq_both : forall x y a b : R, x [<=] y -> a [<=] b -> x[+]a [<=] y[+]b.
Admitted.

Lemma minus_resp_leEq_both : forall x y x' y' : R, x [<=] y -> y' [<=] x' -> x[-]x' [<=] y[-]y'.
Admitted.

Lemma plus_cancel_leEq_rht : forall x y z : R, x[+]z [<=] y[+]z -> x [<=] y.
Admitted.

Lemma inv_cancel_leEq : forall x y : R, [--]y [<=] [--]x -> x [<=] y.
Admitted.

Lemma shift_plus_leEq : forall a b c : R, a [<=] c[-]b -> a[+]b [<=] c.
Admitted.

Lemma shift_leEq_plus : forall a b c : R, a[-]b [<=] c -> a [<=] c[+]b.
Admitted.

Lemma shift_leEq_minus : forall a b c : R, a[+]c [<=] b -> a [<=] b[-]c.
Admitted.

Lemma mult_resp_leEq_rht : forall x y z : R, x [<=] y -> [0] [<=] z -> x[*]z [<=] y[*]z.
Admitted.

Lemma mult_resp_leEq_lft : forall x y z : R, x [<=] y -> [0] [<=] z -> z[*]x [<=] z[*]y.
Admitted.

Lemma mult_resp_leEq_both : forall x x' y y' : R,
 [0] [<=] x -> [0] [<=] y -> x [<=] x' -> y [<=] y' -> x[*]y [<=] x'[*]y'.
Admitted.

Lemma div_resp_leEq : forall (x y z : R) z_, [0] [<] z -> x [<=] y -> (x[/] z[//]z_) [<=] (y[/] z[//]z_).
Admitted.

Lemma mult_cancel_leEq : forall x y z : R, [0] [<] z -> x[*]z [<=] y[*]z -> x [<=] y.
Admitted.

Lemma shift_leEq_div : forall (x y z : R) y_, [0] [<] y -> x[*]y [<=] z -> x [<=] (z[/] y[//]y_).
Admitted.

Lemma eps_div_leEq_eps : forall (eps d : R) d_, [0] [<=] eps -> [1] [<=] d -> (eps[/] d[//]d_) [<=] eps.
Admitted.

Lemma nonneg_div_two : forall eps : R, [0] [<=] eps -> [0] [<=] eps [/]TwoNZ.
Print Options.
Admitted.

Lemma nonneg_div_two' : forall eps : R, [0] [<=] eps -> eps [/]TwoNZ [<=] eps.
Print Options.
Admitted.

Lemma mult_resp_nonneg : forall x y : R, [0] [<=] x -> [0] [<=] y -> [0] [<=] x[*]y.
Admitted.

Lemma Sum_resp_leEq : forall (f g : nat -> R) a b, a <= S b ->
 (forall i, a <= i -> i <= b -> f i [<=] g i) -> Sum a b f [<=] Sum a b g.
Admitted.

Lemma approach_zero_weak : forall x : R, (forall e, [0] [<] e -> x [<=] e) -> x [<=] [0].
Admitted.

End Properties_of_leEq.

Section PosP_properties.

Variable R : COrdField.

Lemma mult_cancel_pos_rht : forall x y : R, [0] [<] x[*]y -> [0] [<=] x -> [0] [<] y.
Admitted.

End PosP_properties.

#[global]
Hint Resolve mult_resp_nonneg.

Module Export CoRN_DOT_algebra_DOT_COrdAbs_WRAPPED.
Module Export COrdAbs.
Definition AbsSmall (R : COrdField) (e x : R) : Prop.
exact ([--]e [<=] x /\ x [<=] e).
Print Options.
Defined.

Arguments AbsSmall [R].

Section AbsSmall_properties.

Variable R : COrdField.

Lemma AbsSmall_wdr : rel_wdr R (AbsSmall (R:=R)).
Admitted.

Lemma AbsSmall_wdr_unfolded : forall x y z : R,
 AbsSmall x y -> y [=] z -> AbsSmall x z.
Proof AbsSmall_wdr.

Lemma AbsSmall_wdl : rel_wdl R (AbsSmall (R:=R)).
 unfold rel_wdl in |- *.
Print Options.
 intros.
Print Options.
 elim H; intros.
Print Options.
 split.
Print Options.
  astepl ([--]x).
Print Options.
  assumption.
Print Options.
 astepr x.
Print Options.
 assumption.
Print Options.
Qed.

Lemma AbsSmall_wdl_unfolded : forall x y z : R,
 AbsSmall x y -> x [=] z -> AbsSmall z y.
Proof AbsSmall_wdl.

Declare Left Step AbsSmall_wdl_unfolded.
Declare Right Step AbsSmall_wdr_unfolded.

Notation ZeroR := ([0]:R).

Lemma AbsSmall_leEq_trans : forall e1 e2 d : R,
 e1 [<=] e2 -> AbsSmall e1 d -> AbsSmall e2 d.
 intros.
Print Options.
 elim H0; intros.
Print Options.
 split.
Print Options.
  apply leEq_transitive with ([--]e1).
Print Options.
   apply inv_resp_leEq.
Print Options.
   assumption.
Print Options.
  assumption.
Print Options.
 apply leEq_transitive with e1.
Print Options.
  assumption.
Print Options.
 assumption.
Print Options.
Qed.

Lemma zero_AbsSmall : forall e : R, [0] [<=] e -> AbsSmall e [0].
 split.
Print Options.
  astepr ([--]ZeroR).
Print Options.
  apply inv_resp_leEq.
Print Options.
  assumption.
Print Options.
 assumption.
Print Options.
Qed.

Lemma AbsSmall_reflexive : forall (e : R), [0] [<=] e -> AbsSmall e e.
 split.
Print Options.
  apply leEq_transitive with ([0]:R); auto.
Print Options.
  astepr ([--][0]:R).
Print Options.
  apply inv_resp_leEq.
Print Options.
  auto.
Print Options.
 apply leEq_reflexive.
Print Options.
Qed.

Lemma AbsSmall_trans : forall e1 e2 d : R,
 e1 [<] e2 -> AbsSmall e1 d -> AbsSmall e2 d.
 intros.
Print Options.
 apply AbsSmall_leEq_trans with e1.
Print Options.
  apply less_leEq.
Print Options.
  assumption.
Print Options.
 assumption.
Print Options.
Qed.

Lemma leEq_imp_AbsSmall : forall e d : R, [0] [<=] e -> e [<=] d -> AbsSmall d e.
 split; try assumption.
Print Options.
 apply leEq_transitive with ZeroR; try assumption.
Print Options.
 astepr ([--]ZeroR).
Print Options.
 apply inv_resp_leEq.
Print Options.
 apply leEq_transitive with e; assumption.
Print Options.
Qed.

Lemma inv_resp_AbsSmall : forall x y : R, AbsSmall x y -> AbsSmall x [--]y.
 intros.
Print Options.
 elim H; intros.
Print Options.
 split.
Print Options.
  apply inv_resp_leEq.
Print Options.
  assumption.
Print Options.
 astepr ([--][--]x).
Print Options.
 apply inv_resp_leEq.
Print Options.
 assumption.
Print Options.
Qed.

Lemma mult_resp_AbsSmall: forall (R: COrdField) (x y e : R) (H: [0][<=]y),
AbsSmall e x -> AbsSmall (y[*]e) (y[*]x).
 intros.
Print Options.
 destruct H0.
Print Options.
 split.
Print Options.
  rstepl (y[*]([--]e)).
Print Options.
  apply mult_resp_leEq_lft; auto.
Print Options.
 apply mult_resp_leEq_lft; auto.
Print Options.
Qed.

Lemma div_resp_AbsSmall: forall (R: COrdField) (x y e : R) (H: [0][<]y),
AbsSmall e x -> AbsSmall (e[/]y[//]pos_ap_zero _ _ H) (x[/]y[//]pos_ap_zero _ _ H).
 intros.
Print Options.
 destruct H0.
Print Options.
 split.
Print Options.
  rstepl (([--]e)[/]y[//]pos_ap_zero _ _ H).
Print Options.
  apply div_resp_leEq; auto.
Print Options.
 apply div_resp_leEq; auto.
Print Options.
Qed.

Lemma sum_resp_AbsSmall : forall
(x y : nat -> R) (n m: nat)
(H1 : m <= n) (H2 : forall i : nat, m <= i -> i <= n ->  AbsSmall (y i) (x i)),
AbsSmall (Sum m n y) (Sum m n x).
 intros.
Print Options.
 assert (H3 : forall i : nat, m <= i -> i <= n ->  [--](y i)[<=]x i).
Print Options.
  intros.
Print Options.
  elim (H2 i H H0).
Print Options.
auto.
Print Options.
  assert (H4 : forall i : nat, m <= i -> i <= n ->  x i[<=]y i).
Print Options.
  intros.
Print Options.
  elim (H2 i H H0).
Print Options.
auto.
Print Options.
  split.
Print Options.
  astepl (Sum m n (fun k: nat => [--](y k))).
Print Options.
  apply Sum_resp_leEq .
Print Options.
   auto with arith.
Print Options.
auto.
Print Options.
  apply Sum_resp_leEq .
Print Options.
  auto with arith.
Print Options.
auto.
Print Options.
Qed.

Lemma AbsSmall_minus : forall e x1 x2 : R, AbsSmall e (x1[-]x2) -> AbsSmall e (x2[-]x1).
 intros.
Print Options.
 rstepr ([--](x1[-]x2)).
Print Options.
 apply inv_resp_AbsSmall.
Print Options.
 assumption.
Print Options.
Qed.

Lemma AbsSmall_plus : forall e1 e2 x1 x2 : R,
 AbsSmall e1 x1 -> AbsSmall e2 x2 -> AbsSmall (e1[+]e2) (x1[+]x2).
 intros.
Print Options.
 elim H; intros.
Print Options.
 elim H0; intros.
Print Options.
 split.
Print Options.
  rstepl ([--]e1[+][--]e2).
Print Options.
  apply plus_resp_leEq_both; assumption.
Print Options.
 apply plus_resp_leEq_both; assumption.
Print Options.
Qed.

Lemma AbsSmall_eps_div_two : forall e x1 x2 : R,
 AbsSmall (e [/]TwoNZ) x1 -> AbsSmall (e [/]TwoNZ) x2 -> AbsSmall e (x1[+]x2).
Print Options.
 intros.
Print Options.
 rstepl (e [/]TwoNZ[+]e [/]TwoNZ).
Print Options.
 apply AbsSmall_plus.
Print Options.
  assumption.
Print Options.
 assumption.
Print Options.
Qed.

Lemma AbsSmall_x_plus_delta : forall x eps delta : R,
 [0] [<=] eps -> [0] [<=] delta -> delta [<=] eps -> AbsSmall eps (x[-] (x[+]delta)).
 intros.
Print Options.

 rstepr ([--]delta).
Print Options.
 apply inv_resp_AbsSmall.
Print Options.
 apply leEq_imp_AbsSmall.
Print Options.
  assumption.
Print Options.
 assumption.
Print Options.
Qed.

Lemma AbsSmall_x_minus_delta : forall x eps delta : R,
 [0] [<=] eps -> [0] [<=] delta -> delta [<=] eps -> AbsSmall eps (x[-] (x[-]delta)).
 intros.
Print Options.

 rstepr delta.
Print Options.
 apply leEq_imp_AbsSmall.
Print Options.
  assumption.
Print Options.
 assumption.
Print Options.
Qed.

Lemma AbsSmall_x_plus_eps_div2 : forall x eps : R, [0] [<=] eps -> AbsSmall eps (x[-] (x[+]eps [/]TwoNZ)).
Print Options.
 intros.
Print Options.
 apply AbsSmall_x_plus_delta.
Print Options.
   assumption.
Print Options.
  apply nonneg_div_two.
Print Options.
  assumption.
Print Options.
 apply nonneg_div_two'.
Print Options.
 assumption.
Print Options.
Qed.

Lemma AbsSmall_x_minus_eps_div2 : forall x eps : R, [0] [<=] eps -> AbsSmall eps (x[-] (x[-]eps [/]TwoNZ)).
Print Options.
 intros.
Print Options.
 apply AbsSmall_x_minus_delta.
Print Options.
   assumption.
Print Options.
  apply nonneg_div_two.
Print Options.
  assumption.
Print Options.
 apply eps_div_leEq_eps.
Print Options.
  assumption.
Print Options.
 apply less_leEq.
Print Options.
 apply one_less_two.
Print Options.
Qed.

Lemma AbsSmall_intermediate : forall x y z eps : R,
 x [<=] y -> y [<=] z -> AbsSmall eps (z[-]x) -> AbsSmall eps (z[-]y).
 intros.
Print Options.
 apply leEq_imp_AbsSmall.
Print Options.
  apply shift_leEq_minus; astepl y.
Print Options.
  assumption.
Print Options.
 elim H1; intros.
Print Options.
 apply leEq_transitive with (z[-]x); try assumption.
Print Options.
 apply minus_resp_leEq_rht.
Print Options.
 assumption.
Print Options.
Qed.

Lemma AbsSmall_eps_div2 : forall eps : R, [0] [<=] eps -> AbsSmall eps (eps [/]TwoNZ).
Print Options.
 intros.
Print Options.
 apply leEq_imp_AbsSmall.
Print Options.
  apply nonneg_div_two.
Print Options.
  assumption.
Print Options.
 apply eps_div_leEq_eps.
Print Options.
  assumption.
Print Options.
 apply less_leEq.
Print Options.
 apply one_less_two.
Print Options.
Qed.

Lemma AbsSmall_nonneg : forall e x : R, AbsSmall e x -> [0] [<=] e.
 intros.
Print Options.
 elim H.
Print Options.
 intros.
Print Options.
 cut ([--]e [<=] e).
Print Options.
  intros.
Print Options.
  apply mult_cancel_leEq with (z := Two:R).
Print Options.
   apply pos_two.
Print Options.
  apply plus_cancel_leEq_rht with (z := [--]e).
Print Options.
  rstepl ([--]e).
Print Options.
  rstepr e.
Print Options.
  assumption.
Print Options.
 apply leEq_transitive with (y := x).
Print Options.
  assumption.
Print Options.
 assumption.
Print Options.
Qed.

Lemma AbsSmall_mult : forall e1 e2 x1 x2 : R,
 AbsSmall e1 x1 -> AbsSmall e2 x2 -> AbsSmall (Three[*] (e1[*]e2)) (x1[*]x2).
 intros.
Print Options.
 elim H.
Print Options.
 elim H0.
Print Options.
 cut ([0] [<=] e1).
Print Options.
  cut ([0] [<=] e2).
Print Options.
   split.
Print Options.
    apply plus_cancel_leEq_rht with (z := Three[*] (e1[*]e2)).
Print Options.
    rstepl ZeroR.
Print Options.
    apply leEq_transitive with (y := x1[*]x2[+]e1[*]e2[+]x1[*]e2[+]e1[*]x2).
Print Options.
     rstepr ((e1[+]x1)[*](e2[+]x2)).
Print Options.
     apply mult_resp_nonneg.
Print Options.
      apply plus_cancel_leEq_rht with (z := [--]x1).
Print Options.
      rstepl ([--]x1).
Print Options.
      rstepr ([--][--]e1).
Print Options.
      apply inv_resp_leEq.
Print Options.
      assumption.
Print Options.
     apply plus_cancel_leEq_rht with (z := [--]x2).
Print Options.
     rstepl ([--]x2).
Print Options.
     rstepr ([--][--]e2).
Print Options.
     apply inv_resp_leEq.
Print Options.
     assumption.
Print Options.
    rstepl (x1[*]x2[+]e1[*]e2[+](x1[*]e2[+]e1[*]x2)).
Print Options.
    rstepr (x1[*]x2[+]e1[*]e2[+](e1[*]e2[+]e1[*]e2)).
Print Options.
    apply plus_resp_leEq_lft.
Print Options.
    apply plus_resp_leEq_both.
Print Options.
     apply mult_resp_leEq_rht.
Print Options.
      assumption.
Print Options.
     assumption.
Print Options.
    apply mult_resp_leEq_lft.
Print Options.
     assumption.
Print Options.
    assumption.
Print Options.
   apply plus_cancel_leEq_rht with (z := [--](x1[*]x2)).
Print Options.
   rstepl ZeroR.
Print Options.
   rstepr ([--](x1[*]x2)[+]e1[*]e2[+](e1[*]e2[+]e1[*]e2)).
Print Options.
   apply leEq_transitive with (y := [--](x1[*]x2)[+]e1[*]e2[+](x1[*]e2[-]e1[*]x2)).
Print Options.
    rstepr ((e1[+]x1)[*](e2[-]x2)).
Print Options.
    apply mult_resp_nonneg.
Print Options.
     apply plus_cancel_leEq_rht with (z := [--]x1).
Print Options.
     rstepl ([--]x1).
Print Options.
     rstepr ([--][--]e1).
Print Options.
     apply inv_resp_leEq.
Print Options.
     assumption.
Print Options.
    apply plus_cancel_leEq_rht with (z := x2).
Print Options.
    rstepl x2.
Print Options.
    rstepr e2.
Print Options.
    assumption.
Print Options.
   apply plus_resp_leEq_lft.
Print Options.
   apply plus_resp_leEq_both.
Print Options.
    apply mult_resp_leEq_rht.
Print Options.
     assumption.
Print Options.
    assumption.
Print Options.
   rstepl (e1[*][--]x2).
Print Options.
   apply mult_resp_leEq_lft.
Print Options.
    rstepr ([--][--]e2).
Print Options.
    apply inv_resp_leEq.
Print Options.
    assumption.
Print Options.
   assumption.
Print Options.
  apply AbsSmall_nonneg with (e := e2) (x := x2).
Print Options.
  assumption.
Print Options.
 apply AbsSmall_nonneg with (e := e1) (x := x1).
Print Options.
 assumption.
Print Options.
Qed.

Lemma AbsSmall_cancel_mult : forall e x z : R,
 [0] [<] z -> AbsSmall (e[*]z) (x[*]z) -> AbsSmall e x.
 intros.
Print Options.
 elim H.
Print Options.
 split.
Print Options.
  apply mult_cancel_leEq with (z := z).
Print Options.
   assumption.
Print Options.
  rstepl ([--](e[*]z)).
Print Options.
  assumption.
Print Options.
 apply mult_cancel_leEq with (z := z).
Print Options.
  assumption.
Print Options.
 assumption.
Print Options.
Qed.

Lemma AbsSmall_approach_zero : forall x : R, (forall e, [0] [<] e -> AbsSmall e x) -> x [=] [0].
 intros.
Print Options.
 apply not_ap_imp_eq.
Print Options.
 intro H0.
Print Options.
 elim (ap_imp_less _ _ _ H0).
Print Options.
  change (Not (x [<] [0])).
Print Options.
  rewrite <- leEq_def.
Print Options.
  apply inv_cancel_leEq.
Print Options.
  astepr ZeroR.
Print Options.
  apply approach_zero_weak.
Print Options.
  intros.
Print Options.
  apply inv_cancel_leEq; astepr x.
Print Options.
  elim (H e); auto.
Print Options.
 change (Not ([0] [<] x)).
Print Options.
 rewrite <- leEq_def.
Print Options.
 apply approach_zero_weak.
Print Options.
 intros.
Print Options.
 elim (H e); auto.
Print Options.
Qed.

Lemma mult_AbsSmall'_rht : forall x y C : R, [0] [<=] C ->
 [--]C [<=] x -> x [<=] C -> [--]C [<=] y -> y [<=] C -> x[*]y [<=] Three[*]C[^]2.
Proof.
 intros.
 astepl ([0][+]x[*]y).
apply shift_plus_leEq.
 apply leEq_transitive with ((C[+]x)[*](C[-]y)).
  apply mult_resp_nonneg.
   apply shift_leEq_plus.
astepl ([--]x).
astepr ([--][--]C).
   apply inv_resp_leEq.
auto.
   apply shift_leEq_minus.
astepl y.
auto.
  rstepl (C[^]2[-]x[*]y[+]C[*](x[-]y)).
 rstepr (C[^]2[-]x[*]y[+]C[*](C[-][--]C)).
 apply plus_resp_leEq_lft.
 apply mult_resp_leEq_lft.
  apply minus_resp_leEq_both.
   auto.
auto.
auto.
Qed.

Lemma mult_AbsSmall_rht : forall x y X Y : R, [0] [<=] X ->
 [0] [<=] Y -> [--]X [<=] x -> x [<=] X -> [--]Y [<=] y -> y [<=] Y -> x[*]y [<=] X[*]Y.
Proof.
 intros.
 rewrite -> leEq_def.
 intro.
 cut ([0] [<] x[*]y); intros.
  2: apply leEq_less_trans with (X[*]Y); auto.
 rewrite -> leEq_def in *.
 cut (x[*]y [#] [0]); intros.
  2: apply pos_ap_zero; auto.
 cut (x [#] [0]); intros.
  2: apply mult_cancel_ap_zero_lft with y; auto.
 elim (ap_imp_less _ _ _ X3); intro.
  cut (y [<] [0]); intros.
   2: astepl ([--][--]y); astepr ([--]([0]:R)); apply inv_resp_less.
   2: apply mult_cancel_pos_rht with ([--]x).
    2: astepr (x[*]y); auto.
   2: astepl ([--]([0]:R)); apply less_leEq; apply inv_resp_less; auto.
  apply (less_irreflexive_unfolded R [1]).
  apply leEq_less_trans with (X[*]Y[/] _[//]X2).
   rstepr ((X[/] [--]x[//]inv_resp_ap_zero _ _ X3)[*]
     (Y[/] [--]y[//]inv_resp_ap_zero _ _ (less_imp_ap _ _ _ X4))).
   astepl ([1][*]([1]:R)).
   apply mult_resp_leEq_both.
      apply less_leEq; apply pos_one.
     apply less_leEq; apply pos_one.
    apply shift_leEq_div.
     astepl ([--]([0]:R)); apply inv_resp_less; auto.
    astepl ([--]x); astepr ([--][--]X); apply inv_resp_leEq; firstorder using leEq_def.
   apply shift_leEq_div.
    astepl ([--]([0]:R)); apply inv_resp_less; auto.
   astepl ([--]y); astepr ([--][--]Y); apply inv_resp_leEq; firstorder using leEq_def.
  apply shift_div_less; auto.
  astepr (x[*]y); auto.
 cut ([0] [<] y); intros.
  2: apply mult_cancel_pos_rht with x; try apply less_leEq; auto.
 apply (less_irreflexive_unfolded R [1]).
 apply leEq_less_trans with (X[*]Y[/] _[//]X2).
  rstepr ((X[/] x[//]X3)[*](Y[/] y[//]pos_ap_zero _ _ X4)).
  astepl ([1][*]([1]:R)).
  apply mult_resp_leEq_both.
     apply less_leEq; apply pos_one.
    apply less_leEq; apply pos_one.
   apply shift_leEq_div; auto.
   astepl x; firstorder using leEq_def.
  apply shift_leEq_div; auto.
  astepl y; firstorder using leEq_def.
 apply shift_div_less; auto.
 astepr (x[*]y); firstorder using leEq_def.
Qed.

Lemma mult_AbsSmall_lft : forall x y X Y : R, [0] [<=] X -> [0] [<=] Y ->
 [--]X [<=] x -> x [<=] X -> [--]Y [<=] y -> y [<=] Y -> [--](X[*]Y) [<=] x[*]y.
Proof.
 intros.
 rstepr ([--]([--]x[*]y)).
 apply inv_resp_leEq.
 apply mult_AbsSmall_rht; auto.
  apply inv_resp_leEq.
auto.
  rstepr ([--][--]X).
 apply inv_resp_leEq.
auto.
Qed.

Lemma mult_AbsSmall : forall x y X Y : R,
 AbsSmall X x -> AbsSmall Y y -> AbsSmall (X[*]Y) (x[*]y).
Proof.
 unfold AbsSmall in |- *.
 intros.
 elim H.
intros.
elim H0.
intros.
 cut ([0] [<=] X).
intro.
cut ([0] [<=] Y).
intro.
  split.
    apply mult_AbsSmall_lft; auto.
   apply mult_AbsSmall_rht; auto.
  apply AbsSmall_nonneg with y; auto.
 apply AbsSmall_nonneg with x; auto.
Qed.

End AbsSmall_properties.

Declare Left Step AbsSmall_wdl_unfolded.
Declare Right Step AbsSmall_wdr_unfolded.

Definition absBig (R : COrdField) (e x : R) : CProp :=
 [0] [<] e and (e [<=] x or x [<=] [--]e).

Notation AbsBig := (absBig _).

Lemma AbsBigSmall_minus : forall (R : COrdField) (e1 e2 x1 x2 : R),
 e2 [<] e1 -> AbsBig e1 x1 -> AbsSmall e2 x2 -> AbsBig (e1[-]e2) (x1[-]x2).
Proof.
 intros.
 unfold absBig in |- *.
 split.
  apply plus_cancel_less with (z := e2).
  rstepl e2.
  rstepr e1.
  assumption.
 unfold absBig in X0.
 elim X0.
 intros H2 H3.
 case H3.
  intro H4.
  left.
  unfold AbsSmall in H.
  elim H.
  intros.
  rstepl (e1[+][--]e2).
  rstepr (x1[+][--]x2).
  apply plus_resp_leEq_both.
   assumption.
  apply inv_cancel_leEq.
  rstepl x2.
  rstepr e2.
  assumption.
 intro H4.
 right.
 unfold AbsSmall in H.
 elim H.
 intros H5 H6.
 rstepr ([--]e1[+]e2).
 rstepl (x1[+][--]x2).
 apply plus_resp_leEq_both.
  assumption.
 apply inv_cancel_leEq.
 rstepr x2.
 rstepl ([--]e2).
 assumption.
Qed.

Section absBig_wd_properties.

Variable R : COrdField.

Lemma AbsBig_wdr : Crel_wdr R AbsBig.
Proof.
 red in |- *.
 intros.
 unfold absBig in |- *.
 unfold absBig in H.
 elim X.
 intros H1 H2.
 split.
  assumption.
 case H2.
  intro H3.
  left.
  apply leEq_wdr with y.
   assumption.
  assumption.
 intro H3.
 right.
 apply leEq_wdl with y.
  assumption.
 assumption.
Qed.

Lemma AbsBig_wdl : Crel_wdl R AbsBig.
Proof.
 red in |- *.
 unfold absBig in |- *.
 intros.
 elim X.
 intros H1 H2.
 split.
  astepr x.
  assumption.
 case H2.
  intro H3.
  left.
  astepl x.
  assumption.
 intro H3.
 right.
 astepr ([--]x).
 assumption.
Qed.

Lemma AbsBig_wdr_unfolded : forall x y z : R, AbsBig x y -> y [=] z -> AbsBig x z.
Proof AbsBig_wdr.

Lemma AbsBig_wdl_unfolded : forall x y z : R, AbsBig x y -> x [=] z -> AbsBig z y.
Proof AbsBig_wdl.

End absBig_wd_properties.

Declare Left Step AbsBig_wdl_unfolded.
Declare Right Step AbsBig_wdr_unfolded.

Add Parametric Morphism c : (@AbsSmall c) with signature (@cs_eq (cof_crr c)) ==> (@cs_eq c) ==> iff as AbsSmall_morph_wd.
Proof with try assumption.
 intros x1 x2 xeq y1 y2 yeq.
 split; intro H.
  stepr y1...
  stepl x1...
 symmetry in xeq, yeq.
 stepr y2...
 stepl x2...
Qed.

End COrdAbs.

End CoRN_DOT_algebra_DOT_COrdAbs_WRAPPED.
Module Export CoRN_DOT_algebra_DOT_COrdAbs.
Module Export CoRN.
Module Export algebra.
Module COrdAbs.
Include CoRN_DOT_algebra_DOT_COrdAbs_WRAPPED.COrdAbs.
End COrdAbs.

End algebra.

End CoRN.

End CoRN_DOT_algebra_DOT_COrdAbs.
Export CoRN.model.setoids.Qsetoid.
Import CoRN.algebra.CSemiGroups.

Definition Q_as_CSemiGroup := Build_CSemiGroup _ Qplus_is_bin_fun Qplus_is_assoc.
Export CoRN.algebra.COrdAbs.

Section OrdField_Cauchy.

Variable R : COrdField.

Set Implicit Arguments.
Unset Strict Implicit.
Definition Cauchy_prop (g : nat -> R) : CProp.
Admitted.

Set Strict Implicit.
Unset Implicit Arguments.

Record CauchySeq : Type :=
 {CS_seq   :> nat -> R;
  CS_proof :  Cauchy_prop CS_seq}.
Definition SeqLimit (seq : nat -> R) (lim : R) : CProp.
Admitted.

End OrdField_Cauchy.

Arguments SeqLimit [R].

Record is_CReals (R : COrdField) (lim : CauchySeq R -> R) : CProp :=
  {ax_Lim  : forall s : CauchySeq R, SeqLimit s (lim s);
   ax_Arch : forall x : R, {n : nat | x [<=] nring n}}.

Record CReals : Type :=
  {crl_crr   :> COrdField;
   crl_lim   :  CauchySeq crl_crr -> crl_crr;
   crl_proof :  is_CReals crl_crr crl_lim}.
Definition Lim : forall IR : CReals, CauchySeq IR -> IR.
Admitted.

Arguments Lim [IR].

Lemma ZEROQ_as_rht_unit3 : is_rht_unit (S:=Q_as_CSetoid) Qplus_is_bin_fun 0.
Admitted.

Lemma ZEROQ_as_lft_unit3 : is_lft_unit (S:=Q_as_CSetoid) Qplus_is_bin_fun 0.
Admitted.

Definition Q_is_CMonoid := Build_is_CMonoid
 Q_as_CSemiGroup _ ZEROQ_as_rht_unit3 ZEROQ_as_lft_unit3.

Definition Q_as_CMonoid := Build_CMonoid Q_as_CSemiGroup _ Q_is_CMonoid.

Lemma Q_is_CGroup : is_CGroup Q_as_CMonoid Qopp_is_fun.
Admitted.

Definition Q_as_CGroup := Build_CGroup Q_as_CMonoid Qopp_is_fun Q_is_CGroup.

Lemma Q_is_CAbGroup : is_CAbGroup Q_as_CGroup.
Admitted.

Definition Q_as_CAbGroup := Build_CAbGroup Q_as_CGroup Q_is_CAbGroup.

Definition Q_is_CRing : is_CRing Q_as_CAbGroup 1 Qmult_is_bin_fun.
Admitted.

Definition Q_as_CRing := Build_CRing _ _ _ Q_is_CRing.

Lemma Q_is_CField : is_CField Q_as_CRing Qinv_dep.
Admitted.

Definition Q_as_CField := Build_CField _ _ Q_is_CField Qinv_strext.

Definition Qlt_is_strict_order := Build_strictorder
 Qlt_trans Qlt_is_antisymmetric_unfolded.

Definition Q_is_COrdField := Build_is_COrdField Q_as_CField
 Qlt_is_CSetoid_relation Qle (default_greater Q_as_CField Qlt_is_CSetoid_relation)
 (default_grEq Q_as_CField Qle) Qlt_is_strict_order (fun x y E z => proj2 (Qplus_lt_l x y z) E)
 Qmult_lt_0_compat Qlt_gives_apartness Qle_is_not_lt Qgt_is_lt Qge_is_not_gt.

Definition Q_as_COrdField := Build_COrdField _ _ _ _ _ Q_is_COrdField.

Definition IR : CReals.
Admitted.

Notation PartIR := (PartFunct IR).

Section Rational_sequence_prelogue.

Variable R1 : CReals.

Local Coercion nat_of_P : positive >-> nat.

Lemma den_is_nonzero : forall x : Q_as_COrdField, nring (R:=R1) (Qden x) [#] [0].
Admitted.

Definition inj_Q : Q_as_COrdField -> R1.
 intro x.
Print Options.
 case x.
Print Options.
 intros num0 den0.
Print Options.
 exact (zring num0[/]nring (R:=R1) den0[//]den_is_nonzero (Qmake num0 den0)).
Print Options.
Defined.

End Rational_sequence_prelogue.

Section Max_function.

Variables x y : IR.

Definition MAX : IR.
Admitted.

End Max_function.

Lemma MAX_strext : bin_op_strext _ MAX.
Admitted.

Definition Max := Build_CSetoid_bin_op _ MAX MAX_strext.

Section Minimum.
Definition Min : CSetoid_bin_op IR.
Admitted.

Lemma Min_leEq_lft : forall x y : IR, Min x y [<=] x.
Admitted.

Lemma Min_leEq_rht : forall x y : IR, Min x y [<=] y.
Admitted.

Variables a b : IR.

Lemma Min_leEq_Max : Min a b [<=] Max a b.
Admitted.

End Minimum.
Definition AbsIR : CSetoid_un_op IR.
Admitted.

Definition compact (a b : IR) (Hab : a [<=] b) (x : IR) := a [<=] x and x [<=] b.

Notation Compact := (compact _ _).

Section Definitions_and_Basic_Results.

Variables a b : IR.
Hypothesis Hab : a [<=] b.

Let I := Compact Hab.

Variable F : PartIR.

Let P := Dom F.

Definition Continuous_I := included I P and (forall e, [0] [<] e -> {d : IR | [0] [<] d |
 forall x y, I x -> I y -> forall Hx Hy, AbsIR (x[-]y) [<=] d -> AbsIR (F x Hx[-]F y Hy) [<=] e}).

End Definitions_and_Basic_Results.

Arguments Continuous_I [a b].

Section Integral.

Variables a b : IR.
Hypothesis Hab : a [<=] b.

Variable F : PartIR.
Hypothesis contF : Continuous_I Hab F.

Definition integral_seq : nat -> IR.
Admitted.

Lemma Cauchy_Darboux_Seq : Cauchy_prop integral_seq.
Admitted.

Definition integral := Lim (Build_CauchySeq _ _ Cauchy_Darboux_Seq).

End Integral.

Inductive interval : Type :=
  | realline         : interval
  | openl      : IR -> interval
  | openr      : IR -> interval
  | closel     : IR -> interval
  | closer     : IR -> interval
  | olor : IR -> IR -> interval
  | olcr : IR -> IR -> interval
  | clor : IR -> IR -> interval
  | clcr : IR -> IR -> interval.
Definition iprop (I : interval) (x : IR) : CProp.
exact (match I with
  | realline => True
  | openr b  => x [<] b
  | openl a  => a [<] x
  | closer b => x [<=] b
  | closel a => a [<=] x
  | olor a b => a [<] x and x [<] b
  | olcr a b => a [<] x and x [<=] b
  | clor a b => a [<=] x and x [<] b
  | clcr a b => a [<=] x and x [<=] b
  end).
Print Options.
Defined.

Coercion iprop : interval >-> Funclass.

Lemma iprop_wd : forall I : interval, pred_wd _ I.
Admitted.

Section Functions.
Variable I : interval.

Definition Continuous F := included I (Dom F) and (forall a b (Hab : a [<=] b),
 included (Compact Hab) I -> Continuous_I Hab F).

End Functions.

Section Definitions.

Variables a b : IR.
Hypothesis Hab : Min a b [<=] Max a b.
Variable F : PartIR.

Hypothesis HF : Continuous_I Hab F.

Lemma Integral_inc1 : Continuous_I (Min_leEq_lft a b) F.
Admitted.

Lemma Integral_inc2 : Continuous_I (Min_leEq_rht a b) F.
Admitted.

Definition Integral :=
  integral _ _ (Min_leEq_rht a b) F Integral_inc2[-]integral _ _ (Min_leEq_lft a b) _ Integral_inc1.

End Definitions.

Arguments Integral [a b Hab F].

Section Indefinite_Integral.

Variable I : interval.
Variable F : PartIR.

Hypothesis contF : Continuous I F.

Variable a : IR.
Hypothesis Ha : I a.

Lemma prim_lemma : forall x : IR, I x -> Continuous_I (Min_leEq_Max a x) F.
Admitted.

Lemma Fprim_strext : forall x y Hx Hy,
 Integral (prim_lemma x Hx) [#] Integral (prim_lemma y Hy) -> x [#] y.
Admitted.

Definition Fprim : PartIR.
 apply Build_PartFunct with (pfpfun := fun (x : IR) (Hx : I x) => Integral (prim_lemma x Hx)).
Print Options.
  apply iprop_wd.
Print Options.
 exact Fprim_strext.
Print Options.
Defined.

End Indefinite_Integral.

Arguments Fprim [I F].

Notation "[-S-] F" := (Fprim F) (at level 20).
Fixpoint pi_seq (n : nat) : IR.
Admitted.

Lemma pi_seq_Cauchy : Cauchy_prop pi_seq.
Admitted.

Definition Pi := Two[*]Lim (Build_CauchySeq _ _ pi_seq_Cauchy).

Lemma ArcTan_def_lemma : Continuous realline {1/} ( [-C-][1]{+}FId{^}2).
Admitted.

Definition ArcTang := ( [-S-]ArcTan_def_lemma) [0] I.
Print Options.

Definition ArcTan (x : IR) := ArcTang x I.
Import CoRN.model.totalorder.QMinMax.
Import CoRN.stdlib_omissions.Q.

Set Implicit Arguments.

Section Pi.
Let f (a b:Q) : Q.
exact (let (x,y) := a in
 let (z,w) := b in
 Qred ((x*w + y*z)%Z/(y*w-x*z)%Z)).
Defined.

Definition ArcTan_multiple : forall x, -(1) <= x <= 1 -> forall n,
  sumbool True ((nring n)[*]ArcTan (inj_Q _ x)[=]ArcTan (inj_Q _ (iter_nat n _ (f x) 0))).
 intros x Hx.
Print Options.
 induction n.
Print Options.
  right.
Print Options.
 admit.
Print Options.
 destruct (IHn) as [H|H].
Print Options.
  left; constructor.
Print Options.
 set (y:=(iter_nat n Q (f x) 0)) in *.
Print Options.
 destruct (Qlt_le_dec_fast 1 y) as [_|Y0].
Print Options.
  left; constructor.
Print Options.
 destruct (Qlt_le_dec_fast y (-(1))) as [_|Y1].
Print Options.
  left; constructor.
Print Options.
 destruct (Qeq_dec (1-x*y) 0) as [_|Y2].
Print Options.
  left; constructor.
Print Options.
 right.
Print Options.
 admit.
Print Options.
Defined.

Lemma reflect_right : forall A B (x:{A}+{B}), (match x with left _ => False | right _ => True end) -> B.
Admitted.

Lemma Pi_Formula :
(((nring 44)[*]ArcTan (inj_Q IR (1 /  57%Z))[-]
  (nring 12)[*]ArcTan (inj_Q IR (1 / 682%Z))[+]
  (nring  7)[*]ArcTan (inj_Q IR (1 / 239%Z))[+]
  (nring 24)[*]ArcTan (inj_Q IR (1 / 12943%Z)))[=]
 Pi[/]FourNZ).
Print Options.
 assert (H0:-(1) <= (1/(57%Z)) <= 1).
Print Options.
  split; discriminate.
Print Options.
 set (y0:=(iter_nat 44 _ (f (1/57%Z)) 0)).
Print Options.
 csetoid_replace ((nring 44)[*]ArcTan (inj_Q IR (1 / 57%Z)))
   (ArcTan (inj_Q IR y0)); [|apply: (reflect_right (ArcTan_multiple H0 44)); now vm_compute].
Print Options.
🛠️ Intermediate Coq File (useful for debugging if minimization did not go as far as you wanted)
🛠️ 📜 Intermediate Coq File log (useful for debugging if minimization did not go as far as you wanted)
📜 Build Log (contains the Coq error message) (truncated to last 8.0KiB; full 7.7MiB file on GitHub Actions Artifacts under build.log)
2+flambda/bin:/github/workspace/.venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+++ export COQBIN=/github/workspace/builds/coq/coq-failing/_install_ci/bin/
+++ COQBIN=/github/workspace/builds/coq/coq-failing/_install_ci/bin/
++ CI_BUILD_DIR=/github/workspace/builds/coq/coq-failing/_build_ci
++ declare -A overlays
++ set +x
+ git_download corn
+ local project=corn
+ local dest=/github/workspace/builds/coq/coq-failing/_build_ci/corn
+ local giturl_var=corn_CI_GITURL
+ local giturl=https://github.com/coq-community/corn
+ local ref_var=corn_CI_REF
+ local ref=master
+ local parent_project_var=corn_CI_PARENT_PROJECT
+ local parent_project=
+ local submodule_folder_var=corn_CI_SUBMODULE_FOLDER
+ local submodule_folder=
+ local ov_url=
+ local ov_ref=
++ dirname /github/workspace/builds/coq/coq-failing/_build_ci/corn
+ local dest_prefix=/github/workspace/builds/coq/coq-failing/_build_ci/
+ '[' '' = '' ']'
+ local parent_project_dest=/github/workspace/builds/coq/coq-failing/_build_ci/
+ local parent_project_relative_dest=
+ '[' -d /github/workspace/builds/coq/coq-failing/_build_ci/corn ']'
+ echo 'Warning: download and unpacking of corn skipped because /github/workspace/builds/coq/coq-failing/_build_ci/corn already exists.'
Warning: download and unpacking of corn skipped because /github/workspace/builds/coq/coq-failing/_build_ci/corn already exists.
+ '[' '' ']'
+ export 'COQEXTRAFLAGS=-native-compiler no'
+ COQEXTRAFLAGS='-native-compiler no'
+ cd /github/workspace/builds/coq/coq-failing/_build_ci/corn
+ ./configure.sh
Deprecated environment variable COQLIB, use ROCQLIB instead.
Deprecated environment variable COQCORELIB, use ROCQRUNTIMELIB instead.
+ make
+ '[' -z x ']'
+ command make
ROCQ DEP VFILES
Warning: Deprecated environment variable COQLIB, use ROCQLIB instead.
         [deprecated-coq-env-var,deprecated-since-9.0,deprecated,default]
Warning: Deprecated environment variable COQCORELIB,
         use ROCQRUNTIMELIB instead.
         [deprecated-coq-env-var,deprecated-since-9.0,deprecated,default]
.Makefile.d (real: 0.77, user: 0.19, sys: 0.17, mem: 22732 ko)
ROCQ compile reals/fast/CRpi_fast.v
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin/////rocq
MINIMIZER_DEBUG_EXTRA: original invocation: '' 
MINIMIZER_DEBUG_EXTRA: new invocation: /github/workspace/builds/coq/coq-failing/_install_ci/bin/rocq.orig compile -q -w -deprecated-native-compiler-option -native-compiler no -R /github/workspace/builds/coq/coq-failing/_build_ci/corn CoRN reals/fast/CRpi_fast.v 
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: ocamlpath: /github/workspace/builds/coq/coq-failing/_install_ci/lib:
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/corn
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/rocq.orig compile -q -w -deprecated-native-compiler-option -native-compiler no -R /github/workspace/builds/coq/coq-failing/_build_ci/corn CoRN reals/fast/CRpi_fast.v 
MINIMIZER_DEBUG_EXTRA: coqlib: Warning: Deprecated environment variable COQLIB, use ROCQLIB instead.
/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq//
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.xDzrdtvQfb
MINIMIZER_DEBUG: files:  reals/fast/CRpi_fast.v /github/workspace/builds/coq/coq-failing/_build_ci/corn/reals/fast/CRpi_fast.vWarning, feedback message received but no listener to handle it!
Warning: Deprecated environment variable COQLIB, use ROCQLIB instead.
[deprecated-coq-env-var,deprecated-since-9.0,deprecated,default]Warning, feedback message received but no listener to handle it!
Warning: Deprecated environment variable COQLIB, use ROCQLIB instead.
[deprecated-coq-env-var,deprecated-since-9.0,deprecated,default]
Warning: Deprecated environment variable COQCORELIB,
use ROCQRUNTIMELIB instead.
[deprecated-coq-env-var,deprecated-since-9.0,deprecated,default]
File "./reals/fast/CRpi_fast.v", line 26, characters 0-36:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "./reals/fast/CRpi_fast.v", line 32, characters 0-55:
Warning: Notation "_ = _" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "./reals/fast/CRpi_fast.v", line 32, characters 0-55:
Warning: Notation "_ ≠ _" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "./reals/fast/CRpi_fast.v", line 94, characters 2-45:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 97, characters 3-8:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 100, characters 2-22:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 100, characters 2-22:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 100, characters 2-22:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 100, characters 2-22:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 100, characters 2-22:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 105, characters 1-7:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 105, characters 1-7:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 105, characters 1-7:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 105, characters 1-7:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 105, characters 1-7:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 110, characters 2-50:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 113, characters 2-7:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 120, characters 1-6:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 230, characters 1-154:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 230, characters 1-154:
Error: Stack overflow.

Command exited with non-zero status 1
reals/fast/CRpi_fast.vo (real: 3.56, user: 3.05, sys: 0.27, mem: 1727464 ko)
make[1]: *** [Makefile:815: reals/fast/CRpi_fast.vo] Error 1
make[1]: *** [reals/fast/CRpi_fast.vo] Deleting file 'reals/fast/CRpi_fast.glob'
make: *** [Makefile:411: all] Error 2
+ code=2
+ printf '\n%s exit code: %s\n' corn 2
+ '[' corn '!=' stdlib_test ']'
+ echo 'Aggregating timing log...'
Aggregating timing log...
+ echo

+ tools/make-one-time-file.py --real _build_ci/corn.log
    Time |   Peak Mem | File Name              
-----------------------------------------------
0m04.33s | 1727464 ko | Total Time / Peak Mem  
-----------------------------------------------
0m03.56s | 1727464 ko | reals/fast/CRpi_fast.vo
0m00.77s |   22732 ko | .Makefile.d            
+ '[' '' ']'
+ exit 2
/github/workspace/builds/coq /github/workspace
::endgroup::
📜 🔎 Minimization Log (truncated to last 8.0KiB; full 4.3MiB file on GitHub Actions Artifacts under bug.log)
recated-dirpath-Coq,deprecated-since-9.0,deprecated,default]
File "/tmp/tmpx1oxqpvy/Top/bug_01.v", line 294, characters 0-36:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "/tmp/tmpx1oxqpvy/Top/bug_01.v", line 333, characters 0-55:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "/tmp/tmpx1oxqpvy/Top/bug_01.v", line 343, characters 0-29:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "/tmp/tmpx1oxqpvy/Top/bug_01.v", line 412, characters 35-36:
Error: The reference R was not found in the current environment.


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Admitting definitions unsuccessful.
No successful changes.

I will now attempt to admit lemmas with Admitted with Proof using

Non-fatal error: Failed to admit lemmas and preserve the error.  
The new error was:
Deprecated environment variable COQCORELIB, use ROCQRUNTIMELIB instead.
Warning: Deprecated environment variable COQCORELIB,
use ROCQRUNTIMELIB instead.
[deprecated-coq-env-var,deprecated-since-9.0,deprecated,default]
File "/tmp/tmpl25u2a38/Top/bug_01.v", line 223, characters 0-34:
Warning: Library File Stdlib.ZArith.ZArith_base is deprecated
since Stdlib 9.0. use ZArith instead
[deprecated-library-file-since-Stdlib-9.0,deprecated-since-Stdlib-9.0,deprecated-library-file,deprecated,default]
File "/tmp/tmpl25u2a38/Top/bug_01.v", line 287, characters 7-20:
Warning: Coq.Init.Ltac has been replaced by Corelib.Init.Ltac.
[deprecated-dirpath-Coq,deprecated-since-9.0,deprecated,default]
File "/tmp/tmpl25u2a38/Top/bug_01.v", line 294, characters 0-36:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "/tmp/tmpl25u2a38/Top/bug_01.v", line 333, characters 0-55:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "/tmp/tmpl25u2a38/Top/bug_01.v", line 343, characters 0-29:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "/tmp/tmpl25u2a38/Top/bug_01.v", line 419, characters 35-36:
Error: The reference R was not found in the current environment.


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Admitting lemmas unsuccessful.
No successful changes.

I will now attempt to admit definitions with Admitted with Proof using

Non-fatal error: Failed to admit definitions and preserve the error.  
The new error was:
Deprecated environment variable COQCORELIB, use ROCQRUNTIMELIB instead.
Warning: Deprecated environment variable COQCORELIB,
use ROCQRUNTIMELIB instead.
[deprecated-coq-env-var,deprecated-since-9.0,deprecated,default]
File "/tmp/tmpgm_sykq5/Top/bug_01.v", line 223, characters 0-34:
Warning: Library File Stdlib.ZArith.ZArith_base is deprecated
since Stdlib 9.0. use ZArith instead
[deprecated-library-file-since-Stdlib-9.0,deprecated-since-Stdlib-9.0,deprecated-library-file,deprecated,default]
File "/tmp/tmpgm_sykq5/Top/bug_01.v", line 287, characters 7-20:
Warning: Coq.Init.Ltac has been replaced by Corelib.Init.Ltac.
[deprecated-dirpath-Coq,deprecated-since-9.0,deprecated,default]
File "/tmp/tmpgm_sykq5/Top/bug_01.v", line 294, characters 0-36:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "/tmp/tmpgm_sykq5/Top/bug_01.v", line 333, characters 0-55:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "/tmp/tmpgm_sykq5/Top/bug_01.v", line 343, characters 0-29:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "/tmp/tmpgm_sykq5/Top/bug_01.v", line 409, characters 35-36:
Error: The reference R was not found in the current environment.


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Admitting definitions unsuccessful.
No successful changes.

I will now attempt to admit lemmas with admit. Defined with Proof using

Non-fatal error: Failed to admit lemmas and preserve the error.  
The new error was:
Deprecated environment variable COQCORELIB, use ROCQRUNTIMELIB instead.
Warning: Deprecated environment variable COQCORELIB,
use ROCQRUNTIMELIB instead.
[deprecated-coq-env-var,deprecated-since-9.0,deprecated,default]
File "/tmp/tmpcza4gdp8/Top/bug_01.v", line 223, characters 0-34:
Warning: Library File Stdlib.ZArith.ZArith_base is deprecated
since Stdlib 9.0. use ZArith instead
[deprecated-library-file-since-Stdlib-9.0,deprecated-since-Stdlib-9.0,deprecated-library-file,deprecated,default]
File "/tmp/tmpcza4gdp8/Top/bug_01.v", line 287, characters 7-20:
Warning: Coq.Init.Ltac has been replaced by Corelib.Init.Ltac.
[deprecated-dirpath-Coq,deprecated-since-9.0,deprecated,default]
File "/tmp/tmpcza4gdp8/Top/bug_01.v", line 294, characters 0-36:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "/tmp/tmpcza4gdp8/Top/bug_01.v", line 333, characters 0-55:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "/tmp/tmpcza4gdp8/Top/bug_01.v", line 343, characters 0-29:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "/tmp/tmpcza4gdp8/Top/bug_01.v", line 420, characters 35-36:
Error: The reference R was not found in the current environment.


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Admitting lemmas unsuccessful.
No successful changes.

I will now attempt to admit definitions with admit. Defined with Proof using

Non-fatal error: Failed to admit definitions and preserve the error.  
The new error was:
Deprecated environment variable COQCORELIB, use ROCQRUNTIMELIB instead.
Warning: Deprecated environment variable COQCORELIB,
use ROCQRUNTIMELIB instead.
[deprecated-coq-env-var,deprecated-since-9.0,deprecated,default]
File "/tmp/tmpx1oxqpvy/Top/bug_01.v", line 223, characters 0-34:
Warning: Library File Stdlib.ZArith.ZArith_base is deprecated
since Stdlib 9.0. use ZArith instead
[deprecated-library-file-since-Stdlib-9.0,deprecated-since-Stdlib-9.0,deprecated-library-file,deprecated,default]
File "/tmp/tmpx1oxqpvy/Top/bug_01.v", line 287, characters 7-20:
Warning: Coq.Init.Ltac has been replaced by Corelib.Init.Ltac.
[deprecated-dirpath-Coq,deprecated-since-9.0,deprecated,default]
File "/tmp/tmpx1oxqpvy/Top/bug_01.v", line 294, characters 0-36:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "/tmp/tmpx1oxqpvy/Top/bug_01.v", line 333, characters 0-55:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "/tmp/tmpx1oxqpvy/Top/bug_01.v", line 343, characters 0-29:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "/tmp/tmpx1oxqpvy/Top/bug_01.v", line 412, characters 35-36:
Error: The reference R was not found in the current environment.


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Admitting definitions unsuccessful.
No successful changes.

I will now attempt to add Proof using lines
�[92m
Adding Proof using lines successful.�[0m
Failed to do everything at once; trying one at a time.
Adding Proof using lines unsuccessful.
No successful changes.

I will now attempt to export modules
Module exportation successful

I will now attempt to split imports and exports
Import/Export splitting unsuccessful.

I will now attempt to split := definitions
One-line definition splitting unsuccessful.

I will now attempt to lift Requires to the top of the file while inserting option settings

I will now attempt to lift Requires to the top of the file while inserting option settings

I will now attempt to remove all lines, one at a time

If you have any comments on your experience of the minimizer, please share them in a reply (possibly tagging @JasonGross).
If you believe there's a bug in the bug minimizer, please report it on the bug minimizer issue tracker.

@coqbot-app
Copy link
Contributor

coqbot-app bot commented Feb 28, 2026

🏁 Bench results:

┌─────────────────────────────────────┬───────────────────────────┬─────────────────────────────────────────┬────────────────────────────┐
│                                     │       user time [s]       │            CPU instructions             │   max resident mem [KB]    │
│                                     │                           │                                         │                            │
│            package_name             │   NEW      OLD     PDIFF  │      NEW             OLD         PDIFF  │   NEW       OLD     PDIFF  │
├─────────────────────────────────────┼───────────────────────────┼─────────────────────────────────────────┼────────────────────────────┤
│               coq-engine-bench-lite │  120.48   129.29    -6.81 │   901800930413    961049505607    -6.16 │   870640  1007680   -13.60 │
│             rocq-mathcomp-ssreflect │    1.10     1.13    -2.65 │     7716974947      7723110465    -0.08 │   850428   851840    -0.17 │
│                           rocq-core │    6.62     6.77    -2.22 │    40506876824     40624014343    -0.29 │   448132   444328     0.86 │
│          rocq-metarocq-translations │   16.37    16.74    -2.21 │   115829230736    119120040579    -2.76 │   772552   777340    -0.62 │
│                       coq-fiat-core │   55.96    56.59    -1.11 │   342575534504    343612474049    -0.30 │   480572   484500    -0.81 │
│                 rocq-mathcomp-order │   80.97    81.71    -0.91 │   603113675639    600610825898     0.42 │  1983996  1984124    -0.01 │
│                      rocq-equations │    8.59     8.66    -0.81 │    59489111113     59835947004    -0.58 │   400056   400720    -0.17 │
│                            coq-hott │  157.88   158.80    -0.58 │  1066097574973   1068977600656    -0.27 │   466064   454516     2.54 │
│                           coq-verdi │   43.80    44.04    -0.54 │   290529632642    292693318077    -0.74 │   520160   529024    -1.68 │
│                        rocq-runtime │   74.31    74.62    -0.42 │   542024298290    541953772766     0.01 │   502408   502948    -0.11 │
│                  rocq-mathcomp-boot │   39.80    39.95    -0.38 │   236963234564    234964120855     0.85 │   748756   753692    -0.65 │
│                           rocq-elpi │   15.72    15.76    -0.25 │   110903540365    111004032202    -0.09 │   576720   581108    -0.76 │
│                   coq-iris-examples │  369.36   368.75     0.17 │  2421302807847   2420842617530     0.02 │  1110720  1113116    -0.22 │
│              coq-mathcomp-odd-order │  629.78   628.36     0.23 │  4556843921976   4513122571324     0.97 │  3746064  3751232    -0.14 │
│               rocq-mathcomp-algebra │  349.30   348.37     0.27 │  2626835060014   2611438865421     0.59 │  1633852  1624060     0.60 │
│                    coq-math-classes │   83.83    83.56     0.32 │   510308780950    508821262205     0.29 │   512252   516524    -0.83 │
│               rocq-metarocq-erasure │  483.74   482.09     0.34 │  3323987307632   3297449631344     0.80 │  1812272  1792392     1.11 │
│                            coq-core │    2.67     2.66     0.38 │    18291481692     18287644215     0.02 │    89808    89620     0.21 │
│                           coq-color │  235.11   234.21     0.38 │  1490578040099   1485596712497     0.34 │  1174348  1182920    -0.72 │
│                rocq-metarocq-common │   41.16    40.98     0.44 │   264516319319    264560155081    -0.02 │   919896   929392    -1.02 │
│              rocq-mathcomp-fingroup │   27.62    27.48     0.51 │   180921120387    179719194933     0.67 │   645508   645704    -0.03 │
│                      coq-verdi-raft │  499.85   497.08     0.56 │  3451155597615   3444944862366     0.18 │   824164   825904    -0.21 │
│           rocq-metarocq-safechecker │  337.81   335.84     0.59 │  2493429344242   2479764941872     0.55 │  1778952  1790356    -0.64 │
│              rocq-metarocq-template │   85.25    84.70     0.65 │   585735197591    581153955427     0.79 │  1043652  1059152    -1.46 │
│                 rocq-metarocq-utils │   24.49    24.32     0.70 │   157778833935    157396891556     0.24 │   589492   593000    -0.59 │
│                        rocq-bignums │   26.08    25.84     0.93 │   167385446141    164018607727     2.05 │   477256   460692     3.60 │
│                             coq-vst │  861.42   852.35     1.06 │  6537452328841   6446719211111     1.41 │  2222708  2211528     0.51 │
│              rocq-mathcomp-solvable │  108.53   107.28     1.17 │   766615256111    748966327561     2.36 │  1520336  1534028    -0.89 │
│             rocq-mathcomp-character │  110.23   108.86     1.26 │   803105900470    783553949682     2.50 │  2213460  2221892    -0.38 │
│                 rocq-metarocq-pcuic │  642.83   633.78     1.43 │  4148214305104   4071326913070     1.89 │  2315248  2315116     0.01 │
│                 rocq-mathcomp-field │  205.48   202.25     1.60 │  1590720233336   1545983858183     2.89 │  2945864  2965992    -0.68 │
│               coq-mathcomp-analysis │ 1226.44  1203.99     1.86 │  9381397007798   9096647994367     3.13 │  2640324  2646232    -0.22 │
│                      coq-coquelicot │   40.89    40.05     2.10 │   250888878262    245021717898     2.39 │   839816   839032     0.09 │
│                         coq-coqutil │   48.98    47.00     4.21 │   309050942085    293413846694     5.33 │   587740   568076     3.46 │
│                         rocq-stdlib │  463.43   436.05     6.28 │  1866903079752   1546821108950    20.69 │  1798960   653020   175.48 │
│                         coq-unimath │ 2278.00  1811.89    25.73 │ 19873305767829  15053712798900    32.02 │  1080300  1102240    -1.99 │
│                        coq-bedrock2 │  457.49   363.24    25.95 │  3911967931251   3002206126231    30.30 │ 12559336   883832  1321.01 │
│                 coq-category-theory │  836.03   554.27    50.83 │  6679235055487   4045955102777    65.08 │  2117488   893952   136.87 │
│                        coq-compcert │  479.70   307.47    56.02 │  3806194197307   2019627491278    88.46 │  2416984  1162400   107.93 │
│                        coq-coqprime │   94.63    53.88    75.63 │   738556977417    368032688201   100.68 │  2219980   825924   168.79 │
│          coq-performance-tests-lite │ 2074.62   906.31   128.91 │ 18840544225982   7245502172148   160.03 │  4918912  1232640   299.06 │
│                    coq-fiat-parsers │ 2225.15   279.30   696.69 │ 18750681579703   2136659549020   777.57 │  2596604  2245396    15.64 │
│ coq-neural-net-interp-computed-lite │ 6037.92   238.69  2429.61 │ 60551434234602   2268767205681  2568.91 │  1584636   899396    76.19 │
└─────────────────────────────────────┴───────────────────────────┴─────────────────────────────────────────┴────────────────────────────┘

INFO: failed to install
coq-corn (in NEW)
coq-rewriter (in NEW)
coq-fourcolor (in NEW)

coq-fiat-crypto-with-bedrock (dependency coq-rewriter failed)
coq-rewriter-perf-SuperFast (dependency coq-rewriter failed)

🐢 Top 25 slow downs
┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│                                                              TOP 25 SLOW DOWNS                                                               │
│                                                                                                                                              │
│  OLD      NEW      DIFF       %DIFF      Ln                     FILE                                                                         │
├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│    203     6003  5799.9482    2860.12%      8  coq-neural-net-interp-computed-lite/theories/MaxOfTwoNumbersSimpler/Computed/AllLogits.v.html │
│   36.6     1818  1780.9219    4863.45%    139  coq-fiat-parsers/src/Parsers/Refinement/SharpenedJSON.v.html                                  │
│   38.5      632   593.2239    1541.09%    224  coq-performance-tests-lite/PerformanceExperiments/rewrite_lift_lets_map.v.html                │
│   1.55      278   276.6165   17838.12%     81  coq-category-theory/Theory/Metacategory/DecideExample.v.html                                  │
│  7.438  112.327   104.8890    1410.18%  40843  coq-compcert/cparser/Parser.v.html                                                            │
│   49.0      124    75.2445     153.44%    376  coq-unimath/UniMath/ModelCategories/Generated/LNWFSMonoidalStructure.v.html                   │
│  3.716     71.1    67.3840    1813.35%  40839  coq-compcert/cparser/Parser.v.html                                                            │
│ 0.0301     45.9    45.8248  152409.12%    396  coq-unimath/UniMath/CategoryTheory/Hyperdoctrines/HValuedSets.v.html                          │
│   8.74     38.6    29.8939     342.23%    453  coq-unimath/UniMath/SyntheticHomotopyTheory/Circle2.v.html                                    │
│   1.85     28.8    26.9341    1456.70%     79  coq-fiat-parsers/src/Parsers/Refinement/SharpenedJSON.v.html                                  │
│   1.86     28.8    26.9216    1450.23%     77  coq-fiat-parsers/src/Parsers/Refinement/SharpenedJSON.v.html                                  │
│   1.92     28.7    26.8083    1395.64%     66  coq-fiat-parsers/src/Parsers/Refinement/SharpenedJSON.v.html                                  │
│   1.99     28.7    26.7416    1345.08%     64  coq-fiat-parsers/src/Parsers/Refinement/SharpenedJSON.v.html                                  │
│   24.2     46.3    22.1342      91.41%    550  coq-bedrock2/bedrock2/src/bedrock2Examples/insertionsort.v.html                               │
│   46.4     67.6    21.1718      45.65%    115  coq-bedrock2/bedrock2/src/bedrock2Examples/full_mul.v.html                                    │
│   1.62     22.4    20.7539    1279.74%    322  coq-performance-tests-lite/PerformanceExperiments/rewrite_plus_0_tree.v.html                  │
│   16.7     36.8    20.1405     120.74%    905  coq-unimath/UniMath/ModelCategories/Generated/LNWFSCocomplete.v.html                          │
│   2.49     22.5    19.9946     801.43%    116  coq-bedrock2/bedrock2/src/bedrock2Examples/full_mul.v.html                                    │
│   21.1     40.0    18.9039      89.55%    338  coq-unimath/UniMath/ModelCategories/Generated/LNWFSMonoidalStructure.v.html                   │
│  0.819     15.8    15.0156    1833.51%    603  coq-coqprime/src/Coqprime/elliptic/SMain.v.html                                               │
│ 0.0712     11.9    11.7824   16542.54%    601  coq-unimath/UniMath/AlgebraicTheories/RepresentationTheorem.v.html                            │
│ 0.0733     10.7    10.6663   14559.14%    116  coq-unimath/UniMath/Algebra/GaussianElimination/Tests.v.html                                  │
│   1.08     11.4    10.2814     951.43%    531  coq-performance-tests-lite/src/Nia.v.html                                                     │
│   12.3     22.5    10.1378      82.19%    531  coq-performance-tests-lite/src/Nia.v.html                                                     │
│  0.873     10.9    10.0404    1150.40%    596  coq-coqprime/src/Coqprime/elliptic/SMain.v.html                                               │
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
🐇 Top 25 speed ups
┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│                                                                TOP 25 SPEED UPS                                                                │
│                                                                                                                                                │
│  OLD     NEW     DIFF     %DIFF    Ln                      FILE                                                                                │
├────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│  9.69     2.56  -7.1319  -73.61%    87  coq-engine-bench-lite/coq/PerformanceDemos/quadratic_reduction.v.html                                  │
│  4.18     3.23  -0.9455  -22.62%   492  rocq-stdlib/theories/Reals/Cauchy/ConstructiveCauchyRealsMult.v.html                                   │
│ 0.942    0.326  -0.6159  -65.38%    73  coq-mathcomp-analysis/theories/exp.v.html                                                              │
│ 0.587  0.00160  -0.5856  -99.73%   236  coq-mathcomp-analysis/theories/lebesgue_integral_theory/lebesgue_integral_monotone_convergence.v.html  │
│ 0.599   0.0149  -0.5846  -97.52%   111  coq-mathcomp-analysis/theories/hoelder.v.html                                                          │
│ 0.601   0.0189  -0.5825  -96.86%    77  coq-mathcomp-analysis/theories/lebesgue_integral_theory/lebesgue_integral_dominated_convergence.v.html │
│ 0.592   0.0205  -0.5718  -96.53%   140  coq-mathcomp-analysis/theories/trigo.v.html                                                            │
│ 0.581   0.0115  -0.5698  -98.03%   287  coq-mathcomp-analysis/theories/trigo.v.html                                                            │
│ 0.966    0.402  -0.5645  -58.43%    46  coq-mathcomp-analysis/theories/probability_theory/uniform_distribution.v.html                          │
│ 0.572  0.00877  -0.5629  -98.47%   218  coq-mathcomp-analysis/theories/lebesgue_measure.v.html                                                 │
│ 0.570  0.00768  -0.5619  -98.65%   162  coq-mathcomp-analysis/theories/ftc.v.html                                                              │
│ 0.565  0.00547  -0.5598  -99.03%   293  coq-mathcomp-analysis/theories/hoelder.v.html                                                          │
│  2.58     2.02  -0.5583  -21.67%   123  coq-mathcomp-analysis/theories/lebesgue_integral_theory/lebesgue_Rintegral.v.html                      │
│ 0.578   0.0209  -0.5568  -96.39%   121  coq-mathcomp-analysis/theories/lebesgue_integral_theory/lebesgue_integral_differentiation.v.html       │
│ 0.560  0.00772  -0.5519  -98.62%    74  coq-mathcomp-analysis/theories/lebesgue_integral_theory/lebesgue_integral_monotone_convergence.v.html  │
│ 0.558  0.00669  -0.5512  -98.80%   140  coq-mathcomp-analysis/theories/derive.v.html                                                           │
│  1.72     1.19  -0.5367  -31.17%  2103  coq-fiat-parsers/src/Parsers/BooleanRecognizerOptimized.v.html                                         │
│ 0.535  0.00329  -0.5319  -99.38%   144  coq-mathcomp-analysis/theories/measure_theory/measure_negligible.v.html                                │
│ 0.884    0.354  -0.5301  -59.99%   100  coq-mathcomp-analysis/theories/lebesgue_integral_theory/lebesgue_integral_differentiation.v.html       │
│ 0.631    0.105  -0.5265  -83.39%   186  coq-mathcomp-analysis/theories/lebesgue_integral_theory/measurable_fun_approximation.v.html            │
│ 0.581   0.0564  -0.5248  -90.29%   127  coq-mathcomp-analysis/theories/lebesgue_integral_theory/lebesgue_integral_dominated_convergence.v.html │
│ 0.580   0.0572  -0.5225  -90.13%    69  coq-mathcomp-analysis/theories/lebesgue_integral_theory/measurable_fun_approximation.v.html            │
│ 0.517  0.00796  -0.5086  -98.46%    78  coq-mathcomp-analysis/theories/ess_sup_inf.v.html                                                      │
│ 0.544   0.0372  -0.5066  -93.16%   208  coq-mathcomp-analysis/theories/ereal.v.html                                                            │
│ 0.498  0.00611  -0.4915  -98.77%   404  coq-mathcomp-analysis/theories/numfun.v.html                                                           │
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

@coqbot-app
Copy link
Contributor

coqbot-app bot commented Feb 28, 2026

Minimization interrupted by timeout, being automatically continued. Partially Minimized File /home/runner/work/run-coq-bug-minimizer/run-coq-bug-minimizer/builds/coq/coq-failing/_build_ci/corn/reals/fast/CRpi_fast.v in 5h 15m 7s (from ci-corn) (interrupted by timeout, being automatically continued) (full log on GitHub Actions - verbose log)
⭐ ⏱️ Partially Minimized Coq File (timeout) (truncated to first and last 32KiB; full 107KiB file on GitHub Actions Artifacts under bug.v)
(* -*- mode: coq; coq-prog-args: ("-emacs" "-q" "-w" "-deprecated-native-compiler-option" "-native-compiler" "no" "-coqlib" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq//" "-R" "/github/workspace/builds/coq/coq-failing/_build_ci/corn" "CoRN" "-Q" "/github/workspace/cwd" "Top" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq///user-contrib/Bignums" "Bignums" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq///user-contrib/HB" "HB" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq///user-contrib/Ltac2" "Ltac2" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq///user-contrib/MathClasses" "MathClasses" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq///user-contrib/Stdlib" "Stdlib" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq///user-contrib/elpi" "elpi" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq///user-contrib/elpi_elpi" "elpi_elpi" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq///user-contrib/elpi_examples" "elpi_examples" "-top" "Top.bug_01") -*- *)
(* File reduced by coq-bug-minimizer from original input, then from 362 lines to 68 lines, then from 80 lines to 1074 lines, then from 1081 lines to 78 lines, then from 89 lines to 1725 lines, then from 1732 lines to 96 lines, then from 108 lines to 1195 lines, then from 1202 lines to 99 lines, then from 110 lines to 1587 lines, then from 1594 lines to 117 lines, then from 129 lines to 896 lines, then from 903 lines to 120 lines, then from 131 lines to 1147 lines, then from 1154 lines to 132 lines, then from 143 lines to 1154 lines, then from 1161 lines to 144 lines, then from 155 lines to 1086 lines, then from 1093 lines to 156 lines, then from 167 lines to 1191 lines, then from 1198 lines to 214 lines, then from 225 lines to 1320 lines, then from 1327 lines to 357 lines, then from 362 lines to 135 lines, then from 147 lines to 1975 lines, then from 1982 lines to 145 lines, then from 156 lines to 1770 lines, then from 1777 lines to 210 lines, then from 221 lines to 2049 lines, then from 2056 lines to 242 lines, then from 253 lines to 1745 lines, then from 1752 lines to 244 lines, then from 255 lines to 1816 lines, then from 1823 lines to 259 lines, then from 271 lines to 1478 lines, then from 1485 lines to 296 lines, then from 307 lines to 1721 lines, then from 1728 lines to 315 lines, then from 327 lines to 1175 lines, then from 1182 lines to 317 lines, then from 329 lines to 1252 lines, then from 1258 lines to 346 lines, then from 357 lines to 1685 lines, then from 1692 lines to 555 lines, then from 563 lines to 210 lines, then from 222 lines to 972 lines, then from 978 lines to 220 lines, then from 231 lines to 1055 lines, then from 1062 lines to 248 lines, then from 259 lines to 2033 lines, then from 2038 lines to 311 lines, then from 322 lines to 1621 lines, then from 1627 lines to 331 lines, then from 342 lines to 1683 lines, then from 1690 lines to 368 lines, then from 379 lines to 730 lines, then from 737 lines to 384 lines, then from 395 lines to 750 lines, then from 757 lines to 410 lines, then from 421 lines to 763 lines, then from 770 lines to 418 lines, then from 429 lines to 840 lines, then from 847 lines to 426 lines, then from 437 lines to 767 lines, then from 774 lines to 447 lines, then from 458 lines to 780 lines, then from 787 lines to 455 lines, then from 466 lines to 812 lines, then from 819 lines to 469 lines, then from 480 lines to 1590 lines, then from 1596 lines to 594 lines, then from 604 lines to 310 lines, then from 322 lines to 646 lines, then from 653 lines to 333 lines, then from 344 lines to 1365 lines, then from 1372 lines to 357 lines, then from 368 lines to 680 lines, then from 687 lines to 375 lines, then from 386 lines to 1323 lines, then from 1327 lines to 1009 lines, then from 1020 lines to 2472 lines, then from 2478 lines to 1095 lines, then from 1106 lines to 3016 lines, then from 3017 lines to 2780 lines, then from 2791 lines to 3122 lines, then from 3129 lines to 2998 lines, then from 3005 lines to 2805 lines, then from 2817 lines to 3217 lines, then from 3223 lines to 2906 lines, then from 2917 lines to 4126 lines, then from 4133 lines to 3112 lines, then from 3123 lines to 4291 lines, then from 4292 lines to 4398 lines *)
(* coqc version 9.3+alpha compiled with OCaml 4.14.2
   coqtop version 9.3+alpha
   Expected coqc runtime on this file: 4.365 sec
   Expected coqc peak memory usage on this file: 6191548.0 kb *)









Require CoRN.tactics.Step.
Require Corelib.Relations.Relation_Definitions.
Require Corelib.Classes.Morphisms.
Require Corelib.BinNums.NatDef.
Require Corelib.Init.Ltac.
Require Corelib.Program.Utils.
Require Corelib.Classes.Equivalence.
Require Corelib.BinNums.IntDef.
Require Corelib.BinNums.PosDef.
Require Corelib.Init.Sumbool.
Require Corelib.Numbers.BinNums.
Require Corelib.Lists.ListDef.
Require Corelib.Program.Wf.
Require Corelib.Classes.RelationClasses.
Require Corelib.Classes.Morphisms_Prop.
Require Corelib.Program.Basics.
Require Corelib.Classes.SetoidTactics.
Require Corelib.Setoids.Setoid.
Require Corelib.Init.Wf.
Require Corelib.Program.Tactics.
Require MathClasses.theory.CoqStreams.
Require Stdlib.Classes.DecidableClass.
Require Stdlib.Logic.Decidable.
Require Stdlib.Logic.EqdepFacts.
Require Stdlib.Logic.FunctionalExtensionality.
Require Stdlib.Logic.HLevelsBase.
Require Stdlib.Program.Syntax.
Require Stdlib.Unicode.Utf8_core.
Require Stdlib.micromega.ZifyClasses.
Require Stdlib.setoid_ring.Algebra_syntax.
Require Stdlib.BinNums.IntDef.
Require Stdlib.BinNums.PosDef.
Require Stdlib.BinNums.NatDef.
Require Stdlib.Classes.Morphisms.
Require Stdlib.Classes.RelationClasses.
Require Stdlib.Classes.Equivalence.
Require Stdlib.Classes.SetoidTactics.
Require Stdlib.Classes.Morphisms_Prop.
Require Stdlib.Init.Wf.
Require Stdlib.Init.Sumbool.
Require Stdlib.Lists.ListDef.
Require Stdlib.Logic.Eqdep.
Require Stdlib.Logic.Eqdep_dec.
Require Stdlib.Logic.ProofIrrelevanceFacts.
Require Stdlib.Numbers.BinNums.
Require Stdlib.Program.Basics.
Require Stdlib.Program.Tactics.
Require Stdlib.Program.Utils.
Require Stdlib.Program.Wf.
Require Stdlib.Relations.Relation_Definitions.
Require Stdlib.Setoids.Setoid.
Require Stdlib.Unicode.Utf8.
Require CoRN.tactics.CornTac.
Require Stdlib.Bool.Bool.
Require Stdlib.Logic.JMeq.
Require Stdlib.Logic.ProofIrrelevance.
Require Stdlib.Relations.Relation_Operators.
Require Stdlib.Program.Combinators.
Require Stdlib.Relations.Operators_Properties.
Require Stdlib.PArith.BinPosDef.
Require Stdlib.Relations.Relations.
Require Stdlib.Program.Equality.
Require Stdlib.Numbers.NumPrelude.
Require Stdlib.Program.WfExtensionality.
Require MathClasses.misc.stdlib_hints.
Require Stdlib.Structures.Equalities.
Require Stdlib.Program.Subset.
Require Stdlib.Structures.Orders.
Require Stdlib.Structures.OrdersTac.
Require Stdlib.Structures.OrdersFacts.
Require Stdlib.Structures.GenericMinMax.
Require Stdlib.Program.Program.
Require Stdlib.Numbers.NatInt.NZAxioms.
Require Stdlib.Numbers.NatInt.NZBase.
Require Stdlib.Numbers.NatInt.NZAdd.
Require Stdlib.Numbers.NatInt.NZMul.
Require Stdlib.Numbers.NatInt.NZOrder.
Require Stdlib.Numbers.NatInt.NZAddOrder.
Require Stdlib.Numbers.NatInt.NZMulOrder.
Require MathClasses.interfaces.canonical_names.
Require Stdlib.Numbers.NatInt.NZDiv.
Require Stdlib.Numbers.NatInt.NZGcd.
Require Stdlib.Numbers.NatInt.NZParity.
Require Stdlib.Numbers.NatInt.NZPow.
Require Stdlib.Numbers.NatInt.NZSqrt.
Require MathClasses.misc.propholds.
Require MathClasses.misc.setoid_tactics.
Require MathClasses.misc.util.
Require Stdlib.Numbers.NatInt.NZLog.
Require MathClasses.misc.workarounds.
Require Stdlib.Numbers.NatInt.NZBits.
Require MathClasses.misc.decision.
Require Stdlib.Numbers.Integer.Abstract.ZAxioms.
Require Stdlib.Numbers.Natural.Abstract.NAxioms.
Require Stdlib.Numbers.Integer.Abstract.ZBase.
Require Stdlib.Numbers.Natural.Abstract.NBase.
Require Stdlib.Numbers.Integer.Abstract.ZAdd.
Require Stdlib.Numbers.Natural.Abstract.NAdd.
Require Stdlib.Numbers.Integer.Abstract.ZMul.
Require Stdlib.Numbers.Natural.Abstract.NOrder.
Require MathClasses.interfaces.abstract_algebra.
Require Stdlib.Numbers.Integer.Abstract.ZLt.
Require Stdlib.Numbers.Natural.Abstract.NAddOrder.
Require MathClasses.interfaces.orders.
Require Stdlib.Numbers.Integer.Abstract.ZAddOrder.
Require Stdlib.Numbers.Natural.Abstract.NMulOrder.
Require CoRN.algebra.RSetoid.
Require Stdlib.Numbers.Integer.Abstract.ZMulOrder.
Require Stdlib.Numbers.Natural.Abstract.NSub.
Require CoRN.order.PartialOrder.
Require Stdlib.Numbers.Integer.Abstract.ZMaxMin.
Require Stdlib.Numbers.Integer.Abstract.ZParity.
Require Stdlib.Numbers.Integer.Abstract.ZSgnAbs.
Require Stdlib.Numbers.Natural.Abstract.NDiv.
Require Stdlib.Numbers.Natural.Abstract.NGcd.
Require Stdlib.Numbers.Natural.Abstract.NMaxMin.
Require Stdlib.Numbers.Natural.Abstract.NParity.
Require Stdlib.Numbers.Natural.Abstract.NSqrt.
Require CoRN.order.SemiLattice.
Require Stdlib.Numbers.Integer.Abstract.ZDivFloor.
Require Stdlib.Numbers.Integer.Abstract.ZDivTrunc.
Require Stdlib.Numbers.Integer.Abstract.ZGcd.
Require Stdlib.Numbers.Natural.Abstract.NDiv0.
Require Stdlib.Numbers.Natural.Abstract.NPow.
Require CoRN.order.Lattice.
Require Stdlib.Numbers.Integer.Abstract.ZPow.
Require Stdlib.Numbers.Natural.Abstract.NLcm.
Require Stdlib.Numbers.Natural.Abstract.NLog.
Require CoRN.order.TotalOrder.
Require Stdlib.Numbers.Integer.Abstract.ZBits.
Require Stdlib.Numbers.Integer.Abstract.ZLcm.
Require Stdlib.Numbers.Natural.Abstract.NBits.
Require Stdlib.Numbers.Natural.Abstract.NLcm0.
Require Stdlib.Numbers.Integer.Abstract.ZProperties.
Require Stdlib.Numbers.Natural.Abstract.NProperties.
Require Stdlib.Arith.PeanoNat.
Require Stdlib.Arith.Between.
Require Stdlib.Arith.Compare_dec.
Require Stdlib.Arith.EqNat.
Require Stdlib.Arith.Factorial.
Require Stdlib.Arith.Wf_nat.
Require Stdlib.Arith.Euclid.
Require Stdlib.Arith.Peano_dec.
Require Stdlib.Lists.List.
Require Stdlib.Lists.ListDec.
Require Stdlib.micromega.Refl.
Require Stdlib.Lists.Finite.
Require Stdlib.micromega.Tauto.
Require CoRN.stdlib_omissions.Pair.
Require Stdlib.Lists.ListTactics.
Require Stdlib.Sorting.Permutation.
Require Stdlib.PArith.BinPos.
Require Stdlib.Arith.Arith_base.
Require Stdlib.PArith.POrderedType.
Require Stdlib.PArith.Pnat.
Require Stdlib.NArith.BinNatDef.
Require Stdlib.PArith.PArith.
Require Stdlib.NArith.BinNat.
Require Stdlib.setoid_ring.BinList.
Require Stdlib.NArith.Ndiv_def.
Require Stdlib.NArith.Ngcd_def.
Require Stdlib.NArith.Nsqrt_def.
Require Stdlib.setoid_ring.Ring_theory.
Require Stdlib.NArith.Nnat.
Require Stdlib.ZArith.BinIntDef.
Require Stdlib.NArith.NArith_base.
Require Stdlib.ZArith.BinInt.
Require Stdlib.ZArith.Zcompare.
Require Stdlib.ZArith.Zeven.
Require Stdlib.ZArith.auxiliary.
Require Stdlib.ZArith.Zpow_def.
Require Stdlib.setoid_ring.Ncring.
Require Stdlib.micromega.Env.
Require Stdlib.micromega.VarMap.
Require Stdlib.micromega.EnvRing.
Require Stdlib.setoid_ring.Ring_polynom.
Require Stdlib.setoid_ring.InitialRing.
Require Stdlib.ZArith.Znat.
Require Stdlib.ZArith.Zorder.
Require Stdlib.setoid_ring.Ncring_polynom.
Require Stdlib.setoid_ring.Ring_tac.
Require Stdlib.ZArith.Zmax.
Require Stdlib.ZArith.Zmin.
Require Stdlib.ZArith.Zminmax.
Require Stdlib.ZArith.Zmisc.
Require Stdlib.omega.OmegaLemmas.
Require Stdlib.setoid_ring.Ncring_initial.
Require Stdlib.setoid_ring.Ring_base.
Require Stdlib.micromega.ZifyInst.
Require Stdlib.setoid_ring.Field_theory.
Require Stdlib.setoid_ring.Ncring_tac.
Require Stdlib.setoid_ring.Ring.
Require Stdlib.ZArith.ZArith_dec.
Require Stdlib.micromega.OrderedRing.
Require Stdlib.micromega.Zify.
Require Stdlib.setoid_ring.Field_tac.
Require Stdlib.setoid_ring.NArithRing.
Require Stdlib.setoid_ring.ZArithRing.
Require Stdlib.ZArith.Wf_Z.
Require Stdlib.omega.PreOmega.
Require Stdlib.setoid_ring.ArithRing.
Require Stdlib.setoid_ring.Cring.
Require Stdlib.setoid_ring.Field.
Require Stdlib.ZArith.Zbool.
Require Stdlib.setoid_ring.Integral_domain.
Require Stdlib.ZArith.Zabs.
Require Stdlib.nsatz.NsatzTactic.
Require Stdlib.NArith.NArith.
Require Stdlib.micromega.RingMicromega.
Require Stdlib.ZArith.Zhints.
Require Stdlib.Arith.Arith.
Require Stdlib.micromega.ZMicromega.
Require Stdlib.QArith.QArith_base.
Require Stdlib.ZArith.ZArith_base.
Require CoRN.stdlib_omissions.P.
Require Stdlib.QArith.Qreduction.
Require CoRN.stdlib_omissions.List.
Require CoRN.util.SetoidPermutation.
Require Stdlib.QArith.Qfield.
Require Stdlib.QArith.Qring.
Require Stdlib.ZArith.Zcomplements.
Require Stdlib.QArith.Qpower.
Require Stdlib.ZArith.Zdiv.
Require Stdlib.ZArith.Zpower.
Require Stdlib.micromega.Lia.
Require Stdlib.QArith.QNsatz.
Require Stdlib.QArith.Qround.
Require Stdlib.btauto.Algebra.
Require Stdlib.btauto.Reflect.
Require Stdlib.btauto.Btauto.
Require Stdlib.QArith.QArith.
Require Stdlib.ZArith.ZNsatz.
Require Stdlib.QArith.Qabs.
Require Stdlib.ZArith.Zbitwise.
Require Stdlib.micromega.ZArith_hints.
Require Stdlib.ZArith.Zdivisibility.
Require Stdlib.ZArith.Zcong.
Require Stdlib.ZArith.Zdiv_facts.
Require Stdlib.ZArith.ZModOffset.
Require Stdlib.ZArith.Znumtheory.
Require CoRN.model.totalorder.QMinMax.
Require Stdlib.ZArith.ZArith.
Require CoRN.stdlib_omissions.Z.
Require CoRN.logic.CornBasics.
Require CoRN.logic.CLogic.
Require CoRN.model.Zmod.ZBasics.
Require CoRN.model.structures.Nsec.
Require CoRN.model.structures.Zsec.
Require CoRN.tactics.AlgReflection.
Require CoRN.model.Zmod.ZDivides.
Require CoRN.model.Zmod.ZGcd.
Require CoRN.model.Zmod.ZMod.
Require CoRN.model.Zmod.Cmod.
Require CoRN.stdlib_omissions.Q.
Require CoRN.model.structures.Qsec.
Require CoRN.algebra.CSetoids.
Require CoRN.algebra.CSetoidFun.
Require CoRN.algebra.CSetoidInc.
Require CoRN.tactics.csetoid_rewrite.
Require CoRN.algebra.CSemiGroups.
Require CoRN.algebra.CMonoids.
Require CoRN.algebra.CAbMonoids.
Require CoRN.algebra.CGroups.
Require CoRN.algebra.CAbGroups.
Require CoRN.algebra.CSums.
Require CoRN.algebra.CRings.

Module Export AdmitTactic.
Module Import LocalFalse.
Inductive False : Prop := .
End LocalFalse.
Axiom proof_admitted : False.
Import Coq.Init.Ltac.
Tactic Notation "admit" := abstract case proof_admitted.
End AdmitTactic.

Module Export CoRN_DOT_algebra_DOT_CFields_WRAPPED.
Module Export CFields.







Export CoRN.algebra.CRings.

Transparent sym_eq.
Transparent f_equal.

Transparent cs_crr.
Transparent csg_crr.
Transparent cm_crr.
Transparent cg_crr.
Transparent cr_crr.

Transparent csf_fun.
Transparent csbf_fun.
Transparent csr_rel.

Transparent cs_eq.
Transparent cs_neq.
Transparent cs_ap.
Transparent cm_unit.
Definition is_CField (R : CRing) (cf_rcpcl : forall x : R, x [#] [0] -> R) : Prop. exact (forall x Hx, is_inverse cr_mult [1] x (cf_rcpcl x Hx)). Defined.

Record CField : Type :=
  {cf_crr   :> CRing;
   cf_rcpcl :  forall x : cf_crr, x [#] [0] -> cf_crr;
   cf_proof :  is_CField cf_crr cf_rcpcl;
   cf_rcpsx :  forall x y x_ y_, cf_rcpcl x x_ [#] cf_rcpcl y y_ -> x [#] y}.


Definition f_rcpcl' (F : CField) : PartFunct F.
Proof.
 apply Build_PartFunct with (fun x : F => x [#] [0]) (cf_rcpcl F).
  red in |- *; intros; astepl x.
auto.
  exact (cf_rcpsx F).
Defined.

Definition f_rcpcl F x x_ := f_rcpcl' F x x_.

Arguments f_rcpcl [F].



Definition cf_div (F : CField) (x y : F) y_ : F := x[*]f_rcpcl y y_.

Arguments cf_div [F].
Notation "x [/] y [//] Hy" := (cf_div x y Hy) (at level 80).


Section Field_axioms.
Variable F : CField.

Lemma rcpcl_is_inverse : forall x x_, is_inverse cr_mult [1] x (cf_rcpcl F x x_).
Admitted.

End Field_axioms.

Section Field_basics.


Variable F : CField.

Lemma rcpcl_is_inverse_unfolded : forall x x_, x[*]cf_rcpcl F x x_ [=] [1].
Admitted.

Lemma field_mult_inv : forall (x : F) x_, x[*]f_rcpcl x x_ [=] [1].
Proof rcpcl_is_inverse_unfolded.
Hint Resolve field_mult_inv: algebra.

Lemma field_mult_inv_op : forall (x : F) x_, f_rcpcl x x_[*]x [=] [1].
Proof.
 intros x x_.
 elim (rcpcl_is_inverse F x x_); auto.
Qed.

End Field_basics.

#[global]
Hint Resolve field_mult_inv field_mult_inv_op: algebra.

Section Field_multiplication.


Variable F : CField.

Lemma mult_resp_ap_zero : forall x y : F, x [#] [0] -> y [#] [0] -> x[*]y [#] [0].
Proof.
 intros x y Hx Hy.
 apply cring_mult_ap_zero with (f_rcpcl y Hy).
 astepl x.
  auto.
 astepl (x[*][1]).
 eapply eq_transitive_unfolded.
  2: apply CRings.mult_assoc.
 algebra.
Qed.

Lemma mult_lft_resp_ap : forall x y z : F, x [#] y -> z [#] [0] -> z[*]x [#] z[*]y.
Proof.
 intros x y z H Hz.
 apply zero_minus_apart.
 unfold cg_minus in |- *.
 astepl (z[*]x[+]z[*][--]y).
 astepl (z[*] (x[+][--]y)).
 astepl (z[*] (x[-]y)).
 apply mult_resp_ap_zero; algebra.
Qed.

Lemma mult_rht_resp_ap : forall x y z : F, x [#] y -> z [#] [0] -> x[*]z [#] y[*]z.
Proof.
 intros x y z H Hz.
 astepl (z[*]x).
 astepr (z[*]y).
 apply mult_lft_resp_ap; assumption.
Qed.

Lemma mult_resp_neq_zero : forall x y : F, x[~=][0] -> y[~=][0] -> x[*]y[~=][0].
Proof.
 intros x y Hx Hy.
 cut (~ Not (x [#] [0])).
  intro H.
  cut (~ Not (y [#] [0])).
   intro H0.
   apply notnot_ap_imp_neq.
   cut (x [#] [0] -> y [#] [0] -> x[*]y [#] [0]).
    intro H1.
    intro.
    apply H0; intro H3.
    apply H; intro H4.
    apply H2; auto.
   intros; apply mult_resp_ap_zero; auto.
  apply neq_imp_notnot_ap; auto.
 apply neq_imp_notnot_ap; auto.
Qed.

Lemma mult_resp_neq : forall x y z : F, x[~=]y -> z[~=][0] -> x[*]z[~=]y[*]z.
Proof.
 intros x y z H Hz.
 generalize (neq_imp_notnot_ap _ _ _ H).
 generalize (neq_imp_notnot_ap _ _ _ Hz).
 generalize (mult_rht_resp_ap x y z).
 intros H1 H2 H3.
 apply notnot_ap_imp_neq.
 intro H4.
 apply H2; intro.
 apply H3; intro.
 apply H4.
 auto.
Qed.

Lemma mult_eq_zero : forall x y : F, x[~=][0] -> x[*]y [=] [0] -> y [=] [0].
Proof.
 intros x y Hx Hxy.
 apply not_ap_imp_eq.
 intro H.
 elim (eq_imp_not_neq _ _ _ Hxy).
 apply mult_resp_neq_zero.
  assumption.
 apply ap_imp_neq.
 assumption.
Qed.

Lemma mult_cancel_lft : forall x y z : F, z [#] [0] -> z[*]x [=] z[*]y -> x [=] y.
Proof.
 intros x y z Hz H.
 apply not_ap_imp_eq.
 intro H2.
 elim (eq_imp_not_ap _ _ _ H).
 apply mult_lft_resp_ap; assumption.
Qed.

Lemma mult_cancel_rht : forall x y z : F, z [#] [0] -> x[*]z [=] y[*]z -> x [=] y.
Proof.
 intros x y z Hz H.
 apply (mult_cancel_lft x y z).
  assumption.
 astepr (y[*]z).
 Step_final (x[*]z).
Qed.

Lemma square_eq_aux : forall x a : F, x[^]2 [=] a[^]2 -> (x[+]a) [*] (x[-]a) [=] [0].
Proof.
 intros x a H.
 astepl (x[^]2[-]a[^]2).
 Step_final (a[^]2[-]a[^]2).
Qed.

Lemma square_eq_weak : forall x a : F, x[^]2 [=] a[^]2 -> Not (x [#] a and x [#] [--]a).
Proof.
 intros x a H.
 intro H0.
 elim H0; intros H1 H2.
 generalize (square_eq_aux _ _ H); intro H3.
 generalize (eq_imp_not_ap _ _ _ H3); intro H4.
 apply H4.
 apply mult_resp_ap_zero.
  astepr ([--]a[+]a).
apply op_rht_resp_ap.
auto.
  astepr (a[-]a).
 apply minus_resp_ap_rht.
 assumption.
Qed.

Lemma cond_square_eq : forall x a : F,
 (Two:F) [#] [0] -> a [#] [0] -> x[^]2 [=] a[^]2 -> x [=] a or x [=] [--]a.
Proof.
 intros x a H Ha H0.
 cut (a [#] [--]a).
  intro H1.
  elim (ap_cotransitive_unfolded _ _ _ H1 x); intro H2.
   right.
   apply not_ap_imp_eq.
   intro H3.
   elim (square_eq_weak _ _ H0).
   split; auto.
   apply ap_symmetric_unfolded; auto.
  left.
  apply not_ap_imp_eq.
  intro H3.
  elim (square_eq_weak _ _ H0); auto.
 apply plus_cancel_ap_lft with a.
 astepr ([0]:F).
 astepl (Two[*]a).
 apply mult_resp_ap_zero; auto.
Qed.
End Field_multiplication.

Section x_square.
Lemma x_xminone : forall (F : CField) (x : F), x[^]2 [=] x -> x[*] (x[-][1]) [=] [0].
Proof.
 intros H x h.
 astepl (x[*]x[-]x[*][1]).
 astepl (x[*]x[-]x).
 apply cg_cancel_rht with x.
 astepl (x[*]x[+][--]x[+]x).
 astepl (x[*]x[+]([--]x[+]x)).
 astepl (x[*]x[+][0]).
 astepl (x[*]x).
 astepr x.
 astepl (x[^]2).
 exact h.
Qed.

Lemma square_id : forall (F : CField) (x : F), x[^]2 [=] x -> {x [=] [0]} + {x [=] [1]}.
Proof.
 intros F x H.
 cut (([0]:F) [#] ([1]:F)).
  intro H0.
  elim (ap_cotransitive_unfolded _ _ _ H0 x).
   intro H1.
   right.
   apply not_ap_imp_eq.
   red in |- *.
   intro H2.
   set (H3 := minus_resp_ap_rht F x [1] [1] H2) in *.
   set (H4 := ap_wdr_unfolded F (x[-][1]) ([1][-][1]) [0] H3 (cg_minus_correct F [1])) in *.
   set (H5 := ap_symmetric_unfolded F [0] x H1) in *.
   set (H6 := mult_resp_ap_zero F x (x[-][1]) H5 H4) in *.
   simpl in |- *.
   set (H7 := x_xminone F x H) in *.
   set (H8 := eq_imp_not_ap F (x[*] (x[-][1])) [0] H7) in *.
   intuition.
  left.
  apply not_ap_imp_eq.
  red in |- *.
  intro H2.
  set (H3 := minus_resp_ap_rht F x [1] [1] b) in *.
  set (H4 := ap_wdr_unfolded F (x[-][1]) ([1][-][1]) [0] H3 (cg_minus_correct F [1])) in *.
  set (H6 := mult_resp_ap_zero F x (x[-][1]) H2 H4) in *.
  set (H7 := x_xminone F x H) in *.
  set (H8 := eq_imp_not_ap F (x[*] (x[-][1])) [0] H7) in *.
  intuition.
 apply ap_symmetric_unfolded.
 apply ring_non_triv.
Qed.
End x_square.

#[global]
Hint Resolve mult_resp_ap_zero: algebra.

Section Rcpcl_properties.


Variable F : CField.

Lemma inv_one : f_rcpcl [1] (ring_non_triv F) [=] [1].
Proof.
 astepl ([1][*]f_rcpcl [1] (ring_non_triv F)).
 apply field_mult_inv.
Qed.

Lemma f_rcpcl_wd : forall (x y : F) x_ y_, x [=] y -> f_rcpcl x x_ [=] f_rcpcl y y_.
Proof.
 intros x y H.
 unfold f_rcpcl in |- *; algebra.
Qed.

Lemma f_rcpcl_mult : forall (y z : F) y_ z_ yz_,
 f_rcpcl (y[*]z) yz_ [=] f_rcpcl y y_[*]f_rcpcl z z_.
Proof.
 intros y z nzy nzz nzyz.
 apply mult_cancel_lft with (y[*]z).
  assumption.
 astepl ([1]:F).
 astepr (y[*]z[*] (f_rcpcl z nzz[*]f_rcpcl y nzy)).
 astepr (y[*] (z[*] (f_rcpcl z nzz[*]f_rcpcl y nzy))).
 astepr (y[*] (z[*]f_rcpcl z nzz[*]f_rcpcl y nzy)).
 astepr (y[*] ([1][*]f_rcpcl y nzy)).
 astepr (y[*]f_rcpcl y nzy).
 Step_final ([1]:F).
Qed.

Lemma f_rcpcl_resp_ap_zero : forall (y : F) y_, f_rcpcl y y_ [#] [0].
Proof.
 intros y nzy.
 apply cring_mult_ap_zero_op with y.
 astepl ([1]:F).
apply one_ap_zero.
Qed.

Lemma f_rcpcl_f_rcpcl : forall (x : F) x_ r_, f_rcpcl (f_rcpcl x x_) r_ [=] x.
Proof.
 intros x nzx nzr.
 apply mult_cancel_rht with (f_rcpcl x nzx).
  assumption.
 astepr ([1]:F).
 Step_final (f_rcpcl x nzx[*]f_rcpcl (f_rcpcl x nzx) nzr).
Qed.

End Rcpcl_properties.

Section MultipGroup.


Variable F : CField.



Definition NonZeroMonoid : CMonoid := Build_SubCMonoid
 (Build_multCMonoid F) (nonZeroP (M:=F)) (one_ap_zero F) (mult_resp_ap_zero F).

Definition fmg_cs_inv : CSetoid_un_op NonZeroMonoid.
Proof.
 red in |- *.
 cut (forall x : NonZeroMonoid, nonZeroP (cf_rcpcl F (scs_elem _ _ x) (scs_prf _ _ x))).
  intro H.
  apply Build_CSetoid_fun with (fun x : NonZeroMonoid =>
    Build_subcsetoid_crr _ _ (cf_rcpcl F (scs_elem _ _ x) (scs_prf _ _ x)) (H x)).
  red in |- *.
  simpl in |- *.
  simple destruct x; simple destruct y.
intros scs_elem0 scs_prf0 H0.
  apply (cf_rcpsx _ _ _ _ _ H0).
 intro; simpl in |- *.
 red in |- *.
 astepl (f_rcpcl (scs_elem _ _ x) (scs_prf _ _ x)).
 apply f_rcpcl_resp_ap_zero.
Defined.

Lemma plus_nonzeros_eq_mult_dom : forall x y : NonZeroMonoid,
 scs_elem _ _ (x[+]y) [=] scs_elem _ _ x[*]scs_elem _ _ y.
Proof.
 simple destruct x; simple destruct y; algebra.
Qed.

Lemma cfield_to_mult_cgroup : CGroup.
Proof.
 apply (Build_CGroup NonZeroMonoid fmg_cs_inv).
 intro x.
 red in |- *.
 elim x; intros x_ Hx.
 simpl in |- *; apply cf_proof.
Qed.

End MultipGroup.

Section Div_properties.


Variable F : CField.

Lemma div_prop : forall (x : F) x_, ([0][/] x[//]x_) [=] [0].
Proof.
 unfold cf_div in |- *; algebra.
Qed.

Lemma div_1 : forall (x y : F) y_, (x[/] y[//]y_) [*]y [=] x.
Proof.
 intros x y y_.
 astepl (x[*]f_rcpcl y y_[*]y).
 astepl (x[*] (f_rcpcl y y_[*]y)).
 Step_final (x[*][1]).
Qed.

Lemma div_1' : forall (x y : F) y_, y[*] (x[/] y[//]y_) [=] x.
Proof.
 intros x y y_.
 astepl ((x[/] y[//]y_) [*]y).
 apply div_1.
Qed.

Lemma div_1'' : forall (x y : F) y_, (x[*]y[/] y[//]y_) [=] x.
Proof.
 intros x y y_.
 unfold cf_div in |- *.
 astepl (y[*]x[*]f_rcpcl y y_).
 astepl (y[*] (x[*]f_rcpcl y y_)).
 change (y[*] (x[/] y[//]y_) [=] x) in |- *.
 apply div_1'.
Qed.

Hint Resolve div_1: algebra.

Lemma x_div_x : forall (x : F) x_, (x[/] x[//]x_) [=] [1].
Proof.
 intros x x_.
 unfold cf_div in |- *.
 apply field_mult_inv.
Qed.

Hint Resolve x_div_x: algebra.

Lemma x_div_one : forall x : F, (x[/] [1][//]ring_non_triv F) [=] x.
Proof.
 intro x.
 unfold cf_div in |- *.
 generalize inv_one; intro H.
 astepl (x[*][1]).
 apply mult_one.
Qed.



Lemma x_mult_y_div_z : forall (x y z : F) z_, x[*] (y[/] z[//]z_) [=] (x[*]y[/] z[//]z_).
Proof.
 unfold cf_div in |- *; algebra.
Qed.

Hint Resolve x_mult_y_div_z: algebra.

Lemma div_wd : forall (x x' y y' : F) y_ y'_, x [=] x' -> y [=] y' -> (x[/] y[//]y_) [=] (x'[/] y'[//]y'_).
Proof.
 intros x x' y y' nzy nzy' H H0.
 unfold cf_div in |- *.
 cut (f_rcpcl y nzy [=] f_rcpcl y' nzy').
  intro H1.
  algebra.
 apply f_rcpcl_wd.
 assumption.
Qed.

Hint Resolve div_wd: algebra_c.



Lemma div_div : forall (x y z : F) y_ z_ yz_, ((x[/] y[//]y_) [/] z[//]z_) [=] (x[/] y[*]z[//]yz_).
Proof.
 intros x y z nzy nzz nzyz.
 unfold cf_div in |- *.
 astepl (x[*] (f_rcpcl y nzy[*]f_rcpcl z nzz)).
 apply mult_wdr.
 apply eq_symmetric_unfolded.
 apply f_rcpcl_mult.
Qed.

Lemma div_resp_ap_zero_rev : forall (x y : F) y_, x [#] [0] -> (x[/] y[//]y_) [#] [0].
Proof.
 intros x y nzy Hx.
 unfold cf_div in |- *.
 apply mult_resp_ap_zero.
  assumption.
 apply f_rcpcl_resp_ap_zero.
Qed.

Lemma div_resp_ap_zero : forall (x y : F) y_, (x[/] y[//]y_) [#] [0] -> x [#] [0].
Proof.
 intros x y nzy Hxy.
 astepl ((x[/] y[//]nzy) [*]y).
algebra.
Qed.



Lemma div_div2 : forall (x y z : F) y_ z_ yz_, (x[/] y[/] z[//]z_[//]yz_) [=] (x[*]z[/] y[//]y_).
Proof.
 intros x y z nzy nzz nzyz.
 unfold cf_div in |- *.
 astepr (x[*] (z[*]f_rcpcl y nzy)).
 apply mult_wdr.
 cut (f_rcpcl z nzz [#] [0]).
  intro nzrz.
  apply eq_transitive_unfolded with (f_rcpcl y nzy[*]f_rcpcl (f_rcpcl z nzz) nzrz).
   apply f_rcpcl_mult.
  astepr (f_rcpcl y nzy[*]z).
  apply mult_wdr.
  apply f_rcpcl_f_rcpcl.
 apply f_rcpcl_resp_ap_zero.
Qed.



Lemma mult_of_divs : forall (x y p q : F) y_ q_ yq_,
 (x[*]p[/] y[*]q[//]yq_) [=] (x[/] y[//]y_) [*] (p[/] q[//]q_).
Proof.
 intros x y p q nzy nzq nzyq.
 unfold cf_div in |- *.
 astepl (x[*] (p[*]f_rcpcl (y[*]q) nzyq)).
 astepr (x[*] (f_rcpcl y nzy[*] (p[*]f_rcpcl q nzq))).
 apply mult_wdr.
 astepr (f_rcpcl y nzy[*]p[*]f_rcpcl q nzq).
 astepr (p[*]f_rcpcl y nzy[*]f_rcpcl q nzq).
 astepr (p[*] (f_rcpcl y nzy[*]f_rcpcl q nzq)).
 apply mult_wdr.
 apply f_rcpcl_mult.
Qed.

Lemma div_dist : forall (x y z : F) z_, (x[+]y[/] z[//]z_) [=] (x[/] z[//]z_) [+] (y[/] z[//]z_).
Proof.
 unfold cf_div in |- *; algebra.
Qed.

Lemma div_dist' : forall (x y z : F) z_, (x[-]y[/] z[//]z_) [=] (x[/] z[//]z_) [-] (y[/] z[//]z_).
Proof.
 unfold cf_div in |- *; algebra.
Qed.

Lemma div_semi_sym : forall (x y z : F) y_ z_, ((x[/] y[//]y_) [/] z[//]z_) [=] ((x[/] z[//]z_) [/] y[//]y_).
Proof.
 intros.
 unfold cf_div in |- *.
 astepl (x[*] ((f_rcpcl y y_) [*] (f_rcpcl z z_))).
 Step_final (x[*] ((f_rcpcl z z_) [*] (f_rcpcl y y_))).
Qed.

Hint Resolve div_semi_sym: algebra.

Lemma eq_div : forall (x y u v : F) y_ v_, x[*]v [=] u[*]y -> (x[/] y[//]y_) [=] (u[/] v[//]v_).
Proof.
 intros x y u v Hy Hv H.
 astepl (x[*][1][/] y[//]Hy).
 astepl (x[*] (v[/] v[//]Hv) [/] y[//]Hy).
 astepl ((x[*]v[/] v[//]Hv) [/] y[//]Hy).
 astepl ((u[*]y[/] v[//]Hv) [/] y[//]Hy).
 astepl ((u[*]y[/] y[//]Hy) [/] v[//]Hv).
 astepl (u[*] (y[/] y[//]Hy) [/] v[//]Hv).
 Step_final (u[*][1][/] v[//]Hv).
Qed.

Lemma div_strext : forall (x x' y y' : F) y_ y'_, (x[/] y[//]y_) [#] (x'[/] y'[//]y'_) -> x [#] x' or y [#] y'.
Proof.
 intros x x' y y' Hy Hy' H.
 unfold cf_div in H.
 elim (cs_bin_op_strext F cr_mult _ _ _ _ H).
  auto.
 intro H1.
 right.
 unfold f_rcpcl in H1.
 exact (pfstrx _ _ _ _ _ _ H1).
Qed.

End Div_properties.

#[global]
Hint Resolve div_1 div_1' div_1'' div_wd x_div_x x_div_one div_div div_div2
  mult_of_divs x_mult_y_div_z mult_of_divs div_dist div_dist' div_semi_sym
  div_prop: algebra.



Section Mult_Cancel_Ap_Zero.

Variable F : CField.

Lemma mult_cancel_ap_zero_lft : forall x y : F, x[*]y [#] [0] -> x [#] [0].
Proof.
 intros x y H.
 cut (x[*]y [#] [0][*][0]).
  intro H0.
  elim (bin_op_strext_unfolded _ _ _ _ _ _ H0); intro H1.
   3: astepr ([0]:F); auto.
  assumption.
 astepl (x[*]y[/] y[//]H1).
 apply div_resp_ap_zero_rev.
 assumption.
Qed.

Lemma mult_cancel_ap_zero_rht : forall x y : F, x[*]y [#] [0] -> y [#] [0].
Proof.
 intros x y H.
 apply mult_cancel_ap_zero_lft with x.
 astepl (x[*]y).
auto.
Qed.

Lemma recip_ap_zero : forall (x : F) x_, ([1][/] x[//]x_) [#] [0].
Proof.
 intros; apply cring_mult_ap_zero with x.
 astepl ([1]:F).
algebra.
Qed.

Lemma recip_resp_ap : forall (x y : F) x_ y_, x [#] y -> ([1][/] x[//]x_) [#] ([1][/] y[//]y_).
Proof.
 intros x y x_ y_ H.
 apply zero_minus_apart.
 apply mult_cancel_ap_zero_lft with (x[*]y).
 apply ap_wdl with (y[-]x).
  apply minus_ap_zero.
  apply ap_symmetric_unfolded; assumption.
 eapply eq_transitive_unfolded.
  2: apply eq_symmetric_unfolded; apply dist_2b.
 apply cg_minus_wd.
  astepr (x[*]y[*] ([1][/] x[//]x_)).
  astepr (x[*]y[*][1][/] x[//]x_).
  astepr (x[*]y[/] x[//]x_).
  astepr (y[*]x[/] x[//]x_).
  astepr (y[*] (x[/] x[//]x_)).
  Step_final (y[*][1]).
 astepr (x[*]y[*] ([1][/] y[//]y_)).
 astepr (x[*]y[*][1][/] y[//]y_).
 astepr (x[*]y[/] y[//]y_).
 astepr (x[*] (y[/] y[//]y_)).
 Step_final (x[*][1]).
Qed.

End Mult_Cancel_Ap_Zero.

Section CField_Ops.



Variable X : CField.

Variables F G : PartFunct X.


Let P := Dom F.
Let Q := Dom G.


Section Part_Function_Recip.



Let R := extend Q (fun x Hx => G x Hx [#] [0]).

Let Ext2R := ext2 (S:=X) (P:=Q) (R:=fun x Hx => G x Hx [#] [0]).

Lemma part_function_recip_strext : forall x y Hx Hy,
 ([1][/] _[//]Ext2R x Hx) [#] ([1][/] _[//]Ext2R y Hy) -> x [#] y.
Proof.
 intros x y Hx Hy H.
 elim (div_strext _ _ _ _ _ _ _ H); intro H1.
  exfalso; apply ap_irreflexive_unfolded with (x := [1]:X); auto.
 exact (pfstrx _ _ _ _ _ _ H1).
Qed.

Lemma part_function_recip_pred_wd : pred_wd X R.
Proof.
 red in |- *; intros x y H H0.
 elim H; intros H1 H2; split.
  apply (dom_wd X G x y H1 H0).
 intro H3; astepl (G x H1).
auto.
Qed.

Definition Frecip := Build_PartFunct X _ part_function_recip_pred_wd
 (fun x Hx => [1][/] _[//]Ext2R x Hx) part_function_recip_strext.

End Part_Function_Recip.

Section Part_Function_Div.



Let R := Conj P (extend Q (fun x Hx => G x Hx [#] [0])).

Let Ext2R := ext2 (S:=X) (P:=Q) (R:=fun x Hx => G x Hx [#] [0]).

Lemma part_function_div_strext : forall x y Hx Hy,
 (F x (prj1 X _ _ _ Hx) [/] _[//]Ext2R x (prj2 X _ _ _ Hx)) [#]
  (F y (prj1 X _ _ _ Hy) [/] _[//]Ext2R y (prj2 X _ _ _ Hy)) ->
 x [#] y.
Proof.
 intros x y Hx Hy H.
 elim (div_strext _ _ _ _ _ _ _ H); intro H1; exact (pfstrx _ _ _ _ _ _ H1).
Qed.

Lemma part_function_div_pred_wd : pred_wd X R.
Proof.
 red in |- *; intros x y H H0.
 elim H; intros H1 H2; split.
  apply (dom_wd X F x y H1 H0).
 clear H1.
 elim H2; intros H1 H3; split.
  apply (dom_wd X G x y H1 H0).
 intro H4; astepl (G x H1).
auto.
Qed.

Definition Fdiv := Build_PartFunct X _ part_function_div_pred_wd
 (fun x Hx => F x (Prj1 Hx) [/] _[//]Ext2R x (Prj2 Hx)) part_function_div_strext.

End Part_Function_Div.



Variable R:X -> CProp.

Lemma included_FRecip : included R Q ->
 (forall x, R x -> forall Hx, G x Hx [#] [0]) -> included R (Dom Frecip).
Proof.
 intros H H0.
 simpl in |- *.
 unfold extend in |- *.
 split.
  apply H; assumption.
 intros; apply H0; assumption.
Qed.

Lemma included_FRecip' : included R (Dom Frecip) -> included R Q.
Proof.
 intro H; simpl in H; eapply included_extend; apply H.
Qed.

Lemma included_FDiv : included R P -> included R Q ->
 (forall x, R x -> forall Hx, G x Hx [#] [0]) -> included R (Dom Fdiv).
Proof.
 intros HP HQ Hx.
 simpl in |- *.
 apply included_conj.
  assumption.
 unfold extend in |- *.
 split.
  apply HQ; assumption.
 intros; apply Hx; assumption.
Qed.

Lemma included_FDiv' : included R (Dom Fdiv) -> included R P.
Proof.
 intro H; simpl in H; eapply included_conj_lft; apply H.
Qed.

Lemma included_FDiv'' : included R (Dom Fdiv) -> included R Q.
 intro H; simpl in H; eapply included_extend; eapply included_conj_rht; apply H.
Qed.

End CField_Ops.

Arguments Frecip [X].
Notation "{1/} x" := (Frecip x) (at level 4, right associativity).

Arguments Fdiv [X].
Infix "{/}" := Fdiv (at level 41, no associativity).

#[global]
Hint Resolve included_FRecip included_FDiv : included.

#[global]
Hint Immediate included_FRecip' included_FDiv' included_FDiv'' : included.

End CFields.

End CoRN_DOT_algebra_DOT_CFields_WRAPPED.
Module Export CoRN_DOT_alge

[...]

- *; intros.
 clear X.
 cut ([0] [<] f _ (Nat.lt_succ_diag_r (S n1)) or [0] [<]
   Sumx (fun (i : nat) (l : i < n1) => f i (Nat.lt_lt_succ_r i (S n1) (Nat.lt_lt_succ_r i n1 l)))[+]
     f n1 (Nat.lt_lt_succ_r n1 (S n1) (Nat.lt_succ_diag_r n1))).
  intro X.
 inversion_clear X.
  exists (S n1).
   exists (Nat.lt_succ_diag_r (S n1)).
   eapply less_wdr.
    apply X2.
   apply H; auto.
  set (f' := fun (i : nat) (H : i < S n1) => f i (Nat.lt_lt_succ_r _ _ H)) in *.
  cut {i : nat | {H : i < S n1 | [0] [<] f' i H}}; intros.
   elim X; intros i Hi; elim Hi; clear X2 Hi; intros Hi Hi'.
   exists i.
   exists (Nat.lt_lt_succ_r _ _ Hi).
   eapply less_wdr.
    apply Hi'.
   unfold f' in |- *; simpl in |- *.
   apply H; auto.
  apply X0.
   red in |- *.
intros i j Hij.
rewrite Hij.
unfold f' in |- *.
   intros H0 H'.
   apply H; auto.
  apply X2; assumption.
 apply positive_Sum_two.
 eapply less_wdr.
  2: apply cag_commutes_unfolded.
 assumption.
Qed.

Lemma negative_Sumx : forall n (f : forall i, i < n -> R),
 nat_less_n_fun f -> Sumx f [<] [0] -> {i : nat | {H : i < n | f i H [<] [0]}}.
Proof.
 intros.
 cut {i : nat | {H : i < n | [0] [<] [--](f i H)}}.
  intro H1.
  elim H1; intros i Hi; elim Hi; clear X Hi; intros Hi Hi'.
  exists i; exists Hi.
  astepl ([--][--](f i Hi)); astepr ([--]([0]:R)); apply inv_resp_less; assumption.
 apply positive_Sumx with (f := fun (i : nat) (H : i < n) => [--](f i H)).
  red in |- *; intros.
  apply un_op_wd_unfolded; apply H; assumption.
 astepl ([--]([0]:R)); apply less_wdr with ([--](Sumx f)).
  apply inv_resp_less; assumption.
 generalize f H; clear X H f.
 induction  n as [| n Hrecn].
  simpl in |- *.
  intros; algebra.
 intros.
 simpl in |- *.
 rstepl ([--](Sumx (fun (i : nat) (l : i < n) => f i (Nat.lt_lt_succ_r i n l)))[+] [--](f n (Nat.lt_succ_diag_r n))).
 apply bin_op_wd_unfolded.
  2: algebra.
 apply Hrecn with (f := fun (i : nat) (l : i < n) => f i (Nat.lt_lt_succ_r i n l)).
 red in |- *; intros; apply H; auto.
Qed.

End misc.

End Properties_of_Ordering.

Add Parametric Morphism c : (@cof_leEq c) with signature (@cs_eq (cof_crr c)) ==> (@cs_eq c) ==> iff as cof_leEq_wd.
Proof with try assumption.
 intros x1 x2 Hx y1 y2 Hy.
 split; intros.
  stepl x1...
  stepr y1...
 symmetry in Hx, Hy.
 stepl x2...
 stepr y2...
Qed.

End COrdFields.

End CoRN_DOT_algebra_DOT_COrdFields_WRAPPED.
Module Export CoRN_DOT_algebra_DOT_COrdFields.
Module Export CoRN.
Module Export algebra.
Module COrdFields.
Include CoRN_DOT_algebra_DOT_COrdFields_WRAPPED.COrdFields.
End COrdFields.

End algebra.

End CoRN.

End CoRN_DOT_algebra_DOT_COrdFields.
Export CoRN.algebra.COrdFields.

Section Properties_of_leEq.

Variable R : COrdField.

Lemma plus_resp_leEq_lft : forall x y z : R, x [<=] y -> z[+]x [<=] z[+]y.
Admitted.

Lemma inv_resp_leEq : forall x y : R, x [<=] y -> [--]y [<=] [--]x.
Admitted.

Lemma minus_resp_leEq_rht : forall x y z : R, y [<=] x -> z[-]x [<=] z[-]y.
Admitted.

Lemma plus_resp_leEq_both : forall x y a b : R, x [<=] y -> a [<=] b -> x[+]a [<=] y[+]b.
Admitted.

Lemma minus_resp_leEq_both : forall x y x' y' : R, x [<=] y -> y' [<=] x' -> x[-]x' [<=] y[-]y'.
Admitted.

Lemma plus_cancel_leEq_rht : forall x y z : R, x[+]z [<=] y[+]z -> x [<=] y.
Admitted.

Lemma inv_cancel_leEq : forall x y : R, [--]y [<=] [--]x -> x [<=] y.
Admitted.

Lemma shift_plus_leEq : forall a b c : R, a [<=] c[-]b -> a[+]b [<=] c.
Admitted.

Lemma shift_leEq_plus : forall a b c : R, a[-]b [<=] c -> a [<=] c[+]b.
Admitted.

Lemma shift_leEq_minus : forall a b c : R, a[+]c [<=] b -> a [<=] b[-]c.
Admitted.

Lemma mult_resp_leEq_rht : forall x y z : R, x [<=] y -> [0] [<=] z -> x[*]z [<=] y[*]z.
Admitted.

Lemma mult_resp_leEq_lft : forall x y z : R, x [<=] y -> [0] [<=] z -> z[*]x [<=] z[*]y.
Admitted.

Lemma mult_resp_leEq_both : forall x x' y y' : R,
 [0] [<=] x -> [0] [<=] y -> x [<=] x' -> y [<=] y' -> x[*]y [<=] x'[*]y'.
Admitted.

Lemma div_resp_leEq : forall (x y z : R) z_, [0] [<] z -> x [<=] y -> (x[/] z[//]z_) [<=] (y[/] z[//]z_).
Admitted.

Lemma mult_cancel_leEq : forall x y z : R, [0] [<] z -> x[*]z [<=] y[*]z -> x [<=] y.
Admitted.

Lemma shift_leEq_div : forall (x y z : R) y_, [0] [<] y -> x[*]y [<=] z -> x [<=] (z[/] y[//]y_).
Admitted.

Lemma eps_div_leEq_eps : forall (eps d : R) d_, [0] [<=] eps -> [1] [<=] d -> (eps[/] d[//]d_) [<=] eps.
Admitted.

Lemma nonneg_div_two : forall eps : R, [0] [<=] eps -> [0] [<=] eps [/]TwoNZ.
Print Options.
Admitted.

Lemma nonneg_div_two' : forall eps : R, [0] [<=] eps -> eps [/]TwoNZ [<=] eps.
Print Options.
Admitted.

Lemma mult_resp_nonneg : forall x y : R, [0] [<=] x -> [0] [<=] y -> [0] [<=] x[*]y.
Admitted.

Lemma Sum_resp_leEq : forall (f g : nat -> R) a b, a <= S b ->
 (forall i, a <= i -> i <= b -> f i [<=] g i) -> Sum a b f [<=] Sum a b g.
Admitted.

Lemma approach_zero_weak : forall x : R, (forall e, [0] [<] e -> x [<=] e) -> x [<=] [0].
Admitted.

End Properties_of_leEq.

Section PosP_properties.

Variable R : COrdField.

Lemma mult_cancel_pos_rht : forall x y : R, [0] [<] x[*]y -> [0] [<=] x -> [0] [<] y.
Admitted.

End PosP_properties.

#[global]
Hint Resolve mult_resp_nonneg.
Definition AbsSmall (R : COrdField) (e x : R) : Prop.
exact ([--]e [<=] x /\ x [<=] e).
Print Options.
Defined.

Arguments AbsSmall [R].

Section AbsSmall_properties.

Variable R : COrdField.

Lemma AbsSmall_wdr : rel_wdr R (AbsSmall (R:=R)).
Admitted.

Lemma AbsSmall_wdr_unfolded : forall x y z : R,
 AbsSmall x y -> y [=] z -> AbsSmall x z.
Proof AbsSmall_wdr.

Lemma AbsSmall_wdl : rel_wdl R (AbsSmall (R:=R)).
 unfold rel_wdl in |- *.
Print Options.
 intros.
Print Options.
 elim H; intros.
Print Options.
 split.
Print Options.
  astepl ([--]x).
Print Options.
  assumption.
Print Options.
 astepr x.
Print Options.
 assumption.
Print Options.
Qed.

Lemma AbsSmall_wdl_unfolded : forall x y z : R,
 AbsSmall x y -> x [=] z -> AbsSmall z y.
Proof AbsSmall_wdl.

Declare Left Step AbsSmall_wdl_unfolded.
Declare Right Step AbsSmall_wdr_unfolded.

Notation ZeroR := ([0]:R).

Lemma AbsSmall_leEq_trans : forall e1 e2 d : R,
 e1 [<=] e2 -> AbsSmall e1 d -> AbsSmall e2 d.
 intros.
Print Options.
 elim H0; intros.
Print Options.
 split.
Print Options.
  apply leEq_transitive with ([--]e1).
Print Options.
   apply inv_resp_leEq.
Print Options.
   assumption.
Print Options.
  assumption.
Print Options.
 apply leEq_transitive with e1.
Print Options.
  assumption.
Print Options.
 assumption.
Print Options.
Qed.

Lemma zero_AbsSmall : forall e : R, [0] [<=] e -> AbsSmall e [0].
 split.
Print Options.
  astepr ([--]ZeroR).
Print Options.
  apply inv_resp_leEq.
Print Options.
  assumption.
Print Options.
 assumption.
Print Options.
Qed.

Lemma AbsSmall_reflexive : forall (e : R), [0] [<=] e -> AbsSmall e e.
 split.
Print Options.
  apply leEq_transitive with ([0]:R); auto.
Print Options.
  astepr ([--][0]:R).
Print Options.
  apply inv_resp_leEq.
Print Options.
  auto.
Print Options.
 apply leEq_reflexive.
Print Options.
Qed.

Lemma AbsSmall_trans : forall e1 e2 d : R,
 e1 [<] e2 -> AbsSmall e1 d -> AbsSmall e2 d.
 intros.
Print Options.
 apply AbsSmall_leEq_trans with e1.
Print Options.
  apply less_leEq.
Print Options.
  assumption.
Print Options.
 assumption.
Print Options.
Qed.

Lemma leEq_imp_AbsSmall : forall e d : R, [0] [<=] e -> e [<=] d -> AbsSmall d e.
 split; try assumption.
Print Options.
 apply leEq_transitive with ZeroR; try assumption.
Print Options.
 astepr ([--]ZeroR).
Print Options.
 apply inv_resp_leEq.
Print Options.
 apply leEq_transitive with e; assumption.
Print Options.
Qed.

Lemma inv_resp_AbsSmall : forall x y : R, AbsSmall x y -> AbsSmall x [--]y.
 intros.
Print Options.
 elim H; intros.
Print Options.
 split.
Print Options.
  apply inv_resp_leEq.
Print Options.
  assumption.
Print Options.
 astepr ([--][--]x).
Print Options.
 apply inv_resp_leEq.
Print Options.
 assumption.
Print Options.
Qed.

Lemma mult_resp_AbsSmall: forall (R: COrdField) (x y e : R) (H: [0][<=]y),
AbsSmall e x -> AbsSmall (y[*]e) (y[*]x).
 intros.
Print Options.
 destruct H0.
Print Options.
 split.
Print Options.
  rstepl (y[*]([--]e)).
Print Options.
  apply mult_resp_leEq_lft; auto.
Print Options.
 apply mult_resp_leEq_lft; auto.
Print Options.
Qed.

Lemma div_resp_AbsSmall: forall (R: COrdField) (x y e : R) (H: [0][<]y),
AbsSmall e x -> AbsSmall (e[/]y[//]pos_ap_zero _ _ H) (x[/]y[//]pos_ap_zero _ _ H).
 intros.
Print Options.
 destruct H0.
Print Options.
 split.
Print Options.
  rstepl (([--]e)[/]y[//]pos_ap_zero _ _ H).
Print Options.
  apply div_resp_leEq; auto.
Print Options.
 apply div_resp_leEq; auto.
Print Options.
Qed.

Lemma sum_resp_AbsSmall : forall
(x y : nat -> R) (n m: nat)
(H1 : m <= n) (H2 : forall i : nat, m <= i -> i <= n ->  AbsSmall (y i) (x i)),
AbsSmall (Sum m n y) (Sum m n x).
 intros.
Print Options.
 assert (H3 : forall i : nat, m <= i -> i <= n ->  [--](y i)[<=]x i).
Print Options.
  intros.
Print Options.
  elim (H2 i H H0).
Print Options.
auto.
Print Options.
  assert (H4 : forall i : nat, m <= i -> i <= n ->  x i[<=]y i).
Print Options.
  intros.
Print Options.
  elim (H2 i H H0).
Print Options.
auto.
Print Options.
  split.
Print Options.
  astepl (Sum m n (fun k: nat => [--](y k))).
Print Options.
  apply Sum_resp_leEq .
Print Options.
   auto with arith.
Print Options.
auto.
Print Options.
  apply Sum_resp_leEq .
Print Options.
  auto with arith.
Print Options.
auto.
Print Options.
Qed.

Lemma AbsSmall_minus : forall e x1 x2 : R, AbsSmall e (x1[-]x2) -> AbsSmall e (x2[-]x1).
 intros.
Print Options.
 rstepr ([--](x1[-]x2)).
Print Options.
 apply inv_resp_AbsSmall.
Print Options.
 assumption.
Print Options.
Qed.

Lemma AbsSmall_plus : forall e1 e2 x1 x2 : R,
 AbsSmall e1 x1 -> AbsSmall e2 x2 -> AbsSmall (e1[+]e2) (x1[+]x2).
 intros.
Print Options.
 elim H; intros.
Print Options.
 elim H0; intros.
Print Options.
 split.
Print Options.
  rstepl ([--]e1[+][--]e2).
Print Options.
  apply plus_resp_leEq_both; assumption.
Print Options.
 apply plus_resp_leEq_both; assumption.
Print Options.
Qed.

Lemma AbsSmall_eps_div_two : forall e x1 x2 : R,
 AbsSmall (e [/]TwoNZ) x1 -> AbsSmall (e [/]TwoNZ) x2 -> AbsSmall e (x1[+]x2).
Print Options.
 intros.
Print Options.
 rstepl (e [/]TwoNZ[+]e [/]TwoNZ).
Print Options.
 apply AbsSmall_plus.
Print Options.
  assumption.
Print Options.
 assumption.
Print Options.
Qed.

Lemma AbsSmall_x_plus_delta : forall x eps delta : R,
 [0] [<=] eps -> [0] [<=] delta -> delta [<=] eps -> AbsSmall eps (x[-] (x[+]delta)).
 intros.
Print Options.

 rstepr ([--]delta).
Print Options.
 apply inv_resp_AbsSmall.
Print Options.
 apply leEq_imp_AbsSmall.
Print Options.
  assumption.
Print Options.
 assumption.
Print Options.
Qed.

Lemma AbsSmall_x_minus_delta : forall x eps delta : R,
 [0] [<=] eps -> [0] [<=] delta -> delta [<=] eps -> AbsSmall eps (x[-] (x[-]delta)).
 intros.
Print Options.

 rstepr delta.
Print Options.
 apply leEq_imp_AbsSmall.
Print Options.
  assumption.
Print Options.
 assumption.
Print Options.
Qed.

Lemma AbsSmall_x_plus_eps_div2 : forall x eps : R, [0] [<=] eps -> AbsSmall eps (x[-] (x[+]eps [/]TwoNZ)).
Print Options.
 intros.
Print Options.
 apply AbsSmall_x_plus_delta.
Print Options.
   assumption.
Print Options.
  apply nonneg_div_two.
Print Options.
  assumption.
Print Options.
 apply nonneg_div_two'.
Print Options.
 assumption.
Print Options.
Qed.

Lemma AbsSmall_x_minus_eps_div2 : forall x eps : R, [0] [<=] eps -> AbsSmall eps (x[-] (x[-]eps [/]TwoNZ)).
Print Options.
 intros.
Print Options.
 apply AbsSmall_x_minus_delta.
Print Options.
   assumption.
Print Options.
  apply nonneg_div_two.
Print Options.
  assumption.
Print Options.
 apply eps_div_leEq_eps.
Print Options.
  assumption.
Print Options.
 apply less_leEq.
Print Options.
 apply one_less_two.
Print Options.
Qed.

Lemma AbsSmall_intermediate : forall x y z eps : R,
 x [<=] y -> y [<=] z -> AbsSmall eps (z[-]x) -> AbsSmall eps (z[-]y).
 intros.
Print Options.
 apply leEq_imp_AbsSmall.
Print Options.
  apply shift_leEq_minus; astepl y.
Print Options.
  assumption.
Print Options.
 elim H1; intros.
Print Options.
 apply leEq_transitive with (z[-]x); try assumption.
Print Options.
 apply minus_resp_leEq_rht.
Print Options.
 assumption.
Print Options.
Qed.

Lemma AbsSmall_eps_div2 : forall eps : R, [0] [<=] eps -> AbsSmall eps (eps [/]TwoNZ).
Print Options.
 intros.
Print Options.
 apply leEq_imp_AbsSmall.
Print Options.
  apply nonneg_div_two.
Print Options.
  assumption.
Print Options.
 apply eps_div_leEq_eps.
Print Options.
  assumption.
Print Options.
 apply less_leEq.
Print Options.
 apply one_less_two.
Print Options.
Qed.

Lemma AbsSmall_nonneg : forall e x : R, AbsSmall e x -> [0] [<=] e.
 intros.
Print Options.
 elim H.
Print Options.
 intros.
Print Options.
 cut ([--]e [<=] e).
Print Options.
  intros.
Print Options.
  apply mult_cancel_leEq with (z := Two:R).
Print Options.
   apply pos_two.
Print Options.
  apply plus_cancel_leEq_rht with (z := [--]e).
Print Options.
  rstepl ([--]e).
Print Options.
  rstepr e.
Print Options.
  assumption.
Print Options.
 apply leEq_transitive with (y := x).
Print Options.
  assumption.
Print Options.
 assumption.
Print Options.
Qed.

Lemma AbsSmall_mult : forall e1 e2 x1 x2 : R,
 AbsSmall e1 x1 -> AbsSmall e2 x2 -> AbsSmall (Three[*] (e1[*]e2)) (x1[*]x2).
 intros.
Print Options.
 elim H.
Print Options.
 elim H0.
Print Options.
 cut ([0] [<=] e1).
Print Options.
  cut ([0] [<=] e2).
Print Options.
   split.
Print Options.
    apply plus_cancel_leEq_rht with (z := Three[*] (e1[*]e2)).
Print Options.
    rstepl ZeroR.
Print Options.
    apply leEq_transitive with (y := x1[*]x2[+]e1[*]e2[+]x1[*]e2[+]e1[*]x2).
Print Options.
     rstepr ((e1[+]x1)[*](e2[+]x2)).
Print Options.
     apply mult_resp_nonneg.
Print Options.
      apply plus_cancel_leEq_rht with (z := [--]x1).
Print Options.
      rstepl ([--]x1).
Print Options.
      rstepr ([--][--]e1).
Print Options.
      apply inv_resp_leEq.
Print Options.
      assumption.
Print Options.
     apply plus_cancel_leEq_rht with (z := [--]x2).
Print Options.
     rstepl ([--]x2).
Print Options.
     rstepr ([--][--]e2).
Print Options.
     apply inv_resp_leEq.
Print Options.
     assumption.
Print Options.
    rstepl (x1[*]x2[+]e1[*]e2[+](x1[*]e2[+]e1[*]x2)).
Print Options.
    rstepr (x1[*]x2[+]e1[*]e2[+](e1[*]e2[+]e1[*]e2)).
Print Options.
    apply plus_resp_leEq_lft.
Print Options.
    apply plus_resp_leEq_both.
Print Options.
     apply mult_resp_leEq_rht.
Print Options.
      assumption.
Print Options.
     assumption.
Print Options.
    apply mult_resp_leEq_lft.
Print Options.
     assumption.
Print Options.
    assumption.
Print Options.
   apply plus_cancel_leEq_rht with (z := [--](x1[*]x2)).
Print Options.
   rstepl ZeroR.
Print Options.
   rstepr ([--](x1[*]x2)[+]e1[*]e2[+](e1[*]e2[+]e1[*]e2)).
Print Options.
   apply leEq_transitive with (y := [--](x1[*]x2)[+]e1[*]e2[+](x1[*]e2[-]e1[*]x2)).
Print Options.
    rstepr ((e1[+]x1)[*](e2[-]x2)).
Print Options.
    apply mult_resp_nonneg.
Print Options.
     apply plus_cancel_leEq_rht with (z := [--]x1).
Print Options.
     rstepl ([--]x1).
Print Options.
     rstepr ([--][--]e1).
Print Options.
     apply inv_resp_leEq.
Print Options.
     assumption.
Print Options.
    apply plus_cancel_leEq_rht with (z := x2).
Print Options.
    rstepl x2.
Print Options.
    rstepr e2.
Print Options.
    assumption.
Print Options.
   apply plus_resp_leEq_lft.
Print Options.
   apply plus_resp_leEq_both.
Print Options.
    apply mult_resp_leEq_rht.
Print Options.
     assumption.
Print Options.
    assumption.
Print Options.
   rstepl (e1[*][--]x2).
Print Options.
   apply mult_resp_leEq_lft.
Print Options.
    rstepr ([--][--]e2).
Print Options.
    apply inv_resp_leEq.
Print Options.
    assumption.
Print Options.
   assumption.
Print Options.
  apply AbsSmall_nonneg with (e := e2) (x := x2).
Print Options.
  assumption.
Print Options.
 apply AbsSmall_nonneg with (e := e1) (x := x1).
Print Options.
 assumption.
Print Options.
Qed.

Lemma AbsSmall_cancel_mult : forall e x z : R,
 [0] [<] z -> AbsSmall (e[*]z) (x[*]z) -> AbsSmall e x.
 intros.
Print Options.
 elim H.
Print Options.
 split.
Print Options.
  apply mult_cancel_leEq with (z := z).
Print Options.
   assumption.
Print Options.
  rstepl ([--](e[*]z)).
Print Options.
  assumption.
Print Options.
 apply mult_cancel_leEq with (z := z).
Print Options.
  assumption.
Print Options.
 assumption.
Print Options.
Qed.

Lemma AbsSmall_approach_zero : forall x : R, (forall e, [0] [<] e -> AbsSmall e x) -> x [=] [0].
 intros.
Print Options.
 apply not_ap_imp_eq.
Print Options.
 intro H0.
Print Options.
 elim (ap_imp_less _ _ _ H0).
Print Options.
  change (Not (x [<] [0])).
Print Options.
  rewrite <- leEq_def.
Print Options.
  apply inv_cancel_leEq.
Print Options.
  astepr ZeroR.
Print Options.
  apply approach_zero_weak.
Print Options.
  intros.
Print Options.
  apply inv_cancel_leEq; astepr x.
Print Options.
  elim (H e); auto.
Print Options.
 change (Not ([0] [<] x)).
Print Options.
 rewrite <- leEq_def.
Print Options.
 apply approach_zero_weak.
Print Options.
 intros.
Print Options.
 elim (H e); auto.
Print Options.
Qed.

Lemma mult_AbsSmall'_rht : forall x y C : R, [0] [<=] C ->
 [--]C [<=] x -> x [<=] C -> [--]C [<=] y -> y [<=] C -> x[*]y [<=] Three[*]C[^]2.
 intros.
Print Options.
 astepl ([0][+]x[*]y).
Print Options.
apply shift_plus_leEq.
Print Options.
 apply leEq_transitive with ((C[+]x)[*](C[-]y)).
Print Options.
  apply mult_resp_nonneg.
Print Options.
   apply shift_leEq_plus.
Print Options.
astepl ([--]x).
Print Options.
astepr ([--][--]C).
Print Options.
   apply inv_resp_leEq.
Print Options.
auto.
Print Options.
   apply shift_leEq_minus.
Print Options.
astepl y.
Print Options.
auto.
Print Options.
  rstepl (C[^]2[-]x[*]y[+]C[*](x[-]y)).
Print Options.
 rstepr (C[^]2[-]x[*]y[+]C[*](C[-][--]C)).
Print Options.
 apply plus_resp_leEq_lft.
Print Options.
 apply mult_resp_leEq_lft.
Print Options.
  apply minus_resp_leEq_both.
Print Options.
   auto.
Print Options.
auto.
Print Options.
auto.
Print Options.
Qed.

Lemma mult_AbsSmall_rht : forall x y X Y : R, [0] [<=] X ->
 [0] [<=] Y -> [--]X [<=] x -> x [<=] X -> [--]Y [<=] y -> y [<=] Y -> x[*]y [<=] X[*]Y.
 intros.
Print Options.
 rewrite -> leEq_def.
Print Options.
 intro.
Print Options.
 cut ([0] [<] x[*]y); intros.
Print Options.
  2: apply leEq_less_trans with (X[*]Y); auto.
Print Options.
 cut (x[*]y [#] [0]); intros.
Print Options.
  2: apply pos_ap_zero; auto.
Print Options.
 cut (x [#] [0]); intros.
Print Options.
  2: apply mult_cancel_ap_zero_lft with y; auto.
Print Options.
 elim (ap_imp_less _ _ _ X3); intro.
Print Options.
  cut (y [<] [0]); intros.
Print Options.
   2: astepl ([--][--]y); astepr ([--]([0]:R)); apply inv_resp_less.
Print Options.
   2: apply mult_cancel_pos_rht with ([--]x).
Print Options.
    2: astepr (x[*]y); auto.
Print Options.
   2: astepl ([--]([0]:R)); apply less_leEq; apply inv_resp_less; auto.
Print Options.
  apply (less_irreflexive_unfolded R [1]).
Print Options.
  apply leEq_less_trans with (X[*]Y[/] _[//]X2).
Print Options.
   rstepr ((X[/] [--]x[//]inv_resp_ap_zero _ _ X3)[*]
     (Y[/] [--]y[//]inv_resp_ap_zero _ _ (less_imp_ap _ _ _ X4))).
Print Options.
   astepl ([1][*]([1]:R)).
Print Options.
   apply mult_resp_leEq_both.
Print Options.
      apply less_leEq; apply pos_one.
Print Options.
     apply less_leEq; apply pos_one.
Print Options.
    apply shift_leEq_div.
Print Options.
     astepl ([--]([0]:R)); apply inv_resp_less; auto.
Print Options.
    astepl ([--]x); astepr ([--][--]X); apply inv_resp_leEq; firstorder using leEq_def.
Print Options.
   apply shift_leEq_div.
Print Options.
    astepl ([--]([0]:R)); apply inv_resp_less; auto.
Print Options.
   astepl ([--]y); astepr ([--][--]Y); apply inv_resp_leEq; firstorder using leEq_def.
Print Options.
  apply shift_div_less; auto.
Print Options.
  astepr (x[*]y); auto.
Print Options.
 cut ([0] [<] y); intros.
Print Options.
  2: apply mult_cancel_pos_rht with x; try apply less_leEq; auto.
Print Options.
 apply (less_irreflexive_unfolded R [1]).
Print Options.
 apply leEq_less_trans with (X[*]Y[/] _[//]X2).
Print Options.
  rstepr ((X[/] x[//]X3)[*](Y[/] y[//]pos_ap_zero _ _ X4)).
Print Options.
  astepl ([1][*]([1]:R)).
Print Options.
  apply mult_resp_leEq_both.
Print Options.
     apply less_leEq; apply pos_one.
Print Options.
    apply less_leEq; apply pos_one.
Print Options.
   apply shift_leEq_div; auto.
Print Options.
   astepl x; firstorder using leEq_def.
Print Options.
  apply shift_leEq_div; auto.
Print Options.
  astepl y; firstorder using leEq_def.
Print Options.
 apply shift_div_less; auto.
Print Options.
 astepr (x[*]y); firstorder using leEq_def.
Print Options.
Qed.

Lemma mult_AbsSmall_lft : forall x y X Y : R, [0] [<=] X -> [0] [<=] Y ->
 [--]X [<=] x -> x [<=] X -> [--]Y [<=] y -> y [<=] Y -> [--](X[*]Y) [<=] x[*]y.
 intros.
Print Options.
 rstepr ([--]([--]x[*]y)).
Print Options.
 apply inv_resp_leEq.
Print Options.
 apply mult_AbsSmall_rht; auto.
Print Options.
  apply inv_resp_leEq.
Print Options.
auto.
Print Options.
  rstepr ([--][--]X).
Print Options.
 apply inv_resp_leEq.
Print Options.
auto.
Print Options.
Qed.

Lemma mult_AbsSmall : forall x y X Y : R,
 AbsSmall X x -> AbsSmall Y y -> AbsSmall (X[*]Y) (x[*]y).
 intros.
Print Options.
 elim H.
Print Options.
elim H0.
Print Options.
 cut ([0] [<=] X).
Print Options.
cut ([0] [<=] Y).
Print Options.
  split.
Print Options.
    apply mult_AbsSmall_lft; auto.
Print Options.
   apply mult_AbsSmall_rht; auto.
Print Options.
  apply AbsSmall_nonneg with y; auto.
Print Options.
 apply AbsSmall_nonneg with x; auto.
Print Options.
Qed.

End AbsSmall_properties.

Declare Left Step AbsSmall_wdl_unfolded.
Declare Right Step AbsSmall_wdr_unfolded.
Definition absBig (R : COrdField) (e x : R) : CProp. exact ([0] [<] e and (e [<=] x or x [<=] [--]e)). Defined.

Notation AbsBig := (absBig _).

Lemma AbsBigSmall_minus : forall (R : COrdField) (e1 e2 x1 x2 : R),
 e2 [<] e1 -> AbsBig e1 x1 -> AbsSmall e2 x2 -> AbsBig (e1[-]e2) (x1[-]x2).
 split.
Print Options.
  apply plus_cancel_less with (z := e2).
Print Options.
  rstepl e2.
Print Options.
  rstepr e1.
Print Options.
  assumption.
Print Options.
 elim X0.
Print Options.
 intros H2 H3.
Print Options.
 case H3.
Print Options.
  left.
Print Options.
  elim H.
Print Options.
  intros.
Print Options.
  apply plus_resp_leEq_both.
Print Options.
   assumption.
Print Options.
  apply inv_cancel_leEq.
Print Options.
  rstepl x2.
Print Options.
  rstepr e2.
Print Options.
  assumption.
Print Options.
 right.
Print Options.
 elim H.
Print Options.
 intros H5 H6.
Print Options.
 rstepr ([--]e1[+]e2).
Print Options.
 apply plus_resp_leEq_both.
Print Options.
  assumption.
Print Options.
 apply inv_cancel_leEq.
Print Options.
 rstepr x2.
Print Options.
 assumption.
Print Options.
Qed.

Section absBig_wd_properties.

Variable R : COrdField.

Lemma AbsBig_wdr : Crel_wdr R AbsBig.
 red in |- *.
Print Options.
 intros.
Print Options.
 elim X.
Print Options.
 intros H1 H2.
Print Options.
 split.
Print Options.
  assumption.
Print Options.
 case H2.
Print Options.
  left.
Print Options.
  apply leEq_wdr with y.
Print Options.
   assumption.
Print Options.
  assumption.
Print Options.
 right.
Print Options.
 apply leEq_wdl with y.
Print Options.
  assumption.
Print Options.
 assumption.
Print Options.
Qed.

Lemma AbsBig_wdl : Crel_wdl R AbsBig.
 red in |- *.
Print Options.
 intros.
Print Options.
 elim X.
Print Options.
 intros H1 H2.
Print Options.
 split.
Print Options.
  astepr x.
Print Options.
  assumption.
Print Options.
 case H2.
Print Options.
  left.
Print Options.
  astepl x.
Print Options.
  assumption.
Print Options.
 right.
Print Options.
 astepr ([--]x).
Print Options.
 assumption.
Print Options.
Qed.

Lemma AbsBig_wdr_unfolded : forall x y z : R, AbsBig x y -> y [=] z -> AbsBig x z.
Proof AbsBig_wdr.

Lemma AbsBig_wdl_unfolded : forall x y z : R, AbsBig x y -> x [=] z -> AbsBig z y.
Proof AbsBig_wdl.

End absBig_wd_properties.

Add Parametric Morphism c : (@AbsSmall c) with signature (@cs_eq (cof_crr c)) ==> (@cs_eq c) ==> iff as AbsSmall_morph_wd.
Proof with try assumption.
 intros x1 x2 xeq y1 y2 yeq.
Print Options.
 split; intro H.
Print Options.
  stepr y1...
Print Options.
  stepl x1...
Print Options.
 symmetry in xeq, yeq.
Print Options.
 stepr y2...
Print Options.
 stepl x2...
Print Options.
Qed.

Definition Q_as_CSemiGroup := Build_CSemiGroup _ Qplus_is_bin_fun Qplus_is_assoc.

Section OrdField_Cauchy.

Variable R : COrdField.

Set Implicit Arguments.
Unset Strict Implicit.
Definition Cauchy_prop (g : nat -> R) : CProp.
Admitted.

Set Strict Implicit.
Unset Implicit Arguments.

Record CauchySeq : Type :=
 {CS_seq   :> nat -> R;
  CS_proof :  Cauchy_prop CS_seq}.
Definition SeqLimit (seq : nat -> R) (lim : R) : CProp.
Admitted.

End OrdField_Cauchy.

Arguments SeqLimit [R].

Record is_CReals (R : COrdField) (lim : CauchySeq R -> R) : CProp :=
  {ax_Lim  : forall s : CauchySeq R, SeqLimit s (lim s);
   ax_Arch : forall x : R, {n : nat | x [<=] nring n}}.

Record CReals : Type :=
  {crl_crr   :> COrdField;
   crl_lim   :  CauchySeq crl_crr -> crl_crr;
   crl_proof :  is_CReals crl_crr crl_lim}.
Definition Lim : forall IR : CReals, CauchySeq IR -> IR.
Admitted.

Arguments Lim [IR].

Lemma ZEROQ_as_rht_unit3 : is_rht_unit (S:=Q_as_CSetoid) Qplus_is_bin_fun 0.
Admitted.

Lemma ZEROQ_as_lft_unit3 : is_lft_unit (S:=Q_as_CSetoid) Qplus_is_bin_fun 0.
Admitted.

Definition Q_is_CMonoid := Build_is_CMonoid
 Q_as_CSemiGroup _ ZEROQ_as_rht_unit3 ZEROQ_as_lft_unit3.

Definition Q_as_CMonoid := Build_CMonoid Q_as_CSemiGroup _ Q_is_CMonoid.

Lemma Q_is_CGroup : is_CGroup Q_as_CMonoid Qopp_is_fun.
Admitted.

Definition Q_as_CGroup := Build_CGroup Q_as_CMonoid Qopp_is_fun Q_is_CGroup.

Lemma Q_is_CAbGroup : is_CAbGroup Q_as_CGroup.
Admitted.

Definition Q_as_CAbGroup := Build_CAbGroup Q_as_CGroup Q_is_CAbGroup.

Definition Q_is_CRing : is_CRing Q_as_CAbGroup 1 Qmult_is_bin_fun.
Admitted.

Definition Q_as_CRing := Build_CRing _ _ _ Q_is_CRing.

Lemma Q_is_CField : is_CField Q_as_CRing Qinv_dep.
Admitted.

Definition Q_as_CField := Build_CField _ _ Q_is_CField Qinv_strext.

Definition Qlt_is_strict_order := Build_strictorder
 Qlt_trans Qlt_is_antisymmetric_unfolded.

Definition Q_is_COrdField := Build_is_COrdField Q_as_CField
 Qlt_is_CSetoid_relation Qle (default_greater Q_as_CField Qlt_is_CSetoid_relation)
 (default_grEq Q_as_CField Qle) Qlt_is_strict_order (fun x y E z => proj2 (Qplus_lt_l x y z) E)
 Qmult_lt_0_compat Qlt_gives_apartness Qle_is_not_lt Qgt_is_lt Qge_is_not_gt.

Definition Q_as_COrdField := Build_COrdField _ _ _ _ _ Q_is_COrdField.

Definition IR : CReals.
Admitted.

Notation PartIR := (PartFunct IR).

Section Rational_sequence_prelogue.

Variable R1 : CReals.

Local Coercion nat_of_P : positive >-> nat.

Lemma den_is_nonzero : forall x : Q_as_COrdField, nring (R:=R1) (Qden x) [#] [0].
Admitted.

Definition inj_Q : Q_as_COrdField -> R1.
 intro x.
Print Options.
 case x.
Print Options.
 intros num0 den0.
Print Options.
 exact (zring num0[/]nring (R:=R1) den0[//]den_is_nonzero (Qmake num0 den0)).
Print Options.
Defined.

End Rational_sequence_prelogue.

Section Max_function.

Variables x y : IR.

Definition MAX : IR.
Admitted.

End Max_function.

Lemma MAX_strext : bin_op_strext _ MAX.
Admitted.

Definition Max := Build_CSetoid_bin_op _ MAX MAX_strext.

Section Minimum.
Definition Min : CSetoid_bin_op IR.
Admitted.

Lemma Min_leEq_lft : forall x y : IR, Min x y [<=] x.
Admitted.

Lemma Min_leEq_rht : forall x y : IR, Min x y [<=] y.
Admitted.

Variables a b : IR.

Lemma Min_leEq_Max : Min a b [<=] Max a b.
Admitted.

End Minimum.
Definition AbsIR : CSetoid_un_op IR.
Admitted.

Definition compact (a b : IR) (Hab : a [<=] b) (x : IR) := a [<=] x and x [<=] b.

Notation Compact := (compact _ _).

Section Definitions_and_Basic_Results.

Variables a b : IR.
Hypothesis Hab : a [<=] b.

Let I := Compact Hab.

Variable F : PartIR.

Let P := Dom F.

Definition Continuous_I := included I P and (forall e, [0] [<] e -> {d : IR | [0] [<] d |
 forall x y, I x -> I y -> forall Hx Hy, AbsIR (x[-]y) [<=] d -> AbsIR (F x Hx[-]F y Hy) [<=] e}).

End Definitions_and_Basic_Results.

Arguments Continuous_I [a b].

Section Integral.

Variables a b : IR.
Hypothesis Hab : a [<=] b.

Variable F : PartIR.
Hypothesis contF : Continuous_I Hab F.

Definition integral_seq : nat -> IR.
Admitted.

Lemma Cauchy_Darboux_Seq : Cauchy_prop integral_seq.
Admitted.

Definition integral := Lim (Build_CauchySeq _ _ Cauchy_Darboux_Seq).

End Integral.

Inductive interval : Type :=
  | realline         : interval
  | openl      : IR -> interval
  | openr      : IR -> interval
  | closel     : IR -> interval
  | closer     : IR -> interval
  | olor : IR -> IR -> interval
  | olcr : IR -> IR -> interval
  | clor : IR -> IR -> interval
  | clcr : IR -> IR -> interval.
Definition iprop (I : interval) (x : IR) : CProp.
exact (match I with
  | realline => True
  | openr b  => x [<] b
  | openl a  => a [<] x
  | closer b => x [<=] b
  | closel a => a [<=] x
  | olor a b => a [<] x and x [<] b
  | olcr a b => a [<] x and x [<=] b
  | clor a b => a [<=] x and x [<] b
  | clcr a b => a [<=] x and x [<=] b
  end).
Print Options.
Defined.

Coercion iprop : interval >-> Funclass.

Lemma iprop_wd : forall I : interval, pred_wd _ I.
Admitted.

Section Functions.
Variable I : interval.

Definition Continuous F := included I (Dom F) and (forall a b (Hab : a [<=] b),
 included (Compact Hab) I -> Continuous_I Hab F).

End Functions.

Section Definitions.

Variables a b : IR.
Hypothesis Hab : Min a b [<=] Max a b.
Variable F : PartIR.

Hypothesis HF : Continuous_I Hab F.

Lemma Integral_inc1 : Continuous_I (Min_leEq_lft a b) F.
Admitted.

Lemma Integral_inc2 : Continuous_I (Min_leEq_rht a b) F.
Admitted.

Definition Integral :=
  integral _ _ (Min_leEq_rht a b) F Integral_inc2[-]integral _ _ (Min_leEq_lft a b) _ Integral_inc1.

End Definitions.

Arguments Integral [a b Hab F].

Section Indefinite_Integral.

Variable I : interval.
Variable F : PartIR.

Hypothesis contF : Continuous I F.

Variable a : IR.
Hypothesis Ha : I a.

Lemma prim_lemma : forall x : IR, I x -> Continuous_I (Min_leEq_Max a x) F.
Admitted.

Lemma Fprim_strext : forall x y Hx Hy,
 Integral (prim_lemma x Hx) [#] Integral (prim_lemma y Hy) -> x [#] y.
Admitted.

Definition Fprim : PartIR.
 apply Build_PartFunct with (pfpfun := fun (x : IR) (Hx : I x) => Integral (prim_lemma x Hx)).
Print Options.
  apply iprop_wd.
Print Options.
 exact Fprim_strext.
Print Options.
Defined.

End Indefinite_Integral.

Arguments Fprim [I F].

Notation "[-S-] F" := (Fprim F) (at level 20).
Fixpoint pi_seq (n : nat) : IR.
Admitted.

Lemma pi_seq_Cauchy : Cauchy_prop pi_seq.
Admitted.

Definition Pi := Two[*]Lim (Build_CauchySeq _ _ pi_seq_Cauchy).

Lemma ArcTan_def_lemma : Continuous realline {1/} ( [-C-][1]{+}FId{^}2).
Print Options.
Admitted.

Definition ArcTang := ( [-S-]ArcTan_def_lemma) [0] I.
Print Options.

Definition ArcTan (x : IR) := ArcTang x I.
Import CoRN.model.totalorder.QMinMax.
Import CoRN.stdlib_omissions.Q.

Set Implicit Arguments.

Section Pi.
Let f (a b:Q) : Q.
exact (let (x,y) := a in
 let (z,w) := b in
 Qred ((x*w + y*z)%Z/(y*w-x*z)%Z)).
Defined.

Definition ArcTan_multiple : forall x, -(1) <= x <= 1 -> forall n,
  sumbool True ((nring n)[*]ArcTan (inj_Q _ x)[=]ArcTan (inj_Q _ (iter_nat n _ (f x) 0))).
 intros x Hx.
Print Options.
 induction n.
Print Options.
  right.
Print Options.
 admit.
Print Options.
 destruct (IHn) as [H|H].
Print Options.
  left; constructor.
Print Options.
 set (y:=(iter_nat n Q (f x) 0)) in *.
Print Options.
 destruct (Qlt_le_dec_fast 1 y) as [_|Y0].
Print Options.
  left; constructor.
Print Options.
 destruct (Qlt_le_dec_fast y (-(1))) as [_|Y1].
Print Options.
  left; constructor.
Print Options.
 destruct (Qeq_dec (1-x*y) 0) as [_|Y2].
Print Options.
  left; constructor.
Print Options.
 right.
Print Options.
 admit.
Print Options.
Defined.

Lemma reflect_right : forall A B (x:{A}+{B}), (match x with left _ => False | right _ => True end) -> B.
Admitted.

Lemma Pi_Formula :
(((nring 44)[*]ArcTan (inj_Q IR (1 /  57%Z))[-]
  (nring 12)[*]ArcTan (inj_Q IR (1 / 682%Z))[+]
  (nring  7)[*]ArcTan (inj_Q IR (1 / 239%Z))[+]
  (nring 24)[*]ArcTan (inj_Q IR (1 / 12943%Z)))[=]
 Pi[/]FourNZ).
Print Options.
 assert (H0:-(1) <= (1/(57%Z)) <= 1).
Print Options.
  split; discriminate.
Print Options.
 set (y0:=(iter_nat 44 _ (f (1/57%Z)) 0)).
Print Options.
 csetoid_replace ((nring 44)[*]ArcTan (inj_Q IR (1 / 57%Z)))
   (ArcTan (inj_Q IR y0)); [|apply: (reflect_right (ArcTan_multiple H0 44)); now vm_compute].
Print Options.
🛠️ Intermediate Coq File (useful for debugging if minimization did not go as far as you wanted)
🛠️ 📜 Intermediate Coq File log (useful for debugging if minimization did not go as far as you wanted)
📜 Build Log (contains the Coq error message) (truncated to last 8.0KiB; full 7.7MiB file on GitHub Actions Artifacts under build.log)
2+flambda/bin:/github/workspace/.venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+++ export COQBIN=/github/workspace/builds/coq/coq-failing/_install_ci/bin/
+++ COQBIN=/github/workspace/builds/coq/coq-failing/_install_ci/bin/
++ CI_BUILD_DIR=/github/workspace/builds/coq/coq-failing/_build_ci
++ declare -A overlays
++ set +x
+ git_download corn
+ local project=corn
+ local dest=/github/workspace/builds/coq/coq-failing/_build_ci/corn
+ local giturl_var=corn_CI_GITURL
+ local giturl=https://github.com/coq-community/corn
+ local ref_var=corn_CI_REF
+ local ref=master
+ local parent_project_var=corn_CI_PARENT_PROJECT
+ local parent_project=
+ local submodule_folder_var=corn_CI_SUBMODULE_FOLDER
+ local submodule_folder=
+ local ov_url=
+ local ov_ref=
++ dirname /github/workspace/builds/coq/coq-failing/_build_ci/corn
+ local dest_prefix=/github/workspace/builds/coq/coq-failing/_build_ci/
+ '[' '' = '' ']'
+ local parent_project_dest=/github/workspace/builds/coq/coq-failing/_build_ci/
+ local parent_project_relative_dest=
+ '[' -d /github/workspace/builds/coq/coq-failing/_build_ci/corn ']'
+ echo 'Warning: download and unpacking of corn skipped because /github/workspace/builds/coq/coq-failing/_build_ci/corn already exists.'
Warning: download and unpacking of corn skipped because /github/workspace/builds/coq/coq-failing/_build_ci/corn already exists.
+ '[' '' ']'
+ export 'COQEXTRAFLAGS=-native-compiler no'
+ COQEXTRAFLAGS='-native-compiler no'
+ cd /github/workspace/builds/coq/coq-failing/_build_ci/corn
+ ./configure.sh
Deprecated environment variable COQLIB, use ROCQLIB instead.
Deprecated environment variable COQCORELIB, use ROCQRUNTIMELIB instead.
+ make
+ '[' -z x ']'
+ command make
ROCQ DEP VFILES
Warning: Deprecated environment variable COQLIB, use ROCQLIB instead.
         [deprecated-coq-env-var,deprecated-since-9.0,deprecated,default]
Warning: Deprecated environment variable COQCORELIB,
         use ROCQRUNTIMELIB instead.
         [deprecated-coq-env-var,deprecated-since-9.0,deprecated,default]
.Makefile.d (real: 0.47, user: 0.18, sys: 0.18, mem: 22476 ko)
ROCQ compile reals/fast/CRpi_fast.v
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin/////rocq
MINIMIZER_DEBUG_EXTRA: original invocation: '' 
MINIMIZER_DEBUG_EXTRA: new invocation: /github/workspace/builds/coq/coq-failing/_install_ci/bin/rocq.orig compile -q -w -deprecated-native-compiler-option -native-compiler no -R /github/workspace/builds/coq/coq-failing/_build_ci/corn CoRN reals/fast/CRpi_fast.v 
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: ocamlpath: /github/workspace/builds/coq/coq-failing/_install_ci/lib:
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/corn
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/rocq.orig compile -q -w -deprecated-native-compiler-option -native-compiler no -R /github/workspace/builds/coq/coq-failing/_build_ci/corn CoRN reals/fast/CRpi_fast.v 
MINIMIZER_DEBUG_EXTRA: coqlib: Warning: Deprecated environment variable COQLIB, use ROCQLIB instead.
/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq//
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.DzZM3Ba6hh
MINIMIZER_DEBUG: files:  reals/fast/CRpi_fast.v /github/workspace/builds/coq/coq-failing/_build_ci/corn/reals/fast/CRpi_fast.vWarning, feedback message received but no listener to handle it!
Warning: Deprecated environment variable COQLIB, use ROCQLIB instead.
[deprecated-coq-env-var,deprecated-since-9.0,deprecated,default]Warning, feedback message received but no listener to handle it!
Warning: Deprecated environment variable COQLIB, use ROCQLIB instead.
[deprecated-coq-env-var,deprecated-since-9.0,deprecated,default]
Warning: Deprecated environment variable COQCORELIB,
use ROCQRUNTIMELIB instead.
[deprecated-coq-env-var,deprecated-since-9.0,deprecated,default]
File "./reals/fast/CRpi_fast.v", line 26, characters 0-36:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "./reals/fast/CRpi_fast.v", line 32, characters 0-55:
Warning: Notation "_ = _" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "./reals/fast/CRpi_fast.v", line 32, characters 0-55:
Warning: Notation "_ ≠ _" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "./reals/fast/CRpi_fast.v", line 94, characters 2-45:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 97, characters 3-8:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 100, characters 2-22:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 100, characters 2-22:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 100, characters 2-22:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 100, characters 2-22:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 100, characters 2-22:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 105, characters 1-7:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 105, characters 1-7:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 105, characters 1-7:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 105, characters 1-7:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 105, characters 1-7:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 110, characters 2-50:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 113, characters 2-7:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 120, characters 1-6:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 230, characters 1-154:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 230, characters 1-154:
Error: Stack overflow.

Command exited with non-zero status 1
reals/fast/CRpi_fast.vo (real: 3.49, user: 3.03, sys: 0.34, mem: 1731772 ko)
make[1]: *** [Makefile:815: reals/fast/CRpi_fast.vo] Error 1
make[1]: *** [reals/fast/CRpi_fast.vo] Deleting file 'reals/fast/CRpi_fast.glob'
make: *** [Makefile:411: all] Error 2
+ code=2
+ printf '\n%s exit code: %s\n' corn 2
+ '[' corn '!=' stdlib_test ']'
+ echo 'Aggregating timing log...'
Aggregating timing log...
+ echo

+ tools/make-one-time-file.py --real _build_ci/corn.log
    Time |   Peak Mem | File Name              
-----------------------------------------------
0m03.96s | 1731772 ko | Total Time / Peak Mem  
-----------------------------------------------
0m03.49s | 1731772 ko | reals/fast/CRpi_fast.vo
0m00.47s |   22476 ko | .Makefile.d            
+ '[' '' ']'
+ exit 2
/github/workspace/builds/coq /github/workspace
::endgroup::
📜 🔎 Minimization Log (truncated to last 8.0KiB; full 14MiB file on GitHub Actions Artifacts under bug.log)
le "/tmp/tmpthrj2ban/Top/bug_01.v", line 223, characters 0-34:
Warning: Library File Stdlib.ZArith.ZArith_base is deprecated
since Stdlib 9.0. use ZArith instead
[deprecated-library-file-since-Stdlib-9.0,deprecated-since-Stdlib-9.0,deprecated-library-file,deprecated,default]
File "/tmp/tmpthrj2ban/Top/bug_01.v", line 282, characters 7-20:
Warning: Coq.Init.Ltac has been replaced by Corelib.Init.Ltac.
[deprecated-dirpath-Coq,deprecated-since-9.0,deprecated,default]
File "/tmp/tmpthrj2ban/Top/bug_01.v", line 295, characters 0-27:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "/tmp/tmpthrj2ban/Top/bug_01.v", line 379, characters 28-45:
Error: The reference field_mult_inv_op was not found in the current
environment. Did you mean field_mult_inv?


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Admitting definitions unsuccessful.
No successful changes.

I will now attempt to admit lemmas with Admitted with Proof using

Non-fatal error: Failed to admit lemmas and preserve the error.  
The new error was:
Deprecated environment variable COQCORELIB, use ROCQRUNTIMELIB instead.
Warning: Deprecated environment variable COQCORELIB,
use ROCQRUNTIMELIB instead.
[deprecated-coq-env-var,deprecated-since-9.0,deprecated,default]
File "/tmp/tmpmhjpfu_1/Top/bug_01.v", line 223, characters 0-34:
Warning: Library File Stdlib.ZArith.ZArith_base is deprecated
since Stdlib 9.0. use ZArith instead
[deprecated-library-file-since-Stdlib-9.0,deprecated-since-Stdlib-9.0,deprecated-library-file,deprecated,default]
File "/tmp/tmpmhjpfu_1/Top/bug_01.v", line 282, characters 7-20:
Warning: Coq.Init.Ltac has been replaced by Corelib.Init.Ltac.
[deprecated-dirpath-Coq,deprecated-since-9.0,deprecated,default]
File "/tmp/tmpmhjpfu_1/Top/bug_01.v", line 295, characters 0-27:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "/tmp/tmpmhjpfu_1/Top/bug_01.v", line 383, characters 28-45:
Error: The reference field_mult_inv_op was not found in the current
environment. Did you mean field_mult_inv?


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Admitting lemmas unsuccessful.
No successful changes.

I will now attempt to admit definitions with Admitted with Proof using

Non-fatal error: Failed to admit definitions and preserve the error.  
The new error was:
Deprecated environment variable COQCORELIB, use ROCQRUNTIMELIB instead.
Warning: Deprecated environment variable COQCORELIB,
use ROCQRUNTIMELIB instead.
[deprecated-coq-env-var,deprecated-since-9.0,deprecated,default]
File "/tmp/tmpi2xacp8f/Top/bug_01.v", line 223, characters 0-34:
Warning: Library File Stdlib.ZArith.ZArith_base is deprecated
since Stdlib 9.0. use ZArith instead
[deprecated-library-file-since-Stdlib-9.0,deprecated-since-Stdlib-9.0,deprecated-library-file,deprecated,default]
File "/tmp/tmpi2xacp8f/Top/bug_01.v", line 282, characters 7-20:
Warning: Coq.Init.Ltac has been replaced by Corelib.Init.Ltac.
[deprecated-dirpath-Coq,deprecated-since-9.0,deprecated,default]
File "/tmp/tmpi2xacp8f/Top/bug_01.v", line 295, characters 0-27:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "/tmp/tmpi2xacp8f/Top/bug_01.v", line 378, characters 28-45:
Error: The reference field_mult_inv_op was not found in the current
environment. Did you mean field_mult_inv?


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Admitting definitions unsuccessful.
No successful changes.

I will now attempt to admit lemmas with admit. Defined with Proof using

Non-fatal error: Failed to admit lemmas and preserve the error.  
The new error was:
Deprecated environment variable COQCORELIB, use ROCQRUNTIMELIB instead.
Warning: Deprecated environment variable COQCORELIB,
use ROCQRUNTIMELIB instead.
[deprecated-coq-env-var,deprecated-since-9.0,deprecated,default]
File "/tmp/tmpyn3y8q18/Top/bug_01.v", line 223, characters 0-34:
Warning: Library File Stdlib.ZArith.ZArith_base is deprecated
since Stdlib 9.0. use ZArith instead
[deprecated-library-file-since-Stdlib-9.0,deprecated-since-Stdlib-9.0,deprecated-library-file,deprecated,default]
File "/tmp/tmpyn3y8q18/Top/bug_01.v", line 282, characters 7-20:
Warning: Coq.Init.Ltac has been replaced by Corelib.Init.Ltac.
[deprecated-dirpath-Coq,deprecated-since-9.0,deprecated,default]
File "/tmp/tmpyn3y8q18/Top/bug_01.v", line 295, characters 0-27:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "/tmp/tmpyn3y8q18/Top/bug_01.v", line 384, characters 28-45:
Error: The reference field_mult_inv_op was not found in the current
environment. Did you mean field_mult_inv?


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Admitting lemmas unsuccessful.
No successful changes.

I will now attempt to admit definitions with admit. Defined with Proof using

Non-fatal error: Failed to admit definitions and preserve the error.  
The new error was:
Deprecated environment variable COQCORELIB, use ROCQRUNTIMELIB instead.
Warning: Deprecated environment variable COQCORELIB,
use ROCQRUNTIMELIB instead.
[deprecated-coq-env-var,deprecated-since-9.0,deprecated,default]
File "/tmp/tmphihek560/Top/bug_01.v", line 223, characters 0-34:
Warning: Library File Stdlib.ZArith.ZArith_base is deprecated
since Stdlib 9.0. use ZArith instead
[deprecated-library-file-since-Stdlib-9.0,deprecated-since-Stdlib-9.0,deprecated-library-file,deprecated,default]
File "/tmp/tmphihek560/Top/bug_01.v", line 282, characters 7-20:
Warning: Coq.Init.Ltac has been replaced by Corelib.Init.Ltac.
[deprecated-dirpath-Coq,deprecated-since-9.0,deprecated,default]
File "/tmp/tmphihek560/Top/bug_01.v", line 295, characters 0-27:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "/tmp/tmphihek560/Top/bug_01.v", line 380, characters 28-45:
Error: The reference field_mult_inv_op was not found in the current
environment. Did you mean field_mult_inv?


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Admitting definitions unsuccessful.
No successful changes.

I will now attempt to add Proof using lines

Non-fatal error: Failed to add Proof using lines and preserve the error.  
The new error was:
Deprecated environment variable COQCORELIB, use ROCQRUNTIMELIB instead.
Warning: Deprecated environment variable COQCORELIB,
use ROCQRUNTIMELIB instead.
[deprecated-coq-env-var,deprecated-since-9.0,deprecated,default]
File "/tmp/tmpmnm1i8u0/Top/bug_01.v", line 223, characters 0-34:
Warning: Library File Stdlib.ZArith.ZArith_base is deprecated
since Stdlib 9.0. use ZArith instead
[deprecated-library-file-since-Stdlib-9.0,deprecated-since-Stdlib-9.0,deprecated-library-file,deprecated,default]
File "/tmp/tmpmnm1i8u0/Top/bug_01.v", line 282, characters 7-20:
Warning: Coq.Init.Ltac has been replaced by Corelib.Init.Ltac.
[deprecated-dirpath-Coq,deprecated-since-9.0,deprecated,default]
File "/tmp/tmpmnm1i8u0/Top/bug_01.v", line 295, characters 0-27:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "/tmp/tmpmnm1i8u0/Top/bug_01.v", line 378, characters 0-32:
Error: Anomaly "Non-qed command classified incorrectly"
Please report at http://rocq-prover.org/bugs/.


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Adding Proof using lines unsuccessful.
No successful changes.

I will now attempt to export modules
Module exportation successful

I will now attempt to split imports and exports
Import/Export splitting unsuccessful.

I will now attempt to split := definitions
One-line definition splitting successful

I will now attempt to lift Requires to the top of the file while inserting option settings

I will now attempt to lift Requires to the top of the file while inserting option settings

I will now attempt to remove all lines, one at a time

If you have any comments on your experience of the minimizer, please share them in a reply (possibly tagging @JasonGross).
If you believe there's a bug in the bug minimizer, please report it on the bug minimizer issue tracker.

@coqbot-app
Copy link
Contributor

coqbot-app bot commented Feb 28, 2026

Minimization interrupted by timeout, being automatically continued. Partially Minimized File /home/runner/work/run-coq-bug-minimizer/run-coq-bug-minimizer/builds/coq/coq-failing/_build_ci/corn/reals/fast/CRpi_fast.v in 5h 15m 7s (from ci-corn) (interrupted by timeout, being automatically continued) (full log on GitHub Actions - verbose log)
⭐ ⏱️ Partially Minimized Coq File (timeout) (truncated to first and last 32KiB; full 48KiB file on GitHub Actions Artifacts under bug.v)
(* -*- mode: coq; coq-prog-args: ("-emacs" "-q" "-w" "-deprecated-native-compiler-option" "-native-compiler" "no" "-coqlib" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq//" "-R" "/github/workspace/builds/coq/coq-failing/_build_ci/corn" "CoRN" "-Q" "/github/workspace/cwd" "Top" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq///user-contrib/Bignums" "Bignums" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq///user-contrib/HB" "HB" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq///user-contrib/Ltac2" "Ltac2" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq///user-contrib/MathClasses" "MathClasses" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq///user-contrib/Stdlib" "Stdlib" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq///user-contrib/elpi" "elpi" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq///user-contrib/elpi_elpi" "elpi_elpi" "-Q" "/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq///user-contrib/elpi_examples" "elpi_examples" "-top" "Top.bug_01") -*- *)
(* File reduced by coq-bug-minimizer from original input, then from 362 lines to 68 lines, then from 80 lines to 1074 lines, then from 1081 lines to 78 lines, then from 89 lines to 1725 lines, then from 1732 lines to 96 lines, then from 108 lines to 1195 lines, then from 1202 lines to 99 lines, then from 110 lines to 1587 lines, then from 1594 lines to 117 lines, then from 129 lines to 896 lines, then from 903 lines to 120 lines, then from 131 lines to 1147 lines, then from 1154 lines to 132 lines, then from 143 lines to 1154 lines, then from 1161 lines to 144 lines, then from 155 lines to 1086 lines, then from 1093 lines to 156 lines, then from 167 lines to 1191 lines, then from 1198 lines to 214 lines, then from 225 lines to 1320 lines, then from 1327 lines to 357 lines, then from 362 lines to 135 lines, then from 147 lines to 1975 lines, then from 1982 lines to 145 lines, then from 156 lines to 1770 lines, then from 1777 lines to 210 lines, then from 221 lines to 2049 lines, then from 2056 lines to 242 lines, then from 253 lines to 1745 lines, then from 1752 lines to 244 lines, then from 255 lines to 1816 lines, then from 1823 lines to 259 lines, then from 271 lines to 1478 lines, then from 1485 lines to 296 lines, then from 307 lines to 1721 lines, then from 1728 lines to 315 lines, then from 327 lines to 1175 lines, then from 1182 lines to 317 lines, then from 329 lines to 1252 lines, then from 1258 lines to 346 lines, then from 357 lines to 1685 lines, then from 1692 lines to 555 lines, then from 563 lines to 210 lines, then from 222 lines to 972 lines, then from 978 lines to 220 lines, then from 231 lines to 1055 lines, then from 1062 lines to 248 lines, then from 259 lines to 2033 lines, then from 2038 lines to 311 lines, then from 322 lines to 1621 lines, then from 1627 lines to 331 lines, then from 342 lines to 1683 lines, then from 1690 lines to 368 lines, then from 379 lines to 730 lines, then from 737 lines to 384 lines, then from 395 lines to 750 lines, then from 757 lines to 410 lines, then from 421 lines to 763 lines, then from 770 lines to 418 lines, then from 429 lines to 840 lines, then from 847 lines to 426 lines, then from 437 lines to 767 lines, then from 774 lines to 447 lines, then from 458 lines to 780 lines, then from 787 lines to 455 lines, then from 466 lines to 812 lines, then from 819 lines to 469 lines, then from 480 lines to 1590 lines, then from 1596 lines to 594 lines, then from 604 lines to 310 lines, then from 322 lines to 646 lines, then from 653 lines to 333 lines, then from 344 lines to 1365 lines, then from 1372 lines to 357 lines, then from 368 lines to 680 lines, then from 687 lines to 375 lines, then from 386 lines to 1323 lines, then from 1327 lines to 1009 lines, then from 1020 lines to 2472 lines, then from 2478 lines to 1095 lines, then from 1106 lines to 3016 lines, then from 3017 lines to 2780 lines, then from 2791 lines to 3122 lines, then from 3129 lines to 2998 lines, then from 3005 lines to 2805 lines, then from 2817 lines to 3217 lines, then from 3223 lines to 2906 lines, then from 2917 lines to 4126 lines, then from 4133 lines to 3112 lines, then from 3123 lines to 4291 lines, then from 4292 lines to 4398 lines, then from 4363 lines to 4061 lines, then from 4073 lines to 5710 lines, then from 5711 lines to 593 lines, then from 605 lines to 1615 lines, then from 1622 lines to 590 lines, then from 601 lines to 1380 lines, then from 1387 lines to 1096 lines, then from 1107 lines to 1980 lines, then from 1985 lines to 1777 lines *)
(* coqc version 9.3+alpha compiled with OCaml 4.14.2
   coqtop version 9.3+alpha
   Expected coqc runtime on this file: 1.734 sec
   Expected coqc peak memory usage on this file: 5286384.0 kb *)









Require CoRN.tactics.Step.
Require Corelib.Classes.Morphisms.
Require Corelib.Program.Wf.
Require Corelib.BinNums.IntDef.
Require Corelib.Init.Sumbool.
Require Corelib.Classes.Morphisms_Prop.
Require Corelib.Program.Basics.
Require Corelib.Lists.ListDef.
Require Corelib.Classes.Equivalence.
Require Corelib.Numbers.BinNums.
Require Corelib.Init.Ltac.
Require Corelib.BinNums.NatDef.
Require Corelib.Setoids.Setoid.
Require Corelib.BinNums.PosDef.
Require Corelib.Program.Utils.
Require Corelib.Classes.RelationClasses.
Require Corelib.Program.Tactics.
Require Corelib.Init.Wf.
Require Corelib.Classes.SetoidTactics.
Require Corelib.Relations.Relation_Definitions.
Require MathClasses.theory.CoqStreams.
Require Stdlib.Classes.DecidableClass.
Require Stdlib.Logic.Decidable.
Require Stdlib.Logic.EqdepFacts.
Require Stdlib.Logic.FunctionalExtensionality.
Require Stdlib.Logic.HLevelsBase.
Require Stdlib.Program.Syntax.
Require Stdlib.Unicode.Utf8_core.
Require Stdlib.micromega.ZifyClasses.
Require Stdlib.setoid_ring.Algebra_syntax.
Require Stdlib.BinNums.NatDef.
Require Stdlib.BinNums.IntDef.
Require Stdlib.BinNums.PosDef.
Require Stdlib.Classes.SetoidTactics.
Require Stdlib.Classes.Morphisms.
Require Stdlib.Classes.Equivalence.
Require Stdlib.Classes.RelationClasses.
Require Stdlib.Classes.Morphisms_Prop.
Require Stdlib.Init.Wf.
Require Stdlib.Init.Sumbool.
Require Stdlib.Lists.ListDef.
Require Stdlib.Logic.Eqdep.
Require Stdlib.Logic.Eqdep_dec.
Require Stdlib.Logic.ProofIrrelevanceFacts.
Require Stdlib.Numbers.BinNums.
Require Stdlib.Program.Basics.
Require Stdlib.Program.Tactics.
Require Stdlib.Program.Utils.
Require Stdlib.Program.Wf.
Require Stdlib.Relations.Relation_Definitions.
Require Stdlib.Setoids.Setoid.
Require Stdlib.Unicode.Utf8.
Require CoRN.tactics.CornTac.
Require Stdlib.Bool.Bool.
Require Stdlib.Logic.JMeq.
Require Stdlib.Logic.ProofIrrelevance.
Require Stdlib.Relations.Relation_Operators.
Require Stdlib.Program.Combinators.
Require Stdlib.Relations.Operators_Properties.
Require Stdlib.PArith.BinPosDef.
Require Stdlib.Relations.Relations.
Require Stdlib.Program.Equality.
Require Stdlib.Numbers.NumPrelude.
Require Stdlib.Program.WfExtensionality.
Require MathClasses.misc.stdlib_hints.
Require Stdlib.Structures.Equalities.
Require Stdlib.Program.Subset.
Require Stdlib.Structures.Orders.
Require Stdlib.Structures.OrdersTac.
Require Stdlib.Structures.OrdersFacts.
Require Stdlib.Structures.GenericMinMax.
Require Stdlib.Program.Program.
Require Stdlib.Numbers.NatInt.NZAxioms.
Require Stdlib.Numbers.NatInt.NZBase.
Require Stdlib.Numbers.NatInt.NZAdd.
Require Stdlib.Numbers.NatInt.NZMul.
Require Stdlib.Numbers.NatInt.NZOrder.
Require Stdlib.Numbers.NatInt.NZAddOrder.
Require Stdlib.Numbers.NatInt.NZMulOrder.
Require MathClasses.interfaces.canonical_names.
Require Stdlib.Numbers.NatInt.NZDiv.
Require Stdlib.Numbers.NatInt.NZGcd.
Require Stdlib.Numbers.NatInt.NZParity.
Require Stdlib.Numbers.NatInt.NZPow.
Require Stdlib.Numbers.NatInt.NZSqrt.
Require MathClasses.misc.propholds.
Require MathClasses.misc.setoid_tactics.
Require MathClasses.misc.util.
Require Stdlib.Numbers.NatInt.NZLog.
Require MathClasses.misc.workarounds.
Require Stdlib.Numbers.NatInt.NZBits.
Require MathClasses.misc.decision.
Require Stdlib.Numbers.Integer.Abstract.ZAxioms.
Require Stdlib.Numbers.Natural.Abstract.NAxioms.
Require Stdlib.Numbers.Integer.Abstract.ZBase.
Require Stdlib.Numbers.Natural.Abstract.NBase.
Require Stdlib.Numbers.Integer.Abstract.ZAdd.
Require Stdlib.Numbers.Natural.Abstract.NAdd.
Require Stdlib.Numbers.Integer.Abstract.ZMul.
Require Stdlib.Numbers.Natural.Abstract.NOrder.
Require MathClasses.interfaces.abstract_algebra.
Require Stdlib.Numbers.Integer.Abstract.ZLt.
Require Stdlib.Numbers.Natural.Abstract.NAddOrder.
Require MathClasses.interfaces.orders.
Require CoRN.model.totalorder.QMinMax.
Require CoRN.model.structures.Qsec.
Require CoRN.algebra.CMonoids.
Axiom proof_admitted : False.
Tactic Notation "admit" := abstract case proof_admitted.

Module Export CoRN_DOT_algebra_DOT_CGroups_WRAPPED.
Module Export CGroups.
Export CoRN.algebra.CMonoids.





Definition is_CGroup (G : CMonoid) (inv : CSetoid_un_op G) :=
  forall x, is_inverse csg_op [0] x (inv x).

Record CGroup : Type :=
  {cg_crr   : CMonoid;
   cg_inv   :  CSetoid_un_op cg_crr;
   cg_proof :  is_CGroup cg_crr cg_inv}.

Module Export coercions.
  Coercion cg_crr : CGroup >-> CMonoid.
End coercions.





Arguments cg_inv {c}.
Notation "[--] x" := (cg_inv x) (at level 4, right associativity).

Definition cg_minus (G : CGroup) (x y : G) := x[+] [--]y.



Arguments cg_minus [G].
Infix "[-]" := cg_minus (at level 50, left associativity).




Section CGroup_axioms.
Variable G : CGroup.

Lemma cg_inverse : forall x : G, is_inverse csg_op [0] x [--] x.
Proof cg_proof G.

End CGroup_axioms.


Section CGroup_basics.
Variable G : CGroup.

Lemma cg_rht_inv_unfolded : forall x : G, x[+] [--] x [=] [0].
Proof.
 intro x; elim (cg_inverse G x); auto.
Qed.

Lemma cg_lft_inv_unfolded : forall x : G, [--] x[+]x [=] [0].
Proof.
 intro x; elim (cg_inverse G x); auto.
Qed.

Lemma cg_minus_correct : forall x : G, x [-] x [=] [0].
Proof.
 intro x.
 unfold cg_minus in |- *.
 apply cg_rht_inv_unfolded.
Qed.
Hint Resolve cg_rht_inv_unfolded cg_lft_inv_unfolded cg_minus_correct:
  algebra.

Lemma cg_inverse' : forall x : G, is_inverse csg_op [0] [--] x x.
Proof.
 intro x.
 split; algebra.
Qed.


Lemma cg_minus_unfolded : forall x y : G, x [-] y [=] x[+] [--] y.
Proof.
 algebra.
Qed.
Hint Resolve cg_minus_unfolded: algebra.

Lemma cg_minus_wd : forall x x' y y' : G, x [=] x' -> y [=] y' -> x [-] y [=] x' [-] y'.
Proof.
 intros x x' y y' H H0.
 unfold cg_minus in |- *.
 Step_final (x[+] [--] y').
Qed.
Hint Resolve cg_minus_wd: algebra_c.

Lemma cg_minus_strext : forall x x' y y' : G, x [-] y [#] x' [-] y' -> x [#] x' or y [#] y'.
Proof.
 intros x x' y y' H.
cut (x [#] x' or [--] y [#] [--] y').
 intro H0.
elim H0.
  left; trivial.
  intro H1.
  right; exact (cs_un_op_strext G cg_inv y y' H1).
 apply bin_op_strext_unfolded with (csg_op (c:=G)).
trivial.
Qed.

Definition cg_minus_is_csetoid_bin_op : CSetoid_bin_op G :=
  Build_CSetoid_bin_op G (cg_minus (G:=G)) cg_minus_strext.

Lemma grp_inv_assoc : forall x y : G, x[+]y [-] y [=] x.
Proof.
 intros x y; unfold cg_minus in |- *.
 astepl (x[+](y[+] [--] y)).
 Step_final (x[+][0]).
Qed.
Hint Resolve grp_inv_assoc: algebra.

Lemma cg_inv_unique : forall x y : G, x[+]y [=] [0] -> y [=] [--] x.
Proof.
 intros x y H.
 astepl ([0][+]y).
 astepl ([--] x[+]x[+]y).
 astepl ([--] x[+](x[+]y)).
 Step_final ([--] x[+][0]).
Qed.

Lemma cg_inv_inv : forall x : G, [--] [--] x [=] x.
Proof.
 intro x.
 astepl ([0][+] [--] [--] x).
 astepl (x[+] [--] x[+] [--] [--] x).
 astepl (x[+]([--] x[+] [--] [--] x)).
 Step_final (x[+][0]).
Qed.
Hint Resolve cg_inv_inv: algebra.

Lemma cg_cancel_lft : forall x y z : G, x[+]y [=] x[+]z -> y [=] z.
Proof.
 intros x y z H.
 astepl ([0][+]y).
 astepl ([--] x[+]x[+]y).
 astepl ([--] x[+](x[+]y)).
 astepl ([--] x[+](x[+]z)).
 astepl ([--] x[+]x[+]z).
 Step_final ([0][+]z).
Qed.

Lemma cg_cancel_rht : forall x y z : G, y[+]x [=] z[+]x -> y [=] z.
Proof.
 intros x y z H.
 astepl (y[+][0]).
 astepl (y[+](x[+] [--] x)).
 astepl (y[+]x[+] [--] x).
 astepl (z[+]x[+] [--] x).
 astepl (z[+](x[+] [--] x)).
 Step_final (z[+][0]).
Qed.

Lemma cg_inv_unique' : forall x y : G, x[+]y [=] [0] -> x [=] [--] y.
Proof.
 intros x y H.
 astepl (x[+][0]).
 astepl (x[+](y[+] [--] y)).
 astepl (x[+]y[+] [--] y).
 Step_final ([0][+] [--] y).
Qed.

Lemma cg_inv_unique_2 : forall x y : G, x [-] y [=] [0] -> x [=] y.
Proof.
 intros x y H.
 generalize (cg_inv_unique _ _ H); intro H0.
 astepl ([--] [--] x).
 Step_final ([--] [--] y).
Qed.

Lemma cg_zero_inv : [--] ([0]:G) [=] [0].
Proof.
 apply eq_symmetric_unfolded; apply cg_inv_unique; algebra.
Qed.

Hint Resolve cg_zero_inv: algebra.

Lemma cg_inv_zero : forall x : G, x [-] [0] [=] x.
Proof.
 intro x.
 unfold cg_minus in |- *.
 Step_final (x[+][0]).
Qed.

Lemma cg_inv_op : forall x y : G, [--] (x[+]y) [=] [--] y[+] [--] x.
Proof.
 intros x y.
 apply (eq_symmetric G).
 apply cg_inv_unique.
 astepl (x[+]y[+] [--] y[+] [--] x).
 astepl (x[+](y[+] [--] y)[+] [--] x).
 astepl (x[+][0][+] [--] x).
 Step_final (x[+] [--] x).
Qed.



Lemma x_minus_x : forall x y : G, x [=] y -> x [-] y [=] [0].
Proof.
 intros x y H; Step_final (x [-] x).
Qed.


Section SubCGroups.
Variable P : G -> CProp.
Variable Punit : P [0].
Variable op_pres_P : bin_op_pres_pred _ P csg_op.
Variable inv_pres_P : un_op_pres_pred _ P cg_inv.

Let subcrr : CMonoid := Build_SubCMonoid _ _ Punit op_pres_P.
Let subinv : CSetoid_un_op subcrr := Build_SubCSetoid_un_op _ _ _ inv_pres_P.

Lemma isgrp_scrr : is_CGroup subcrr subinv.
Proof.
 red in |- *.
intro x.
case x.
intros.
split; simpl in |- *; algebra.
Qed.

Definition Build_SubCGroup : CGroup := Build_CGroup subcrr _ isgrp_scrr.

End SubCGroups.

End CGroup_basics.

Add Parametric Morphism c : (@cg_minus c) with signature (@cs_eq (cg_crr c)) ==> (@cs_eq c) ==> (@cs_eq c) as cg_minus_wd_morph.
Proof.
 intros.
 apply cg_minus_wd; assumption.
Qed.

#[global]
Hint Resolve cg_rht_inv_unfolded cg_lft_inv_unfolded: algebra.
#[global]
Hint Resolve cg_inv_inv cg_minus_correct cg_zero_inv cg_inv_zero: algebra.
#[global]
Hint Resolve cg_minus_unfolded grp_inv_assoc cg_inv_op: algebra.
#[global]
Hint Resolve cg_minus_wd: algebra_c.


Section Assoc_properties.
Variable G : CGroup.

Lemma assoc_2 : forall x y z : G, x[+] (y [-] z) [=] x[+]y [-] z.
Proof.
 intros x y z; unfold cg_minus in |- *; algebra.
Qed.

Lemma zero_minus : forall x : G, [0] [-] x [=] [--] x.
Proof.
 intro x.
 unfold cg_minus in |- *.
 algebra.
Qed.

Lemma cg_cancel_mixed : forall x y : G, x [=] x [-] y[+]y.
Proof.
 intros x y.
 unfold cg_minus in |- *.
 astepr (x[+]([--] y[+]y)).
 Step_final (x[+][0]).
Qed.

Lemma plus_resp_eq : forall x y z : G, y [=] z -> x[+]y [=] x[+]z.
Proof.
 algebra.
Qed.

End Assoc_properties.

#[global]
Hint Resolve assoc_2 Nat.add_sub zero_minus cg_cancel_mixed plus_resp_eq:
  algebra.


Section cgroups_apartness.
Variable G : CGroup.

Lemma cg_add_ap_zero : forall x y : G, x[+]y [#] [0] -> x [#] [0] or y [#] [0].
Proof.
 intros x y H.
 apply (cs_bin_op_strext _ csg_op x [0] y [0]).
 astepr ([0]:G).
 auto.
Qed.

Lemma op_rht_resp_ap : forall x y z : G, x [#] y -> x[+]z [#] y[+]z.
Proof.
 intros x y z H.
 cut (x[+]z [-] z [#] y[+]z [-] z).
  intros h.
  case (cs_bin_op_strext _ _ _ _ _ _ h).
   auto.
  intro contra; elim (ap_irreflexive _ _ contra).
 astepl x; astepr y.
auto.
Qed.

Lemma cg_ap_cancel_rht : forall x y z : G, x[+]z [#] y[+]z -> x [#] y.
Proof.
 intros x y z H.
 apply ap_wdr_unfolded with (y[+]z [-] z).
  apply ap_wdl_unfolded with (x[+]z [-] z).
   apply (op_rht_resp_ap _ _ [--] z H).
  astepr (x[+][0]).
  Step_final (x[+](z [-] z)).
 astepr (y[+][0]).
 Step_final (y[+](z [-] z)).
Qed.

Lemma plus_cancel_ap_rht : forall x y z : G, x[+]z [#] y[+]z -> x [#] y.
Proof cg_ap_cancel_rht.

Lemma minus_ap_zero : forall x y : G, x [#] y -> x [-] y [#] [0].
Proof.
 intros x y H.
 astepr (y [-] y).
 unfold cg_minus in |- *.
 apply op_rht_resp_ap; assumption.
Qed.

Lemma zero_minus_apart : forall x y : G, x [-] y [#] [0] -> x [#] y.
Proof.
 unfold cg_minus in |- *.
intros x y H.
 cut (x[+] [--] y [#] y[+] [--] y).
intros h.
  apply (cg_ap_cancel_rht _ _ _ h).
 astepr ([0]:G).
auto.
Qed.

Lemma inv_resp_ap_zero : forall x : G, x [#] [0] -> [--] x [#] [0].
Proof.
 intros x H.
 astepl ([0][+] [--] x).
 astepl ([0] [-] x).
 apply minus_ap_zero.
 apply (ap_symmetric G).
 auto.
Qed.

Lemma inv_resp_ap : forall x y : G, x [#] y -> [--] x [#] [--] y.
Proof.
 intros x y H.
 apply (csf_strext _ _ (cg_inv (c:=G))).
 astepl x.
 astepr y.
 auto.
Qed.

Lemma minus_resp_ap_rht : forall x y z : G, x [#] y -> x [-] z [#] y [-] z.
Proof.
 intros x y z H.
 unfold cg_minus in |- *.
 apply op_rht_resp_ap.
 assumption.
Qed.

Lemma minus_resp_ap_lft : forall x y z : G, x [#] y -> z [-] x [#] z [-] y.
Proof.
 intros x y z H.
 astepl ([--] (x [-] z)).
  2: unfold cg_minus in |- *; Step_final ([--] [--] z[+] [--] x).
 astepr ([--] (y [-] z)).
  2: unfold cg_minus in |- *; Step_final ([--] [--] z[+] [--] y).
 apply inv_resp_ap.
 apply minus_resp_ap_rht.
 auto.
Qed.

Lemma minus_cancel_ap_rht : forall x y z : G, x [-] z [#] y [-] z -> x [#] y.
Proof.
 unfold cg_minus in |- *.
 intros x y z H.
 exact (plus_cancel_ap_rht _ _ _ H).
Qed.

End cgroups_apartness.
#[global]
Hint Resolve op_rht_resp_ap: algebra.
#[global]
Hint Resolve minus_ap_zero zero_minus_apart inv_resp_ap_zero: algebra.

Section CGroup_Ops.



Definition PS_Inv (A : CSetoid) : PS_as_CMonoid A -> PS_as_CMonoid A.
Proof.
 simpl in |- *.
 intros f.
 elim f.
 intros fo prfo.
 set (H0 := Inv fo prfo) in *.
 apply Build_subcsetoid_crr with H0.
 unfold H0 in |- *.
 apply Inv_bij.
Defined.

Definition Inv_as_un_op (A : CSetoid) : CSetoid_un_op (PS_as_CMonoid A).
Proof.
 unfold CSetoid_un_op in |- *.
 apply Build_CSetoid_fun with (PS_Inv A).
 unfold fun_strext in |- *.
 intros x y.
 case x.
 case y.
 simpl in |- *.
 intros f H g H0.
 unfold ap_fun in |- *.
 intro H1.
 elim H1.
 clear H1.
 intros a H1.
 exists (Inv g H0 a).
 astepl a.
  2: simpl in |- *.
  2: apply eq_symmetric_unfolded.
  2: apply inv1.
 unfold bijective in H.
 elim H.
 unfold injective in |- *.
 intros H2 H3.
 astepl (f (Inv f H a)).
  apply H2.
  apply ap_symmetric_unfolded.
  exact H1.
 simpl in |- *.
 apply inv1.
Defined.

Lemma PS_is_CGroup :
 forall A : CSetoid, is_CGroup (PS_as_CMonoid A) (Inv_as_un_op A).
Proof.
 intro A.
 unfold is_CGroup in |- *.
 intro x.
 unfold is_inverse in |- *.
 simpl in |- *.
 split.
  case x.
  simpl in |- *.
  intros f H.
  unfold eq_fun in |- *.
  intro a.
  unfold comp in |- *.
  simpl in |- *.
  apply inv2.
 case x.
 simpl in |- *.
 intros f H.
 unfold eq_fun in |- *.
 intro a.
 unfold comp in |- *.
 simpl in |- *.
 apply inv1.
Qed.

Definition PS_as_CGroup (A : CSetoid) :=
  Build_CGroup (PS_as_CMonoid A) (Inv_as_un_op A) (PS_is_CGroup A).



Variable G : CGroup.

Variables F F' : PartFunct G.


Let P := Dom F.
Let Q := Dom F'.


Section Part_Function_Inv.

Lemma part_function_inv_strext : forall x y (Hx : P x) (Hy : P y),
 [--] (F x Hx) [#] [--] (F y Hy) -> x [#] y.
Proof.
 intros x y Hx Hy H.
 apply pfstrx with F Hx Hy.
 apply un_op_strext_unfolded with (cg_inv (c:=G)); assumption.
Qed.

Definition Finv := Build_PartFunct _ _
 (dom_wd _ F) (fun x Hx => [--] (F x Hx)) part_function_inv_strext.

End Part_Function_Inv.

Section Part_Function_Minus.

Lemma part_function_minus_strext : forall x y (Hx : Conj P Q x) (Hy : Conj P Q y),
 F x (Prj1 Hx) [-] F' x (Prj2 Hx) [#] F y (Prj1 Hy) [-] F' y (Prj2 Hy) -> x [#] y.
Proof.
 intros x y Hx Hy H.
 cut (F x (Prj1 Hx) [#] F y (Prj1 Hy) or F' x (Prj2 Hx) [#] F' y (Prj2 Hy)).
  intro H0.
  elim H0; intro H1; exact (pfstrx _ _ _ _ _ _ H1).
 apply cg_minus_strext; auto.
Qed.

Definition Fminus := Build_PartFunct G _ (conj_wd (dom_wd _ F) (dom_wd _ F'))
 (fun x Hx => F x (Prj1 Hx) [-] F' x (Prj2 Hx)) part_function_minus_strext.

End Part_Function_Minus.



Variable R:G -> CProp.

Lemma included_FInv : included R P -> included R (Dom Finv).
Proof.
 intro; simpl in |- *; assumption.
Qed.

Lemma included_FInv' : included R (Dom Finv) -> included R P.
Proof.
 intro; simpl in |- *; assumption.
Qed.

Lemma included_FMinus : included R P -> included R Q -> included R (Dom Fminus).
Proof.
 intros; simpl in |- *; apply included_conj; assumption.
Qed.

Lemma included_FMinus' : included R (Dom Fminus) -> included R P.
Proof.
 intro H; simpl in H; eapply included_conj_lft; apply H.
Qed.

Lemma included_FMinus'' : included R (Dom Fminus) -> included R Q.
Proof.
 intro H; simpl in H; eapply included_conj_rht; apply H.
Qed.

End CGroup_Ops.

Arguments Finv [G].
Notation "{--} x" := (Finv x) (at level 4, right associativity).

Arguments Fminus [G].
Infix "{-}" := Fminus (at level 50, left associativity).

#[global]
Hint Resolve included_FInv included_FMinus : included.

#[global]
Hint Immediate included_FInv' included_FMinus' included_FMinus'' : included.

End CGroups.

End CoRN_DOT_algebra_DOT_CGroups_WRAPPED.
Module Export CoRN_DOT_algebra_DOT_CGroups.
Module Export CoRN.
Module Export algebra.
Module CGroups.
Include CoRN_DOT_algebra_DOT_CGroups_WRAPPED.CGroups.
End CGroups.

End algebra.

End CoRN.

End CoRN_DOT_algebra_DOT_CGroups.
Module Export CoRN_DOT_algebra_DOT_CAbGroups_WRAPPED.
Module Export CAbGroups.

Export CoRN.algebra.CGroups.

Section Abelian_Groups.

Definition is_CAbGroup (G : CGroup) := commutes (csg_op (c:=G)).

Record CAbGroup : Type :=
 {cag_crr   : CGroup;
  cag_proof :  is_CAbGroup cag_crr}.

Local Coercion cag_crr : CAbGroup >-> CGroup.

Section AbGroup_Axioms.

Variable G : CAbGroup.

Lemma cag_commutes : commutes (csg_op (c:=G)).
Admitted.

Lemma cag_commutes_unfolded : forall x y : G, x[+]y [=] y[+]x.
Proof cag_commutes.

End AbGroup_Axioms.

Section SubCAbGroups.

Variable G : CAbGroup.
Variable P : G -> CProp.
Variable Punit : P [0].
Variable op_pres_P : bin_op_pres_pred _ P csg_op.
Variable inv_pres_P : un_op_pres_pred _ P cg_inv.

Let subcrr : CGroup := Build_SubCGroup _ _ Punit op_pres_P inv_pres_P.

Lemma isabgrp_scrr : is_CAbGroup subcrr.
Proof.
 red in |- *.
intros x y.
case x.
case y.
intros.
simpl in |- *.
apply cag_commutes_unfolded.
Qed.

Definition Build_SubCAbGroup : CAbGroup := Build_CAbGroup subcrr isabgrp_scrr.

End SubCAbGroups.

Section Various.

Hint Resolve cag_commutes_unfolded: algebra.

Variable G : CAbGroup.

Lemma cag_op_inv : forall x y : G, [--] (x[+]y) [=] [--]x[+] [--]y.
Proof.
 intros x y.
 astepr ([--]y[+] [--]x).
 apply cg_inv_op.
Qed.

Hint Resolve cag_op_inv: algebra.

Lemma assoc_1 : forall x y z : G, x[-] (y[-]z) [=] x[-]y[+]z.
Proof.
 intros x y z; unfold cg_minus in |- *.
 astepr (x[+]([--]y[+]z)).
 Step_final (x[+]([--]y[+] [--][--]z)).
Qed.

Lemma minus_plus : forall x y z : G, x[-] (y[+]z) [=] x[-]y[-]z.
Proof.
 intros x y z.
 unfold cg_minus in |- *.
 Step_final (x[+]([--]y[+] [--]z)).
Qed.

Lemma op_lft_resp_ap : forall x y z : G, y [#] z -> x[+]y [#] x[+]z.
Proof.
 intros x y z H.
 astepl (y[+]x).
 astepr (z[+]x).
 apply op_rht_resp_ap; assumption.
Qed.

Lemma cag_ap_cancel_lft : forall x y z : G, x[+]y [#] x[+]z -> y [#] z.
Proof.
 intros x y z H.
 apply ap_symmetric_unfolded.
 apply cg_ap_cancel_rht with x.
 apply ap_symmetric_unfolded.
 astepl (x[+]y).
 astepr (x[+]z).
 auto.
Qed.

Lemma plus_cancel_ap_lft : forall x y z : G, z[+]x [#] z[+]y -> x [#] y.
Proof.
 intros x y z H.
 apply cag_ap_cancel_lft with z.
 assumption.
Qed.

End Various.

End Abelian_Groups.

#[global]
Hint Resolve cag_commutes_unfolded: algebra.
#[global]
Hint Resolve cag_op_inv assoc_1 zero_minus minus_plus op_lft_resp_ap: algebra.

Module Export coercions.
  Export CGroups.coercions.
  Coercion cag_crr : CAbGroup >-> CGroup.
End coercions.

Section Nice_Char.

Variable S : CSetoid.
Variable unit : S.
Variable plus : S -> S -> S.

Hypothesis plus_lext : forall x y z : S, plus x z [#] plus y z -> x [#] y.
Hypothesis plus_lunit : forall x : S, plus unit x [=] x.
Hypothesis plus_comm : forall x y : S, plus x y [=] plus y x.
Hypothesis plus_assoc : associative plus.

Variable inv : CSetoid_un_op S.

Hypothesis inv_inv : forall x : S, plus x (inv x) [=] unit.

Lemma plus_rext : forall x y z : S, plus x y [#] plus x z -> y [#] z.
Proof.
 intros x y z H.
 apply plus_lext with x.
 astepl (plus x y).
 astepr (plus x z).
 auto.
Qed.

Lemma plus_runit : forall x : S, plus x unit [=] x.
Proof.
 intro x.
 Step_final (plus unit x).
Qed.

Lemma plus_is_fun : bin_fun_strext _ _ _ plus.
Proof.
 intros x x' y y' H.
 elim (ap_cotransitive_unfolded _ _ _ H (plus x y')); intro H'.
  right; apply plus_lext with x.
  astepl (plus x y); astepr (plus x y'); auto.
 left; eauto.
Qed.

Lemma inv_inv' : forall x : S, plus (inv x) x [=] unit.
Proof.
 intro.
 Step_final (plus x (inv x)).
Qed.

Definition plus_fun : CSetoid_bin_op S := Build_CSetoid_bin_fun _ _ _ plus plus_is_fun.

Definition Build_CSemiGroup' : CSemiGroup.
Proof.
 apply Build_CSemiGroup with S plus_fun.
 exact plus_assoc.
Defined.

Definition Build_CMonoid' : CMonoid.
Proof.
 apply Build_CMonoid with Build_CSemiGroup' unit.
 apply Build_is_CMonoid.
  exact plus_runit.
 exact plus_lunit.
Defined.

Definition Build_CGroup' : CGroup.
Proof.
 apply Build_CGroup with Build_CMonoid' inv.
 split.
  auto.
 apply inv_inv'.
Defined.

Definition Build_CAbGroup' : CAbGroup.
Proof.
 apply Build_CAbGroup with Build_CGroup'.
 exact plus_comm.
Defined.

End Nice_Char.

Section Group_Extras.

Variable G : CAbGroup.

Fixpoint nmult (a:G) (n:nat) {struct n} : G :=
  match n with
  | O => [0]
  | S p => a[+]nmult a p
  end.

Lemma nmult_wd : forall (x y:G) (n m:nat), (x [=] y) -> n = m -> nmult x n [=] nmult y m.
Proof.
 simple induction n; intros.
  rewrite <- H0; algebra.
 rewrite <- H1; simpl in |- *; algebra.
Qed.

Lemma nmult_one : forall x:G, nmult x 1 [=] x.
Proof.
 simpl in |- *; algebra.
Qed.

Lemma nmult_Zero : forall n:nat, nmult [0] n [=] [0].
Proof.
 intro n.
 induction n.
  algebra.
 simpl in |- *; Step_final (([0]:G)[+][0]).
Qed.

Lemma nmult_plus : forall m n x, nmult x m[+]nmult x n [=] nmult x (m + n).
Proof.
 simple induction m.
  simpl in |- *; algebra.
 clear m; intro m.
 intros.
 simpl in |- *.
Step_final (x[+](nmult x m[+]nmult x n)).
Qed.

Lemma nmult_mult : forall n m x, nmult (nmult x m) n [=] nmult x (m * n).
Proof.
 simple induction n.
  intro.
rewrite Nat.mul_0_r.
algebra.
  clear n; intros.
 simpl in |- *.
 rewrite Nat.mul_comm.
simpl in |- *.
 eapply eq_transitive_unfolded.
  2: apply nmult_plus.
 rewrite Nat.mul_comm.
algebra.
Qed.

Lemma nmult_inv : forall n x, nmult [--]x n [=] [--] (nmult x n).
Proof.
 intro; induction n; simpl in |- *.
  algebra.
 intros.
 Step_final ([--]x[+] [--](nmult x n)).
Qed.

Lemma nmult_plus' : forall n x y, nmult x n[+]nmult y n [=] nmult (x[+]y) n.
Proof.
 intro; induction n; simpl in |- *; intros.
  algebra.
 astepr (x[+]y[+](nmult x n[+]nmult y n)).
 astepr (x[+](y[+](nmult x n[+]nmult y n))).
 astepr (x[+](y[+]nmult x n[+]nmult y n)).
 astepr (x[+](nmult x n[+]y[+]nmult y n)).
 Step_final (x[+](nmult x n[+](y[+]nmult y n))).
Qed.

Hint Resolve nmult_wd nmult_Zero nmult_inv nmult_plus nmult_plus': algebra.

Definition zmult a z := caseZ_diff z (fun n m => nmult a n[-]nmult a m).

Lemma zmult_char : forall (m n:nat) z, z = (m - n)%Z ->
 forall x, zmult x z [=] nmult x m[-]nmult x n.
Proof.
 simple induction z; intros.
   simpl in |- *.
   replace m with n.
Step_final ([0]:G).
auto with zarith.
    simpl in |- *.
  astepl (nmult x (nat_of_P p)).
  apply cg_cancel_rht with (nmult x n).
  astepr (nmult x m).
  astepl (nmult x (nat_of_P p + n)).
  apply nmult_wd; algebra.
  rewrite <- convert_is_POS in H.
  auto with zarith.
 simpl in |- *.
 astepl [--](nmult x (nat_of_P p)).
 unfold cg_minus in |- *.
 astepr ([--][--](nmult x m)[+] [--](nmult x n)).
 astepr [--]([--](nmult x m)[+]nmult x n).
 apply un_op_wd_unfolded.
 apply cg_cancel_lft with (nmult x m).
 astepr (nmult x m[+] [--](nmult x m)[+]nmult x n).
 astepr ([0][+]nmult x n).
 astepr (nmult x n).
 astepl (nmult x (m + nat_of_P p)).
 apply nmult_wd; algebra.
 rewrite <- min_convert_is_NEG in H.
 auto with zarith.
Qed.

Lemma zmult_wd : forall (x y:G) (n m:Z), (x [=] y) -> n = m -> zmult x n [=] zmult y m.
Proof.
 do 3 intro.
 case n; intros; inversion H0.
   algebra.
  unfold zmult in |- *.
  simpl in |- *.
  astepl (nmult x (nat_of_P p)); Step_final (nmult y (nat_of_P p)).
 simpl in |- *.
 astepl [--](nmult x (nat_of_P p)).
 Step_final [--](nmult y (nat_of_P p)).
Qed.

Lemma zmult_one : forall x:G, zmult x 1 [=] x.
Proof.
 simpl in |- *; algebra.
Qed.

Lemma zmult_min_one : forall x:G, zmult x (-1) [=] [--]x.
Proof.
 intros; simpl in |- *; Step_final ([0][-]x).
Qed.

Lemma zmult_zero : forall x:G, zmult x 0 [=] [0].
Proof.
 simpl in |- *; algebra.
Qed.

Lemma zmult_Zero : forall k:Z, zmult [0] k [=] [0].
Proof.
 intro; induction k; simpl in |- *.
   algebra.
  Step_final (([0]:G)[-][0]).
 Step_final (([0]:G)[-][0]).
Qed.

Hint Resolve zmult_zero: algebra.

Lemma zmult_plus : forall m n x, zmult x m[+]zmult x n [=] zmult x (m + n).
Proof.
 intros; case m; case n; intros.
         simpl in |- *; Step_final ([0][+]([0][-][0]):G).
        simpl in |- *; Step_final ([0][+](nmult x (nat_of_P p)[-][0])).
       simpl in |- *; Step_final ([0][+]([0][-]nmult x (nat_of_P p))).
      simpl in |- *; Step_final (nmult x (nat_of_P p)[-][0][+][0]).
     simpl in |- *.
     astepl (nmult x (nat_of_P p0)[+]nmult x (nat_of_P p)).
     astepr (nmult x (nat_of_P (p0 + p))).
     rewrite nat_of_P_plus_morphism.
apply nmult_plus.
     simpl (zmult x (Zpos p0)[+]zmult x (Zneg p)) in |- *.
    astepl (nmult x (nat_of_P p0)[+] [--](nmult x (nat_of_P p))).
    astepl (nmult x (nat_of_P p0)[-]nmult x (nat_of_P p)).
    apply eq_symmetric_unfolded; apply zmult_char with (z := (Zpos p0 + Zneg p)%Z).
    rewrite convert_is_POS.
unfold Zminus in |- *.
rewrite min_convert_is_NEG; auto.
    rewrite <- Zplus_0_r_reverse.
Step_final (zmult x (Zneg p)[+][0]).
   simpl (zmult x (Zneg p0)[+]zmult x (Zpos p)) in |- *.
  astepl ([--](nmult x (nat_of_P p0))[+]nmult x (nat_of_P p)).
  astepl (nmult x (nat_of_P p)[+] [--](nmult x (nat_of_P p0))).
  astepl (nmult x (nat_of_P p)[-]nmult x (nat_of_P p0)).
  rewrite Zplus_comm.
  apply eq_symmetric_unfolded; apply zmult_char with (z := (Zpos p + Zneg p0)%Z).
  rewrite convert_is_POS.
unfold Zminus in |- *.
rewrite min_convert_is_NEG; auto.
  simpl in |- *.
 astepl ([--](nmult x (nat_of_P p0))[+] [--](nmult x (nat_of_P p))).
 astepl [--](nmult x (nat_of_P p0)[+]nmult x (nat_of_P p)).
 astepr [--](nmult x (nat_of_P (p0 + p))).
 apply un_op_wd_unfolded.
 rewrite nat_of_P_plus_morphism.
apply nmult_plus.
Qed.

Lemma zmult_mult : forall m n x, zmult (zmult x m) n [=] zmult x (m * n).
Proof.
 simple induction m; simple induction n; simpl in |- *; intros.
         Step_final ([0][-][0][+]([0]:G)).
        astepr ([0]:G).
astepl (nmult ([0][-][0]) (nat_of_P p)).
        Step_final (nmult [0] (nat_of_P p)).
       astepr [--]([0]:G).
astepl [--](nmult ([0][-][0]) (nat_of_P p)).
       Step_final [--](nmult [0] (nat_of_P p)).
      algebra.
     astepr (nmult x (nat_of_P (p * p0))).
     astepl (nmult (nmult x (nat_of_P p)) (nat_of_P p0)[-][0]).
     astepl (nmult (nmult x (nat_of_P p)) (nat_of_P p0)).
     rewrite nat_of_P_mult_morphism.
apply nmult_mult.
     astepr [--](nmult x (nat_of_P (p * p0))).
    astepl ([0][-]nmult (nmult x (nat_of_P p)) (nat_of_P p0)).
    astepl [--](nmult (nmult x (nat_of_P p)) (nat_of_P p0)).
    rewrite nat_of_P_mult_morphism.
apply un_op_wd_unfolded.
apply nmult_mult.
    algebra.
  astepr [--](nmult x (nat_of_P (p * p0))).
  astepl (nmult [--](nmult x (nat_of_P p)) (nat_of_P p0)[-][0]).
  astepl (nmult [--](nmult x (nat_of_P p)) (nat_of_P p0)).
  rewrite nat_of_P_mult_morphism.
eapply eq_transitive_unfolded.
  apply nmult_inv.
apply un_op_wd_unfolded.
apply nmult_mult.
  astepr (nmult x (nat_of_P (p * p0))).
 astepr [--][--](nmult x (nat_of_P (p * p0))).
 astepl ([0][-]nmult [--](nmult x (nat_of_P p)) (nat_of_P p0)).
 astepl [--](nmult [--](nmult x (nat_of_P p)) (nat_of_P p0)).
 rewrite nat_of_P_mult_morphism.
apply un_op_wd_unfolded.
eapply eq_transitive_unfolded.
 apply nmult_inv.
apply un_op_wd_unfolded.
apply nmult_mult.
Qed.

Lemma zmult_plus' : forall z x y, zmult x z[+]zmult y z [=] zmult (x[+]y) z.
Proof.
 intro z; pattern z in |- *.
 apply nats_Z_ind.
  intro n; case n.
   intros; simpl in |- *.
Step_final (([0]:G)[+]([0][-][0])).
   clear n; intros.
  rewrite POS_anti_convert; simpl in |- *.
set (p := nat_of_P (P_of_succ_nat n)) in *.
  astepl (nmult x p[+]nmult y p).
Step_final (nmult (x[+]y) p).
  intro n; case n.
  intros; simpl in |- *.
Step_final (([0]:G)[+]([0][-][

[...]

nal (x[+](z [-] z)).
 astepr (y[+][0]).
 Step_final (y[+](z [-] z)).
Qed.

Lemma plus_cancel_ap_rht : forall x y z : G, x[+]z [#] y[+]z -> x [#] y.
Proof cg_ap_cancel_rht.

Lemma minus_ap_zero : forall x y : G, x [#] y -> x [-] y [#] [0].
Proof.
 intros x y H.
 astepr (y [-] y).
 unfold cg_minus in |- *.
 apply op_rht_resp_ap; assumption.
Qed.

Lemma zero_minus_apart : forall x y : G, x [-] y [#] [0] -> x [#] y.
Proof.
 unfold cg_minus in |- *.
intros x y H.
 cut (x[+] [--] y [#] y[+] [--] y).
intros h.
  apply (cg_ap_cancel_rht _ _ _ h).
 astepr ([0]:G).
auto.
Qed.

Lemma inv_resp_ap_zero : forall x : G, x [#] [0] -> [--] x [#] [0].
Proof.
 intros x H.
 astepl ([0][+] [--] x).
 astepl ([0] [-] x).
 apply minus_ap_zero.
 apply (ap_symmetric G).
 auto.
Qed.

Lemma inv_resp_ap : forall x y : G, x [#] y -> [--] x [#] [--] y.
Proof.
 intros x y H.
 apply (csf_strext _ _ (cg_inv (c:=G))).
 astepl x.
 astepr y.
 auto.
Qed.

Lemma minus_resp_ap_rht : forall x y z : G, x [#] y -> x [-] z [#] y [-] z.
Proof.
 intros x y z H.
 unfold cg_minus in |- *.
 apply op_rht_resp_ap.
 assumption.
Qed.

Lemma minus_resp_ap_lft : forall x y z : G, x [#] y -> z [-] x [#] z [-] y.
Proof.
 intros x y z H.
 astepl ([--] (x [-] z)).
  2: unfold cg_minus in |- *; Step_final ([--] [--] z[+] [--] x).
 astepr ([--] (y [-] z)).
  2: unfold cg_minus in |- *; Step_final ([--] [--] z[+] [--] y).
 apply inv_resp_ap.
 apply minus_resp_ap_rht.
 auto.
Qed.

Lemma minus_cancel_ap_rht : forall x y z : G, x [-] z [#] y [-] z -> x [#] y.
Proof.
 unfold cg_minus in |- *.
 intros x y z H.
 exact (plus_cancel_ap_rht _ _ _ H).
Qed.

End cgroups_apartness.
#[global]
Hint Resolve op_rht_resp_ap: algebra.
#[global]
Hint Resolve minus_ap_zero zero_minus_apart inv_resp_ap_zero: algebra.

Section CGroup_Ops.



Definition PS_Inv (A : CSetoid) : PS_as_CMonoid A -> PS_as_CMonoid A.
Proof.
 simpl in |- *.
 intros f.
 elim f.
 intros fo prfo.
 set (H0 := Inv fo prfo) in *.
 apply Build_subcsetoid_crr with H0.
 unfold H0 in |- *.
 apply Inv_bij.
Defined.

Definition Inv_as_un_op (A : CSetoid) : CSetoid_un_op (PS_as_CMonoid A).
Proof.
 unfold CSetoid_un_op in |- *.
 apply Build_CSetoid_fun with (PS_Inv A).
 unfold fun_strext in |- *.
 intros x y.
 case x.
 case y.
 simpl in |- *.
 intros f H g H0.
 unfold ap_fun in |- *.
 intro H1.
 elim H1.
 clear H1.
 intros a H1.
 exists (Inv g H0 a).
 astepl a.
  2: simpl in |- *.
  2: apply eq_symmetric_unfolded.
  2: apply inv1.
 unfold bijective in H.
 elim H.
 unfold injective in |- *.
 intros H2 H3.
 astepl (f (Inv f H a)).
  apply H2.
  apply ap_symmetric_unfolded.
  exact H1.
 simpl in |- *.
 apply inv1.
Defined.

Lemma PS_is_CGroup :
 forall A : CSetoid, is_CGroup (PS_as_CMonoid A) (Inv_as_un_op A).
Proof.
 intro A.
 unfold is_CGroup in |- *.
 intro x.
 unfold is_inverse in |- *.
 simpl in |- *.
 split.
  case x.
  simpl in |- *.
  intros f H.
  unfold eq_fun in |- *.
  intro a.
  unfold comp in |- *.
  simpl in |- *.
  apply inv2.
 case x.
 simpl in |- *.
 intros f H.
 unfold eq_fun in |- *.
 intro a.
 unfold comp in |- *.
 simpl in |- *.
 apply inv1.
Qed.

Definition PS_as_CGroup (A : CSetoid) :=
  Build_CGroup (PS_as_CMonoid A) (Inv_as_un_op A) (PS_is_CGroup A).



Variable G : CGroup.

Variables F F' : PartFunct G.


Let P := Dom F.
Let Q := Dom F'.


Section Part_Function_Inv.

Lemma part_function_inv_strext : forall x y (Hx : P x) (Hy : P y),
 [--] (F x Hx) [#] [--] (F y Hy) -> x [#] y.
Proof.
 intros x y Hx Hy H.
 apply pfstrx with F Hx Hy.
 apply un_op_strext_unfolded with (cg_inv (c:=G)); assumption.
Qed.

Definition Finv := Build_PartFunct _ _
 (dom_wd _ F) (fun x Hx => [--] (F x Hx)) part_function_inv_strext.

End Part_Function_Inv.

Section Part_Function_Minus.

Lemma part_function_minus_strext : forall x y (Hx : Conj P Q x) (Hy : Conj P Q y),
 F x (Prj1 Hx) [-] F' x (Prj2 Hx) [#] F y (Prj1 Hy) [-] F' y (Prj2 Hy) -> x [#] y.
Proof.
 intros x y Hx Hy H.
 cut (F x (Prj1 Hx) [#] F y (Prj1 Hy) or F' x (Prj2 Hx) [#] F' y (Prj2 Hy)).
  intro H0.
  elim H0; intro H1; exact (pfstrx _ _ _ _ _ _ H1).
 apply cg_minus_strext; auto.
Qed.

Definition Fminus := Build_PartFunct G _ (conj_wd (dom_wd _ F) (dom_wd _ F'))
 (fun x Hx => F x (Prj1 Hx) [-] F' x (Prj2 Hx)) part_function_minus_strext.

End Part_Function_Minus.



Variable R:G -> CProp.

Lemma included_FInv : included R P -> included R (Dom Finv).
Proof.
 intro; simpl in |- *; assumption.
Qed.

Lemma included_FInv' : included R (Dom Finv) -> included R P.
Proof.
 intro; simpl in |- *; assumption.
Qed.

Lemma included_FMinus : included R P -> included R Q -> included R (Dom Fminus).
Proof.
 intros; simpl in |- *; apply included_conj; assumption.
Qed.

Lemma included_FMinus' : included R (Dom Fminus) -> included R P.
Proof.
 intro H; simpl in H; eapply included_conj_lft; apply H.
Qed.

Lemma included_FMinus'' : included R (Dom Fminus) -> included R Q.
Proof.
 intro H; simpl in H; eapply included_conj_rht; apply H.
Qed.

End CGroup_Ops.

Arguments Finv [G].
Notation "{--} x" := (Finv x) (at level 4, right associativity).

Arguments Fminus [G].
Infix "{-}" := Fminus (at level 50, left associativity).

#[global]
Hint Resolve included_FInv included_FMinus : included.

#[global]
Hint Immediate included_FInv' included_FMinus' included_FMinus'' : included.

End CGroups.

End CoRN_DOT_algebra_DOT_CGroups_WRAPPED.
Module Export CoRN_DOT_algebra_DOT_CGroups.
Module Export CoRN.
Module Export algebra.
Module CGroups.
Include CoRN_DOT_algebra_DOT_CGroups_WRAPPED.CGroups.
End CGroups.

End algebra.

End CoRN.

End CoRN_DOT_algebra_DOT_CGroups.
Module Export CoRN_DOT_algebra_DOT_CAbGroups_WRAPPED.
Module Export CAbGroups.

Export CoRN.algebra.CGroups.

Section Abelian_Groups.

Definition is_CAbGroup (G : CGroup) := commutes (csg_op (c:=G)).

Record CAbGroup : Type :=
 {cag_crr   : CGroup;
  cag_proof :  is_CAbGroup cag_crr}.

Local Coercion cag_crr : CAbGroup >-> CGroup.

Section AbGroup_Axioms.

Variable G : CAbGroup.

Lemma cag_commutes : commutes (csg_op (c:=G)).
Admitted.

Lemma cag_commutes_unfolded : forall x y : G, x[+]y [=] y[+]x.
Proof cag_commutes.

End AbGroup_Axioms.

Section SubCAbGroups.

Variable G : CAbGroup.
Variable P : G -> CProp.
Variable Punit : P [0].
Variable op_pres_P : bin_op_pres_pred _ P csg_op.
Variable inv_pres_P : un_op_pres_pred _ P cg_inv.

Let subcrr : CGroup := Build_SubCGroup _ _ Punit op_pres_P inv_pres_P.

Lemma isabgrp_scrr : is_CAbGroup subcrr.
Proof.
 red in |- *.
intros x y.
case x.
case y.
intros.
simpl in |- *.
apply cag_commutes_unfolded.
Qed.

Definition Build_SubCAbGroup : CAbGroup := Build_CAbGroup subcrr isabgrp_scrr.

End SubCAbGroups.

Section Various.

Hint Resolve cag_commutes_unfolded: algebra.

Variable G : CAbGroup.

Lemma cag_op_inv : forall x y : G, [--] (x[+]y) [=] [--]x[+] [--]y.
Proof.
 intros x y.
 astepr ([--]y[+] [--]x).
 apply cg_inv_op.
Qed.

Hint Resolve cag_op_inv: algebra.

Lemma assoc_1 : forall x y z : G, x[-] (y[-]z) [=] x[-]y[+]z.
Proof.
 intros x y z; unfold cg_minus in |- *.
 astepr (x[+]([--]y[+]z)).
 Step_final (x[+]([--]y[+] [--][--]z)).
Qed.

Lemma minus_plus : forall x y z : G, x[-] (y[+]z) [=] x[-]y[-]z.
Proof.
 intros x y z.
 unfold cg_minus in |- *.
 Step_final (x[+]([--]y[+] [--]z)).
Qed.

Lemma op_lft_resp_ap : forall x y z : G, y [#] z -> x[+]y [#] x[+]z.
Proof.
 intros x y z H.
 astepl (y[+]x).
 astepr (z[+]x).
 apply op_rht_resp_ap; assumption.
Qed.

Lemma cag_ap_cancel_lft : forall x y z : G, x[+]y [#] x[+]z -> y [#] z.
Proof.
 intros x y z H.
 apply ap_symmetric_unfolded.
 apply cg_ap_cancel_rht with x.
 apply ap_symmetric_unfolded.
 astepl (x[+]y).
 astepr (x[+]z).
 auto.
Qed.

Lemma plus_cancel_ap_lft : forall x y z : G, z[+]x [#] z[+]y -> x [#] y.
Proof.
 intros x y z H.
 apply cag_ap_cancel_lft with z.
 assumption.
Qed.

End Various.

End Abelian_Groups.

#[global]
Hint Resolve cag_commutes_unfolded: algebra.
#[global]
Hint Resolve cag_op_inv assoc_1 zero_minus minus_plus op_lft_resp_ap: algebra.

Module Export coercions.
  Export CGroups.coercions.
  Coercion cag_crr : CAbGroup >-> CGroup.
End coercions.

Section Nice_Char.

Variable S : CSetoid.
Variable unit : S.
Variable plus : S -> S -> S.

Hypothesis plus_lext : forall x y z : S, plus x z [#] plus y z -> x [#] y.
Hypothesis plus_lunit : forall x : S, plus unit x [=] x.
Hypothesis plus_comm : forall x y : S, plus x y [=] plus y x.
Hypothesis plus_assoc : associative plus.

Variable inv : CSetoid_un_op S.

Hypothesis inv_inv : forall x : S, plus x (inv x) [=] unit.

Lemma plus_rext : forall x y z : S, plus x y [#] plus x z -> y [#] z.
Proof.
 intros x y z H.
 apply plus_lext with x.
 astepl (plus x y).
 astepr (plus x z).
 auto.
Qed.

Lemma plus_runit : forall x : S, plus x unit [=] x.
Proof.
 intro x.
 Step_final (plus unit x).
Qed.

Lemma plus_is_fun : bin_fun_strext _ _ _ plus.
Proof.
 intros x x' y y' H.
 elim (ap_cotransitive_unfolded _ _ _ H (plus x y')); intro H'.
  right; apply plus_lext with x.
  astepl (plus x y); astepr (plus x y'); auto.
 left; eauto.
Qed.

Lemma inv_inv' : forall x : S, plus (inv x) x [=] unit.
Proof.
 intro.
 Step_final (plus x (inv x)).
Qed.

Definition plus_fun : CSetoid_bin_op S := Build_CSetoid_bin_fun _ _ _ plus plus_is_fun.

Definition Build_CSemiGroup' : CSemiGroup.
Proof.
 apply Build_CSemiGroup with S plus_fun.
 exact plus_assoc.
Defined.

Definition Build_CMonoid' : CMonoid.
Proof.
 apply Build_CMonoid with Build_CSemiGroup' unit.
 apply Build_is_CMonoid.
  exact plus_runit.
 exact plus_lunit.
Defined.

Definition Build_CGroup' : CGroup.
Proof.
 apply Build_CGroup with Build_CMonoid' inv.
 split.
  auto.
 apply inv_inv'.
Defined.

Definition Build_CAbGroup' : CAbGroup.
Proof.
 apply Build_CAbGroup with Build_CGroup'.
 exact plus_comm.
Defined.

End Nice_Char.

Section Group_Extras.

Variable G : CAbGroup.

Fixpoint nmult (a:G) (n:nat) {struct n} : G :=
  match n with
  | O => [0]
  | S p => a[+]nmult a p
  end.

Lemma nmult_wd : forall (x y:G) (n m:nat), (x [=] y) -> n = m -> nmult x n [=] nmult y m.
Proof.
 simple induction n; intros.
  rewrite <- H0; algebra.
 rewrite <- H1; simpl in |- *; algebra.
Qed.

Lemma nmult_one : forall x:G, nmult x 1 [=] x.
Proof.
 simpl in |- *; algebra.
Qed.

Lemma nmult_Zero : forall n:nat, nmult [0] n [=] [0].
Proof.
 intro n.
 induction n.
  algebra.
 simpl in |- *; Step_final (([0]:G)[+][0]).
Qed.

Lemma nmult_plus : forall m n x, nmult x m[+]nmult x n [=] nmult x (m + n).
Proof.
 simple induction m.
  simpl in |- *; algebra.
 clear m; intro m.
 intros.
 simpl in |- *.
Step_final (x[+](nmult x m[+]nmult x n)).
Qed.

Lemma nmult_mult : forall n m x, nmult (nmult x m) n [=] nmult x (m * n).
Proof.
 simple induction n.
  intro.
rewrite Nat.mul_0_r.
algebra.
  clear n; intros.
 simpl in |- *.
 rewrite Nat.mul_comm.
simpl in |- *.
 eapply eq_transitive_unfolded.
  2: apply nmult_plus.
 rewrite Nat.mul_comm.
algebra.
Qed.

Lemma nmult_inv : forall n x, nmult [--]x n [=] [--] (nmult x n).
Proof.
 intro; induction n; simpl in |- *.
  algebra.
 intros.
 Step_final ([--]x[+] [--](nmult x n)).
Qed.

Lemma nmult_plus' : forall n x y, nmult x n[+]nmult y n [=] nmult (x[+]y) n.
Proof.
 intro; induction n; simpl in |- *; intros.
  algebra.
 astepr (x[+]y[+](nmult x n[+]nmult y n)).
 astepr (x[+](y[+](nmult x n[+]nmult y n))).
 astepr (x[+](y[+]nmult x n[+]nmult y n)).
 astepr (x[+](nmult x n[+]y[+]nmult y n)).
 Step_final (x[+](nmult x n[+](y[+]nmult y n))).
Qed.

Hint Resolve nmult_wd nmult_Zero nmult_inv nmult_plus nmult_plus': algebra.

Definition zmult a z := caseZ_diff z (fun n m => nmult a n[-]nmult a m).

Lemma zmult_char : forall (m n:nat) z, z = (m - n)%Z ->
 forall x, zmult x z [=] nmult x m[-]nmult x n.
Proof.
 simple induction z; intros.
   simpl in |- *.
   replace m with n.
Step_final ([0]:G).
auto with zarith.
    simpl in |- *.
  astepl (nmult x (nat_of_P p)).
  apply cg_cancel_rht with (nmult x n).
  astepr (nmult x m).
  astepl (nmult x (nat_of_P p + n)).
  apply nmult_wd; algebra.
  rewrite <- convert_is_POS in H.
  auto with zarith.
 simpl in |- *.
 astepl [--](nmult x (nat_of_P p)).
 unfold cg_minus in |- *.
 astepr ([--][--](nmult x m)[+] [--](nmult x n)).
 astepr [--]([--](nmult x m)[+]nmult x n).
 apply un_op_wd_unfolded.
 apply cg_cancel_lft with (nmult x m).
 astepr (nmult x m[+] [--](nmult x m)[+]nmult x n).
 astepr ([0][+]nmult x n).
 astepr (nmult x n).
 astepl (nmult x (m + nat_of_P p)).
 apply nmult_wd; algebra.
 rewrite <- min_convert_is_NEG in H.
 auto with zarith.
Qed.

Lemma zmult_wd : forall (x y:G) (n m:Z), (x [=] y) -> n = m -> zmult x n [=] zmult y m.
Proof.
 do 3 intro.
 case n; intros; inversion H0.
   algebra.
  unfold zmult in |- *.
  simpl in |- *.
  astepl (nmult x (nat_of_P p)); Step_final (nmult y (nat_of_P p)).
 simpl in |- *.
 astepl [--](nmult x (nat_of_P p)).
 Step_final [--](nmult y (nat_of_P p)).
Qed.

Lemma zmult_one : forall x:G, zmult x 1 [=] x.
Proof.
 simpl in |- *; algebra.
Qed.

Lemma zmult_min_one : forall x:G, zmult x (-1) [=] [--]x.
Proof.
 intros; simpl in |- *; Step_final ([0][-]x).
Qed.

Lemma zmult_zero : forall x:G, zmult x 0 [=] [0].
Proof.
 simpl in |- *; algebra.
Qed.

Lemma zmult_Zero : forall k:Z, zmult [0] k [=] [0].
Proof.
 intro; induction k; simpl in |- *.
   algebra.
  Step_final (([0]:G)[-][0]).
 Step_final (([0]:G)[-][0]).
Qed.

Hint Resolve zmult_zero: algebra.

Lemma zmult_plus : forall m n x, zmult x m[+]zmult x n [=] zmult x (m + n).
Proof.
 intros; case m; case n; intros.
         simpl in |- *; Step_final ([0][+]([0][-][0]):G).
        simpl in |- *; Step_final ([0][+](nmult x (nat_of_P p)[-][0])).
       simpl in |- *; Step_final ([0][+]([0][-]nmult x (nat_of_P p))).
      simpl in |- *; Step_final (nmult x (nat_of_P p)[-][0][+][0]).
     simpl in |- *.
     astepl (nmult x (nat_of_P p0)[+]nmult x (nat_of_P p)).
     astepr (nmult x (nat_of_P (p0 + p))).
     rewrite nat_of_P_plus_morphism.
apply nmult_plus.
     simpl (zmult x (Zpos p0)[+]zmult x (Zneg p)) in |- *.
    astepl (nmult x (nat_of_P p0)[+] [--](nmult x (nat_of_P p))).
    astepl (nmult x (nat_of_P p0)[-]nmult x (nat_of_P p)).
    apply eq_symmetric_unfolded; apply zmult_char with (z := (Zpos p0 + Zneg p)%Z).
    rewrite convert_is_POS.
unfold Zminus in |- *.
rewrite min_convert_is_NEG; auto.
    rewrite <- Zplus_0_r_reverse.
Step_final (zmult x (Zneg p)[+][0]).
   simpl (zmult x (Zneg p0)[+]zmult x (Zpos p)) in |- *.
  astepl ([--](nmult x (nat_of_P p0))[+]nmult x (nat_of_P p)).
  astepl (nmult x (nat_of_P p)[+] [--](nmult x (nat_of_P p0))).
  astepl (nmult x (nat_of_P p)[-]nmult x (nat_of_P p0)).
  rewrite Zplus_comm.
  apply eq_symmetric_unfolded; apply zmult_char with (z := (Zpos p + Zneg p0)%Z).
  rewrite convert_is_POS.
unfold Zminus in |- *.
rewrite min_convert_is_NEG; auto.
  simpl in |- *.
 astepl ([--](nmult x (nat_of_P p0))[+] [--](nmult x (nat_of_P p))).
 astepl [--](nmult x (nat_of_P p0)[+]nmult x (nat_of_P p)).
 astepr [--](nmult x (nat_of_P (p0 + p))).
 apply un_op_wd_unfolded.
 rewrite nat_of_P_plus_morphism.
apply nmult_plus.
Qed.

Lemma zmult_mult : forall m n x, zmult (zmult x m) n [=] zmult x (m * n).
Proof.
 simple induction m; simple induction n; simpl in |- *; intros.
         Step_final ([0][-][0][+]([0]:G)).
        astepr ([0]:G).
astepl (nmult ([0][-][0]) (nat_of_P p)).
        Step_final (nmult [0] (nat_of_P p)).
       astepr [--]([0]:G).
astepl [--](nmult ([0][-][0]) (nat_of_P p)).
       Step_final [--](nmult [0] (nat_of_P p)).
      algebra.
     astepr (nmult x (nat_of_P (p * p0))).
     astepl (nmult (nmult x (nat_of_P p)) (nat_of_P p0)[-][0]).
     astepl (nmult (nmult x (nat_of_P p)) (nat_of_P p0)).
     rewrite nat_of_P_mult_morphism.
apply nmult_mult.
     astepr [--](nmult x (nat_of_P (p * p0))).
    astepl ([0][-]nmult (nmult x (nat_of_P p)) (nat_of_P p0)).
    astepl [--](nmult (nmult x (nat_of_P p)) (nat_of_P p0)).
    rewrite nat_of_P_mult_morphism.
apply un_op_wd_unfolded.
apply nmult_mult.
    algebra.
  astepr [--](nmult x (nat_of_P (p * p0))).
  astepl (nmult [--](nmult x (nat_of_P p)) (nat_of_P p0)[-][0]).
  astepl (nmult [--](nmult x (nat_of_P p)) (nat_of_P p0)).
  rewrite nat_of_P_mult_morphism.
eapply eq_transitive_unfolded.
  apply nmult_inv.
apply un_op_wd_unfolded.
apply nmult_mult.
  astepr (nmult x (nat_of_P (p * p0))).
 astepr [--][--](nmult x (nat_of_P (p * p0))).
 astepl ([0][-]nmult [--](nmult x (nat_of_P p)) (nat_of_P p0)).
 astepl [--](nmult [--](nmult x (nat_of_P p)) (nat_of_P p0)).
 rewrite nat_of_P_mult_morphism.
apply un_op_wd_unfolded.
eapply eq_transitive_unfolded.
 apply nmult_inv.
apply un_op_wd_unfolded.
apply nmult_mult.
Qed.

Lemma zmult_plus' : forall z x y, zmult x z[+]zmult y z [=] zmult (x[+]y) z.
Proof.
 intro z; pattern z in |- *.
 apply nats_Z_ind.
  intro n; case n.
   intros; simpl in |- *.
Step_final (([0]:G)[+]([0][-][0])).
   clear n; intros.
  rewrite POS_anti_convert; simpl in |- *.
set (p := nat_of_P (P_of_succ_nat n)) in *.
  astepl (nmult x p[+]nmult y p).
Step_final (nmult (x[+]y) p).
  intro n; case n.
  intros; simpl in |- *.
Step_final (([0]:G)[+]([0][-][0])).
  clear n; intros.
 rewrite NEG_anti_convert; simpl in |- *.
set (p := nat_of_P (P_of_succ_nat n)) in *.
 astepl ([--](nmult x p)[+] [--](nmult y p)).
astepr [--](nmult (x[+]y) p).
 Step_final [--](nmult x p[+]nmult y p).
Qed.

End Group_Extras.

#[global]
Hint Resolve nmult_wd nmult_one nmult_Zero nmult_plus nmult_inv nmult_mult
  nmult_plus' zmult_wd zmult_one zmult_min_one zmult_zero zmult_Zero
  zmult_plus zmult_mult zmult_plus': algebra.

Arguments nmult [G].
Arguments zmult [G].

End CAbGroups.

End CoRN_DOT_algebra_DOT_CAbGroups_WRAPPED.
Module Export CoRN_DOT_algebra_DOT_CAbGroups.
Module Export CoRN.
Module Export algebra.
Module CAbGroups.
Include CoRN_DOT_algebra_DOT_CAbGroups_WRAPPED.CAbGroups.
End CAbGroups.

End algebra.

End CoRN.

End CoRN_DOT_algebra_DOT_CAbGroups.
Export CoRN.algebra.CAbGroups.

Definition distributive S (mult plus : CSetoid_bin_op S) :=
  forall x y z, mult x (plus y z) [=] plus (mult x y) (mult x z).

Arguments distributive [S].

Record is_CRing (G : CAbGroup) (One : G) (mult : CSetoid_bin_op G) : CProp :=
  {ax_mult_assoc : associative mult;
   ax_mult_mon   : is_CMonoid (Build_CSemiGroup G mult ax_mult_assoc) One;
   ax_mult_com   : commutes mult;
   ax_dist       : distributive mult csg_op;
   ax_non_triv   : One [#] [0]}.

Record CRing : Type :=
  {cr_crr   : CAbGroup;
   cr_one   :  cr_crr;
   cr_mult  :  CSetoid_bin_op cr_crr;
   cr_proof :  is_CRing cr_crr cr_one cr_mult}.

Notation "[1]" := (cr_one _).
  Coercion cr_crr : CRing >-> CAbGroup.

Arguments cr_mult {c}.
Infix "[*]" := cr_mult (at level 40, left associativity).

Section exponentiation.

Variable R : CRing.
Fixpoint nexp (m : nat) : R -> R.
Admitted.

Lemma nexp_strong_ext : forall n, fun_strext (nexp n).
Admitted.

Definition nexp_op n := Build_CSetoid_un_op R (nexp n) (nexp_strong_ext n).

End exponentiation.

Notation "x [^] n" := (nexp_op _ n x) (at level 20).

Section nat_injection.

Variable R : CRing.
Fixpoint nring (m : nat) : R.
Admitted.

End nat_injection.

Arguments nring [R].

Notation Two := (nring 2).
Notation Four := (nring 4).

Section int_injection.

Variable R : CRing.
Definition zring (z : Z) : R.
Admitted.

End int_injection.

Arguments zring [R].

Section CRing_Ops.

Variable R : CRing.

Variables F G : PartFunct R.

Variable n : nat.

Lemma part_function_nth_strext : forall x y Hx Hy, F x Hx[^]n [#] F y Hy[^]n -> x [#] y.
Print Options.
admit.
Print Options.
Defined.

Definition Fnth := Build_PartFunct R _ (dom_wd R F)
 (fun x Hx => F x Hx[^]n) part_function_nth_strext.
Print Options.

End CRing_Ops.

Arguments Fnth [R].
Infix "{^}" := Fnth (at level 30, right associativity).
Definition is_CField (R : CRing) (cf_rcpcl : forall x : R, x [#] [0] -> R) : Prop.
Admitted.

Record CField : Type :=
  {cf_crr   :> CRing;
   cf_rcpcl :  forall x : cf_crr, x [#] [0] -> cf_crr;
   cf_proof :  is_CField cf_crr cf_rcpcl;
   cf_rcpsx :  forall x y x_ y_, cf_rcpcl x x_ [#] cf_rcpcl y y_ -> x [#] y}.

Definition f_rcpcl' (F : CField) : PartFunct F.
 apply Build_PartFunct with (fun x : F => x [#] [0]) (cf_rcpcl F).
Print Options.
  red in |- *; intros; astepl x.
Print Options.
auto.
Print Options.
  exact (cf_rcpsx F).
Print Options.
Defined.

Definition f_rcpcl F x x_ := f_rcpcl' F x x_.

Arguments f_rcpcl [F].

Definition cf_div (F : CField) (x y : F) y_ : F := x[*]f_rcpcl y y_.

Arguments cf_div [F].
Notation "x [/] y [//] Hy" := (cf_div x y Hy) (at level 80).

Section CField_Ops.

Variable X : CField.

Variables F G : PartFunct X.
Let Q := Dom G.

Let R := extend Q (fun x Hx => G x Hx [#] [0]).

Let Ext2R := ext2 (S:=X) (P:=Q) (R:=fun x Hx => G x Hx [#] [0]).

Lemma part_function_recip_strext : forall x y Hx Hy,
 ([1][/] _[//]Ext2R x Hx) [#] ([1][/] _[//]Ext2R y Hy) -> x [#] y.
Print Options.
admit.
Print Options.
Defined.

Lemma part_function_recip_pred_wd : pred_wd X R.
admit.
Print Options.
Defined.

Definition Frecip := Build_PartFunct X _ part_function_recip_pred_wd
 (fun x Hx => [1][/] _[//]Ext2R x Hx) part_function_recip_strext.
Print Options.

End CField_Ops.

Arguments Frecip [X].
Notation "{1/} x" := (Frecip x) (at level 4, right associativity).

Export CoRN.model.structures.Qsec.

Lemma ap_Q_irreflexive1 : irreflexive (A:=Q) Qap.
Admitted.

Lemma ap_Q_symmetric1 : Csymmetric Qap.
Admitted.

Lemma ap_Q_cotransitive1 : cotransitive (A:=Q) Qap.
Admitted.

Lemma ap_Q_tight1 : tight_apart (A:=Q) Qeq Qap.
Admitted.

Definition ap_Q_is_apartness := Build_is_CSetoid Q Qeq Qap
 ap_Q_irreflexive1 ap_Q_symmetric1 ap_Q_cotransitive1 ap_Q_tight1.

Definition Q_as_CSetoid := Build_CSetoid _ _ _ ap_Q_is_apartness.

Lemma Qplus_strext1 : bin_fun_strext Q_as_CSetoid Q_as_CSetoid Q_as_CSetoid Qplus.
Admitted.

Definition Qplus_is_bin_fun := Build_CSetoid_bin_fun _ _ _ _ Qplus_strext1.

Lemma Qplus_is_assoc : associative Qplus_is_bin_fun.
Proof Qplus_assoc.

Lemma Qopp_strext : fun_strext (S1:=Q_as_CSetoid) (S2:=Q_as_CSetoid) Qopp.
Admitted.

Definition Qopp_is_fun := Build_CSetoid_fun _ _ _ Qopp_strext.

Lemma Qmult_strext1 : bin_fun_strext Q_as_CSetoid Q_as_CSetoid Q_as_CSetoid Qmult.
Admitted.

Definition Qmult_is_bin_fun := Build_CSetoid_bin_fun _ _ _ _ Qmult_strext1.

Lemma Qlt_strext : Crel_strext Q_as_CSetoid Qlt.
Admitted.

Definition Qlt_is_CSetoid_relation := Build_CCSetoid_relation _ _ Qlt_strext.
Export CoRN.algebra.CSetoids.

Record strictorder (A : Type)(R : A -> A -> CProp) : CProp :=
 {so_trans : Ctransitive R;
  so_asym  : antisymmetric R}.

Arguments strictorder [A].
Arguments Build_strictorder [A R].

Record is_COrdField (F : CField)
  (less : CCSetoid_relation F) (leEq : Relation F)
  (greater : CCSetoid_relation F) (grEq : Relation F) : CProp :=
  {ax_less_strorder  : strictorder less;
   ax_plus_resp_less : forall x y, less x y -> forall z, less (x[+]z) (y[+]z);
   ax_mult_resp_pos  : forall x y, less [0] x -> less [0] y -> less [0] (x[*]y);
   ax_less_conf_ap   : forall x y, Iff (x [#] y) (less x y or less y x);
   def_leEq : forall x y, (leEq x y) <-> (Not (less y x));
   def_greater : forall x y, Iff (greater x y) (less y x);
   def_grEq : forall x y, (grEq x y) <-> (leEq y x)}.

Record COrdField : Type :=
  {cof_crr   :> CField;
   cof_less  :  CCSetoid_relation cof_crr;
   cof_leEq :  cof_crr -> cof_crr -> Prop;
   cof_greater :  CCSetoid_relation cof_crr;
   cof_grEq : cof_crr -> cof_crr -> Prop;
   cof_proof :  is_COrdField cof_crr cof_less cof_leEq cof_greater cof_grEq}.

Arguments cof_less {c}.
Infix "[<]" := cof_less (at level 70, no associativity).

Arguments cof_leEq {c}.
Infix "[<=]" := cof_leEq (at level 70, no associativity).

Definition default_greater (X:CField) (lt:CCSetoid_relation X) : CCSetoid_relation X.
 exists (fun x y => lt y x).
Print Options.
 destruct lt.
Print Options.
 unfold Crel_strext in *.
Print Options.
 intros.
Print Options.
 pose (Ccsr_strext _ y2 _ x2 X0).
Print Options.
 tauto.
Print Options.
Defined.
Definition default_grEq (X:CField) (le:Relation X) : Relation X.
exact ((fun x y => (le y x))).
Print Options.
Defined.

Section infinity_of_cordfields.

Variable R : COrdField.

Lemma four_ap_zero : Four [#] ([0]:R).
Admitted.

End infinity_of_cordfields.
Notation " x [/]FourNZ" := (x[/] Four[//]four_ap_zero _) (at level 20).
Print Options.

Definition Q_as_CSemiGroup := Build_CSemiGroup _ Qplus_is_bin_fun Qplus_is_assoc.

Section OrdField_Cauchy.

Variable R : COrdField.

Set Implicit Arguments.
Unset Strict Implicit.
Definition Cauchy_prop (g : nat -> R) : CProp.
Admitted.

Set Strict Implicit.
Unset Implicit Arguments.

Record CauchySeq : Type :=
 {CS_seq   :> nat -> R;
  CS_proof :  Cauchy_prop CS_seq}.
Definition SeqLimit (seq : nat -> R) (lim : R) : CProp.
Admitted.

End OrdField_Cauchy.

Arguments SeqLimit [R].

Record is_CReals (R : COrdField) (lim : CauchySeq R -> R) : CProp :=
  {ax_Lim  : forall s : CauchySeq R, SeqLimit s (lim s);
   ax_Arch : forall x : R, {n : nat | x [<=] nring n}}.
Print Options.

Record CReals : Type :=
  {crl_crr   :> COrdField;
   crl_lim   :  CauchySeq crl_crr -> crl_crr;
   crl_proof :  is_CReals crl_crr crl_lim}.
Definition Lim : forall IR : CReals, CauchySeq IR -> IR.
Admitted.

Arguments Lim [IR].

Lemma ZEROQ_as_rht_unit3 : is_rht_unit (S:=Q_as_CSetoid) Qplus_is_bin_fun 0.
Admitted.

Lemma ZEROQ_as_lft_unit3 : is_lft_unit (S:=Q_as_CSetoid) Qplus_is_bin_fun 0.
Admitted.

Definition Q_is_CMonoid := Build_is_CMonoid
 Q_as_CSemiGroup _ ZEROQ_as_rht_unit3 ZEROQ_as_lft_unit3.

Definition Q_as_CMonoid := Build_CMonoid Q_as_CSemiGroup _ Q_is_CMonoid.

Lemma Q_is_CGroup : is_CGroup Q_as_CMonoid Qopp_is_fun.
Admitted.

Definition Q_as_CGroup := Build_CGroup Q_as_CMonoid Qopp_is_fun Q_is_CGroup.

Lemma Q_is_CAbGroup : is_CAbGroup Q_as_CGroup.
Admitted.

Definition Q_as_CAbGroup := Build_CAbGroup Q_as_CGroup Q_is_CAbGroup.

Definition Q_is_CRing : is_CRing Q_as_CAbGroup 1 Qmult_is_bin_fun.
Admitted.

Definition Q_as_CRing := Build_CRing _ _ _ Q_is_CRing.

Lemma Q_is_CField : is_CField Q_as_CRing Qinv_dep.
Admitted.

Definition Q_as_CField := Build_CField _ _ Q_is_CField Qinv_strext.

Definition Qlt_is_strict_order := Build_strictorder
 Qlt_trans Qlt_is_antisymmetric_unfolded.

Definition Q_is_COrdField := Build_is_COrdField Q_as_CField
 Qlt_is_CSetoid_relation Qle (default_greater Q_as_CField Qlt_is_CSetoid_relation)
 (default_grEq Q_as_CField Qle) Qlt_is_strict_order (fun x y E z => proj2 (Qplus_lt_l x y z) E)
 Qmult_lt_0_compat Qlt_gives_apartness Qle_is_not_lt Qgt_is_lt Qge_is_not_gt.

Definition Q_as_COrdField := Build_COrdField _ _ _ _ _ Q_is_COrdField.

Definition IR : CReals.
Admitted.

Notation PartIR := (PartFunct IR).

Section Rational_sequence_prelogue.

Variable R1 : CReals.

Local Coercion nat_of_P : positive >-> nat.

Lemma den_is_nonzero : forall x : Q_as_COrdField, nring (R:=R1) (Qden x) [#] [0].
Admitted.

Definition inj_Q : Q_as_COrdField -> R1.
 intro x.
Print Options.
 case x.
Print Options.
 intros num0 den0.
Print Options.
 exact (zring num0[/]nring (R:=R1) den0[//]den_is_nonzero (Qmake num0 den0)).
Print Options.
Defined.

End Rational_sequence_prelogue.

Section Max_function.

Variables x y : IR.

Definition MAX : IR.
Admitted.

End Max_function.

Lemma MAX_strext : bin_op_strext _ MAX.
Admitted.

Definition Max := Build_CSetoid_bin_op _ MAX MAX_strext.

Section Minimum.
Definition Min : CSetoid_bin_op IR.
Admitted.

Lemma Min_leEq_lft : forall x y : IR, Min x y [<=] x.
Print Options.
Admitted.

Lemma Min_leEq_rht : forall x y : IR, Min x y [<=] y.
Print Options.
Admitted.

Variables a b : IR.

Lemma Min_leEq_Max : Min a b [<=] Max a b.
Print Options.
Admitted.

End Minimum.
Definition AbsIR : CSetoid_un_op IR.
Admitted.

Definition compact (a b : IR) (Hab : a [<=] b) (x : IR) := a [<=] x and x [<=] b.
Print Options.

Notation Compact := (compact _ _).

Section Definitions_and_Basic_Results.

Variables a b : IR.
Hypothesis Hab : a [<=] b.
Print Options.

Let I := Compact Hab.

Variable F : PartIR.

Let P := Dom F.

Definition Continuous_I := included I P and (forall e, [0] [<] e -> {d : IR | [0] [<] d |
 forall x y, I x -> I y -> forall Hx Hy, AbsIR (x[-]y) [<=] d -> AbsIR (F x Hx[-]F y Hy) [<=] e}).
Print Options.

End Definitions_and_Basic_Results.

Arguments Continuous_I [a b].

Section Integral.

Variables a b : IR.
Hypothesis Hab : a [<=] b.
Print Options.

Variable F : PartIR.
Hypothesis contF : Continuous_I Hab F.

Definition integral_seq : nat -> IR.
Admitted.

Lemma Cauchy_Darboux_Seq : Cauchy_prop integral_seq.
Admitted.

Definition integral := Lim (Build_CauchySeq _ _ Cauchy_Darboux_Seq).

End Integral.

Inductive interval : Type :=
  | realline         : interval
  | openl      : IR -> interval
  | openr      : IR -> interval
  | closel     : IR -> interval
  | closer     : IR -> interval
  | olor : IR -> IR -> interval
  | olcr : IR -> IR -> interval
  | clor : IR -> IR -> interval
  | clcr : IR -> IR -> interval.
Definition iprop (I : interval) (x : IR) : CProp.
exact (match I with
  | realline => True
  | openr b  => x [<] b
  | openl a  => a [<] x
  | closer b => x [<=] b
  | closel a => a [<=] x
  | olor a b => a [<] x and x [<] b
  | olcr a b => a [<] x and x [<=] b
  | clor a b => a [<=] x and x [<] b
  | clcr a b => a [<=] x and x [<=] b
  end).
Print Options.
Defined.

Coercion iprop : interval >-> Funclass.

Lemma iprop_wd : forall I : interval, pred_wd _ I.
Admitted.

Section Functions.
Variable I : interval.

Definition Continuous F := included I (Dom F) and (forall a b (Hab : a [<=] b),
 included (Compact Hab) I -> Continuous_I Hab F).
Print Options.

End Functions.

Section Definitions.

Variables a b : IR.
Hypothesis Hab : Min a b [<=] Max a b.
Print Options.
Variable F : PartIR.

Hypothesis HF : Continuous_I Hab F.

Lemma Integral_inc1 : Continuous_I (Min_leEq_lft a b) F.
Admitted.

Lemma Integral_inc2 : Continuous_I (Min_leEq_rht a b) F.
Admitted.

Definition Integral :=
  integral _ _ (Min_leEq_rht a b) F Integral_inc2[-]integral _ _ (Min_leEq_lft a b) _ Integral_inc1.

End Definitions.

Arguments Integral [a b Hab F].

Section Indefinite_Integral.

Variable I : interval.
Variable F : PartIR.

Hypothesis contF : Continuous I F.

Variable a : IR.
Hypothesis Ha : I a.

Lemma prim_lemma : forall x : IR, I x -> Continuous_I (Min_leEq_Max a x) F.
Admitted.

Lemma Fprim_strext : forall x y Hx Hy,
 Integral (prim_lemma x Hx) [#] Integral (prim_lemma y Hy) -> x [#] y.
Admitted.

Definition Fprim : PartIR.
 apply Build_PartFunct with (pfpfun := fun (x : IR) (Hx : I x) => Integral (prim_lemma x Hx)).
Print Options.
  apply iprop_wd.
Print Options.
 exact Fprim_strext.
Print Options.
Defined.

End Indefinite_Integral.

Arguments Fprim [I F].

Notation "[-S-] F" := (Fprim F) (at level 20).
Fixpoint pi_seq (n : nat) : IR.
Admitted.

Lemma pi_seq_Cauchy : Cauchy_prop pi_seq.
Admitted.

Definition Pi := Two[*]Lim (Build_CauchySeq _ _ pi_seq_Cauchy).

Lemma ArcTan_def_lemma : Continuous realline {1/} ( [-C-][1]{+}FId{^}2).
Print Options.
Admitted.

Definition ArcTang := ( [-S-]ArcTan_def_lemma) [0] I.
Print Options.

Definition ArcTan (x : IR) := ArcTang x I.
Import CoRN.model.totalorder.QMinMax.
Import CoRN.stdlib_omissions.Q.

Set Implicit Arguments.

Section Pi.
Let f (a b:Q) : Q.
exact (let (x,y) := a in
 let (z,w) := b in
 Qred ((x*w + y*z)%Z/(y*w-x*z)%Z)).
Print Options.
Defined.

Definition ArcTan_multiple : forall x, -(1) <= x <= 1 -> forall n,
  sumbool True ((nring n)[*]ArcTan (inj_Q _ x)[=]ArcTan (inj_Q _ (iter_nat n _ (f x) 0))).
 intros x Hx.
Print Options.
 induction n.
Print Options.
  right.
Print Options.
 admit.
Print Options.
 destruct (IHn) as [H|H].
Print Options.
  left; constructor.
Print Options.
 set (y:=(iter_nat n Q (f x) 0)) in *.
Print Options.
 destruct (Qlt_le_dec_fast 1 y) as [_|Y0].
Print Options.
  left; constructor.
Print Options.
 destruct (Qlt_le_dec_fast y (-(1))) as [_|Y1].
Print Options.
  left; constructor.
Print Options.
 destruct (Qeq_dec (1-x*y) 0) as [_|Y2].
Print Options.
  left; constructor.
Print Options.
 right.
Print Options.
 admit.
Print Options.
Defined.

Lemma reflect_right : forall A B (x:{A}+{B}), (match x with left _ => False | right _ => True end) -> B.
Admitted.

Lemma Pi_Formula :
(((nring 44)[*]ArcTan (inj_Q IR (1 /  57%Z))[-]
  (nring 12)[*]ArcTan (inj_Q IR (1 / 682%Z))[+]
  (nring  7)[*]ArcTan (inj_Q IR (1 / 239%Z))[+]
  (nring 24)[*]ArcTan (inj_Q IR (1 / 12943%Z)))[=]
 Pi[/]FourNZ).
Print Options.
 assert (H0:-(1) <= (1/(57%Z)) <= 1).
Print Options.
  split; discriminate.
Print Options.
 set (y0:=(iter_nat 44 _ (f (1/57%Z)) 0)).
Print Options.
 csetoid_replace ((nring 44)[*]ArcTan (inj_Q IR (1 / 57%Z)))
   (ArcTan (inj_Q IR y0)); [|apply: (reflect_right (ArcTan_multiple H0 44)); now vm_compute].
Print Options.
🛠️ Intermediate Coq File (useful for debugging if minimization did not go as far as you wanted)
🛠️ 📜 Intermediate Coq File log (useful for debugging if minimization did not go as far as you wanted)
📜 Build Log (contains the Coq error message) (truncated to last 8.0KiB; full 7.7MiB file on GitHub Actions Artifacts under build.log)
2+flambda/bin:/github/workspace/.venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+++ export COQBIN=/github/workspace/builds/coq/coq-failing/_install_ci/bin/
+++ COQBIN=/github/workspace/builds/coq/coq-failing/_install_ci/bin/
++ CI_BUILD_DIR=/github/workspace/builds/coq/coq-failing/_build_ci
++ declare -A overlays
++ set +x
+ git_download corn
+ local project=corn
+ local dest=/github/workspace/builds/coq/coq-failing/_build_ci/corn
+ local giturl_var=corn_CI_GITURL
+ local giturl=https://github.com/coq-community/corn
+ local ref_var=corn_CI_REF
+ local ref=master
+ local parent_project_var=corn_CI_PARENT_PROJECT
+ local parent_project=
+ local submodule_folder_var=corn_CI_SUBMODULE_FOLDER
+ local submodule_folder=
+ local ov_url=
+ local ov_ref=
++ dirname /github/workspace/builds/coq/coq-failing/_build_ci/corn
+ local dest_prefix=/github/workspace/builds/coq/coq-failing/_build_ci/
+ '[' '' = '' ']'
+ local parent_project_dest=/github/workspace/builds/coq/coq-failing/_build_ci/
+ local parent_project_relative_dest=
+ '[' -d /github/workspace/builds/coq/coq-failing/_build_ci/corn ']'
+ echo 'Warning: download and unpacking of corn skipped because /github/workspace/builds/coq/coq-failing/_build_ci/corn already exists.'
Warning: download and unpacking of corn skipped because /github/workspace/builds/coq/coq-failing/_build_ci/corn already exists.
+ '[' '' ']'
+ export 'COQEXTRAFLAGS=-native-compiler no'
+ COQEXTRAFLAGS='-native-compiler no'
+ cd /github/workspace/builds/coq/coq-failing/_build_ci/corn
+ ./configure.sh
Deprecated environment variable COQLIB, use ROCQLIB instead.
Deprecated environment variable COQCORELIB, use ROCQRUNTIMELIB instead.
+ make
+ '[' -z x ']'
+ command make
ROCQ DEP VFILES
Warning: Deprecated environment variable COQLIB, use ROCQLIB instead.
         [deprecated-coq-env-var,deprecated-since-9.0,deprecated,default]
Warning: Deprecated environment variable COQCORELIB,
         use ROCQRUNTIMELIB instead.
         [deprecated-coq-env-var,deprecated-since-9.0,deprecated,default]
.Makefile.d (real: 0.45, user: 0.20, sys: 0.17, mem: 22520 ko)
ROCQ compile reals/fast/CRpi_fast.v
MINIMIZER_DEBUG_EXTRA: coqc: /github/workspace/builds/coq/coq-failing/_install_ci/bin/////rocq
MINIMIZER_DEBUG_EXTRA: original invocation: '' 
MINIMIZER_DEBUG_EXTRA: new invocation: /github/workspace/builds/coq/coq-failing/_install_ci/bin/rocq.orig compile -q -w -deprecated-native-compiler-option -native-compiler no -R /github/workspace/builds/coq/coq-failing/_build_ci/corn CoRN reals/fast/CRpi_fast.v 
MINIMIZER_DEBUG_EXTRA: coqpath: 
MINIMIZER_DEBUG_EXTRA: ocamlpath: /github/workspace/builds/coq/coq-failing/_install_ci/lib:
MINIMIZER_DEBUG_EXTRA: pwd: PWD=/github/workspace/builds/coq/coq-failing/_build_ci/corn
MINIMIZER_DEBUG_EXTRA: exec: /github/workspace/builds/coq/coq-failing/_install_ci/bin/rocq.orig compile -q -w -deprecated-native-compiler-option -native-compiler no -R /github/workspace/builds/coq/coq-failing/_build_ci/corn CoRN reals/fast/CRpi_fast.v 
MINIMIZER_DEBUG_EXTRA: coqlib: Warning: Deprecated environment variable COQLIB, use ROCQLIB instead.
/github/workspace/builds/coq/coq-failing/_install_ci/lib/coq//
MINIMIZER_DEBUG: info: /tmp/tmp-coqbot-minimizer.tUeOF4Q2mq
MINIMIZER_DEBUG: files:  reals/fast/CRpi_fast.v /github/workspace/builds/coq/coq-failing/_build_ci/corn/reals/fast/CRpi_fast.vWarning, feedback message received but no listener to handle it!
Warning: Deprecated environment variable COQLIB, use ROCQLIB instead.
[deprecated-coq-env-var,deprecated-since-9.0,deprecated,default]Warning, feedback message received but no listener to handle it!
Warning: Deprecated environment variable COQLIB, use ROCQLIB instead.
[deprecated-coq-env-var,deprecated-since-9.0,deprecated,default]
Warning: Deprecated environment variable COQCORELIB,
use ROCQRUNTIMELIB instead.
[deprecated-coq-env-var,deprecated-since-9.0,deprecated,default]
File "./reals/fast/CRpi_fast.v", line 26, characters 0-36:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "./reals/fast/CRpi_fast.v", line 32, characters 0-55:
Warning: Notation "_ = _" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "./reals/fast/CRpi_fast.v", line 32, characters 0-55:
Warning: Notation "_ ≠ _" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "./reals/fast/CRpi_fast.v", line 94, characters 2-45:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 97, characters 3-8:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 100, characters 2-22:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 100, characters 2-22:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 100, characters 2-22:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 100, characters 2-22:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 100, characters 2-22:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 105, characters 1-7:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 105, characters 1-7:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 105, characters 1-7:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 105, characters 1-7:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 105, characters 1-7:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 110, characters 2-50:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 113, characters 2-7:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 120, characters 1-6:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 230, characters 1-154:
Warning: vm_compute disabled at configure time; falling back to cbv.
[vm-compute-disabled,bytecode-compiler,default]
File "./reals/fast/CRpi_fast.v", line 230, characters 1-154:
Error: Stack overflow.

Command exited with non-zero status 1
reals/fast/CRpi_fast.vo (real: 3.44, user: 3.02, sys: 0.28, mem: 1730264 ko)
make[1]: *** [Makefile:815: reals/fast/CRpi_fast.vo] Error 1
make[1]: *** [reals/fast/CRpi_fast.vo] Deleting file 'reals/fast/CRpi_fast.glob'
make: *** [Makefile:411: all] Error 2
+ code=2
+ printf '\n%s exit code: %s\n' corn 2
+ '[' corn '!=' stdlib_test ']'
+ echo 'Aggregating timing log...'
Aggregating timing log...
+ echo

+ tools/make-one-time-file.py --real _build_ci/corn.log
    Time |   Peak Mem | File Name              
-----------------------------------------------
0m03.89s | 1730264 ko | Total Time / Peak Mem  
-----------------------------------------------
0m03.44s | 1730264 ko | reals/fast/CRpi_fast.vo
0m00.45s |   22520 ko | .Makefile.d            
+ '[' '' ']'
+ exit 2
/github/workspace/builds/coq /github/workspace
::endgroup::
📜 🔎 Minimization Log (truncated to last 8.0KiB; full 28MiB file on GitHub Actions Artifacts under bug.log)
e-9.0,deprecated,default]
File "/tmp/tmpuw_c_fh9/Top/bug_01.v", line 223, characters 0-34:
Warning: Library File Stdlib.ZArith.ZArith_base is deprecated
since Stdlib 9.0. use ZArith instead
[deprecated-library-file-since-Stdlib-9.0,deprecated-since-Stdlib-9.0,deprecated-library-file,deprecated,default]
File "/tmp/tmpuw_c_fh9/Top/bug_01.v", line 276, characters 7-20:
Warning: Coq.Init.Ltac has been replaced by Corelib.Init.Ltac.
[deprecated-dirpath-Coq,deprecated-since-9.0,deprecated,default]
File "/tmp/tmpuw_c_fh9/Top/bug_01.v", line 289, characters 0-29:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "/tmp/tmpuw_c_fh9/Top/bug_01.v", line 335, characters 46-50:
Error: The reference nexp was not found in the current environment.


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Admitting lemmas unsuccessful.
No successful changes.

I will now attempt to admit definitions with admit. Defined

Non-fatal error: Failed to admit definitions and preserve the error.  
The new error was:
Deprecated environment variable COQCORELIB, use ROCQRUNTIMELIB instead.
Warning: Deprecated environment variable COQCORELIB,
use ROCQRUNTIMELIB instead.
[deprecated-coq-env-var,deprecated-since-9.0,deprecated,default]
File "/tmp/tmpuw_c_fh9/Top/bug_01.v", line 223, characters 0-34:
Warning: Library File Stdlib.ZArith.ZArith_base is deprecated
since Stdlib 9.0. use ZArith instead
[deprecated-library-file-since-Stdlib-9.0,deprecated-since-Stdlib-9.0,deprecated-library-file,deprecated,default]
File "/tmp/tmpuw_c_fh9/Top/bug_01.v", line 276, characters 7-20:
Warning: Coq.Init.Ltac has been replaced by Corelib.Init.Ltac.
[deprecated-dirpath-Coq,deprecated-since-9.0,deprecated,default]
File "/tmp/tmpuw_c_fh9/Top/bug_01.v", line 289, characters 0-29:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "/tmp/tmpuw_c_fh9/Top/bug_01.v", line 335, characters 46-50:
Error: The reference nexp was not found in the current environment.


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Admitting definitions unsuccessful.
No successful changes.

I will now attempt to admit lemmas with Admitted with Proof using

Non-fatal error: Failed to admit lemmas and preserve the error.  
The new error was:
Deprecated environment variable COQCORELIB, use ROCQRUNTIMELIB instead.
Warning: Deprecated environment variable COQCORELIB,
use ROCQRUNTIMELIB instead.
[deprecated-coq-env-var,deprecated-since-9.0,deprecated,default]
File "/tmp/tmp7sjnn2bv/Top/bug_01.v", line 223, characters 0-34:
Warning: Library File Stdlib.ZArith.ZArith_base is deprecated
since Stdlib 9.0. use ZArith instead
[deprecated-library-file-since-Stdlib-9.0,deprecated-since-Stdlib-9.0,deprecated-library-file,deprecated,default]
File "/tmp/tmp7sjnn2bv/Top/bug_01.v", line 276, characters 7-20:
Warning: Coq.Init.Ltac has been replaced by Corelib.Init.Ltac.
[deprecated-dirpath-Coq,deprecated-since-9.0,deprecated,default]
File "/tmp/tmp7sjnn2bv/Top/bug_01.v", line 289, characters 0-29:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "/tmp/tmp7sjnn2bv/Top/bug_01.v", line 333, characters 46-50:
Error: The reference nexp was not found in the current environment.


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Admitting lemmas unsuccessful.
No successful changes.

I will now attempt to admit definitions with Admitted with Proof using

Non-fatal error: Failed to admit definitions and preserve the error.  
The new error was:
Deprecated environment variable COQCORELIB, use ROCQRUNTIMELIB instead.
Warning: Deprecated environment variable COQCORELIB,
use ROCQRUNTIMELIB instead.
[deprecated-coq-env-var,deprecated-since-9.0,deprecated,default]
File "/tmp/tmp7sjnn2bv/Top/bug_01.v", line 223, characters 0-34:
Warning: Library File Stdlib.ZArith.ZArith_base is deprecated
since Stdlib 9.0. use ZArith instead
[deprecated-library-file-since-Stdlib-9.0,deprecated-since-Stdlib-9.0,deprecated-library-file,deprecated,default]
File "/tmp/tmp7sjnn2bv/Top/bug_01.v", line 276, characters 7-20:
Warning: Coq.Init.Ltac has been replaced by Corelib.Init.Ltac.
[deprecated-dirpath-Coq,deprecated-since-9.0,deprecated,default]
File "/tmp/tmp7sjnn2bv/Top/bug_01.v", line 289, characters 0-29:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "/tmp/tmp7sjnn2bv/Top/bug_01.v", line 333, characters 46-50:
Error: The reference nexp was not found in the current environment.


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Admitting definitions unsuccessful.
No successful changes.

I will now attempt to admit lemmas with admit. Defined with Proof using

Non-fatal error: Failed to admit lemmas and preserve the error.  
The new error was:
Deprecated environment variable COQCORELIB, use ROCQRUNTIMELIB instead.
Warning: Deprecated environment variable COQCORELIB,
use ROCQRUNTIMELIB instead.
[deprecated-coq-env-var,deprecated-since-9.0,deprecated,default]
File "/tmp/tmpuw_c_fh9/Top/bug_01.v", line 223, characters 0-34:
Warning: Library File Stdlib.ZArith.ZArith_base is deprecated
since Stdlib 9.0. use ZArith instead
[deprecated-library-file-since-Stdlib-9.0,deprecated-since-Stdlib-9.0,deprecated-library-file,deprecated,default]
File "/tmp/tmpuw_c_fh9/Top/bug_01.v", line 276, characters 7-20:
Warning: Coq.Init.Ltac has been replaced by Corelib.Init.Ltac.
[deprecated-dirpath-Coq,deprecated-since-9.0,deprecated,default]
File "/tmp/tmpuw_c_fh9/Top/bug_01.v", line 289, characters 0-29:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "/tmp/tmpuw_c_fh9/Top/bug_01.v", line 335, characters 46-50:
Error: The reference nexp was not found in the current environment.


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Admitting lemmas unsuccessful.
No successful changes.

I will now attempt to admit definitions with admit. Defined with Proof using

Non-fatal error: Failed to admit definitions and preserve the error.  
The new error was:
Deprecated environment variable COQCORELIB, use ROCQRUNTIMELIB instead.
Warning: Deprecated environment variable COQCORELIB,
use ROCQRUNTIMELIB instead.
[deprecated-coq-env-var,deprecated-since-9.0,deprecated,default]
File "/tmp/tmpuw_c_fh9/Top/bug_01.v", line 223, characters 0-34:
Warning: Library File Stdlib.ZArith.ZArith_base is deprecated
since Stdlib 9.0. use ZArith instead
[deprecated-library-file-since-Stdlib-9.0,deprecated-since-Stdlib-9.0,deprecated-library-file,deprecated,default]
File "/tmp/tmpuw_c_fh9/Top/bug_01.v", line 276, characters 7-20:
Warning: Coq.Init.Ltac has been replaced by Corelib.Init.Ltac.
[deprecated-dirpath-Coq,deprecated-since-9.0,deprecated,default]
File "/tmp/tmpuw_c_fh9/Top/bug_01.v", line 289, characters 0-29:
Warning: Notation "{ _ : _ | _ }" was already used in scope type_scope.
[notation-overridden,parsing,default]
File "/tmp/tmpuw_c_fh9/Top/bug_01.v", line 335, characters 46-50:
Error: The reference nexp was not found in the current environment.


�[93mIntermediate code not saved.�[0m
Failed to do everything at once; trying one at a time.
Admitting definitions unsuccessful.
No successful changes.

I will now attempt to add Proof using lines
�[92m
Adding Proof using lines successful.�[0m
Failed to do everything at once; trying one at a time.
Adding Proof using lines unsuccessful.
No successful changes.

I will now attempt to export modules
Module exportation successful

I will now attempt to split imports and exports
Import/Export splitting unsuccessful.

I will now attempt to split := definitions
One-line definition splitting unsuccessful.

I will now attempt to lift Requires to the top of the file while inserting option settings

I will now attempt to lift Requires to the top of the file while inserting option settings

I will now attempt to remove all lines, one at a time

If you have any comments on your experience of the minimizer, please share them in a reply (possibly tagging @JasonGross).
If you believe there's a bug in the bug minimizer, please report it on the bug minimizer issue tracker.

@SkySkimmer
Copy link
Contributor Author

Most significant vosize changes (sorted by % then absolute change)

coq-fiat-parsers/./src/Parsers/Refinement/SharpenedABStarParseTree.vo 18952 22895 3943 20%
rocq-stdlib/./theories/Zmod/Zstar.vo 784 784 0 0%
...
coq-hott/./theories/Colimits/Colimit_Flattening.vo 307072 53747 -253325 -82%
coq-hott/./theories/WildCat/Products.vo 960638 162971 -797667 -83%
coq-fiat-parsers/./src/Parsers/BooleanRecognizerOptimized.vo 2792213 474256 -2317957 -83%
coq-hott/./theories/WildCat/MonoidalTwistConstruction.vo 406329 62006 -344323 -84%
coq-fiat-parsers/./src/Parsers/GenericRecognizerOptimized.vo 2045280 292217 -1753063 -85%
coq-unimath/./UniMath/CategoryTheory/Inductives/LambdaCalculus.vo 116684 15464 -101220 -86%
coq-category-theory/./Functor/Traversable/Product.vo 102822 12599 -90223 -87%
coq-hott/./theories/Spaces/TwoSphere.vo 93567 11044 -82523 -88%
coq-hott/./theories/Spaces/Spheres.vo 264173 31496 -232677 -88%
coq-hott/./theories/Categories/Grothendieck/ToSet/Morphisms.vo 75474 5692 -69782 -92%
coq-unimath/./UniMath/CategoryTheory/Monads/Derivative.vo 934674 70861 -863813 -92%
coq-unimath/./UniMath/CategoryTheory/Monoidal/AlternativeDefinitions/EquivalenceWhiskeredNonCurriedMonoidalCategories.vo 1007871 72125 -935746 -92%
coq-fiat-parsers/./src/Parsers/Refinement/SharpenedJSON.vo 6567699 327111 -6240588 -95%
coq-hott/./theories/Spaces/Torus/TorusEquivCircles.vo 1110230 28450 -1081780 -97%

@SkySkimmer SkySkimmer added request: full CI Use this label when you want your next push to trigger a full CI. and removed needs: progress Work in progress: awaiting action from the author. labels Mar 2, 2026
@SkySkimmer SkySkimmer marked this pull request as ready for review March 2, 2026 13:52
@SkySkimmer SkySkimmer requested review from a team as code owners March 2, 2026 13:52
@coqbot-app coqbot-app bot removed the request: full CI Use this label when you want your next push to trigger a full CI. label Mar 2, 2026
@github-actions github-actions bot added the needs: rebase Should be rebased on the latest master to solve conflicts or have a newer CI run. label Mar 2, 2026
@coqbot-app coqbot-app bot removed the needs: rebase Should be rebased on the latest master to solve conflicts or have a newer CI run. label Mar 3, 2026
@coqbot-app coqbot-app bot added the needs: full CI The latest GitLab pipeline that ran was a light CI. Say "@coqbot run full ci" to get a full CI. label Mar 3, 2026
Copy link
Contributor

@silene silene left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes seem fine to me, but the motivation eludes me. What does it bring?

Is it a way to avoid generating (and storing) the VM segment in the .vo file? If so, what happens if the user compiles a file with coqc -bytecode-compiler no and then requires it with coqc -bytecode-compiler yes? Does it crash?

@SkySkimmer
Copy link
Contributor Author

SkySkimmer commented Mar 4, 2026

Is it a way to avoid generating (and storing) the VM segment in the .vo file?

That and also fixing that we ignore the configure time flag.

what happens if the user compiles a file with coqc -bytecode-compiler no and then requires it with coqc -bytecode-compiler yes

Definitions from the bytecode=no file are treated as axioms by the VM.
Maybe we should produce a warning when we try to compile a term which has non-compiled constants?

@silene
Copy link
Contributor

silene commented Mar 4, 2026

Maybe we should produce a warning when we try to compile a term which has non-compiled constants?

I might even go for an error, so as to avoid having a large discrepancy between a term reduced by vm_compute and a term reduced by cbv. (And we all know how wrong things can go when normalizing terms with opaque constants, so better to error out rather than to go into an infinite loop.)

@SkySkimmer SkySkimmer added the needs: progress Work in progress: awaiting action from the author. label Mar 4, 2026
@SkySkimmer
Copy link
Contributor Author

Moved lazy change to separate PR #21735

The code also puts "BCuncompiled" for symbols and primitives, but
symbols can only be declared when rewrite rules are on so VM is
disabled and cannot be reenabled, and the const_body_code for
primitives is not accessed as genlambda produces Lprim instead of Lconst.
@SkySkimmer SkySkimmer added request: full CI Use this label when you want your next push to trigger a full CI. and removed needs: progress Work in progress: awaiting action from the author. labels Mar 10, 2026
@SkySkimmer SkySkimmer requested review from a team as code owners March 10, 2026 16:48
@coqbot-app coqbot-app bot removed request: full CI Use this label when you want your next push to trigger a full CI. needs: full CI The latest GitLab pipeline that ran was a light CI. Say "@coqbot run full ci" to get a full CI. labels Mar 10, 2026
@SkySkimmer
Copy link
Contributor Author

I might even go for an error,

Added error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants