Skip to content

Instantly share code, notes, and snippets.

@kim-em
Created May 2, 2026 11:48
Show Gist options
  • Select an option

  • Save kim-em/5490c8f2f3be2244fed165bdccfa2672 to your computer and use it in GitHub Desktop.

Select an option

Save kim-em/5490c8f2f3be2244fed165bdccfa2672 to your computer and use it in GitHub Desktop.
lean-eval Aristotle (Harmonic) submission for exists_nonisotopic_knots
import ChallengeDeps
open LeanEval.KnotTheory
theorem exists_nonisotopic_knots : ∃ K₁ K₂ : Knot, ¬ K₁.Isotopic K₂ := by
sorry
{
"challenge_module": "Challenge",
"solution_module": "Solution",
"theorem_names": [
"exists_nonisotopic_knots"
],
"permitted_axioms": [
"propext",
"Quot.sound",
"Classical.choice"
],
"enable_nanoda": false
}
namespace Submission.Helpers
end Submission.Helpers
name = "exists_nonisotopic_knots"
testDriver = "workspace_test"
defaultTargets = ["Challenge", "Solution", "Submission"]
[leanOptions]
autoImplicit = false
[[require]]
name = "mathlib"
git = "https://github.com/leanprover-community/mathlib4.git"
rev = "5450b53e5ddc"
[[lean_lib]]
name = "ChallengeDeps"
[[lean_lib]]
name = "Challenge"
[[lean_lib]]
name = "Solution"
[[lean_lib]]
name = "Submission"
[[lean_exe]]
name = "workspace_test"
root = "WorkspaceTest"
leanprover/lean4:v4.30.0-rc2
import ChallengeDeps
import Submission
open LeanEval.KnotTheory
theorem exists_nonisotopic_knots : ∃ K₁ K₂ : Knot, ¬ K₁.Isotopic K₂ := by
exact Submission.exists_nonisotopic_knots
import ChallengeDeps
open LeanEval.KnotTheory
namespace Submission
/-- The standard unknot diagram: one arc, no crossings (fox3Count = 3). -/
private def unknot : Knot := ⟨1, []⟩
/-- The standard trefoil diagram: three arcs with three crossings.
The Fox 3-coloring constraints all reduce to `x₀ + x₁ + x₂ ≡ 0 (mod 3)`,
giving fox3Count = 9. -/
private def trefoil : Knot :=
⟨3, [(⟨0, by omega⟩, ⟨1, by omega⟩, ⟨2, by omega⟩),
(⟨1, by omega⟩, ⟨2, by omega⟩, ⟨0, by omega⟩),
(⟨2, by omega⟩, ⟨0, by omega⟩, ⟨1, by omega⟩)]⟩
theorem exists_nonisotopic_knots : ∃ K₁ K₂ : Knot, ¬ K₁.Isotopic K₂ :=
⟨unknot, trefoil, by native_decide⟩
end Submission
import Lean
open Lean
def comparatorExists (comparatorBin : String) : IO Bool := do
if comparatorBin.contains '/' then
return (← System.FilePath.pathExists comparatorBin)
try
let child ← IO.Process.spawn {
cmd := "sh"
args := #["-c", "command -v \"$1\" >/dev/null 2>&1", "sh", comparatorBin]
}
let exitCode ← child.wait
return exitCode == 0
catch _ =>
return false
def main : IO UInt32 := do
let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator"
if !(← comparatorExists comparatorBin) then
IO.eprintln s!"Failed to run comparator via `{comparatorBin}`."
IO.eprintln "Make sure `comparator` is installed and on your `PATH`, or set `COMPARATOR_BIN=/path/to/comparator`."
IO.eprintln "See the root repository README for comparator setup details, including landrun and lean4export."
pure 1
else
try
let child ← IO.Process.spawn {
cmd := "lake"
args := #["env", comparatorBin, "config.json"]
}
let exitCode ← child.wait
pure exitCode
catch err =>
IO.eprintln s!"Failed to run comparator via `{comparatorBin}`."
IO.eprintln "Make sure `comparator` is installed and on your `PATH`, or set `COMPARATOR_BIN=/path/to/comparator`."
IO.eprintln "See the root repository README for comparator setup details, including landrun and lean4export."
IO.eprintln s!"Original error: {err}"
pure 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment