Permalink
Browse files

Merge pull request #1 from 0x01/master

Update to 8.4 beta
  • Loading branch information...
2 parents 2a93661 + 8b864e2 commit c52cab66f35ded10aa7adad0f49f0e29f82f14f5 @wires wires committed Feb 3, 2012
Showing with 290 additions and 352 deletions.
  1. +1 −1 .gitmodules
  2. +10 −36 README
  3. +1 −0 algebra/CPoly_NthCoeff.v
  4. +0 −1 algebra/CPolynomials.v
  5. +0 −2 algebra/CRing_as_Ring.v
  6. 0 {reals/fast → broken}/AbstractIntegration.v
  7. 0 {algebra → broken}/CPoly_Euclid.v
  8. 0 {algebra → broken}/CPoly_Lagrange.v
  9. 0 {algebra → broken}/CPoly_Newton.v
  10. 0 {algebra → broken}/CRingClass.v
  11. +9 −9 {metric2 → broken}/Classified.v
  12. 0 {algebra → broken}/DivDiff_RepeatedIntegral.v
  13. 0 {reals/fast → broken}/NewAbstractIntegration.v
  14. 0 {reals/fast → broken}/Picard.v
  15. 0 {algebra → broken}/Ranges.v
  16. 0 {algebra → broken}/RingClass.v
  17. 0 {reals/fast → broken}/SimpsonIntegration.v
  18. +136 −0 broken/abstract_gsum.v
  19. 0 {reals/fast → broken}/diff.v
  20. 0 {util → broken}/list_separates.v
  21. +1 −1 math-classes
  22. +2 −2 metric2/Limit.v
  23. +20 −0 metric2/UCFnMonoid.v
  24. +1 −1 model/Zmod/ZGcd.v
  25. +0 −2 model/structures/QnonNeg.v
  26. +1 −3 reals/Q_in_CReals.v
  27. +4 −5 reals/fast/CRAlternatingSum.v
  28. +4 −4 reals/fast/CRArith.v
  29. +4 −1 reals/fast/CRGroupOps.v
  30. +2 −1 reals/fast/CRarctan.v
  31. +3 −4 reals/fast/CRarctan_small.v
  32. +3 −3 reals/fast/CRball.v
  33. +6 −10 reals/fast/CRcorrect.v
  34. +1 −1 reals/fast/CRexp.v
  35. +1 −1 reals/fast/CRroot.v
  36. +2 −1 reals/fast/CRseries.v
  37. +1 −1 reals/fast/CRsin.v
  38. +23 −13 reals/faster/ARAlternatingSum.v
  39. +1 −1 reals/faster/ARArith.v
  40. +0 −212 reals/faster/ARGeometricSum.v
  41. +7 −8 reals/faster/ARbigD.v
  42. +2 −2 reals/faster/ARbigQ.v
  43. +23 −3 reals/faster/ARexp.v
  44. +5 −2 reals/faster/ARroot.v
  45. +0 −4 transc/Pi.v
  46. +1 −2 transc/RealPowers.v
  47. +2 −2 transc/TrigMon.v
  48. +0 −1 util/Extract.v
  49. +2 −0 util/PointFree.v
  50. +11 −12 util/Qdlog.v
View
@@ -1,3 +1,3 @@
[submodule "math-classes"]
path = math-classes
- url = git://github.com/0x01/math-classes.git
+ url = git://github.com/robbertkrebbers/math-classes.git
View
46 README
@@ -4,19 +4,11 @@ C-CoRN, the Coq Constructive Repository at Nijmegen
PREREQUISITES
-------------
- This version of C-CoRN is known to compile with:
+This version of C-CoRN is known to compile with:
- - Coq version revision 14023 from the trunk branch
-
- svn co -r 14023 svn://scm.gforge.inria.fr/svn/coq/trunk coq-14023/
+ - Coq 8.4 beta
One might also perform the following optimizations:
- * Revert commit 13997 to speed up instance resolution (dependent subgoals
- are put first since 13997. This sometimes reduces the performance
- badly). This commit can be reverted using the following command:
-
- svn diff -r 13997:13996 | patch -p0
-
* Change size = 6 to size = 12 in theories/Numbers/Natural/BigN/NMake_gen.ml
to increase performance for big numbers.
@@ -29,29 +21,19 @@ PREREQUISITES
GIT CHECKOUT & SUBMODULES
-------------------------
-The corn repository contains the math-classes repository as a submodule.
-You can obtain it's contents automatically by giving the --recursive
-option when you clone this repository:
+C-CoRN depends on Math Classes, which is a library of abstract interfaces for
+mathematical structures that is heavily based on Coq's new type classes.
+Math Classes is contained in the C-CoRN git repository as a submodule. You can
+obtain math-classes automatically by giving the --recursive option when you
+clone the git repository:
git clone --recursive https://github.com/c-corn/corn.git
-If you have already cloned this repository without --recursive, you can
+If you have already cloned the CoRN repository without --recursive, you can
still get the submodules with
git submodule update --init --recursive
-If you don't do this, you will run into the following build error:
-
- $ scons -k -j4
-
- scons: Reading SConscript files ...
- scons: warning: Ignoring missing SConscript
- 'math-classes/src/SConscript'
- File "/home/wires/w/corn/SConstruct", line 31, in <module>
- TypeError: 'NoneType' object is not iterable:
- File "/home/wires/w/corn/SConstruct", line 31:
- mc_vs, mc_vos, mc_globs = env.SConscript(dirs='math-classes/src')
-
BUILDING C-CoRN
---------------
@@ -82,15 +64,7 @@ A dependency graph in DOT format can be created with "scons deps.dot".
PLOTS
-----
-If you want high resolution plots in examples/Circle.v,
-follow the instructions in dump/INSTALL
-
-OTHERS
-------
-More information can be found at the C-CoRN page,
-http://c-corn.cs.ru.nl/
-For any questions, comments, bug reports or other feel free to contact
-us; contact information is in the doc/www/info.html file.
+If you want high resolution plots in examples/Circle.v, follow the instructions
+in dump/INSTALL
- LocalWords: Nijmegen CoRN Coq VCS
View
@@ -36,6 +36,7 @@
Require Export CPolynomials.
Require Import Morphisms.
+Require Import CRings.
(**
* Polynomials: Nth Coefficient
View
@@ -40,7 +40,6 @@
(** printing RX %\ensuremath{R[x]}% #R[x]# *)
(** printing FX %\ensuremath{F[x]}% #F[x]# *)
-Require Export CRingClass.
Require Import CRing_Homomorphisms.
Require Import Rational.
View
@@ -1,5 +1,3 @@
-Require Export CRingClass.
-Require Export RingClass. (* should not be needed *)
Require Export CRings Ring.
Definition CRing_Ring(R:CRing):(ring_theory (@cm_unit R) (@cr_one R) (@csg_op R) (@cr_mult R) (fun x y => x [-] y) (@cg_inv R) (@cs_eq R)).
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -4,12 +4,12 @@
it is still bound to stdlib Q rather than an abstract Rationals implementation. *)
Require Import
- Setoid Arith List Program
+ Arith List
CSetoids Qmetric Qring Qinf ProductMetric QposInf
UniformContinuity stdlib_rationals
stdlib_omissions.Pair stdlib_omissions.Q PointFree
interfaces.abstract_algebra
- MathClasses.theory.setoids theory.products.
+ theory.setoids theory.products.
Import Qinf.notations.
@@ -43,7 +43,7 @@ Hint Unfold relation : type_classes.
Context `{!Equiv X} `{!MetricSpaceBall}.
Class MetricSpaceClass: Prop :=
- { mspc_setoid: Setoid X
+ { mspc_setoid : Setoid X
; mspc_ball_proper:> Proper (=) mspc_ball
; mspc_ball_inf: ∀ x y, mspc_ball Qinf.infinite x y
; mspc_ball_negative: ∀ (e: Q), (e < 0)%Q → ∀ x y, ~ mspc_ball e x y
@@ -56,11 +56,8 @@ Hint Unfold relation : type_classes.
(∀ d: Qpos, mspc_ball (e + d) a b) → mspc_ball e a b }.
Context `{MetricSpaceClass}.
-
- Let hint := mspc_setoid.
-
+Local Existing Instance mspc_setoid.
(** Two simple derived properties: *)
-
Lemma mspc_eq a b: (∀ e: Qpos, mspc_ball e a b) → a = b.
Proof with auto.
intros.
@@ -162,7 +159,7 @@ Section genball.
split; destruct Qdec_sign as [[|]|]; auto.
Qed.
- Instance genball_Proper: Proper ((=) ==> (=) ==> (=)) genball.
+ Instance genball_Proper: Proper ((=) ==> (=) ==> (=) ==> iff) genball.
Proof with auto; intuition.
unfold genball.
intros u e' E.
@@ -184,6 +181,9 @@ Section genball.
reflexivity.
Qed.
+Instance: ∀ e, Proper ((=) ==> (=) ==> iff) (genball e).
+Proof. intros; now apply genball_Proper. Qed.
+
Lemma genball_negative (q: Q): (q < 0)%Q → ∀ x y: X, ~ genball q x y.
Proof with auto.
unfold genball.
@@ -227,7 +227,7 @@ Section genball.
change (genball (exist _ e1 B + exist _ e2 E )%Qpos a c).
apply ball_genball.
apply Rtriangle with b; apply ball_genball...
- rewrite <- V. rewrite F, Qplus_0_r...
+ rewrite <- V. rewrite F. rewrite Qplus_0_r...
rewrite U, C, Qplus_0_l...
exfalso. apply (Qlt_irrefl (e1 + e2)). rewrite -> C at 1. rewrite -> F at 1...
exfalso. apply (Qlt_irrefl (e1 + e2)). rewrite -> J at 1...
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
View
@@ -0,0 +1,136 @@
+
+(* Import in the following order to minimize trouble:
+ stdlib, old corn things, mathclasses, new corn things *)
+
+Require Import Limit.
+Require Import abstract_algebra orders additional_operations streams series.
+
+(*
+Lemma forall_impl {A} (P Q: ∞ A → Prop) (H1:∀ t, P t → Q t) :
+ ∀ t, ForAll P t → ForAll Q t.
+Proof.
+ cofix G.
+ split.
+ apply (H1 t).
+ destruct H as [Ha _].
+ exact Ha.
+ destruct H as [_ Hb].
+ apply (G (tl t) Hb).
+Qed.
+*)
+
+(** This section is about computing a generalized version of
+ a geometric series.
+
+ A geometric series has the form $s_{i+1} = r * s_i$ for some
+ ratio $0 < r < 1$ (should we allow negative values for $a$
+ the series will be alternating, however, we don't allow this).
+
+ We impose a further positivity restriction on the elements
+ of the series, $0 ≤ s_i$.
+
+*)
+
+Section geom_sum.
+
+(** We work abstractly of an ordered ring R *)
+Context `{FullPseudoSemiRingOrder R}.
+
+(** R is not automatically a SemiRing as this causes loops in
+ instance search. So we add it locally as this is needed for
+ rewrites, e.g. (1)
+*)
+Instance: SemiRing R := pseudo_srorder_semiring.
+
+(** A geometric series is a series with a constant ratio
+ between succesive terms. Here we parametrize by this ratio
+*)
+Variable r : R.
+Hypothesis Hr : 0 < r < 1.
+
+
+(** A slightly stricter (positive) version of [GeometricSeries],
+ which specifies a slightly more general (less-than instead of
+ equality) version of a geometric series.
+*)
+Definition ARGeometricSeries : ∞ R → Prop :=
+ ForAll (λ xs, 0 ≤ hd (tl xs) ≤ r * hd xs).
+
+
+Section properties.
+
+Context `(gs: ARGeometricSeries s).
+
+(** If [s] is a geometric series, then so is it's tail *)
+Lemma gs_tl : ARGeometricSeries (tl s).
+Proof.
+ apply ForAll_tl; now assumption.
+Qed.
+
+(** Every element in a geometric series is positive *)
+Lemma gs_positive : 0 ≤ hd s.
+Proof.
+ destruct gs as [GS FA].
+ apply (maps.order_reflecting_pos (.*.) r); try tauto.
+ rewrite rings.mult_0_r.
+ transitivity (hd (tl s)); tauto.
+Qed.
+
+(** A geometric series is always decreasing *)
+Lemma gs_decreasing : hd (tl s) ≤ hd s.
+Proof.
+ destruct gs.
+ apply (maps.order_reflecting_pos (.*.) r); try tauto.
+ transitivity (hd (tl s)); try tauto.
+ rewrite <- (rings.mult_1_l (hd (tl s))) at 2.
+ apply semirings.mult_le_compat; try solve [apply orders.lt_le; tauto].
+ tauto.
+ reflexivity.
+Qed.
+
+Notation "'x₀'" := (hd s).
+
+(* if only...
+
+ Notation "'xₙ₊1'" := (Str_nth (n + 1) s).
+ Notation "'xₙ'" := (Str_nth n s).
+*)
+Require Import nat_pow.
+
+Lemma helper n `{xs:∞A} : Str_nth (1 + n) xs ≡ hd (tl (Str_nth_tl n xs)).
+Admitted.
+
+(* [peano_naturals.nat_induction] is a induction scheme that uses
+ type classed naturals. *)
+
+Lemma gs_nth_rn n : Str_nth n s ≤ r^n * x₀.
+Proof.
+ induction n using peano_naturals.nat_induction.
+ rewrite nat_pow_0, rings.mult_1_l; compute; reflexivity.
+ rewrite nat_pow_S.
+ apply (ForAll_Str_nth_tl n) in gs.
+ destruct gs as [[GS1 GS2] FA].
+ replace (hd (Str_nth_tl n s)) with (Str_nth n s) in GS2 by auto.
+ replace (hd (tl (Str_nth_tl n s))) with (Str_nth (1+n) s) in GS2.
+ transitivity (r * Str_nth n s); [assumption|].
+ rewrite <- associativity.
+ apply (maps.order_preserving_nonneg (.*.) r).
+ apply orders.lt_le. destruct Hr as [Ha Hb].
+ auto.
+ assumption.
+ apply helper.
+Admitted.
+
+End properties.
+
+(** A geometric series is decreasing and non negative. *)
+Lemma gs_dnn `(gs: ARGeometricSeries s) : DecreasingNonNegative s.
+Proof.
+ revert s gs.
+ cofix FIX; intros s gs.
+ constructor.
+ now split; auto using gs_positive, gs_tl, gs_decreasing.
+ now apply FIX, gs_tl.
+Qed.
+
+End geom_sum.
File renamed without changes.
File renamed without changes.
Submodule math-classes updated 125 files
View
@@ -30,7 +30,7 @@ Require Import abstract_algebra theory.streams orders.naturals.
A predicate saying there exists a point in the stream where a predicate
is satsified.
-We take the unusual step of puting this inductive type in Prop even
+We take the unusual step of putting this inductive type in Prop even
though it contains constructive information. This is because we expect
this proof to only be used in proofs of termination. *)
Inductive LazyExists {A} (P : Stream A → Prop) (x : Stream A) : Prop :=
@@ -45,7 +45,7 @@ Proof.
induction 1 as [|? ? IH]; intros s2 E.
left. now rewrite <-E.
right. intros _. apply (IH tt). now rewrite E.
- split; repeat intro; eapply prf; eauto. now symmetry.
+ split; repeat intro; eapply prf; eauto.
Qed.
Lemma LazyExists_tl `{P : Stream A → Prop} `(ex : LazyExists P s) (Ptl : EventuallyForAll P s) :
View
@@ -0,0 +1,20 @@
+Require Import Utf8 Streams UniformContinuity abstract_algebra.
+
+
+(** Uniform continuous maps from a metric space to itself (endomaps)
+ form a monoid under composition
+*)
+Section uniform_cont_fn_monoid.
+
+ Context {X:MetricSpace}.
+ Open Scope uc_scope. (* for the _ --> _ notation *)
+
+ Instance ucfn_unit: MonUnit (X --> X) := @uc_id X.
+ Instance ucfn_compose {X}: SgOp (X --> X) := @uc_compose X X X.
+
+ Instance ucfn_monoid: Monoid (X --> X).
+ Proof.
+ repeat split; try apply _; easy.
+ Qed.
+
+End uniform_cont_fn_monoid.
View
@@ -54,7 +54,7 @@ Definition pp := (positive * positive)%type.
Definition pp_lt (x y : pp) :=
let (a, b) := x in
- let (c, d) := y in (b ?= d)%positive Datatypes.Eq = Datatypes.Lt.
+ let (c, d) := y in (b ?= d)%positive = Datatypes.Lt.
Lemma pp_lt_wf : Wf.well_founded pp_lt.
Proof.
@@ -36,8 +36,6 @@ Section binop.
Program Definition binop: T -> T -> T := o.
- Next Obligation. apply o_ok; apply proj2_sig. Qed.
-
Lemma binop_comm (x y: T): binop x y == binop y x.
Proof. unfold eq. simpl. apply o_comm. Qed.
View
@@ -366,9 +366,7 @@ Proof.
apply nring_less.
apply nat_of_P_lt_Lt_compare_morphism.
red in H.
- simpl in H.
- rewrite <- ZC4 in H.
- assumption.
+ simpl in H. now rewrite ZC4.
Qed.
(** Using the above lemmata we prove the basic properties of [inj_Q], i.e.%\% it is a setoid function and preserves the ring operations and oreder operation. *)
Oops, something went wrong.

0 comments on commit c52cab6

Please sign in to comment.