Skip to content

Commit e43a0ef

Browse files
committed
wip broken
1 parent af492ca commit e43a0ef

4 files changed

Lines changed: 56 additions & 39 deletions

File tree

config.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
coq = "8.10";
3-
mathcomp = "CohenCyril/maxr";
3+
mathcomp = "1.11.0";
44
}

default.nix

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{
22
nixpkgs ? (if builtins.pathExists ./nixpkgs.nix then import ./nixpkgs.nix
3-
else fetchTarball https://github.com/CohenCyril/nixpkgs/archive/mathcomp-fix-rec.tar.gz),
3+
else fetchTarball https://github.com/NixOS/nixpkgs-channels/archive/72b9660dc18ba347f7cd41a9504fc181a6d87dc3.tar.gz),
44
config ? (if builtins.pathExists ./config.nix then import ./config.nix else {}),
55
withEmacs ? false,
66
print-env ? false,
7+
do-nothing ? false,
78
package ? (if builtins.pathExists ./package.nix then import ./package.nix else "mathcomp-fast"),
89
src ? (if builtins.pathExists ./package.nix then ./. else false)
910
}:
@@ -20,6 +21,7 @@ let
2021
"8.9" = coqPackages_8_9;
2122
"8.10" = coqPackages_8_10;
2223
"8.11" = coqPackages_8_11;
24+
"8.12" = coqPackages_8_12;
2325
"default" = coqPackages_8_10;
2426
}.${(cfg-fun pkgs).coq or "default"}.overrideScope'
2527
(coqPackages: super-coqPackages:
@@ -39,17 +41,6 @@ let
3941
mathcomp-extra-config =
4042
let mec = super-coqPackages.mathcomp-extra-config; in
4143
lib.recursiveUpdate mec {
42-
initial = {
43-
# fixing mathcomp analysis to depend on real-closed
44-
mathcomp-analysis = {version, coqPackages} @ args:
45-
let mca = mec.initial.mathcomp-analysis args; in
46-
mca // (
47-
if elem version [ "master" "cauchy_etoile" "holomorphy" ]
48-
then {
49-
propagatedBuildInputs = mca.propagatedBuildInputs ++
50-
[coqPackages.mathcomp-real-closed];
51-
} else {});
52-
};
5344
for-coq-and-mc.${coqPackages.coq.coq-version}.${coqPackages.mathcomp.version} =
5445
(super-coqPackages.mathcomp-extra-config.${coqPackages.coq.coq-version}.${coqPackages.mathcomp.version} or {}) //
5546
(removeAttrs cfg [ "mathcomp" "coq" "mathcomp-fast" "mathcomp-full" ]);
@@ -88,16 +79,38 @@ let
8879
for x in $propagatedBuildInputs; do printf " "; echo $x | cut -d "-" -f "2-"; done
8980
echo "you can pass option --arg config '{coq = \"x.y\"; math-comp = \"x.y.z\";}' to nix-shell to change coq and/or math-comp versions"
9081
}
82+
9183
printEnv () {
9284
for x in $buildInputs; do echo $x; done
9385
for x in $propagatedBuildInputs; do echo $x; done
9486
}
87+
9588
cachixEnv () {
9689
echo "Pushing environement to cachix"
9790
printEnv | cachix push math-comp
9891
}
92+
9993
nixDefault () {
10094
cat $mathcompnix/default.nix
95+
} > default.nix
96+
97+
updateNixPkgs (){
98+
HASH=$(git ls-remote https://github.com/NixOS/nixpkgs-channels refs/heads/nixpkgs-unstable | cut -f1);
99+
URL=https://github.com/NixOS/nixpkgs-channels/archive/$HASH.tar.gz
100+
SHA256=$(nix-prefetch-url --unpack $URL)
101+
echo "fetchTarball {
102+
url = $URL;
103+
sha256 = \"$SHA256\";
104+
}" > nixpkgs.nix
105+
}
106+
updateNixPkgsMaster (){
107+
HASH=$(git ls-remote https://github.com/NixOS/nixpkgs refs/heads/master | cut -f1);
108+
URL=https://github.com/NixOS/nixpkgs/archive/$HASH.tar.gz
109+
SHA256=$(nix-prefetch-url --unpack $URL)
110+
echo "fetchTarball {
111+
url = $URL;
112+
sha256 = \"$SHA256\";
113+
}" > nixpkgs.nix
101114
}
102115
''
103116
+ pkgs.lib.optionalString print-env "nixEnv";
@@ -111,5 +124,12 @@ let
111124
in
112125
if pkgs.lib.trivial.inNixShell then pkg.overrideAttrs (old: {
113126
inherit shellHook mathcompnix;
114-
buildInputs = (old.buildInputs or []) ++ pkgs.lib.optional withEmacs emacs;
127+
128+
buildInputs = if do-nothing then []
129+
else (old.buildInputs ++
130+
(if pkgs.lib.trivial.inNixShell then pkgs.lib.optional withEmacs pkgs.emacs
131+
else []));
132+
133+
propagatedBuildInputs = if do-nothing then [] else old.propagatedBuildInputs;
134+
115135
}) else pkg

theories/polyrcf.v

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ Section CauchyBound.
171171
Definition cauchy_bound (p : {poly R}) :=
172172
1 + `|lead_coef p|^-1 * \sum_(i < size p) `|p`_i|.
173173

174-
(* Could be a sharp bound *)
175174
Lemma cauchy_boundP (p : {poly R}) x :
176175
p != 0 -> p.[x] = 0 -> `| x | < cauchy_bound p.
177176
Proof.
@@ -746,11 +745,11 @@ rewrite mem_pmap; apply/mapP/idP => [[i i_in /some_eq_iroot[]//]|rpx].
746745
have xcpoo : x \in cpi.
747746
apply: subitvP (root_in_cauchy_bound p_neq0 _) => //=.
748747
by rewrite ler_opp2 andbb le_maxr lexx.
749-
exists (rindex rs x); first by rewrite mem_iota add0n -lock/= ltnS.
750-
have rprev_cp : edflt1 0 (rprev rs x) \in cpi.
751-
have := map_f (edflt1 0) (in_rprev rs x); rewrite /= inE => /predU1P[->//|].
748+
exists (rindex rs x); first by rewrite mem_iota add0n -lock/= ltnS rindex_size.
749+
have rprev_cp : edflt1 0 (aprev rs x) \in cpi.
750+
have := map_f (edflt1 0) (in_aprev rs x); rewrite /= inE => /predU1P[->//|].
752751
by rewrite -map_comp /= map_id => /rscpi.
753-
have rnext_cp : edflt1 0 (rnext rs x) \in cpi.
752+
have rnext_cp : edflt1 0 (anext rs x) \in cpi.
754753
have := map_f (edflt1 0) (in_rnext rs x); rewrite /= inE => /predU1P[->//|].
755754
by rewrite -map_comp /= map_id => /rscpi.
756755
apply/some_eq_iroot; split => //; apply: eq_iroot => //; last 1 first.

theories/table.v

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -211,16 +211,14 @@ Lemma all_find (s : seq T) : find predT s = 0. Proof. by elim: s. Qed.
211211
Section lrindex_def.
212212
Variable (x0 : T) (s : seq T).
213213
Hypothesis s_sorted : sorted <=%O s.
214-
(* Let leT_trans := @le_trans _ T. *)
214+
Let leT_trans := @le_trans _ T.
215215

216216
Notation lindex t := (find (>= t) s).
217217
Notation rindex t := (find (> t) s).
218218

219-
Print HintDb core.
220-
221219
Lemma eq_count_undup : s = flatten [seq nseq (count_mem x s) x | x <- undup s].
222220
Proof.
223-
rewrite (eq_sorted _ le_anti _ _ ((@perm_count_undup _ _)))//.
221+
rewrite (eq_sorted le_trans le_anti _ _ ((@perm_count_undup _ _)))//.
224222
have := subseq_sorted le_trans (undup_subseq s) s_sorted.
225223
elim: (undup) => //= x l ihl; rewrite path_sortedE// => /andP[/allP le_xl l_s].
226224
elim: (count_mem _ _)=> [|/= k ihk]; rewrite ?path_min_sorted ?ihl//.
@@ -247,7 +245,7 @@ Lemma lindex_le t j : (j < size s)%N -> (lindex t <= j)%N = (t <= nth x0 s j)%O.
247245
Proof.
248246
move=> j_lt; set i := find _ _.
249247
case: (leqP i) => [ij|/(before_find x0)//]; have i_lt := leq_ltn_trans ij j_lt.
250-
by rewrite (@le_trans _ _ (nth x0 s i)) ?sorted_le_nth ?nth_find ?has_find.
248+
rewrite (@le_trans _ _ (nth x0 s i)) ?sorted_le_nth ?nth_find ?has_find//.
251249
Qed.
252250

253251
Lemma lindex_gt t j : (j < size s)%N -> (j < lindex t)%N = (nth x0 s j < t)%O.
@@ -620,12 +618,12 @@ End sorted_mono.
620618

621619
Lemma lindex_eq i : {in [pred t | [i] < t%:x <= [i.+1]], forall t, lindex s t = i}.
622620
Proof. by move=> t; apply: eq_from_lindex; rewrite gt_sprev le_anext. Qed.
623-
Print HintDb core.
624-
Lemma lindex_eq' u : {in [pred t | sprev u < t%:x <= u%:x],
621+
622+
Lemma lindex_eql u : {in [pred t | sprev u < t%:x <= u%:x],
625623
forall t, lindex s t = lindex s u}.
626624
Proof.
627-
move=> t; rewrite inE => /andP[ut tu]; apply: eq_lindex.
628-
by rewrite le_anext.
625+
move=> t; rewrite inE => /andP[ut tu].
626+
by rewrite (@lindex_eq (lindex s u))// inE ut (le_trans tu)// le_anext.
629627
Qed.
630628

631629
Lemma rindex_eq i : {in [pred t | [i] <= t%:x < [i.+1]], forall t, rindex s t = i}.
@@ -634,24 +632,24 @@ Proof. by move=> t; apply: eq_from_rindex; rewrite ge_aprev lt_snext. Qed.
634632
Lemma ext_inF i : {in [pred t | [i] < t%:x < [i.+1]], forall t, t \in s = false}.
635633
Proof.
636634
move=> t; rewrite inE => /andP[t_gt t_lt]; have := t_lt.
637-
638-
rewrite -(@lindexE i t); last by rewrite inE t_gt ltW.
639-
by apply: contraTF => /mem_rnext->; rewrite ltxx.
640-
Qed.
635+
(* rewrite -(@lindexE i t); last by rewrite inE t_gt ltW. *)
636+
(* by apply: contraTF => /mem_rnext->; rewrite ltxx. *)
637+
Admitted.
641638

642639
Lemma lrindex_notin i :
643640
{in [pred t | [i] < t%:x < [i.+1]], forall t, t \notin s}.
644-
Proof. by move=> x /lindex_inF->. Qed.
641+
Proof. (* by move=> x /lindex_inF->. Qed. *) Admitted.
645642

646-
Lemma lindex_next t tnext : rnext t = tnext%:x -> lindex s tnext = lindex s t.
647-
Proof. by move=> sneq; apply: lindexE; rewrite inE -sneq lexx andbT. Qed.
643+
Lemma lindex_next t tnext : anext t = tnext%:x -> lindex s tnext = lindex s t.
644+
(* Proof. by move=> sneq; apply: lindexE; rewrite inE -sneq lexx andbT. Qed. *)
645+
Admitted.
648646

649647
End ext_seq.
650-
End lindex.
648+
End rindex.
651649

652650
Bind Scope ext_scope with ext.
653651
Notation edflt1 t := (edflt t t).
654652
Notation "s `[ i ]" := (nth +oo%x (ext_seq s) i) : ext_scope.
655-
Notation rprev s t := s`[lindex s t].
656-
Notation rnext s t := s`[(lindex s t).+1].
657-
Hint Resolve lrindex_size lrindexP gt_rprev ge_rprev le_rnext lt_rprev_rnext.
653+
Notation lindex s t := (find (>= t) s).
654+
Notation rindex s t := (find (> t) s).
655+
(* Hint Resolve lrindex_size lrindexP gt_rprev ge_rprev le_rnext lt_rprev_rnext. *)

0 commit comments

Comments
 (0)