Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions scripts/gen_all_batches.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
import sys, subprocess, pickle, io, os
from pathlib import Path

PLAN = [(6,6),(8,9),(10,11),(12,13),(14,15),(16,18),(18,20),(20,22),(22,24),(24,26),
(26,27),(28,29),(30,31),(32,33),(34,35),(36,37),(38,39),(40,41),(42,43),(44,45),
(46,47),(48,49),(50,51),(52,53),(54,55),(56,58),(58,60),(60,63),(64,69),(70,79),(80,100)]
REPO = r"c:/Users/teort/Github/sendov/Sendov/FiniteRange"
import mk_batch
SCRIPTS = Path(__file__).resolve().parent
REPO = SCRIPTS.parents[0] / "Sendov" / "FiniteRange"
sys.path.insert(0, str(Path(__file__).resolve().parent))
import gen_batch
ok, fail = [], []
for (n0, n1) in PLAN:
try:
r = mk_batch.build(n0, n1)
pickle.dump(r, open(f"batch_{n0}_{n1}.pkl", "wb"))
subprocess.run([sys.executable, "emit_batch.py", f"batch_{n0}_{n1}.pkl"], check=True)
r = gen_batch.build(n0, n1)
pkl = SCRIPTS / f"batch_{n0}_{n1}.pkl"
pickle.dump(r, open(pkl, "wb"))
subprocess.run([sys.executable, str(SCRIPTS / "emit_batch.py"), str(pkl)], cwd=str(SCRIPTS), check=True)
src = f"Degree{n0}_{n1}.lean"
io.open(os.path.join(REPO, src), "w", encoding="utf-8", newline="\n").write(
io.open(src, encoding="utf-8").read())
Expand Down
3 changes: 2 additions & 1 deletion scripts/gen_cover.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import io
from pathlib import Path
PLAN = [(6,6),(8,9),(10,11),(12,13),(14,15),(16,18),(18,20),(20,22),(22,24),(24,26),
(26,27),(28,29),(30,31),(32,33),(34,35),(36,37),(38,39),(40,41),(42,43),(44,45),
(46,47),(48,49),(50,51),(52,53),(54,55),(56,58),(58,60),(60,63),(64,69),(70,79),
Expand Down Expand Up @@ -91,6 +92,6 @@
end Sendov
'''
src = head + imports + doc + "\n".join(L) + tail
io.open(r"c:/Users/teort/Github/sendov/Sendov/FiniteRange/Cover.lean", "w",
io.open(Path(__file__).resolve().parents[1] / "Sendov" / "FiniteRange" / "Cover.lean", "w",
encoding="utf-8", newline="\n").write(src)
print(f"{len(runs)} branches covering degrees 5..100")
3 changes: 2 additions & 1 deletion scripts/gen_endgame.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import sympy as sp, io
from pathlib import Path

a = sp.symbols('a')
g = 300 + 47*a - a**2
Expand Down Expand Up @@ -238,6 +239,6 @@ def poly(cs, var="α"):

end Sendov
'''
io.open(r"c:/Users/teort/Github/sendov/Sendov/LargeDegree/Endgame.lean", "w",
io.open(Path(__file__).resolve().parents[1] / "Sendov" / "LargeDegree" / "Endgame.lean", "w",
encoding="utf-8", newline="\n").write(src)
print(f"written Endgame.lean, {len(src)} bytes")
6 changes: 3 additions & 3 deletions scripts/gen_sinh.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import sympy as sp, io
from pathlib import Path

y = sp.symbols('y', real=True)
U = y**3 - 10*y**2 + 36*y - 36
Expand Down Expand Up @@ -260,8 +261,7 @@ def poly_str(cs, var="y"):
'''
# The analytic tail carries no generated data, and contains brace characters that an
# f-string would swallow, so it is kept beside this script rather than inlined.
src = src.replace("\nend Sendov\n", "\n") + io.open(
"sinh_tail.lean.txt", encoding="utf-8").read()
io.open(r"c:/Users/teort/Github/sendov/Sendov/Common/Sinh.lean", "w",
src = src.replace("\nend Sendov\n", "\n") + io.open(Path(__file__).resolve().with_name("sinh_tail.lean.txt"), encoding="utf-8").read()
io.open(Path(__file__).resolve().parents[1] / "Sendov" / "Common" / "Sinh.lean", "w",
encoding="utf-8", newline="\n").write(src)
print(f"written Sinh.lean, {len(src)} bytes")