diff --git a/.gitattributes b/.gitattributes index a6344aac8c09253b3b630fb776ae94478aa0275b..7e058a5808829f87c41631170c9e5ee94fed61fe 100644 --- a/.gitattributes +++ b/.gitattributes @@ -33,3 +33,38 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text *.zip filter=lfs diff=lfs merge=lfs -text *.zst filter=lfs diff=lfs merge=lfs -text *tfevents* filter=lfs diff=lfs merge=lfs -text +results.json filter=lfs diff=lfs merge=lfs -text +test/15k_state_problem_translation.json filter=lfs diff=lfs merge=lfs -text +test/lean4_random/1k_test.json filter=lfs diff=lfs merge=lfs -text +test/lean4_random/5k_first.json filter=lfs diff=lfs merge=lfs -text +test/lean4_random/5k_second.json filter=lfs diff=lfs merge=lfs -text +test/lean4_random/5k_third.json filter=lfs diff=lfs merge=lfs -text +test/result.json filter=lfs diff=lfs merge=lfs -text +test/zero_shot/lean4_basic_test/generation/lean4_random_5k_first_1epoch/1/result.json filter=lfs diff=lfs merge=lfs -text +test/zero_shot/lean4_basic_test/generation/lean4_random_5k_first_2epoch/1/result.json filter=lfs diff=lfs merge=lfs -text +test/zero_shot/lean4_basic_test/generation/lean4_random_5k_first_3epoch/1/result.json filter=lfs diff=lfs merge=lfs -text +test/zero_shot/lean4_random_test/generation/lean4_random_5k_first_1epoch/1/result.json filter=lfs diff=lfs merge=lfs -text +test/zero_shot/lean4_random_test/generation/lean4_random_5k_first_2epoch/1/result.json filter=lfs diff=lfs merge=lfs -text +test/zero_shot/lean4_random_test/generation/lean4_random_5k_first_3epoch/1/result.json filter=lfs diff=lfs merge=lfs -text +test/zero_shot/math_train/generation/lean4_random_15k_all/2/1/0.json filter=lfs diff=lfs merge=lfs -text +test/zero_shot/math_train/generation/lean4_random_15k_all/2/1/1.json filter=lfs diff=lfs merge=lfs -text +gpt_result/lean_basic/gpt3/1.jsonl filter=lfs diff=lfs merge=lfs -text +gpt_result/lean_basic/gpt3/2.jsonl filter=lfs diff=lfs merge=lfs -text +gpt_result/lean_basic/gpt3/3.jsonl filter=lfs diff=lfs merge=lfs -text +gpt_result/lean_basic/gpt3/4.jsonl filter=lfs diff=lfs merge=lfs -text +gpt_result/lean_basic/gpt3/5.jsonl filter=lfs diff=lfs merge=lfs -text +gpt_result/lean_basic/gpt4/1.jsonl filter=lfs diff=lfs merge=lfs -text +gpt_result/lean_basic/gpt4/2.jsonl filter=lfs diff=lfs merge=lfs -text +gpt_result/lean_basic/gpt4/3.jsonl filter=lfs diff=lfs merge=lfs -text +gpt_result/lean_basic/gpt4/4.jsonl filter=lfs diff=lfs merge=lfs -text +gpt_result/lean_basic/gpt4/5.jsonl filter=lfs diff=lfs merge=lfs -text +gpt_result/lean_random/gpt3/1.jsonl filter=lfs diff=lfs merge=lfs -text +gpt_result/lean_random/gpt3/2.jsonl filter=lfs diff=lfs merge=lfs -text +gpt_result/lean_random/gpt3/3.jsonl filter=lfs diff=lfs merge=lfs -text +gpt_result/lean_random/gpt3/4.jsonl filter=lfs diff=lfs merge=lfs -text +gpt_result/lean_random/gpt3/5.jsonl filter=lfs diff=lfs merge=lfs -text +gpt_result/lean_random/gpt4/1.jsonl filter=lfs diff=lfs merge=lfs -text +gpt_result/lean_random/gpt4/2.jsonl filter=lfs diff=lfs merge=lfs -text +gpt_result/lean_random/gpt4/3.jsonl filter=lfs diff=lfs merge=lfs -text +gpt_result/lean_random/gpt4/4.jsonl filter=lfs diff=lfs merge=lfs -text +gpt_result/lean_random/gpt4/5.jsonl filter=lfs diff=lfs merge=lfs -text diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..babae05d3292a664e68576391d929fe0f54ab0d3 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,24 @@ +name: Run Tests + +on: [push, pull_request] + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: install elan + run: | + set -o pipefail + curl -sSfL https://github.com/leanprover/elan/releases/download/v3.0.0/elan-x86_64-unknown-linux-gnu.tar.gz | tar xz + ./elan-init -y --default-toolchain none + echo "$HOME/.elan/bin" >> $GITHUB_PATH + + - name: build + run: lake build + + - name: Run tests + run: ./test.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..aba526c587b740251fd151c1a70097cada733c74 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +/build +/lake-packages/* +/lakefile.olean +/.lake +/test/Mathlib/.lake +/test/*.olean +/test/*.olean.tmp diff --git a/.vscode/copyright.code-snippets b/.vscode/copyright.code-snippets new file mode 100644 index 0000000000000000000000000000000000000000..82c5f9d1a1466a7856bf1df0b6a784dd914f548f --- /dev/null +++ b/.vscode/copyright.code-snippets @@ -0,0 +1,13 @@ +{ + "Copyright header for mathlib": { + "scope": "lean4", + "prefix": "copyright", + "body": [ + "/-", + "Copyright (c) ${CURRENT_YEAR} $1. All rights reserved.", + "Released under Apache 2.0 license as described in the file LICENSE.", + "Authors: $1", + "-/" + ] + } +} diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000000000000000000000000000000000000..f65ad9ce5f36501a1d1ce344a33f58c5c94577d8 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,13 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations. + // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp + + // List of extensions which should be recommended for users of this workspace. + "recommendations": [ + "leanprover.lean4" + ], + // List of extensions recommended by VS Code that should not be recommended for users of this workspace. + "unwantedRecommendations": [ + "ms-vscode-remote.remote-containers" + ] +} diff --git a/.vscode/module-docstring.code-snippets b/.vscode/module-docstring.code-snippets new file mode 100644 index 0000000000000000000000000000000000000000..1e45c0e6cf0b172ddd1e1050e54b175190112a6a --- /dev/null +++ b/.vscode/module-docstring.code-snippets @@ -0,0 +1,35 @@ +{ + "Module docstring for mathlib": { + "scope": "lean4", + "prefix": "module docstring", + "body": [ + "/-!", + "# ${TM_FILENAME_BASE/([^_]*)(_?)/${1:/capitalize}${2:+ }/g}", + "", + "## Main definitions", + "", + "* `FooBar`", + "", + "## Main statements", + "", + "* `fooBar_unique`", + "", + "## Notation", + "", + "", + "", + "## Implementation details", + "", + "", + "", + "## References", + "", + "* [F. Bar, *Quuxes*][bibkey]", + "", + "## Tags", + "", + "Foobars, barfoos", + "-/", + "", + ]}, +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000000000000000000000000000000000000..f35800349ee1da6f4d5d7fe77e6c9fae150cf52e --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,11 @@ +{ + "editor.insertSpaces": true, + "editor.tabSize": 2, + "editor.rulers" : [100], + "files.encoding": "utf8", + "files.eol": "\n", + "files.insertFinalNewline": true, + // We don't use this: it messes up our test files! + // "files.trimFinalNewlines": true, + "files.trimTrailingWhitespace": true, +} diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..d6adc2839767059ff22bd5b36d1fdcadef67589e --- /dev/null +++ b/README.md @@ -0,0 +1,174 @@ +# A read-eval-print-loop for Lean 4 + +Run using `lake exe repl`. +Communicates via JSON on stdin and stdout. +Commands should be separated by blank lines. + +The REPL works both in "command" mode and "tactic" mode. + +## Command mode + +In command mode, you send complete commands (e.g. declarations) to the REPL. + +Commands may be of the form + +```json +{ "cmd" : "def f := 2" } +``` + +```json +{ "cmd" : "example : f = 2 := rfl", "env" : 1 } +``` + +The `env` field, if present, +must contain a number received in the `env` field of a previous response, +and causes the command to be run in the existing environment. + +If there is no `env` field, a new environment is created. + +You can only use `import` commands when you do not specify the `env` field. + +You can backtrack simply by using earlier values for `env`. + +The response includes: +* A numeric label for the `Environment` after your command, + which you can use as the starting point for subsequent commands. +* Any messages generated while processing your command. +* A list of the `sorry`s in your command, including + * their expected type, and + * a numeric label for the proof state at the `sorry`, which you can then use in tactic mode. + +Example output: + +```json +{"sorries": + [{"pos": {"line": 1, "column": 18}, + "endPos": {"line": 1, "column": 23}, + "goal": "⊢ Nat", + "proofState": 0}], + "messages": + [{"severity": "error", + "pos": {"line": 1, "column": 23}, + "endPos": {"line": 1, "column": 26}, + "data": + "type mismatch\n rfl\nhas type\n f = f : Prop\nbut is expected to have type\n f = 2 : Prop"}], + "env": 6} +``` + +showing any messages generated, and sorries with their goal states. + +## File mode + +There is a simple wrapper around command mode that allows reading in an entire file. + +If `test/file.lean` contains +```lean +def f : Nat := 37 + +def g := 2 + +theorem h : f + g = 39 := by exact rfl +``` + +then +``` +echo '{"path": "test/file.lean", "allTactics": true}' | lake exe repl +``` +results in output +```json +{"tactics": + [{"tactic": "exact rfl", + "proofState": 0, + "pos": {"line": 5, "column": 29}, + "goals": "⊢ f + g = 39", + "endPos": {"line": 5, "column": 38}}], + "env": 0} + ``` + +## Tactic mode (experimental) + +To enter tactic mode issue a command containing a `sorry`, +and then use the `proofState` index returned for each `sorry`. + +Example usage: +```json +{"cmd" : "def f (x : Unit) : Nat := by sorry"} + +{"sorries": + [{"proofState": 0, + "pos": {"line": 1, "column": 29}, + "goal": "x : Unit\n⊢ Nat", + "endPos": {"line": 1, "column": 34}}], + "messages": + [{"severity": "warning", + "pos": {"line": 1, "column": 4}, + "endPos": {"line": 1, "column": 5}, + "data": "declaration uses 'sorry'"}], + "env": 0} + +{"tactic": "apply Int.natAbs", "proofState": 0} + +{"proofState": 1, "goals": ["x : Unit\n⊢ Int"]} + +{"tactic": "exact -37", "proofState": 1} + +{"proofState": 2, "goals": []} +``` + +You can use `sorry` in tactic mode. +The result will contain additional `proofState` identifiers for the goal at each sorry. + +At present there is nothing you can do with a completed proof state: +we would like to extend this so that you can replace the original `sorry` with your tactic script, +and obtain the resulting `Environment` + +## Pickling + +The REPL supports pickling environments and proof states to disk as `.olean` files. +As long as the same imports are available, it should be possible to move such an `.olean` file +to another machine and unpickle into a new REPL session. + +The commands are + +```json +{"pickleTo": "path/to/file.olean", "env": 7} + +{"pickleTo": "path/to/file.olean", "proofState": 17} + +{"unpickleEnvFrom": "path/to/file.olean"} + +{"unpickleProofStateFrom": "path/to/file.olean"} +``` + +The unpickling commands will report the new "env" or "proofState" identifier that +you can use in subsequent commands. + +Pickling is quite efficient: +* we don't record full `Environment`s, only the changes relative to imports +* unpickling uses memory mapping +* file sizes are generally small, but see https://github.com/digama0/leangz if compression is + desirable + +## Using the REPL from another project + +Set up your project as usual using `lake new` or `lake init` +(or the interactive setup GUI available via the VSCode extension under the `∀` menu). + +In that project, add `require` statements in the `lakefile.lean` for any dependencies you need +(e.g. Mathlib). (You probably should verify that `lake build` works as expected in that project.) + +Now you can run the REPL as: +```shell +lake env ../path/to/repl/.lake/build/bin/repl < commands.in +``` +(Here `../path/to/repl/` represents the path to your checkout of this repository, +in which you've already run `lake build`.) + +The `lake env` prefix sets up the environment associated to your local project, so that the REPL +can find needed imports. + +## Future work + +* Replay tactic scripts from tactic mode back into the original `sorry`. +* Currently if you create scoped environment extensions (e.g. scoped notations) in a session + these are not correctly pickled and unpickled in later sessions. diff --git a/REPL.lean b/REPL.lean new file mode 100644 index 0000000000000000000000000000000000000000..e84fb322c79f42616e8b145d476d653dd828111b --- /dev/null +++ b/REPL.lean @@ -0,0 +1,4 @@ +import REPL.Frontend +import REPL.Lean.InfoTree +import REPL.JSON +import REPL.Main diff --git a/REPL/Frontend.lean b/REPL/Frontend.lean new file mode 100644 index 0000000000000000000000000000000000000000..a70b07ea9b04b9ef78b8aca2b94a97261ea30e6f --- /dev/null +++ b/REPL/Frontend.lean @@ -0,0 +1,47 @@ +/- +Copyright (c) 2023 Scott Morrison. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Scott Morrison +-/ +import Lean.Elab.Frontend + +open Lean Elab + +namespace Lean.Elab.IO + +/-- +Wrapper for `IO.processCommands` that enables info states, and returns +* the new command state +* messages +* info trees +-/ +def processCommandsWithInfoTrees + (inputCtx : Parser.InputContext) (parserState : Parser.ModuleParserState) + (commandState : Command.State) : IO (Command.State × List Message × List InfoTree) := do + let commandState := { commandState with infoState.enabled := true } + let s ← IO.processCommands inputCtx parserState commandState <&> Frontend.State.commandState + pure (s, s.messages.msgs.toList, s.infoState.trees.toList) + +/-- +Process some text input, with or without an existing command state. +If there is no existing environment, we parse the input for headers (e.g. import statements), +and create a new environment. +Otherwise, we add to the existing environment. + +Returns the resulting command state, along with a list of messages and info trees. +-/ +def processInput (input : String) (cmdState? : Option Command.State) + (opts : Options := {}) (fileName : Option String := none) : + IO (Command.State × List Message × List InfoTree) := unsafe do + Lean.initSearchPath (← Lean.findSysroot) + enableInitializersExecution + let fileName := fileName.getD "" + let inputCtx := Parser.mkInputContext input fileName + let (parserState, commandState) ← match cmdState? with + | none => do + let (header, parserState, messages) ← Parser.parseHeader inputCtx + let (env, messages) ← processHeader header opts messages inputCtx + pure (parserState, (Command.mkState env messages opts)) + | some cmdState => do + pure ({ : Parser.ModuleParserState }, cmdState) + processCommandsWithInfoTrees inputCtx parserState commandState diff --git a/REPL/JSON.lean b/REPL/JSON.lean new file mode 100644 index 0000000000000000000000000000000000000000..10cd88066b055493f6dcbdb347abf53c0bbedf5c --- /dev/null +++ b/REPL/JSON.lean @@ -0,0 +1,186 @@ +/- +Copyright (c) 2023 Scott Morrison. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Scott Morrison +-/ +import Lean.Data.Json +import Lean.Message +import Lean.Elab.InfoTree.Main + +open Lean Elab InfoTree + +namespace REPL + +structure CommandOptions where + allTactics : Option Bool := none + /-- + Should be "full", "tactics", "original", or "substantive". + Anything else is ignored. + -/ + infotree : Option String + +/-- Run Lean commands. +If `env = none`, starts a new session (in which you can use `import`). +If `env = some n`, builds on the existing environment `n`. +-/ +structure Command extends CommandOptions where + env : Option Nat + cmd : String +deriving ToJson, FromJson + +/-- Process a Lean file in a fresh environment. -/ +structure File extends CommandOptions where + path : System.FilePath +deriving FromJson + +/-- +Run a tactic in a proof state. +-/ +structure ProofStep where + proofState : Nat + tactic : String +deriving ToJson, FromJson + +/-- Line and column information for error messages and sorries. -/ +structure Pos where + line : Nat + column : Nat +deriving ToJson, FromJson + +/-- Severity of a message. -/ +inductive Severity + | trace | info | warning | error +deriving ToJson, FromJson + +/-- A Lean message. -/ +structure Message where + pos : Pos + endPos : Option Pos + severity : Severity + data : String +deriving ToJson, FromJson + +/-- Construct the JSON representation of a Lean message. -/ +def Message.of (m : Lean.Message) : IO Message := do pure <| + { pos := ⟨m.pos.line, m.pos.column⟩, + endPos := m.endPos.map fun p => ⟨p.line, p.column⟩, + severity := match m.severity with + | .information => .info + | .warning => .warning + | .error => .error, + data := (← m.data.toString).trim } + +/-- A Lean `sorry`. -/ +structure Sorry where + pos : Pos + endPos : Pos + goal : String + /-- + The index of the proof state at the sorry. + You can use the `ProofStep` instruction to run a tactic at this state. + -/ + proofState : Option Nat +deriving FromJson + +instance : ToJson Sorry where + toJson r := Json.mkObj <| .join [ + [("goal", r.goal)], + [("proofState", toJson r.proofState)], + if r.pos.line ≠ 0 then [("pos", toJson r.pos)] else [], + if r.endPos.line ≠ 0 then [("endPos", toJson r.endPos)] else [], + ] + +/-- Construct the JSON representation of a Lean sorry. -/ +def Sorry.of (goal : String) (pos endPos : Lean.Position) (proofState : Option Nat) : Sorry := + { pos := ⟨pos.line, pos.column⟩, + endPos := ⟨endPos.line, endPos.column⟩, + goal, + proofState } + +structure Tactic where + pos : Pos + endPos : Pos + goals : String + tactic : String + proofState : Option Nat +deriving ToJson, FromJson + +/-- Construct the JSON representation of a Lean tactic. -/ +def Tactic.of (goals tactic : String) (pos endPos : Lean.Position) (proofState : Option Nat) : Tactic := + { pos := ⟨pos.line, pos.column⟩, + endPos := ⟨endPos.line, endPos.column⟩, + goals, + tactic, + proofState } + +/-- +A response to a Lean command. +`env` can be used in later calls, to build on the stored environment. +-/ +structure CommandResponse where + env : Nat + messages : List Message := [] + sorries : List Sorry := [] + tactics : List Tactic := [] + infotree : Option Json := none +deriving FromJson + +def Json.nonemptyList [ToJson α] (k : String) : List α → List (String × Json) + | [] => [] + | l => [⟨k, toJson l⟩] + +instance : ToJson CommandResponse where + toJson r := Json.mkObj <| .join [ + [("env", r.env)], + Json.nonemptyList "messages" r.messages, + Json.nonemptyList "sorries" r.sorries, + Json.nonemptyList "tactics" r.tactics, + match r.infotree with | some j => [("infotree", j)] | none => [] + ] + +/-- +A response to a Lean tactic. +`proofState` can be used in later calls, to run further tactics. +-/ +structure ProofStepResponse where + proofState : Nat + goals : List String + messages : List Message := [] + sorries : List Sorry := [] + traces : List String +deriving ToJson, FromJson + +instance : ToJson ProofStepResponse where + toJson r := Json.mkObj <| .join [ + [("proofState", r.proofState)], + [("goals", toJson r.goals)], + Json.nonemptyList "messages" r.messages, + Json.nonemptyList "sorries" r.sorries, + Json.nonemptyList "traces" r.traces + ] + +/-- Json wrapper for an error. -/ +structure Error where + message : String +deriving ToJson, FromJson + +structure PickleEnvironment where + env : Nat + pickleTo : System.FilePath +deriving ToJson, FromJson + +structure UnpickleEnvironment where + unpickleEnvFrom : System.FilePath +deriving ToJson, FromJson + +structure PickleProofState where + proofState : Nat + pickleTo : System.FilePath +deriving ToJson, FromJson + +structure UnpickleProofState where + unpickleProofStateFrom : System.FilePath + env : Option Nat +deriving ToJson, FromJson + +end REPL diff --git a/REPL/Lean/ContextInfo.lean b/REPL/Lean/ContextInfo.lean new file mode 100644 index 0000000000000000000000000000000000000000..9170c16b8a394a0bd1e08aa83a25c316779dbd9a --- /dev/null +++ b/REPL/Lean/ContextInfo.lean @@ -0,0 +1,9 @@ +import Lean + +namespace Lean.Elab.ContextInfo + +/-- Pretty print an expression in the given `ContextInfo` with the given `LocalContext`. -/ +def ppExpr (ctx : ContextInfo) (lctx : LocalContext) (e : Expr) : IO Format := + ctx.runMetaM lctx (do Meta.ppExpr (← instantiateMVars e)) + +end Lean.Elab.ContextInfo diff --git a/REPL/Lean/Environment.lean b/REPL/Lean/Environment.lean new file mode 100644 index 0000000000000000000000000000000000000000..61d4e76f24414f6ef55e26adb4c3135854ffe022 --- /dev/null +++ b/REPL/Lean/Environment.lean @@ -0,0 +1,31 @@ +import REPL.Util.Pickle +import Lean.Replay + +open System (FilePath) + +namespace Lean.Environment + +/-- +Pickle an `Environment` to disk. + +We only store: +* the list of imports +* the new constants from `Environment.constants` +and when unpickling, we build a fresh `Environment` from the imports, +and then add the new constants. +-/ +def pickle (env : Environment) (path : FilePath) : IO Unit := + _root_.pickle path (env.header.imports, env.constants.map₂) + +/-- +Unpickle an `Environment` from disk. + +We construct a fresh `Environment` with the relevant imports, +and then replace the new constants. +-/ +def unpickle (path : FilePath) : IO (Environment × CompactedRegion) := unsafe do + let ((imports, map₂), region) ← _root_.unpickle (Array Import × PHashMap Name ConstantInfo) path + let env ← importModules imports {} 0 + return (← env.replay (HashMap.ofList map₂.toList), region) + +end Lean.Environment diff --git a/REPL/Lean/InfoTree.lean b/REPL/Lean/InfoTree.lean new file mode 100644 index 0000000000000000000000000000000000000000..ac4ffb69c03f72e77681e761984ac8357ec82a51 --- /dev/null +++ b/REPL/Lean/InfoTree.lean @@ -0,0 +1,272 @@ +/- +Copyright (c) 2023 Scott Morrison. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Scott Morrison +-/ +import Lean + +/-! +Additional functions to deal with `InfoTree`. +-/ + +open Lean Elab Meta + +namespace Lean.FileMap + +/-- Extract the range of a `Syntax` expressed as lines and columns. -/ +-- Extracted from the private declaration `Lean.Elab.formatStxRange`, +-- in `Lean.Elab.InfoTree.Main`. +def stxRange (fileMap : FileMap) (stx : Syntax) : Position × Position := + let pos := stx.getPos?.getD 0 + let endPos := stx.getTailPos?.getD pos + (fileMap.toPosition pos, fileMap.toPosition endPos) + +end Lean.FileMap + +namespace Lean.Syntax + +/-- Check if a `Syntax` is an explicit invocation of the `sorry` tactic. -/ +def isSorryTactic (stx : Syntax) : Bool := + s!"{stx}" = "(Tactic.tacticSorry \"sorry\")" + +/-- Check if a `Syntax` is an explicit `sorry` term. -/ +def isSorryTerm (stx : Syntax) : Bool := + s!"{stx}" = "(Term.sorry \"sorry\")" + +end Lean.Syntax + +namespace Lean.Elab + +/-- Extract the range of a `Syntax` expressed as lines and columns. -/ +-- Extracted from the private declaration `Lean.Elab.formatStxRange`, +-- in `Lean.Elab.InfoTree.Main`. +def stxRange (fileMap : FileMap) (stx : Syntax) : Position × Position := + let pos := stx.getPos?.getD 0 + let endPos := stx.getTailPos?.getD pos + (fileMap.toPosition pos, fileMap.toPosition endPos) + +end Lean.Elab + +namespace Lean.Elab.Info + +/-- The type of a `Lean.Elab.Info`, as a string. -/ +def kind : Info → String + | .ofTacticInfo _ => "TacticInfo" + | .ofTermInfo _ => "TermInfo" + | .ofCommandInfo _ => "CommmandInfo" + | .ofMacroExpansionInfo _ => "MacroExpansionInfo" + | .ofOptionInfo _ => "OptionInfo" + | .ofFieldInfo _ => "FieldInfo" + | .ofCompletionInfo _ => "CompletionInfo" + | .ofUserWidgetInfo _ => "UserWidgetInfo" + | .ofCustomInfo _ => "CustomInfo" + | .ofFVarAliasInfo _ => "FVarAliasInfo" + | .ofFieldRedeclInfo _ => "FieldRedeclInfo" + | .ofOmissionInfo _ => "OmissionInfo" + +/-- The `Syntax` for a `Lean.Elab.Info`, if there is one. -/ +def stx? : Info → Option Syntax + | .ofTacticInfo info => info.stx + | .ofTermInfo info => info.stx + | .ofCommandInfo info => info.stx + | .ofMacroExpansionInfo info => info.stx + | .ofOptionInfo info => info.stx + | .ofFieldInfo info => info.stx + | .ofCompletionInfo info => info.stx + | .ofUserWidgetInfo info => info.stx + | .ofCustomInfo info => info.stx + | .ofFVarAliasInfo _ => none + | .ofFieldRedeclInfo info => info.stx + | .ofOmissionInfo info => info.stx + +/-- Is the `Syntax` for this `Lean.Elab.Info` original, or synthetic? -/ +def isOriginal (i : Info) : Bool := + match i.stx? with + | none => true -- Somewhat unclear what to do with `FVarAliasInfo`, so be conservative. + | some stx => match stx.getHeadInfo with + | .original .. => true + | _ => false + +end Lean.Elab.Info +namespace Lean.Elab.TacticInfo + +/-- Find the name for the outermost `Syntax` in this `TacticInfo`. -/ +def name? (t : TacticInfo) : Option Name := + match t.stx with + | Syntax.node _ n _ => some n + | _ => none + +/-- Decide whether a tactic is "substantive", +or is merely a tactic combinator (e.g. `by`, `;`, multiline tactics, parenthesized tactics). -/ +def isSubstantive (t : TacticInfo) : Bool := + match t.name? with + | none => false + | some `null => false + | some ``cdot => false + | some ``cdotTk => false + | some ``Lean.Parser.Term.byTactic => false + | some ``Lean.Parser.Tactic.tacticSeq => false + | some ``Lean.Parser.Tactic.tacticSeq1Indented => false + | some ``Lean.Parser.Tactic.«tactic_<;>_» => false + | some ``Lean.Parser.Tactic.paren => false + | _ => true + +end Lean.Elab.TacticInfo + +namespace Lean.Elab.InfoTree + +/-- +Keep `.node` nodes and `.hole` nodes satisfying predicates. + +Returns a `List InfoTree`, although in most situations this will be a singleton. +-/ +partial def filter (p : Info → Bool) (m : MVarId → Bool := fun _ => false) : + InfoTree → List InfoTree + | .context ctx tree => tree.filter p m |>.map (.context ctx) + | .node info children => + if p info then + [.node info (children.toList.map (filter p m)).join.toPArray'] + else + (children.toList.map (filter p m)).join + | .hole mvar => if m mvar then [.hole mvar] else [] + +/-- Discard all nodes besides `.context` nodes and `TacticInfo` nodes. -/ +partial def retainTacticInfo (tree : InfoTree) : List InfoTree := + tree.filter fun | .ofTacticInfo _ => true | _ => false + +/-- Retain only nodes with "original" syntax. -/ +partial def retainOriginal (tree : InfoTree) : List InfoTree := + tree.filter Info.isOriginal + +/-- Discard all TacticInfo nodes that are tactic combinators or structuring tactics. -/ +-- There is considerable grey area here: what to do with `classical`? +partial def retainSubstantive (tree : InfoTree) : List InfoTree := + tree.filter fun | .ofTacticInfo i => i.isSubstantive | _ => true + +/-- Analogue of `Lean.Elab.InfoTree.findInfo?`, but that returns all results. -/ +partial def findAllInfo (t : InfoTree) (ctx? : Option ContextInfo) (p : Info → Bool) : + List (Info × Option ContextInfo) := + match t with + | context ctx t => t.findAllInfo (ctx.mergeIntoOuter? ctx?) p + | node i ts => + let info := if p i then [(i, ctx?)] else [] + let rest := ts.toList.bind (fun t => t.findAllInfo ctx? p) + info ++ rest + | _ => [] + +/-- Return all `TacticInfo` nodes in an `InfoTree` with "original" syntax, +each equipped with its relevant `ContextInfo`. -/ +def findTacticNodes (t : InfoTree) : List (TacticInfo × ContextInfo) := + let infos := t.findAllInfo none fun i => match i with + | .ofTacticInfo i' => i.isOriginal && i'.isSubstantive + | _ => false + infos.filterMap fun p => match p with + | (.ofTacticInfo i, some ctx) => (i, ctx) + | _ => none + +/-- Return all `TacticInfo` nodes in an `InfoTree` +corresponding to explicit invocations of the `sorry` tactic, +each equipped with its relevant `ContextInfo`. -/ +def findSorryTacticNodes (t : InfoTree) : List (TacticInfo × ContextInfo) := + let infos := t.findAllInfo none fun i => match i with + | .ofTacticInfo i => i.stx.isSorryTactic && !i.goalsBefore.isEmpty + | _ => false + infos.filterMap fun p => match p with + | (.ofTacticInfo i, some ctx) => (i, ctx) + | _ => none + +/-- Return all `TermInfo` nodes in an `InfoTree` +corresponding to explicit `sorry` terms, +each equipped with its relevant `ContextInfo`. -/ +def findSorryTermNodes (t : InfoTree) : List (TermInfo × ContextInfo) := + let infos := t.findAllInfo none fun i => match i with + | .ofTermInfo i => i.stx.isSorryTerm + | _ => false + infos.filterMap fun p => match p with + | (.ofTermInfo i, some ctx) => (i, ctx) + | _ => none + +inductive SorryType +| tactic : MVarId → SorryType +| term : LocalContext → Option Expr → SorryType +deriving Inhabited + +/-- +Finds all appearances of `sorry` in an `InfoTree`, reporting +* the `ContextInfo` at that point, +* the `MVarId` for a goal that was closed by `sorry`, + or the `Option Expr` expected type for a term supplied by `sorry` +* and the start and end positions of the `sorry` in the file. +-/ +def sorries (t : InfoTree) : List (ContextInfo × SorryType × Position × Position) := + (t.findSorryTacticNodes.map fun ⟨i, ctx⟩ => + -- HACK: creating a child ngen + ({ ctx with mctx := i.mctxBefore, ngen := ctx.ngen.mkChild.1 }, .tactic i.goalsBefore.head!, + stxRange ctx.fileMap i.stx)) ++ + (t.findSorryTermNodes.map fun ⟨i, ctx⟩ => + (ctx, .term i.lctx i.expectedType?, stxRange ctx.fileMap i.stx)) + +def tactics (t : InfoTree) : List (ContextInfo × Syntax × List MVarId × Position × Position) := + (t.findTacticNodes.map fun ⟨i, ctx⟩ => + -- HACK: creating a child ngen + ({ ctx with mctx := i.mctxBefore, ngen := ctx.ngen.mkChild.1 }, i.stx, i.goalsBefore, + stxRange ctx.fileMap i.stx)) + + +end Lean.Elab.InfoTree + +namespace Lean.Elab.TacticInfo + +/-- Return the range of the tactic, as a pair of file positions. -/ +def range (info : TacticInfo) (ctx : ContextInfo) : Position × Position := ctx.fileMap.stxRange info.stx + +/-- Pretty print a tactic. -/ +def pp (info : TacticInfo) (ctx : ContextInfo) : IO Format := + ctx.runMetaM {} try + Lean.PrettyPrinter.ppTactic ⟨info.stx⟩ + catch _ => + pure "" + +open Meta + +/-- Run a tactic on the goals stored in a `TacticInfo`. -/ +def runMetaMGoalsBefore (info : TacticInfo) (ctx : ContextInfo) (x : List MVarId → MetaM α) : IO α := do + ctx.runMetaM {} <| Meta.withMCtx info.mctxBefore <| x info.goalsBefore + +/-- Run a tactic on the after goals stored in a `TacticInfo`. -/ +def runMetaMGoalsAfter (info : TacticInfo) (ctx : ContextInfo) (x : List MVarId → MetaM α) : IO α := do + ctx.runMetaM {} <| Meta.withMCtx info.mctxAfter <| x info.goalsAfter + +/-- Run a tactic on the main goal stored in a `TacticInfo`. -/ +def runMetaM (info : TacticInfo) (ctx : ContextInfo) (x : MVarId → MetaM α) : IO α := do + match info.goalsBefore.head? with + | none => throw <| IO.userError s!"No goals at {← info.pp ctx}" + | some g => info.runMetaMGoalsBefore ctx fun _ => do g.withContext <| x g + +def mainGoal (info : TacticInfo) (ctx : ContextInfo) : IO Expr := + info.runMetaM ctx (fun g => do instantiateMVars (← g.getType)) + +def formatMainGoal (info : TacticInfo) (ctx : ContextInfo) : IO Format := + info.runMetaM ctx (fun g => do ppExpr (← instantiateMVars (← g.getType))) + +def goalState (info : TacticInfo) (ctx : ContextInfo) : IO (List Format) := do + info.runMetaMGoalsBefore ctx (fun gs => gs.mapM fun g => do Meta.ppGoal g) + +def goalStateAfter (info : TacticInfo) (ctx : ContextInfo) : IO (List Format) := do + info.runMetaMGoalsAfter ctx (fun gs => gs.mapM fun g => do Meta.ppGoal g) + +def ppExpr (info : TacticInfo) (ctx : ContextInfo) (e : Expr) : IO Format := + info.runMetaM ctx (fun _ => do Meta.ppExpr (← instantiateMVars e)) + +end Lean.Elab.TacticInfo + +namespace Lean.Elab.InfoTree + +/-- +Finds all tactic invocations in an `InfoTree`, +ignoring structuring tactics (e.g. `by`, `;`, multiline tactics, parenthesized tactics). +-/ +def substantiveTactics (t : InfoTree) : List (TacticInfo × ContextInfo) := + t.findTacticNodes.filter fun i => i.1.isSubstantive + +end Lean.Elab.InfoTree diff --git a/REPL/Lean/InfoTree/ToJson.lean b/REPL/Lean/InfoTree/ToJson.lean new file mode 100644 index 0000000000000000000000000000000000000000..6e3023c2ed2d380a1e0c4eddb03a8bfda87a7f76 --- /dev/null +++ b/REPL/Lean/InfoTree/ToJson.lean @@ -0,0 +1,114 @@ +import REPL.Lean.InfoTree +import REPL.Lean.ContextInfo + +/-! +# Exporting an `InfoTree` as Json + +-/ + +namespace Lean.Elab + +structure InfoTreeNode (α : Type) where + kind : String + node : Option α + children : List Json +deriving ToJson + +deriving instance ToJson for Lean.Position + +structure Syntax.Range where + synthetic : Bool + start : Lean.Position + finish : Lean.Position +deriving ToJson + +structure Syntax.Json where + pp : Option String + -- raw : String + range : Range +deriving ToJson + +def _root_.Lean.Syntax.toRange (stx : Syntax) (ctx : ContextInfo) : Syntax.Range := + let pos := stx.getPos?.getD 0 + let endPos := stx.getTailPos?.getD pos + { start := ctx.fileMap.toPosition pos + finish := ctx.fileMap.toPosition endPos + synthetic := match stx.getHeadInfo with + | .original .. => false + | _ => true } + +def _root_.Lean.Syntax.toJson (stx : Syntax) (ctx : ContextInfo) (lctx : LocalContext) : IO Syntax.Json := do + return { + pp := match (← ctx.ppSyntax lctx stx).pretty with + | "failed to pretty print term (use 'set_option pp.rawOnError true' for raw representation)" => none + | pp => some pp + -- raw := toString stx + range := stx.toRange ctx } + +structure TacticInfo.Json where + name : Option Name + stx : Syntax.Json + goalsBefore : List String + goalsAfter : List String +deriving ToJson + +-- Note: this is not responsible for converting the children to Json. +def TacticInfo.toJson (i : TacticInfo) (ctx : ContextInfo) : IO TacticInfo.Json := do + return { + name := i.name? + stx := + { pp := Format.pretty (← i.pp ctx), + -- raw := toString i.info.stx, + range := i.stx.toRange ctx }, + goalsBefore := (← i.goalState ctx).map Format.pretty, + goalsAfter := (← i.goalStateAfter ctx).map Format.pretty } + +structure CommandInfo.Json where + elaborator : Option Name + stx : Syntax.Json +deriving ToJson + +def CommandInfo.toJson (info : CommandInfo) (ctx : ContextInfo) : IO CommandInfo.Json := do + return { + elaborator := match info.elaborator with | .anonymous => none | n => some n, + stx := ← info.stx.toJson ctx {} } + +structure TermInfo.Json where + elaborator : Option Name + stx : Syntax.Json + expectedType? : Option String + expr : String + isBinder : Bool +deriving ToJson + +def TermInfo.toJson (info : TermInfo) (ctx : ContextInfo) : IO TermInfo.Json := do + return { + elaborator := match info.elaborator with | .anonymous => none | n => some n, + stx := ← info.stx.toJson ctx info.lctx, + expectedType? := ← info.expectedType?.mapM fun ty => do + pure (← ctx.ppExpr info.lctx ty).pretty + expr := (← ctx.ppExpr info.lctx info.expr).pretty + isBinder := info.isBinder } + +structure InfoTree.HoleJson where + goalState : String +deriving ToJson + +partial def InfoTree.toJson (t : InfoTree) (ctx? : Option ContextInfo) : IO Json := do + match t with + | .context ctx t => t.toJson (ctx.mergeIntoOuter? ctx?) + | .node info children => + if let some ctx := ctx? then + let node : Option Json ← match info with + | .ofTermInfo info => some <$> (do pure <| Lean.toJson (← info.toJson ctx)) + | .ofCommandInfo info => some <$> (do pure <| Lean.toJson (← info.toJson ctx)) + | .ofTacticInfo info => some <$> (do pure <| Lean.toJson (← info.toJson ctx)) + | _ => pure none + return Lean.toJson (InfoTreeNode.mk info.kind node (← children.toList.mapM fun t' => t'.toJson ctx)) + else throw <| IO.userError "No `ContextInfo` available." + | .hole mvarId => + if let some ctx := ctx? then + return Lean.toJson (InfoTree.HoleJson.mk (← ctx.runMetaM {} (do Meta.ppGoal mvarId)).pretty) + else throw <| IO.userError "No `ContextInfo` available." + +end Lean.Elab diff --git a/REPL/Main.lean b/REPL/Main.lean new file mode 100644 index 0000000000000000000000000000000000000000..0ef81ee3282186d582ea4fc021b861b87a5fc079 --- /dev/null +++ b/REPL/Main.lean @@ -0,0 +1,323 @@ +/- +Copyright (c) 2023 Scott Morrison. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Scott Morrison +-/ +import REPL.JSON +import REPL.Frontend +import REPL.Util.Path +import REPL.Lean.ContextInfo +import REPL.Lean.Environment +import REPL.Lean.InfoTree +import REPL.Lean.InfoTree.ToJson +import REPL.Snapshots + +/-! +# A REPL for Lean. + +Communicates via JSON on stdin and stdout. Commands should be separated by blank lines. + +Commands may be of the form +``` +{ "cmd" : "import Mathlib.Data.List.Basic\ndef f := 2" } +``` +or +``` +{ "cmd" : "example : f = 2 := rfl", "env" : 3 } +``` + +The `env` field, if present, +must contain a number received in the `env` field of a previous response, +and causes the command to be run in the existing environment. + +If there is no `env` field, a new environment is created. + +You can only use `import` commands when you do not specify the `env` field. + +You can backtrack simply by using earlier values for `env`. + +The results are of the form +``` +{"sorries": + [{"pos": {"line": 1, "column": 18}, + "endPos": {"line": 1, "column": 23}, + "goal": "\n⊢ Nat"}], + "messages": + [{"severity": "error", + "pos": {"line": 1, "column": 23}, + "endPos": {"line": 1, "column": 26}, + "data": + "type mismatch\n rfl\nhas type\n f = f : Prop\nbut is expected to have type\n f = 2 : Prop"}], + "env": 6} + ``` + showing any messages generated, or sorries with their goal states. + Information is generated for tactic mode sorries, but not for term mode sorries. +-/ + +open Lean Elab + +namespace REPL + +/-- The monadic state for the Lean REPL. -/ +structure State where + /-- + Environment snapshots after complete declarations. + The user can run a declaration in a given environment using `{"cmd": "def f := 37", "env": 17}`. + -/ + cmdStates : Array CommandSnapshot := #[] + /-- + Proof states after individual tactics. + The user can run a tactic in a given proof state using `{"tactic": "exact 42", "proofState": 5}`. + Declarations with containing `sorry` record a proof state at each sorry, + and report the numerical index for the recorded state at each sorry. + -/ + proofStates : Array ProofSnapshot := #[] + +/-- +The Lean REPL monad. + +We only use this with `m := IO`, but it is set up as a monad transformer for flexibility. +-/ +abbrev M (m : Type → Type) := StateT State m + +variable [Monad m] [MonadLiftT IO m] + +/-- Record an `CommandSnapshot` into the REPL state, returning its index for future use. -/ +def recordCommandSnapshot (state : CommandSnapshot) : M m Nat := do + let id := (← get).cmdStates.size + modify fun s => { s with cmdStates := s.cmdStates.push state } + return id + +/-- Record a `ProofSnapshot` into the REPL state, returning its index for future use. -/ +def recordProofSnapshot (proofState : ProofSnapshot) : M m Nat := do + let id := (← get).proofStates.size + modify fun s => { s with proofStates := s.proofStates.push proofState } + return id + +def sorries (trees : List InfoTree) (env? : Option Environment) : M m (List Sorry) := + trees.bind InfoTree.sorries |>.mapM + fun ⟨ctx, g, pos, endPos⟩ => do + let (goal, proofState) ← match g with + | .tactic g => do + let s ← ProofSnapshot.create ctx none env? [g] + pure ("\n".intercalate <| (← s.ppGoals).map fun s => s!"{s}", some s) + | .term lctx (some t) => do + let s ← ProofSnapshot.create ctx lctx env? [] [t] + pure ("\n".intercalate <| (← s.ppGoals).map fun s => s!"{s}", some s) + | .term _ none => unreachable! + let proofStateId ← proofState.mapM recordProofSnapshot + return Sorry.of goal pos endPos proofStateId + +def ppTactic (ctx : ContextInfo) (stx : Syntax) : IO Format := + ctx.runMetaM {} try + Lean.PrettyPrinter.ppTactic ⟨stx⟩ + catch _ => + pure "" + +def tactics (trees : List InfoTree) : M m (List Tactic) := + trees.bind InfoTree.tactics |>.mapM + fun ⟨ctx, stx, goals, pos, endPos⟩ => do + let proofState := some (← ProofSnapshot.create ctx none none goals) + let goals := s!"{(← ctx.ppGoals goals)}".trim + let tactic := Format.pretty (← ppTactic ctx stx) + let proofStateId ← proofState.mapM recordProofSnapshot + return Tactic.of goals tactic pos endPos proofStateId + +/-- Record a `ProofSnapshot` and generate a JSON response for it. -/ +def createProofStepReponse (proofState : ProofSnapshot) (old? : Option ProofSnapshot := none) : + M m ProofStepResponse := do + let messages := proofState.newMessages old? + let messages ← messages.mapM fun m => Message.of m + let traces ← proofState.newTraces old? + let trees := proofState.newInfoTrees old? + let trees ← match old? with + | some old => do + let (ctx, _) ← old.runMetaM do return { ← CommandContextInfo.save with } + let ctx := PartialContextInfo.commandCtx ctx + pure <| trees.map fun t => InfoTree.context ctx t + | none => pure trees + -- For debugging purposes, sometimes we print out the trees here: + -- trees.forM fun t => do IO.println (← t.format) + let sorries ← sorries trees none + let id ← recordProofSnapshot proofState + return { + proofState := id + goals := (← proofState.ppGoals).map fun s => s!"{s}" + messages + sorries + traces } + +/-- Pickle a `CommandSnapshot`, generating a JSON response. -/ +def pickleCommandSnapshot (n : PickleEnvironment) : M m (CommandResponse ⊕ Error) := do + match (← get).cmdStates[n.env]? with + | none => return .inr ⟨"Unknown environment."⟩ + | some env => + discard <| env.pickle n.pickleTo + return .inl { env := n.env } + +/-- Unpickle a `CommandSnapshot`, generating a JSON response. -/ +def unpickleCommandSnapshot (n : UnpickleEnvironment) : M IO CommandResponse := do + let (env, _) ← CommandSnapshot.unpickle n.unpickleEnvFrom + let env ← recordCommandSnapshot env + return { env } + +/-- Pickle a `ProofSnapshot`, generating a JSON response. -/ +-- This generates a new identifier, which perhaps is not what we want? +def pickleProofSnapshot (n : PickleProofState) : M m (ProofStepResponse ⊕ Error) := do + match (← get).proofStates[n.proofState]? with + | none => return .inr ⟨"Unknown proof State."⟩ + | some proofState => + discard <| proofState.pickle n.pickleTo + return .inl (← createProofStepReponse proofState) + +/-- Unpickle a `ProofSnapshot`, generating a JSON response. -/ +def unpickleProofSnapshot (n : UnpickleProofState) : M IO (ProofStepResponse ⊕ Error) := do + let (cmdSnapshot?, notFound) ← do match n.env with + | none => pure (none, false) + | some i => do match (← get).cmdStates[i]? with + | some env => pure (some env, false) + | none => pure (none, true) + if notFound then + return .inr ⟨"Unknown environment."⟩ + let (proofState, _) ← ProofSnapshot.unpickle n.unpickleProofStateFrom cmdSnapshot? + Sum.inl <$> createProofStepReponse proofState + +/-- +Run a command, returning the id of the new environment, and any messages and sorries. +-/ +def runCommand (s : Command) : M IO (CommandResponse ⊕ Error) := do + let (cmdSnapshot?, notFound) ← do match s.env with + | none => pure (none, false) + | some i => do match (← get).cmdStates[i]? with + | some env => pure (some env, false) + | none => pure (none, true) + if notFound then + return .inr ⟨"Unknown environment."⟩ + let initialCmdState? := cmdSnapshot?.map fun c => c.cmdState + let (cmdState, messages, trees) ← try + IO.processInput s.cmd initialCmdState? + catch ex => + return .inr ⟨ex.toString⟩ + let messages ← messages.mapM fun m => Message.of m + -- For debugging purposes, sometimes we print out the trees here: + -- trees.forM fun t => do IO.println (← t.format) + let sorries ← sorries trees (initialCmdState?.map (·.env)) + let tactics ← match s.allTactics with + | some true => tactics trees + | _ => pure [] + let cmdSnapshot := + { cmdState + cmdContext := (cmdSnapshot?.map fun c => c.cmdContext).getD + { fileName := "", fileMap := default, tacticCache? := none } } + let env ← recordCommandSnapshot cmdSnapshot + let jsonTrees := match s.infotree with + | some "full" => trees + | some "tactics" => trees.bind InfoTree.retainTacticInfo + | some "original" => trees.bind InfoTree.retainTacticInfo |>.bind InfoTree.retainOriginal + | some "substantive" => trees.bind InfoTree.retainTacticInfo |>.bind InfoTree.retainSubstantive + | _ => [] + let infotree := if jsonTrees.isEmpty then + none + else + some <| Json.arr (← jsonTrees.toArray.mapM fun t => t.toJson none) + return .inl + { env, + messages, + sorries, + tactics + infotree } + +def processFile (s : File) : M IO (CommandResponse ⊕ Error) := do + try + let cmd ← IO.FS.readFile s.path + runCommand { s with env := none, cmd } + catch e => + pure <| .inr ⟨e.toString⟩ + +/-- +Run a single tactic, returning the id of the new proof statement, and the new goals. +-/ +-- TODO detect sorries? +def runProofStep (s : ProofStep) : M IO (ProofStepResponse ⊕ Error) := do + match (← get).proofStates[s.proofState]? with + | none => return .inr ⟨"Unknown proof state."⟩ + | some proofState => + try + let proofState' ← proofState.runString s.tactic + return .inl (← createProofStepReponse proofState' proofState) + catch ex => + return .inr ⟨"Lean error:\n" ++ ex.toString⟩ + +end REPL + +open REPL + +/-- Get lines from stdin until a blank line is entered. -/ +partial def getLines : IO String := do + let line ← (← IO.getStdin).getLine + if line.trim.isEmpty then + return line + else + return line ++ (← getLines) + +instance [ToJson α] [ToJson β] : ToJson (α ⊕ β) where + toJson x := match x with + | .inl a => toJson a + | .inr b => toJson b + +/-- Commands accepted by the REPL. -/ +inductive Input +| command : REPL.Command → Input +| file : REPL.File → Input +| proofStep : REPL.ProofStep → Input +| pickleEnvironment : REPL.PickleEnvironment → Input +| unpickleEnvironment : REPL.UnpickleEnvironment → Input +| pickleProofSnapshot : REPL.PickleProofState → Input +| unpickleProofSnapshot : REPL.UnpickleProofState → Input + +/-- Parse a user input string to an input command. -/ +def parse (query : String) : IO Input := do + let json := Json.parse query + match json with + | .error e => throw <| IO.userError <| toString <| toJson <| + (⟨"Could not parse JSON:\n" ++ e⟩ : Error) + | .ok j => match fromJson? j with + | .ok (r : REPL.ProofStep) => return .proofStep r + | .error _ => match fromJson? j with + | .ok (r : REPL.PickleEnvironment) => return .pickleEnvironment r + | .error _ => match fromJson? j with + | .ok (r : REPL.UnpickleEnvironment) => return .unpickleEnvironment r + | .error _ => match fromJson? j with + | .ok (r : REPL.PickleProofState) => return .pickleProofSnapshot r + | .error _ => match fromJson? j with + | .ok (r : REPL.UnpickleProofState) => return .unpickleProofSnapshot r + | .error _ => match fromJson? j with + | .ok (r : REPL.Command) => return .command r + | .error _ => match fromJson? j with + | .ok (r : REPL.File) => return .file r + | .error e => throw <| IO.userError <| toString <| toJson <| + (⟨"Could not parse as a valid JSON command:\n" ++ e⟩ : Error) + +/-- Read-eval-print loop for Lean. -/ +unsafe def repl : IO Unit := + StateT.run' loop {} +where loop : M IO Unit := do + let query ← getLines + if query = "" then + return () + if query.startsWith "#" || query.startsWith "--" then loop else + IO.println <| toString <| ← match ← parse query with + | .command r => return toJson (← runCommand r) + | .file r => return toJson (← processFile r) + | .proofStep r => return toJson (← runProofStep r) + | .pickleEnvironment r => return toJson (← pickleCommandSnapshot r) + | .unpickleEnvironment r => return toJson (← unpickleCommandSnapshot r) + | .pickleProofSnapshot r => return toJson (← pickleProofSnapshot r) + | .unpickleProofSnapshot r => return toJson (← unpickleProofSnapshot r) + IO.println "" -- easier to parse the output if there are blank lines + loop + +/-- Main executable function, run as `lake exe repl`. -/ +unsafe def main (_ : List String) : IO Unit := do + initSearchPath (← Lean.findSysroot) + repl diff --git a/REPL/Snapshots.lean b/REPL/Snapshots.lean new file mode 100644 index 0000000000000000000000000000000000000000..206b22afe9517c3836cef5f9a970f2b373ff6b2e --- /dev/null +++ b/REPL/Snapshots.lean @@ -0,0 +1,306 @@ +/- +Copyright (c) 2023 Lean FRO, LLC. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Scott Morrison +-/ +import Lean.Replay +import Lean.Elab.Command +import REPL.Util.Pickle + +open Lean Elab + +namespace Lean.Elab.Command + +@[inline] def CommandElabM.run (x : CommandElabM α) (ctx : Context) (s : State) : EIO Exception (α × State) := + (x ctx).run s + +@[inline] def CommandElabM.run' (x : CommandElabM α) (ctx : Context) (s : State) : EIO Exception α := + Prod.fst <$> x.run ctx s + +@[inline] def CommandElabM.toIO (x : CommandElabM α) (ctx : Context) (s : State) : IO (α × State) := do + match (← (x.run ctx s).toIO') with + | Except.error (Exception.error _ msg) => throw <| IO.userError (← msg.toString) + | Except.error (Exception.internal id _) => throw <| IO.userError <| "internal exception #" ++ toString id.idx + | Except.ok a => return a + +end Lean.Elab.Command + +namespace REPL + +/-- +Bundled structure for the `State` and `Context` objects +for the `CommandElabM` monad. +-/ +structure CommandSnapshot where + cmdState : Command.State + cmdContext : Command.Context + +namespace CommandSnapshot + +open Lean.Elab.Command + +/-- A copy of `Command.State` with the `Environment`, caches, and logging omitted. -/ +structure CompactableCommandSnapshot where + -- env : Environment + scopes : List Scope := [{ header := "" }] + nextMacroScope : Nat := firstFrontendMacroScope + 1 + maxRecDepth : Nat + nextInstIdx : Nat := 1 -- for generating anonymous instance names + ngen : NameGenerator := {} + -- infoState : InfoState := {} + -- traceState : TraceState := {} + -- messages : MessageLog := {} + +open System (FilePath) + +/-- +Run a `CommandElabM` monadic function in the current `ProofSnapshot`, +updating the `Command.State`. +-/ +def runCommandElabM (p : CommandSnapshot) (t : CommandElabM α) : IO (α × CommandSnapshot) := do + let (a, cmdState) ← (CommandElabM.toIO · p.cmdContext p.cmdState) do t + return (a, { p with cmdState }) + + +/-- +Pickle a `CommandSnapshot`, discarding closures and non-essential caches. + +When pickling the `Environment`, we do so relative to its imports. +-/ +def pickle (p : CommandSnapshot) (path : FilePath) : IO Unit := do + let env := p.cmdState.env + let p' := { p with cmdState := { p.cmdState with env := ← mkEmptyEnvironment }} + _root_.pickle path + (env.header.imports, + env.constants.map₂, + ({ p'.cmdState with } : CompactableCommandSnapshot), + p'.cmdContext) + +/-- +Unpickle a `CommandSnapshot`. +-/ +def unpickle (path : FilePath) : IO (CommandSnapshot × CompactedRegion) := unsafe do + let ((imports, map₂, cmdState, cmdContext), region) ← + _root_.unpickle (Array Import × PHashMap Name ConstantInfo × CompactableCommandSnapshot × + Command.Context) path + let env ← (← importModules imports {} 0).replay (HashMap.ofList map₂.toList) + let p' : CommandSnapshot := + { cmdState := { cmdState with env } + cmdContext } + let (_, p'') ← p'.runCommandElabM do + for o in ← getOpenDecls do + if let .simple ns _ := o then do + activateScoped ns + return (p'', region) + +end CommandSnapshot + +/-- +Bundled structure for the `State` and `Context` objects +for the `CoreM`, `MetaM`, `TermElabM`, and `TacticM` monads. +-/ +structure ProofSnapshot where + coreState : Core.State + coreContext : Core.Context + metaState : Meta.State + metaContext : Meta.Context + termState : Term.State + termContext : Term.Context + tacticState : Tactic.State + tacticContext : Tactic.Context + +namespace ProofSnapshot + +open Lean Elab Tactic + +/-- New messages in a `ProofSnapshot`, relative to an optional previous `ProofSnapshot`. -/ +def newMessages (new : ProofSnapshot) (old? : Option ProofSnapshot := none) : List Lean.Message := + match old? with + | none => new.coreState.messages.msgs.toList + | some old => new.coreState.messages.msgs.toList.drop (old.coreState.messages.msgs.size) + +/-- New info trees in a `ProofSnapshot`, relative to an optional previous `ProofSnapshot`. -/ +def newInfoTrees (new : ProofSnapshot) (old? : Option ProofSnapshot := none) : List InfoTree := + let infoState := new.coreState.infoState + let trees := match old? with + | none => infoState.trees.toList + | some old => infoState.trees.toList.drop (old.coreState.infoState.trees.size) + trees.map fun t => t.substitute infoState.assignment + +/-- Run a `CoreM` monadic function in the current `ProofSnapshot`, updating the `Core.State`. -/ +def runCoreM (p : ProofSnapshot) (t : CoreM α) : IO (α × ProofSnapshot) := do + let (a, coreState) ← (Lean.Core.CoreM.toIO · p.coreContext p.coreState) do t + return (a, { p with coreState }) + +/-- Run a `MetaM` monadic function in the current `ProofSnapshot`, updating the `Meta.State`. -/ +def runMetaM (p : ProofSnapshot) (t : MetaM α) : IO (α × ProofSnapshot) := do + let ((a, metaState), p') ← + p.runCoreM (Lean.Meta.MetaM.run (ctx := p.metaContext) (s := p.metaState) do t) + return (a, { p' with metaState }) + +/-- Run a `TermElabM` monadic function in the current `ProofSnapshot`, updating the `Term.State`. -/ +def runTermElabM (p : ProofSnapshot) (t : TermElabM α) : IO (α × ProofSnapshot) := do + let ((a, termState), p') ← p.runMetaM (Lean.Elab.Term.TermElabM.run (s := p.termState) + (do let r ← t; Term.synthesizeSyntheticMVarsNoPostponing; pure r)) + return (a, { p' with termState }) + +/-- Run a `TacticM` monadic function in the current `ProofSnapshot`, updating the `Tactic.State`. -/ +def runTacticM (p : ProofSnapshot) (t : TacticM α) : IO (α × ProofSnapshot) := do + let ((a, tacticState), p') ← p.runTermElabM (t p.tacticContext |>.run p.tacticState) + return (a, { p' with tacticState }) + +/-- +Run a `TacticM` monadic function in the current `ProofSnapshot`, updating the `Tactic.State`, +and discarding the return value. +-/ +def runTacticM' (p : ProofSnapshot) (t : TacticM α) : IO ProofSnapshot := + Prod.snd <$> p.runTacticM t + +/-- New traces in a `ProofSnapshot`, relative to an optional previous `ProofSnapshot`. -/ +def newTraces (new : ProofSnapshot) (old? : Option ProofSnapshot := none) : IO (List String) := + match old? with + | none => (·.1) <$> new.runCoreM (do + (← getTraces).toList.mapM fun t => do pure (← t.msg.toString).trim) + | some old => do + let oldCount ← (·.1) <$> old.runCoreM (return (← getTraces).size) + (·.1) <$> new.runCoreM (do + ((← getTraces).toList.drop oldCount).mapM fun t => do pure (← t.msg.toString).trim) + +/-- +Evaluate a `Syntax` into a `TacticM` tactic, and run it in the current `ProofSnapshot`. +-/ +def runSyntax (p : ProofSnapshot) (t : Syntax) : IO ProofSnapshot := + Prod.snd <$> p.runTacticM (evalTactic t) + +/-- +Parse a string into a `Syntax`, evaluate it as a `TacticM` tactic, +and run it in the current `ProofSnapshot`. +-/ +def runString (p : ProofSnapshot) (t : String) : IO ProofSnapshot := + match Parser.runParserCategory p.coreState.env `tactic t with + | .error e => throw (IO.userError e) + | .ok stx => p.runSyntax stx + +/-- Pretty print the current goals in the `ProofSnapshot`. -/ +def ppGoals (p : ProofSnapshot) : IO (List Format) := + Prod.fst <$> p.runMetaM do p.tacticState.goals.mapM (Meta.ppGoal ·) +/-- +Construct a `ProofSnapshot` from a `ContextInfo` and optional `LocalContext`, and a list of goals. + +For convenience, we also allow a list of `Expr`s, and these are appended to the goals +as fresh metavariables with the given types. +-/ +def create (ctx : ContextInfo) (lctx? : Option LocalContext) (env? : Option Environment) + (goals : List MVarId) (types : List Expr := []) : IO ProofSnapshot := do + ctx.runMetaM (lctx?.getD {}) do + let goals := goals ++ (← types.mapM fun t => Expr.mvarId! <$> Meta.mkFreshExprMVar (some t)) + goals.head!.withContext do + let s ← getThe Core.State + let s := match env? with + | none => s + | some env => { s with env } + pure <| + { coreState := s + coreContext := ← readThe Core.Context + metaState := ← getThe Meta.State + metaContext := ← readThe Meta.Context + termState := {} + termContext := {} + tacticState := { goals } + tacticContext := { elaborator := .anonymous } } + +open Lean.Core in +/-- A copy of `Core.State` with the `Environment`, caches, and logging omitted. -/ +structure CompactableCoreState where + -- env : Environment + nextMacroScope : MacroScope := firstFrontendMacroScope + 1 + ngen : NameGenerator := {} + -- traceState : TraceState := {} + -- cache : Core.Cache := {} + -- messages : MessageLog := {} + -- infoState : Elab.InfoState := {} + +open Lean.Meta in +/-- A copy of `Meta.Context` with closures omitted. -/ +structure CompactableMetaContext where + config : Config := {} + lctx : LocalContext := {} + localInstances : LocalInstances := #[] + defEqCtx? : Option DefEqContext := none + synthPendingDepth : Nat := 0 + -- canUnfold? : Option (Config → ConstantInfo → CoreM Bool) := none + +/-- A copy of `Term.Context` with closures and a cache omitted. -/ +structure CompactableTermContext where + declName? : Option Name := none + auxDeclToFullName : FVarIdMap Name := {} + macroStack : MacroStack := [] + mayPostpone : Bool := true + errToSorry : Bool := true + autoBoundImplicit : Bool := false + autoBoundImplicits : PArray Expr := {} + -- autoBoundImplicitForbidden : Name → Bool := fun _ => false + sectionVars : NameMap Name := {} + sectionFVars : NameMap Expr := {} + implicitLambda : Bool := true + isNoncomputableSection : Bool := false + ignoreTCFailures : Bool := false + inPattern : Bool := false + -- tacticCache? : Option (IO.Ref Tactic.Cache) := none + saveRecAppSyntax : Bool := true + holesAsSyntheticOpaque : Bool := false + +open System (FilePath) + +/-- +Pickle a `ProofSnapshot`, discarding closures and non-essential caches. + +When pickling the `Environment`, we do so relative to its imports. +-/ +def pickle (p : ProofSnapshot) (path : FilePath) : IO Unit := do + let env := p.coreState.env + let p' := { p with coreState := { p.coreState with env := ← mkEmptyEnvironment }} + _root_.pickle path + (env.header.imports, + env.constants.map₂, + ({ p'.coreState with } : CompactableCoreState), + p'.coreContext, + p'.metaState, + ({ p'.metaContext with } : CompactableMetaContext), + p'.termState, + ({ p'.termContext with } : CompactableTermContext), + p'.tacticState, + p'.tacticContext) + +/-- +Unpickle a `ProofSnapshot`. +-/ +def unpickle (path : FilePath) (cmd? : Option CommandSnapshot) : + IO (ProofSnapshot × CompactedRegion) := unsafe do + let ((imports, map₂, coreState, coreContext, metaState, metaContext, termState, termContext, + tacticState, tacticContext), region) ← + _root_.unpickle (Array Import × PHashMap Name ConstantInfo × CompactableCoreState × + Core.Context × Meta.State × CompactableMetaContext × Term.State × CompactableTermContext × + Tactic.State × Tactic.Context) path + let env ← match cmd? with + | none => + enableInitializersExecution + (← importModules imports {} 0).replay (HashMap.ofList map₂.toList) + | some cmd => + cmd.cmdState.env.replay (HashMap.ofList map₂.toList) + let p' : ProofSnapshot := + { coreState := { coreState with env } + coreContext + metaState + metaContext := { metaContext with } + termState + termContext := { termContext with } + tacticState + tacticContext } + let (_, p'') ← p'.runCoreM do + for o in ← getOpenDecls do + if let .simple ns _ := o then + activateScoped ns + return (p'', region) + +end ProofSnapshot diff --git a/REPL/Util/Path.lean b/REPL/Util/Path.lean new file mode 100644 index 0000000000000000000000000000000000000000..8454b9a7c66893f58c47483d86a3b636f0cbb7d2 --- /dev/null +++ b/REPL/Util/Path.lean @@ -0,0 +1,36 @@ +/- +Copyright (c) 2022 Gabriel Ebner. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Gabriel Ebner +-/ +import Lean + +-- This has been duplicated from Std4 to avoid a dependency. + +/-! +# `compile_time_search_path%` term elaborator. + +Use this as `searchPathRef.set compile_time_search_path%`. +-/ + +open Lean System + +-- Ideally this instance would be constructed simply by `deriving instance ToExpr for FilePath` +-- but for now we have decided not to upstream the `ToExpr` derive handler from `Mathlib`. +-- https://leanprover.zulipchat.com/#narrow/stream/348111-std4/topic/ToExpr.20derive.20handler/near/386476438 +instance : ToExpr FilePath where + toTypeExpr := mkConst ``FilePath + toExpr path := mkApp (mkConst ``FilePath.mk) (toExpr path.1) + +/-- +Term elaborator that retrieves the current `SearchPath`. + +Typical usage is `searchPathRef.set compile_time_search_path%`. + +This must not be used in files that are potentially compiled on another machine and then +imported. +(That is, if used in an imported file it will embed the search path from whichever machine +compiled the `.olean`.) +-/ +elab "compile_time_search_path%" : term => + return toExpr (← searchPathRef.get) diff --git a/REPL/Util/Pickle.lean b/REPL/Util/Pickle.lean new file mode 100644 index 0000000000000000000000000000000000000000..e3a4c9e71f0fd0443c57bee9d29a14d79e6c908a --- /dev/null +++ b/REPL/Util/Pickle.lean @@ -0,0 +1,44 @@ +/- +Copyright (c) 2023 Mario Carneiro. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Mario Carneiro +-/ +import Lean.Environment + +/-! +# Pickling and unpickling objects + +By abusing `saveModuleData` and `readModuleData` we can pickle and unpickle objects to disk. +-/ + +open Lean System + +/-- +Save an object to disk. +If you need to write multiple objects from within a single declaration, +you will need to provide a unique `key` for each. +-/ +def pickle {α : Type} (path : FilePath) (x : α) (key : Name := by exact decl_name%) : IO Unit := + saveModuleData path key (unsafe unsafeCast x) + +/-- +Load an object from disk. +Note: The returned `CompactedRegion` can be used to free the memory behind the value +of type `α`, using `CompactedRegion.free` (which is only safe once all references to the `α` are +released). Ignoring the `CompactedRegion` results in the data being leaked. +Use `withUnpickle` to call `CompactedRegion.free` automatically. + +This function is unsafe because the data being loaded may not actually have type `α`, and this +may cause crashes or other bad behavior. +-/ +unsafe def unpickle (α : Type) (path : FilePath) : IO (α × CompactedRegion) := do + let (x, region) ← readModuleData path + pure (unsafeCast x, region) + +/-- Load an object from disk and run some continuation on it, freeing memory afterwards. -/ +unsafe def withUnpickle [Monad m] [MonadLiftT IO m] {α β : Type} + (path : FilePath) (f : α → m β) : m β := do + let (x, region) ← unpickle α path + let r ← f x + region.free + pure r diff --git a/__pycache__/code.cpython-310.pyc b/__pycache__/code.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d8a4126b8b6c074eff2ae1b371e4a44f0f139ed8 Binary files /dev/null and b/__pycache__/code.cpython-310.pyc differ diff --git a/__pycache__/code.cpython-39.pyc b/__pycache__/code.cpython-39.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6ad2241d10d796dbe4f70e1435df38fafd39fa1f Binary files /dev/null and b/__pycache__/code.cpython-39.pyc differ diff --git a/__pycache__/openllm_pass_rate_new_test.cpython-39.pyc b/__pycache__/openllm_pass_rate_new_test.cpython-39.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2e23baae587608cb35a08241e995f49e8d9ab191 Binary files /dev/null and b/__pycache__/openllm_pass_rate_new_test.cpython-39.pyc differ diff --git a/all_code.py b/all_code.py new file mode 100644 index 0000000000000000000000000000000000000000..959e1da31b823ab34b25e8e2c8e56d41ab511ea7 --- /dev/null +++ b/all_code.py @@ -0,0 +1,159 @@ +import json + +# from mariana.repl.pass_rate_new import main + +def handle(): + + data = json.load(open('pass_rate_results/lean4_basic_test/lean4_random_15k_all.jsonl')) + # data['results'] += json.load(open('pass_rate_results/gsm8k_train/lean4_random_15k_all.jsonl'))['results'] + + + PROMPT_DICT = { + "wild": ( + "# Problem:\n{question}\n\n" + "# Proof:\n{answer}." + ), + "lean4": ( + "Statement and proof in natural language:\n\n" + "{statement_text}\n\n" + "Translate the statement and proof in natural language to lean4:" + ), + "prompt_no_input": ( + "Below is an instruction that describes a task. " + "Write a response that appropriately completes the request.\n\n" + "### Instruction:\n{instruction}\n\n### Response:" + ), + } + training_data = [] + ratio = [] + for item in data['results']: + if item['status'] == 'pass': + if not len(item['stderr']): + ratio.append(1) + # training_data.append( + # { + # "statement_poof":item['statement'], + # "model_response":PROMPT_DICT["wild"].format(question= item['content']['question'], answer = item['content']['answer']), + # "task": "statementproof_inform", + # } + # ) + else: + ratio.append(0) + print ( item['stderr']) + + + # with open("pass_rate_results/combined_lean4_random_15k_all_passed.jsonl", "w") as f: + # json.dump(training_data, f, ensure_ascii=False, indent=2) + + + print("false positives: ", 1 - sum(ratio)/len(ratio)) + + +def savetojson(): + + import_statements = '''import algebra.algebra.basic +import algebra.order.floor +import algebra.associated +import algebra.big_operators.basic +import algebra.big_operators.enat +import algebra.big_operators.order +import algebra.big_operators.pi +import algebra.geom_sum +import algebra.group.pi +import algebra.group.commute +import algebra.group_power.basic +import algebra.group_power.identities +import algebra.order.floor +import algebra.quadratic_discriminant +import algebra.ring.basic +import analysis.asymptotics.asymptotic_equivalent +import analysis.mean_inequalities +import analysis.normed_space.basic +import analysis.inner_product_space.basic +import analysis.inner_product_space.euclidean_dist +import analysis.normed_space.pi_Lp +import analysis.special_functions.exp +import analysis.special_functions.exp_deriv +import analysis.special_functions.log +import analysis.special_functions.logb +import analysis.special_functions.log_deriv +import analysis.special_functions.pow +import analysis.special_functions.sqrt +import analysis.special_functions.trigonometric.basic +import analysis.special_functions.trigonometric.complex +import combinatorics.simple_graph.basic +import data.complex.basic +import data.complex.exponential +import data.finset.basic +import data.fintype.card +import data.int.basic +import data.int.gcd +import data.int.modeq +import data.int.parity +import data.list.intervals +import data.list.palindrome +import data.multiset.basic +import data.nat.basic +import data.nat.choose.basic +import data.nat.digits +import data.nat.factorial.basic +import data.nat.fib +import data.nat.modeq +import data.nat.multiplicity +import data.nat.parity +import data.nat.prime +import data.pnat.basic +import data.pnat.prime +import data.polynomial +import data.polynomial.basic +import data.polynomial.eval +import data.rat.basic +import data.real.basic +import data.real.ennreal +import data.real.irrational +import data.real.nnreal +import data.real.sqrt +import data.real.golden_ratio +import data.set.finite +import data.sym.sym2 +import data.zmod.basic +import dynamics.fixed_points.basic +import field_theory.finite.basic +import geometry.euclidean.basic +import geometry.euclidean.circumcenter +import geometry.euclidean.monge_point +import geometry.euclidean.sphere +import init.data.nat.gcd +import linear_algebra.affine_space.affine_map +import linear_algebra.affine_space.independent +import linear_algebra.affine_space.ordered +import linear_algebra.finite_dimensional +import logic.equiv.basic +import measure_theory.integral.interval_integral +import number_theory.arithmetic_function +import number_theory.legendre_symbol.quadratic_reciprocity +import number_theory.primes_congruent_one +import order.bounds +import order.filter.basic +import order.well_founded +import topology.basic +import topology.instances.nnreal +''' + + data = { + "working_file": import_statements + } + + with open('data/notlean_dependency.json', 'w', encoding='utf-8') as f: + json.dump(data, f, indent=4) + + +def load_to_atp(): + data_path = 'pass_rate_results/math_train/1/10pass10.jsonl' + data = json.load(open(data_path, "r", encoding='utf-8')) + import pdb + pdb.set_trace() +if __name__ == '__main__': + load_to_atp() + # get_novel_premises() + # savetojson() \ No newline at end of file diff --git a/basic_working.json b/basic_working.json new file mode 100644 index 0000000000000000000000000000000000000000..51bf02d17455e487b69159b02bbc46e93086db0c --- /dev/null +++ b/basic_working.json @@ -0,0 +1,378 @@ +{ + "working_file_list": [ + "import Mathlib.MeasureTheory.Measure.GiryMonad\nimport Mathlib.Dynamics.Ergodic.MeasurePreserving\nimport Mathlib.MeasureTheory.Integral.Lebesgue\nimport Mathlib.MeasureTheory.Measure.OpenPos", + "import Mathlib.Analysis.Normed.Group.Basic\nimport Mathlib.MeasureTheory.Function.AEMeasurableSequence\nimport Mathlib.MeasureTheory.Group.Arithmetic\nimport Mathlib.MeasureTheory.Order.Lattice\nimport Mathlib.Topology.Instances.EReal\nimport Mathlib.Topology.MetricSpace.Thickening\nimport Mathlib.Topology.GDelta\nimport Mathlib.Topology.Order.Lattice\nimport Mathlib.Topology.Semicontinuous", + "import Mathlib.Analysis.SpecificLimits.Basic\nimport Mathlib.MeasureTheory.PiSystem\nimport Mathlib.Data.Countable.Basic\nimport Mathlib.Data.Fin.VecNotation", + "import Mathlib.MeasureTheory.Measure.Content\nimport Mathlib.MeasureTheory.Group.Prod\nimport Mathlib.Topology.Algebra.Group.Compact", + "import Mathlib.Dynamics.Ergodic.MeasurePreserving\nimport Mathlib.LinearAlgebra.Determinant\nimport Mathlib.LinearAlgebra.Matrix.Diagonal\nimport Mathlib.LinearAlgebra.Matrix.Transvection\nimport Mathlib.MeasureTheory.Constructions.Pi\nimport Mathlib.MeasureTheory.Measure.Stieltjes\nimport Mathlib.MeasureTheory.Measure.Haar.OfBasis", + "import Mathlib.Data.Finset.Update\nimport Mathlib.Data.Prod.TProd\nimport Mathlib.GroupTheory.Coset\nimport Mathlib.Logic.Equiv.Fin\nimport Mathlib.MeasureTheory.MeasurableSpace.Defs\nimport Mathlib.Order.Filter.SmallSets\nimport Mathlib.Order.LiminfLimsup\nimport Mathlib.Data.Set.UnionLift", + "import Mathlib.Analysis.NormedSpace.BoundedLinearMaps\nimport Mathlib.MeasureTheory.Measure.WithDensity\nimport Mathlib.MeasureTheory.Function.SimpleFuncDense\nimport Mathlib.Topology.Algebra.Module.FiniteDimension", + "import Mathlib.MeasureTheory.Function.AEEqFun.DomAct\nimport Mathlib.MeasureTheory.Function.LpSpace", + "import Mathlib.Analysis.SpecialFunctions.Pow.NNReal\nimport Mathlib.MeasureTheory.Constructions.BorelSpace.Complex", + "import Mathlib.MeasureTheory.Function.ConditionalExpectation.CondexpL1", + "import Mathlib.Analysis.NormedSpace.IndicatorFunction\nimport Mathlib.MeasureTheory.Function.EssSup\nimport Mathlib.MeasureTheory.Function.AEEqFun\nimport Mathlib.MeasureTheory.Function.SpecialFunctions.Basic", + "import Mathlib.Topology.Instances.ENNReal\nimport Mathlib.MeasureTheory.Measure.Dirac", + "import Mathlib.Probability.Notation\nimport Mathlib.Probability.Process.Stopping", + "import Mathlib.Probability.Independence.Kernel", + "import Mathlib.MeasureTheory.Integral.Bochner\nimport Mathlib.MeasureTheory.Measure.GiryMonad", + "import Mathlib.Algebra.Module.Hom\nimport Mathlib.Algebra.Module.Prod\nimport Mathlib.Algebra.Module.Submodule.Ker\nimport Mathlib.Data.Set.Finite\nimport Mathlib.Order.ConditionallyCompleteLattice.Basic", + "import Mathlib.LinearAlgebra.RootSystem.Defs", + "import Mathlib.LinearAlgebra.Matrix.Adjugate\nimport Mathlib.RingTheory.PolynomialAlgebra", + "import Mathlib.Algebra.AddTorsor", + "import Mathlib.GroupTheory.Perm.Sign\nimport Mathlib.Data.Fintype.Perm\nimport Mathlib.LinearAlgebra.Multilinear.Basis", + "import Mathlib.Data.Finsupp.Fintype\nimport Mathlib.LinearAlgebra.TensorProduct.Basis", + "import Mathlib.RingTheory.Finiteness\nimport Mathlib.LinearAlgebra.FreeModule.Basic", + "import Mathlib.Algebra.RingQuot\nimport Mathlib.LinearAlgebra.TensorAlgebra.Basic\nimport Mathlib.LinearAlgebra.QuadraticForm.Isometry\nimport Mathlib.LinearAlgebra.QuadraticForm.IsometryEquiv", + "import Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.GroupTheory.Congruence\nimport Mathlib.LinearAlgebra.Basic\nimport Mathlib.Tactic.SuppressCompilation", + "import Mathlib.LinearAlgebra.Matrix.Determinant\nimport Mathlib.LinearAlgebra.Matrix.SesquilinearForm\nimport Mathlib.LinearAlgebra.Matrix.Symmetric", + "import Mathlib.Algebra.Algebra.Basic\nimport Mathlib.Algebra.BigOperators.Order\nimport Mathlib.Data.Fintype.BigOperators\nimport Mathlib.Data.Fintype.Sort\nimport Mathlib.Data.List.FinRange\nimport Mathlib.LinearAlgebra.Pi", + "import Mathlib.LinearAlgebra.CliffordAlgebra.Basic\nimport Mathlib.LinearAlgebra.Alternating.Basic", + "import Mathlib.Algebra.Algebra.Spectrum\nimport Mathlib.LinearAlgebra.GeneralLinearGroup\nimport Mathlib.LinearAlgebra.FiniteDimensional", + "import Mathlib.Algebra.FreeAlgebra\nimport Mathlib.Algebra.RingQuot\nimport Mathlib.Algebra.TrivSqZeroExt\nimport Mathlib.Algebra.Algebra.Operations\nimport Mathlib.LinearAlgebra.Multilinear.Basic", + "import Mathlib.Algebra.Algebra.Tower", + "import Mathlib.LinearAlgebra.FiniteDimensional", + "import Mathlib.LinearAlgebra.LinearIndependent", + "import Mathlib.LinearAlgebra.FreeModule.Finite.Basic\nimport Mathlib.LinearAlgebra.Matrix.Charpoly.Coeff\nimport Mathlib.FieldTheory.Minpoly.Field", + "import Mathlib.Init.Logic\nimport Mathlib.Init.Function\nimport Mathlib.Init.Algebra.Classes\nimport Std.Util.LibraryNote\nimport Std.Tactic.Lint.Basic", + "import Mathlib.Init.Order.Defs\nimport Mathlib.Logic.Nontrivial.Defs\nimport Mathlib.Tactic.Attr.Register\nimport Mathlib.Data.Prod.Basic\nimport Mathlib.Data.Subtype\nimport Mathlib.Logic.Function.Basic\nimport Mathlib.Logic.Unique", + "import Mathlib.Data.Bool.Basic\nimport Mathlib.Data.Option.Defs\nimport Mathlib.Data.Prod.Basic\nimport Mathlib.Data.Sigma.Basic\nimport Mathlib.Data.Subtype\nimport Mathlib.Data.Sum.Basic\nimport Mathlib.Init.Data.Sigma.Basic\nimport Mathlib.Logic.Equiv.Defs\nimport Mathlib.Logic.Function.Conjugate\nimport Mathlib.Tactic.Lift\nimport Mathlib.Tactic.Convert\nimport Mathlib.Tactic.Contrapose\nimport Mathlib.Tactic.GeneralizeProofs\nimport Mathlib.Tactic.SimpRw", + "import Mathlib.Logic.Equiv.Nat\nimport Mathlib.Data.PNat.Basic\nimport Mathlib.Order.Directed\nimport Mathlib.Data.Countable.Defs\nimport Mathlib.Order.RelIso.Basic\nimport Mathlib.Data.Fin.Basic", + "import Mathlib.Logic.Small.Defs\nimport Mathlib.Logic.Equiv.Set", + "import Mathlib.Logic.Nonempty\nimport Mathlib.Init.Set\nimport Mathlib.Logic.Basic", + "import Mathlib.Data.Option.Basic\nimport Mathlib.Data.Prod.PProd\nimport Mathlib.Logic.Equiv.Basic", + "import Mathlib.Analysis.Calculus.TangentCone\nimport Mathlib.Analysis.NormedSpace.OperatorNorm.Asymptotics", + "import Mathlib.Analysis.Calculus.Deriv.Add", + "import Mathlib.Analysis.InnerProductSpace.Dual\nimport Mathlib.Analysis.Calculus.FDeriv.Basic\nimport Mathlib.Analysis.Calculus.Deriv.Basic", + "import Mathlib.Analysis.Calculus.ContDiff.Basic\nimport Mathlib.Analysis.NormedSpace.FiniteDimension", + "import Mathlib.Analysis.Calculus.Deriv.Comp\nimport Mathlib.Analysis.Calculus.Deriv.Add\nimport Mathlib.Analysis.Calculus.Deriv.Mul\nimport Mathlib.Analysis.Calculus.Deriv.Slope", + "import Mathlib.Analysis.Calculus.FDeriv.Basic\nimport Mathlib.Analysis.NormedSpace.OperatorNorm.NormedSpace", + "import Mathlib.Analysis.Calculus.ContDiff.Defs\nimport Mathlib.Analysis.Calculus.FDeriv.Add\nimport Mathlib.Analysis.Calculus.FDeriv.Mul\nimport Mathlib.Analysis.Calculus.Deriv.Inverse", + "import Mathlib.Algebra.DirectSum.Module\nimport Mathlib.Analysis.Complex.Basic\nimport Mathlib.Analysis.Convex.Uniform\nimport Mathlib.Analysis.NormedSpace.Completion\nimport Mathlib.Analysis.NormedSpace.BoundedLinearMaps", + "import Mathlib.Algebra.Algebra.NonUnitalSubalgebra\nimport Mathlib.Algebra.Algebra.Subalgebra.Basic\nimport Mathlib.Analysis.Normed.Group.Basic\nimport Mathlib.GroupTheory.OrderOfElement\nimport Mathlib.Topology.Instances.NNReal\nimport Mathlib.Topology.MetricSpace.DilationEquiv", + "import Mathlib.Algebra.Order.Group.TypeTags\nimport Mathlib.Analysis.Normed.Field.Basic", + "import Mathlib.Analysis.Normed.Group.Seminorm\nimport Mathlib.Order.LiminfLimsup\nimport Mathlib.Topology.Instances.Rat\nimport Mathlib.Topology.MetricSpace.Algebra\nimport Mathlib.Topology.MetricSpace.IsometricSMul\nimport Mathlib.Topology.Sequences", + "import Mathlib.Analysis.SpecialFunctions.Exp\nimport Mathlib.Data.Nat.Factorization.Basic\nimport Mathlib.Analysis.NormedSpace.Real", + "import Mathlib.Analysis.SpecialFunctions.Exp\nimport Mathlib.Tactic.Positivity.Core", + "import Mathlib.MeasureTheory.Integral.ExpDecay\nimport Mathlib.Analysis.SpecialFunctions.ImproperIntegrals\nimport Mathlib.Analysis.MellinTransform", + "import Mathlib.Analysis.Convex.Basic\nimport Mathlib.Analysis.Convex.Hull\nimport Mathlib.Analysis.NormedSpace.Basic\nimport Mathlib.Topology.Bornology.Absorbs", + "import Mathlib.Analysis.NormedSpace.Dual\nimport Mathlib.Analysis.NormedSpace.Star.Basic\nimport Mathlib.Analysis.Complex.Basic\nimport Mathlib.Analysis.InnerProductSpace.Adjoint\nimport Mathlib.Algebra.Star.Subalgebra", + "import Mathlib.Analysis.BoxIntegral.Partition.Filter\nimport Mathlib.Analysis.BoxIntegral.Partition.Measure\nimport Mathlib.Topology.UniformSpace.Compact\nimport Mathlib.Init.Data.Bool.Lemmas", + "import Mathlib.Algebra.BigOperators.Option\nimport Mathlib.Analysis.BoxIntegral.Box.Basic\nimport Mathlib.Data.Set.Pairwise.Lattice", + "import Mathlib.Data.Set.Intervals.Monotone\nimport Mathlib.Topology.MetricSpace.Basic\nimport Mathlib.Topology.MetricSpace.Bounded\nimport Mathlib.Topology.Order.MonotoneConvergence", + "import Mathlib.Data.Complex.Module\nimport Mathlib.Data.Complex.Order\nimport Mathlib.Data.Complex.Exponential\nimport Mathlib.Data.RCLike.Basic\nimport Mathlib.Topology.Algebra.InfiniteSum.Module\nimport Mathlib.Topology.Instances.RealVectorSpace", + "import Mathlib.Analysis.Complex.Circle\nimport Mathlib.Analysis.NormedSpace.BallAction", + "import Mathlib.Data.Fintype.Parity\nimport Mathlib.LinearAlgebra.Matrix.SpecialLinearGroup\nimport Mathlib.Analysis.Complex.Basic\nimport Mathlib.GroupTheory.GroupAction.Defs\nimport Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup\nimport Mathlib.Tactic.LinearCombination", + "import Mathlib.Algebra.GeomSum\nimport Mathlib.Order.Filter.Archimedean\nimport Mathlib.Order.Iterate\nimport Mathlib.Topology.Instances.ENNReal\nimport Mathlib.Topology.Algebra.Algebra", + "import Mathlib.Algebra.Order.Module.OrderedSMul\nimport Mathlib.Analysis.Convex.Star\nimport Mathlib.LinearAlgebra.AffineSpace.AffineSubspace", + "import Mathlib.Analysis.Convex.Hull\nimport Mathlib.LinearAlgebra.AffineSpace.Independent", + "import Mathlib.Analysis.Convex.Hull", + "import Mathlib.Analysis.Convex.Slope\nimport Mathlib.Analysis.SpecialFunctions.Pow.Real\nimport Mathlib.Tactic.LinearCombination", + "import Mathlib.Algebra.Algebra.Pi\nimport Mathlib.Algebra.Algebra.RestrictScalars\nimport Mathlib.Analysis.Normed.Field.Basic\nimport Mathlib.Analysis.Normed.MulAction", + "import Mathlib.Analysis.NormedSpace.OperatorNorm.NormedSpace\nimport Mathlib.Topology.Algebra.Module.Multilinear.Basic", + "import Mathlib.Algebra.Algebra.Tower\nimport Mathlib.Analysis.LocallyConvex.WithSeminorms\nimport Mathlib.Topology.Algebra.Module.StrongTopology\nimport Mathlib.Analysis.NormedSpace.LinearIsometry\nimport Mathlib.Analysis.NormedSpace.ContinuousLinearMap\nimport Mathlib.Tactic.SuppressCompilation", + "import Mathlib.Analysis.Normed.Group.Hom\nimport Mathlib.Analysis.NormedSpace.Basic\nimport Mathlib.Analysis.NormedSpace.LinearIsometry\nimport Mathlib.Algebra.Star.SelfAdjoint\nimport Mathlib.Algebra.Star.Subalgebra\nimport Mathlib.Algebra.Star.Unitary\nimport Mathlib.Topology.Algebra.Module.Star", + "import Mathlib.Analysis.Calculus.FormalMultilinearSeries\nimport Mathlib.Analysis.SpecificLimits.Normed\nimport Mathlib.Logic.Equiv.Fin\nimport Mathlib.Topology.Algebra.InfiniteSum.Module", + "import Mathlib.CategoryTheory.Sites.Sheaf\nimport Mathlib.Topology.Category.CompHaus.EffectiveEpi", + "import Mathlib.Data.Fin.VecNotation\nimport Mathlib.SetTheory.Cardinal.Basic", + "import Mathlib.ModelTheory.Syntax\nimport Mathlib.ModelTheory.Semantics\nimport Mathlib.ModelTheory.Algebra.Ring.Basic\nimport Mathlib.Algebra.Field.MinimalAxioms", + "import Mathlib.ModelTheory.Syntax\nimport Mathlib.ModelTheory.Semantics\nimport Mathlib.Algebra.Ring.Equiv", + "import Mathlib.Init.Control.Combinators\nimport Mathlib.Init.Function\nimport Mathlib.Tactic.CasesM\nimport Mathlib.Tactic.Attr.Core", + "import Mathlib.Logic.Equiv.Defs", + "import Mathlib.Data.Option.Defs\nimport Mathlib.Control.Functor", + "import Mathlib.Control.Bifunctor\nimport Mathlib.Control.Traversable.Basic", + "import Mathlib.Init.Order.LinearOrder\nimport Mathlib.Data.Prod.Basic\nimport Mathlib.Data.Subtype\nimport Mathlib.Tactic.Spread\nimport Mathlib.Tactic.Convert\nimport Mathlib.Tactic.SimpRw\nimport Mathlib.Tactic.Cases\nimport Mathlib.Order.Notation", + "import Mathlib.Logic.Equiv.Option\nimport Mathlib.Order.RelIso.Basic\nimport Mathlib.Order.Disjoint\nimport Mathlib.Order.WithBot\nimport Mathlib.Tactic.Monotonicity.Attr\nimport Mathlib.Util.AssertExists", + "import Mathlib.Data.SetLike.Basic\nimport Mathlib.Data.Set.Intervals.OrdConnected\nimport Mathlib.Data.Set.Intervals.OrderIso\nimport Mathlib.Data.Set.Lattice", + "import Mathlib.Order.PropInstances", + "import Mathlib.Data.Set.Finite", + "import Mathlib.Logic.Function.Iterate\nimport Mathlib.Init.Data.Int.Order\nimport Mathlib.Order.Compare\nimport Mathlib.Order.Max\nimport Mathlib.Order.RelClasses\nimport Mathlib.Tactic.Choose", + "import Mathlib.Order.CompleteLattice\nimport Mathlib.Order.Cover\nimport Mathlib.Order.Iterate", + "import Mathlib.Init.Algebra.Classes\nimport Mathlib.Data.FunLike.Basic\nimport Mathlib.Logic.Embedding.Basic\nimport Mathlib.Order.RelClasses", + "import Mathlib.Order.Atoms\nimport Mathlib.Order.OrderIsoNat\nimport Mathlib.Order.RelIso.Set\nimport Mathlib.Order.SupClosed\nimport Mathlib.Order.SupIndep\nimport Mathlib.Order.Zorn\nimport Mathlib.Data.Finset.Order\nimport Mathlib.Data.Set.Intervals.OrderIso\nimport Mathlib.Data.Finite.Set\nimport Mathlib.Tactic.TFAE", + "import Mathlib.Order.Bounds.Basic\nimport Mathlib.Order.WellFounded\nimport Mathlib.Data.Set.Image\nimport Mathlib.Data.Set.Intervals.Basic\nimport Mathlib.Data.Set.Lattice", + "import Mathlib.Data.Set.Intervals.Basic\nimport Mathlib.Data.Set.NAry\nimport Mathlib.Order.Directed", + "import Mathlib.Data.Sum.Order\nimport Mathlib.Order.InitialSeg\nimport Mathlib.SetTheory.Cardinal.Basic\nimport Mathlib.Tactic.PPWithUniv", + "import Mathlib.Data.Set.Lattice\nimport Mathlib.Logic.Small.Basic\nimport Mathlib.Logic.Function.OfArity\nimport Mathlib.Order.WellFounded", + "import Mathlib.Data.Int.Basic\nimport Mathlib.SetTheory.Game.PGame\nimport Mathlib.Tactic.Abel", + "import Mathlib.Algebra.Order.Hom.Monoid\nimport Mathlib.SetTheory.Game.Ordinal", + "import Mathlib.Algebra.Module.Basic\nimport Mathlib.Data.Fintype.BigOperators\nimport Mathlib.Data.Finsupp.Defs\nimport Mathlib.Data.Set.Countable\nimport Mathlib.Logic.Small.Set\nimport Mathlib.Order.ConditionallyCompleteLattice.Basic\nimport Mathlib.Order.SuccPred.CompleteLinearOrder\nimport Mathlib.SetTheory.Cardinal.SchroederBernstein\nimport Mathlib.Tactic.PPWithUniv", + "import Mathlib.Algebra.Group.Equiv.TypeTags\nimport Mathlib.Algebra.Module.Basic\nimport Mathlib.Algebra.Module.LinearMap.Basic\nimport Mathlib.Algebra.MonoidAlgebra.Basic\nimport Mathlib.LinearAlgebra.Dual\nimport Mathlib.LinearAlgebra.Contraction\nimport Mathlib.RingTheory.TensorProduct.Basic", + "import Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.CategoryTheory.SingleObj\nimport Mathlib.CategoryTheory.Limits.FunctorCategory\nimport Mathlib.CategoryTheory.Limits.Preserves.Basic\nimport Mathlib.CategoryTheory.Adjunction.Limits\nimport Mathlib.CategoryTheory.Conj", + "import Mathlib.Algebra.Homology.Opposite\nimport Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex\nimport Mathlib.RepresentationTheory.GroupCohomology.Resolution", + "import Mathlib.CategoryTheory.Limits.HasLimits", + "import Mathlib.CategoryTheory.Limits.Connected\nimport Mathlib.CategoryTheory.Limits.Constructions.Over.Products\nimport Mathlib.CategoryTheory.Limits.Constructions.Over.Connected\nimport Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers\nimport Mathlib.CategoryTheory.Limits.Constructions.Equalizers", + "import Mathlib.CategoryTheory.Limits.Shapes.RegularMono\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Preserves.Basic", + "import Mathlib.CategoryTheory.NatIso", + "import Mathlib.CategoryTheory.Limits.Constructions.Pullbacks\nimport Mathlib.CategoryTheory.Preadditive.Biproducts\nimport Mathlib.CategoryTheory.Limits.Shapes.Images\nimport Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers\nimport Mathlib.CategoryTheory.Abelian.NonPreadditive", + "import Mathlib.CategoryTheory.Subobject.MonoOver\nimport Mathlib.CategoryTheory.Skeletal\nimport Mathlib.CategoryTheory.ConcreteCategory.Basic\nimport Mathlib.Tactic.ApplyFun\nimport Mathlib.Tactic.CategoryTheory.Elementwise", + "import Mathlib.CategoryTheory.EqToHom\nimport Mathlib.CategoryTheory.Functor.Const\nimport Mathlib.CategoryTheory.Opposites\nimport Mathlib.Data.Prod.Basic", + "import Mathlib.CategoryTheory.CommSq", + "import Mathlib.Algebra.BigOperators.Basic\nimport Mathlib.Algebra.Group.Hom.Defs\nimport Mathlib.Algebra.Module.Basic\nimport Mathlib.CategoryTheory.Endomorphism\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels", + "import Mathlib.CategoryTheory.Preadditive.Opposite\nimport Mathlib.Algebra.Category.ModuleCat.Basic\nimport Mathlib.Algebra.Category.GroupCat.Preadditive", + "import Mathlib.CategoryTheory.Functor.Category\nimport Mathlib.CategoryTheory.Functor.FullyFaithful\nimport Mathlib.CategoryTheory.Functor.ReflectsIso", + "import Mathlib.CategoryTheory.EqToHom\nimport Mathlib.CategoryTheory.NatIso\nimport Mathlib.CategoryTheory.Products.Basic", + "import Mathlib.Algebra.Group.Basic\nimport Mathlib.CategoryTheory.Limits.Preserves.Shapes.Zero\nimport Mathlib.CategoryTheory.Monoidal.End\nimport Mathlib.CategoryTheory.Monoidal.Discrete", + "import Mathlib.CategoryTheory.Equivalence", + "import Mathlib.CategoryTheory.FinCategory.Basic\nimport Mathlib.CategoryTheory.Limits.Cones\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.Adjunction.Basic\nimport Mathlib.CategoryTheory.Category.Preorder\nimport Mathlib.CategoryTheory.Category.ULift\nimport Mathlib.CategoryTheory.PEmpty", + "import Mathlib.CategoryTheory.Monoidal.Types.Symmetric\nimport Mathlib.CategoryTheory.Monoidal.Types.Coyoneda\nimport Mathlib.CategoryTheory.Monoidal.Center\nimport Mathlib.Tactic.ApplyFun", + "import Mathlib.CategoryTheory.Abelian.Basic", + "import Mathlib.CategoryTheory.EqToHom", + "import Mathlib.CategoryTheory.Iso\nimport Mathlib.CategoryTheory.Functor.Category\nimport Mathlib.CategoryTheory.EqToHom", + "import Mathlib.CategoryTheory.Whiskering\nimport Mathlib.CategoryTheory.Functor.FullyFaithful\nimport Mathlib.CategoryTheory.NatIso", + "import Mathlib.CategoryTheory.Extensive\nimport Mathlib.CategoryTheory.Sites.Coverage\nimport Mathlib.CategoryTheory.EffectiveEpi.Basic", + "import Mathlib.CategoryTheory.Adjunction.Limits\nimport Mathlib.CategoryTheory.Limits.Preserves.Shapes.Products\nimport Mathlib.CategoryTheory.Limits.Shapes.Biproducts\nimport Mathlib.CategoryTheory.Shift.Basic", + "import Mathlib.CategoryTheory.Types\nimport Mathlib.CategoryTheory.Functor.EpiMono\nimport Mathlib.CategoryTheory.Limits.Constructions.EpiMono", + "import Mathlib.CategoryTheory.Monoidal.Free.Coherence\nimport Mathlib.CategoryTheory.Monoidal.Discrete\nimport Mathlib.CategoryTheory.Monoidal.NaturalTransformation\nimport Mathlib.CategoryTheory.Monoidal.Opposite\nimport Mathlib.Tactic.CategoryTheory.Coherence\nimport Mathlib.CategoryTheory.CommSq", + "import Mathlib.CategoryTheory.Monoidal.Functor\nimport Mathlib.CategoryTheory.ChosenFiniteProducts\nimport Mathlib.CategoryTheory.Limits.Shapes.Types\nimport Mathlib.Logic.Equiv.Fin", + "import Mathlib.CategoryTheory.Monoidal.Functor", + "import Mathlib.CategoryTheory.Monoidal.Free.Coherence\nimport Mathlib.Tactic.CategoryTheory.Coherence\nimport Mathlib.CategoryTheory.Closed.Monoidal\nimport Mathlib.Tactic.ApplyFun", + "import Mathlib.CategoryTheory.Monoidal.Category\nimport Mathlib.CategoryTheory.Limits.Shapes.BinaryProducts\nimport Mathlib.CategoryTheory.PEmpty", + "import Mathlib.CategoryTheory.Preadditive.Basic\nimport Mathlib.Algebra.Module.LinearMap.Basic\nimport Mathlib.Algebra.Algebra.Basic", + "import Mathlib.CategoryTheory.Category.Init\nimport Mathlib.Combinatorics.Quiver.Basic\nimport Mathlib.Tactic.PPWithUniv\nimport Mathlib.Tactic.Common", + "import Mathlib.CategoryTheory.Limits.Shapes.Products", + "import Mathlib.Data.Fintype.Basic\nimport Mathlib.CategoryTheory.DiscreteCategory\nimport Mathlib.CategoryTheory.Opposites\nimport Mathlib.CategoryTheory.Category.ULift", + "import Mathlib.CategoryTheory.Category.Basic", + "import Mathlib.CategoryTheory.Comma.StructuredArrow\nimport Mathlib.CategoryTheory.Limits.Shapes.Equivalence", + "import Mathlib.CategoryTheory.FintypeCat\nimport Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers\nimport Mathlib.CategoryTheory.Limits.FintypeCat\nimport Mathlib.CategoryTheory.Limits.MonoCoprod\nimport Mathlib.CategoryTheory.Limits.Preserves.Shapes.Terminal\nimport Mathlib.CategoryTheory.Limits.Shapes.Types\nimport Mathlib.CategoryTheory.Limits.Shapes.ConcreteCategory\nimport Mathlib.CategoryTheory.Limits.Shapes.Diagonal\nimport Mathlib.CategoryTheory.SingleObj\nimport Mathlib.Data.Finite.Card", + "import Mathlib.CategoryTheory.Groupoid\nimport Mathlib.Combinatorics.Quiver.Basic", + "import Mathlib.LinearAlgebra.StdBasis\nimport Mathlib.Tactic.Linarith\nimport Mathlib.Data.Finset.PiAntidiagonal\nimport Mathlib.Data.MvPolynomial.Basic", + "import Mathlib.Tactic.FinCases\nimport Mathlib.Data.Nat.Choose.Sum\nimport Mathlib.LinearAlgebra.Finsupp", + "import Mathlib.Algebra.GroupPower.Order\nimport Mathlib.RingTheory.Ideal.Operations\nimport Mathlib.Tactic.TFAE", + "import Mathlib.RingTheory.Adjoin.Basic", + "import Mathlib.Algebra.Ring.Equiv\nimport Mathlib.Algebra.Ring.Prod\nimport Mathlib.Data.Set.Finite\nimport Mathlib.GroupTheory.Submonoid.Membership\nimport Mathlib.GroupTheory.Subsemigroup.Membership\nimport Mathlib.GroupTheory.Subsemigroup.Centralizer", + "import Mathlib.Algebra.EuclideanDomain.Basic\nimport Mathlib.Data.Nat.Factors\nimport Mathlib.RingTheory.Coprime.Basic\nimport Mathlib.RingTheory.PrincipalIdealDomain", + "import Mathlib.Algebra.CharP.ExpChar\nimport Mathlib.Algebra.GeomSum\nimport Mathlib.Data.MvPolynomial.CommRing\nimport Mathlib.Data.MvPolynomial.Equiv\nimport Mathlib.RingTheory.Polynomial.Content\nimport Mathlib.RingTheory.UniqueFactorizationDomain", + "import Mathlib.Algebra.NeZero\nimport Mathlib.Algebra.Polynomial.BigOperators\nimport Mathlib.RingTheory.RootsOfUnity.Complex\nimport Mathlib.Data.Polynomial.Lifts\nimport Mathlib.Data.Polynomial.Splits\nimport Mathlib.FieldTheory.RatFunc\nimport Mathlib.NumberTheory.ArithmeticFunction\nimport Mathlib.RingTheory.RootsOfUnity.Basic", + "import Mathlib.Data.Polynomial.Derivative\nimport Mathlib.Data.Nat.Parity\nimport Mathlib.Data.Nat.Factorial.DoubleFactorial", + "import Mathlib.RingTheory.EisensteinCriterion\nimport Mathlib.RingTheory.Polynomial.ScaleRoots", + "import Mathlib.Algebra.GroupPower.Ring\nimport Mathlib.Algebra.Ring.Divisibility.Basic\nimport Mathlib.Algebra.Ring.Hom.Defs\nimport Mathlib.GroupTheory.GroupAction.Units\nimport Mathlib.Logic.Basic\nimport Mathlib.Tactic.Ring", + "import Mathlib.RingTheory.Noetherian\nimport Mathlib.Algebra.DirectSum.Module\nimport Mathlib.Algebra.DirectSum.Finsupp\nimport Mathlib.Algebra.Module.Projective\nimport Mathlib.Algebra.Module.Injective\nimport Mathlib.Algebra.Module.CharacterModule\nimport Mathlib.LinearAlgebra.DirectSum.TensorProduct\nimport Mathlib.LinearAlgebra.FreeModule.Basic\nimport Mathlib.Algebra.Module.Projective", + "import Mathlib.GroupTheory.Subgroup.Basic\nimport Mathlib.RingTheory.Subsemiring.Basic", + "import Mathlib.Algebra.Algebra.Operations\nimport Mathlib.Algebra.Algebra.Subalgebra.Tower\nimport Mathlib.LinearAlgebra.Prod\nimport Mathlib.LinearAlgebra.Finsupp", + "import Mathlib.Algebra.Module.Basic\nimport Mathlib.Algebra.Ring.Equiv\nimport Mathlib.Algebra.Ring.Prod\nimport Mathlib.Algebra.GroupRingAction.Subobjects\nimport Mathlib.Data.Set.Finite\nimport Mathlib.GroupTheory.Submonoid.Centralizer\nimport Mathlib.GroupTheory.Submonoid.Membership\nimport Mathlib.RingTheory.NonUnitalSubsemiring.Basic", + "import Mathlib.GroupTheory.MonoidLocalization\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\nimport Mathlib.RingTheory.OreLocalization.OreSet\nimport Mathlib.Tactic.NoncommRing", + "import Mathlib.Algebra.Function.Support\nimport Mathlib.Order.WellFoundedSet", + "import Mathlib.RingTheory.Ideal.Over\nimport Mathlib.RingTheory.Polynomial.RationalRoot", + "import Mathlib.Algebra.CharP.Basic\nimport Mathlib.Data.Polynomial.AlgebraMap\nimport Mathlib.Data.MvPolynomial.Degrees\nimport Mathlib.LinearAlgebra.FinsuppVectorSpace\nimport Mathlib.LinearAlgebra.FreeModule.Finite.Basic", + "import Mathlib.Algebra.DirectSum.Algebra\nimport Mathlib.Algebra.DirectSum.Decomposition\nimport Mathlib.Algebra.DirectSum.Internal\nimport Mathlib.Algebra.DirectSum.Ring", + "import Mathlib.Algebra.Algebra.Tower\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\nimport Mathlib.GroupTheory.MonoidLocalization\nimport Mathlib.RingTheory.Ideal.Basic\nimport Mathlib.GroupTheory.GroupAction.Ring", + "import Mathlib.Init.Data.Int.CompLemmas\nimport Mathlib.RingTheory.UniqueFactorizationDomain\nimport Mathlib.RingTheory.Localization.Basic", + "import Mathlib.Algebra.CharP.Two\nimport Mathlib.Algebra.CharP.Reduced\nimport Mathlib.Algebra.NeZero\nimport Mathlib.Data.Polynomial.RingDivision\nimport Mathlib.GroupTheory.SpecificGroups.Cyclic\nimport Mathlib.NumberTheory.Divisors\nimport Mathlib.RingTheory.IntegralDomain\nimport Mathlib.Tactic.Zify", + "import Mathlib.LinearAlgebra.FiniteDimensional\nimport Mathlib.LinearAlgebra.TensorProduct.Tower\nimport Mathlib.RingTheory.Adjoin.Basic\nimport Mathlib.LinearAlgebra.DirectSum.Finsupp", + "import Mathlib.Data.MvPolynomial.Counit\nimport Mathlib.Data.MvPolynomial.Invertible\nimport Mathlib.RingTheory.WittVector.Defs", + "import Mathlib.RingTheory.MvPowerSeries.Basic\nimport Mathlib.Data.Polynomial.Basic\nimport Mathlib.Data.Polynomial.AlgebraMap", + "import Mathlib.RingTheory.PrincipalIdealDomain\nimport Mathlib.RingTheory.Ideal.LocalRing\nimport Mathlib.RingTheory.Valuation.PrimeMultiplicity\nimport Mathlib.LinearAlgebra.AdicCompletion", + "import Mathlib.GroupTheory.Subgroup.Basic\nimport Mathlib.RingTheory.NonUnitalSubsemiring.Basic", + "import Mathlib.RingTheory.Localization.Integer\nimport Mathlib.RingTheory.Localization.Submodule", + "import Mathlib.Algebra.Group.Conj\nimport Mathlib.Algebra.Group.Pi.Lemmas\nimport Mathlib.Data.Set.Image\nimport Mathlib.GroupTheory.Submonoid.Centralizer\nimport Mathlib.Order.Atoms\nimport Mathlib.Tactic.ApplyFun", + "import Mathlib.Algebra.Group.Prod\nimport Mathlib.Algebra.Group.Units.Equiv\nimport Mathlib.Algebra.GroupPower.IterateHom\nimport Mathlib.Logic.Equiv.Set", + "import Mathlib.Algebra.Module.BigOperators\nimport Mathlib.Data.Fintype.Perm\nimport Mathlib.GroupTheory.Perm.Finite\nimport Mathlib.GroupTheory.Perm.List", + "import Mathlib.Algebra.Group.Hom.Defs\nimport Mathlib.Algebra.Group.Units\nimport Mathlib.GroupTheory.Subsemigroup.Basic", + "import Mathlib.Algebra.PUnitInstances\nimport Mathlib.GroupTheory.Subgroup.Basic\nimport Mathlib.GroupTheory.Congruence\nimport Mathlib.GroupTheory.Submonoid.Membership", + "import Mathlib.Data.Fintype.Card\nimport Mathlib.GroupTheory.GroupAction.Defs\nimport Mathlib.GroupTheory.GroupAction.Group\nimport Mathlib.Data.Setoid.Basic\nimport Mathlib.Data.Set.Pointwise.SMul\nimport Mathlib.GroupTheory.Subgroup.Basic", + "import Mathlib.Algebra.Group.Opposite\nimport Mathlib.Algebra.Group.Pi.Lemmas\nimport Mathlib.GroupTheory.GroupAction.Defs", + "import Mathlib.Algebra.Group.Hom.Defs\nimport Mathlib.Data.Set.Lattice\nimport Mathlib.Data.SetLike.Basic", + "import Mathlib.Data.Fintype.Basic\nimport Mathlib.Data.List.Sublists\nimport Mathlib.Data.List.InsertNth\nimport Mathlib.GroupTheory.Subgroup.Basic", + "import Mathlib.Algebra.Group.TypeTags\nimport Mathlib.Algebra.Ring.Defs\nimport Mathlib.Data.Int.Cast.Basic\nimport Mathlib.Order.Monotone.Basic", + "import Mathlib.Data.Nat.Order.Basic\nimport Mathlib.Data.Int.Basic\nimport Mathlib.Algebra.Order.Group.Abs\nimport Mathlib.Algebra.Order.Ring.CharZero\nimport Mathlib.Algebra.Divisibility.Basic", + "import Mathlib.Init.Data.Nat.Lemmas\nimport Mathlib.Data.Int.Cast.Defs\nimport Mathlib.Algebra.Group.Basic", + "import Mathlib.Data.Int.Order.Basic\nimport Mathlib.Data.Nat.Cast.Order\nimport Mathlib.Algebra.Ring.Divisibility.Basic", + "import Mathlib.Data.DList.Defs\nimport Mathlib.Tactic.TypeStar", + "import Mathlib.Mathport.Rename", + "import Mathlib.Data.Nat.SuccPred\nimport Mathlib.Algebra.CharZero.Lemmas\nimport Mathlib.Algebra.Order.Sub.WithTop\nimport Mathlib.Algebra.Order.Ring.WithTop", + "import Mathlib.Data.Real.Sqrt\nimport Mathlib.Analysis.NormedSpace.Star.Basic\nimport Mathlib.Analysis.NormedSpace.ContinuousLinearMap\nimport Mathlib.Analysis.NormedSpace.Basic", + "import Mathlib.Init.ZeroOne\nimport Mathlib.Data.Set.Defs\nimport Mathlib.Order.Basic\nimport Mathlib.Order.SymmDiff\nimport Mathlib.Tactic.Tauto\nimport Mathlib.Tactic.ByContra\nimport Mathlib.Util.Delaborators", + "import Mathlib.Data.Set.Function\nimport Mathlib.Logic.Relation\nimport Mathlib.Logic.Pairwise", + "import Mathlib.Algebra.Group.Equiv.Basic\nimport Mathlib.Algebra.Group.Units.Hom\nimport Mathlib.Algebra.GroupPower.Basic\nimport Mathlib.Algebra.GroupWithZero.Basic\nimport Mathlib.Algebra.Opposites\nimport Mathlib.Data.Nat.Order.Basic\nimport Mathlib.Data.Set.Lattice\nimport Mathlib.Tactic.Common", + "import Mathlib.Order.MinMax\nimport Mathlib.Data.Set.Basic\nimport Mathlib.Tactic.Says", + "import Mathlib.Data.List.Lex\nimport Mathlib.Data.Char", + "import Mathlib.Logic.Function.Basic\nimport Mathlib.Tactic.MkIffOfInductiveProp", + "import Mathlib.Data.PNat.Defs\nimport Mathlib.Data.Nat.Bits\nimport Mathlib.Data.Nat.Order.Basic\nimport Mathlib.Data.Set.Basic\nimport Mathlib.Algebra.GroupWithZero.Divisibility\nimport Mathlib.Algebra.Order.Positive.Ring\nimport Mathlib.Order.Hom.Basic", + "import Mathlib.Data.W.Basic", + "import Mathlib.Control.Functor.Multivariate\nimport Mathlib.Data.PFunctor.Univariate.Basic", + "import Mathlib.Init.Function\nimport Mathlib.Logic.Function.Basic\nimport Mathlib.Tactic.Inhabit", + "import Mathlib.Algebra.Module.LinearMap.Basic\nimport Mathlib.Algebra.BigOperators.Basic\nimport Mathlib.Data.Set.Finite\nimport Mathlib.GroupTheory.Submonoid.Membership\nimport Mathlib.GroupTheory.GroupAction.BigOperators\nimport Mathlib.Data.Finset.Preimage", + "import Lean.Linter.Deprecated\nimport Mathlib.Mathport.Rename\nimport Mathlib.Init.Data.Nat.Bitwise\nimport Mathlib.Init.Data.Int.Basic\nimport Mathlib.Init.ZeroOne", + "import Mathlib.Logic.Equiv.List", + "import Mathlib.Init.Function\nimport Mathlib.Logic.Function.Basic", + "import Mathlib.Algebra.Algebra.Tower\nimport Mathlib.Algebra.GroupPower.Ring\nimport Mathlib.Algebra.Regular.Pow\nimport Mathlib.Algebra.MonoidAlgebra.Support\nimport Mathlib.Data.Finsupp.Antidiagonal\nimport Mathlib.Order.SymmDiff\nimport Mathlib.RingTheory.Adjoin.Basic", + "import Mathlib.Control.Traversable.Equiv\nimport Mathlib.Control.Traversable.Instances\nimport Std.Data.LazyList\nimport Mathlib.Lean.Thunk", + "import Mathlib.Logic.Relation\nimport Mathlib.Order.GaloisConnection", + "import Mathlib.Data.Vector\nimport Mathlib.Data.List.Nodup\nimport Mathlib.Data.List.OfFn\nimport Mathlib.Data.List.InsertNth\nimport Mathlib.Control.Applicative\nimport Mathlib.Control.Traversable.Basic", + "import Mathlib.Algebra.GroupPower.Ring\nimport Mathlib.Algebra.MonoidAlgebra.Basic\nimport Mathlib.Data.Finset.Sort", + "import Mathlib.RingTheory.Finiteness\nimport Mathlib.Data.Polynomial.AlgebraMap", + "import Std.Tactic.Alias", + "import Mathlib.Algebra.BigOperators.Finsupp\nimport Mathlib.Algebra.Regular.SMul\nimport Mathlib.Data.Finset.Preimage\nimport Mathlib.Data.Rat.BigOperators\nimport Mathlib.GroupTheory.GroupAction.Hom\nimport Mathlib.Data.Set.Basic", + "import Mathlib.Data.Finset.Attr\nimport Mathlib.Data.Multiset.Bind\nimport Mathlib.Data.Multiset.FinsetOps\nimport Mathlib.Data.Set.Lattice", + "import Mathlib.Order.Cover\nimport Mathlib.Order.LocallyFinite\nimport Mathlib.Data.Set.Intervals.Monoid", + "import Mathlib.Algebra.Group.TypeTags\nimport Mathlib.Algebra.Ring.Defs\nimport Mathlib.Algebra.GroupWithZero.Defs", + "import Mathlib.Algebra.Order.Monoid.WithZero\nimport Mathlib.Algebra.Order.Ring.Canonical\nimport Mathlib.Data.Nat.Basic", + "import Mathlib.Data.Nat.Defs\nimport Mathlib.Tactic.GCongr.Core\nimport Mathlib.Tactic.Common\nimport Mathlib.Tactic.Monotonicity.Attr", + "import Mathlib.Algebra.GroupPower.Basic\nimport Mathlib.Algebra.GroupWithZero.Divisibility\nimport Mathlib.Data.Nat.Order.Lemmas\nimport Mathlib.Tactic.NthRewrite", + "import Mathlib.Algebra.Divisibility.Basic\nimport Mathlib.Algebra.Group.Equiv.Basic\nimport Mathlib.Algebra.Group.TypeTags\nimport Mathlib.Algebra.Ring.Hom.Defs\nimport Mathlib.Data.Nat.Basic", + "import Mathlib.Init.Data.Nat.Lemmas\nimport Mathlib.Init.Data.Nat.Bitwise\nimport Mathlib.Data.Nat.GCD.Basic\nimport Mathlib.Logic.Function.Iterate\nimport Mathlib.Data.Finset.NatAntidiagonal\nimport Mathlib.Algebra.BigOperators.Basic\nimport Mathlib.Tactic.Ring\nimport Mathlib.Tactic.Zify", + "import Mathlib.Data.Nat.Factorial.Basic\nimport Mathlib.Order.Monotone.Basic", + "import Mathlib.Algebra.BigOperators.Finsupp\nimport Mathlib.Data.Finsupp.Multiset\nimport Mathlib.Data.Nat.PrimeFin\nimport Mathlib.NumberTheory.Padics.PadicVal\nimport Mathlib.Data.Nat.GCD.BigOperators\nimport Mathlib.Data.Nat.Interval\nimport Mathlib.Tactic.IntervalCases\nimport Mathlib.Algebra.GroupPower.Order", + "import Mathlib.Data.Set.Basic\nimport Mathlib.Tactic.Monotonicity.Attr\nimport Mathlib.Tactic.SetLike", + "import Mathlib.Algebra.NeZero\nimport Mathlib.Order.RelIso.Basic\nimport Mathlib.Data.Nat.Order.Basic\nimport Mathlib.Order.Hom.Set\nimport Std.Data.Fin.Lemmas", + "import Mathlib.Data.Fin.OrderHom\nimport Mathlib.Data.Pi.Lex\nimport Mathlib.Data.Set.Intervals.Basic", + "import Mathlib.Algebra.Star.Basic\nimport Mathlib.Algebra.Order.CauSeq.Completion", + "import Mathlib.Algebra.CharP.Basic\nimport Mathlib.RingTheory.Ideal.Operations\nimport Mathlib.Data.Fintype.Units\nimport Mathlib.Data.Nat.Parity\nimport Mathlib.Tactic.FinCases", + "import Mathlib.Logic.Function.Basic\nimport Mathlib.Util.CompileInductive", + "import Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Algebra.Pi\nimport Mathlib.Algebra.BigOperators.Pi\nimport Mathlib.Algebra.BigOperators.Ring\nimport Mathlib.Algebra.BigOperators.RingEquiv\nimport Mathlib.Algebra.Module.LinearMap.Basic\nimport Mathlib.Algebra.Module.Pi\nimport Mathlib.Algebra.Star.BigOperators\nimport Mathlib.Algebra.Star.Module\nimport Mathlib.Algebra.Star.Pi\nimport Mathlib.Data.Fintype.BigOperators\nimport Mathlib.GroupTheory.GroupAction.BigOperators", + "import Mathlib.Init.Data.Nat.Lemmas\nimport Mathlib.Init.Function", + "import Mathlib.Data.Semiquot\nimport Mathlib.Data.Nat.Size\nimport Mathlib.Tactic.Ring.RingNF", + "import Mathlib.Data.Set.Card\nimport Mathlib.Order.Minimal\nimport Mathlib.Data.Matroid.Init", + "import Mathlib.Data.Set.List\nimport Mathlib.Data.List.Perm\nimport Mathlib.Init.Quot -- Porting note: added import\nimport Mathlib.Order.Hom.Basic", + "import Mathlib.Mathport.Rename", + "import Mathlib.Data.PFunctor.Univariate.M", + "import Mathlib.Data.PFunctor.Multivariate.Basic", + "import Mathlib.Init.Control.Combinators\nimport Mathlib.Data.Option.Defs\nimport Mathlib.Logic.IsEmpty\nimport Mathlib.Logic.Relator\nimport Mathlib.Util.CompileInductive\nimport Aesop", + "import Mathlib.Algebra.Order.Ring.WithTop\nimport Mathlib.Algebra.Order.Sub.WithTop\nimport Mathlib.Data.Real.NNReal\nimport Mathlib.Data.Set.Intervals.WithBotTop", + "import Mathlib.Data.Bool.Basic\nimport Mathlib.Data.Nat.Defs\nimport Mathlib.Data.Option.Basic\nimport Mathlib.Data.List.Defs\nimport Mathlib.Init.Data.List.Basic\nimport Mathlib.Init.Data.List.Instances\nimport Mathlib.Init.Data.List.Lemmas\nimport Mathlib.Logic.Unique\nimport Mathlib.Order.Basic\nimport Std.Data.List.Lemmas\nimport Mathlib.Tactic.Common", + "import Mathlib.Logic.Equiv.Nat\nimport Mathlib.Logic.Equiv.Fin\nimport Mathlib.Data.Countable.Defs", + "import Mathlib.Data.Multiset.Basic\nimport Mathlib.Data.Vector.Basic\nimport Mathlib.Data.Setoid.Basic\nimport Mathlib.Tactic.ApplyFun", + "import Mathlib.Init.Align", + "import Mathlib.Data.Fintype.Powerset\nimport Mathlib.Data.Fintype.Prod\nimport Mathlib.Data.Fintype.Sigma\nimport Mathlib.Data.Fintype.Sum\nimport Mathlib.Data.Fintype.Vector", + "import Mathlib.Algebra.CharZero.Lemmas\nimport Mathlib.Algebra.GroupPower.Ring\nimport Mathlib.Algebra.GroupWithZero.Bitwise\nimport Mathlib.Data.Real.Basic\nimport Mathlib.Data.Set.Image", + "import Mathlib.Algebra.Ring.Hom.Defs -- FIXME: This import is bogus\nimport Mathlib.Data.Finset.Image\nimport Mathlib.Data.Fin.OrderHom", + "import Mathlib.Algebra.Category.Ring.FilteredColimits\nimport Mathlib.Geometry.RingedSpace.SheafedSpace\nimport Mathlib.Topology.Sheaves.Stalks\nimport Mathlib.Algebra.Category.Ring.Colimits\nimport Mathlib.Algebra.Category.Ring.Limits", + "import Mathlib.Analysis.InnerProductSpace.Projection\nimport Mathlib.Geometry.Euclidean.PerpBisector\nimport Mathlib.Algebra.QuadraticDiscriminant", + "import Mathlib.Analysis.Convex.StrictConvexBetween\nimport Mathlib.Geometry.Euclidean.Basic", + "import Mathlib.Analysis.InnerProductSpace.Basic\nimport Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse", + "import Mathlib.Analysis.InnerProductSpace.TwoDim\nimport Mathlib.Geometry.Euclidean.Angle.Unoriented.Basic", + "import Mathlib.Analysis.Normed.Group.AddTorsor\nimport Mathlib.Analysis.InnerProductSpace.Basic", + "import Mathlib.Geometry.Manifold.MFDeriv.Defs", + "import Mathlib.Geometry.Manifold.ContMDiff.Defs", + "import Mathlib.Geometry.Manifold.LocalInvariantProperties\nimport Mathlib.Topology.Sheaves.LocalPredicate", + "import Mathlib.Geometry.Manifold.ContMDiff.Atlas\nimport Mathlib.Geometry.Manifold.VectorBundle.FiberwiseLinear\nimport Mathlib.Topology.VectorBundle.Constructions", + "import Mathlib.Data.Seq.Seq\nimport Mathlib.Algebra.Field.Defs", + "import Mathlib.Algebra.Order.Floor\nimport Mathlib.Algebra.ContinuedFractions.Basic", + "import Mathlib.CategoryTheory.Limits.Preserves.Shapes.Zero", + "import Mathlib.Algebra.Group.Basic\nimport Mathlib.Algebra.Group.Hom.Defs\nimport Mathlib.Algebra.GroupWithZero.NeZero\nimport Mathlib.Algebra.Opposites\nimport Mathlib.Algebra.Ring.Defs", + "import Mathlib.Algebra.Divisibility.Basic\nimport Mathlib.Algebra.Group.Units.Hom\nimport Mathlib.Algebra.GroupWithZero.InjSurj\nimport Mathlib.Algebra.Ring.Hom.Defs\nimport Mathlib.Data.Set.Basic", + "import Mathlib.Algebra.Divisibility.Basic\nimport Mathlib.Algebra.Group.Equiv.Basic\nimport Mathlib.Algebra.Ring.Defs", + "import Mathlib.Algebra.Associated\nimport Mathlib.Algebra.Ring.Regular\nimport Mathlib.Tactic.Common", + "import Mathlib.Algebra.BigOperators.Multiset.Lemmas\nimport Mathlib.Algebra.BigOperators.Multiset.Order\nimport Mathlib.Algebra.Function.Indicator\nimport Mathlib.Algebra.Ring.Opposite\nimport Mathlib.Data.Finset.Powerset\nimport Mathlib.Data.Finset.Preimage\nimport Mathlib.Data.Finset.Sigma\nimport Mathlib.Data.Finset.Sum\nimport Mathlib.Data.Fintype.Pi\nimport Mathlib.Data.Int.Cast.Lemmas\nimport Mathlib.Data.Set.Image", + "import Mathlib.Algebra.BigOperators.List.Defs\nimport Mathlib.Data.List.Forall2\nimport Mathlib.Algebra.Divisibility.Basic\nimport Mathlib.Algebra.Ring.Commute\nimport Mathlib.Data.Nat.Order.Basic\nimport Mathlib.Data.Int.Basic", + "import Mathlib.Algebra.Group.Hom.Basic\nimport Mathlib.Algebra.GroupPower.Hom\nimport Mathlib.Algebra.BigOperators.List.Basic\nimport Mathlib.Data.Multiset.Basic", + "import Mathlib.Algebra.CharZero.Lemmas\nimport Mathlib.Algebra.Module.Submodule.Ker\nimport Mathlib.Algebra.Module.Submodule.RestrictScalars\nimport Mathlib.Algebra.Module.ULift\nimport Mathlib.RingTheory.Subring.Basic", + "import Mathlib.Algebra.Algebra.Basic\nimport Mathlib.Data.Set.UnionLift\nimport Mathlib.LinearAlgebra.Finsupp\nimport Mathlib.RingTheory.Ideal.Operations", + "import Mathlib.Algebra.Order.Monoid.Defs\nimport Mathlib.Algebra.Group.InjSurj\nimport Mathlib.Order.Hom.Basic", + "import Mathlib.Logic.Basic\nimport Mathlib.Tactic.Positivity.Basic", + "import Mathlib.Algebra.Order.AbsoluteValue\nimport Mathlib.Algebra.Order.Field.Basic\nimport Mathlib.Algebra.Order.Group.MinMax\nimport Mathlib.Algebra.Ring.Pi\nimport Mathlib.GroupTheory.GroupAction.Pi\nimport Mathlib.GroupTheory.GroupAction.Ring\nimport Mathlib.Init.Align\nimport Mathlib.Tactic.GCongr\nimport Mathlib.Tactic.Ring", + "import Mathlib.Algebra.Group.Equiv.Basic\nimport Mathlib.Algebra.Ring.Basic\nimport Mathlib.Algebra.Order.Sub.Defs\nimport Mathlib.Order.Hom.Basic", + "import Mathlib.Algebra.Field.Basic\nimport Mathlib.Algebra.GroupWithZero.Units.Equiv\nimport Mathlib.Algebra.Order.Field.Defs\nimport Mathlib.Algebra.Order.Ring.Abs\nimport Mathlib.Order.Bounds.OrderIso\nimport Mathlib.Tactic.Positivity.Core", + "import Mathlib.Algebra.Order.Field.Canonical.Defs", + "import Mathlib.Algebra.Field.Defs\nimport Mathlib.Algebra.GroupWithZero.Units.Lemmas\nimport Mathlib.Algebra.Ring.Commute\nimport Mathlib.Algebra.Ring.Hom.Defs", + "import Mathlib.Algebra.Invertible.GroupWithZero\nimport Mathlib.Algebra.Group.Commute.Units\nimport Mathlib.Algebra.Group.Hom.Defs\nimport Mathlib.Algebra.Group.Units\nimport Mathlib.Algebra.GroupPower.Basic\nimport Mathlib.Algebra.GroupWithZero.Units.Basic\nimport Mathlib.Algebra.Ring.Defs", + "import Mathlib.Data.Bracket\nimport Mathlib.LinearAlgebra.Basic", + "import Mathlib.Algebra.Ring.Divisibility.Lemmas\nimport Mathlib.Algebra.Lie.Nilpotent\nimport Mathlib.Algebra.Lie.Engel\nimport Mathlib.LinearAlgebra.Eigenspace.Triangularizable\nimport Mathlib.RingTheory.Artinian\nimport Mathlib.LinearAlgebra.Trace\nimport Mathlib.LinearAlgebra.FreeModule.PID", + "import Mathlib.Data.DFinsupp.Basic\nimport Mathlib.GroupTheory.Submonoid.Operations", + "import Mathlib.Algebra.GroupWithZero.Units.Lemmas\nimport Mathlib.Algebra.Ring.Equiv\nimport Mathlib.GroupTheory.GroupAction.Group", + "import Mathlib.RingTheory.UniqueFactorizationDomain", + "import Mathlib.Algebra.GroupPower.Basic\nimport Mathlib.Algebra.Group.Hom.Defs", + "import Mathlib.Algebra.BigOperators.List.Basic\nimport Mathlib.GroupTheory.GroupAction.Defs", + "import Mathlib.Algebra.Module.Basic\nimport Mathlib.Algebra.Order.Archimedean\nimport Mathlib.Algebra.Order.Group.Instances", + "import Mathlib.Data.Int.ModEq\nimport Mathlib.Data.Nat.Multiplicity\nimport Mathlib.Data.Nat.Choose.Sum\nimport Mathlib.Data.Nat.Cast.Prod\nimport Mathlib.Algebra.Group.ULift\nimport Mathlib.GroupTheory.OrderOfElement", + "import Mathlib.Algebra.Lie.OfAssociative", + "import Mathlib.Algebra.Category.MonCat.Basic\nimport Mathlib.CategoryTheory.Endomorphism", + "import Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.CategoryTheory.Conj\nimport Mathlib.CategoryTheory.Linear.Basic\nimport Mathlib.CategoryTheory.Preadditive.AdditiveFunctor\nimport Mathlib.LinearAlgebra.Basic", + "import Mathlib.Algebra.Category.ModuleCat.Basic\nimport Mathlib.LinearAlgebra.TensorProduct.Basic\nimport Mathlib.CategoryTheory.Monoidal.Linear", + "import Mathlib.Algebra.Algebra.Subalgebra.Basic\nimport Mathlib.Algebra.FreeAlgebra\nimport Mathlib.Algebra.Category.Ring.Basic\nimport Mathlib.Algebra.Category.ModuleCat.Basic", + "import Mathlib.CategoryTheory.ConcreteCategory.BundledHom\nimport Mathlib.Algebra.PUnitInstances\nimport Mathlib.CategoryTheory.Functor.ReflectsIso", + "import Mathlib.Algebra.PEmptyInstances\nimport Mathlib.Algebra.Group.Equiv.Basic\nimport Mathlib.CategoryTheory.ConcreteCategory.BundledHom\nimport Mathlib.CategoryTheory.Functor.ReflectsIso", + "import Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.CategoryTheory.ConcreteCategory.ReflectsIso\nimport Mathlib.Algebra.Ring.Equiv", + "import Mathlib.CategoryTheory.Monoidal.Rigid.Basic\nimport Mathlib.CategoryTheory.Monoidal.Subcategory\nimport Mathlib.LinearAlgebra.Coevaluation\nimport Mathlib.LinearAlgebra.FreeModule.Finite.Matrix\nimport Mathlib.Algebra.Category.ModuleCat.Monoidal.Closed", + "import Mathlib.Algebra.Group.Commute.Basic\nimport Mathlib.Algebra.GroupWithZero.Defs\nimport Mathlib.Data.Int.Defs\nimport Mathlib.Tactic.Common", + "import Mathlib.Algebra.GroupPower.CovariantClass\nimport Mathlib.Algebra.Order.Monoid.WithTop\nimport Mathlib.Algebra.SMulWithZero\nimport Mathlib.Order.Hom.Basic\nimport Mathlib.Data.Nat.Order.Basic", + "import Mathlib.Algebra.EuclideanDomain.Defs\nimport Mathlib.Algebra.Ring.Divisibility.Basic\nimport Mathlib.Algebra.Ring.Regular\nimport Mathlib.Algebra.GroupWithZero.Divisibility\nimport Mathlib.Algebra.Ring.Basic", + "import Mathlib.Algebra.Function.Indicator\nimport Mathlib.Algebra.SMulWithZero\nimport Mathlib.Data.Int.Basic\nimport Mathlib.Data.NNRat.Defs\nimport Mathlib.GroupTheory.GroupAction.Group\nimport Mathlib.GroupTheory.GroupAction.Pi\nimport Mathlib.Logic.Basic\nimport Mathlib.Tactic.Abel", + "import Mathlib.GroupTheory.GroupAction.SubMulAction\nimport Mathlib.GroupTheory.Submonoid.Membership", + "import Mathlib.Algebra.Module.Pi\nimport Mathlib.Algebra.Ring.CompTypeclasses\nimport Mathlib.Algebra.Star.Basic\nimport Mathlib.GroupTheory.GroupAction.DomAct.Basic\nimport Mathlib.GroupTheory.GroupAction.Hom", + "import Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.NonUnitalHom\nimport Mathlib.Algebra.BigOperators.Finsupp\nimport Mathlib.Algebra.Module.BigOperators\nimport Mathlib.LinearAlgebra.Finsupp", + "import Mathlib.Algebra.Group.Commute.Defs\nimport Mathlib.Algebra.Group.Units\nimport Mathlib.Algebra.Order.Monoid.Lemmas\nimport Mathlib.Tactic.NthRewrite", + "import Aesop\nimport Mathlib.Algebra.Group.Defs\nimport Mathlib.Logic.Function.Basic\nimport Mathlib.Tactic.Cases\nimport Mathlib.Tactic.SimpRw\nimport Mathlib.Tactic.SplitIfs", + "import Mathlib.Algebra.Group.Semiconj.Defs\nimport Mathlib.Algebra.Group.Basic", + "import Mathlib.Algebra.Group.Basic\nimport Mathlib.Algebra.Group.Hom.Defs", + "import Mathlib.Algebra.Group.Defs\nimport Mathlib.Data.Prod.Basic\nimport Mathlib.Data.Sum.Basic\nimport Mathlib.Logic.Unique\nimport Mathlib.Tactic.Spread", + "import Mathlib.Algebra.Group.Equiv.Basic\nimport Mathlib.Algebra.Group.WithOne.Defs\nimport Mathlib.Data.Option.Basic", + "import Mathlib.Algebra.Group.Hom.Basic\nimport Mathlib.Data.FunLike.Equiv\nimport Mathlib.Logic.Equiv.Basic", + "import Mathlib.Algebra.Group.Commute.Defs\nimport Mathlib.Algebra.Group.Semiconj.Basic", + "import Mathlib.Algebra.Field.Opposite\nimport Mathlib.Algebra.Invertible.Defs\nimport Mathlib.Algebra.Ring.Aut\nimport Mathlib.Algebra.Ring.CompTypeclasses\nimport Mathlib.Algebra.Field.Opposite\nimport Mathlib.Algebra.Invertible.Defs\nimport Mathlib.Data.NNRat.Defs\nimport Mathlib.Data.Rat.Cast.Defs\nimport Mathlib.Data.SetLike.Basic\nimport Mathlib.GroupTheory.GroupAction.Opposite", + "import Mathlib.Algebra.Group.Basic\nimport Mathlib.Algebra.GroupWithZero.NeZero\nimport Mathlib.Algebra.Group.OrderSynonym", + "import Mathlib.Algebra.GroupWithZero.Basic\nimport Mathlib.Algebra.Group.Units\nimport Mathlib.Tactic.Nontriviality\nimport Mathlib.Util.AssertExists\nimport Mathlib.Tactic.Contrapose", + "import Mathlib.CategoryTheory.Category.Grpd\nimport Mathlib.CategoryTheory.Groupoid\nimport Mathlib.Topology.Category.TopCat.Basic\nimport Mathlib.Topology.Homotopy.Path\nimport Mathlib.Data.Set.Basic", + "import Mathlib.RingTheory.IntegralClosure", + "import Mathlib.FieldTheory.Normal\nimport Mathlib.FieldTheory.Perfect\nimport Mathlib.RingTheory.Localization.Integral", + "import Mathlib.FieldTheory.Separable\nimport Mathlib.RingTheory.IntegralDomain\nimport Mathlib.Algebra.CharP.Reduced\nimport Mathlib.Tactic.ApplyFun", + "import Lean\nimport Std\nimport Mathlib.Tactic.PPWithUniv\nimport Mathlib.Tactic.ExtendDoc\nimport Mathlib.Tactic.Lemma\nimport Mathlib.Tactic.TypeStar", + "import Lean.Elab.Tactic.SolveByElim\nimport Mathlib.Tactic.Monotonicity.Attr", + "import Lean.Elab.Tactic.Simp\nimport Lean.Elab.App\nimport Mathlib.Tactic.Simps.NotationClass\nimport Std.Data.String.Basic\nimport Std.Util.LibraryNote\nimport Mathlib.Lean.Expr.Basic", + "import Mathlib.Tactic.NormNum.Inv\nimport Mathlib.Tactic.NormNum.Pow\nimport Mathlib.Util.AtomM\nimport Mathlib.Data.Rat.Order", + "import Mathlib.Tactic.NormNum.Core\nimport Mathlib.Tactic.HaveI\nimport Mathlib.Data.Nat.Cast.Commute\nimport Mathlib.Data.Int.Basic\nimport Mathlib.Algebra.Invertible.Basic\nimport Mathlib.Tactic.Clear!\nimport Mathlib.Data.Nat.Cast.Basic", + "import Mathlib.Algebra.GroupPower.Order\nimport Mathlib.Data.Int.CharZero\nimport Mathlib.Data.Int.Order.Basic\nimport Mathlib.Data.Nat.Factorial.Basic\nimport Mathlib.Data.Rat.Order\nimport Mathlib.Tactic.Positivity.Core\nimport Qq", + "import Std.Data.Rat.Lemmas\nimport Mathlib.Mathport.Rename", + "import Mathlib.Mathport.Rename", + "import Std.Logic\nimport Mathlib.Mathport.Rename", + "import Mathlib.Mathport.Rename\nimport Mathlib.Init.Data.Nat.Notation\nimport Std.Data.List.Basic", + "import Mathlib.Init.ZeroOne\nimport Mathlib.Init.Data.Nat.Notation\nimport Mathlib.Util.CompileInductive", + "import Mathlib.Init.Data.Nat.Notation", + "import Mathlib.Mathport.Rename", + "import Mathlib.Mathport.Rename\nimport Std.Data.Bool", + "import Mathlib.AlgebraicGeometry.AffineScheme\nimport Mathlib.AlgebraicGeometry.Pullbacks\nimport Mathlib.CategoryTheory.MorphismProperty\nimport Mathlib.Data.List.TFAE", + "import Mathlib.LinearAlgebra.Finsupp\nimport Mathlib.RingTheory.Ideal.Over\nimport Mathlib.RingTheory.Ideal.Prod\nimport Mathlib.RingTheory.Ideal.MinimalPrime\nimport Mathlib.RingTheory.Localization.Away.Basic\nimport Mathlib.RingTheory.Nilpotent\nimport Mathlib.Topology.Sets.Closeds\nimport Mathlib.Topology.Sober", + "import Mathlib.Data.Set.Function\nimport Mathlib.Logic.Function.Iterate\nimport Mathlib.GroupTheory.Perm.Basic", + "import Mathlib.Algebra.BigOperators.Basic\nimport Mathlib.Dynamics.FixedPoints.Basic", + "import Mathlib.Algebra.Function.Support\nimport Mathlib.Order.Filter.Lift\nimport Mathlib.Topology.Defs.Filter", + "import Mathlib.Order.SetNotation\nimport Mathlib.Tactic.Continuity\nimport Mathlib.Tactic.FunProp", + "import Mathlib.Topology.Order.ProjIcc\nimport Mathlib.Topology.ContinuousFunction.Ordered\nimport Mathlib.Topology.CompactOpen\nimport Mathlib.Topology.UnitInterval", + "import Mathlib.Analysis.NormedSpace.BoundedLinearMaps\nimport Mathlib.Topology.FiberBundle.Basic", + "import Mathlib.Data.Set.Image\nimport Mathlib.Order.SuccPred.Relation\nimport Mathlib.Topology.Clopen\nimport Mathlib.Topology.Irreducible", + "import Mathlib.CategoryTheory.ConcreteCategory.BundledHom\nimport Mathlib.CategoryTheory.Elementwise\nimport Mathlib.Topology.ContinuousFunction.Basic", + "import Mathlib.Topology.Category.TopCat.Basic\nimport Mathlib.CategoryTheory.Limits.Types", + "import Mathlib.Topology.Category.CompHaus.Basic\nimport Mathlib.Topology.LocallyConstant.Basic\nimport Mathlib.CategoryTheory.FintypeCat", + "import Mathlib.Topology.Category.Profinite.Basic\nimport Mathlib.CategoryTheory.Limits.ConcreteCategory", + "import Mathlib.Topology.ExtremallyDisconnected\nimport Mathlib.Topology.Category.CompHaus.Projective\nimport Mathlib.Topology.Category.Profinite.Basic", + "import Mathlib.CategoryTheory.Adjunction.Reflective\nimport Mathlib.Topology.StoneCech\nimport Mathlib.CategoryTheory.Monad.Limits\nimport Mathlib.Topology.UrysohnsLemma\nimport Mathlib.Topology.Category.TopCat.Limits.Basic\nimport Mathlib.Data.Set.Basic", + "import Mathlib.Order.Filter.SmallSets\nimport Mathlib.Tactic.Monotonicity\nimport Mathlib.Topology.Compactness.Compact\nimport Mathlib.Topology.NhdsSet\nimport Mathlib.Algebra.Group.Defs", + "import Mathlib.Data.Set.Intervals.Pi\nimport Mathlib.Data.Set.Pointwise.Basic\nimport Mathlib.Order.Filter.Interval\nimport Mathlib.Tactic.TFAE\nimport Mathlib.Tactic.NormNum\nimport Mathlib.Topology.Order.LeftRight\nimport Mathlib.Topology.Order.OrderClosed", + "import Mathlib.Order.Hom.Basic\nimport Mathlib.Topology.ContinuousFunction.Basic", + "import Mathlib.Topology.Algebra.Ring.Basic\nimport Mathlib.Topology.Algebra.MulAction\nimport Mathlib.Topology.Algebra.UniformGroup\nimport Mathlib.Topology.ContinuousFunction.Basic\nimport Mathlib.Topology.UniformSpace.UniformEmbedding\nimport Mathlib.Algebra.Algebra.Basic\nimport Mathlib.LinearAlgebra.Projection\nimport Mathlib.LinearAlgebra.Pi\nimport Mathlib.LinearAlgebra.Finsupp", + "import Mathlib.Topology.Algebra.Module.Basic\nimport Mathlib.LinearAlgebra.Multilinear.Basic", + "import Mathlib.LinearAlgebra.Alternating.Basic\nimport Mathlib.LinearAlgebra.BilinearMap\nimport Mathlib.Topology.Algebra.Module.Multilinear.Basic", + "import Mathlib.GroupTheory.Subgroup.Basic\nimport Mathlib.Topology.Algebra.OpenSubgroup\nimport Mathlib.Topology.Algebra.Ring.Basic", + "import Mathlib.Algebra.Ring.Prod\nimport Mathlib.RingTheory.Subring.Basic\nimport Mathlib.Topology.Algebra.Group.Basic", + "import Mathlib.Topology.Algebra.InfiniteSum.Defs\nimport Mathlib.Data.Fintype.BigOperators\nimport Mathlib.Topology.Algebra.Monoid", + "import Mathlib.GroupTheory.GroupAction.ConjAct\nimport Mathlib.GroupTheory.GroupAction.Quotient\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.Topology.Algebra.Monoid\nimport Mathlib.Topology.Algebra.Constructions", + "import Mathlib.Data.Nat.Interval\nimport Mathlib.Data.ENNReal.Real\nimport Mathlib.Topology.UniformSpace.Pi\nimport Mathlib.Topology.UniformSpace.UniformConvergence\nimport Mathlib.Topology.UniformSpace.UniformEmbedding", + "import Mathlib.Algebra.Function.Indicator\nimport Mathlib.Tactic.FinCases\nimport Mathlib.Topology.Sets.Closeds", + "import Mathlib.Order.Filter.Cofinite", + "import Mathlib.Topology.MetricSpace.ProperSpace", + "import Mathlib.Topology.MetricSpace.Basic", + "import Mathlib.Topology.FiberBundle.Trivialization", + "import Mathlib.Data.Set.UnionLift\nimport Mathlib.Topology.Homeomorph", + "import Mathlib.Algebra.GeomSum\nimport Mathlib.RingTheory.Ideal.Quotient", + "import Mathlib.Algebra.Associated\nimport Mathlib.RingTheory.Int.Basic\nimport Mathlib.Tactic.Ring\nimport Mathlib.Algebra.Star.Unitary", + "import Mathlib.Algebra.DirectSum.Algebra\nimport Mathlib.Analysis.Complex.UpperHalfPlane.FunctionsBoundedAtInfty\nimport Mathlib.Analysis.Complex.UpperHalfPlane.Manifold\nimport Mathlib.Geometry.Manifold.MFDeriv.SpecificFunctions\nimport Mathlib.NumberTheory.ModularForms.SlashInvariantForms", + "import Mathlib.NumberTheory.ModularForms.SlashInvariantForms\nimport Mathlib.NumberTheory.ModularForms.CongruenceSubgroups", + "import Mathlib.Data.Int.Parity\nimport Mathlib.RingTheory.DedekindDomain.IntegralClosure", + "import Mathlib.Algebra.GCDMonoid.Finset\nimport Mathlib.Algebra.GroupPower.Ring\nimport Mathlib.Data.Nat.Parity\nimport Mathlib.Data.Rat.Defs\nimport Mathlib.Tactic.Positivity.Basic\nimport Mathlib.Tactic.TFAE", + "import Mathlib.Analysis.PSeries\nimport Mathlib.NumberTheory.ArithmeticFunction\nimport Mathlib.Analysis.NormedSpace.FiniteDimension", + "import Mathlib.Init.Core\nimport Mathlib.RingTheory.Polynomial.Cyclotomic.Roots\nimport Mathlib.NumberTheory.NumberField.Basic\nimport Mathlib.FieldTheory.Galois", + "import Mathlib.Analysis.Calculus.MeanValue\nimport Mathlib.Analysis.Calculus.Deriv.Polynomial\nimport Mathlib.Data.Polynomial.DenomsClearable\nimport Mathlib.Data.Real.Irrational\nimport Mathlib.Topology.Algebra.Polynomial", + "import Mathlib.NumberTheory.LegendreSymbol.QuadraticChar.Basic", + "import Mathlib.Data.Fintype.Parity\nimport Mathlib.NumberTheory.LegendreSymbol.ZModChar\nimport Mathlib.FieldTheory.Finite.Basic", + "import Mathlib.Algebra.Periodic\nimport Mathlib.Data.ZMod.Units\nimport Mathlib.NumberTheory.LegendreSymbol.MulCharacter", + "import Mathlib.Analysis.Normed.Field.InfiniteSum\nimport Mathlib.Analysis.SpecificLimits.Normed\nimport Mathlib.NumberTheory.ArithmeticFunction\nimport Mathlib.NumberTheory.SmoothNumbers", + "import Lean.Meta.Tactic.Rewrite\nimport Std.Lean.Expr\nimport Std.Lean.Name\nimport Std.Data.Rat.Basic\nimport Std.Data.List.Basic\nimport Std.Lean.Name\nimport Std.Logic", + "import Mathlib.Lean.Meta", + "import Lean.Meta.AppBuilder\nimport Lean.Meta.Basic", + "import Mathlib.Data.Opposite\nimport Mathlib.Tactic.Cases", + "import Mathlib.Combinatorics.SimpleGraph.Init\nimport Mathlib.Data.Rel\nimport Mathlib.Data.Set.Finite\nimport Mathlib.Data.Sym.Sym2", + "import Mathlib.Algebra.GroupPower.Order\nimport Mathlib.Combinatorics.SimpleGraph.Clique\nimport Mathlib.Data.Finset.Sym\nimport Mathlib.Tactic.GCongr\nimport Mathlib.Tactic.Positivity", + "import Mathlib.Dynamics.FixedPoints.Basic\nimport Mathlib.GroupTheory.Perm.Option\nimport Mathlib.Logic.Equiv.Defs\nimport Mathlib.Logic.Equiv.Option", + "import Mathlib.Combinatorics.Hall.Finite\nimport Mathlib.CategoryTheory.CofilteredSystem\nimport Mathlib.Data.Rel" + ], + "working_file": "import Mathlib.MeasureTheory.Measure.GiryMonad\nimport Mathlib.Dynamics.Ergodic.MeasurePreserving\nimport Mathlib.MeasureTheory.Integral.Lebesgue\nimport Mathlib.MeasureTheory.Measure.OpenPos\nimport Mathlib.Analysis.Normed.Group.Basic\nimport Mathlib.MeasureTheory.Function.AEMeasurableSequence\nimport Mathlib.MeasureTheory.Group.Arithmetic\nimport Mathlib.MeasureTheory.Order.Lattice\nimport Mathlib.Topology.Instances.EReal\nimport Mathlib.Topology.MetricSpace.Thickening\nimport Mathlib.Topology.GDelta\nimport Mathlib.Topology.Order.Lattice\nimport Mathlib.Topology.Semicontinuous\nimport Mathlib.Analysis.SpecificLimits.Basic\nimport Mathlib.MeasureTheory.PiSystem\nimport Mathlib.Data.Countable.Basic\nimport Mathlib.Data.Fin.VecNotation\nimport Mathlib.MeasureTheory.Measure.Content\nimport Mathlib.MeasureTheory.Group.Prod\nimport Mathlib.Topology.Algebra.Group.Compact\nimport Mathlib.Dynamics.Ergodic.MeasurePreserving\nimport Mathlib.LinearAlgebra.Determinant\nimport Mathlib.LinearAlgebra.Matrix.Diagonal\nimport Mathlib.LinearAlgebra.Matrix.Transvection\nimport Mathlib.MeasureTheory.Constructions.Pi\nimport Mathlib.MeasureTheory.Measure.Stieltjes\nimport Mathlib.MeasureTheory.Measure.Haar.OfBasis\nimport Mathlib.Data.Finset.Update\nimport Mathlib.Data.Prod.TProd\nimport Mathlib.GroupTheory.Coset\nimport Mathlib.Logic.Equiv.Fin\nimport Mathlib.MeasureTheory.MeasurableSpace.Defs\nimport Mathlib.Order.Filter.SmallSets\nimport Mathlib.Order.LiminfLimsup\nimport Mathlib.Data.Set.UnionLift\nimport Mathlib.Analysis.NormedSpace.BoundedLinearMaps\nimport Mathlib.MeasureTheory.Measure.WithDensity\nimport Mathlib.MeasureTheory.Function.SimpleFuncDense\nimport Mathlib.Topology.Algebra.Module.FiniteDimension\nimport Mathlib.MeasureTheory.Function.AEEqFun.DomAct\nimport Mathlib.MeasureTheory.Function.LpSpace\nimport Mathlib.Analysis.SpecialFunctions.Pow.NNReal\nimport Mathlib.MeasureTheory.Constructions.BorelSpace.Complex\nimport Mathlib.MeasureTheory.Function.ConditionalExpectation.CondexpL1\nimport Mathlib.Analysis.NormedSpace.IndicatorFunction\nimport Mathlib.MeasureTheory.Function.EssSup\nimport Mathlib.MeasureTheory.Function.AEEqFun\nimport Mathlib.MeasureTheory.Function.SpecialFunctions.Basic\nimport Mathlib.Topology.Instances.ENNReal\nimport Mathlib.MeasureTheory.Measure.Dirac\nimport Mathlib.Probability.Notation\nimport Mathlib.Probability.Process.Stopping\nimport Mathlib.Probability.Independence.Kernel\nimport Mathlib.MeasureTheory.Integral.Bochner\nimport Mathlib.MeasureTheory.Measure.GiryMonad\nimport Mathlib.Algebra.Module.Hom\nimport Mathlib.Algebra.Module.Prod\nimport Mathlib.Algebra.Module.Submodule.Ker\nimport Mathlib.Data.Set.Finite\nimport Mathlib.Order.ConditionallyCompleteLattice.Basic\nimport Mathlib.LinearAlgebra.RootSystem.Defs\nimport Mathlib.LinearAlgebra.Matrix.Adjugate\nimport Mathlib.RingTheory.PolynomialAlgebra\nimport Mathlib.Algebra.AddTorsor\nimport Mathlib.GroupTheory.Perm.Sign\nimport Mathlib.Data.Fintype.Perm\nimport Mathlib.LinearAlgebra.Multilinear.Basis\nimport Mathlib.Data.Finsupp.Fintype\nimport Mathlib.LinearAlgebra.TensorProduct.Basis\nimport Mathlib.RingTheory.Finiteness\nimport Mathlib.LinearAlgebra.FreeModule.Basic\nimport Mathlib.Algebra.RingQuot\nimport Mathlib.LinearAlgebra.TensorAlgebra.Basic\nimport Mathlib.LinearAlgebra.QuadraticForm.Isometry\nimport Mathlib.LinearAlgebra.QuadraticForm.IsometryEquiv\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.GroupTheory.Congruence\nimport Mathlib.LinearAlgebra.Basic\nimport Mathlib.Tactic.SuppressCompilation\nimport Mathlib.LinearAlgebra.Matrix.Determinant\nimport Mathlib.LinearAlgebra.Matrix.SesquilinearForm\nimport Mathlib.LinearAlgebra.Matrix.Symmetric\nimport Mathlib.Algebra.Algebra.Basic\nimport Mathlib.Algebra.BigOperators.Order\nimport Mathlib.Data.Fintype.BigOperators\nimport Mathlib.Data.Fintype.Sort\nimport Mathlib.Data.List.FinRange\nimport Mathlib.LinearAlgebra.Pi\nimport Mathlib.LinearAlgebra.CliffordAlgebra.Basic\nimport Mathlib.LinearAlgebra.Alternating.Basic\nimport Mathlib.Algebra.Algebra.Spectrum\nimport Mathlib.LinearAlgebra.GeneralLinearGroup\nimport Mathlib.LinearAlgebra.FiniteDimensional\nimport Mathlib.Algebra.FreeAlgebra\nimport Mathlib.Algebra.RingQuot\nimport Mathlib.Algebra.TrivSqZeroExt\nimport Mathlib.Algebra.Algebra.Operations\nimport Mathlib.LinearAlgebra.Multilinear.Basic\nimport Mathlib.Algebra.Algebra.Tower\nimport Mathlib.LinearAlgebra.FiniteDimensional\nimport Mathlib.LinearAlgebra.LinearIndependent\nimport Mathlib.LinearAlgebra.FreeModule.Finite.Basic\nimport Mathlib.LinearAlgebra.Matrix.Charpoly.Coeff\nimport Mathlib.FieldTheory.Minpoly.Field\nimport Mathlib.Init.Logic\nimport Mathlib.Init.Function\nimport Mathlib.Init.Algebra.Classes\nimport Std.Util.LibraryNote\nimport Std.Tactic.Lint.Basic\nimport Mathlib.Init.Order.Defs\nimport Mathlib.Logic.Nontrivial.Defs\nimport Mathlib.Tactic.Attr.Register\nimport Mathlib.Data.Prod.Basic\nimport Mathlib.Data.Subtype\nimport Mathlib.Logic.Function.Basic\nimport Mathlib.Logic.Unique\nimport Mathlib.Data.Bool.Basic\nimport Mathlib.Data.Option.Defs\nimport Mathlib.Data.Prod.Basic\nimport Mathlib.Data.Sigma.Basic\nimport Mathlib.Data.Subtype\nimport Mathlib.Data.Sum.Basic\nimport Mathlib.Init.Data.Sigma.Basic\nimport Mathlib.Logic.Equiv.Defs\nimport Mathlib.Logic.Function.Conjugate\nimport Mathlib.Tactic.Lift\nimport Mathlib.Tactic.Convert\nimport Mathlib.Tactic.Contrapose\nimport Mathlib.Tactic.GeneralizeProofs\nimport Mathlib.Tactic.SimpRw\nimport Mathlib.Logic.Equiv.Nat\nimport Mathlib.Data.PNat.Basic\nimport Mathlib.Order.Directed\nimport Mathlib.Data.Countable.Defs\nimport Mathlib.Order.RelIso.Basic\nimport Mathlib.Data.Fin.Basic\nimport Mathlib.Logic.Small.Defs\nimport Mathlib.Logic.Equiv.Set\nimport Mathlib.Logic.Nonempty\nimport Mathlib.Init.Set\nimport Mathlib.Logic.Basic\nimport Mathlib.Data.Option.Basic\nimport Mathlib.Data.Prod.PProd\nimport Mathlib.Logic.Equiv.Basic\nimport Mathlib.Analysis.Calculus.TangentCone\nimport Mathlib.Analysis.NormedSpace.OperatorNorm.Asymptotics\nimport Mathlib.Analysis.Calculus.Deriv.Add\nimport Mathlib.Analysis.InnerProductSpace.Dual\nimport Mathlib.Analysis.Calculus.FDeriv.Basic\nimport Mathlib.Analysis.Calculus.Deriv.Basic\nimport Mathlib.Analysis.Calculus.ContDiff.Basic\nimport Mathlib.Analysis.NormedSpace.FiniteDimension\nimport Mathlib.Analysis.Calculus.Deriv.Comp\nimport Mathlib.Analysis.Calculus.Deriv.Add\nimport Mathlib.Analysis.Calculus.Deriv.Mul\nimport Mathlib.Analysis.Calculus.Deriv.Slope\nimport Mathlib.Analysis.Calculus.FDeriv.Basic\nimport Mathlib.Analysis.NormedSpace.OperatorNorm.NormedSpace\nimport Mathlib.Analysis.Calculus.ContDiff.Defs\nimport Mathlib.Analysis.Calculus.FDeriv.Add\nimport Mathlib.Analysis.Calculus.FDeriv.Mul\nimport Mathlib.Analysis.Calculus.Deriv.Inverse\nimport Mathlib.Algebra.DirectSum.Module\nimport Mathlib.Analysis.Complex.Basic\nimport Mathlib.Analysis.Convex.Uniform\nimport Mathlib.Analysis.NormedSpace.Completion\nimport Mathlib.Analysis.NormedSpace.BoundedLinearMaps\nimport Mathlib.Algebra.Algebra.NonUnitalSubalgebra\nimport Mathlib.Algebra.Algebra.Subalgebra.Basic\nimport Mathlib.Analysis.Normed.Group.Basic\nimport Mathlib.GroupTheory.OrderOfElement\nimport Mathlib.Topology.Instances.NNReal\nimport Mathlib.Topology.MetricSpace.DilationEquiv\nimport Mathlib.Algebra.Order.Group.TypeTags\nimport Mathlib.Analysis.Normed.Field.Basic\nimport Mathlib.Analysis.Normed.Group.Seminorm\nimport Mathlib.Order.LiminfLimsup\nimport Mathlib.Topology.Instances.Rat\nimport Mathlib.Topology.MetricSpace.Algebra\nimport Mathlib.Topology.MetricSpace.IsometricSMul\nimport Mathlib.Topology.Sequences\nimport Mathlib.Analysis.SpecialFunctions.Exp\nimport Mathlib.Data.Nat.Factorization.Basic\nimport Mathlib.Analysis.NormedSpace.Real\nimport Mathlib.Analysis.SpecialFunctions.Exp\nimport Mathlib.Tactic.Positivity.Core\nimport Mathlib.MeasureTheory.Integral.ExpDecay\nimport Mathlib.Analysis.SpecialFunctions.ImproperIntegrals\nimport Mathlib.Analysis.MellinTransform\nimport Mathlib.Analysis.Convex.Basic\nimport Mathlib.Analysis.Convex.Hull\nimport Mathlib.Analysis.NormedSpace.Basic\nimport Mathlib.Topology.Bornology.Absorbs\nimport Mathlib.Analysis.NormedSpace.Dual\nimport Mathlib.Analysis.NormedSpace.Star.Basic\nimport Mathlib.Analysis.Complex.Basic\nimport Mathlib.Analysis.InnerProductSpace.Adjoint\nimport Mathlib.Algebra.Star.Subalgebra\nimport Mathlib.Analysis.BoxIntegral.Partition.Filter\nimport Mathlib.Analysis.BoxIntegral.Partition.Measure\nimport Mathlib.Topology.UniformSpace.Compact\nimport Mathlib.Init.Data.Bool.Lemmas\nimport Mathlib.Algebra.BigOperators.Option\nimport Mathlib.Analysis.BoxIntegral.Box.Basic\nimport Mathlib.Data.Set.Pairwise.Lattice\nimport Mathlib.Data.Set.Intervals.Monotone\nimport Mathlib.Topology.MetricSpace.Basic\nimport Mathlib.Topology.MetricSpace.Bounded\nimport Mathlib.Topology.Order.MonotoneConvergence\nimport Mathlib.Data.Complex.Module\nimport Mathlib.Data.Complex.Order\nimport Mathlib.Data.Complex.Exponential\nimport Mathlib.Data.RCLike.Basic\nimport Mathlib.Topology.Algebra.InfiniteSum.Module\nimport Mathlib.Topology.Instances.RealVectorSpace\nimport Mathlib.Analysis.Complex.Circle\nimport Mathlib.Analysis.NormedSpace.BallAction\nimport Mathlib.Data.Fintype.Parity\nimport Mathlib.LinearAlgebra.Matrix.SpecialLinearGroup\nimport Mathlib.Analysis.Complex.Basic\nimport Mathlib.GroupTheory.GroupAction.Defs\nimport Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup\nimport Mathlib.Tactic.LinearCombination\nimport Mathlib.Algebra.GeomSum\nimport Mathlib.Order.Filter.Archimedean\nimport Mathlib.Order.Iterate\nimport Mathlib.Topology.Instances.ENNReal\nimport Mathlib.Topology.Algebra.Algebra\nimport Mathlib.Algebra.Order.Module.OrderedSMul\nimport Mathlib.Analysis.Convex.Star\nimport Mathlib.LinearAlgebra.AffineSpace.AffineSubspace\nimport Mathlib.Analysis.Convex.Hull\nimport Mathlib.LinearAlgebra.AffineSpace.Independent\nimport Mathlib.Analysis.Convex.Hull\nimport Mathlib.Analysis.Convex.Slope\nimport Mathlib.Analysis.SpecialFunctions.Pow.Real\nimport Mathlib.Tactic.LinearCombination\nimport Mathlib.Algebra.Algebra.Pi\nimport Mathlib.Algebra.Algebra.RestrictScalars\nimport Mathlib.Analysis.Normed.Field.Basic\nimport Mathlib.Analysis.Normed.MulAction\nimport Mathlib.Analysis.NormedSpace.OperatorNorm.NormedSpace\nimport Mathlib.Topology.Algebra.Module.Multilinear.Basic\nimport Mathlib.Algebra.Algebra.Tower\nimport Mathlib.Analysis.LocallyConvex.WithSeminorms\nimport Mathlib.Topology.Algebra.Module.StrongTopology\nimport Mathlib.Analysis.NormedSpace.LinearIsometry\nimport Mathlib.Analysis.NormedSpace.ContinuousLinearMap\nimport Mathlib.Tactic.SuppressCompilation\nimport Mathlib.Analysis.Normed.Group.Hom\nimport Mathlib.Analysis.NormedSpace.Basic\nimport Mathlib.Analysis.NormedSpace.LinearIsometry\nimport Mathlib.Algebra.Star.SelfAdjoint\nimport Mathlib.Algebra.Star.Subalgebra\nimport Mathlib.Algebra.Star.Unitary\nimport Mathlib.Topology.Algebra.Module.Star\nimport Mathlib.Analysis.Calculus.FormalMultilinearSeries\nimport Mathlib.Analysis.SpecificLimits.Normed\nimport Mathlib.Logic.Equiv.Fin\nimport Mathlib.Topology.Algebra.InfiniteSum.Module\nimport Mathlib.CategoryTheory.Sites.Sheaf\nimport Mathlib.Topology.Category.CompHaus.EffectiveEpi\nimport Mathlib.Data.Fin.VecNotation\nimport Mathlib.SetTheory.Cardinal.Basic\nimport Mathlib.ModelTheory.Syntax\nimport Mathlib.ModelTheory.Semantics\nimport Mathlib.ModelTheory.Algebra.Ring.Basic\nimport Mathlib.Algebra.Field.MinimalAxioms\nimport Mathlib.ModelTheory.Syntax\nimport Mathlib.ModelTheory.Semantics\nimport Mathlib.Algebra.Ring.Equiv\nimport Mathlib.Init.Control.Combinators\nimport Mathlib.Init.Function\nimport Mathlib.Tactic.CasesM\nimport Mathlib.Tactic.Attr.Core\nimport Mathlib.Logic.Equiv.Defs\nimport Mathlib.Data.Option.Defs\nimport Mathlib.Control.Functor\nimport Mathlib.Control.Bifunctor\nimport Mathlib.Control.Traversable.Basic\nimport Mathlib.Init.Order.LinearOrder\nimport Mathlib.Data.Prod.Basic\nimport Mathlib.Data.Subtype\nimport Mathlib.Tactic.Spread\nimport Mathlib.Tactic.Convert\nimport Mathlib.Tactic.SimpRw\nimport Mathlib.Tactic.Cases\nimport Mathlib.Order.Notation\nimport Mathlib.Logic.Equiv.Option\nimport Mathlib.Order.RelIso.Basic\nimport Mathlib.Order.Disjoint\nimport Mathlib.Order.WithBot\nimport Mathlib.Tactic.Monotonicity.Attr\nimport Mathlib.Util.AssertExists\nimport Mathlib.Data.SetLike.Basic\nimport Mathlib.Data.Set.Intervals.OrdConnected\nimport Mathlib.Data.Set.Intervals.OrderIso\nimport Mathlib.Data.Set.Lattice\nimport Mathlib.Order.PropInstances\nimport Mathlib.Data.Set.Finite\nimport Mathlib.Logic.Function.Iterate\nimport Mathlib.Init.Data.Int.Order\nimport Mathlib.Order.Compare\nimport Mathlib.Order.Max\nimport Mathlib.Order.RelClasses\nimport Mathlib.Tactic.Choose\nimport Mathlib.Order.CompleteLattice\nimport Mathlib.Order.Cover\nimport Mathlib.Order.Iterate\nimport Mathlib.Init.Algebra.Classes\nimport Mathlib.Data.FunLike.Basic\nimport Mathlib.Logic.Embedding.Basic\nimport Mathlib.Order.RelClasses\nimport Mathlib.Order.Atoms\nimport Mathlib.Order.OrderIsoNat\nimport Mathlib.Order.RelIso.Set\nimport Mathlib.Order.SupClosed\nimport Mathlib.Order.SupIndep\nimport Mathlib.Order.Zorn\nimport Mathlib.Data.Finset.Order\nimport Mathlib.Data.Set.Intervals.OrderIso\nimport Mathlib.Data.Finite.Set\nimport Mathlib.Tactic.TFAE\nimport Mathlib.Order.Bounds.Basic\nimport Mathlib.Order.WellFounded\nimport Mathlib.Data.Set.Image\nimport Mathlib.Data.Set.Intervals.Basic\nimport Mathlib.Data.Set.Lattice\nimport Mathlib.Data.Set.Intervals.Basic\nimport Mathlib.Data.Set.NAry\nimport Mathlib.Order.Directed\nimport Mathlib.Data.Sum.Order\nimport Mathlib.Order.InitialSeg\nimport Mathlib.SetTheory.Cardinal.Basic\nimport Mathlib.Tactic.PPWithUniv\nimport Mathlib.Data.Set.Lattice\nimport Mathlib.Logic.Small.Basic\nimport Mathlib.Logic.Function.OfArity\nimport Mathlib.Order.WellFounded\nimport Mathlib.Data.Int.Basic\nimport Mathlib.SetTheory.Game.PGame\nimport Mathlib.Tactic.Abel\nimport Mathlib.Algebra.Order.Hom.Monoid\nimport Mathlib.SetTheory.Game.Ordinal\nimport Mathlib.Algebra.Module.Basic\nimport Mathlib.Data.Fintype.BigOperators\nimport Mathlib.Data.Finsupp.Defs\nimport Mathlib.Data.Set.Countable\nimport Mathlib.Logic.Small.Set\nimport Mathlib.Order.ConditionallyCompleteLattice.Basic\nimport Mathlib.Order.SuccPred.CompleteLinearOrder\nimport Mathlib.SetTheory.Cardinal.SchroederBernstein\nimport Mathlib.Tactic.PPWithUniv\nimport Mathlib.Algebra.Group.Equiv.TypeTags\nimport Mathlib.Algebra.Module.Basic\nimport Mathlib.Algebra.Module.LinearMap.Basic\nimport Mathlib.Algebra.MonoidAlgebra.Basic\nimport Mathlib.LinearAlgebra.Dual\nimport Mathlib.LinearAlgebra.Contraction\nimport Mathlib.RingTheory.TensorProduct.Basic\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.CategoryTheory.SingleObj\nimport Mathlib.CategoryTheory.Limits.FunctorCategory\nimport Mathlib.CategoryTheory.Limits.Preserves.Basic\nimport Mathlib.CategoryTheory.Adjunction.Limits\nimport Mathlib.CategoryTheory.Conj\nimport Mathlib.Algebra.Homology.Opposite\nimport Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex\nimport Mathlib.RepresentationTheory.GroupCohomology.Resolution\nimport Mathlib.CategoryTheory.Limits.HasLimits\nimport Mathlib.CategoryTheory.Limits.Connected\nimport Mathlib.CategoryTheory.Limits.Constructions.Over.Products\nimport Mathlib.CategoryTheory.Limits.Constructions.Over.Connected\nimport Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers\nimport Mathlib.CategoryTheory.Limits.Constructions.Equalizers\nimport Mathlib.CategoryTheory.Limits.Shapes.RegularMono\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Preserves.Basic\nimport Mathlib.CategoryTheory.NatIso\nimport Mathlib.CategoryTheory.Limits.Constructions.Pullbacks\nimport Mathlib.CategoryTheory.Preadditive.Biproducts\nimport Mathlib.CategoryTheory.Limits.Shapes.Images\nimport Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers\nimport Mathlib.CategoryTheory.Abelian.NonPreadditive\nimport Mathlib.CategoryTheory.Subobject.MonoOver\nimport Mathlib.CategoryTheory.Skeletal\nimport Mathlib.CategoryTheory.ConcreteCategory.Basic\nimport Mathlib.Tactic.ApplyFun\nimport Mathlib.Tactic.CategoryTheory.Elementwise\nimport Mathlib.CategoryTheory.EqToHom\nimport Mathlib.CategoryTheory.Functor.Const\nimport Mathlib.CategoryTheory.Opposites\nimport Mathlib.Data.Prod.Basic\nimport Mathlib.CategoryTheory.CommSq\nimport Mathlib.Algebra.BigOperators.Basic\nimport Mathlib.Algebra.Group.Hom.Defs\nimport Mathlib.Algebra.Module.Basic\nimport Mathlib.CategoryTheory.Endomorphism\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Preadditive.Opposite\nimport Mathlib.Algebra.Category.ModuleCat.Basic\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.CategoryTheory.Functor.Category\nimport Mathlib.CategoryTheory.Functor.FullyFaithful\nimport Mathlib.CategoryTheory.Functor.ReflectsIso\nimport Mathlib.CategoryTheory.EqToHom\nimport Mathlib.CategoryTheory.NatIso\nimport Mathlib.CategoryTheory.Products.Basic\nimport Mathlib.Algebra.Group.Basic\nimport Mathlib.CategoryTheory.Limits.Preserves.Shapes.Zero\nimport Mathlib.CategoryTheory.Monoidal.End\nimport Mathlib.CategoryTheory.Monoidal.Discrete\nimport Mathlib.CategoryTheory.Equivalence\nimport Mathlib.CategoryTheory.FinCategory.Basic\nimport Mathlib.CategoryTheory.Limits.Cones\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.Adjunction.Basic\nimport Mathlib.CategoryTheory.Category.Preorder\nimport Mathlib.CategoryTheory.Category.ULift\nimport Mathlib.CategoryTheory.PEmpty\nimport Mathlib.CategoryTheory.Monoidal.Types.Symmetric\nimport Mathlib.CategoryTheory.Monoidal.Types.Coyoneda\nimport Mathlib.CategoryTheory.Monoidal.Center\nimport Mathlib.Tactic.ApplyFun\nimport Mathlib.CategoryTheory.Abelian.Basic\nimport Mathlib.CategoryTheory.EqToHom\nimport Mathlib.CategoryTheory.Iso\nimport Mathlib.CategoryTheory.Functor.Category\nimport Mathlib.CategoryTheory.EqToHom\nimport Mathlib.CategoryTheory.Whiskering\nimport Mathlib.CategoryTheory.Functor.FullyFaithful\nimport Mathlib.CategoryTheory.NatIso\nimport Mathlib.CategoryTheory.Extensive\nimport Mathlib.CategoryTheory.Sites.Coverage\nimport Mathlib.CategoryTheory.EffectiveEpi.Basic\nimport Mathlib.CategoryTheory.Adjunction.Limits\nimport Mathlib.CategoryTheory.Limits.Preserves.Shapes.Products\nimport Mathlib.CategoryTheory.Limits.Shapes.Biproducts\nimport Mathlib.CategoryTheory.Shift.Basic\nimport Mathlib.CategoryTheory.Types\nimport Mathlib.CategoryTheory.Functor.EpiMono\nimport Mathlib.CategoryTheory.Limits.Constructions.EpiMono\nimport Mathlib.CategoryTheory.Monoidal.Free.Coherence\nimport Mathlib.CategoryTheory.Monoidal.Discrete\nimport Mathlib.CategoryTheory.Monoidal.NaturalTransformation\nimport Mathlib.CategoryTheory.Monoidal.Opposite\nimport Mathlib.Tactic.CategoryTheory.Coherence\nimport Mathlib.CategoryTheory.CommSq\nimport Mathlib.CategoryTheory.Monoidal.Functor\nimport Mathlib.CategoryTheory.ChosenFiniteProducts\nimport Mathlib.CategoryTheory.Limits.Shapes.Types\nimport Mathlib.Logic.Equiv.Fin\nimport Mathlib.CategoryTheory.Monoidal.Functor\nimport Mathlib.CategoryTheory.Monoidal.Free.Coherence\nimport Mathlib.Tactic.CategoryTheory.Coherence\nimport Mathlib.CategoryTheory.Closed.Monoidal\nimport Mathlib.Tactic.ApplyFun\nimport Mathlib.CategoryTheory.Monoidal.Category\nimport Mathlib.CategoryTheory.Limits.Shapes.BinaryProducts\nimport Mathlib.CategoryTheory.PEmpty\nimport Mathlib.CategoryTheory.Preadditive.Basic\nimport Mathlib.Algebra.Module.LinearMap.Basic\nimport Mathlib.Algebra.Algebra.Basic\nimport Mathlib.CategoryTheory.Category.Init\nimport Mathlib.Combinatorics.Quiver.Basic\nimport Mathlib.Tactic.PPWithUniv\nimport Mathlib.Tactic.Common\nimport Mathlib.CategoryTheory.Limits.Shapes.Products\nimport Mathlib.Data.Fintype.Basic\nimport Mathlib.CategoryTheory.DiscreteCategory\nimport Mathlib.CategoryTheory.Opposites\nimport Mathlib.CategoryTheory.Category.ULift\nimport Mathlib.CategoryTheory.Category.Basic\nimport Mathlib.CategoryTheory.Comma.StructuredArrow\nimport Mathlib.CategoryTheory.Limits.Shapes.Equivalence\nimport Mathlib.CategoryTheory.FintypeCat\nimport Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers\nimport Mathlib.CategoryTheory.Limits.FintypeCat\nimport Mathlib.CategoryTheory.Limits.MonoCoprod\nimport Mathlib.CategoryTheory.Limits.Preserves.Shapes.Terminal\nimport Mathlib.CategoryTheory.Limits.Shapes.Types\nimport Mathlib.CategoryTheory.Limits.Shapes.ConcreteCategory\nimport Mathlib.CategoryTheory.Limits.Shapes.Diagonal\nimport Mathlib.CategoryTheory.SingleObj\nimport Mathlib.Data.Finite.Card\nimport Mathlib.CategoryTheory.Groupoid\nimport Mathlib.Combinatorics.Quiver.Basic\nimport Mathlib.LinearAlgebra.StdBasis\nimport Mathlib.Tactic.Linarith\nimport Mathlib.Data.Finset.PiAntidiagonal\nimport Mathlib.Data.MvPolynomial.Basic\nimport Mathlib.Tactic.FinCases\nimport Mathlib.Data.Nat.Choose.Sum\nimport Mathlib.LinearAlgebra.Finsupp\nimport Mathlib.Algebra.GroupPower.Order\nimport Mathlib.RingTheory.Ideal.Operations\nimport Mathlib.Tactic.TFAE\nimport Mathlib.RingTheory.Adjoin.Basic\nimport Mathlib.Algebra.Ring.Equiv\nimport Mathlib.Algebra.Ring.Prod\nimport Mathlib.Data.Set.Finite\nimport Mathlib.GroupTheory.Submonoid.Membership\nimport Mathlib.GroupTheory.Subsemigroup.Membership\nimport Mathlib.GroupTheory.Subsemigroup.Centralizer\nimport Mathlib.Algebra.EuclideanDomain.Basic\nimport Mathlib.Data.Nat.Factors\nimport Mathlib.RingTheory.Coprime.Basic\nimport Mathlib.RingTheory.PrincipalIdealDomain\nimport Mathlib.Algebra.CharP.ExpChar\nimport Mathlib.Algebra.GeomSum\nimport Mathlib.Data.MvPolynomial.CommRing\nimport Mathlib.Data.MvPolynomial.Equiv\nimport Mathlib.RingTheory.Polynomial.Content\nimport Mathlib.RingTheory.UniqueFactorizationDomain\nimport Mathlib.Algebra.NeZero\nimport Mathlib.Algebra.Polynomial.BigOperators\nimport Mathlib.RingTheory.RootsOfUnity.Complex\nimport Mathlib.Data.Polynomial.Lifts\nimport Mathlib.Data.Polynomial.Splits\nimport Mathlib.FieldTheory.RatFunc\nimport Mathlib.NumberTheory.ArithmeticFunction\nimport Mathlib.RingTheory.RootsOfUnity.Basic\nimport Mathlib.Data.Polynomial.Derivative\nimport Mathlib.Data.Nat.Parity\nimport Mathlib.Data.Nat.Factorial.DoubleFactorial\nimport Mathlib.RingTheory.EisensteinCriterion\nimport Mathlib.RingTheory.Polynomial.ScaleRoots\nimport Mathlib.Algebra.GroupPower.Ring\nimport Mathlib.Algebra.Ring.Divisibility.Basic\nimport Mathlib.Algebra.Ring.Hom.Defs\nimport Mathlib.GroupTheory.GroupAction.Units\nimport Mathlib.Logic.Basic\nimport Mathlib.Tactic.Ring\nimport Mathlib.RingTheory.Noetherian\nimport Mathlib.Algebra.DirectSum.Module\nimport Mathlib.Algebra.DirectSum.Finsupp\nimport Mathlib.Algebra.Module.Projective\nimport Mathlib.Algebra.Module.Injective\nimport Mathlib.Algebra.Module.CharacterModule\nimport Mathlib.LinearAlgebra.DirectSum.TensorProduct\nimport Mathlib.LinearAlgebra.FreeModule.Basic\nimport Mathlib.Algebra.Module.Projective\nimport Mathlib.GroupTheory.Subgroup.Basic\nimport Mathlib.RingTheory.Subsemiring.Basic\nimport Mathlib.Algebra.Algebra.Operations\nimport Mathlib.Algebra.Algebra.Subalgebra.Tower\nimport Mathlib.LinearAlgebra.Prod\nimport Mathlib.LinearAlgebra.Finsupp\nimport Mathlib.Algebra.Module.Basic\nimport Mathlib.Algebra.Ring.Equiv\nimport Mathlib.Algebra.Ring.Prod\nimport Mathlib.Algebra.GroupRingAction.Subobjects\nimport Mathlib.Data.Set.Finite\nimport Mathlib.GroupTheory.Submonoid.Centralizer\nimport Mathlib.GroupTheory.Submonoid.Membership\nimport Mathlib.RingTheory.NonUnitalSubsemiring.Basic\nimport Mathlib.GroupTheory.MonoidLocalization\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\nimport Mathlib.RingTheory.OreLocalization.OreSet\nimport Mathlib.Tactic.NoncommRing\nimport Mathlib.Algebra.Function.Support\nimport Mathlib.Order.WellFoundedSet\nimport Mathlib.RingTheory.Ideal.Over\nimport Mathlib.RingTheory.Polynomial.RationalRoot\nimport Mathlib.Algebra.CharP.Basic\nimport Mathlib.Data.Polynomial.AlgebraMap\nimport Mathlib.Data.MvPolynomial.Degrees\nimport Mathlib.LinearAlgebra.FinsuppVectorSpace\nimport Mathlib.LinearAlgebra.FreeModule.Finite.Basic\nimport Mathlib.Algebra.DirectSum.Algebra\nimport Mathlib.Algebra.DirectSum.Decomposition\nimport Mathlib.Algebra.DirectSum.Internal\nimport Mathlib.Algebra.DirectSum.Ring\nimport Mathlib.Algebra.Algebra.Tower\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\nimport Mathlib.GroupTheory.MonoidLocalization\nimport Mathlib.RingTheory.Ideal.Basic\nimport Mathlib.GroupTheory.GroupAction.Ring\nimport Mathlib.Init.Data.Int.CompLemmas\nimport Mathlib.RingTheory.UniqueFactorizationDomain\nimport Mathlib.RingTheory.Localization.Basic\nimport Mathlib.Algebra.CharP.Two\nimport Mathlib.Algebra.CharP.Reduced\nimport Mathlib.Algebra.NeZero\nimport Mathlib.Data.Polynomial.RingDivision\nimport Mathlib.GroupTheory.SpecificGroups.Cyclic\nimport Mathlib.NumberTheory.Divisors\nimport Mathlib.RingTheory.IntegralDomain\nimport Mathlib.Tactic.Zify\nimport Mathlib.LinearAlgebra.FiniteDimensional\nimport Mathlib.LinearAlgebra.TensorProduct.Tower\nimport Mathlib.RingTheory.Adjoin.Basic\nimport Mathlib.LinearAlgebra.DirectSum.Finsupp\nimport Mathlib.Data.MvPolynomial.Counit\nimport Mathlib.Data.MvPolynomial.Invertible\nimport Mathlib.RingTheory.WittVector.Defs\nimport Mathlib.RingTheory.MvPowerSeries.Basic\nimport Mathlib.Data.Polynomial.Basic\nimport Mathlib.Data.Polynomial.AlgebraMap\nimport Mathlib.RingTheory.PrincipalIdealDomain\nimport Mathlib.RingTheory.Ideal.LocalRing\nimport Mathlib.RingTheory.Valuation.PrimeMultiplicity\nimport Mathlib.LinearAlgebra.AdicCompletion\nimport Mathlib.GroupTheory.Subgroup.Basic\nimport Mathlib.RingTheory.NonUnitalSubsemiring.Basic\nimport Mathlib.RingTheory.Localization.Integer\nimport Mathlib.RingTheory.Localization.Submodule\nimport Mathlib.Algebra.Group.Conj\nimport Mathlib.Algebra.Group.Pi.Lemmas\nimport Mathlib.Data.Set.Image\nimport Mathlib.GroupTheory.Submonoid.Centralizer\nimport Mathlib.Order.Atoms\nimport Mathlib.Tactic.ApplyFun\nimport Mathlib.Algebra.Group.Prod\nimport Mathlib.Algebra.Group.Units.Equiv\nimport Mathlib.Algebra.GroupPower.IterateHom\nimport Mathlib.Logic.Equiv.Set\nimport Mathlib.Algebra.Module.BigOperators\nimport Mathlib.Data.Fintype.Perm\nimport Mathlib.GroupTheory.Perm.Finite\nimport Mathlib.GroupTheory.Perm.List\nimport Mathlib.Algebra.Group.Hom.Defs\nimport Mathlib.Algebra.Group.Units\nimport Mathlib.GroupTheory.Subsemigroup.Basic\nimport Mathlib.Algebra.PUnitInstances\nimport Mathlib.GroupTheory.Subgroup.Basic\nimport Mathlib.GroupTheory.Congruence\nimport Mathlib.GroupTheory.Submonoid.Membership\nimport Mathlib.Data.Fintype.Card\nimport Mathlib.GroupTheory.GroupAction.Defs\nimport Mathlib.GroupTheory.GroupAction.Group\nimport Mathlib.Data.Setoid.Basic\nimport Mathlib.Data.Set.Pointwise.SMul\nimport Mathlib.GroupTheory.Subgroup.Basic\nimport Mathlib.Algebra.Group.Opposite\nimport Mathlib.Algebra.Group.Pi.Lemmas\nimport Mathlib.GroupTheory.GroupAction.Defs\nimport Mathlib.Algebra.Group.Hom.Defs\nimport Mathlib.Data.Set.Lattice\nimport Mathlib.Data.SetLike.Basic\nimport Mathlib.Data.Fintype.Basic\nimport Mathlib.Data.List.Sublists\nimport Mathlib.Data.List.InsertNth\nimport Mathlib.GroupTheory.Subgroup.Basic\nimport Mathlib.Algebra.Group.TypeTags\nimport Mathlib.Algebra.Ring.Defs\nimport Mathlib.Data.Int.Cast.Basic\nimport Mathlib.Order.Monotone.Basic\nimport Mathlib.Data.Nat.Order.Basic\nimport Mathlib.Data.Int.Basic\nimport Mathlib.Algebra.Order.Group.Abs\nimport Mathlib.Algebra.Order.Ring.CharZero\nimport Mathlib.Algebra.Divisibility.Basic\nimport Mathlib.Init.Data.Nat.Lemmas\nimport Mathlib.Data.Int.Cast.Defs\nimport Mathlib.Algebra.Group.Basic\nimport Mathlib.Data.Int.Order.Basic\nimport Mathlib.Data.Nat.Cast.Order\nimport Mathlib.Algebra.Ring.Divisibility.Basic\nimport Mathlib.Data.DList.Defs\nimport Mathlib.Tactic.TypeStar\nimport Mathlib.Mathport.Rename\nimport Mathlib.Data.Nat.SuccPred\nimport Mathlib.Algebra.CharZero.Lemmas\nimport Mathlib.Algebra.Order.Sub.WithTop\nimport Mathlib.Algebra.Order.Ring.WithTop\nimport Mathlib.Data.Real.Sqrt\nimport Mathlib.Analysis.NormedSpace.Star.Basic\nimport Mathlib.Analysis.NormedSpace.ContinuousLinearMap\nimport Mathlib.Analysis.NormedSpace.Basic\nimport Mathlib.Init.ZeroOne\nimport Mathlib.Data.Set.Defs\nimport Mathlib.Order.Basic\nimport Mathlib.Order.SymmDiff\nimport Mathlib.Tactic.Tauto\nimport Mathlib.Tactic.ByContra\nimport Mathlib.Util.Delaborators\nimport Mathlib.Data.Set.Function\nimport Mathlib.Logic.Relation\nimport Mathlib.Logic.Pairwise\nimport Mathlib.Algebra.Group.Equiv.Basic\nimport Mathlib.Algebra.Group.Units.Hom\nimport Mathlib.Algebra.GroupPower.Basic\nimport Mathlib.Algebra.GroupWithZero.Basic\nimport Mathlib.Algebra.Opposites\nimport Mathlib.Data.Nat.Order.Basic\nimport Mathlib.Data.Set.Lattice\nimport Mathlib.Tactic.Common\nimport Mathlib.Order.MinMax\nimport Mathlib.Data.Set.Basic\nimport Mathlib.Tactic.Says\nimport Mathlib.Data.List.Lex\nimport Mathlib.Data.Char\nimport Mathlib.Logic.Function.Basic\nimport Mathlib.Tactic.MkIffOfInductiveProp\nimport Mathlib.Data.PNat.Defs\nimport Mathlib.Data.Nat.Bits\nimport Mathlib.Data.Nat.Order.Basic\nimport Mathlib.Data.Set.Basic\nimport Mathlib.Algebra.GroupWithZero.Divisibility\nimport Mathlib.Algebra.Order.Positive.Ring\nimport Mathlib.Order.Hom.Basic\nimport Mathlib.Data.W.Basic\nimport Mathlib.Control.Functor.Multivariate\nimport Mathlib.Data.PFunctor.Univariate.Basic\nimport Mathlib.Init.Function\nimport Mathlib.Logic.Function.Basic\nimport Mathlib.Tactic.Inhabit\nimport Mathlib.Algebra.Module.LinearMap.Basic\nimport Mathlib.Algebra.BigOperators.Basic\nimport Mathlib.Data.Set.Finite\nimport Mathlib.GroupTheory.Submonoid.Membership\nimport Mathlib.GroupTheory.GroupAction.BigOperators\nimport Mathlib.Data.Finset.Preimage\nimport Lean.Linter.Deprecated\nimport Mathlib.Mathport.Rename\nimport Mathlib.Init.Data.Nat.Bitwise\nimport Mathlib.Init.Data.Int.Basic\nimport Mathlib.Init.ZeroOne\nimport Mathlib.Logic.Equiv.List\nimport Mathlib.Init.Function\nimport Mathlib.Logic.Function.Basic\nimport Mathlib.Algebra.Algebra.Tower\nimport Mathlib.Algebra.GroupPower.Ring\nimport Mathlib.Algebra.Regular.Pow\nimport Mathlib.Algebra.MonoidAlgebra.Support\nimport Mathlib.Data.Finsupp.Antidiagonal\nimport Mathlib.Order.SymmDiff\nimport Mathlib.RingTheory.Adjoin.Basic\nimport Mathlib.Control.Traversable.Equiv\nimport Mathlib.Control.Traversable.Instances\nimport Std.Data.LazyList\nimport Mathlib.Lean.Thunk\nimport Mathlib.Logic.Relation\nimport Mathlib.Order.GaloisConnection\nimport Mathlib.Data.Vector\nimport Mathlib.Data.List.Nodup\nimport Mathlib.Data.List.OfFn\nimport Mathlib.Data.List.InsertNth\nimport Mathlib.Control.Applicative\nimport Mathlib.Control.Traversable.Basic\nimport Mathlib.Algebra.GroupPower.Ring\nimport Mathlib.Algebra.MonoidAlgebra.Basic\nimport Mathlib.Data.Finset.Sort\nimport Mathlib.RingTheory.Finiteness\nimport Mathlib.Data.Polynomial.AlgebraMap\nimport Std.Tactic.Alias\nimport Mathlib.Algebra.BigOperators.Finsupp\nimport Mathlib.Algebra.Regular.SMul\nimport Mathlib.Data.Finset.Preimage\nimport Mathlib.Data.Rat.BigOperators\nimport Mathlib.GroupTheory.GroupAction.Hom\nimport Mathlib.Data.Set.Basic\nimport Mathlib.Data.Finset.Attr\nimport Mathlib.Data.Multiset.Bind\nimport Mathlib.Data.Multiset.FinsetOps\nimport Mathlib.Data.Set.Lattice\nimport Mathlib.Order.Cover\nimport Mathlib.Order.LocallyFinite\nimport Mathlib.Data.Set.Intervals.Monoid\nimport Mathlib.Algebra.Group.TypeTags\nimport Mathlib.Algebra.Ring.Defs\nimport Mathlib.Algebra.GroupWithZero.Defs\nimport Mathlib.Algebra.Order.Monoid.WithZero\nimport Mathlib.Algebra.Order.Ring.Canonical\nimport Mathlib.Data.Nat.Basic\nimport Mathlib.Data.Nat.Defs\nimport Mathlib.Tactic.GCongr.Core\nimport Mathlib.Tactic.Common\nimport Mathlib.Tactic.Monotonicity.Attr\nimport Mathlib.Algebra.GroupPower.Basic\nimport Mathlib.Algebra.GroupWithZero.Divisibility\nimport Mathlib.Data.Nat.Order.Lemmas\nimport Mathlib.Tactic.NthRewrite\nimport Mathlib.Algebra.Divisibility.Basic\nimport Mathlib.Algebra.Group.Equiv.Basic\nimport Mathlib.Algebra.Group.TypeTags\nimport Mathlib.Algebra.Ring.Hom.Defs\nimport Mathlib.Data.Nat.Basic\nimport Mathlib.Init.Data.Nat.Lemmas\nimport Mathlib.Init.Data.Nat.Bitwise\nimport Mathlib.Data.Nat.GCD.Basic\nimport Mathlib.Logic.Function.Iterate\nimport Mathlib.Data.Finset.NatAntidiagonal\nimport Mathlib.Algebra.BigOperators.Basic\nimport Mathlib.Tactic.Ring\nimport Mathlib.Tactic.Zify\nimport Mathlib.Data.Nat.Factorial.Basic\nimport Mathlib.Order.Monotone.Basic\nimport Mathlib.Algebra.BigOperators.Finsupp\nimport Mathlib.Data.Finsupp.Multiset\nimport Mathlib.Data.Nat.PrimeFin\nimport Mathlib.NumberTheory.Padics.PadicVal\nimport Mathlib.Data.Nat.GCD.BigOperators\nimport Mathlib.Data.Nat.Interval\nimport Mathlib.Tactic.IntervalCases\nimport Mathlib.Algebra.GroupPower.Order\nimport Mathlib.Data.Set.Basic\nimport Mathlib.Tactic.Monotonicity.Attr\nimport Mathlib.Tactic.SetLike\nimport Mathlib.Algebra.NeZero\nimport Mathlib.Order.RelIso.Basic\nimport Mathlib.Data.Nat.Order.Basic\nimport Mathlib.Order.Hom.Set\nimport Std.Data.Fin.Lemmas\nimport Mathlib.Data.Fin.OrderHom\nimport Mathlib.Data.Pi.Lex\nimport Mathlib.Data.Set.Intervals.Basic\nimport Mathlib.Algebra.Star.Basic\nimport Mathlib.Algebra.Order.CauSeq.Completion\nimport Mathlib.Algebra.CharP.Basic\nimport Mathlib.RingTheory.Ideal.Operations\nimport Mathlib.Data.Fintype.Units\nimport Mathlib.Data.Nat.Parity\nimport Mathlib.Tactic.FinCases\nimport Mathlib.Logic.Function.Basic\nimport Mathlib.Util.CompileInductive\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Algebra.Pi\nimport Mathlib.Algebra.BigOperators.Pi\nimport Mathlib.Algebra.BigOperators.Ring\nimport Mathlib.Algebra.BigOperators.RingEquiv\nimport Mathlib.Algebra.Module.LinearMap.Basic\nimport Mathlib.Algebra.Module.Pi\nimport Mathlib.Algebra.Star.BigOperators\nimport Mathlib.Algebra.Star.Module\nimport Mathlib.Algebra.Star.Pi\nimport Mathlib.Data.Fintype.BigOperators\nimport Mathlib.GroupTheory.GroupAction.BigOperators\nimport Mathlib.Init.Data.Nat.Lemmas\nimport Mathlib.Init.Function\nimport Mathlib.Data.Semiquot\nimport Mathlib.Data.Nat.Size\nimport Mathlib.Tactic.Ring.RingNF\nimport Mathlib.Data.Set.Card\nimport Mathlib.Order.Minimal\nimport Mathlib.Data.Matroid.Init\nimport Mathlib.Data.Set.List\nimport Mathlib.Data.List.Perm\nimport Mathlib.Init.Quot -- Porting note: added import\nimport Mathlib.Order.Hom.Basic\nimport Mathlib.Mathport.Rename\nimport Mathlib.Data.PFunctor.Univariate.M\nimport Mathlib.Data.PFunctor.Multivariate.Basic\nimport Mathlib.Init.Control.Combinators\nimport Mathlib.Data.Option.Defs\nimport Mathlib.Logic.IsEmpty\nimport Mathlib.Logic.Relator\nimport Mathlib.Util.CompileInductive\nimport Aesop\nimport Mathlib.Algebra.Order.Ring.WithTop\nimport Mathlib.Algebra.Order.Sub.WithTop\nimport Mathlib.Data.Real.NNReal\nimport Mathlib.Data.Set.Intervals.WithBotTop\nimport Mathlib.Data.Bool.Basic\nimport Mathlib.Data.Nat.Defs\nimport Mathlib.Data.Option.Basic\nimport Mathlib.Data.List.Defs\nimport Mathlib.Init.Data.List.Basic\nimport Mathlib.Init.Data.List.Instances\nimport Mathlib.Init.Data.List.Lemmas\nimport Mathlib.Logic.Unique\nimport Mathlib.Order.Basic\nimport Std.Data.List.Lemmas\nimport Mathlib.Tactic.Common\nimport Mathlib.Logic.Equiv.Nat\nimport Mathlib.Logic.Equiv.Fin\nimport Mathlib.Data.Countable.Defs\nimport Mathlib.Data.Multiset.Basic\nimport Mathlib.Data.Vector.Basic\nimport Mathlib.Data.Setoid.Basic\nimport Mathlib.Tactic.ApplyFun\nimport Mathlib.Init.Align\nimport Mathlib.Data.Fintype.Powerset\nimport Mathlib.Data.Fintype.Prod\nimport Mathlib.Data.Fintype.Sigma\nimport Mathlib.Data.Fintype.Sum\nimport Mathlib.Data.Fintype.Vector\nimport Mathlib.Algebra.CharZero.Lemmas\nimport Mathlib.Algebra.GroupPower.Ring\nimport Mathlib.Algebra.GroupWithZero.Bitwise\nimport Mathlib.Data.Real.Basic\nimport Mathlib.Data.Set.Image\nimport Mathlib.Algebra.Ring.Hom.Defs -- FIXME: This import is bogus\nimport Mathlib.Data.Finset.Image\nimport Mathlib.Data.Fin.OrderHom\nimport Mathlib.Algebra.Category.Ring.FilteredColimits\nimport Mathlib.Geometry.RingedSpace.SheafedSpace\nimport Mathlib.Topology.Sheaves.Stalks\nimport Mathlib.Algebra.Category.Ring.Colimits\nimport Mathlib.Algebra.Category.Ring.Limits\nimport Mathlib.Analysis.InnerProductSpace.Projection\nimport Mathlib.Geometry.Euclidean.PerpBisector\nimport Mathlib.Algebra.QuadraticDiscriminant\nimport Mathlib.Analysis.Convex.StrictConvexBetween\nimport Mathlib.Geometry.Euclidean.Basic\nimport Mathlib.Analysis.InnerProductSpace.Basic\nimport Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse\nimport Mathlib.Analysis.InnerProductSpace.TwoDim\nimport Mathlib.Geometry.Euclidean.Angle.Unoriented.Basic\nimport Mathlib.Analysis.Normed.Group.AddTorsor\nimport Mathlib.Analysis.InnerProductSpace.Basic\nimport Mathlib.Geometry.Manifold.MFDeriv.Defs\nimport Mathlib.Geometry.Manifold.ContMDiff.Defs\nimport Mathlib.Geometry.Manifold.LocalInvariantProperties\nimport Mathlib.Topology.Sheaves.LocalPredicate\nimport Mathlib.Geometry.Manifold.ContMDiff.Atlas\nimport Mathlib.Geometry.Manifold.VectorBundle.FiberwiseLinear\nimport Mathlib.Topology.VectorBundle.Constructions\nimport Mathlib.Data.Seq.Seq\nimport Mathlib.Algebra.Field.Defs\nimport Mathlib.Algebra.Order.Floor\nimport Mathlib.Algebra.ContinuedFractions.Basic\nimport Mathlib.CategoryTheory.Limits.Preserves.Shapes.Zero\nimport Mathlib.Algebra.Group.Basic\nimport Mathlib.Algebra.Group.Hom.Defs\nimport Mathlib.Algebra.GroupWithZero.NeZero\nimport Mathlib.Algebra.Opposites\nimport Mathlib.Algebra.Ring.Defs\nimport Mathlib.Algebra.Divisibility.Basic\nimport Mathlib.Algebra.Group.Units.Hom\nimport Mathlib.Algebra.GroupWithZero.InjSurj\nimport Mathlib.Algebra.Ring.Hom.Defs\nimport Mathlib.Data.Set.Basic\nimport Mathlib.Algebra.Divisibility.Basic\nimport Mathlib.Algebra.Group.Equiv.Basic\nimport Mathlib.Algebra.Ring.Defs\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.Ring.Regular\nimport Mathlib.Tactic.Common\nimport Mathlib.Algebra.BigOperators.Multiset.Lemmas\nimport Mathlib.Algebra.BigOperators.Multiset.Order\nimport Mathlib.Algebra.Function.Indicator\nimport Mathlib.Algebra.Ring.Opposite\nimport Mathlib.Data.Finset.Powerset\nimport Mathlib.Data.Finset.Preimage\nimport Mathlib.Data.Finset.Sigma\nimport Mathlib.Data.Finset.Sum\nimport Mathlib.Data.Fintype.Pi\nimport Mathlib.Data.Int.Cast.Lemmas\nimport Mathlib.Data.Set.Image\nimport Mathlib.Algebra.BigOperators.List.Defs\nimport Mathlib.Data.List.Forall2\nimport Mathlib.Algebra.Divisibility.Basic\nimport Mathlib.Algebra.Ring.Commute\nimport Mathlib.Data.Nat.Order.Basic\nimport Mathlib.Data.Int.Basic\nimport Mathlib.Algebra.Group.Hom.Basic\nimport Mathlib.Algebra.GroupPower.Hom\nimport Mathlib.Algebra.BigOperators.List.Basic\nimport Mathlib.Data.Multiset.Basic\nimport Mathlib.Algebra.CharZero.Lemmas\nimport Mathlib.Algebra.Module.Submodule.Ker\nimport Mathlib.Algebra.Module.Submodule.RestrictScalars\nimport Mathlib.Algebra.Module.ULift\nimport Mathlib.RingTheory.Subring.Basic\nimport Mathlib.Algebra.Algebra.Basic\nimport Mathlib.Data.Set.UnionLift\nimport Mathlib.LinearAlgebra.Finsupp\nimport Mathlib.RingTheory.Ideal.Operations\nimport Mathlib.Algebra.Order.Monoid.Defs\nimport Mathlib.Algebra.Group.InjSurj\nimport Mathlib.Order.Hom.Basic\nimport Mathlib.Logic.Basic\nimport Mathlib.Tactic.Positivity.Basic\nimport Mathlib.Algebra.Order.AbsoluteValue\nimport Mathlib.Algebra.Order.Field.Basic\nimport Mathlib.Algebra.Order.Group.MinMax\nimport Mathlib.Algebra.Ring.Pi\nimport Mathlib.GroupTheory.GroupAction.Pi\nimport Mathlib.GroupTheory.GroupAction.Ring\nimport Mathlib.Init.Align\nimport Mathlib.Tactic.GCongr\nimport Mathlib.Tactic.Ring\nimport Mathlib.Algebra.Group.Equiv.Basic\nimport Mathlib.Algebra.Ring.Basic\nimport Mathlib.Algebra.Order.Sub.Defs\nimport Mathlib.Order.Hom.Basic\nimport Mathlib.Algebra.Field.Basic\nimport Mathlib.Algebra.GroupWithZero.Units.Equiv\nimport Mathlib.Algebra.Order.Field.Defs\nimport Mathlib.Algebra.Order.Ring.Abs\nimport Mathlib.Order.Bounds.OrderIso\nimport Mathlib.Tactic.Positivity.Core\nimport Mathlib.Algebra.Order.Field.Canonical.Defs\nimport Mathlib.Algebra.Field.Defs\nimport Mathlib.Algebra.GroupWithZero.Units.Lemmas\nimport Mathlib.Algebra.Ring.Commute\nimport Mathlib.Algebra.Ring.Hom.Defs\nimport Mathlib.Algebra.Invertible.GroupWithZero\nimport Mathlib.Algebra.Group.Commute.Units\nimport Mathlib.Algebra.Group.Hom.Defs\nimport Mathlib.Algebra.Group.Units\nimport Mathlib.Algebra.GroupPower.Basic\nimport Mathlib.Algebra.GroupWithZero.Units.Basic\nimport Mathlib.Algebra.Ring.Defs\nimport Mathlib.Data.Bracket\nimport Mathlib.LinearAlgebra.Basic\nimport Mathlib.Algebra.Ring.Divisibility.Lemmas\nimport Mathlib.Algebra.Lie.Nilpotent\nimport Mathlib.Algebra.Lie.Engel\nimport Mathlib.LinearAlgebra.Eigenspace.Triangularizable\nimport Mathlib.RingTheory.Artinian\nimport Mathlib.LinearAlgebra.Trace\nimport Mathlib.LinearAlgebra.FreeModule.PID\nimport Mathlib.Data.DFinsupp.Basic\nimport Mathlib.GroupTheory.Submonoid.Operations\nimport Mathlib.Algebra.GroupWithZero.Units.Lemmas\nimport Mathlib.Algebra.Ring.Equiv\nimport Mathlib.GroupTheory.GroupAction.Group\nimport Mathlib.RingTheory.UniqueFactorizationDomain\nimport Mathlib.Algebra.GroupPower.Basic\nimport Mathlib.Algebra.Group.Hom.Defs\nimport Mathlib.Algebra.BigOperators.List.Basic\nimport Mathlib.GroupTheory.GroupAction.Defs\nimport Mathlib.Algebra.Module.Basic\nimport Mathlib.Algebra.Order.Archimedean\nimport Mathlib.Algebra.Order.Group.Instances\nimport Mathlib.Data.Int.ModEq\nimport Mathlib.Data.Nat.Multiplicity\nimport Mathlib.Data.Nat.Choose.Sum\nimport Mathlib.Data.Nat.Cast.Prod\nimport Mathlib.Algebra.Group.ULift\nimport Mathlib.GroupTheory.OrderOfElement\nimport Mathlib.Algebra.Lie.OfAssociative\nimport Mathlib.Algebra.Category.MonCat.Basic\nimport Mathlib.CategoryTheory.Endomorphism\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.CategoryTheory.Conj\nimport Mathlib.CategoryTheory.Linear.Basic\nimport Mathlib.CategoryTheory.Preadditive.AdditiveFunctor\nimport Mathlib.LinearAlgebra.Basic\nimport Mathlib.Algebra.Category.ModuleCat.Basic\nimport Mathlib.LinearAlgebra.TensorProduct.Basic\nimport Mathlib.CategoryTheory.Monoidal.Linear\nimport Mathlib.Algebra.Algebra.Subalgebra.Basic\nimport Mathlib.Algebra.FreeAlgebra\nimport Mathlib.Algebra.Category.Ring.Basic\nimport Mathlib.Algebra.Category.ModuleCat.Basic\nimport Mathlib.CategoryTheory.ConcreteCategory.BundledHom\nimport Mathlib.Algebra.PUnitInstances\nimport Mathlib.CategoryTheory.Functor.ReflectsIso\nimport Mathlib.Algebra.PEmptyInstances\nimport Mathlib.Algebra.Group.Equiv.Basic\nimport Mathlib.CategoryTheory.ConcreteCategory.BundledHom\nimport Mathlib.CategoryTheory.Functor.ReflectsIso\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.CategoryTheory.ConcreteCategory.ReflectsIso\nimport Mathlib.Algebra.Ring.Equiv\nimport Mathlib.CategoryTheory.Monoidal.Rigid.Basic\nimport Mathlib.CategoryTheory.Monoidal.Subcategory\nimport Mathlib.LinearAlgebra.Coevaluation\nimport Mathlib.LinearAlgebra.FreeModule.Finite.Matrix\nimport Mathlib.Algebra.Category.ModuleCat.Monoidal.Closed\nimport Mathlib.Algebra.Group.Commute.Basic\nimport Mathlib.Algebra.GroupWithZero.Defs\nimport Mathlib.Data.Int.Defs\nimport Mathlib.Tactic.Common\nimport Mathlib.Algebra.GroupPower.CovariantClass\nimport Mathlib.Algebra.Order.Monoid.WithTop\nimport Mathlib.Algebra.SMulWithZero\nimport Mathlib.Order.Hom.Basic\nimport Mathlib.Data.Nat.Order.Basic\nimport Mathlib.Algebra.EuclideanDomain.Defs\nimport Mathlib.Algebra.Ring.Divisibility.Basic\nimport Mathlib.Algebra.Ring.Regular\nimport Mathlib.Algebra.GroupWithZero.Divisibility\nimport Mathlib.Algebra.Ring.Basic\nimport Mathlib.Algebra.Function.Indicator\nimport Mathlib.Algebra.SMulWithZero\nimport Mathlib.Data.Int.Basic\nimport Mathlib.Data.NNRat.Defs\nimport Mathlib.GroupTheory.GroupAction.Group\nimport Mathlib.GroupTheory.GroupAction.Pi\nimport Mathlib.Logic.Basic\nimport Mathlib.Tactic.Abel\nimport Mathlib.GroupTheory.GroupAction.SubMulAction\nimport Mathlib.GroupTheory.Submonoid.Membership\nimport Mathlib.Algebra.Module.Pi\nimport Mathlib.Algebra.Ring.CompTypeclasses\nimport Mathlib.Algebra.Star.Basic\nimport Mathlib.GroupTheory.GroupAction.DomAct.Basic\nimport Mathlib.GroupTheory.GroupAction.Hom\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.NonUnitalHom\nimport Mathlib.Algebra.BigOperators.Finsupp\nimport Mathlib.Algebra.Module.BigOperators\nimport Mathlib.LinearAlgebra.Finsupp\nimport Mathlib.Algebra.Group.Commute.Defs\nimport Mathlib.Algebra.Group.Units\nimport Mathlib.Algebra.Order.Monoid.Lemmas\nimport Mathlib.Tactic.NthRewrite\nimport Aesop\nimport Mathlib.Algebra.Group.Defs\nimport Mathlib.Logic.Function.Basic\nimport Mathlib.Tactic.Cases\nimport Mathlib.Tactic.SimpRw\nimport Mathlib.Tactic.SplitIfs\nimport Mathlib.Algebra.Group.Semiconj.Defs\nimport Mathlib.Algebra.Group.Basic\nimport Mathlib.Algebra.Group.Basic\nimport Mathlib.Algebra.Group.Hom.Defs\nimport Mathlib.Algebra.Group.Defs\nimport Mathlib.Data.Prod.Basic\nimport Mathlib.Data.Sum.Basic\nimport Mathlib.Logic.Unique\nimport Mathlib.Tactic.Spread\nimport Mathlib.Algebra.Group.Equiv.Basic\nimport Mathlib.Algebra.Group.WithOne.Defs\nimport Mathlib.Data.Option.Basic\nimport Mathlib.Algebra.Group.Hom.Basic\nimport Mathlib.Data.FunLike.Equiv\nimport Mathlib.Logic.Equiv.Basic\nimport Mathlib.Algebra.Group.Commute.Defs\nimport Mathlib.Algebra.Group.Semiconj.Basic\nimport Mathlib.Algebra.Field.Opposite\nimport Mathlib.Algebra.Invertible.Defs\nimport Mathlib.Algebra.Ring.Aut\nimport Mathlib.Algebra.Ring.CompTypeclasses\nimport Mathlib.Algebra.Field.Opposite\nimport Mathlib.Algebra.Invertible.Defs\nimport Mathlib.Data.NNRat.Defs\nimport Mathlib.Data.Rat.Cast.Defs\nimport Mathlib.Data.SetLike.Basic\nimport Mathlib.GroupTheory.GroupAction.Opposite\nimport Mathlib.Algebra.Group.Basic\nimport Mathlib.Algebra.GroupWithZero.NeZero\nimport Mathlib.Algebra.Group.OrderSynonym\nimport Mathlib.Algebra.GroupWithZero.Basic\nimport Mathlib.Algebra.Group.Units\nimport Mathlib.Tactic.Nontriviality\nimport Mathlib.Util.AssertExists\nimport Mathlib.Tactic.Contrapose\nimport Mathlib.CategoryTheory.Category.Grpd\nimport Mathlib.CategoryTheory.Groupoid\nimport Mathlib.Topology.Category.TopCat.Basic\nimport Mathlib.Topology.Homotopy.Path\nimport Mathlib.Data.Set.Basic\nimport Mathlib.RingTheory.IntegralClosure\nimport Mathlib.FieldTheory.Normal\nimport Mathlib.FieldTheory.Perfect\nimport Mathlib.RingTheory.Localization.Integral\nimport Mathlib.FieldTheory.Separable\nimport Mathlib.RingTheory.IntegralDomain\nimport Mathlib.Algebra.CharP.Reduced\nimport Mathlib.Tactic.ApplyFun\nimport Lean\nimport Std\nimport Mathlib.Tactic.PPWithUniv\nimport Mathlib.Tactic.ExtendDoc\nimport Mathlib.Tactic.Lemma\nimport Mathlib.Tactic.TypeStar\nimport Lean.Elab.Tactic.SolveByElim\nimport Mathlib.Tactic.Monotonicity.Attr\nimport Lean.Elab.Tactic.Simp\nimport Lean.Elab.App\nimport Mathlib.Tactic.Simps.NotationClass\nimport Std.Data.String.Basic\nimport Std.Util.LibraryNote\nimport Mathlib.Lean.Expr.Basic\nimport Mathlib.Tactic.NormNum.Inv\nimport Mathlib.Tactic.NormNum.Pow\nimport Mathlib.Util.AtomM\nimport Mathlib.Data.Rat.Order\nimport Mathlib.Tactic.NormNum.Core\nimport Mathlib.Tactic.HaveI\nimport Mathlib.Data.Nat.Cast.Commute\nimport Mathlib.Data.Int.Basic\nimport Mathlib.Algebra.Invertible.Basic\nimport Mathlib.Tactic.Clear!\nimport Mathlib.Data.Nat.Cast.Basic\nimport Mathlib.Algebra.GroupPower.Order\nimport Mathlib.Data.Int.CharZero\nimport Mathlib.Data.Int.Order.Basic\nimport Mathlib.Data.Nat.Factorial.Basic\nimport Mathlib.Data.Rat.Order\nimport Mathlib.Tactic.Positivity.Core\nimport Qq\nimport Std.Data.Rat.Lemmas\nimport Mathlib.Mathport.Rename\nimport Mathlib.Mathport.Rename\nimport Std.Logic\nimport Mathlib.Mathport.Rename\nimport Mathlib.Mathport.Rename\nimport Mathlib.Init.Data.Nat.Notation\nimport Std.Data.List.Basic\nimport Mathlib.Init.ZeroOne\nimport Mathlib.Init.Data.Nat.Notation\nimport Mathlib.Util.CompileInductive\nimport Mathlib.Init.Data.Nat.Notation\nimport Mathlib.Mathport.Rename\nimport Mathlib.Mathport.Rename\nimport Std.Data.Bool\nimport Mathlib.AlgebraicGeometry.AffineScheme\nimport Mathlib.AlgebraicGeometry.Pullbacks\nimport Mathlib.CategoryTheory.MorphismProperty\nimport Mathlib.Data.List.TFAE\nimport Mathlib.LinearAlgebra.Finsupp\nimport Mathlib.RingTheory.Ideal.Over\nimport Mathlib.RingTheory.Ideal.Prod\nimport Mathlib.RingTheory.Ideal.MinimalPrime\nimport Mathlib.RingTheory.Localization.Away.Basic\nimport Mathlib.RingTheory.Nilpotent\nimport Mathlib.Topology.Sets.Closeds\nimport Mathlib.Topology.Sober\nimport Mathlib.Data.Set.Function\nimport Mathlib.Logic.Function.Iterate\nimport Mathlib.GroupTheory.Perm.Basic\nimport Mathlib.Algebra.BigOperators.Basic\nimport Mathlib.Dynamics.FixedPoints.Basic\nimport Mathlib.Algebra.Function.Support\nimport Mathlib.Order.Filter.Lift\nimport Mathlib.Topology.Defs.Filter\nimport Mathlib.Order.SetNotation\nimport Mathlib.Tactic.Continuity\nimport Mathlib.Tactic.FunProp\nimport Mathlib.Topology.Order.ProjIcc\nimport Mathlib.Topology.ContinuousFunction.Ordered\nimport Mathlib.Topology.CompactOpen\nimport Mathlib.Topology.UnitInterval\nimport Mathlib.Analysis.NormedSpace.BoundedLinearMaps\nimport Mathlib.Topology.FiberBundle.Basic\nimport Mathlib.Data.Set.Image\nimport Mathlib.Order.SuccPred.Relation\nimport Mathlib.Topology.Clopen\nimport Mathlib.Topology.Irreducible\nimport Mathlib.CategoryTheory.ConcreteCategory.BundledHom\nimport Mathlib.CategoryTheory.Elementwise\nimport Mathlib.Topology.ContinuousFunction.Basic\nimport Mathlib.Topology.Category.TopCat.Basic\nimport Mathlib.CategoryTheory.Limits.Types\nimport Mathlib.Topology.Category.CompHaus.Basic\nimport Mathlib.Topology.LocallyConstant.Basic\nimport Mathlib.CategoryTheory.FintypeCat\nimport Mathlib.Topology.Category.Profinite.Basic\nimport Mathlib.CategoryTheory.Limits.ConcreteCategory\nimport Mathlib.Topology.ExtremallyDisconnected\nimport Mathlib.Topology.Category.CompHaus.Projective\nimport Mathlib.Topology.Category.Profinite.Basic\nimport Mathlib.CategoryTheory.Adjunction.Reflective\nimport Mathlib.Topology.StoneCech\nimport Mathlib.CategoryTheory.Monad.Limits\nimport Mathlib.Topology.UrysohnsLemma\nimport Mathlib.Topology.Category.TopCat.Limits.Basic\nimport Mathlib.Data.Set.Basic\nimport Mathlib.Order.Filter.SmallSets\nimport Mathlib.Tactic.Monotonicity\nimport Mathlib.Topology.Compactness.Compact\nimport Mathlib.Topology.NhdsSet\nimport Mathlib.Algebra.Group.Defs\nimport Mathlib.Data.Set.Intervals.Pi\nimport Mathlib.Data.Set.Pointwise.Basic\nimport Mathlib.Order.Filter.Interval\nimport Mathlib.Tactic.TFAE\nimport Mathlib.Tactic.NormNum\nimport Mathlib.Topology.Order.LeftRight\nimport Mathlib.Topology.Order.OrderClosed\nimport Mathlib.Order.Hom.Basic\nimport Mathlib.Topology.ContinuousFunction.Basic\nimport Mathlib.Topology.Algebra.Ring.Basic\nimport Mathlib.Topology.Algebra.MulAction\nimport Mathlib.Topology.Algebra.UniformGroup\nimport Mathlib.Topology.ContinuousFunction.Basic\nimport Mathlib.Topology.UniformSpace.UniformEmbedding\nimport Mathlib.Algebra.Algebra.Basic\nimport Mathlib.LinearAlgebra.Projection\nimport Mathlib.LinearAlgebra.Pi\nimport Mathlib.LinearAlgebra.Finsupp\nimport Mathlib.Topology.Algebra.Module.Basic\nimport Mathlib.LinearAlgebra.Multilinear.Basic\nimport Mathlib.LinearAlgebra.Alternating.Basic\nimport Mathlib.LinearAlgebra.BilinearMap\nimport Mathlib.Topology.Algebra.Module.Multilinear.Basic\nimport Mathlib.GroupTheory.Subgroup.Basic\nimport Mathlib.Topology.Algebra.OpenSubgroup\nimport Mathlib.Topology.Algebra.Ring.Basic\nimport Mathlib.Algebra.Ring.Prod\nimport Mathlib.RingTheory.Subring.Basic\nimport Mathlib.Topology.Algebra.Group.Basic\nimport Mathlib.Topology.Algebra.InfiniteSum.Defs\nimport Mathlib.Data.Fintype.BigOperators\nimport Mathlib.Topology.Algebra.Monoid\nimport Mathlib.GroupTheory.GroupAction.ConjAct\nimport Mathlib.GroupTheory.GroupAction.Quotient\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.Topology.Algebra.Monoid\nimport Mathlib.Topology.Algebra.Constructions\nimport Mathlib.Data.Nat.Interval\nimport Mathlib.Data.ENNReal.Real\nimport Mathlib.Topology.UniformSpace.Pi\nimport Mathlib.Topology.UniformSpace.UniformConvergence\nimport Mathlib.Topology.UniformSpace.UniformEmbedding\nimport Mathlib.Algebra.Function.Indicator\nimport Mathlib.Tactic.FinCases\nimport Mathlib.Topology.Sets.Closeds\nimport Mathlib.Order.Filter.Cofinite\nimport Mathlib.Topology.MetricSpace.ProperSpace\nimport Mathlib.Topology.MetricSpace.Basic\nimport Mathlib.Topology.FiberBundle.Trivialization\nimport Mathlib.Data.Set.UnionLift\nimport Mathlib.Topology.Homeomorph\nimport Mathlib.Algebra.GeomSum\nimport Mathlib.RingTheory.Ideal.Quotient\nimport Mathlib.Algebra.Associated\nimport Mathlib.RingTheory.Int.Basic\nimport Mathlib.Tactic.Ring\nimport Mathlib.Algebra.Star.Unitary\nimport Mathlib.Algebra.DirectSum.Algebra\nimport Mathlib.Analysis.Complex.UpperHalfPlane.FunctionsBoundedAtInfty\nimport Mathlib.Analysis.Complex.UpperHalfPlane.Manifold\nimport Mathlib.Geometry.Manifold.MFDeriv.SpecificFunctions\nimport Mathlib.NumberTheory.ModularForms.SlashInvariantForms\nimport Mathlib.NumberTheory.ModularForms.SlashInvariantForms\nimport Mathlib.NumberTheory.ModularForms.CongruenceSubgroups\nimport Mathlib.Data.Int.Parity\nimport Mathlib.RingTheory.DedekindDomain.IntegralClosure\nimport Mathlib.Algebra.GCDMonoid.Finset\nimport Mathlib.Algebra.GroupPower.Ring\nimport Mathlib.Data.Nat.Parity\nimport Mathlib.Data.Rat.Defs\nimport Mathlib.Tactic.Positivity.Basic\nimport Mathlib.Tactic.TFAE\nimport Mathlib.Analysis.PSeries\nimport Mathlib.NumberTheory.ArithmeticFunction\nimport Mathlib.Analysis.NormedSpace.FiniteDimension\nimport Mathlib.Init.Core\nimport Mathlib.RingTheory.Polynomial.Cyclotomic.Roots\nimport Mathlib.NumberTheory.NumberField.Basic\nimport Mathlib.FieldTheory.Galois\nimport Mathlib.Analysis.Calculus.MeanValue\nimport Mathlib.Analysis.Calculus.Deriv.Polynomial\nimport Mathlib.Data.Polynomial.DenomsClearable\nimport Mathlib.Data.Real.Irrational\nimport Mathlib.Topology.Algebra.Polynomial\nimport Mathlib.NumberTheory.LegendreSymbol.QuadraticChar.Basic\nimport Mathlib.Data.Fintype.Parity\nimport Mathlib.NumberTheory.LegendreSymbol.ZModChar\nimport Mathlib.FieldTheory.Finite.Basic\nimport Mathlib.Algebra.Periodic\nimport Mathlib.Data.ZMod.Units\nimport Mathlib.NumberTheory.LegendreSymbol.MulCharacter\nimport Mathlib.Analysis.Normed.Field.InfiniteSum\nimport Mathlib.Analysis.SpecificLimits.Normed\nimport Mathlib.NumberTheory.ArithmeticFunction\nimport Mathlib.NumberTheory.SmoothNumbers\nimport Lean.Meta.Tactic.Rewrite\nimport Std.Lean.Expr\nimport Std.Lean.Name\nimport Std.Data.Rat.Basic\nimport Std.Data.List.Basic\nimport Std.Lean.Name\nimport Std.Logic\nimport Mathlib.Lean.Meta\nimport Lean.Meta.AppBuilder\nimport Lean.Meta.Basic\nimport Mathlib.Data.Opposite\nimport Mathlib.Tactic.Cases\nimport Mathlib.Combinatorics.SimpleGraph.Init\nimport Mathlib.Data.Rel\nimport Mathlib.Data.Set.Finite\nimport Mathlib.Data.Sym.Sym2\nimport Mathlib.Algebra.GroupPower.Order\nimport Mathlib.Combinatorics.SimpleGraph.Clique\nimport Mathlib.Data.Finset.Sym\nimport Mathlib.Tactic.GCongr\nimport Mathlib.Tactic.Positivity\nimport Mathlib.Dynamics.FixedPoints.Basic\nimport Mathlib.GroupTheory.Perm.Option\nimport Mathlib.Logic.Equiv.Defs\nimport Mathlib.Logic.Equiv.Option\nimport Mathlib.Combinatorics.Hall.Finite\nimport Mathlib.CategoryTheory.CofilteredSystem\nimport Mathlib.Data.Rel" +} \ No newline at end of file diff --git a/code.py b/code.py new file mode 100644 index 0000000000000000000000000000000000000000..0074609951dfabce045d9d214fedb6ce6c3f08f2 --- /dev/null +++ b/code.py @@ -0,0 +1,69 @@ + +import os +import subprocess +import json + +# Set the directory where your .lean files are located + +# Get a list of all .lean files in the directory +# lean_files = [f for f in os.listdir(directory) if f.endswith(".lean")] +# lean_files = ["test/file.lean"] +def main(args): + command_list = [] + for i in range(8): + with open(f"{args.input_path}/{i}.json", 'r', encoding='utf-8') as rf: + for line in rf.readlines(): + try: + json_item = json.loads(line) + json_item['cmd'] = '\n'.join() + except: + import pdb + pdb.set_trace() + command_list.append(json_item) + results = [] + passed = 0 + total = 0 + + for item in command_list: + data = '{"cmd": "%s", "allTactics": true}' % item['cmd'] + command = 'echo \'%s\' | lake exe repl' % data + + try: + result = subprocess.run(command, shell=True, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout = result.stdout.decode('utf-8') + stderr = result.stderr.decode('utf-8') + results.append({ + 'file_path': item['file_path'], + 'stdout': stdout, + 'stderr': stderr, + 'status': 'pass' + }) + passed += 1 + except subprocess.CalledProcessError as e: + results.append({ + 'file_path': item['file_path'], + 'error': str(e), + 'status': 'nopass' + }) + total += 1 + + # Calculate pass rate + pass_rate = passed / total * 100 + + # Save results to a JSON file + with open('results.json', 'w') as f: + json.dump({'results': results, 'pass_rate': pass_rate}, f, indent=2) + +if __name__ == '__main__': + arg_parser = ArgumentParser() + arg_parser.add_argument('--data_path', type=str, + default='data/grade-school-math-master/grade_school_math/data/test.jsonl') + arg_parser.add_argument('--input_path', type=str, default='') + arg_parser.add_argument('--cuda_num', type=int, default=8) + arg_parser.add_argument('--output_path', type=str, default='total.json') + arg_parser.add_argument('--generate_method', type=str, + choices=['single', 'sft', 'comp', 'self_consistency', 'single_consistency']) + arg_parser.add_argument('--method', type=str, choices=['main', 'test', 'get_data']) + args = arg_parser.parse_args() + main(args) + diff --git a/data/basic_working.json b/data/basic_working.json new file mode 100644 index 0000000000000000000000000000000000000000..2c04ce2944a7bd786a69b63c674bc30b0eadd455 --- /dev/null +++ b/data/basic_working.json @@ -0,0 +1,378 @@ +{ + "working_file_list": [ + "import Mathlib.MeasureTheory.Measure.GiryMonad\nimport Mathlib.Dynamics.Ergodic.MeasurePreserving\nimport Mathlib.MeasureTheory.Integral.Lebesgue\nimport Mathlib.MeasureTheory.Measure.OpenPos", + "import Mathlib.Analysis.Normed.Group.Basic\nimport Mathlib.MeasureTheory.Function.AEMeasurableSequence\nimport Mathlib.MeasureTheory.Group.Arithmetic\nimport Mathlib.MeasureTheory.Order.Lattice\nimport Mathlib.Topology.Instances.EReal\nimport Mathlib.Topology.MetricSpace.Thickening\nimport Mathlib.Topology.GDelta\nimport Mathlib.Topology.Order.Lattice\nimport Mathlib.Topology.Semicontinuous", + "import Mathlib.Analysis.SpecificLimits.Basic\nimport Mathlib.MeasureTheory.PiSystem\nimport Mathlib.Data.Countable.Basic\nimport Mathlib.Data.Fin.VecNotation", + "import Mathlib.MeasureTheory.Measure.Content\nimport Mathlib.MeasureTheory.Group.Prod\nimport Mathlib.Topology.Algebra.Group.Compact", + "import Mathlib.Dynamics.Ergodic.MeasurePreserving\nimport Mathlib.LinearAlgebra.Determinant\nimport Mathlib.LinearAlgebra.Matrix.Diagonal\nimport Mathlib.LinearAlgebra.Matrix.Transvection\nimport Mathlib.MeasureTheory.Constructions.Pi\nimport Mathlib.MeasureTheory.Measure.Stieltjes\nimport Mathlib.MeasureTheory.Measure.Haar.OfBasis", + "import Mathlib.Data.Finset.Update\nimport Mathlib.Data.Prod.TProd\nimport Mathlib.GroupTheory.Coset\nimport Mathlib.Logic.Equiv.Fin\nimport Mathlib.MeasureTheory.MeasurableSpace.Defs\nimport Mathlib.Order.Filter.SmallSets\nimport Mathlib.Order.LiminfLimsup\nimport Mathlib.Data.Set.UnionLift", + "import Mathlib.Analysis.NormedSpace.BoundedLinearMaps\nimport Mathlib.MeasureTheory.Measure.WithDensity\nimport Mathlib.MeasureTheory.Function.SimpleFuncDense\nimport Mathlib.Topology.Algebra.Module.FiniteDimension", + "import Mathlib.MeasureTheory.Function.AEEqFun.DomAct\nimport Mathlib.MeasureTheory.Function.LpSpace", + "import Mathlib.Analysis.SpecialFunctions.Pow.NNReal\nimport Mathlib.MeasureTheory.Constructions.BorelSpace.Complex", + "import Mathlib.MeasureTheory.Function.ConditionalExpectation.CondexpL1", + "import Mathlib.Analysis.NormedSpace.IndicatorFunction\nimport Mathlib.MeasureTheory.Function.EssSup\nimport Mathlib.MeasureTheory.Function.AEEqFun\nimport Mathlib.MeasureTheory.Function.SpecialFunctions.Basic", + "import Mathlib.Topology.Instances.ENNReal\nimport Mathlib.MeasureTheory.Measure.Dirac", + "import Mathlib.Probability.Notation\nimport Mathlib.Probability.Process.Stopping", + "import Mathlib.Probability.Independence.Kernel", + "import Mathlib.MeasureTheory.Integral.Bochner\nimport Mathlib.MeasureTheory.Measure.GiryMonad", + "import Mathlib.Algebra.Module.Hom\nimport Mathlib.Algebra.Module.Prod\nimport Mathlib.Algebra.Module.Submodule.Ker\nimport Mathlib.Data.Set.Finite\nimport Mathlib.Order.ConditionallyCompleteLattice.Basic", + "import Mathlib.LinearAlgebra.RootSystem.Defs", + "import Mathlib.LinearAlgebra.Matrix.Adjugate\nimport Mathlib.RingTheory.PolynomialAlgebra", + "import Mathlib.Algebra.AddTorsor", + "import Mathlib.GroupTheory.Perm.Sign\nimport Mathlib.Data.Fintype.Perm\nimport Mathlib.LinearAlgebra.Multilinear.Basis", + "import Mathlib.Data.Finsupp.Fintype\nimport Mathlib.LinearAlgebra.TensorProduct.Basis", + "import Mathlib.RingTheory.Finiteness\nimport Mathlib.LinearAlgebra.FreeModule.Basic", + "import Mathlib.Algebra.RingQuot\nimport Mathlib.LinearAlgebra.TensorAlgebra.Basic\nimport Mathlib.LinearAlgebra.QuadraticForm.Isometry\nimport Mathlib.LinearAlgebra.QuadraticForm.IsometryEquiv", + "import Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.GroupTheory.Congruence\nimport Mathlib.LinearAlgebra.Basic\nimport Mathlib.Tactic.SuppressCompilation", + "import Mathlib.LinearAlgebra.Matrix.Determinant\nimport Mathlib.LinearAlgebra.Matrix.SesquilinearForm\nimport Mathlib.LinearAlgebra.Matrix.Symmetric", + "import Mathlib.Algebra.Algebra.Basic\nimport Mathlib.Algebra.BigOperators.Order\nimport Mathlib.Data.Fintype.BigOperators\nimport Mathlib.Data.Fintype.Sort\nimport Mathlib.Data.List.FinRange\nimport Mathlib.LinearAlgebra.Pi", + "import Mathlib.LinearAlgebra.CliffordAlgebra.Basic\nimport Mathlib.LinearAlgebra.Alternating.Basic", + "import Mathlib.Algebra.Algebra.Spectrum\nimport Mathlib.LinearAlgebra.GeneralLinearGroup\nimport Mathlib.LinearAlgebra.FiniteDimensional", + "import Mathlib.Algebra.FreeAlgebra\nimport Mathlib.Algebra.RingQuot\nimport Mathlib.Algebra.TrivSqZeroExt\nimport Mathlib.Algebra.Algebra.Operations\nimport Mathlib.LinearAlgebra.Multilinear.Basic", + "import Mathlib.Algebra.Algebra.Tower", + "import Mathlib.LinearAlgebra.FiniteDimensional", + "import Mathlib.LinearAlgebra.LinearIndependent", + "import Mathlib.LinearAlgebra.FreeModule.Finite.Basic\nimport Mathlib.LinearAlgebra.Matrix.Charpoly.Coeff\nimport Mathlib.FieldTheory.Minpoly.Field", + "import Mathlib.Init.Logic\nimport Mathlib.Init.Function\nimport Mathlib.Init.Algebra.Classes\nimport Std.Util.LibraryNote\nimport Std.Tactic.Lint.Basic", + "import Mathlib.Init.Order.Defs\nimport Mathlib.Logic.Nontrivial.Defs\nimport Mathlib.Tactic.Attr.Register\nimport Mathlib.Data.Prod.Basic\nimport Mathlib.Data.Subtype\nimport Mathlib.Logic.Function.Basic\nimport Mathlib.Logic.Unique", + "import Mathlib.Data.Bool.Basic\nimport Mathlib.Data.Option.Defs\nimport Mathlib.Data.Prod.Basic\nimport Mathlib.Data.Sigma.Basic\nimport Mathlib.Data.Subtype\nimport Mathlib.Data.Sum.Basic\nimport Mathlib.Init.Data.Sigma.Basic\nimport Mathlib.Logic.Equiv.Defs\nimport Mathlib.Logic.Function.Conjugate\nimport Mathlib.Tactic.Lift\nimport Mathlib.Tactic.Convert\nimport Mathlib.Tactic.Contrapose\nimport Mathlib.Tactic.GeneralizeProofs\nimport Mathlib.Tactic.SimpRw", + "import Mathlib.Logic.Equiv.Nat\nimport Mathlib.Data.PNat.Basic\nimport Mathlib.Order.Directed\nimport Mathlib.Data.Countable.Defs\nimport Mathlib.Order.RelIso.Basic\nimport Mathlib.Data.Fin.Basic", + "import Mathlib.Logic.Small.Defs\nimport Mathlib.Logic.Equiv.Set", + "import Mathlib.Logic.Nonempty\nimport Mathlib.Init.Set\nimport Mathlib.Logic.Basic", + "import Mathlib.Data.Option.Basic\nimport Mathlib.Data.Prod.PProd\nimport Mathlib.Logic.Equiv.Basic", + "import Mathlib.Analysis.Calculus.TangentCone\nimport Mathlib.Analysis.NormedSpace.OperatorNorm.Asymptotics", + "import Mathlib.Analysis.Calculus.Deriv.Add", + "import Mathlib.Analysis.InnerProductSpace.Dual\nimport Mathlib.Analysis.Calculus.FDeriv.Basic\nimport Mathlib.Analysis.Calculus.Deriv.Basic", + "import Mathlib.Analysis.Calculus.ContDiff.Basic\nimport Mathlib.Analysis.NormedSpace.FiniteDimension", + "import Mathlib.Analysis.Calculus.Deriv.Comp\nimport Mathlib.Analysis.Calculus.Deriv.Add\nimport Mathlib.Analysis.Calculus.Deriv.Mul\nimport Mathlib.Analysis.Calculus.Deriv.Slope", + "import Mathlib.Analysis.Calculus.FDeriv.Basic\nimport Mathlib.Analysis.NormedSpace.OperatorNorm.NormedSpace", + "import Mathlib.Analysis.Calculus.ContDiff.Defs\nimport Mathlib.Analysis.Calculus.FDeriv.Add\nimport Mathlib.Analysis.Calculus.FDeriv.Mul\nimport Mathlib.Analysis.Calculus.Deriv.Inverse", + "import Mathlib.Algebra.DirectSum.Module\nimport Mathlib.Analysis.Complex.Basic\nimport Mathlib.Analysis.Convex.Uniform\nimport Mathlib.Analysis.NormedSpace.Completion\nimport Mathlib.Analysis.NormedSpace.BoundedLinearMaps", + "import Mathlib.Algebra.Algebra.NonUnitalSubalgebra\nimport Mathlib.Algebra.Algebra.Subalgebra.Basic\nimport Mathlib.Analysis.Normed.Group.Basic\nimport Mathlib.GroupTheory.OrderOfElement\nimport Mathlib.Topology.Instances.NNReal\nimport Mathlib.Topology.MetricSpace.DilationEquiv", + "import Mathlib.Algebra.Order.Group.TypeTags\nimport Mathlib.Analysis.Normed.Field.Basic", + "import Mathlib.Analysis.Normed.Group.Seminorm\nimport Mathlib.Order.LiminfLimsup\nimport Mathlib.Topology.Instances.Rat\nimport Mathlib.Topology.MetricSpace.Algebra\nimport Mathlib.Topology.MetricSpace.IsometricSMul\nimport Mathlib.Topology.Sequences", + "import Mathlib.Analysis.SpecialFunctions.Exp\nimport Mathlib.Data.Nat.Factorization.Basic\nimport Mathlib.Analysis.NormedSpace.Real", + "import Mathlib.Analysis.SpecialFunctions.Exp\nimport Mathlib.Tactic.Positivity.Core", + "import Mathlib.MeasureTheory.Integral.ExpDecay\nimport Mathlib.Analysis.SpecialFunctions.ImproperIntegrals\nimport Mathlib.Analysis.MellinTransform", + "import Mathlib.Analysis.Convex.Basic\nimport Mathlib.Analysis.Convex.Hull\nimport Mathlib.Analysis.NormedSpace.Basic\nimport Mathlib.Topology.Bornology.Absorbs", + "import Mathlib.Analysis.NormedSpace.Dual\nimport Mathlib.Analysis.NormedSpace.Star.Basic\nimport Mathlib.Analysis.Complex.Basic\nimport Mathlib.Analysis.InnerProductSpace.Adjoint\nimport Mathlib.Algebra.Star.Subalgebra", + "import Mathlib.Analysis.BoxIntegral.Partition.Filter\nimport Mathlib.Analysis.BoxIntegral.Partition.Measure\nimport Mathlib.Topology.UniformSpace.Compact\nimport Mathlib.Init.Data.Bool.Lemmas", + "import Mathlib.Algebra.BigOperators.Option\nimport Mathlib.Analysis.BoxIntegral.Box.Basic\nimport Mathlib.Data.Set.Pairwise.Lattice", + "import Mathlib.Data.Set.Intervals.Monotone\nimport Mathlib.Topology.MetricSpace.Basic\nimport Mathlib.Topology.MetricSpace.Bounded\nimport Mathlib.Topology.Order.MonotoneConvergence", + "import Mathlib.Data.Complex.Module\nimport Mathlib.Data.Complex.Order\nimport Mathlib.Data.Complex.Exponential\nimport Mathlib.Data.RCLike.Basic\nimport Mathlib.Topology.Algebra.InfiniteSum.Module\nimport Mathlib.Topology.Instances.RealVectorSpace", + "import Mathlib.Analysis.Complex.Circle\nimport Mathlib.Analysis.NormedSpace.BallAction", + "import Mathlib.Data.Fintype.Parity\nimport Mathlib.LinearAlgebra.Matrix.SpecialLinearGroup\nimport Mathlib.Analysis.Complex.Basic\nimport Mathlib.GroupTheory.GroupAction.Defs\nimport Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup\nimport Mathlib.Tactic.LinearCombination", + "import Mathlib.Algebra.GeomSum\nimport Mathlib.Order.Filter.Archimedean\nimport Mathlib.Order.Iterate\nimport Mathlib.Topology.Instances.ENNReal\nimport Mathlib.Topology.Algebra.Algebra", + "import Mathlib.Algebra.Order.Module.OrderedSMul\nimport Mathlib.Analysis.Convex.Star\nimport Mathlib.LinearAlgebra.AffineSpace.AffineSubspace", + "import Mathlib.Analysis.Convex.Hull\nimport Mathlib.LinearAlgebra.AffineSpace.Independent", + "import Mathlib.Analysis.Convex.Hull", + "import Mathlib.Analysis.Convex.Slope\nimport Mathlib.Analysis.SpecialFunctions.Pow.Real\nimport Mathlib.Tactic.LinearCombination", + "import Mathlib.Algebra.Algebra.Pi\nimport Mathlib.Algebra.Algebra.RestrictScalars\nimport Mathlib.Analysis.Normed.Field.Basic\nimport Mathlib.Analysis.Normed.MulAction", + "import Mathlib.Analysis.NormedSpace.OperatorNorm.NormedSpace\nimport Mathlib.Topology.Algebra.Module.Multilinear.Basic", + "import Mathlib.Algebra.Algebra.Tower\nimport Mathlib.Analysis.LocallyConvex.WithSeminorms\nimport Mathlib.Topology.Algebra.Module.StrongTopology\nimport Mathlib.Analysis.NormedSpace.LinearIsometry\nimport Mathlib.Analysis.NormedSpace.ContinuousLinearMap\nimport Mathlib.Tactic.SuppressCompilation", + "import Mathlib.Analysis.Normed.Group.Hom\nimport Mathlib.Analysis.NormedSpace.Basic\nimport Mathlib.Analysis.NormedSpace.LinearIsometry\nimport Mathlib.Algebra.Star.SelfAdjoint\nimport Mathlib.Algebra.Star.Subalgebra\nimport Mathlib.Algebra.Star.Unitary\nimport Mathlib.Topology.Algebra.Module.Star", + "import Mathlib.Analysis.Calculus.FormalMultilinearSeries\nimport Mathlib.Analysis.SpecificLimits.Normed\nimport Mathlib.Logic.Equiv.Fin\nimport Mathlib.Topology.Algebra.InfiniteSum.Module", + "import Mathlib.CategoryTheory.Sites.Sheaf\nimport Mathlib.Topology.Category.CompHaus.EffectiveEpi", + "import Mathlib.Data.Fin.VecNotation\nimport Mathlib.SetTheory.Cardinal.Basic", + "import Mathlib.ModelTheory.Syntax\nimport Mathlib.ModelTheory.Semantics\nimport Mathlib.ModelTheory.Algebra.Ring.Basic\nimport Mathlib.Algebra.Field.MinimalAxioms", + "import Mathlib.ModelTheory.Syntax\nimport Mathlib.ModelTheory.Semantics\nimport Mathlib.Algebra.Ring.Equiv", + "import Mathlib.Init.Control.Combinators\nimport Mathlib.Init.Function\nimport Mathlib.Tactic.CasesM\nimport Mathlib.Tactic.Attr.Core", + "import Mathlib.Logic.Equiv.Defs", + "import Mathlib.Data.Option.Defs\nimport Mathlib.Control.Functor", + "import Mathlib.Control.Bifunctor\nimport Mathlib.Control.Traversable.Basic", + "import Mathlib.Init.Order.LinearOrder\nimport Mathlib.Data.Prod.Basic\nimport Mathlib.Data.Subtype\nimport Mathlib.Tactic.Spread\nimport Mathlib.Tactic.Convert\nimport Mathlib.Tactic.SimpRw\nimport Mathlib.Tactic.Cases\nimport Mathlib.Order.Notation", + "import Mathlib.Logic.Equiv.Option\nimport Mathlib.Order.RelIso.Basic\nimport Mathlib.Order.Disjoint\nimport Mathlib.Order.WithBot\nimport Mathlib.Tactic.Monotonicity.Attr\nimport Mathlib.Util.AssertExists", + "import Mathlib.Data.SetLike.Basic\nimport Mathlib.Data.Set.Intervals.OrdConnected\nimport Mathlib.Data.Set.Intervals.OrderIso\nimport Mathlib.Data.Set.Lattice", + "import Mathlib.Order.PropInstances", + "import Mathlib.Data.Set.Finite", + "import Mathlib.Logic.Function.Iterate\nimport Mathlib.Init.Data.Int.Order\nimport Mathlib.Order.Compare\nimport Mathlib.Order.Max\nimport Mathlib.Order.RelClasses\nimport Mathlib.Tactic.Choose", + "import Mathlib.Order.CompleteLattice\nimport Mathlib.Order.Cover\nimport Mathlib.Order.Iterate", + "import Mathlib.Init.Algebra.Classes\nimport Mathlib.Data.FunLike.Basic\nimport Mathlib.Logic.Embedding.Basic\nimport Mathlib.Order.RelClasses", + "import Mathlib.Order.Atoms\nimport Mathlib.Order.OrderIsoNat\nimport Mathlib.Order.RelIso.Set\nimport Mathlib.Order.SupClosed\nimport Mathlib.Order.SupIndep\nimport Mathlib.Order.Zorn\nimport Mathlib.Data.Finset.Order\nimport Mathlib.Data.Set.Intervals.OrderIso\nimport Mathlib.Data.Finite.Set\nimport Mathlib.Tactic.TFAE", + "import Mathlib.Order.Bounds.Basic\nimport Mathlib.Order.WellFounded\nimport Mathlib.Data.Set.Image\nimport Mathlib.Data.Set.Intervals.Basic\nimport Mathlib.Data.Set.Lattice", + "import Mathlib.Data.Set.Intervals.Basic\nimport Mathlib.Data.Set.NAry\nimport Mathlib.Order.Directed", + "import Mathlib.Data.Sum.Order\nimport Mathlib.Order.InitialSeg\nimport Mathlib.SetTheory.Cardinal.Basic\nimport Mathlib.Tactic.PPWithUniv", + "import Mathlib.Data.Set.Lattice\nimport Mathlib.Logic.Small.Basic\nimport Mathlib.Logic.Function.OfArity\nimport Mathlib.Order.WellFounded", + "import Mathlib.Data.Int.Basic\nimport Mathlib.SetTheory.Game.PGame\nimport Mathlib.Tactic.Abel", + "import Mathlib.Algebra.Order.Hom.Monoid\nimport Mathlib.SetTheory.Game.Ordinal", + "import Mathlib.Algebra.Module.Basic\nimport Mathlib.Data.Fintype.BigOperators\nimport Mathlib.Data.Finsupp.Defs\nimport Mathlib.Data.Set.Countable\nimport Mathlib.Logic.Small.Set\nimport Mathlib.Order.ConditionallyCompleteLattice.Basic\nimport Mathlib.Order.SuccPred.CompleteLinearOrder\nimport Mathlib.SetTheory.Cardinal.SchroederBernstein\nimport Mathlib.Tactic.PPWithUniv", + "import Mathlib.Algebra.Group.Equiv.TypeTags\nimport Mathlib.Algebra.Module.Basic\nimport Mathlib.Algebra.Module.LinearMap.Basic\nimport Mathlib.Algebra.MonoidAlgebra.Basic\nimport Mathlib.LinearAlgebra.Dual\nimport Mathlib.LinearAlgebra.Contraction\nimport Mathlib.RingTheory.TensorProduct.Basic", + "import Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.CategoryTheory.SingleObj\nimport Mathlib.CategoryTheory.Limits.FunctorCategory\nimport Mathlib.CategoryTheory.Limits.Preserves.Basic\nimport Mathlib.CategoryTheory.Adjunction.Limits\nimport Mathlib.CategoryTheory.Conj", + "import Mathlib.Algebra.Homology.Opposite\nimport Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex\nimport Mathlib.RepresentationTheory.GroupCohomology.Resolution", + "import Mathlib.CategoryTheory.Limits.HasLimits", + "import Mathlib.CategoryTheory.Limits.Connected\nimport Mathlib.CategoryTheory.Limits.Constructions.Over.Products\nimport Mathlib.CategoryTheory.Limits.Constructions.Over.Connected\nimport Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers\nimport Mathlib.CategoryTheory.Limits.Constructions.Equalizers", + "import Mathlib.CategoryTheory.Limits.Shapes.RegularMono\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Preserves.Basic", + "import Mathlib.CategoryTheory.NatIso", + "import Mathlib.CategoryTheory.Limits.Constructions.Pullbacks\nimport Mathlib.CategoryTheory.Preadditive.Biproducts\nimport Mathlib.CategoryTheory.Limits.Shapes.Images\nimport Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers\nimport Mathlib.CategoryTheory.Abelian.NonPreadditive", + "import Mathlib.CategoryTheory.Subobject.MonoOver\nimport Mathlib.CategoryTheory.Skeletal\nimport Mathlib.CategoryTheory.ConcreteCategory.Basic\nimport Mathlib.Tactic.ApplyFun\nimport Mathlib.Tactic.CategoryTheory.Elementwise", + "import Mathlib.CategoryTheory.EqToHom\nimport Mathlib.CategoryTheory.Functor.Const\nimport Mathlib.CategoryTheory.Opposites\nimport Mathlib.Data.Prod.Basic", + "import Mathlib.CategoryTheory.CommSq", + "import Mathlib.Algebra.BigOperators.Basic\nimport Mathlib.Algebra.Group.Hom.Defs\nimport Mathlib.Algebra.Module.Basic\nimport Mathlib.CategoryTheory.Endomorphism\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels", + "import Mathlib.CategoryTheory.Preadditive.Opposite\nimport Mathlib.Algebra.Category.ModuleCat.Basic\nimport Mathlib.Algebra.Category.GroupCat.Preadditive", + "import Mathlib.CategoryTheory.Functor.Category\nimport Mathlib.CategoryTheory.Functor.FullyFaithful\nimport Mathlib.CategoryTheory.Functor.ReflectsIso", + "import Mathlib.CategoryTheory.EqToHom\nimport Mathlib.CategoryTheory.NatIso\nimport Mathlib.CategoryTheory.Products.Basic", + "import Mathlib.Algebra.Group.Basic\nimport Mathlib.CategoryTheory.Limits.Preserves.Shapes.Zero\nimport Mathlib.CategoryTheory.Monoidal.End\nimport Mathlib.CategoryTheory.Monoidal.Discrete", + "import Mathlib.CategoryTheory.Equivalence", + "import Mathlib.CategoryTheory.FinCategory.Basic\nimport Mathlib.CategoryTheory.Limits.Cones\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.Adjunction.Basic\nimport Mathlib.CategoryTheory.Category.Preorder\nimport Mathlib.CategoryTheory.Category.ULift\nimport Mathlib.CategoryTheory.PEmpty", + "import Mathlib.CategoryTheory.Monoidal.Types.Symmetric\nimport Mathlib.CategoryTheory.Monoidal.Types.Coyoneda\nimport Mathlib.CategoryTheory.Monoidal.Center\nimport Mathlib.Tactic.ApplyFun", + "import Mathlib.CategoryTheory.Abelian.Basic", + "import Mathlib.CategoryTheory.EqToHom", + "import Mathlib.CategoryTheory.Iso\nimport Mathlib.CategoryTheory.Functor.Category\nimport Mathlib.CategoryTheory.EqToHom", + "import Mathlib.CategoryTheory.Whiskering\nimport Mathlib.CategoryTheory.Functor.FullyFaithful\nimport Mathlib.CategoryTheory.NatIso", + "import Mathlib.CategoryTheory.Extensive\nimport Mathlib.CategoryTheory.Sites.Coverage\nimport Mathlib.CategoryTheory.EffectiveEpi.Basic", + "import Mathlib.CategoryTheory.Adjunction.Limits\nimport Mathlib.CategoryTheory.Limits.Preserves.Shapes.Products\nimport Mathlib.CategoryTheory.Limits.Shapes.Biproducts\nimport Mathlib.CategoryTheory.Shift.Basic", + "import Mathlib.CategoryTheory.Types\nimport Mathlib.CategoryTheory.Functor.EpiMono\nimport Mathlib.CategoryTheory.Limits.Constructions.EpiMono", + "import Mathlib.CategoryTheory.Monoidal.Free.Coherence\nimport Mathlib.CategoryTheory.Monoidal.Discrete\nimport Mathlib.CategoryTheory.Monoidal.NaturalTransformation\nimport Mathlib.CategoryTheory.Monoidal.Opposite\nimport Mathlib.Tactic.CategoryTheory.Coherence\nimport Mathlib.CategoryTheory.CommSq", + "import Mathlib.CategoryTheory.Monoidal.Functor\nimport Mathlib.CategoryTheory.ChosenFiniteProducts\nimport Mathlib.CategoryTheory.Limits.Shapes.Types\nimport Mathlib.Logic.Equiv.Fin", + "import Mathlib.CategoryTheory.Monoidal.Functor", + "import Mathlib.CategoryTheory.Monoidal.Free.Coherence\nimport Mathlib.Tactic.CategoryTheory.Coherence\nimport Mathlib.CategoryTheory.Closed.Monoidal\nimport Mathlib.Tactic.ApplyFun", + "import Mathlib.CategoryTheory.Monoidal.Category\nimport Mathlib.CategoryTheory.Limits.Shapes.BinaryProducts\nimport Mathlib.CategoryTheory.PEmpty", + "import Mathlib.CategoryTheory.Preadditive.Basic\nimport Mathlib.Algebra.Module.LinearMap.Basic\nimport Mathlib.Algebra.Algebra.Basic", + "import Mathlib.CategoryTheory.Category.Init\nimport Mathlib.Combinatorics.Quiver.Basic\nimport Mathlib.Tactic.PPWithUniv\nimport Mathlib.Tactic.Common", + "import Mathlib.CategoryTheory.Limits.Shapes.Products", + "import Mathlib.Data.Fintype.Basic\nimport Mathlib.CategoryTheory.DiscreteCategory\nimport Mathlib.CategoryTheory.Opposites\nimport Mathlib.CategoryTheory.Category.ULift", + "import Mathlib.CategoryTheory.Category.Basic", + "import Mathlib.CategoryTheory.Comma.StructuredArrow\nimport Mathlib.CategoryTheory.Limits.Shapes.Equivalence", + "import Mathlib.CategoryTheory.FintypeCat\nimport Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers\nimport Mathlib.CategoryTheory.Limits.FintypeCat\nimport Mathlib.CategoryTheory.Limits.MonoCoprod\nimport Mathlib.CategoryTheory.Limits.Preserves.Shapes.Terminal\nimport Mathlib.CategoryTheory.Limits.Shapes.Types\nimport Mathlib.CategoryTheory.Limits.Shapes.ConcreteCategory\nimport Mathlib.CategoryTheory.Limits.Shapes.Diagonal\nimport Mathlib.CategoryTheory.SingleObj\nimport Mathlib.Data.Finite.Card", + "import Mathlib.CategoryTheory.Groupoid\nimport Mathlib.Combinatorics.Quiver.Basic", + "import Mathlib.LinearAlgebra.StdBasis\nimport Mathlib.Tactic.Linarith\nimport Mathlib.Data.Finset.PiAntidiagonal\nimport Mathlib.Data.MvPolynomial.Basic", + "import Mathlib.Tactic.FinCases\nimport Mathlib.Data.Nat.Choose.Sum\nimport Mathlib.LinearAlgebra.Finsupp", + "import Mathlib.Algebra.GroupPower.Order\nimport Mathlib.RingTheory.Ideal.Operations\nimport Mathlib.Tactic.TFAE", + "import Mathlib.RingTheory.Adjoin.Basic", + "import Mathlib.Algebra.Ring.Equiv\nimport Mathlib.Algebra.Ring.Prod\nimport Mathlib.Data.Set.Finite\nimport Mathlib.GroupTheory.Submonoid.Membership\nimport Mathlib.GroupTheory.Subsemigroup.Membership\nimport Mathlib.GroupTheory.Subsemigroup.Centralizer", + "import Mathlib.Algebra.EuclideanDomain.Basic\nimport Mathlib.Data.Nat.Factors\nimport Mathlib.RingTheory.Coprime.Basic\nimport Mathlib.RingTheory.PrincipalIdealDomain", + "import Mathlib.Algebra.CharP.ExpChar\nimport Mathlib.Algebra.GeomSum\nimport Mathlib.Data.MvPolynomial.CommRing\nimport Mathlib.Data.MvPolynomial.Equiv\nimport Mathlib.RingTheory.Polynomial.Content\nimport Mathlib.RingTheory.UniqueFactorizationDomain", + "import Mathlib.Algebra.NeZero\nimport Mathlib.Algebra.Polynomial.BigOperators\nimport Mathlib.RingTheory.RootsOfUnity.Complex\nimport Mathlib.Data.Polynomial.Lifts\nimport Mathlib.Data.Polynomial.Splits\nimport Mathlib.FieldTheory.RatFunc\nimport Mathlib.NumberTheory.ArithmeticFunction\nimport Mathlib.RingTheory.RootsOfUnity.Basic", + "import Mathlib.Data.Polynomial.Derivative\nimport Mathlib.Data.Nat.Parity\nimport Mathlib.Data.Nat.Factorial.DoubleFactorial", + "import Mathlib.RingTheory.EisensteinCriterion\nimport Mathlib.RingTheory.Polynomial.ScaleRoots", + "import Mathlib.Algebra.GroupPower.Ring\nimport Mathlib.Algebra.Ring.Divisibility.Basic\nimport Mathlib.Algebra.Ring.Hom.Defs\nimport Mathlib.GroupTheory.GroupAction.Units\nimport Mathlib.Logic.Basic\nimport Mathlib.Tactic.Ring", + "import Mathlib.RingTheory.Noetherian\nimport Mathlib.Algebra.DirectSum.Module\nimport Mathlib.Algebra.DirectSum.Finsupp\nimport Mathlib.Algebra.Module.Projective\nimport Mathlib.Algebra.Module.Injective\nimport Mathlib.Algebra.Module.CharacterModule\nimport Mathlib.LinearAlgebra.DirectSum.TensorProduct\nimport Mathlib.LinearAlgebra.FreeModule.Basic\nimport Mathlib.Algebra.Module.Projective", + "import Mathlib.GroupTheory.Subgroup.Basic\nimport Mathlib.RingTheory.Subsemiring.Basic", + "import Mathlib.Algebra.Algebra.Operations\nimport Mathlib.Algebra.Algebra.Subalgebra.Tower\nimport Mathlib.LinearAlgebra.Prod\nimport Mathlib.LinearAlgebra.Finsupp", + "import Mathlib.Algebra.Module.Basic\nimport Mathlib.Algebra.Ring.Equiv\nimport Mathlib.Algebra.Ring.Prod\nimport Mathlib.Algebra.GroupRingAction.Subobjects\nimport Mathlib.Data.Set.Finite\nimport Mathlib.GroupTheory.Submonoid.Centralizer\nimport Mathlib.GroupTheory.Submonoid.Membership\nimport Mathlib.RingTheory.NonUnitalSubsemiring.Basic", + "import Mathlib.GroupTheory.MonoidLocalization\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\nimport Mathlib.RingTheory.OreLocalization.OreSet\nimport Mathlib.Tactic.NoncommRing", + "import Mathlib.Algebra.Function.Support\nimport Mathlib.Order.WellFoundedSet", + "import Mathlib.RingTheory.Ideal.Over\nimport Mathlib.RingTheory.Polynomial.RationalRoot", + "import Mathlib.Algebra.CharP.Basic\nimport Mathlib.Data.Polynomial.AlgebraMap\nimport Mathlib.Data.MvPolynomial.Degrees\nimport Mathlib.LinearAlgebra.FinsuppVectorSpace\nimport Mathlib.LinearAlgebra.FreeModule.Finite.Basic", + "import Mathlib.Algebra.DirectSum.Algebra\nimport Mathlib.Algebra.DirectSum.Decomposition\nimport Mathlib.Algebra.DirectSum.Internal\nimport Mathlib.Algebra.DirectSum.Ring", + "import Mathlib.Algebra.Algebra.Tower\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\nimport Mathlib.GroupTheory.MonoidLocalization\nimport Mathlib.RingTheory.Ideal.Basic\nimport Mathlib.GroupTheory.GroupAction.Ring", + "import Mathlib.Init.Data.Int.CompLemmas\nimport Mathlib.RingTheory.UniqueFactorizationDomain\nimport Mathlib.RingTheory.Localization.Basic", + "import Mathlib.Algebra.CharP.Two\nimport Mathlib.Algebra.CharP.Reduced\nimport Mathlib.Algebra.NeZero\nimport Mathlib.Data.Polynomial.RingDivision\nimport Mathlib.GroupTheory.SpecificGroups.Cyclic\nimport Mathlib.NumberTheory.Divisors\nimport Mathlib.RingTheory.IntegralDomain\nimport Mathlib.Tactic.Zify", + "import Mathlib.LinearAlgebra.FiniteDimensional\nimport Mathlib.LinearAlgebra.TensorProduct.Tower\nimport Mathlib.RingTheory.Adjoin.Basic\nimport Mathlib.LinearAlgebra.DirectSum.Finsupp", + "import Mathlib.Data.MvPolynomial.Counit\nimport Mathlib.Data.MvPolynomial.Invertible\nimport Mathlib.RingTheory.WittVector.Defs", + "import Mathlib.RingTheory.MvPowerSeries.Basic\nimport Mathlib.Data.Polynomial.Basic\nimport Mathlib.Data.Polynomial.AlgebraMap", + "import Mathlib.RingTheory.PrincipalIdealDomain\nimport Mathlib.RingTheory.Ideal.LocalRing\nimport Mathlib.RingTheory.Valuation.PrimeMultiplicity\nimport Mathlib.LinearAlgebra.AdicCompletion", + "import Mathlib.GroupTheory.Subgroup.Basic\nimport Mathlib.RingTheory.NonUnitalSubsemiring.Basic", + "import Mathlib.RingTheory.Localization.Integer\nimport Mathlib.RingTheory.Localization.Submodule", + "import Mathlib.Algebra.Group.Conj\nimport Mathlib.Algebra.Group.Pi.Lemmas\nimport Mathlib.Data.Set.Image\nimport Mathlib.GroupTheory.Submonoid.Centralizer\nimport Mathlib.Order.Atoms\nimport Mathlib.Tactic.ApplyFun", + "import Mathlib.Algebra.Group.Prod\nimport Mathlib.Algebra.Group.Units.Equiv\nimport Mathlib.Algebra.GroupPower.IterateHom\nimport Mathlib.Logic.Equiv.Set", + "import Mathlib.Algebra.Module.BigOperators\nimport Mathlib.Data.Fintype.Perm\nimport Mathlib.GroupTheory.Perm.Finite\nimport Mathlib.GroupTheory.Perm.List", + "import Mathlib.Algebra.Group.Hom.Defs\nimport Mathlib.Algebra.Group.Units\nimport Mathlib.GroupTheory.Subsemigroup.Basic", + "import Mathlib.Algebra.PUnitInstances\nimport Mathlib.GroupTheory.Subgroup.Basic\nimport Mathlib.GroupTheory.Congruence\nimport Mathlib.GroupTheory.Submonoid.Membership", + "import Mathlib.Data.Fintype.Card\nimport Mathlib.GroupTheory.GroupAction.Defs\nimport Mathlib.GroupTheory.GroupAction.Group\nimport Mathlib.Data.Setoid.Basic\nimport Mathlib.Data.Set.Pointwise.SMul\nimport Mathlib.GroupTheory.Subgroup.Basic", + "import Mathlib.Algebra.Group.Opposite\nimport Mathlib.Algebra.Group.Pi.Lemmas\nimport Mathlib.GroupTheory.GroupAction.Defs", + "import Mathlib.Algebra.Group.Hom.Defs\nimport Mathlib.Data.Set.Lattice\nimport Mathlib.Data.SetLike.Basic", + "import Mathlib.Data.Fintype.Basic\nimport Mathlib.Data.List.Sublists\nimport Mathlib.Data.List.InsertNth\nimport Mathlib.GroupTheory.Subgroup.Basic", + "import Mathlib.Algebra.Group.TypeTags\nimport Mathlib.Algebra.Ring.Defs\nimport Mathlib.Data.Int.Cast.Basic\nimport Mathlib.Order.Monotone.Basic", + "import Mathlib.Data.Nat.Order.Basic\nimport Mathlib.Data.Int.Basic\nimport Mathlib.Algebra.Order.Group.Abs\nimport Mathlib.Algebra.Order.Ring.CharZero\nimport Mathlib.Algebra.Divisibility.Basic", + "import Mathlib.Init.Data.Nat.Lemmas\nimport Mathlib.Data.Int.Cast.Defs\nimport Mathlib.Algebra.Group.Basic", + "import Mathlib.Data.Int.Order.Basic\nimport Mathlib.Data.Nat.Cast.Order\nimport Mathlib.Algebra.Ring.Divisibility.Basic", + "import Mathlib.Data.DList.Defs\nimport Mathlib.Tactic.TypeStar", + "import Mathlib.Mathport.Rename", + "import Mathlib.Data.Nat.SuccPred\nimport Mathlib.Algebra.CharZero.Lemmas\nimport Mathlib.Algebra.Order.Sub.WithTop\nimport Mathlib.Algebra.Order.Ring.WithTop", + "import Mathlib.Data.Real.Sqrt\nimport Mathlib.Analysis.NormedSpace.Star.Basic\nimport Mathlib.Analysis.NormedSpace.ContinuousLinearMap\nimport Mathlib.Analysis.NormedSpace.Basic", + "import Mathlib.Init.ZeroOne\nimport Mathlib.Data.Set.Defs\nimport Mathlib.Order.Basic\nimport Mathlib.Order.SymmDiff\nimport Mathlib.Tactic.Tauto\nimport Mathlib.Tactic.ByContra\nimport Mathlib.Util.Delaborators", + "import Mathlib.Data.Set.Function\nimport Mathlib.Logic.Relation\nimport Mathlib.Logic.Pairwise", + "import Mathlib.Algebra.Group.Equiv.Basic\nimport Mathlib.Algebra.Group.Units.Hom\nimport Mathlib.Algebra.GroupPower.Basic\nimport Mathlib.Algebra.GroupWithZero.Basic\nimport Mathlib.Algebra.Opposites\nimport Mathlib.Data.Nat.Order.Basic\nimport Mathlib.Data.Set.Lattice\nimport Mathlib.Tactic.Common", + "import Mathlib.Order.MinMax\nimport Mathlib.Data.Set.Basic\nimport Mathlib.Tactic.Says", + "import Mathlib.Data.List.Lex\nimport Mathlib.Data.Char", + "import Mathlib.Logic.Function.Basic\nimport Mathlib.Tactic.MkIffOfInductiveProp", + "import Mathlib.Data.PNat.Defs\nimport Mathlib.Data.Nat.Bits\nimport Mathlib.Data.Nat.Order.Basic\nimport Mathlib.Data.Set.Basic\nimport Mathlib.Algebra.GroupWithZero.Divisibility\nimport Mathlib.Algebra.Order.Positive.Ring\nimport Mathlib.Order.Hom.Basic", + "import Mathlib.Data.W.Basic", + "import Mathlib.Control.Functor.Multivariate\nimport Mathlib.Data.PFunctor.Univariate.Basic", + "import Mathlib.Init.Function\nimport Mathlib.Logic.Function.Basic\nimport Mathlib.Tactic.Inhabit", + "import Mathlib.Algebra.Module.LinearMap.Basic\nimport Mathlib.Algebra.BigOperators.Basic\nimport Mathlib.Data.Set.Finite\nimport Mathlib.GroupTheory.Submonoid.Membership\nimport Mathlib.GroupTheory.GroupAction.BigOperators\nimport Mathlib.Data.Finset.Preimage", + "import Lean.Linter.Deprecated\nimport Mathlib.Mathport.Rename\nimport Mathlib.Init.Data.Nat.Bitwise\nimport Mathlib.Init.Data.Int.Basic\nimport Mathlib.Init.ZeroOne", + "import Mathlib.Logic.Equiv.List", + "import Mathlib.Init.Function\nimport Mathlib.Logic.Function.Basic", + "import Mathlib.Algebra.Algebra.Tower\nimport Mathlib.Algebra.GroupPower.Ring\nimport Mathlib.Algebra.Regular.Pow\nimport Mathlib.Algebra.MonoidAlgebra.Support\nimport Mathlib.Data.Finsupp.Antidiagonal\nimport Mathlib.Order.SymmDiff\nimport Mathlib.RingTheory.Adjoin.Basic", + "import Mathlib.Control.Traversable.Equiv\nimport Mathlib.Control.Traversable.Instances\nimport Std.Data.LazyList\nimport Mathlib.Lean.Thunk", + "import Mathlib.Logic.Relation\nimport Mathlib.Order.GaloisConnection", + "import Mathlib.Data.Vector\nimport Mathlib.Data.List.Nodup\nimport Mathlib.Data.List.OfFn\nimport Mathlib.Data.List.InsertNth\nimport Mathlib.Control.Applicative\nimport Mathlib.Control.Traversable.Basic", + "import Mathlib.Algebra.GroupPower.Ring\nimport Mathlib.Algebra.MonoidAlgebra.Basic\nimport Mathlib.Data.Finset.Sort", + "import Mathlib.RingTheory.Finiteness\nimport Mathlib.Data.Polynomial.AlgebraMap", + "import Std.Tactic.Alias", + "import Mathlib.Algebra.BigOperators.Finsupp\nimport Mathlib.Algebra.Regular.SMul\nimport Mathlib.Data.Finset.Preimage\nimport Mathlib.Data.Rat.BigOperators\nimport Mathlib.GroupTheory.GroupAction.Hom\nimport Mathlib.Data.Set.Basic", + "import Mathlib.Data.Finset.Attr\nimport Mathlib.Data.Multiset.Bind\nimport Mathlib.Data.Multiset.FinsetOps\nimport Mathlib.Data.Set.Lattice", + "import Mathlib.Order.Cover\nimport Mathlib.Order.LocallyFinite\nimport Mathlib.Data.Set.Intervals.Monoid", + "import Mathlib.Algebra.Group.TypeTags\nimport Mathlib.Algebra.Ring.Defs\nimport Mathlib.Algebra.GroupWithZero.Defs", + "import Mathlib.Algebra.Order.Monoid.WithZero\nimport Mathlib.Algebra.Order.Ring.Canonical\nimport Mathlib.Data.Nat.Basic", + "import Mathlib.Data.Nat.Defs\nimport Mathlib.Tactic.GCongr.Core\nimport Mathlib.Tactic.Common\nimport Mathlib.Tactic.Monotonicity.Attr", + "import Mathlib.Algebra.GroupPower.Basic\nimport Mathlib.Algebra.GroupWithZero.Divisibility\nimport Mathlib.Data.Nat.Order.Lemmas\nimport Mathlib.Tactic.NthRewrite", + "import Mathlib.Algebra.Divisibility.Basic\nimport Mathlib.Algebra.Group.Equiv.Basic\nimport Mathlib.Algebra.Group.TypeTags\nimport Mathlib.Algebra.Ring.Hom.Defs\nimport Mathlib.Data.Nat.Basic", + "import Mathlib.Init.Data.Nat.Lemmas\nimport Mathlib.Init.Data.Nat.Bitwise\nimport Mathlib.Data.Nat.GCD.Basic\nimport Mathlib.Logic.Function.Iterate\nimport Mathlib.Data.Finset.NatAntidiagonal\nimport Mathlib.Algebra.BigOperators.Basic\nimport Mathlib.Tactic.Ring\nimport Mathlib.Tactic.Zify", + "import Mathlib.Data.Nat.Factorial.Basic\nimport Mathlib.Order.Monotone.Basic", + "import Mathlib.Algebra.BigOperators.Finsupp\nimport Mathlib.Data.Finsupp.Multiset\nimport Mathlib.Data.Nat.PrimeFin\nimport Mathlib.NumberTheory.Padics.PadicVal\nimport Mathlib.Data.Nat.GCD.BigOperators\nimport Mathlib.Data.Nat.Interval\nimport Mathlib.Tactic.IntervalCases\nimport Mathlib.Algebra.GroupPower.Order", + "import Mathlib.Data.Set.Basic\nimport Mathlib.Tactic.Monotonicity.Attr\nimport Mathlib.Tactic.SetLike", + "import Mathlib.Algebra.NeZero\nimport Mathlib.Order.RelIso.Basic\nimport Mathlib.Data.Nat.Order.Basic\nimport Mathlib.Order.Hom.Set\nimport Std.Data.Fin.Lemmas", + "import Mathlib.Data.Fin.OrderHom\nimport Mathlib.Data.Pi.Lex\nimport Mathlib.Data.Set.Intervals.Basic", + "import Mathlib.Algebra.Star.Basic\nimport Mathlib.Algebra.Order.CauSeq.Completion", + "import Mathlib.Algebra.CharP.Basic\nimport Mathlib.RingTheory.Ideal.Operations\nimport Mathlib.Data.Fintype.Units\nimport Mathlib.Data.Nat.Parity\nimport Mathlib.Tactic.FinCases", + "import Mathlib.Logic.Function.Basic\nimport Mathlib.Util.CompileInductive", + "import Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Algebra.Pi\nimport Mathlib.Algebra.BigOperators.Pi\nimport Mathlib.Algebra.BigOperators.Ring\nimport Mathlib.Algebra.BigOperators.RingEquiv\nimport Mathlib.Algebra.Module.LinearMap.Basic\nimport Mathlib.Algebra.Module.Pi\nimport Mathlib.Algebra.Star.BigOperators\nimport Mathlib.Algebra.Star.Module\nimport Mathlib.Algebra.Star.Pi\nimport Mathlib.Data.Fintype.BigOperators\nimport Mathlib.GroupTheory.GroupAction.BigOperators", + "import Mathlib.Init.Data.Nat.Lemmas\nimport Mathlib.Init.Function", + "import Mathlib.Data.Semiquot\nimport Mathlib.Data.Nat.Size\nimport Mathlib.Tactic.Ring.RingNF", + "import Mathlib.Data.Set.Card\nimport Mathlib.Order.Minimal\nimport Mathlib.Data.Matroid.Init", + "import Mathlib.Data.Set.List\nimport Mathlib.Data.List.Perm\nimport Mathlib.Init.Quot -- Porting note: added import\nimport Mathlib.Order.Hom.Basic", + "import Mathlib.Mathport.Rename", + "import Mathlib.Data.PFunctor.Univariate.M", + "import Mathlib.Data.PFunctor.Multivariate.Basic", + "import Mathlib.Init.Control.Combinators\nimport Mathlib.Data.Option.Defs\nimport Mathlib.Logic.IsEmpty\nimport Mathlib.Logic.Relator\nimport Mathlib.Util.CompileInductive\nimport Aesop", + "import Mathlib.Algebra.Order.Ring.WithTop\nimport Mathlib.Algebra.Order.Sub.WithTop\nimport Mathlib.Data.Real.NNReal\nimport Mathlib.Data.Set.Intervals.WithBotTop", + "import Mathlib.Data.Bool.Basic\nimport Mathlib.Data.Nat.Defs\nimport Mathlib.Data.Option.Basic\nimport Mathlib.Data.List.Defs\nimport Mathlib.Init.Data.List.Basic\nimport Mathlib.Init.Data.List.Instances\nimport Mathlib.Init.Data.List.Lemmas\nimport Mathlib.Logic.Unique\nimport Mathlib.Order.Basic\nimport Std.Data.List.Lemmas\nimport Mathlib.Tactic.Common", + "import Mathlib.Logic.Equiv.Nat\nimport Mathlib.Logic.Equiv.Fin\nimport Mathlib.Data.Countable.Defs", + "import Mathlib.Data.Multiset.Basic\nimport Mathlib.Data.Vector.Basic\nimport Mathlib.Data.Setoid.Basic\nimport Mathlib.Tactic.ApplyFun", + "import Mathlib.Init.Align", + "import Mathlib.Data.Fintype.Powerset\nimport Mathlib.Data.Fintype.Prod\nimport Mathlib.Data.Fintype.Sigma\nimport Mathlib.Data.Fintype.Sum\nimport Mathlib.Data.Fintype.Vector", + "import Mathlib.Algebra.CharZero.Lemmas\nimport Mathlib.Algebra.GroupPower.Ring\nimport Mathlib.Algebra.GroupWithZero.Bitwise\nimport Mathlib.Data.Real.Basic\nimport Mathlib.Data.Set.Image", + "import Mathlib.Algebra.Ring.Hom.Defs -- FIXME: This import is bogus\nimport Mathlib.Data.Finset.Image\nimport Mathlib.Data.Fin.OrderHom", + "import Mathlib.Algebra.Category.Ring.FilteredColimits\nimport Mathlib.Geometry.RingedSpace.SheafedSpace\nimport Mathlib.Topology.Sheaves.Stalks\nimport Mathlib.Algebra.Category.Ring.Colimits\nimport Mathlib.Algebra.Category.Ring.Limits", + "import Mathlib.Analysis.InnerProductSpace.Projection\nimport Mathlib.Geometry.Euclidean.PerpBisector\nimport Mathlib.Algebra.QuadraticDiscriminant", + "import Mathlib.Analysis.Convex.StrictConvexBetween\nimport Mathlib.Geometry.Euclidean.Basic", + "import Mathlib.Analysis.InnerProductSpace.Basic\nimport Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse", + "import Mathlib.Analysis.InnerProductSpace.TwoDim\nimport Mathlib.Geometry.Euclidean.Angle.Unoriented.Basic", + "import Mathlib.Analysis.Normed.Group.AddTorsor\nimport Mathlib.Analysis.InnerProductSpace.Basic", + "import Mathlib.Geometry.Manifold.MFDeriv.Defs", + "import Mathlib.Geometry.Manifold.ContMDiff.Defs", + "import Mathlib.Geometry.Manifold.LocalInvariantProperties\nimport Mathlib.Topology.Sheaves.LocalPredicate", + "import Mathlib.Geometry.Manifold.ContMDiff.Atlas\nimport Mathlib.Geometry.Manifold.VectorBundle.FiberwiseLinear\nimport Mathlib.Topology.VectorBundle.Constructions", + "import Mathlib.Data.Seq.Seq\nimport Mathlib.Algebra.Field.Defs", + "import Mathlib.Algebra.Order.Floor\nimport Mathlib.Algebra.ContinuedFractions.Basic", + "import Mathlib.CategoryTheory.Limits.Preserves.Shapes.Zero", + "import Mathlib.Algebra.Group.Basic\nimport Mathlib.Algebra.Group.Hom.Defs\nimport Mathlib.Algebra.GroupWithZero.NeZero\nimport Mathlib.Algebra.Opposites\nimport Mathlib.Algebra.Ring.Defs", + "import Mathlib.Algebra.Divisibility.Basic\nimport Mathlib.Algebra.Group.Units.Hom\nimport Mathlib.Algebra.GroupWithZero.InjSurj\nimport Mathlib.Algebra.Ring.Hom.Defs\nimport Mathlib.Data.Set.Basic", + "import Mathlib.Algebra.Divisibility.Basic\nimport Mathlib.Algebra.Group.Equiv.Basic\nimport Mathlib.Algebra.Ring.Defs", + "import Mathlib.Algebra.Associated\nimport Mathlib.Algebra.Ring.Regular\nimport Mathlib.Tactic.Common", + "import Mathlib.Algebra.BigOperators.Multiset.Lemmas\nimport Mathlib.Algebra.BigOperators.Multiset.Order\nimport Mathlib.Algebra.Function.Indicator\nimport Mathlib.Algebra.Ring.Opposite\nimport Mathlib.Data.Finset.Powerset\nimport Mathlib.Data.Finset.Preimage\nimport Mathlib.Data.Finset.Sigma\nimport Mathlib.Data.Finset.Sum\nimport Mathlib.Data.Fintype.Pi\nimport Mathlib.Data.Int.Cast.Lemmas\nimport Mathlib.Data.Set.Image", + "import Mathlib.Algebra.BigOperators.List.Defs\nimport Mathlib.Data.List.Forall2\nimport Mathlib.Algebra.Divisibility.Basic\nimport Mathlib.Algebra.Ring.Commute\nimport Mathlib.Data.Nat.Order.Basic\nimport Mathlib.Data.Int.Basic", + "import Mathlib.Algebra.Group.Hom.Basic\nimport Mathlib.Algebra.GroupPower.Hom\nimport Mathlib.Algebra.BigOperators.List.Basic\nimport Mathlib.Data.Multiset.Basic", + "import Mathlib.Algebra.CharZero.Lemmas\nimport Mathlib.Algebra.Module.Submodule.Ker\nimport Mathlib.Algebra.Module.Submodule.RestrictScalars\nimport Mathlib.Algebra.Module.ULift\nimport Mathlib.RingTheory.Subring.Basic", + "import Mathlib.Algebra.Algebra.Basic\nimport Mathlib.Data.Set.UnionLift\nimport Mathlib.LinearAlgebra.Finsupp\nimport Mathlib.RingTheory.Ideal.Operations", + "import Mathlib.Algebra.Order.Monoid.Defs\nimport Mathlib.Algebra.Group.InjSurj\nimport Mathlib.Order.Hom.Basic", + "import Mathlib.Logic.Basic\nimport Mathlib.Tactic.Positivity.Basic", + "import Mathlib.Algebra.Order.AbsoluteValue\nimport Mathlib.Algebra.Order.Field.Basic\nimport Mathlib.Algebra.Order.Group.MinMax\nimport Mathlib.Algebra.Ring.Pi\nimport Mathlib.GroupTheory.GroupAction.Pi\nimport Mathlib.GroupTheory.GroupAction.Ring\nimport Mathlib.Init.Align\nimport Mathlib.Tactic.GCongr\nimport Mathlib.Tactic.Ring", + "import Mathlib.Algebra.Group.Equiv.Basic\nimport Mathlib.Algebra.Ring.Basic\nimport Mathlib.Algebra.Order.Sub.Defs\nimport Mathlib.Order.Hom.Basic", + "import Mathlib.Algebra.Field.Basic\nimport Mathlib.Algebra.GroupWithZero.Units.Equiv\nimport Mathlib.Algebra.Order.Field.Defs\nimport Mathlib.Algebra.Order.Ring.Abs\nimport Mathlib.Order.Bounds.OrderIso\nimport Mathlib.Tactic.Positivity.Core", + "import Mathlib.Algebra.Order.Field.Canonical.Defs", + "import Mathlib.Algebra.Field.Defs\nimport Mathlib.Algebra.GroupWithZero.Units.Lemmas\nimport Mathlib.Algebra.Ring.Commute\nimport Mathlib.Algebra.Ring.Hom.Defs", + "import Mathlib.Algebra.Invertible.GroupWithZero\nimport Mathlib.Algebra.Group.Commute.Units\nimport Mathlib.Algebra.Group.Hom.Defs\nimport Mathlib.Algebra.Group.Units\nimport Mathlib.Algebra.GroupPower.Basic\nimport Mathlib.Algebra.GroupWithZero.Units.Basic\nimport Mathlib.Algebra.Ring.Defs", + "import Mathlib.Data.Bracket\nimport Mathlib.LinearAlgebra.Basic", + "import Mathlib.Algebra.Ring.Divisibility.Lemmas\nimport Mathlib.Algebra.Lie.Nilpotent\nimport Mathlib.Algebra.Lie.Engel\nimport Mathlib.LinearAlgebra.Eigenspace.Triangularizable\nimport Mathlib.RingTheory.Artinian\nimport Mathlib.LinearAlgebra.Trace\nimport Mathlib.LinearAlgebra.FreeModule.PID", + "import Mathlib.Data.DFinsupp.Basic\nimport Mathlib.GroupTheory.Submonoid.Operations", + "import Mathlib.Algebra.GroupWithZero.Units.Lemmas\nimport Mathlib.Algebra.Ring.Equiv\nimport Mathlib.GroupTheory.GroupAction.Group", + "import Mathlib.RingTheory.UniqueFactorizationDomain", + "import Mathlib.Algebra.GroupPower.Basic\nimport Mathlib.Algebra.Group.Hom.Defs", + "import Mathlib.Algebra.BigOperators.List.Basic\nimport Mathlib.GroupTheory.GroupAction.Defs", + "import Mathlib.Algebra.Module.Basic\nimport Mathlib.Algebra.Order.Archimedean\nimport Mathlib.Algebra.Order.Group.Instances", + "import Mathlib.Data.Int.ModEq\nimport Mathlib.Data.Nat.Multiplicity\nimport Mathlib.Data.Nat.Choose.Sum\nimport Mathlib.Data.Nat.Cast.Prod\nimport Mathlib.Algebra.Group.ULift\nimport Mathlib.GroupTheory.OrderOfElement", + "import Mathlib.Algebra.Lie.OfAssociative", + "import Mathlib.Algebra.Category.MonCat.Basic\nimport Mathlib.CategoryTheory.Endomorphism", + "import Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.CategoryTheory.Conj\nimport Mathlib.CategoryTheory.Linear.Basic\nimport Mathlib.CategoryTheory.Preadditive.AdditiveFunctor\nimport Mathlib.LinearAlgebra.Basic", + "import Mathlib.Algebra.Category.ModuleCat.Basic\nimport Mathlib.LinearAlgebra.TensorProduct.Basic\nimport Mathlib.CategoryTheory.Monoidal.Linear", + "import Mathlib.Algebra.Algebra.Subalgebra.Basic\nimport Mathlib.Algebra.FreeAlgebra\nimport Mathlib.Algebra.Category.Ring.Basic\nimport Mathlib.Algebra.Category.ModuleCat.Basic", + "import Mathlib.CategoryTheory.ConcreteCategory.BundledHom\nimport Mathlib.Algebra.PUnitInstances\nimport Mathlib.CategoryTheory.Functor.ReflectsIso", + "import Mathlib.Algebra.PEmptyInstances\nimport Mathlib.Algebra.Group.Equiv.Basic\nimport Mathlib.CategoryTheory.ConcreteCategory.BundledHom\nimport Mathlib.CategoryTheory.Functor.ReflectsIso", + "import Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.CategoryTheory.ConcreteCategory.ReflectsIso\nimport Mathlib.Algebra.Ring.Equiv", + "import Mathlib.CategoryTheory.Monoidal.Rigid.Basic\nimport Mathlib.CategoryTheory.Monoidal.Subcategory\nimport Mathlib.LinearAlgebra.Coevaluation\nimport Mathlib.LinearAlgebra.FreeModule.Finite.Matrix\nimport Mathlib.Algebra.Category.ModuleCat.Monoidal.Closed", + "import Mathlib.Algebra.Group.Commute.Basic\nimport Mathlib.Algebra.GroupWithZero.Defs\nimport Mathlib.Data.Int.Defs\nimport Mathlib.Tactic.Common", + "import Mathlib.Algebra.GroupPower.CovariantClass\nimport Mathlib.Algebra.Order.Monoid.WithTop\nimport Mathlib.Algebra.SMulWithZero\nimport Mathlib.Order.Hom.Basic\nimport Mathlib.Data.Nat.Order.Basic", + "import Mathlib.Algebra.EuclideanDomain.Defs\nimport Mathlib.Algebra.Ring.Divisibility.Basic\nimport Mathlib.Algebra.Ring.Regular\nimport Mathlib.Algebra.GroupWithZero.Divisibility\nimport Mathlib.Algebra.Ring.Basic", + "import Mathlib.Algebra.Function.Indicator\nimport Mathlib.Algebra.SMulWithZero\nimport Mathlib.Data.Int.Basic\nimport Mathlib.Data.NNRat.Defs\nimport Mathlib.GroupTheory.GroupAction.Group\nimport Mathlib.GroupTheory.GroupAction.Pi\nimport Mathlib.Logic.Basic\nimport Mathlib.Tactic.Abel", + "import Mathlib.GroupTheory.GroupAction.SubMulAction\nimport Mathlib.GroupTheory.Submonoid.Membership", + "import Mathlib.Algebra.Module.Pi\nimport Mathlib.Algebra.Ring.CompTypeclasses\nimport Mathlib.Algebra.Star.Basic\nimport Mathlib.GroupTheory.GroupAction.DomAct.Basic\nimport Mathlib.GroupTheory.GroupAction.Hom", + "import Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.NonUnitalHom\nimport Mathlib.Algebra.BigOperators.Finsupp\nimport Mathlib.Algebra.Module.BigOperators\nimport Mathlib.LinearAlgebra.Finsupp", + "import Mathlib.Algebra.Group.Commute.Defs\nimport Mathlib.Algebra.Group.Units\nimport Mathlib.Algebra.Order.Monoid.Lemmas\nimport Mathlib.Tactic.NthRewrite", + "import Aesop\nimport Mathlib.Algebra.Group.Defs\nimport Mathlib.Logic.Function.Basic\nimport Mathlib.Tactic.Cases\nimport Mathlib.Tactic.SimpRw\nimport Mathlib.Tactic.SplitIfs", + "import Mathlib.Algebra.Group.Semiconj.Defs\nimport Mathlib.Algebra.Group.Basic", + "import Mathlib.Algebra.Group.Basic\nimport Mathlib.Algebra.Group.Hom.Defs", + "import Mathlib.Algebra.Group.Defs\nimport Mathlib.Data.Prod.Basic\nimport Mathlib.Data.Sum.Basic\nimport Mathlib.Logic.Unique\nimport Mathlib.Tactic.Spread", + "import Mathlib.Algebra.Group.Equiv.Basic\nimport Mathlib.Algebra.Group.WithOne.Defs\nimport Mathlib.Data.Option.Basic", + "import Mathlib.Algebra.Group.Hom.Basic\nimport Mathlib.Data.FunLike.Equiv\nimport Mathlib.Logic.Equiv.Basic", + "import Mathlib.Algebra.Group.Commute.Defs\nimport Mathlib.Algebra.Group.Semiconj.Basic", + "import Mathlib.Algebra.Field.Opposite\nimport Mathlib.Algebra.Invertible.Defs\nimport Mathlib.Algebra.Ring.Aut\nimport Mathlib.Algebra.Ring.CompTypeclasses\nimport Mathlib.Algebra.Field.Opposite\nimport Mathlib.Algebra.Invertible.Defs\nimport Mathlib.Data.NNRat.Defs\nimport Mathlib.Data.Rat.Cast.Defs\nimport Mathlib.Data.SetLike.Basic\nimport Mathlib.GroupTheory.GroupAction.Opposite", + "import Mathlib.Algebra.Group.Basic\nimport Mathlib.Algebra.GroupWithZero.NeZero\nimport Mathlib.Algebra.Group.OrderSynonym", + "import Mathlib.Algebra.GroupWithZero.Basic\nimport Mathlib.Algebra.Group.Units\nimport Mathlib.Tactic.Nontriviality\nimport Mathlib.Util.AssertExists\nimport Mathlib.Tactic.Contrapose", + "import Mathlib.CategoryTheory.Category.Grpd\nimport Mathlib.CategoryTheory.Groupoid\nimport Mathlib.Topology.Category.TopCat.Basic\nimport Mathlib.Topology.Homotopy.Path\nimport Mathlib.Data.Set.Basic", + "import Mathlib.RingTheory.IntegralClosure", + "import Mathlib.FieldTheory.Normal\nimport Mathlib.FieldTheory.Perfect\nimport Mathlib.RingTheory.Localization.Integral", + "import Mathlib.FieldTheory.Separable\nimport Mathlib.RingTheory.IntegralDomain\nimport Mathlib.Algebra.CharP.Reduced\nimport Mathlib.Tactic.ApplyFun", + "import Lean\nimport Std\nimport Mathlib.Tactic.PPWithUniv\nimport Mathlib.Tactic.ExtendDoc\nimport Mathlib.Tactic.Lemma\nimport Mathlib.Tactic.TypeStar", + "import Lean.Elab.Tactic.SolveByElim\nimport Mathlib.Tactic.Monotonicity.Attr", + "import Lean.Elab.Tactic.Simp\nimport Lean.Elab.App\nimport Mathlib.Tactic.Simps.NotationClass\nimport Std.Data.String.Basic\nimport Std.Util.LibraryNote\nimport Mathlib.Lean.Expr.Basic", + "import Mathlib.Tactic.NormNum.Inv\nimport Mathlib.Tactic.NormNum.Pow\nimport Mathlib.Util.AtomM\nimport Mathlib.Data.Rat.Order", + "import Mathlib.Tactic.NormNum.Core\nimport Mathlib.Tactic.HaveI\nimport Mathlib.Data.Nat.Cast.Commute\nimport Mathlib.Data.Int.Basic\nimport Mathlib.Algebra.Invertible.Basic\nimport Mathlib.Tactic.Clear!\nimport Mathlib.Data.Nat.Cast.Basic", + "import Mathlib.Algebra.GroupPower.Order\nimport Mathlib.Data.Int.CharZero\nimport Mathlib.Data.Int.Order.Basic\nimport Mathlib.Data.Nat.Factorial.Basic\nimport Mathlib.Data.Rat.Order\nimport Mathlib.Tactic.Positivity.Core\nimport Qq", + "import Std.Data.Rat.Lemmas\nimport Mathlib.Mathport.Rename", + "import Mathlib.Mathport.Rename", + "import Std.Logic\nimport Mathlib.Mathport.Rename", + "import Mathlib.Mathport.Rename\nimport Mathlib.Init.Data.Nat.Notation\nimport Std.Data.List.Basic", + "import Mathlib.Init.ZeroOne\nimport Mathlib.Init.Data.Nat.Notation\nimport Mathlib.Util.CompileInductive", + "import Mathlib.Init.Data.Nat.Notation", + "import Mathlib.Mathport.Rename", + "import Mathlib.Mathport.Rename\nimport Std.Data.Bool", + "import Mathlib.AlgebraicGeometry.AffineScheme\nimport Mathlib.AlgebraicGeometry.Pullbacks\nimport Mathlib.CategoryTheory.MorphismProperty\nimport Mathlib.Data.List.TFAE", + "import Mathlib.LinearAlgebra.Finsupp\nimport Mathlib.RingTheory.Ideal.Over\nimport Mathlib.RingTheory.Ideal.Prod\nimport Mathlib.RingTheory.Ideal.MinimalPrime\nimport Mathlib.RingTheory.Localization.Away.Basic\nimport Mathlib.RingTheory.Nilpotent\nimport Mathlib.Topology.Sets.Closeds\nimport Mathlib.Topology.Sober", + "import Mathlib.Data.Set.Function\nimport Mathlib.Logic.Function.Iterate\nimport Mathlib.GroupTheory.Perm.Basic", + "import Mathlib.Algebra.BigOperators.Basic\nimport Mathlib.Dynamics.FixedPoints.Basic", + "import Mathlib.Algebra.Function.Support\nimport Mathlib.Order.Filter.Lift\nimport Mathlib.Topology.Defs.Filter", + "import Mathlib.Order.SetNotation\nimport Mathlib.Tactic.Continuity\nimport Mathlib.Tactic.FunProp", + "import Mathlib.Topology.Order.ProjIcc\nimport Mathlib.Topology.ContinuousFunction.Ordered\nimport Mathlib.Topology.CompactOpen\nimport Mathlib.Topology.UnitInterval", + "import Mathlib.Analysis.NormedSpace.BoundedLinearMaps\nimport Mathlib.Topology.FiberBundle.Basic", + "import Mathlib.Data.Set.Image\nimport Mathlib.Order.SuccPred.Relation\nimport Mathlib.Topology.Clopen\nimport Mathlib.Topology.Irreducible", + "import Mathlib.CategoryTheory.ConcreteCategory.BundledHom\nimport Mathlib.CategoryTheory.Elementwise\nimport Mathlib.Topology.ContinuousFunction.Basic", + "import Mathlib.Topology.Category.TopCat.Basic\nimport Mathlib.CategoryTheory.Limits.Types", + "import Mathlib.Topology.Category.CompHaus.Basic\nimport Mathlib.Topology.LocallyConstant.Basic\nimport Mathlib.CategoryTheory.FintypeCat", + "import Mathlib.Topology.Category.Profinite.Basic\nimport Mathlib.CategoryTheory.Limits.ConcreteCategory", + "import Mathlib.Topology.ExtremallyDisconnected\nimport Mathlib.Topology.Category.CompHaus.Projective\nimport Mathlib.Topology.Category.Profinite.Basic", + "import Mathlib.CategoryTheory.Adjunction.Reflective\nimport Mathlib.Topology.StoneCech\nimport Mathlib.CategoryTheory.Monad.Limits\nimport Mathlib.Topology.UrysohnsLemma\nimport Mathlib.Topology.Category.TopCat.Limits.Basic\nimport Mathlib.Data.Set.Basic", + "import Mathlib.Order.Filter.SmallSets\nimport Mathlib.Tactic.Monotonicity\nimport Mathlib.Topology.Compactness.Compact\nimport Mathlib.Topology.NhdsSet\nimport Mathlib.Algebra.Group.Defs", + "import Mathlib.Data.Set.Intervals.Pi\nimport Mathlib.Data.Set.Pointwise.Basic\nimport Mathlib.Order.Filter.Interval\nimport Mathlib.Tactic.TFAE\nimport Mathlib.Tactic.NormNum\nimport Mathlib.Topology.Order.LeftRight\nimport Mathlib.Topology.Order.OrderClosed", + "import Mathlib.Order.Hom.Basic\nimport Mathlib.Topology.ContinuousFunction.Basic", + "import Mathlib.Topology.Algebra.Ring.Basic\nimport Mathlib.Topology.Algebra.MulAction\nimport Mathlib.Topology.Algebra.UniformGroup\nimport Mathlib.Topology.ContinuousFunction.Basic\nimport Mathlib.Topology.UniformSpace.UniformEmbedding\nimport Mathlib.Algebra.Algebra.Basic\nimport Mathlib.LinearAlgebra.Projection\nimport Mathlib.LinearAlgebra.Pi\nimport Mathlib.LinearAlgebra.Finsupp", + "import Mathlib.Topology.Algebra.Module.Basic\nimport Mathlib.LinearAlgebra.Multilinear.Basic", + "import Mathlib.LinearAlgebra.Alternating.Basic\nimport Mathlib.LinearAlgebra.BilinearMap\nimport Mathlib.Topology.Algebra.Module.Multilinear.Basic", + "import Mathlib.GroupTheory.Subgroup.Basic\nimport Mathlib.Topology.Algebra.OpenSubgroup\nimport Mathlib.Topology.Algebra.Ring.Basic", + "import Mathlib.Algebra.Ring.Prod\nimport Mathlib.RingTheory.Subring.Basic\nimport Mathlib.Topology.Algebra.Group.Basic", + "import Mathlib.Topology.Algebra.InfiniteSum.Defs\nimport Mathlib.Data.Fintype.BigOperators\nimport Mathlib.Topology.Algebra.Monoid", + "import Mathlib.GroupTheory.GroupAction.ConjAct\nimport Mathlib.GroupTheory.GroupAction.Quotient\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.Topology.Algebra.Monoid\nimport Mathlib.Topology.Algebra.Constructions", + "import Mathlib.Data.Nat.Interval\nimport Mathlib.Data.ENNReal.Real\nimport Mathlib.Topology.UniformSpace.Pi\nimport Mathlib.Topology.UniformSpace.UniformConvergence\nimport Mathlib.Topology.UniformSpace.UniformEmbedding", + "import Mathlib.Algebra.Function.Indicator\nimport Mathlib.Tactic.FinCases\nimport Mathlib.Topology.Sets.Closeds", + "import Mathlib.Order.Filter.Cofinite", + "import Mathlib.Topology.MetricSpace.ProperSpace", + "import Mathlib.Topology.MetricSpace.Basic", + "import Mathlib.Topology.FiberBundle.Trivialization", + "import Mathlib.Data.Set.UnionLift\nimport Mathlib.Topology.Homeomorph", + "import Mathlib.Algebra.GeomSum\nimport Mathlib.RingTheory.Ideal.Quotient", + "import Mathlib.Algebra.Associated\nimport Mathlib.RingTheory.Int.Basic\nimport Mathlib.Tactic.Ring\nimport Mathlib.Algebra.Star.Unitary", + "import Mathlib.Algebra.DirectSum.Algebra\nimport Mathlib.Analysis.Complex.UpperHalfPlane.FunctionsBoundedAtInfty\nimport Mathlib.Analysis.Complex.UpperHalfPlane.Manifold\nimport Mathlib.Geometry.Manifold.MFDeriv.SpecificFunctions\nimport Mathlib.NumberTheory.ModularForms.SlashInvariantForms", + "import Mathlib.NumberTheory.ModularForms.SlashInvariantForms\nimport Mathlib.NumberTheory.ModularForms.CongruenceSubgroups", + "import Mathlib.Data.Int.Parity\nimport Mathlib.RingTheory.DedekindDomain.IntegralClosure", + "import Mathlib.Algebra.GCDMonoid.Finset\nimport Mathlib.Algebra.GroupPower.Ring\nimport Mathlib.Data.Nat.Parity\nimport Mathlib.Data.Rat.Defs\nimport Mathlib.Tactic.Positivity.Basic\nimport Mathlib.Tactic.TFAE", + "import Mathlib.Analysis.PSeries\nimport Mathlib.NumberTheory.ArithmeticFunction\nimport Mathlib.Analysis.NormedSpace.FiniteDimension", + "import Mathlib.Init.Core\nimport Mathlib.RingTheory.Polynomial.Cyclotomic.Roots\nimport Mathlib.NumberTheory.NumberField.Basic\nimport Mathlib.FieldTheory.Galois", + "import Mathlib.Analysis.Calculus.MeanValue\nimport Mathlib.Analysis.Calculus.Deriv.Polynomial\nimport Mathlib.Data.Polynomial.DenomsClearable\nimport Mathlib.Data.Real.Irrational\nimport Mathlib.Topology.Algebra.Polynomial", + "import Mathlib.NumberTheory.LegendreSymbol.QuadraticChar.Basic", + "import Mathlib.Data.Fintype.Parity\nimport Mathlib.NumberTheory.LegendreSymbol.ZModChar\nimport Mathlib.FieldTheory.Finite.Basic", + "import Mathlib.Algebra.Periodic\nimport Mathlib.Data.ZMod.Units\nimport Mathlib.NumberTheory.LegendreSymbol.MulCharacter", + "import Mathlib.Analysis.Normed.Field.InfiniteSum\nimport Mathlib.Analysis.SpecificLimits.Normed\nimport Mathlib.NumberTheory.ArithmeticFunction\nimport Mathlib.NumberTheory.SmoothNumbers", + "import Lean.Meta.Tactic.Rewrite\nimport Std.Lean.Expr\nimport Std.Lean.Name\nimport Std.Data.Rat.Basic\nimport Std.Data.List.Basic\nimport Std.Lean.Name\nimport Std.Logic", + "import Mathlib.Lean.Meta", + "import Lean.Meta.AppBuilder\nimport Lean.Meta.Basic", + "import Mathlib.Data.Opposite\nimport Mathlib.Tactic.Cases", + "import Mathlib.Combinatorics.SimpleGraph.Init\nimport Mathlib.Data.Rel\nimport Mathlib.Data.Set.Finite\nimport Mathlib.Data.Sym.Sym2", + "import Mathlib.Algebra.GroupPower.Order\nimport Mathlib.Combinatorics.SimpleGraph.Clique\nimport Mathlib.Data.Finset.Sym\nimport Mathlib.Tactic.GCongr\nimport Mathlib.Tactic.Positivity", + "import Mathlib.Dynamics.FixedPoints.Basic\nimport Mathlib.GroupTheory.Perm.Option\nimport Mathlib.Logic.Equiv.Defs\nimport Mathlib.Logic.Equiv.Option", + "import Mathlib.Combinatorics.Hall.Finite\nimport Mathlib.CategoryTheory.CofilteredSystem\nimport Mathlib.Data.Rel" + ], + "working_file": "import Mathlib.MeasureTheory.Measure.GiryMonad\nimport Mathlib.Dynamics.Ergodic.MeasurePreserving\nimport Mathlib.MeasureTheory.Integral.Lebesgue\nimport Mathlib.MeasureTheory.Measure.OpenPos\nimport Mathlib.Analysis.Normed.Group.Basic\nimport Mathlib.MeasureTheory.Function.AEMeasurableSequence\nimport Mathlib.MeasureTheory.Group.Arithmetic\nimport Mathlib.MeasureTheory.Order.Lattice\nimport Mathlib.Topology.Instances.EReal\nimport Mathlib.Topology.MetricSpace.Thickening\nimport Mathlib.Topology.GDelta\nimport Mathlib.Topology.Order.Lattice\nimport Mathlib.Topology.Semicontinuous\nimport Mathlib.Analysis.SpecificLimits.Basic\nimport Mathlib.MeasureTheory.PiSystem\nimport Mathlib.Data.Countable.Basic\nimport Mathlib.Data.Fin.VecNotation\nimport Mathlib.MeasureTheory.Measure.Content\nimport Mathlib.MeasureTheory.Group.Prod\nimport Mathlib.Topology.Algebra.Group.Compact\nimport Mathlib.Dynamics.Ergodic.MeasurePreserving\nimport Mathlib.LinearAlgebra.Determinant\nimport Mathlib.LinearAlgebra.Matrix.Diagonal\nimport Mathlib.LinearAlgebra.Matrix.Transvection\nimport Mathlib.MeasureTheory.Constructions.Pi\nimport Mathlib.MeasureTheory.Measure.Stieltjes\nimport Mathlib.MeasureTheory.Measure.Haar.OfBasis\nimport Mathlib.Data.Finset.Update\nimport Mathlib.Data.Prod.TProd\nimport Mathlib.GroupTheory.Coset\nimport Mathlib.Logic.Equiv.Fin\nimport Mathlib.MeasureTheory.MeasurableSpace.Defs\nimport Mathlib.Order.Filter.SmallSets\nimport Mathlib.Order.LiminfLimsup\nimport Mathlib.Data.Set.UnionLift\nimport Mathlib.Analysis.NormedSpace.BoundedLinearMaps\nimport Mathlib.MeasureTheory.Measure.WithDensity\nimport Mathlib.MeasureTheory.Function.SimpleFuncDense\nimport Mathlib.Topology.Algebra.Module.FiniteDimension\nimport Mathlib.MeasureTheory.Function.AEEqFun.DomAct\nimport Mathlib.MeasureTheory.Function.LpSpace\nimport Mathlib.Analysis.SpecialFunctions.Pow.NNReal\nimport Mathlib.MeasureTheory.Constructions.BorelSpace.Complex\nimport Mathlib.MeasureTheory.Function.ConditionalExpectation.CondexpL1\nimport Mathlib.Analysis.NormedSpace.IndicatorFunction\nimport Mathlib.MeasureTheory.Function.EssSup\nimport Mathlib.MeasureTheory.Function.AEEqFun\nimport Mathlib.MeasureTheory.Function.SpecialFunctions.Basic\nimport Mathlib.Topology.Instances.ENNReal\nimport Mathlib.MeasureTheory.Measure.Dirac\nimport Mathlib.Probability.Notation\nimport Mathlib.Probability.Process.Stopping\nimport Mathlib.Probability.Independence.Kernel\nimport Mathlib.MeasureTheory.Integral.Bochner\nimport Mathlib.MeasureTheory.Measure.GiryMonad\nimport Mathlib.Algebra.Module.Hom\nimport Mathlib.Algebra.Module.Prod\nimport Mathlib.Algebra.Module.Submodule.Ker\nimport Mathlib.Data.Set.Finite\nimport Mathlib.Order.ConditionallyCompleteLattice.Basic\nimport Mathlib.LinearAlgebra.RootSystem.Defs\nimport Mathlib.LinearAlgebra.Matrix.Adjugate\nimport Mathlib.RingTheory.PolynomialAlgebra\nimport Mathlib.Algebra.AddTorsor\nimport Mathlib.GroupTheory.Perm.Sign\nimport Mathlib.Data.Fintype.Perm\nimport Mathlib.LinearAlgebra.Multilinear.Basis\nimport Mathlib.Data.Finsupp.Fintype\nimport Mathlib.LinearAlgebra.TensorProduct.Basis\nimport Mathlib.RingTheory.Finiteness\nimport Mathlib.LinearAlgebra.FreeModule.Basic\nimport Mathlib.Algebra.RingQuot\nimport Mathlib.LinearAlgebra.TensorAlgebra.Basic\nimport Mathlib.LinearAlgebra.QuadraticForm.Isometry\nimport Mathlib.LinearAlgebra.QuadraticForm.IsometryEquiv\nimport Mathlib.Algebra.Module.Submodule.Bilinear\nimport Mathlib.GroupTheory.Congruence\nimport Mathlib.LinearAlgebra.Basic\nimport Mathlib.Tactic.SuppressCompilation\nimport Mathlib.LinearAlgebra.Matrix.Determinant\nimport Mathlib.LinearAlgebra.Matrix.SesquilinearForm\nimport Mathlib.LinearAlgebra.Matrix.Symmetric\nimport Mathlib.Algebra.Algebra.Basic\nimport Mathlib.Algebra.BigOperators.Order\nimport Mathlib.Data.Fintype.BigOperators\nimport Mathlib.Data.Fintype.Sort\nimport Mathlib.Data.List.FinRange\nimport Mathlib.LinearAlgebra.Pi\nimport Mathlib.LinearAlgebra.CliffordAlgebra.Basic\nimport Mathlib.LinearAlgebra.Alternating.Basic\nimport Mathlib.Algebra.Algebra.Spectrum\nimport Mathlib.LinearAlgebra.GeneralLinearGroup\nimport Mathlib.LinearAlgebra.FiniteDimensional\nimport Mathlib.Algebra.FreeAlgebra\nimport Mathlib.Algebra.RingQuot\nimport Mathlib.Algebra.TrivSqZeroExt\nimport Mathlib.Algebra.Algebra.Operations\nimport Mathlib.LinearAlgebra.Multilinear.Basic\nimport Mathlib.Algebra.Algebra.Tower\nimport Mathlib.LinearAlgebra.FiniteDimensional\nimport Mathlib.LinearAlgebra.LinearIndependent\nimport Mathlib.LinearAlgebra.FreeModule.Finite.Basic\nimport Mathlib.LinearAlgebra.Matrix.Charpoly.Coeff\nimport Mathlib.FieldTheory.Minpoly.Field\nimport Mathlib.Init.Logic\nimport Mathlib.Init.Function\nimport Mathlib.Init.Algebra.Classes\nimport Std.Util.LibraryNote\nimport Std.Tactic.Lint.Basic\nimport Mathlib.Init.Order.Defs\nimport Mathlib.Logic.Nontrivial.Defs\nimport Mathlib.Tactic.Attr.Register\nimport Mathlib.Data.Prod.Basic\nimport Mathlib.Data.Subtype\nimport Mathlib.Logic.Function.Basic\nimport Mathlib.Logic.Unique\nimport Mathlib.Data.Bool.Basic\nimport Mathlib.Data.Option.Defs\nimport Mathlib.Data.Prod.Basic\nimport Mathlib.Data.Sigma.Basic\nimport Mathlib.Data.Subtype\nimport Mathlib.Data.Sum.Basic\nimport Mathlib.Init.Data.Sigma.Basic\nimport Mathlib.Logic.Equiv.Defs\nimport Mathlib.Logic.Function.Conjugate\nimport Mathlib.Tactic.Lift\nimport Mathlib.Tactic.Convert\nimport Mathlib.Tactic.Contrapose\nimport Mathlib.Tactic.GeneralizeProofs\nimport Mathlib.Tactic.SimpRw\nimport Mathlib.Logic.Equiv.Nat\nimport Mathlib.Data.PNat.Basic\nimport Mathlib.Order.Directed\nimport Mathlib.Data.Countable.Defs\nimport Mathlib.Order.RelIso.Basic\nimport Mathlib.Data.Fin.Basic\nimport Mathlib.Logic.Small.Defs\nimport Mathlib.Logic.Equiv.Set\nimport Mathlib.Logic.Nonempty\nimport Mathlib.Init.Set\nimport Mathlib.Logic.Basic\nimport Mathlib.Data.Option.Basic\nimport Mathlib.Data.Prod.PProd\nimport Mathlib.Logic.Equiv.Basic\nimport Mathlib.Analysis.Calculus.TangentCone\nimport Mathlib.Analysis.NormedSpace.OperatorNorm.Asymptotics\nimport Mathlib.Analysis.Calculus.Deriv.Add\nimport Mathlib.Analysis.InnerProductSpace.Dual\nimport Mathlib.Analysis.Calculus.FDeriv.Basic\nimport Mathlib.Analysis.Calculus.Deriv.Basic\nimport Mathlib.Analysis.Calculus.ContDiff.Basic\nimport Mathlib.Analysis.NormedSpace.FiniteDimension\nimport Mathlib.Analysis.Calculus.Deriv.Comp\nimport Mathlib.Analysis.Calculus.Deriv.Add\nimport Mathlib.Analysis.Calculus.Deriv.Mul\nimport Mathlib.Analysis.Calculus.Deriv.Slope\nimport Mathlib.Analysis.Calculus.FDeriv.Basic\nimport Mathlib.Analysis.NormedSpace.OperatorNorm.NormedSpace\nimport Mathlib.Analysis.Calculus.ContDiff.Defs\nimport Mathlib.Analysis.Calculus.FDeriv.Add\nimport Mathlib.Analysis.Calculus.FDeriv.Mul\nimport Mathlib.Analysis.Calculus.Deriv.Inverse\nimport Mathlib.Algebra.DirectSum.Module\nimport Mathlib.Analysis.Complex.Basic\nimport Mathlib.Analysis.Convex.Uniform\nimport Mathlib.Analysis.NormedSpace.Completion\nimport Mathlib.Analysis.NormedSpace.BoundedLinearMaps\nimport Mathlib.Algebra.Algebra.NonUnitalSubalgebra\nimport Mathlib.Algebra.Algebra.Subalgebra.Basic\nimport Mathlib.Analysis.Normed.Group.Basic\nimport Mathlib.GroupTheory.OrderOfElement\nimport Mathlib.Topology.Instances.NNReal\nimport Mathlib.Topology.MetricSpace.DilationEquiv\nimport Mathlib.Algebra.Order.Group.TypeTags\nimport Mathlib.Analysis.Normed.Field.Basic\nimport Mathlib.Analysis.Normed.Group.Seminorm\nimport Mathlib.Order.LiminfLimsup\nimport Mathlib.Topology.Instances.Rat\nimport Mathlib.Topology.MetricSpace.Algebra\nimport Mathlib.Topology.MetricSpace.IsometricSMul\nimport Mathlib.Topology.Sequences\nimport Mathlib.Analysis.SpecialFunctions.Exp\nimport Mathlib.Data.Nat.Factorization.Basic\nimport Mathlib.Analysis.NormedSpace.Real\nimport Mathlib.Analysis.SpecialFunctions.Exp\nimport Mathlib.Tactic.Positivity.Core\nimport Mathlib.MeasureTheory.Integral.ExpDecay\nimport Mathlib.Analysis.SpecialFunctions.ImproperIntegrals\nimport Mathlib.Analysis.MellinTransform\nimport Mathlib.Analysis.Convex.Basic\nimport Mathlib.Analysis.Convex.Hull\nimport Mathlib.Analysis.NormedSpace.Basic\nimport Mathlib.Topology.Bornology.Absorbs\nimport Mathlib.Analysis.NormedSpace.Dual\nimport Mathlib.Analysis.NormedSpace.Star.Basic\nimport Mathlib.Analysis.Complex.Basic\nimport Mathlib.Analysis.InnerProductSpace.Adjoint\nimport Mathlib.Algebra.Star.Subalgebra\nimport Mathlib.Analysis.BoxIntegral.Partition.Filter\nimport Mathlib.Analysis.BoxIntegral.Partition.Measure\nimport Mathlib.Topology.UniformSpace.Compact\nimport Mathlib.Init.Data.Bool.Lemmas\nimport Mathlib.Algebra.BigOperators.Option\nimport Mathlib.Analysis.BoxIntegral.Box.Basic\nimport Mathlib.Data.Set.Pairwise.Lattice\nimport Mathlib.Data.Set.Intervals.Monotone\nimport Mathlib.Topology.MetricSpace.Basic\nimport Mathlib.Topology.MetricSpace.Bounded\nimport Mathlib.Topology.Order.MonotoneConvergence\nimport Mathlib.Data.Complex.Module\nimport Mathlib.Data.Complex.Order\nimport Mathlib.Data.Complex.Exponential\nimport Mathlib.Data.RCLike.Basic\nimport Mathlib.Topology.Algebra.InfiniteSum.Module\nimport Mathlib.Topology.Instances.RealVectorSpace\nimport Mathlib.Analysis.Complex.Circle\nimport Mathlib.Analysis.NormedSpace.BallAction\nimport Mathlib.Data.Fintype.Parity\nimport Mathlib.LinearAlgebra.Matrix.SpecialLinearGroup\nimport Mathlib.Analysis.Complex.Basic\nimport Mathlib.GroupTheory.GroupAction.Defs\nimport Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup\nimport Mathlib.Tactic.LinearCombination\nimport Mathlib.Algebra.GeomSum\nimport Mathlib.Order.Filter.Archimedean\nimport Mathlib.Order.Iterate\nimport Mathlib.Topology.Instances.ENNReal\nimport Mathlib.Topology.Algebra.Algebra\nimport Mathlib.Algebra.Order.Module.OrderedSMul\nimport Mathlib.Analysis.Convex.Star\nimport Mathlib.LinearAlgebra.AffineSpace.AffineSubspace\nimport Mathlib.Analysis.Convex.Hull\nimport Mathlib.LinearAlgebra.AffineSpace.Independent\nimport Mathlib.Analysis.Convex.Hull\nimport Mathlib.Analysis.Convex.Slope\nimport Mathlib.Analysis.SpecialFunctions.Pow.Real\nimport Mathlib.Tactic.LinearCombination\nimport Mathlib.Algebra.Algebra.Pi\nimport Mathlib.Algebra.Algebra.RestrictScalars\nimport Mathlib.Analysis.Normed.Field.Basic\nimport Mathlib.Analysis.Normed.MulAction\nimport Mathlib.Analysis.NormedSpace.OperatorNorm.NormedSpace\nimport Mathlib.Topology.Algebra.Module.Multilinear.Basic\nimport Mathlib.Algebra.Algebra.Tower\nimport Mathlib.Analysis.LocallyConvex.WithSeminorms\nimport Mathlib.Topology.Algebra.Module.StrongTopology\nimport Mathlib.Analysis.NormedSpace.LinearIsometry\nimport Mathlib.Analysis.NormedSpace.ContinuousLinearMap\nimport Mathlib.Tactic.SuppressCompilation\nimport Mathlib.Analysis.Normed.Group.Hom\nimport Mathlib.Analysis.NormedSpace.Basic\nimport Mathlib.Analysis.NormedSpace.LinearIsometry\nimport Mathlib.Algebra.Star.SelfAdjoint\nimport Mathlib.Algebra.Star.Subalgebra\nimport Mathlib.Algebra.Star.Unitary\nimport Mathlib.Topology.Algebra.Module.Star\nimport Mathlib.Analysis.Calculus.FormalMultilinearSeries\nimport Mathlib.Analysis.SpecificLimits.Normed\nimport Mathlib.Logic.Equiv.Fin\nimport Mathlib.Topology.Algebra.InfiniteSum.Module\nimport Mathlib.CategoryTheory.Sites.Sheaf\nimport Mathlib.Topology.Category.CompHaus.EffectiveEpi\nimport Mathlib.Data.Fin.VecNotation\nimport Mathlib.SetTheory.Cardinal.Basic\nimport Mathlib.ModelTheory.Syntax\nimport Mathlib.ModelTheory.Semantics\nimport Mathlib.ModelTheory.Algebra.Ring.Basic\nimport Mathlib.Algebra.Field.MinimalAxioms\nimport Mathlib.ModelTheory.Syntax\nimport Mathlib.ModelTheory.Semantics\nimport Mathlib.Algebra.Ring.Equiv\nimport Mathlib.Init.Control.Combinators\nimport Mathlib.Init.Function\nimport Mathlib.Tactic.CasesM\nimport Mathlib.Tactic.Attr.Core\nimport Mathlib.Logic.Equiv.Defs\nimport Mathlib.Data.Option.Defs\nimport Mathlib.Control.Functor\nimport Mathlib.Control.Bifunctor\nimport Mathlib.Control.Traversable.Basic\nimport Mathlib.Init.Order.LinearOrder\nimport Mathlib.Data.Prod.Basic\nimport Mathlib.Data.Subtype\nimport Mathlib.Tactic.Spread\nimport Mathlib.Tactic.Convert\nimport Mathlib.Tactic.SimpRw\nimport Mathlib.Tactic.Cases\nimport Mathlib.Order.Notation\nimport Mathlib.Logic.Equiv.Option\nimport Mathlib.Order.RelIso.Basic\nimport Mathlib.Order.Disjoint\nimport Mathlib.Order.WithBot\nimport Mathlib.Tactic.Monotonicity.Attr\nimport Mathlib.Util.AssertExists\nimport Mathlib.Data.SetLike.Basic\nimport Mathlib.Data.Set.Intervals.OrdConnected\nimport Mathlib.Data.Set.Intervals.OrderIso\nimport Mathlib.Data.Set.Lattice\nimport Mathlib.Order.PropInstances\nimport Mathlib.Data.Set.Finite\nimport Mathlib.Logic.Function.Iterate\nimport Mathlib.Init.Data.Int.Order\nimport Mathlib.Order.Compare\nimport Mathlib.Order.Max\nimport Mathlib.Order.RelClasses\nimport Mathlib.Tactic.Choose\nimport Mathlib.Order.CompleteLattice\nimport Mathlib.Order.Cover\nimport Mathlib.Order.Iterate\nimport Mathlib.Init.Algebra.Classes\nimport Mathlib.Data.FunLike.Basic\nimport Mathlib.Logic.Embedding.Basic\nimport Mathlib.Order.RelClasses\nimport Mathlib.Order.Atoms\nimport Mathlib.Order.OrderIsoNat\nimport Mathlib.Order.RelIso.Set\nimport Mathlib.Order.SupClosed\nimport Mathlib.Order.SupIndep\nimport Mathlib.Order.Zorn\nimport Mathlib.Data.Finset.Order\nimport Mathlib.Data.Set.Intervals.OrderIso\nimport Mathlib.Data.Finite.Set\nimport Mathlib.Tactic.TFAE\nimport Mathlib.Order.Bounds.Basic\nimport Mathlib.Order.WellFounded\nimport Mathlib.Data.Set.Image\nimport Mathlib.Data.Set.Intervals.Basic\nimport Mathlib.Data.Set.Lattice\nimport Mathlib.Data.Set.Intervals.Basic\nimport Mathlib.Data.Set.NAry\nimport Mathlib.Order.Directed\nimport Mathlib.Data.Sum.Order\nimport Mathlib.Order.InitialSeg\nimport Mathlib.SetTheory.Cardinal.Basic\nimport Mathlib.Tactic.PPWithUniv\nimport Mathlib.Data.Set.Lattice\nimport Mathlib.Logic.Small.Basic\nimport Mathlib.Logic.Function.OfArity\nimport Mathlib.Order.WellFounded\nimport Mathlib.Data.Int.Basic\nimport Mathlib.SetTheory.Game.PGame\nimport Mathlib.Tactic.Abel\nimport Mathlib.Algebra.Order.Hom.Monoid\nimport Mathlib.SetTheory.Game.Ordinal\nimport Mathlib.Algebra.Module.Basic\nimport Mathlib.Data.Fintype.BigOperators\nimport Mathlib.Data.Finsupp.Defs\nimport Mathlib.Data.Set.Countable\nimport Mathlib.Logic.Small.Set\nimport Mathlib.Order.ConditionallyCompleteLattice.Basic\nimport Mathlib.Order.SuccPred.CompleteLinearOrder\nimport Mathlib.SetTheory.Cardinal.SchroederBernstein\nimport Mathlib.Tactic.PPWithUniv\nimport Mathlib.Algebra.Group.Equiv.TypeTags\nimport Mathlib.Algebra.Module.Basic\nimport Mathlib.Algebra.Module.LinearMap.Basic\nimport Mathlib.Algebra.MonoidAlgebra.Basic\nimport Mathlib.LinearAlgebra.Dual\nimport Mathlib.LinearAlgebra.Contraction\nimport Mathlib.RingTheory.TensorProduct.Basic\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.CategoryTheory.SingleObj\nimport Mathlib.CategoryTheory.Limits.FunctorCategory\nimport Mathlib.CategoryTheory.Limits.Preserves.Basic\nimport Mathlib.CategoryTheory.Adjunction.Limits\nimport Mathlib.CategoryTheory.Conj\nimport Mathlib.Algebra.Homology.Opposite\nimport Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex\nimport Mathlib.RepresentationTheory.GroupCohomology.Resolution\nimport Mathlib.CategoryTheory.Limits.HasLimits\nimport Mathlib.CategoryTheory.Limits.Connected\nimport Mathlib.CategoryTheory.Limits.Constructions.Over.Products\nimport Mathlib.CategoryTheory.Limits.Constructions.Over.Connected\nimport Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers\nimport Mathlib.CategoryTheory.Limits.Constructions.Equalizers\nimport Mathlib.CategoryTheory.Limits.Shapes.RegularMono\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Preserves.Basic\nimport Mathlib.CategoryTheory.NatIso\nimport Mathlib.CategoryTheory.Limits.Constructions.Pullbacks\nimport Mathlib.CategoryTheory.Preadditive.Biproducts\nimport Mathlib.CategoryTheory.Limits.Shapes.Images\nimport Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers\nimport Mathlib.CategoryTheory.Abelian.NonPreadditive\nimport Mathlib.CategoryTheory.Subobject.MonoOver\nimport Mathlib.CategoryTheory.Skeletal\nimport Mathlib.CategoryTheory.ConcreteCategory.Basic\nimport Mathlib.Tactic.ApplyFun\nimport Mathlib.Tactic.CategoryTheory.Elementwise\nimport Mathlib.CategoryTheory.EqToHom\nimport Mathlib.CategoryTheory.Functor.Const\nimport Mathlib.CategoryTheory.Opposites\nimport Mathlib.Data.Prod.Basic\nimport Mathlib.CategoryTheory.CommSq\nimport Mathlib.Algebra.BigOperators.Basic\nimport Mathlib.Algebra.Group.Hom.Defs\nimport Mathlib.Algebra.Module.Basic\nimport Mathlib.CategoryTheory.Endomorphism\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Preadditive.Opposite\nimport Mathlib.Algebra.Category.ModuleCat.Basic\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.CategoryTheory.Functor.Category\nimport Mathlib.CategoryTheory.Functor.FullyFaithful\nimport Mathlib.CategoryTheory.Functor.ReflectsIso\nimport Mathlib.CategoryTheory.EqToHom\nimport Mathlib.CategoryTheory.NatIso\nimport Mathlib.CategoryTheory.Products.Basic\nimport Mathlib.Algebra.Group.Basic\nimport Mathlib.CategoryTheory.Limits.Preserves.Shapes.Zero\nimport Mathlib.CategoryTheory.Monoidal.End\nimport Mathlib.CategoryTheory.Monoidal.Discrete\nimport Mathlib.CategoryTheory.Equivalence\nimport Mathlib.CategoryTheory.FinCategory.Basic\nimport Mathlib.CategoryTheory.Limits.Cones\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.Adjunction.Basic\nimport Mathlib.CategoryTheory.Category.Preorder\nimport Mathlib.CategoryTheory.Category.ULift\nimport Mathlib.CategoryTheory.PEmpty\nimport Mathlib.CategoryTheory.Monoidal.Types.Symmetric\nimport Mathlib.CategoryTheory.Monoidal.Types.Coyoneda\nimport Mathlib.CategoryTheory.Monoidal.Center\nimport Mathlib.Tactic.ApplyFun\nimport Mathlib.CategoryTheory.Abelian.Basic\nimport Mathlib.CategoryTheory.EqToHom\nimport Mathlib.CategoryTheory.Iso\nimport Mathlib.CategoryTheory.Functor.Category\nimport Mathlib.CategoryTheory.EqToHom\nimport Mathlib.CategoryTheory.Whiskering\nimport Mathlib.CategoryTheory.Functor.FullyFaithful\nimport Mathlib.CategoryTheory.NatIso\nimport Mathlib.CategoryTheory.Extensive\nimport Mathlib.CategoryTheory.Sites.Coverage\nimport Mathlib.CategoryTheory.EffectiveEpi.Basic\nimport Mathlib.CategoryTheory.Adjunction.Limits\nimport Mathlib.CategoryTheory.Limits.Preserves.Shapes.Products\nimport Mathlib.CategoryTheory.Limits.Shapes.Biproducts\nimport Mathlib.CategoryTheory.Shift.Basic\nimport Mathlib.CategoryTheory.Types\nimport Mathlib.CategoryTheory.Functor.EpiMono\nimport Mathlib.CategoryTheory.Limits.Constructions.EpiMono\nimport Mathlib.CategoryTheory.Monoidal.Free.Coherence\nimport Mathlib.CategoryTheory.Monoidal.Discrete\nimport Mathlib.CategoryTheory.Monoidal.NaturalTransformation\nimport Mathlib.CategoryTheory.Monoidal.Opposite\nimport Mathlib.Tactic.CategoryTheory.Coherence\nimport Mathlib.CategoryTheory.CommSq\nimport Mathlib.CategoryTheory.Monoidal.Functor\nimport Mathlib.CategoryTheory.ChosenFiniteProducts\nimport Mathlib.CategoryTheory.Limits.Shapes.Types\nimport Mathlib.Logic.Equiv.Fin\nimport Mathlib.CategoryTheory.Monoidal.Functor\nimport Mathlib.CategoryTheory.Monoidal.Free.Coherence\nimport Mathlib.Tactic.CategoryTheory.Coherence\nimport Mathlib.CategoryTheory.Closed.Monoidal\nimport Mathlib.Tactic.ApplyFun\nimport Mathlib.CategoryTheory.Monoidal.Category\nimport Mathlib.CategoryTheory.Limits.Shapes.BinaryProducts\nimport Mathlib.CategoryTheory.PEmpty\nimport Mathlib.CategoryTheory.Preadditive.Basic\nimport Mathlib.Algebra.Module.LinearMap.Basic\nimport Mathlib.Algebra.Algebra.Basic\nimport Mathlib.CategoryTheory.Category.Init\nimport Mathlib.Combinatorics.Quiver.Basic\nimport Mathlib.Tactic.PPWithUniv\nimport Mathlib.Tactic.Common\nimport Mathlib.CategoryTheory.Limits.Shapes.Products\nimport Mathlib.Data.Fintype.Basic\nimport Mathlib.CategoryTheory.DiscreteCategory\nimport Mathlib.CategoryTheory.Opposites\nimport Mathlib.CategoryTheory.Category.ULift\nimport Mathlib.CategoryTheory.Category.Basic\nimport Mathlib.CategoryTheory.Comma.StructuredArrow\nimport Mathlib.CategoryTheory.Limits.Shapes.Equivalence\nimport Mathlib.CategoryTheory.FintypeCat\nimport Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers\nimport Mathlib.CategoryTheory.Limits.FintypeCat\nimport Mathlib.CategoryTheory.Limits.MonoCoprod\nimport Mathlib.CategoryTheory.Limits.Preserves.Shapes.Terminal\nimport Mathlib.CategoryTheory.Limits.Shapes.Types\nimport Mathlib.CategoryTheory.Limits.Shapes.ConcreteCategory\nimport Mathlib.CategoryTheory.Limits.Shapes.Diagonal\nimport Mathlib.CategoryTheory.SingleObj\nimport Mathlib.Data.Finite.Card\nimport Mathlib.CategoryTheory.Groupoid\nimport Mathlib.Combinatorics.Quiver.Basic\nimport Mathlib.LinearAlgebra.StdBasis\nimport Mathlib.Tactic.Linarith\nimport Mathlib.Data.Finset.PiAntidiagonal\nimport Mathlib.Data.MvPolynomial.Basic\nimport Mathlib.Tactic.FinCases\nimport Mathlib.Data.Nat.Choose.Sum\nimport Mathlib.LinearAlgebra.Finsupp\nimport Mathlib.Algebra.GroupPower.Order\nimport Mathlib.RingTheory.Ideal.Operations\nimport Mathlib.Tactic.TFAE\nimport Mathlib.RingTheory.Adjoin.Basic\nimport Mathlib.Algebra.Ring.Equiv\nimport Mathlib.Algebra.Ring.Prod\nimport Mathlib.Data.Set.Finite\nimport Mathlib.GroupTheory.Submonoid.Membership\nimport Mathlib.GroupTheory.Subsemigroup.Membership\nimport Mathlib.GroupTheory.Subsemigroup.Centralizer\nimport Mathlib.Algebra.EuclideanDomain.Basic\nimport Mathlib.Data.Nat.Factors\nimport Mathlib.RingTheory.Coprime.Basic\nimport Mathlib.RingTheory.PrincipalIdealDomain\nimport Mathlib.Algebra.CharP.ExpChar\nimport Mathlib.Algebra.GeomSum\nimport Mathlib.Data.MvPolynomial.CommRing\nimport Mathlib.Data.MvPolynomial.Equiv\nimport Mathlib.RingTheory.Polynomial.Content\nimport Mathlib.RingTheory.UniqueFactorizationDomain\nimport Mathlib.Algebra.NeZero\nimport Mathlib.Algebra.Polynomial.BigOperators\nimport Mathlib.RingTheory.RootsOfUnity.Complex\nimport Mathlib.Data.Polynomial.Lifts\nimport Mathlib.Data.Polynomial.Splits\nimport Mathlib.FieldTheory.RatFunc\nimport Mathlib.NumberTheory.ArithmeticFunction\nimport Mathlib.RingTheory.RootsOfUnity.Basic\nimport Mathlib.Data.Polynomial.Derivative\nimport Mathlib.Data.Nat.Parity\nimport Mathlib.Data.Nat.Factorial.DoubleFactorial\nimport Mathlib.RingTheory.EisensteinCriterion\nimport Mathlib.RingTheory.Polynomial.ScaleRoots\nimport Mathlib.Algebra.GroupPower.Ring\nimport Mathlib.Algebra.Ring.Divisibility.Basic\nimport Mathlib.Algebra.Ring.Hom.Defs\nimport Mathlib.GroupTheory.GroupAction.Units\nimport Mathlib.Logic.Basic\nimport Mathlib.Tactic.Ring\nimport Mathlib.RingTheory.Noetherian\nimport Mathlib.Algebra.DirectSum.Module\nimport Mathlib.Algebra.DirectSum.Finsupp\nimport Mathlib.Algebra.Module.Projective\nimport Mathlib.Algebra.Module.Injective\nimport Mathlib.Algebra.Module.CharacterModule\nimport Mathlib.LinearAlgebra.DirectSum.TensorProduct\nimport Mathlib.LinearAlgebra.FreeModule.Basic\nimport Mathlib.Algebra.Module.Projective\nimport Mathlib.GroupTheory.Subgroup.Basic\nimport Mathlib.RingTheory.Subsemiring.Basic\nimport Mathlib.Algebra.Algebra.Operations\nimport Mathlib.Algebra.Algebra.Subalgebra.Tower\nimport Mathlib.LinearAlgebra.Prod\nimport Mathlib.LinearAlgebra.Finsupp\nimport Mathlib.Algebra.Module.Basic\nimport Mathlib.Algebra.Ring.Equiv\nimport Mathlib.Algebra.Ring.Prod\nimport Mathlib.Algebra.GroupRingAction.Subobjects\nimport Mathlib.Data.Set.Finite\nimport Mathlib.GroupTheory.Submonoid.Centralizer\nimport Mathlib.GroupTheory.Submonoid.Membership\nimport Mathlib.RingTheory.NonUnitalSubsemiring.Basic\nimport Mathlib.GroupTheory.MonoidLocalization\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\nimport Mathlib.RingTheory.OreLocalization.OreSet\nimport Mathlib.Tactic.NoncommRing\nimport Mathlib.Algebra.Function.Support\nimport Mathlib.Order.WellFoundedSet\nimport Mathlib.RingTheory.Ideal.Over\nimport Mathlib.RingTheory.Polynomial.RationalRoot\nimport Mathlib.Algebra.CharP.Basic\nimport Mathlib.Data.Polynomial.AlgebraMap\nimport Mathlib.Data.MvPolynomial.Degrees\nimport Mathlib.LinearAlgebra.FinsuppVectorSpace\nimport Mathlib.LinearAlgebra.FreeModule.Finite.Basic\nimport Mathlib.Algebra.DirectSum.Algebra\nimport Mathlib.Algebra.DirectSum.Decomposition\nimport Mathlib.Algebra.DirectSum.Internal\nimport Mathlib.Algebra.DirectSum.Ring\nimport Mathlib.Algebra.Algebra.Tower\nimport Mathlib.Algebra.GroupWithZero.NonZeroDivisors\nimport Mathlib.GroupTheory.MonoidLocalization\nimport Mathlib.RingTheory.Ideal.Basic\nimport Mathlib.GroupTheory.GroupAction.Ring\nimport Mathlib.Init.Data.Int.CompLemmas\nimport Mathlib.RingTheory.UniqueFactorizationDomain\nimport Mathlib.RingTheory.Localization.Basic\nimport Mathlib.Algebra.CharP.Two\nimport Mathlib.Algebra.CharP.Reduced\nimport Mathlib.Algebra.NeZero\nimport Mathlib.Data.Polynomial.RingDivision\nimport Mathlib.GroupTheory.SpecificGroups.Cyclic\nimport Mathlib.NumberTheory.Divisors\nimport Mathlib.RingTheory.IntegralDomain\nimport Mathlib.Tactic.Zify\nimport Mathlib.LinearAlgebra.FiniteDimensional\nimport Mathlib.LinearAlgebra.TensorProduct.Tower\nimport Mathlib.RingTheory.Adjoin.Basic\nimport Mathlib.LinearAlgebra.DirectSum.Finsupp\nimport Mathlib.Data.MvPolynomial.Counit\nimport Mathlib.Data.MvPolynomial.Invertible\nimport Mathlib.RingTheory.WittVector.Defs\nimport Mathlib.RingTheory.MvPowerSeries.Basic\nimport Mathlib.Data.Polynomial.Basic\nimport Mathlib.Data.Polynomial.AlgebraMap\nimport Mathlib.RingTheory.PrincipalIdealDomain\nimport Mathlib.RingTheory.Ideal.LocalRing\nimport Mathlib.RingTheory.Valuation.PrimeMultiplicity\nimport Mathlib.LinearAlgebra.AdicCompletion\nimport Mathlib.GroupTheory.Subgroup.Basic\nimport Mathlib.RingTheory.NonUnitalSubsemiring.Basic\nimport Mathlib.RingTheory.Localization.Integer\nimport Mathlib.RingTheory.Localization.Submodule\nimport Mathlib.Algebra.Group.Conj\nimport Mathlib.Algebra.Group.Pi.Lemmas\nimport Mathlib.Data.Set.Image\nimport Mathlib.GroupTheory.Submonoid.Centralizer\nimport Mathlib.Order.Atoms\nimport Mathlib.Tactic.ApplyFun\nimport Mathlib.Algebra.Group.Prod\nimport Mathlib.Algebra.Group.Units.Equiv\nimport Mathlib.Algebra.GroupPower.IterateHom\nimport Mathlib.Logic.Equiv.Set\nimport Mathlib.Algebra.Module.BigOperators\nimport Mathlib.Data.Fintype.Perm\nimport Mathlib.GroupTheory.Perm.Finite\nimport Mathlib.GroupTheory.Perm.List\nimport Mathlib.Algebra.Group.Hom.Defs\nimport Mathlib.Algebra.Group.Units\nimport Mathlib.GroupTheory.Subsemigroup.Basic\nimport Mathlib.Algebra.PUnitInstances\nimport Mathlib.GroupTheory.Subgroup.Basic\nimport Mathlib.GroupTheory.Congruence\nimport Mathlib.GroupTheory.Submonoid.Membership\nimport Mathlib.Data.Fintype.Card\nimport Mathlib.GroupTheory.GroupAction.Defs\nimport Mathlib.GroupTheory.GroupAction.Group\nimport Mathlib.Data.Setoid.Basic\nimport Mathlib.Data.Set.Pointwise.SMul\nimport Mathlib.GroupTheory.Subgroup.Basic\nimport Mathlib.Algebra.Group.Opposite\nimport Mathlib.Algebra.Group.Pi.Lemmas\nimport Mathlib.GroupTheory.GroupAction.Defs\nimport Mathlib.Algebra.Group.Hom.Defs\nimport Mathlib.Data.Set.Lattice\nimport Mathlib.Data.SetLike.Basic\nimport Mathlib.Data.Fintype.Basic\nimport Mathlib.Data.List.Sublists\nimport Mathlib.Data.List.InsertNth\nimport Mathlib.GroupTheory.Subgroup.Basic\nimport Mathlib.Algebra.Group.TypeTags\nimport Mathlib.Algebra.Ring.Defs\nimport Mathlib.Data.Int.Cast.Basic\nimport Mathlib.Order.Monotone.Basic\nimport Mathlib.Data.Nat.Order.Basic\nimport Mathlib.Data.Int.Basic\nimport Mathlib.Algebra.Order.Group.Abs\nimport Mathlib.Algebra.Order.Ring.CharZero\nimport Mathlib.Algebra.Divisibility.Basic\nimport Mathlib.Init.Data.Nat.Lemmas\nimport Mathlib.Data.Int.Cast.Defs\nimport Mathlib.Algebra.Group.Basic\nimport Mathlib.Data.Int.Order.Basic\nimport Mathlib.Data.Nat.Cast.Order\nimport Mathlib.Algebra.Ring.Divisibility.Basic\nimport Mathlib.Data.DList.Defs\nimport Mathlib.Tactic.TypeStar\nimport Mathlib.Mathport.Rename\nimport Mathlib.Data.Nat.SuccPred\nimport Mathlib.Algebra.CharZero.Lemmas\nimport Mathlib.Algebra.Order.Sub.WithTop\nimport Mathlib.Algebra.Order.Ring.WithTop\nimport Mathlib.Data.Real.Sqrt\nimport Mathlib.Analysis.NormedSpace.Star.Basic\nimport Mathlib.Analysis.NormedSpace.ContinuousLinearMap\nimport Mathlib.Analysis.NormedSpace.Basic\nimport Mathlib.Init.ZeroOne\nimport Mathlib.Data.Set.Defs\nimport Mathlib.Order.Basic\nimport Mathlib.Order.SymmDiff\nimport Mathlib.Tactic.Tauto\nimport Mathlib.Tactic.ByContra\nimport Mathlib.Util.Delaborators\nimport Mathlib.Data.Set.Function\nimport Mathlib.Logic.Relation\nimport Mathlib.Logic.Pairwise\nimport Mathlib.Algebra.Group.Equiv.Basic\nimport Mathlib.Algebra.Group.Units.Hom\nimport Mathlib.Algebra.GroupPower.Basic\nimport Mathlib.Algebra.GroupWithZero.Basic\nimport Mathlib.Algebra.Opposites\nimport Mathlib.Data.Nat.Order.Basic\nimport Mathlib.Data.Set.Lattice\nimport Mathlib.Tactic.Common\nimport Mathlib.Order.MinMax\nimport Mathlib.Data.Set.Basic\nimport Mathlib.Tactic.Says\nimport Mathlib.Data.List.Lex\nimport Mathlib.Data.Char\nimport Mathlib.Logic.Function.Basic\nimport Mathlib.Tactic.MkIffOfInductiveProp\nimport Mathlib.Data.PNat.Defs\nimport Mathlib.Data.Nat.Bits\nimport Mathlib.Data.Nat.Order.Basic\nimport Mathlib.Data.Set.Basic\nimport Mathlib.Algebra.GroupWithZero.Divisibility\nimport Mathlib.Algebra.Order.Positive.Ring\nimport Mathlib.Order.Hom.Basic\nimport Mathlib.Data.W.Basic\nimport Mathlib.Control.Functor.Multivariate\nimport Mathlib.Data.PFunctor.Univariate.Basic\nimport Mathlib.Init.Function\nimport Mathlib.Logic.Function.Basic\nimport Mathlib.Tactic.Inhabit\nimport Mathlib.Algebra.Module.LinearMap.Basic\nimport Mathlib.Algebra.BigOperators.Basic\nimport Mathlib.Data.Set.Finite\nimport Mathlib.GroupTheory.Submonoid.Membership\nimport Mathlib.GroupTheory.GroupAction.BigOperators\nimport Mathlib.Data.Finset.Preimage\nimport Lean.Linter.Deprecated\nimport Mathlib.Mathport.Rename\nimport Mathlib.Init.Data.Nat.Bitwise\nimport Mathlib.Init.Data.Int.Basic\nimport Mathlib.Init.ZeroOne\nimport Mathlib.Logic.Equiv.List\nimport Mathlib.Init.Function\nimport Mathlib.Logic.Function.Basic\nimport Mathlib.Algebra.Algebra.Tower\nimport Mathlib.Algebra.GroupPower.Ring\nimport Mathlib.Algebra.Regular.Pow\nimport Mathlib.Algebra.MonoidAlgebra.Support\nimport Mathlib.Data.Finsupp.Antidiagonal\nimport Mathlib.Order.SymmDiff\nimport Mathlib.RingTheory.Adjoin.Basic\nimport Mathlib.Control.Traversable.Equiv\nimport Mathlib.Control.Traversable.Instances\nimport Std.Data.LazyList\nimport Mathlib.Lean.Thunk\nimport Mathlib.Logic.Relation\nimport Mathlib.Order.GaloisConnection\nimport Mathlib.Data.Vector\nimport Mathlib.Data.List.Nodup\nimport Mathlib.Data.List.OfFn\nimport Mathlib.Data.List.InsertNth\nimport Mathlib.Control.Applicative\nimport Mathlib.Control.Traversable.Basic\nimport Mathlib.Algebra.GroupPower.Ring\nimport Mathlib.Algebra.MonoidAlgebra.Basic\nimport Mathlib.Data.Finset.Sort\nimport Mathlib.RingTheory.Finiteness\nimport Mathlib.Data.Polynomial.AlgebraMap\nimport Std.Tactic.Alias\nimport Mathlib.Algebra.BigOperators.Finsupp\nimport Mathlib.Algebra.Regular.SMul\nimport Mathlib.Data.Finset.Preimage\nimport Mathlib.Data.Rat.BigOperators\nimport Mathlib.GroupTheory.GroupAction.Hom\nimport Mathlib.Data.Set.Basic\nimport Mathlib.Data.Finset.Attr\nimport Mathlib.Data.Multiset.Bind\nimport Mathlib.Data.Multiset.FinsetOps\nimport Mathlib.Data.Set.Lattice\nimport Mathlib.Order.Cover\nimport Mathlib.Order.LocallyFinite\nimport Mathlib.Data.Set.Intervals.Monoid\nimport Mathlib.Algebra.Group.TypeTags\nimport Mathlib.Algebra.Ring.Defs\nimport Mathlib.Algebra.GroupWithZero.Defs\nimport Mathlib.Algebra.Order.Monoid.WithZero\nimport Mathlib.Algebra.Order.Ring.Canonical\nimport Mathlib.Data.Nat.Basic\nimport Mathlib.Data.Nat.Defs\nimport Mathlib.Tactic.GCongr.Core\nimport Mathlib.Tactic.Common\nimport Mathlib.Tactic.Monotonicity.Attr\nimport Mathlib.Algebra.GroupPower.Basic\nimport Mathlib.Algebra.GroupWithZero.Divisibility\nimport Mathlib.Data.Nat.Order.Lemmas\nimport Mathlib.Tactic.NthRewrite\nimport Mathlib.Algebra.Divisibility.Basic\nimport Mathlib.Algebra.Group.Equiv.Basic\nimport Mathlib.Algebra.Group.TypeTags\nimport Mathlib.Algebra.Ring.Hom.Defs\nimport Mathlib.Data.Nat.Basic\nimport Mathlib.Init.Data.Nat.Lemmas\nimport Mathlib.Init.Data.Nat.Bitwise\nimport Mathlib.Data.Nat.GCD.Basic\nimport Mathlib.Logic.Function.Iterate\nimport Mathlib.Data.Finset.NatAntidiagonal\nimport Mathlib.Algebra.BigOperators.Basic\nimport Mathlib.Tactic.Ring\nimport Mathlib.Tactic.Zify\nimport Mathlib.Data.Nat.Factorial.Basic\nimport Mathlib.Order.Monotone.Basic\nimport Mathlib.Algebra.BigOperators.Finsupp\nimport Mathlib.Data.Finsupp.Multiset\nimport Mathlib.Data.Nat.PrimeFin\nimport Mathlib.NumberTheory.Padics.PadicVal\nimport Mathlib.Data.Nat.GCD.BigOperators\nimport Mathlib.Data.Nat.Interval\nimport Mathlib.Tactic.IntervalCases\nimport Mathlib.Algebra.GroupPower.Order\nimport Mathlib.Data.Set.Basic\nimport Mathlib.Tactic.Monotonicity.Attr\nimport Mathlib.Tactic.SetLike\nimport Mathlib.Algebra.NeZero\nimport Mathlib.Order.RelIso.Basic\nimport Mathlib.Data.Nat.Order.Basic\nimport Mathlib.Order.Hom.Set\nimport Std.Data.Fin.Lemmas\nimport Mathlib.Data.Fin.OrderHom\nimport Mathlib.Data.Pi.Lex\nimport Mathlib.Data.Set.Intervals.Basic\nimport Mathlib.Algebra.Star.Basic\nimport Mathlib.Algebra.Order.CauSeq.Completion\nimport Mathlib.Algebra.CharP.Basic\nimport Mathlib.RingTheory.Ideal.Operations\nimport Mathlib.Data.Fintype.Units\nimport Mathlib.Data.Nat.Parity\nimport Mathlib.Tactic.FinCases\nimport Mathlib.Logic.Function.Basic\nimport Mathlib.Util.CompileInductive\nimport Mathlib.Algebra.Algebra.Opposite\nimport Mathlib.Algebra.Algebra.Pi\nimport Mathlib.Algebra.BigOperators.Pi\nimport Mathlib.Algebra.BigOperators.Ring\nimport Mathlib.Algebra.BigOperators.RingEquiv\nimport Mathlib.Algebra.Module.LinearMap.Basic\nimport Mathlib.Algebra.Module.Pi\nimport Mathlib.Algebra.Star.BigOperators\nimport Mathlib.Algebra.Star.Module\nimport Mathlib.Algebra.Star.Pi\nimport Mathlib.Data.Fintype.BigOperators\nimport Mathlib.GroupTheory.GroupAction.BigOperators\nimport Mathlib.Init.Data.Nat.Lemmas\nimport Mathlib.Init.Function\nimport Mathlib.Data.Semiquot\nimport Mathlib.Data.Nat.Size\nimport Mathlib.Tactic.Ring.RingNF\nimport Mathlib.Data.Set.Card\nimport Mathlib.Order.Minimal\nimport Mathlib.Data.Matroid.Init\nimport Mathlib.Data.Set.List\nimport Mathlib.Data.List.Perm\nimport Mathlib.Init.Quot -- Porting note: added import\nimport Mathlib.Order.Hom.Basic\nimport Mathlib.Mathport.Rename\nimport Mathlib.Data.PFunctor.Univariate.M\nimport Mathlib.Data.PFunctor.Multivariate.Basic\nimport Mathlib.Init.Control.Combinators\nimport Mathlib.Data.Option.Defs\nimport Mathlib.Logic.IsEmpty\nimport Mathlib.Logic.Relator\nimport Mathlib.Util.CompileInductive\nimport Aesop\nimport Mathlib.Algebra.Order.Ring.WithTop\nimport Mathlib.Algebra.Order.Sub.WithTop\nimport Mathlib.Data.Real.NNReal\nimport Mathlib.Data.Set.Intervals.WithBotTop\nimport Mathlib.Data.Bool.Basic\nimport Mathlib.Data.Nat.Defs\nimport Mathlib.Data.Option.Basic\nimport Mathlib.Data.List.Defs\nimport Mathlib.Init.Data.List.Basic\nimport Mathlib.Init.Data.List.Instances\nimport Mathlib.Init.Data.List.Lemmas\nimport Mathlib.Logic.Unique\nimport Mathlib.Order.Basic\nimport Std.Data.List.Lemmas\nimport Mathlib.Tactic.Common\nimport Mathlib.Logic.Equiv.Nat\nimport Mathlib.Logic.Equiv.Fin\nimport Mathlib.Data.Countable.Defs\nimport Mathlib.Data.Multiset.Basic\nimport Mathlib.Data.Vector.Basic\nimport Mathlib.Data.Setoid.Basic\nimport Mathlib.Tactic.ApplyFun\nimport Mathlib.Init.Align\nimport Mathlib.Data.Fintype.Powerset\nimport Mathlib.Data.Fintype.Prod\nimport Mathlib.Data.Fintype.Sigma\nimport Mathlib.Data.Fintype.Sum\nimport Mathlib.Data.Fintype.Vector\nimport Mathlib.Algebra.CharZero.Lemmas\nimport Mathlib.Algebra.GroupPower.Ring\nimport Mathlib.Algebra.GroupWithZero.Bitwise\nimport Mathlib.Data.Real.Basic\nimport Mathlib.Data.Set.Image\nimport Mathlib.Algebra.Ring.Hom.Defs -- FIXME: This import is bogus\nimport Mathlib.Data.Finset.Image\nimport Mathlib.Data.Fin.OrderHom\nimport Mathlib.Algebra.Category.Ring.FilteredColimits\nimport Mathlib.Geometry.RingedSpace.SheafedSpace\nimport Mathlib.Topology.Sheaves.Stalks\nimport Mathlib.Algebra.Category.Ring.Colimits\nimport Mathlib.Algebra.Category.Ring.Limits\nimport Mathlib.Analysis.InnerProductSpace.Projection\nimport Mathlib.Geometry.Euclidean.PerpBisector\nimport Mathlib.Algebra.QuadraticDiscriminant\nimport Mathlib.Analysis.Convex.StrictConvexBetween\nimport Mathlib.Geometry.Euclidean.Basic\nimport Mathlib.Analysis.InnerProductSpace.Basic\nimport Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse\nimport Mathlib.Analysis.InnerProductSpace.TwoDim\nimport Mathlib.Geometry.Euclidean.Angle.Unoriented.Basic\nimport Mathlib.Analysis.Normed.Group.AddTorsor\nimport Mathlib.Analysis.InnerProductSpace.Basic\nimport Mathlib.Geometry.Manifold.MFDeriv.Defs\nimport Mathlib.Geometry.Manifold.ContMDiff.Defs\nimport Mathlib.Geometry.Manifold.LocalInvariantProperties\nimport Mathlib.Topology.Sheaves.LocalPredicate\nimport Mathlib.Geometry.Manifold.ContMDiff.Atlas\nimport Mathlib.Geometry.Manifold.VectorBundle.FiberwiseLinear\nimport Mathlib.Topology.VectorBundle.Constructions\nimport Mathlib.Data.Seq.Seq\nimport Mathlib.Algebra.Field.Defs\nimport Mathlib.Algebra.Order.Floor\nimport Mathlib.Algebra.ContinuedFractions.Basic\nimport Mathlib.CategoryTheory.Limits.Preserves.Shapes.Zero\nimport Mathlib.Algebra.Group.Basic\nimport Mathlib.Algebra.Group.Hom.Defs\nimport Mathlib.Algebra.GroupWithZero.NeZero\nimport Mathlib.Algebra.Opposites\nimport Mathlib.Algebra.Ring.Defs\nimport Mathlib.Algebra.Divisibility.Basic\nimport Mathlib.Algebra.Group.Units.Hom\nimport Mathlib.Algebra.GroupWithZero.InjSurj\nimport Mathlib.Algebra.Ring.Hom.Defs\nimport Mathlib.Data.Set.Basic\nimport Mathlib.Algebra.Divisibility.Basic\nimport Mathlib.Algebra.Group.Equiv.Basic\nimport Mathlib.Algebra.Ring.Defs\nimport Mathlib.Algebra.Associated\nimport Mathlib.Algebra.Ring.Regular\nimport Mathlib.Tactic.Common\nimport Mathlib.Algebra.BigOperators.Multiset.Lemmas\nimport Mathlib.Algebra.BigOperators.Multiset.Order\nimport Mathlib.Algebra.Function.Indicator\nimport Mathlib.Algebra.Ring.Opposite\nimport Mathlib.Data.Finset.Powerset\nimport Mathlib.Data.Finset.Preimage\nimport Mathlib.Data.Finset.Sigma\nimport Mathlib.Data.Finset.Sum\nimport Mathlib.Data.Fintype.Pi\nimport Mathlib.Data.Int.Cast.Lemmas\nimport Mathlib.Data.Set.Image\nimport Mathlib.Algebra.BigOperators.List.Defs\nimport Mathlib.Data.List.Forall2\nimport Mathlib.Algebra.Divisibility.Basic\nimport Mathlib.Algebra.Ring.Commute\nimport Mathlib.Data.Nat.Order.Basic\nimport Mathlib.Data.Int.Basic\nimport Mathlib.Algebra.Group.Hom.Basic\nimport Mathlib.Algebra.GroupPower.Hom\nimport Mathlib.Algebra.BigOperators.List.Basic\nimport Mathlib.Data.Multiset.Basic\nimport Mathlib.Algebra.CharZero.Lemmas\nimport Mathlib.Algebra.Module.Submodule.Ker\nimport Mathlib.Algebra.Module.Submodule.RestrictScalars\nimport Mathlib.Algebra.Module.ULift\nimport Mathlib.RingTheory.Subring.Basic\nimport Mathlib.Algebra.Algebra.Basic\nimport Mathlib.Data.Set.UnionLift\nimport Mathlib.LinearAlgebra.Finsupp\nimport Mathlib.RingTheory.Ideal.Operations\nimport Mathlib.Algebra.Order.Monoid.Defs\nimport Mathlib.Algebra.Group.InjSurj\nimport Mathlib.Order.Hom.Basic\nimport Mathlib.Logic.Basic\nimport Mathlib.Tactic.Positivity.Basic\nimport Mathlib.Algebra.Order.AbsoluteValue\nimport Mathlib.Algebra.Order.Field.Basic\nimport Mathlib.Algebra.Order.Group.MinMax\nimport Mathlib.Algebra.Ring.Pi\nimport Mathlib.GroupTheory.GroupAction.Pi\nimport Mathlib.GroupTheory.GroupAction.Ring\nimport Mathlib.Init.Align\nimport Mathlib.Tactic.GCongr\nimport Mathlib.Tactic.Ring\nimport Mathlib.Algebra.Group.Equiv.Basic\nimport Mathlib.Algebra.Ring.Basic\nimport Mathlib.Algebra.Order.Sub.Defs\nimport Mathlib.Order.Hom.Basic\nimport Mathlib.Algebra.Field.Basic\nimport Mathlib.Algebra.GroupWithZero.Units.Equiv\nimport Mathlib.Algebra.Order.Field.Defs\nimport Mathlib.Algebra.Order.Ring.Abs\nimport Mathlib.Order.Bounds.OrderIso\nimport Mathlib.Tactic.Positivity.Core\nimport Mathlib.Algebra.Order.Field.Canonical.Defs\nimport Mathlib.Algebra.Field.Defs\nimport Mathlib.Algebra.GroupWithZero.Units.Lemmas\nimport Mathlib.Algebra.Ring.Commute\nimport Mathlib.Algebra.Ring.Hom.Defs\nimport Mathlib.Algebra.Invertible.GroupWithZero\nimport Mathlib.Algebra.Group.Commute.Units\nimport Mathlib.Algebra.Group.Hom.Defs\nimport Mathlib.Algebra.Group.Units\nimport Mathlib.Algebra.GroupPower.Basic\nimport Mathlib.Algebra.GroupWithZero.Units.Basic\nimport Mathlib.Algebra.Ring.Defs\nimport Mathlib.Data.Bracket\nimport Mathlib.LinearAlgebra.Basic\nimport Mathlib.Algebra.Ring.Divisibility.Lemmas\nimport Mathlib.Algebra.Lie.Nilpotent\nimport Mathlib.Algebra.Lie.Engel\nimport Mathlib.LinearAlgebra.Eigenspace.Triangularizable\nimport Mathlib.RingTheory.Artinian\nimport Mathlib.LinearAlgebra.Trace\nimport Mathlib.LinearAlgebra.FreeModule.PID\nimport Mathlib.Data.DFinsupp.Basic\nimport Mathlib.GroupTheory.Submonoid.Operations\nimport Mathlib.Algebra.GroupWithZero.Units.Lemmas\nimport Mathlib.Algebra.Ring.Equiv\nimport Mathlib.GroupTheory.GroupAction.Group\nimport Mathlib.RingTheory.UniqueFactorizationDomain\nimport Mathlib.Algebra.GroupPower.Basic\nimport Mathlib.Algebra.Group.Hom.Defs\nimport Mathlib.Algebra.BigOperators.List.Basic\nimport Mathlib.GroupTheory.GroupAction.Defs\nimport Mathlib.Algebra.Module.Basic\nimport Mathlib.Algebra.Order.Archimedean\nimport Mathlib.Algebra.Order.Group.Instances\nimport Mathlib.Data.Int.ModEq\nimport Mathlib.Data.Nat.Multiplicity\nimport Mathlib.Data.Nat.Choose.Sum\nimport Mathlib.Data.Nat.Cast.Prod\nimport Mathlib.Algebra.Group.ULift\nimport Mathlib.GroupTheory.OrderOfElement\nimport Mathlib.Algebra.Lie.OfAssociative\nimport Mathlib.Algebra.Category.MonCat.Basic\nimport Mathlib.CategoryTheory.Endomorphism\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.CategoryTheory.Conj\nimport Mathlib.CategoryTheory.Linear.Basic\nimport Mathlib.CategoryTheory.Preadditive.AdditiveFunctor\nimport Mathlib.LinearAlgebra.Basic\nimport Mathlib.Algebra.Category.ModuleCat.Basic\nimport Mathlib.LinearAlgebra.TensorProduct.Basic\nimport Mathlib.CategoryTheory.Monoidal.Linear\nimport Mathlib.Algebra.Algebra.Subalgebra.Basic\nimport Mathlib.Algebra.FreeAlgebra\nimport Mathlib.Algebra.Category.Ring.Basic\nimport Mathlib.Algebra.Category.ModuleCat.Basic\nimport Mathlib.CategoryTheory.ConcreteCategory.BundledHom\nimport Mathlib.Algebra.PUnitInstances\nimport Mathlib.CategoryTheory.Functor.ReflectsIso\nimport Mathlib.Algebra.PEmptyInstances\nimport Mathlib.Algebra.Group.Equiv.Basic\nimport Mathlib.CategoryTheory.ConcreteCategory.BundledHom\nimport Mathlib.CategoryTheory.Functor.ReflectsIso\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.CategoryTheory.ConcreteCategory.ReflectsIso\nimport Mathlib.Algebra.Ring.Equiv\nimport Mathlib.CategoryTheory.Monoidal.Rigid.Basic\nimport Mathlib.CategoryTheory.Monoidal.Subcategory\nimport Mathlib.LinearAlgebra.Coevaluation\nimport Mathlib.LinearAlgebra.FreeModule.Finite.Matrix\nimport Mathlib.Algebra.Category.ModuleCat.Monoidal.Closed\nimport Mathlib.Algebra.Group.Commute.Basic\nimport Mathlib.Algebra.GroupWithZero.Defs\nimport Mathlib.Data.Int.Defs\nimport Mathlib.Tactic.Common\nimport Mathlib.Algebra.GroupPower.CovariantClass\nimport Mathlib.Algebra.Order.Monoid.WithTop\nimport Mathlib.Algebra.SMulWithZero\nimport Mathlib.Order.Hom.Basic\nimport Mathlib.Data.Nat.Order.Basic\nimport Mathlib.Algebra.EuclideanDomain.Defs\nimport Mathlib.Algebra.Ring.Divisibility.Basic\nimport Mathlib.Algebra.Ring.Regular\nimport Mathlib.Algebra.GroupWithZero.Divisibility\nimport Mathlib.Algebra.Ring.Basic\nimport Mathlib.Algebra.Function.Indicator\nimport Mathlib.Algebra.SMulWithZero\nimport Mathlib.Data.Int.Basic\nimport Mathlib.Data.NNRat.Defs\nimport Mathlib.GroupTheory.GroupAction.Group\nimport Mathlib.GroupTheory.GroupAction.Pi\nimport Mathlib.Logic.Basic\nimport Mathlib.Tactic.Abel\nimport Mathlib.GroupTheory.GroupAction.SubMulAction\nimport Mathlib.GroupTheory.Submonoid.Membership\nimport Mathlib.Algebra.Module.Pi\nimport Mathlib.Algebra.Ring.CompTypeclasses\nimport Mathlib.Algebra.Star.Basic\nimport Mathlib.GroupTheory.GroupAction.DomAct.Basic\nimport Mathlib.GroupTheory.GroupAction.Hom\nimport Mathlib.Algebra.Algebra.Equiv\nimport Mathlib.Algebra.Algebra.NonUnitalHom\nimport Mathlib.Algebra.BigOperators.Finsupp\nimport Mathlib.Algebra.Module.BigOperators\nimport Mathlib.LinearAlgebra.Finsupp\nimport Mathlib.Algebra.Group.Commute.Defs\nimport Mathlib.Algebra.Group.Units\nimport Mathlib.Algebra.Order.Monoid.Lemmas\nimport Mathlib.Tactic.NthRewrite\nimport Aesop\nimport Mathlib.Algebra.Group.Defs\nimport Mathlib.Logic.Function.Basic\nimport Mathlib.Tactic.Cases\nimport Mathlib.Tactic.SimpRw\nimport Mathlib.Tactic.SplitIfs\nimport Mathlib.Algebra.Group.Semiconj.Defs\nimport Mathlib.Algebra.Group.Basic\nimport Mathlib.Algebra.Group.Basic\nimport Mathlib.Algebra.Group.Hom.Defs\nimport Mathlib.Algebra.Group.Defs\nimport Mathlib.Data.Prod.Basic\nimport Mathlib.Data.Sum.Basic\nimport Mathlib.Logic.Unique\nimport Mathlib.Tactic.Spread\nimport Mathlib.Algebra.Group.Equiv.Basic\nimport Mathlib.Algebra.Group.WithOne.Defs\nimport Mathlib.Data.Option.Basic\nimport Mathlib.Algebra.Group.Hom.Basic\nimport Mathlib.Data.FunLike.Equiv\nimport Mathlib.Logic.Equiv.Basic\nimport Mathlib.Algebra.Group.Commute.Defs\nimport Mathlib.Algebra.Group.Semiconj.Basic\nimport Mathlib.Algebra.Field.Opposite\nimport Mathlib.Algebra.Invertible.Defs\nimport Mathlib.Algebra.Ring.Aut\nimport Mathlib.Algebra.Ring.CompTypeclasses\nimport Mathlib.Algebra.Field.Opposite\nimport Mathlib.Algebra.Invertible.Defs\nimport Mathlib.Data.NNRat.Defs\nimport Mathlib.Data.Rat.Cast.Defs\nimport Mathlib.Data.SetLike.Basic\nimport Mathlib.GroupTheory.GroupAction.Opposite\nimport Mathlib.Algebra.Group.Basic\nimport Mathlib.Algebra.GroupWithZero.NeZero\nimport Mathlib.Algebra.Group.OrderSynonym\nimport Mathlib.Algebra.GroupWithZero.Basic\nimport Mathlib.Algebra.Group.Units\nimport Mathlib.Tactic.Nontriviality\nimport Mathlib.Util.AssertExists\nimport Mathlib.Tactic.Contrapose\nimport Mathlib.CategoryTheory.Category.Grpd\nimport Mathlib.CategoryTheory.Groupoid\nimport Mathlib.Topology.Category.TopCat.Basic\nimport Mathlib.Topology.Homotopy.Path\nimport Mathlib.Data.Set.Basic\nimport Mathlib.RingTheory.IntegralClosure\nimport Mathlib.FieldTheory.Normal\nimport Mathlib.FieldTheory.Perfect\nimport Mathlib.RingTheory.Localization.Integral\nimport Mathlib.FieldTheory.Separable\nimport Mathlib.RingTheory.IntegralDomain\nimport Mathlib.Algebra.CharP.Reduced\nimport Mathlib.Tactic.ApplyFun\nimport Lean\nimport Std\nimport Mathlib.Tactic.PPWithUniv\nimport Mathlib.Tactic.ExtendDoc\nimport Mathlib.Tactic.Lemma\nimport Mathlib.Tactic.TypeStar\nimport Lean.Elab.Tactic.SolveByElim\nimport Mathlib.Tactic.Monotonicity.Attr\nimport Lean.Elab.Tactic.Simp\nimport Lean.Elab.App\nimport Mathlib.Tactic.Simps.NotationClass\nimport Std.Data.String.Basic\nimport Std.Util.LibraryNote\nimport Mathlib.Lean.Expr.Basic\nimport Mathlib.Tactic.NormNum.Inv\nimport Mathlib.Tactic.NormNum.Pow\nimport Mathlib.Util.AtomM\nimport Mathlib.Data.Rat.Order\nimport Mathlib.Tactic.NormNum.Core\nimport Mathlib.Tactic.HaveI\nimport Mathlib.Data.Nat.Cast.Commute\nimport Mathlib.Data.Int.Basic\nimport Mathlib.Algebra.Invertible.Basic\nimport Mathlib.Tactic.Clear!\nimport Mathlib.Data.Nat.Cast.Basic\nimport Mathlib.Algebra.GroupPower.Order\nimport Mathlib.Data.Int.CharZero\nimport Mathlib.Data.Int.Order.Basic\nimport Mathlib.Data.Nat.Factorial.Basic\nimport Mathlib.Data.Rat.Order\nimport Mathlib.Tactic.Positivity.Core\nimport Qq\nimport Std.Data.Rat.Lemmas\nimport Mathlib.Mathport.Rename\nimport Mathlib.Mathport.Rename\nimport Std.Logic\nimport Mathlib.Mathport.Rename\nimport Mathlib.Mathport.Rename\nimport Mathlib.Init.Data.Nat.Notation\nimport Std.Data.List.Basic\nimport Mathlib.Init.ZeroOne\nimport Mathlib.Init.Data.Nat.Notation\nimport Mathlib.Util.CompileInductive\nimport Mathlib.Init.Data.Nat.Notation\nimport Mathlib.Mathport.Rename\nimport Mathlib.Mathport.Rename\nimport Std.Data.Bool\nimport Mathlib.AlgebraicGeometry.AffineScheme\nimport Mathlib.AlgebraicGeometry.Pullbacks\nimport Mathlib.CategoryTheory.MorphismProperty\nimport Mathlib.Data.List.TFAE\nimport Mathlib.LinearAlgebra.Finsupp\nimport Mathlib.RingTheory.Ideal.Over\nimport Mathlib.RingTheory.Ideal.Prod\nimport Mathlib.RingTheory.Ideal.MinimalPrime\nimport Mathlib.RingTheory.Localization.Away.Basic\nimport Mathlib.RingTheory.Nilpotent\nimport Mathlib.Topology.Sets.Closeds\nimport Mathlib.Topology.Sober\nimport Mathlib.Data.Set.Function\nimport Mathlib.Logic.Function.Iterate\nimport Mathlib.GroupTheory.Perm.Basic\nimport Mathlib.Algebra.BigOperators.Basic\nimport Mathlib.Dynamics.FixedPoints.Basic\nimport Mathlib.Algebra.Function.Support\nimport Mathlib.Order.Filter.Lift\nimport Mathlib.Topology.Defs.Filter\nimport Mathlib.Order.SetNotation\nimport Mathlib.Tactic.Continuity\nimport Mathlib.Tactic.FunProp\nimport Mathlib.Topology.Order.ProjIcc\nimport Mathlib.Topology.ContinuousFunction.Ordered\nimport Mathlib.Topology.CompactOpen\nimport Mathlib.Topology.UnitInterval\nimport Mathlib.Analysis.NormedSpace.BoundedLinearMaps\nimport Mathlib.Topology.FiberBundle.Basic\nimport Mathlib.Data.Set.Image\nimport Mathlib.Order.SuccPred.Relation\nimport Mathlib.Topology.Clopen\nimport Mathlib.Topology.Irreducible\nimport Mathlib.CategoryTheory.ConcreteCategory.BundledHom\nimport Mathlib.CategoryTheory.Elementwise\nimport Mathlib.Topology.ContinuousFunction.Basic\nimport Mathlib.Topology.Category.TopCat.Basic\nimport Mathlib.CategoryTheory.Limits.Types\nimport Mathlib.Topology.Category.CompHaus.Basic\nimport Mathlib.Topology.LocallyConstant.Basic\nimport Mathlib.CategoryTheory.FintypeCat\nimport Mathlib.Topology.Category.Profinite.Basic\nimport Mathlib.CategoryTheory.Limits.ConcreteCategory\nimport Mathlib.Topology.ExtremallyDisconnected\nimport Mathlib.Topology.Category.CompHaus.Projective\nimport Mathlib.Topology.Category.Profinite.Basic\nimport Mathlib.CategoryTheory.Adjunction.Reflective\nimport Mathlib.Topology.StoneCech\nimport Mathlib.CategoryTheory.Monad.Limits\nimport Mathlib.Topology.UrysohnsLemma\nimport Mathlib.Topology.Category.TopCat.Limits.Basic\nimport Mathlib.Data.Set.Basic\nimport Mathlib.Order.Filter.SmallSets\nimport Mathlib.Tactic.Monotonicity\nimport Mathlib.Topology.Compactness.Compact\nimport Mathlib.Topology.NhdsSet\nimport Mathlib.Algebra.Group.Defs\nimport Mathlib.Data.Set.Intervals.Pi\nimport Mathlib.Data.Set.Pointwise.Basic\nimport Mathlib.Order.Filter.Interval\nimport Mathlib.Tactic.TFAE\nimport Mathlib.Tactic.NormNum\nimport Mathlib.Topology.Order.LeftRight\nimport Mathlib.Topology.Order.OrderClosed\nimport Mathlib.Order.Hom.Basic\nimport Mathlib.Topology.ContinuousFunction.Basic\nimport Mathlib.Topology.Algebra.Ring.Basic\nimport Mathlib.Topology.Algebra.MulAction\nimport Mathlib.Topology.Algebra.UniformGroup\nimport Mathlib.Topology.ContinuousFunction.Basic\nimport Mathlib.Topology.UniformSpace.UniformEmbedding\nimport Mathlib.Algebra.Algebra.Basic\nimport Mathlib.LinearAlgebra.Projection\nimport Mathlib.LinearAlgebra.Pi\nimport Mathlib.LinearAlgebra.Finsupp\nimport Mathlib.Topology.Algebra.Module.Basic\nimport Mathlib.LinearAlgebra.Multilinear.Basic\nimport Mathlib.LinearAlgebra.Alternating.Basic\nimport Mathlib.LinearAlgebra.BilinearMap\nimport Mathlib.Topology.Algebra.Module.Multilinear.Basic\nimport Mathlib.GroupTheory.Subgroup.Basic\nimport Mathlib.Topology.Algebra.OpenSubgroup\nimport Mathlib.Topology.Algebra.Ring.Basic\nimport Mathlib.Algebra.Ring.Prod\nimport Mathlib.RingTheory.Subring.Basic\nimport Mathlib.Topology.Algebra.Group.Basic\nimport Mathlib.Topology.Algebra.InfiniteSum.Defs\nimport Mathlib.Data.Fintype.BigOperators\nimport Mathlib.Topology.Algebra.Monoid\nimport Mathlib.GroupTheory.GroupAction.ConjAct\nimport Mathlib.GroupTheory.GroupAction.Quotient\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.Topology.Algebra.Monoid\nimport Mathlib.Topology.Algebra.Constructions\nimport Mathlib.Data.Nat.Interval\nimport Mathlib.Data.ENNReal.Real\nimport Mathlib.Topology.UniformSpace.Pi\nimport Mathlib.Topology.UniformSpace.UniformConvergence\nimport Mathlib.Topology.UniformSpace.UniformEmbedding\nimport Mathlib.Algebra.Function.Indicator\nimport Mathlib.Tactic.FinCases\nimport Mathlib.Topology.Sets.Closeds\nimport Mathlib.Order.Filter.Cofinite\nimport Mathlib.Topology.MetricSpace.ProperSpace\nimport Mathlib.Topology.MetricSpace.Basic\nimport Mathlib.Topology.FiberBundle.Trivialization\nimport Mathlib.Data.Set.UnionLift\nimport Mathlib.Topology.Homeomorph\nimport Mathlib.Algebra.GeomSum\nimport Mathlib.RingTheory.Ideal.Quotient\nimport Mathlib.Algebra.Associated\nimport Mathlib.RingTheory.Int.Basic\nimport Mathlib.Tactic.Ring\nimport Mathlib.Algebra.Star.Unitary\nimport Mathlib.Algebra.DirectSum.Algebra\nimport Mathlib.Analysis.Complex.UpperHalfPlane.FunctionsBoundedAtInfty\nimport Mathlib.Analysis.Complex.UpperHalfPlane.Manifold\nimport Mathlib.Geometry.Manifold.MFDeriv.SpecificFunctions\nimport Mathlib.NumberTheory.ModularForms.SlashInvariantForms\nimport Mathlib.NumberTheory.ModularForms.SlashInvariantForms\nimport Mathlib.NumberTheory.ModularForms.CongruenceSubgroups\nimport Mathlib.Data.Int.Parity\nimport Mathlib.RingTheory.DedekindDomain.IntegralClosure\nimport Mathlib.Algebra.GCDMonoid.Finset\nimport Mathlib.Algebra.GroupPower.Ring\nimport Mathlib.Data.Nat.Parity\nimport Mathlib.Data.Rat.Defs\nimport Mathlib.Tactic.Positivity.Basic\nimport Mathlib.Tactic.TFAE\nimport Mathlib.Analysis.PSeries\nimport Mathlib.NumberTheory.ArithmeticFunction\nimport Mathlib.Analysis.NormedSpace.FiniteDimension\nimport Mathlib.Init.Core\nimport Mathlib.RingTheory.Polynomial.Cyclotomic.Roots\nimport Mathlib.NumberTheory.NumberField.Basic\nimport Mathlib.FieldTheory.Galois\nimport Mathlib.Analysis.Calculus.MeanValue\nimport Mathlib.Analysis.Calculus.Deriv.Polynomial\nimport Mathlib.Data.Polynomial.DenomsClearable\nimport Mathlib.Data.Real.Irrational\nimport Mathlib.Topology.Algebra.Polynomial\nimport Mathlib.NumberTheory.LegendreSymbol.QuadraticChar.Basic\nimport Mathlib.Data.Fintype.Parity\nimport Mathlib.NumberTheory.LegendreSymbol.ZModChar\nimport Mathlib.FieldTheory.Finite.Basic\nimport Mathlib.Algebra.Periodic\nimport Mathlib.Data.ZMod.Units\nimport Mathlib.NumberTheory.LegendreSymbol.MulCharacter\nimport Mathlib.Analysis.Normed.Field.InfiniteSum\nimport Mathlib.Analysis.SpecificLimits.Normed\nimport Mathlib.NumberTheory.ArithmeticFunction\nimport Mathlib.NumberTheory.SmoothNumbers\nimport Lean.Meta.Tactic.Rewrite\nimport Std.Lean.Expr\nimport Std.Lean.Name\nimport Std.Data.Rat.Basic\nimport Std.Data.List.Basic\nimport Std.Lean.Name\nimport Std.Logic\nimport Mathlib.Lean.Meta\nimport Lean.Meta.AppBuilder\nimport Lean.Meta.Basic\nimport Mathlib.Data.Opposite\nimport Mathlib.Tactic.Cases\nimport Mathlib.Combinatorics.SimpleGraph.Init\nimport Mathlib.Data.Rel\nimport Mathlib.Data.Set.Finite\nimport Mathlib.Data.Sym.Sym2\nimport Mathlib.Algebra.GroupPower.Order\nimport Mathlib.Combinatorics.SimpleGraph.Clique\nimport Mathlib.Data.Finset.Sym\nimport Mathlib.Tactic.GCongr\nimport Mathlib.Tactic.Positivity\nimport Mathlib.Dynamics.FixedPoints.Basic\nimport Mathlib.GroupTheory.Perm.Option\nimport Mathlib.Logic.Equiv.Defs\nimport Mathlib.Logic.Equiv.Option\nimport Mathlib.Combinatorics.Hall.Finite\nimport Mathlib.CategoryTheory.CofilteredSystem\nimport Mathlib.Data.Rel" +} diff --git a/data/notlean_dependency.json b/data/notlean_dependency.json new file mode 100644 index 0000000000000000000000000000000000000000..3475fc5abb31d3e8c63511c40d26e1834d0546a8 --- /dev/null +++ b/data/notlean_dependency.json @@ -0,0 +1,3 @@ +{ + "working_file": "import algebra.algebra.basic\nimport algebra.order.floor\nimport algebra.associated\nimport algebra.big_operators.basic\nimport algebra.big_operators.enat\nimport algebra.big_operators.order\nimport algebra.big_operators.pi\nimport algebra.geom_sum\nimport algebra.group.pi\nimport algebra.group.commute\nimport algebra.group_power.basic\nimport algebra.group_power.identities\nimport algebra.order.floor\nimport algebra.quadratic_discriminant\nimport algebra.ring.basic\nimport analysis.asymptotics.asymptotic_equivalent\nimport analysis.mean_inequalities\nimport analysis.normed_space.basic\nimport analysis.inner_product_space.basic\nimport analysis.inner_product_space.euclidean_dist\nimport analysis.normed_space.pi_Lp\nimport analysis.special_functions.exp\nimport analysis.special_functions.exp_deriv\nimport analysis.special_functions.log\nimport analysis.special_functions.logb\nimport analysis.special_functions.log_deriv\nimport analysis.special_functions.pow\nimport analysis.special_functions.sqrt\nimport analysis.special_functions.trigonometric.basic\nimport analysis.special_functions.trigonometric.complex\nimport combinatorics.simple_graph.basic\nimport data.complex.basic\nimport data.complex.exponential\nimport data.finset.basic\nimport data.fintype.card\nimport data.int.basic\nimport data.int.gcd\nimport data.int.modeq\nimport data.int.parity\nimport data.list.intervals\nimport data.list.palindrome\nimport data.multiset.basic\nimport data.nat.basic\nimport data.nat.choose.basic\nimport data.nat.digits\nimport data.nat.factorial.basic\nimport data.nat.fib\nimport data.nat.modeq\nimport data.nat.multiplicity\nimport data.nat.parity\nimport data.nat.prime\nimport data.pnat.basic\nimport data.pnat.prime\nimport data.polynomial\nimport data.polynomial.basic\nimport data.polynomial.eval\nimport data.rat.basic\nimport data.real.basic\nimport data.real.ennreal\nimport data.real.irrational\nimport data.real.nnreal\nimport data.real.sqrt\nimport data.real.golden_ratio\nimport data.set.finite\nimport data.sym.sym2\nimport data.zmod.basic\nimport dynamics.fixed_points.basic\nimport field_theory.finite.basic\nimport geometry.euclidean.basic\nimport geometry.euclidean.circumcenter\nimport geometry.euclidean.monge_point\nimport geometry.euclidean.sphere\nimport init.data.nat.gcd\nimport linear_algebra.affine_space.affine_map\nimport linear_algebra.affine_space.independent\nimport linear_algebra.affine_space.ordered\nimport linear_algebra.finite_dimensional\nimport logic.equiv.basic\nimport measure_theory.integral.interval_integral\nimport number_theory.arithmetic_function\nimport number_theory.legendre_symbol.quadratic_reciprocity\nimport number_theory.primes_congruent_one\nimport order.bounds\nimport order.filter.basic\nimport order.well_founded\nimport topology.basic\nimport topology.instances.nnreal\n" +} diff --git a/gpt_pass_rate_multi_pass.py b/gpt_pass_rate_multi_pass.py new file mode 100644 index 0000000000000000000000000000000000000000..304e1408edaa20d34f1dba1d7bda002a6110b3e1 --- /dev/null +++ b/gpt_pass_rate_multi_pass.py @@ -0,0 +1,54 @@ +import pdb +import subprocess +import re + +# Output file +output_file = "pass_rate_output.txt" + +# Clearing the output file before appending new content +with open(output_file, "w") as file: + file.write("") + +# List of input paths +input_path_lists = [ + "test/zero_shot/wild_test/generation/lean4_random_15k_all/2/1/", +] + +def get_output(input_string, k): + pattern = r"gpt_result/(\w+)/(\w+)" + match = re.search(pattern, input_string) + if match: + part1 = match.group(1) + part2 = match.group(2) + result = f"gpt_result/{part2}/{part1}_pass{k}.json" + print(result) + return result + else: + print("No match found.") + return None + +# List of input paths +input_path_lists = [ + # "gpt_result/lean_basic/gpt4/", + # "gpt_result/lean_random/gpt4/", + "gpt_result/wild/gpt4/", + # "gpt_result/lean_basic/gpt3/", + # "gpt_result/lean_random/gpt3/", + "gpt_result/wild/gpt3/", +] + +# Iterate through the input paths and run the command +for input_path in input_path_lists: + k = 5 + if "wild" in input_path or "gsm8k_train" in input_path or "math_train" in input_path: + print(f"wild") + print(f"Running for input path: {input_path}", file=open(output_file, "a")) + command = f"python3 gpt_pass_rate_new_notlean_test.py --input_path {input_path} --output_path {get_output(input_path,k)} --k {k}" + subprocess.run(command, shell=True, stdout=open(output_file, "a"), stderr=subprocess.STDOUT) + print("\n\n",file=open(output_file, "a")) + else: + print(f"lean") + print(f"Running for input path: {input_path}", file=open(output_file, "a")) + command = f"python3 gpt_pass_rate_new_test.py --input_path {input_path} --output_path {get_output(input_path, k)} --k {k}" + subprocess.run(command, shell=True, stdout=open(output_file, "a"), stderr=subprocess.STDOUT) + print("\n\n",file=open(output_file, "a")) \ No newline at end of file diff --git a/gpt_pass_rate_new_notlean_test.py b/gpt_pass_rate_new_notlean_test.py new file mode 100644 index 0000000000000000000000000000000000000000..e503bc7b0e709aa5aff78aa28d19d19b9eb64a05 --- /dev/null +++ b/gpt_pass_rate_new_notlean_test.py @@ -0,0 +1,289 @@ +import os +import subprocess +from argparse import ArgumentParser +import json +from concurrent.futures import ThreadPoolExecutor +from tqdm import tqdm +import glob +import tempfile +import random + +def wrapped_function(item): + results = [] + passed = 0 + total = 0 + + temp_dir = tempfile.gettempdir() + temp_file = os.path.join(temp_dir, f"test.lean") + + with open(temp_file, "w") as f: + f.write(item['cmd']) + + # Rest of the function code... + # Process the item using the temporary file + # ... + + # Clean up the temporary file + data = '{"path": "%s", "allTactics": true}' %(temp_file) + command = 'echo \'%s\' | lake exe repl' % data + + try: + result = subprocess.run(command, shell=True, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout = result.stdout.decode('utf-8') + stderr = result.stderr.decode('utf-8') + # stdout = result.stdout.decode('utf-8') + json_stdout = json.loads(stdout) + if "messages" not in json_stdout.keys(): + passed += 1 + # results.append({'item': item['content'], 'stdout': stdout, 'stderr': stderr, 'status': 'pass'}) + results.append({ 'stdout': stdout, 'stderr': stderr, 'status': 'pass'}) + except subprocess.CalledProcessError as e: + # results.append({'item': item['content'], 'error': str(e), 'status': 'nopass'}) + results.append({ 'error': str(e), 'status': 'nopass'}) + total += 1 + + pass_rate = passed / (passed + total) * 100 + + + return {'results': results, 'pass_rate': pass_rate} + +# Set the directory where your .lean files are located + +# Get a list of all .lean files in the directory +# lean_files = [f for f in os.listdir(directory) if f.endswith(".lean")] +# lean_files = ["test/file.lean"] +def single(command_list, args): + results = [] + passed = 0 + total = 0 + for item in tqdm(command_list): + with open("test/test.lean", "w", encoding = 'utf-8') as f: + f.write(item['cmd']) + data = '{"path": "test/test.lean", "allTactics": true}' + # data = '{"cmd": "%s", "allTactics": true}' % item['cmd'] + command = 'echo \'%s\' | lake exe repl' % data + try: + # process = subprocess.Popen(['lake', 'exe', 'repl'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, + # stderr=subprocess.PIPE) + # stdout, stderr = process.communicate(input=data.encode(encoding='utf-8')) + # stdout = stdout.decode('utf-8') + result = subprocess.run(command, shell=True, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout = result.stdout.decode('utf-8') + json_stdout = json.loads(stdout) + if "messages" not in json_stdout.keys(): + passed += 1 + stderr = result.stderr.decode('utf-8') + results.append({ + # 'item': item['content'], + 'stdout': stdout, + 'stderr': stderr, + 'status': 'pass' + }) + except subprocess.CalledProcessError as e: + results.append({ + # 'item': item['content'], + 'error': str(e), + 'status': 'nopass' + }) + total += 1 + + # Calculate pass rate + pass_rate = passed / total * 100 + print(pass_rate) + + # Save results to a JSON file + with open('results.json', 'w') as f: + json.dump({'results': results, 'pass_rate': pass_rate}, f, indent=2, ensure_ascii=False) + + +def multi(command_list, output_path, k ): + results = [] + passed = 0 + total = 0 + def execute_command(item, index): + temp_dir = '/opt/jianqiao' + def filter_json(json_data): + filtered_data = {} + for key in json_data.keys(): + if key in ['question', 'answer', 'total output', 'results']: + filtered_data[key] = json_data[key] + return filtered_data + # result_dict = filter_json(item) + result_dict = item + result_dict['results'] = [] + + for i, cmd in enumerate(item['cmd']): + temp_file = os.path.join(temp_dir,f"{index}_test_{i}.lean") # Ensure unique filenames + with open(temp_file, "w") as f: + f.write(cmd) + + data = '{"path": "%s", "allTactics": true}' % temp_file + command = f'echo \'{data}\' | lake exe repl' + + try: + result = subprocess.run(command, shell=True, check=True,timeout=600, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout = json.loads(result.stdout.decode('utf-8')) + stderr = result.stderr.decode('utf-8') + + except subprocess.TimeoutExpired as e: + result_item = {'error': str(e), 'status': 'nopass_limit'} + + except subprocess.CalledProcessError as e: + result_item = {'error': str(e), 'status': 'nopass_error'} + + else: + if "messages" not in stdout and not len(stderr): + result_item = {'stdout': stdout, 'stderr': stderr, 'status': 'pass' } + elif not len(stderr) and "messages" in stdout: + flag = 0 + for me in stdout['messages']: + if me['severity'] == 'error': + flag = 1 + start_line = me['pos']['line'] - 1 + current_column =me['pos']['column'] -1 + for line_n in range(start_line - 1, 0 , -1): + line_len = len(cmd.split('\n')[line_n]) + current_column += line_len + 1 + if not line_len: + break + result_item = {'stdout': stdout, 'stderr': stderr, 'status': 'nopass', 'string_pos':current_column} + break + if not flag : + result_item = {'stdout': stdout, 'stderr': stderr, 'status': 'pass'} + else: + assert len(stderr) + result_item = {'stdout': stdout, 'stderr': stderr, 'status': 'nopass', 'string_pos': 0 } + + result_dict['results'].append(result_item) + return result_dict + + + total = len(command_list) + + with ThreadPoolExecutor(max_workers=128) as executor: + futures = [executor.submit(execute_command, cmd, i) for i, cmd in enumerate(command_list)] + for future in tqdm(futures, total=total, desc="Processing Commands"): + result = future.result() + results.append(result) + # if result['status'] == 'pass': + # passed += 1 + + def calculate_pass(result_list, k): + pass_1_count = 0 + pass_k_count = 0 + + for result in result_list: + results = result.get('results', []) + if results: + for j in range(min(1, len(results))): + if results[j].get('status') == 'pass': + pass_1_count += 1 + break + + for j in range(min(k, len(results))): + if results[j].get('status') == 'pass': + pass_k_count += 1 + break + + pass_1 = pass_1_count / len(result_list) if result_list else 0 + pass_k = pass_k_count / len(result_list) if result_list else 0 + + return pass_1, pass_k + + pass_1, pass_k = calculate_pass(results, k) + print("Pass@1:", pass_1) + print(f"Pass@{k}:", pass_k) + + # pass_rate = (passed / total) * 100 + # print(f"total test: {total}") + # print(f"Pass rate: {pass_rate}%") + + output_file = f"pass_rate_results/{output_path}" + # Create the directory if it doesn't exist + os.makedirs(os.path.dirname(output_file), exist_ok=True) + + with open(f"{output_file}", 'w') as f: + json.dump({'results': results, 'pass_1': pass_1, f"pass_{k}":pass_k}, f, indent=2, ensure_ascii=False) + +import re +def remove_simp_pattern_from_end(s): + pattern = r'@\[simp\s*.*?\]$' + return re.sub(pattern, '', s) + + +def get_lean(text): + content = "" + try: + code_block_pattern = r"```lean\s*\n(.*?)\n```" + code_blocks = re.findall(code_block_pattern, text, re.DOTALL) + content = "\n\n".join(code_blocks) + except: + matches = re.findall(r'```(.*?)```', text, re.DOTALL) + if len(matches): + content = "\n\n".join(matches) + finally: + if not len(content.strip()): + try: + code_block_pattern = r"```lean4\s*\n(.*?)\n```" + code_blocks = re.findall(code_block_pattern, text, re.DOTALL) + content = "\n\n".join(code_blocks) + except: + content = '' + + if not len(content.strip()): + content = "theorem h : f + g = 39 := by exact rfl" + return content + +def main(args): + command_list = [] + # json_filename = 'data/notlean_dependency.json' + json_filename = 'data/basic_working.json' + + json_item = json.load(open(json_filename, encoding='utf-8')) + working_env = json_item['working_file'] + + all_dicts = {} + with open(f"{args.input_path}/1.jsonl", 'r', encoding='utf-8') as rf: + for line in rf.readlines(): + try: + json_item = json.loads(line) + text = get_lean(json_item['model_response']).split("#align")[0] + json_item['cmd'] = ['\n\n'.join([working_env, text])] + all_dicts[json_item['query_id']] = json_item + assert len(text) > 0 + except: + import pdb + pdb.set_trace() + + file_pattern = os.path.join(args.input_path, '[2-9]*.jsonl') + for file_path in glob.glob(file_pattern): + with open(file_path, 'r', encoding='utf-8') as rf: + for line in rf.readlines(): + try: + json_item = json.loads(line) + text = get_lean(json_item['model_response']).split("#align")[0] + all_dicts[json_item['query_id']]['cmd'].append('\n\n'.join([working_env, text])) + assert len(text) > 0 + except: + import pdb + pdb.set_trace() + for k, v in all_dicts.items(): + command_list.append(v) + multi(command_list, args.output_path, args.k) + +if __name__ == '__main__': + arg_parser = ArgumentParser() + arg_parser.add_argument('--data_path', type=str, + default='data/grade-school-math-master/grade_school_math/data/test.jsonl') + arg_parser.add_argument('--input_path', type=str, default='') + arg_parser.add_argument('--cuda_num', type=int, default=8) + arg_parser.add_argument('--k', type=int, default=1) + arg_parser.add_argument('--output_path', type=str, default='total.json') + arg_parser.add_argument('--generate_method', type=str, + choices=['single', 'sft', 'comp', 'self_consistency', 'single_consistency']) + arg_parser.add_argument('--method', type=str, choices=['main', 'test', 'get_data']) + args = arg_parser.parse_args() + main(args) + + + diff --git a/gpt_pass_rate_new_test.py b/gpt_pass_rate_new_test.py new file mode 100644 index 0000000000000000000000000000000000000000..1d9df78446afd9a8fd736e9ce773bc389c8c65cc --- /dev/null +++ b/gpt_pass_rate_new_test.py @@ -0,0 +1,287 @@ +import os +import subprocess +from argparse import ArgumentParser +import json +from concurrent.futures import ThreadPoolExecutor +from tqdm import tqdm +import glob +import tempfile +import random + +def wrapped_function(item): + results = [] + passed = 0 + total = 0 + + temp_dir = tempfile.gettempdir() + temp_file = os.path.join(temp_dir, f"test.lean") + + with open(temp_file, "w") as f: + f.write(item['cmd']) + + # Rest of the function code... + # Process the item using the temporary file + # ... + + # Clean up the temporary file + data = '{"path": "%s", "allTactics": true}' %(temp_file) + command = 'echo \'%s\' | lake exe repl' % data + + try: + result = subprocess.run(command, shell=True, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout = result.stdout.decode('utf-8') + stderr = result.stderr.decode('utf-8') + # stdout = result.stdout.decode('utf-8') + json_stdout = json.loads(stdout) + if "messages" not in json_stdout.keys(): + passed += 1 + # results.append({'item': item['content'], 'stdout': stdout, 'stderr': stderr, 'status': 'pass'}) + results.append({ 'stdout': stdout, 'stderr': stderr, 'status': 'pass'}) + except subprocess.CalledProcessError as e: + # results.append({'item': item['content'], 'error': str(e), 'status': 'nopass'}) + results.append({ 'error': str(e), 'status': 'nopass'}) + total += 1 + + pass_rate = passed / (passed + total) * 100 + + + return {'results': results, 'pass_rate': pass_rate} + +# Set the directory where your .lean files are located + +# Get a list of all .lean files in the directory +# lean_files = [f for f in os.listdir(directory) if f.endswith(".lean")] +# lean_files = ["test/file.lean"] +def single(command_list, args): + results = [] + passed = 0 + total = 0 + for item in tqdm(command_list): + with open("test/test.lean", "w", encoding = 'utf-8') as f: + f.write(item['cmd']) + data = '{"path": "test/test.lean", "allTactics": true}' + # data = '{"cmd": "%s", "allTactics": true}' % item['cmd'] + command = 'echo \'%s\' | lake exe repl' % data + try: + # process = subprocess.Popen(['lake', 'exe', 'repl'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, + # stderr=subprocess.PIPE) + # stdout, stderr = process.communicate(input=data.encode(encoding='utf-8')) + # stdout = stdout.decode('utf-8') + result = subprocess.run(command, shell=True, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout = result.stdout.decode('utf-8') + json_stdout = json.loads(stdout) + if "messages" not in json_stdout.keys(): + passed += 1 + stderr = result.stderr.decode('utf-8') + results.append({ + # 'item': item['content'], + 'stdout': stdout, + 'stderr': stderr, + 'status': 'pass' + }) + except subprocess.CalledProcessError as e: + results.append({ + # 'item': item['content'], + 'error': str(e), + 'status': 'nopass' + }) + total += 1 + + # Calculate pass rate + pass_rate = passed / total * 100 + print(pass_rate) + + # Save results to a JSON file + with open('results.json', 'w') as f: + json.dump({'results': results, 'pass_rate': pass_rate}, f, indent=2, ensure_ascii=False) + + +def multi(command_list, output_path, k ): + results = [] + passed = 0 + total = 0 + def execute_command(item, index): + temp_dir = '/opt/jianqiao' + def filter_json(json_data): + filtered_data = {} + for key in json_data.keys(): + if key in ['question', 'answer', 'total output', 'results']: + filtered_data[key] = json_data[key] + return filtered_data + result_dict = filter_json(item) + result_dict['results'] = [] + + for i, cmd in enumerate(item['cmd']): + temp_file = os.path.join(temp_dir,f"{index}_test_{i}.lean") # Ensure unique filenames + with open(temp_file, "w") as f: + f.write(cmd) + + data = '{"path": "%s", "allTactics": true}' % temp_file + command = f'echo \'{data}\' | lake exe repl' + + try: + result = subprocess.run(command, shell=True, check=True,timeout=600, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout = json.loads(result.stdout.decode('utf-8')) + stderr = result.stderr.decode('utf-8') + + except subprocess.TimeoutExpired as e: + result_item = {'error': str(e), 'status': 'nopass_limit'} + + except subprocess.CalledProcessError as e: + result_item = {'error': str(e), 'status': 'nopass_error'} + + else: + if "messages" not in stdout and not len(stderr): + result_item = {'stdout': stdout, 'stderr': stderr, 'status': 'pass' } + elif not len(stderr) and "messages" in stdout: + flag = 0 + for me in stdout['messages']: + if me['severity'] == 'error': + flag = 1 + start_line = me['pos']['line'] - 1 + current_column =me['pos']['column'] -1 + for line_n in range(start_line - 1, 0 , -1): + line_len = len(cmd.split('\n')[line_n]) + current_column += line_len + 1 + if not line_len: + break + result_item = {'stdout': stdout, 'stderr': stderr, 'status': 'nopass', 'string_pos':current_column} + break + if not flag : + result_item = {'stdout': stdout, 'stderr': stderr, 'status': 'pass'} + else: + assert len(stderr) + result_item = {'stdout': stdout, 'stderr': stderr, 'status': 'nopass', 'string_pos': 0 } + + result_dict['results'].append(result_item) + return result_dict + + + total = len(command_list) + + with ThreadPoolExecutor(max_workers=128) as executor: + futures = [executor.submit(execute_command, cmd, i) for i, cmd in enumerate(command_list)] + for future in tqdm(futures, total=total, desc="Processing Commands"): + result = future.result() + results.append(result) + # if result['status'] == 'pass': + # passed += 1 + + def calculate_pass(result_list, k): + pass_1_count = 0 + pass_k_count = 0 + + for result in result_list: + results = result.get('results', []) + if results: + for j in range(min(1, len(results))): + if results[j].get('status') == 'pass': + pass_1_count += 1 + break + + for j in range(min(k, len(results))): + if results[j].get('status') == 'pass': + pass_k_count += 1 + break + + pass_1 = pass_1_count / len(result_list) if result_list else 0 + pass_k = pass_k_count / len(result_list) if result_list else 0 + + return pass_1, pass_k + + pass_1, pass_k = calculate_pass(results, k) + print("Pass@1:", pass_1) + print(f"Pass@{k}:", pass_k) + + # pass_rate = (passed / total) * 100 + # print(f"total test: {total}") + # print(f"Pass rate: {pass_rate}%") + + output_file = f"pass_rate_results/{output_path}" + # Create the directory if it doesn't exist + os.makedirs(os.path.dirname(output_file), exist_ok=True) + + with open(f"{output_file}", 'w') as f: + json.dump({'results': results, 'pass_1': pass_1, f"pass_{k}":pass_k}, f, indent=2, ensure_ascii=False) + +import re +def remove_simp_pattern_from_end(s): + pattern = r'@\[simp\s*.*?\]$' + return re.sub(pattern, '', s) + + +def get_lean(text): + content = "" + try: + code_block_pattern = r"```lean\s*\n(.*?)\n```" + code_blocks = re.findall(code_block_pattern, text, re.DOTALL) + content = "\n\n".join(code_blocks) + except: + matches = re.findall(r'```(.*?)```', text, re.DOTALL) + if len(matches): + content = "\n\n".join(matches) + finally: + if not len(content.strip()): + try: + code_block_pattern = r"```lean4\s*\n(.*?)\n```" + code_blocks = re.findall(code_block_pattern, text, re.DOTALL) + content = "\n\n".join(code_blocks) + except: + content = '' + + if not len(content.strip()): + content = "theorem h : f + g = 39 := by exact rfl" + return content + +def main(args): + command_list = [] + + all_dicts = {} + with open(f"{args.input_path}/1.jsonl", 'r', encoding='utf-8') as rf: + for line in rf.readlines(): + try: + json_item = json.loads(line) + working_env = json_item['working_file'] + text = get_lean(json_item['model_response']).split("#align")[0] + + json_item['cmd'] = ['\n\n'.join([working_env, text])] + json_item['answer'] = json_item['statement_poof'] + all_dicts[json_item['query_id']] = json_item + assert len(text) > 0 + except: + import pdb + pdb.set_trace() + + file_pattern = os.path.join(args.input_path, '[2-9]*.jsonl') + for file_path in glob.glob(file_pattern): + with open(file_path, 'r', encoding='utf-8') as rf: + for line in rf.readlines(): + try: + json_item = json.loads(line) + working_env = json_item['working_file'] + text = get_lean(json_item['model_response']).split("#align")[0] + all_dicts[json_item['query_id']]['cmd'].append('\n\n'.join([working_env, text])) + assert len(text) > 0 + except: + import pdb + pdb.set_trace() + for k, v in all_dicts.items(): + command_list.append(v) + multi(command_list, args.output_path, args.k) + +if __name__ == '__main__': + arg_parser = ArgumentParser() + arg_parser.add_argument('--data_path', type=str, + default='data/grade-school-math-master/grade_school_math/data/test.jsonl') + arg_parser.add_argument('--input_path', type=str, default='') + arg_parser.add_argument('--cuda_num', type=int, default=8) + arg_parser.add_argument('--k', type=int, default=1) + arg_parser.add_argument('--output_path', type=str, default='total.json') + arg_parser.add_argument('--generate_method', type=str, + choices=['single', 'sft', 'comp', 'self_consistency', 'single_consistency']) + arg_parser.add_argument('--method', type=str, choices=['main', 'test', 'get_data']) + args = arg_parser.parse_args() + main(args) + + + diff --git a/lake-manifest.json b/lake-manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..5fd0da2aa207eb75ef6e1d4d0b857b0bc3131c0a --- /dev/null +++ b/lake-manifest.json @@ -0,0 +1,68 @@ +{"version": 7, + "packagesDir": ".lake/packages", + "packages": + [{"url": "https://github.com/leanprover/std4", + "type": "git", + "subDir": null, + "rev": "e5306c3b0edefe722370b7387ee9bcd4631d6c17", + "name": "std", + "manifestFile": "lake-manifest.json", + "inputRev": "main", + "inherited": true, + "configFile": "lakefile.lean"}, + {"url": "https://github.com/leanprover-community/quote4", + "type": "git", + "subDir": null, + "rev": "fd760831487e6835944e7eeed505522c9dd47563", + "name": "Qq", + "manifestFile": "lake-manifest.json", + "inputRev": "master", + "inherited": true, + "configFile": "lakefile.lean"}, + {"url": "https://github.com/leanprover-community/aesop", + "type": "git", + "subDir": null, + "rev": "8be30c25e3caa06937feeb62f7ca898370f80ee9", + "name": "aesop", + "manifestFile": "lake-manifest.json", + "inputRev": "master", + "inherited": true, + "configFile": "lakefile.lean"}, + {"url": "https://github.com/leanprover-community/ProofWidgets4", + "type": "git", + "subDir": null, + "rev": "fb65c476595a453a9b8ffc4a1cea2db3a89b9cd8", + "name": "proofwidgets", + "manifestFile": "lake-manifest.json", + "inputRev": "v0.0.30", + "inherited": true, + "configFile": "lakefile.lean"}, + {"url": "https://github.com/leanprover/lean4-cli", + "type": "git", + "subDir": null, + "rev": "be8fa79a28b8b6897dce0713ef50e89c4a0f6ef5", + "name": "Cli", + "manifestFile": "lake-manifest.json", + "inputRev": "main", + "inherited": true, + "configFile": "lakefile.lean"}, + {"url": "https://github.com/leanprover-community/import-graph.git", + "type": "git", + "subDir": null, + "rev": "61a79185b6582573d23bf7e17f2137cd49e7e662", + "name": "importGraph", + "manifestFile": "lake-manifest.json", + "inputRev": "main", + "inherited": true, + "configFile": "lakefile.lean"}, + {"url": "https://github.com/leanprover-community/mathlib4", + "type": "git", + "subDir": null, + "rev": "3cecb823a74ed737c6ebc115e515eba649ec7715", + "name": "mathlib", + "manifestFile": "lake-manifest.json", + "inputRev": "3cecb823a74ed737c6ebc115e515eba649ec7715", + "inherited": false, + "configFile": "lakefile.lean"}], + "name": "REPL", + "lakeDir": ".lake"} diff --git a/lakefile.lean b/lakefile.lean new file mode 100644 index 0000000000000000000000000000000000000000..9a1074a4dc47458de514abbd8088da83ca07071d --- /dev/null +++ b/lakefile.lean @@ -0,0 +1,17 @@ +import Lake +open Lake DSL + +package REPL { + -- add package configuration options here +} + +lean_lib REPL { + -- add library configuration options here +} + +@[default_target] +lean_exe repl where + root := `REPL.Main + supportInterpreter := true + +require mathlib from git "https://github.com/leanprover-community/mathlib4"@"3cecb823a74ed737c6ebc115e515eba649ec7715" diff --git a/lean-toolchain b/lean-toolchain new file mode 100644 index 0000000000000000000000000000000000000000..e35881ce7c99d6834fbe236f7bf4647ce862afd4 --- /dev/null +++ b/lean-toolchain @@ -0,0 +1 @@ +leanprover/lean4:v4.7.0-rc2 diff --git a/nohup.out b/nohup.out new file mode 100644 index 0000000000000000000000000000000000000000..f91c0a7e4e651892a9e15abd984b94b1929c6dfb --- /dev/null +++ b/nohup.out @@ -0,0 +1,4 @@ + Processing Commands: 0%| | 0/10 [00:00 0 + # json_item['cmd'] = '\n'.join([working_env, json_item['total output'][0]]) + except: + import pdb + pdb.set_trace() + # import pdb + # pdb.set_trace() + command_list.append(json_item) + multi(command_list, args.output_path, args.k) + +if __name__ == '__main__': + arg_parser = ArgumentParser() + arg_parser.add_argument('--data_path', type=str, + default='data/grade-school-math-master/grade_school_math/data/test.jsonl') + arg_parser.add_argument('--input_path', type=str, default='') + arg_parser.add_argument('--cuda_num', type=int, default=8) + arg_parser.add_argument('--k', type=int, default=1) + arg_parser.add_argument('--output_path', type=str, default='total.json') + arg_parser.add_argument('--generate_method', type=str, + choices=['single', 'sft', 'comp', 'self_consistency', 'single_consistency']) + arg_parser.add_argument('--method', type=str, choices=['main', 'test', 'get_data']) + args = arg_parser.parse_args() + main(args) + + + diff --git a/pass_rate.py b/pass_rate.py new file mode 100644 index 0000000000000000000000000000000000000000..a9d6497e355a33f358ac627421255316e3476a7f --- /dev/null +++ b/pass_rate.py @@ -0,0 +1,194 @@ +import os +import subprocess +from argparse import ArgumentParser +import json +from concurrent.futures import ThreadPoolExecutor +from tqdm import tqdm +import tempfile + +def wrapped_function(item): + results = [] + passed = 0 + total = 0 + + temp_dir = tempfile.gettempdir() + temp_file = os.path.join(temp_dir, f"test.lean") + + with open(temp_file, "w") as f: + f.write(item['cmd']) + + # Rest of the function code... + # Process the item using the temporary file + # ... + + # Clean up the temporary file + data = '{"path": "%s", "allTactics": true}' %(temp_file) + command = 'echo \'%s\' | lake exe repl' % data + + try: + result = subprocess.run(command, shell=True, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout = result.stdout.decode('utf-8') + stderr = result.stderr.decode('utf-8') + # stdout = result.stdout.decode('utf-8') + json_stdout = json.loads(stdout) + if "messages" not in json_stdout.keys(): + passed += 1 + # results.append({'item': item['content'], 'stdout': stdout, 'stderr': stderr, 'status': 'pass'}) + results.append({ 'stdout': stdout, 'stderr': stderr, 'status': 'pass'}) + except subprocess.CalledProcessError as e: + # results.append({'item': item['content'], 'error': str(e), 'status': 'nopass'}) + results.append({ 'error': str(e), 'status': 'nopass'}) + total += 1 + + pass_rate = passed / (passed + total) * 100 + + + return {'results': results, 'pass_rate': pass_rate} + +# Set the directory where your .lean files are located + +# Get a list of all .lean files in the directory +# lean_files = [f for f in os.listdir(directory) if f.endswith(".lean")] +# lean_files = ["test/file.lean"] +def single(command_list): + results = [] + passed = 0 + total = 0 + for item in tqdm(command_list): + with open("test/test.lean", "w", encoding = 'utf-8') as f: + f.write(item['cmd']) + data = '{"path": "test/test.lean", "allTactics": true}' + # data = '{"cmd": "%s", "allTactics": true}' % item['cmd'] + command = 'echo \'%s\' | lake exe repl' % data + try: + # process = subprocess.Popen(['lake', 'exe', 'repl'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, + # stderr=subprocess.PIPE) + # stdout, stderr = process.communicate(input=data.encode(encoding='utf-8')) + # stdout = stdout.decode('utf-8') + result = subprocess.run(command, shell=True, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout = result.stdout.decode('utf-8') + json_stdout = json.loads(stdout) + if "messages" not in json_stdout.keys(): + passed += 1 + stderr = result.stderr.decode('utf-8') + results.append({ + # 'item': item['content'], + 'stdout': stdout, + 'stderr': stderr, + 'status': 'pass' + }) + except subprocess.CalledProcessError as e: + results.append({ + # 'item': item['content'], + 'error': str(e), + 'status': 'nopass' + }) + total += 1 + + # Calculate pass rate + pass_rate = passed / total * 100 + print(pass_rate) + + # Save results to a JSON file + with open('results.json', 'w') as f: + json.dump({'results': results, 'pass_rate': pass_rate}, f, indent=2, ensure_ascii=False) + + + + +def multi(command_list): + results = [] + passed = 0 + total = 0 + def execute_command(item): + temp_dir = '/data/tmp' + temp_file = os.path.join(temp_dir, f"test_{item['index']}.lean") # Ensure unique filenames + with open(temp_file, "w") as f: + f.write(item['cmd']) + + data = '{"path": "%s", "allTactics": true}' % temp_file + command = f'echo \'{data}\' | lake exe repl' + + try: + result = subprocess.run(command, shell=True, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout = result.stdout.decode('utf-8') + stderr = result.stderr.decode('utf-8') + + if "messages" not in json.loads(stdout): + return {'stdout': stdout, 'stderr': stderr, 'status': 'pass'} + else: + return {'stdout': stdout, 'stderr': stderr, 'status': 'nopass'} + + except subprocess.CalledProcessError as e: + return {'error': str(e), 'status': 'nopass'} + + os.remove(temp_file) + + total = len(command_list) + + with ThreadPoolExecutor(max_workers=32) as executor: + futures = [executor.submit(execute_command, {'index': i, 'cmd': cmd['cmd']}) for i, cmd in enumerate(command_list)] + for future in tqdm(futures, total=total, desc="Processing Commands"): + result = future.result() + results.append(result) + if result['status'] == 'pass': + passed += 1 + + pass_rate = (passed / total) * 100 + print(f"Pass rate: {pass_rate}%") + + with open('results.json', 'w') as f: + json.dump({'results': results, 'pass_rate': pass_rate}, f, indent=2, ensure_ascii=False) + +import re +def remove_simp_pattern_from_end(s): + pattern = r'@\[simp\s*.*?\]$' + return re.sub(pattern, '', s) + +def main(args): + command_list = [] + for i in range(4): + with open(f"{args.input_path}/{i}.json", 'r', encoding='utf-8') as rf: + for line in rf.readlines(): + try: + json_item = json.loads(line) + # json_item['content']['statement_poof'] + # json_item['cmd'] = '\n'.join([json_item['content']['working_file'] , json_item['total output'][0]]) + working_env = json_item['content']['working_file'].split('\n') + for loc in range(len(working_env) - 3, 0, -1): + if not len(working_env[loc].strip()): + break + + working_env = '\n'.join(working_env[:loc] + ['\n']) + # statement = json_item['content']['statement_poof'].split('\n') + statement = json_item['total output'][0].split('\n') + for loc in range(len(statement)): + if not len(statement[loc].strip()): + break + statement = '\n'.join(statement[:loc] + ['\n']) + json_item['cmd'] = '\n'.join([working_env, statement]) + assert len(statement) > 0 + # json_item['cmd'] = '\n'.join([working_env, json_item['total output'][0]]) + except: + import pdb + pdb.set_trace() + command_list.append(json_item) + command_list = command_list + results = [] + passed = 0 + total = 0 + single(command_list[:1]) + +if __name__ == '__main__': + arg_parser = ArgumentParser() + arg_parser.add_argument('--data_path', type=str, + default='data/grade-school-math-master/grade_school_math/data/test.jsonl') + arg_parser.add_argument('--input_path', type=str, default='') + arg_parser.add_argument('--cuda_num', type=int, default=8) + arg_parser.add_argument('--output_path', type=str, default='total.json') + arg_parser.add_argument('--generate_method', type=str, + choices=['single', 'sft', 'comp', 'self_consistency', 'single_consistency']) + arg_parser.add_argument('--method', type=str, choices=['main', 'test', 'get_data']) + args = arg_parser.parse_args() + main(args) + diff --git a/pass_rate_atp_pass.py b/pass_rate_atp_pass.py new file mode 100644 index 0000000000000000000000000000000000000000..814f3ecd626dd69accad219488f67ce5bb9a6882 --- /dev/null +++ b/pass_rate_atp_pass.py @@ -0,0 +1,112 @@ +import pdb +import subprocess +import re + +# Output file +output_file = "pass_rate_output.txt" + +# Clearing the output file before appending new content +with open(output_file, "w") as file: + file.write("") + +# List of input paths +input_path_lists = [ + "test/zero_shot/wild_test/generation/lean4_random_15k_all/2/1/", +] + +def get_output(input_string, k): + pattern = r"zero_shot/(\w+)/(.+?)/(\w+)" + match = re.search(pattern, input_string) + if match: + part1 = match.group(1) + part2 = match.group(3) + f"pass{k}.jsonl" + result = "/".join([part1, part2]) + print(result) + else: + print("No match found.") + assert True + return result + +# List of input paths +input_path_lists = [ + # "../auto-info/generate_result/zero_shot/gsm8k_train/generation/lean4_random_15k_all/2/10/", + # "../auto-info/generate_result/zero_shot/math_train/generation/lean4_random_15k_all/2/10/", + # "../auto-info/generate_result/zero_shot/wild_test/generation/lean4_rft/1/1", + # "../auto-info/generate_result/zero_shot/wild_test/generation/lean4_rft/2/1", + # "../auto-info/generate_result/zero_shot/wild_test/generation/lean4_rft/3/1", + # "../auto-info/generate_result/zero_shot/wild_test/generation/lean4_verifier/1/1", + # "../auto-info/generate_result/zero_shot/wild_test/generation/lean4_verifier/2/1", + # "../auto-info/generate_result/zero_shot/wild_test/generation/lean4_verifier/3/1", + # "../auto-info/generate_result/zero_shot/wild_test/generation/lean4_verifier_rft/1/1", + # "../auto-info/generate_result/zero_shot/wild_test/generation/lean4_verifier_rft/2/1", + # "../auto-info/generate_result/zero_shot/wild_test/generation/lean4_verifier_rft/3/1", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_basic_test/generation/lean4_rft/1/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_basic_test/generation/lean4_rft/2/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_basic_test/generation/lean4_rft/3/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_random_test/generation/lean4_rft/1/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_random_test/generation/lean4_rft/2/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_random_test/generation/lean4_rft/3/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_basic_test/generation/lean4_verifier/1/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_basic_test/generation/lean4_verifier/2/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_basic_test/generation/lean4_verifier/3/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_random_test/generation/lean4_verifier/1/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_random_test/generation/lean4_verifier/2/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_random_test/generation/lean4_verifier/3/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_basic_test/generation/lean4_verifier_rft/1/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_basic_test/generation/lean4_verifier_rft/2/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_basic_test/generation/lean4_verifier_rft/3/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_random_test/generation/lean4_verifier_rft/1/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_random_test/generation/lean4_verifier_rft/2/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_random_test/generation/lean4_verifier_rft/3/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/wild_test/generation/lean4_rft/1/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/wild_test/generation/lean4_rft/2/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/wild_test/generation/lean4_rft/3/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/wild_test/generation/lean4_verifier/1/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/wild_test/generation/lean4_verifier/2/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/wild_test/generation/lean4_verifier/3/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/wild_test/generation/lean4_verifier_rft/1/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/wild_test/generation/lean4_verifier_rft/2/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/wild_test/generation/lean4_verifier_rft/3/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_15k_train/generation/lean4_random_15k_all/2/20/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_basic_test/generation/lean4_random_15k_all/2/5/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_random_test/generation/lean4_random_15k_all/2/5/", + # "/opt/tiger/mariana/auto-info/generate_result/zero_shot/lean4_random_test/generation/lean4_random_5k/2/1/", + # "test/zero_shot/lean4_random_test/generation/lean4_random_15k_all/3/1/", + # "/opt/tiger/mariana/auto-info/generate_result/zero_shot/lean4_basic_test/generation/lean4_random_15k_all/2/1/", + # "/opt/tiger/mariana/auto-info/generate_result/zero_shot/lean4_random_test/generation/lean4_random_15k_all/2/1/", + # "test/zero_shot/lean4_random_test/generation/lean4_random_15k_all/3/1/", + # "test/zero_shot/lean4_basic_test/generation/lean4_random_15k_all/3/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_basic_test/generation/lean4_random_15k_all_mathrft/1/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_random_test/generation/lean4_random_15k_all_mathrft/1/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/wild_test/generation/lean4_random_15k_all_mathrft/1/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_basic_test/generation/lean4_random_15k_all_mathrft/2/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_random_test/generation/lean4_random_15k_all_mathrft/2/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/wild_test/generation/lean4_random_15k_all_mathrft/2/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_basic_test/generation/lean4_random_15k_all_mathrft/3/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_random_test/generation/lean4_random_15k_all_mathrft/3/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/wild_test/generation/lean4_random_15k_all_mathrft/3/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/gsm8k_train/generation/lean4_random_15k_all_mathrft/2/10/", + # "/opt/tiger/auto-info/generate_result/zero_shot/math_train/generation/lean4_random_15k_all_mathrft/2/10/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_15k_train/generation/lean4_random_15k_all_mathrft/2/10/", + # Add more input paths as needed + "/opt/tiger/auto-info/generate_result/zero_shot/lean4_basic_test/generation/lean4_random_15k_all_mathrft/2/5/", + "/opt/tiger/auto-info/generate_result/zero_shot/lean4_random_test/generation/lean4_random_15k_all_mathrft/2/5/", + "/opt/tiger/auto-info/generate_result/zero_shot/wild_test/generation/lean4_random_15k_all_mathrft/2/5/", +] + +# Iterate through the input paths and run the command +for input_path in input_path_lists: + k = 5 + if "wild_test" in input_path or "gsm8k_train" in input_path or "math_train" in input_path: + print(f"wild") + print(f"Running for input path: {input_path}", file=open(output_file, "a")) + command = f"python3 pass_rate_notlean_test.py --input_path {input_path} --output_path {get_output(input_path,k)} --k {k}" + subprocess.run(command, shell=True, stdout=open(output_file, "a"), stderr=subprocess.STDOUT) + print("\n\n",file=open(output_file, "a")) + + else: + print(f"lean") + print(f"Running for input path: {input_path}", file=open(output_file, "a")) + command = f"python3 pass_rate_new_test.py --input_path {input_path} --output_path {get_output(input_path, k)} --k {k}" + subprocess.run(command, shell=True, stdout=open(output_file, "a"), stderr=subprocess.STDOUT) + print("\n\n",file=open(output_file, "a")) diff --git a/pass_rate_atp_test.py b/pass_rate_atp_test.py new file mode 100644 index 0000000000000000000000000000000000000000..afc7248cb30e2ca728a9bb760685d9823286136e --- /dev/null +++ b/pass_rate_atp_test.py @@ -0,0 +1,264 @@ +import os +import subprocess +from argparse import ArgumentParser +import json +from concurrent.futures import ThreadPoolExecutor +from tqdm import tqdm +import glob +import tempfile +import random + +def wrapped_function(item): + results = [] + passed = 0 + total = 0 + + temp_dir = tempfile.gettempdir() + temp_file = os.path.join(temp_dir, f"test.lean") + + with open(temp_file, "w") as f: + f.write(item['cmd']) + + # Rest of the function code... + # Process the item using the temporary file + # ... + + # Clean up the temporary file + data = '{"path": "%s", "allTactics": true}' %(temp_file) + command = 'echo \'%s\' | lake exe repl' % data + + try: + result = subprocess.run(command, shell=True, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout = result.stdout.decode('utf-8') + stderr = result.stderr.decode('utf-8') + # stdout = result.stdout.decode('utf-8') + json_stdout = json.loads(stdout) + if "messages" not in json_stdout.keys(): + passed += 1 + # results.append({'item': item['content'], 'stdout': stdout, 'stderr': stderr, 'status': 'pass'}) + results.append({ 'stdout': stdout, 'stderr': stderr, 'status': 'pass'}) + except subprocess.CalledProcessError as e: + # results.append({'item': item['content'], 'error': str(e), 'status': 'nopass'}) + results.append({ 'error': str(e), 'status': 'nopass'}) + total += 1 + + pass_rate = passed / (passed + total) * 100 + + + return {'results': results, 'pass_rate': pass_rate} + +# Set the directory where your .lean files are located + +# Get a list of all .lean files in the directory +# lean_files = [f for f in os.listdir(directory) if f.endswith(".lean")] +# lean_files = ["test/file.lean"] +def single(command_list, args): + results = [] + passed = 0 + total = 0 + for item in tqdm(command_list): + with open("test/test.lean", "w", encoding = 'utf-8') as f: + f.write(item['cmd']) + data = '{"path": "test/test.lean", "allTactics": true}' + # data = '{"cmd": "%s", "allTactics": true}' % item['cmd'] + command = 'echo \'%s\' | lake exe repl' % data + try: + # process = subprocess.Popen(['lake', 'exe', 'repl'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, + # stderr=subprocess.PIPE) + # stdout, stderr = process.communicate(input=data.encode(encoding='utf-8')) + # stdout = stdout.decode('utf-8') + result = subprocess.run(command, shell=True, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout = result.stdout.decode('utf-8') + json_stdout = json.loads(stdout) + if "messages" not in json_stdout.keys(): + passed += 1 + stderr = result.stderr.decode('utf-8') + results.append({ + # 'item': item['content'], + 'stdout': stdout, + 'stderr': stderr, + 'status': 'pass' + }) + except subprocess.CalledProcessError as e: + results.append({ + # 'item': item['content'], + 'error': str(e), + 'status': 'nopass' + }) + total += 1 + + # Calculate pass rate + pass_rate = passed / total * 100 + print(pass_rate) + + # Save results to a JSON file + with open('results.json', 'w') as f: + json.dump({'results': results, 'pass_rate': pass_rate}, f, indent=2, ensure_ascii=False) + + +def multi(command_list, output_path, k ): + results = [] + passed = 0 + total = 0 + def execute_command(item, index): + temp_dir = '/opt/jianqiao' + def filter_json(json_data): + filtered_data = {} + for key in json_data.keys(): + if key in ['question', 'answer', 'total output', 'results']: + filtered_data[key] = json_data[key] + return filtered_data + result_dict = filter_json(item) + result_dict['results'] = [] + + for i, cmd in enumerate(item['cmd']): + temp_file = os.path.join(temp_dir,f"{index}_test_{i}.lean") # Ensure unique filenames + with open(temp_file, "w") as f: + f.write(cmd) + + data = '{"path": "%s", "allTactics": true}' % temp_file + command = f'echo \'{data}\' | lake exe repl' + + try: + result = subprocess.run(command, shell=True, check=True,timeout=600, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout = json.loads(result.stdout.decode('utf-8')) + stderr = result.stderr.decode('utf-8') + + except subprocess.TimeoutExpired as e: + result_item = {'error': str(e), 'status': 'nopass_limit'} + + except subprocess.CalledProcessError as e: + result_item = {'error': str(e), 'status': 'nopass_error'} + + else: + if "messages" not in stdout and not len(stderr): + result_item = {'stdout': stdout, 'stderr': stderr, 'status': 'pass' } + elif not len(stderr) and "messages" in stdout: + flag = 0 + for me in stdout['messages']: + if me['severity'] == 'error': + flag = 1 + # start_line = me['pos']['line'] - 1 + # current_column =me['pos']['column'] -1 + # for line_n in range(start_line - 1, 0 , -1): + # line_len = len(cmd.split('\n')[line_n]) + # current_column += line_len + 1 + # if not line_len: + # break + current_column = -1 + result_item = {'stdout': stdout, 'stderr': stderr, 'status': 'nopass', 'string_pos':current_column} + break + if not flag : + result_item = {'stdout': stdout, 'stderr': stderr, 'status': 'pass'} + else: + assert len(stderr) + result_item = {'stdout': stdout, 'stderr': stderr, 'status': 'nopass', 'string_pos': 0 } + + result_dict['results'].append(result_item) + return result_dict + + + total = len(command_list) + + with ThreadPoolExecutor(max_workers=128) as executor: + futures = [executor.submit(execute_command, cmd, i) for i, cmd in enumerate(command_list)] + for future in tqdm(futures, total=total, desc="Processing Commands"): + result = future.result() + results.append(result) + # if result['status'] == 'pass': + # passed += 1 + + def calculate_pass(result_list, k): + pass_1_count = 0 + pass_k_count = 0 + + for result in result_list: + results = result.get('results', []) + if results: + for j in range(min(1, len(results))): + if results[j].get('status') == 'pass': + pass_1_count += 1 + break + + for j in range(min(k, len(results))): + if results[j].get('status') == 'pass': + pass_k_count += 1 + break + + pass_1 = pass_1_count / len(result_list) if result_list else 0 + pass_k = pass_k_count / len(result_list) if result_list else 0 + + return pass_1, pass_k + + pass_1, pass_k = calculate_pass(results, k) + print("Pass@1:", pass_1) + print(f"Pass@{k}:", pass_k) + + # pass_rate = (passed / total) * 100 + # print(f"total test: {total}") + # print(f"Pass rate: {pass_rate}%") + + output_file = f"pass_rate_results/{output_path}" + # Create the directory if it doesn't exist + os.makedirs(os.path.dirname(output_file), exist_ok=True) + + with open(f"{output_file}", 'w') as f: + json.dump({'results': results, 'pass_1': pass_1, f"pass_{k}":pass_k}, f, indent=2, ensure_ascii=False) + +import re +def remove_simp_pattern_from_end(s): + pattern = r'@\[simp\s*.*?\]$' + return re.sub(pattern, '', s) + +def main(args): + command_list = [] + file_pattern = os.path.join(args.input_path, '[0-1]*.json') + # head_list = ["import MiniF2F.Minif2fImport", "import MiniF2F.Valid", "import MiniF2F.Test"] + head_list = '' + with open("MiniF2F/Minif2fImport.lean", 'r', encoding='utf8') as rf: + for line in rf.readlines(): + head_list += line + for file_path in glob.glob(file_pattern): + with open(file_path, 'r', encoding='utf-8') as rf: + for line in rf.readlines(): + try: + json_item = json.loads(line) + working_env = json_item['content']['header'] + # pdb.set_trace() + # statement = json_item['total output'][0] + json_item['cmd'] = [] + for output in json_item['total output'][:min(args.k, len(json_item['total output']))]: + proof = output.split("#align")[0] + atp = json_item['content']['formal_statement'].split(":=")[0] + ":=" + proof + + json_item['cmd'].append('\n\n'.join( [head_list, working_env, atp])) + # print(json_item['cmd'][0]) + # import pdb + # pdb.set_trace() + + # json_item['answer'] = json_item['content']['statement_poof'] + # json_item['cmd'] = '\n'.join([working_env, json_item['total output'][0]]) + except: + import pdb + pdb.set_trace() + # import pdb + # pdb.set_trace() + command_list.append(json_item) + multi(command_list, args.output_path, args.k) + +if __name__ == '__main__': + arg_parser = ArgumentParser() + arg_parser.add_argument('--data_path', type=str, + default='/opt/tiger/CLIP/theorem_proving/generate_result/zero_shot/minif2f_test/generation/lean5_random_15k_all_mathrft/2/5/') + arg_parser.add_argument('--input_path', type=str, default='/opt/tiger/CLIP/theorem_proving/generate_result/zero_shot/minif2f_test/generation/lean5_random_15k_all_mathrft/2/5/') + arg_parser.add_argument('--cuda_num', type=int, default=8) + arg_parser.add_argument('--k', type=int, default=5) + arg_parser.add_argument('--output_path', type=str, default='total.json') + arg_parser.add_argument('--generate_method', type=str, + choices=['single', 'sft', 'comp', 'self_consistency', 'single_consistency']) + arg_parser.add_argument('--method', type=str, choices=['main', 'test', 'get_data']) + args = arg_parser.parse_args() + main(args) + + + diff --git a/pass_rate_found_item.py b/pass_rate_found_item.py new file mode 100644 index 0000000000000000000000000000000000000000..b1227ad8159ca90a5b5b5b847aa097c76cc4815a --- /dev/null +++ b/pass_rate_found_item.py @@ -0,0 +1,175 @@ +import os +import subprocess +from argparse import ArgumentParser +import json +from concurrent.futures import ThreadPoolExecutor +from tqdm import tqdm +import tempfile + +def wrapped_function(item): + results = [] + passed = 0 + total = 0 + + temp_dir = tempfile.gettempdir() + temp_file = os.path.join(temp_dir, f"test.lean") + + with open(temp_file, "w") as f: + f.write(item['cmd']) + + # Rest of the function code... + # Process the item using the temporary file + # ... + + # Clean up the temporary file + data = '{"path": "%s", "allTactics": true}' %(temp_file) + command = 'echo \'%s\' | lake exe repl' % data + + try: + result = subprocess.run(command, shell=True, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout = result.stdout.decode('utf-8') + stderr = result.stderr.decode('utf-8') + # stdout = result.stdout.decode('utf-8') + json_stdout = json.loads(stdout) + if "messages" not in json_stdout.keys(): + passed += 1 + # results.append({'item': item['content'], 'stdout': stdout, 'stderr': stderr, 'status': 'pass'}) + results.append({ 'stdout': stdout, 'stderr': stderr, 'status': 'pass'}) + except subprocess.CalledProcessError as e: + # results.append({'item': item['content'], 'error': str(e), 'status': 'nopass'}) + results.append({ 'error': str(e), 'status': 'nopass'}) + total += 1 + + pass_rate = passed / (passed + total) * 100 + + + return {'results': results, 'pass_rate': pass_rate} + +# Set the directory where your .lean files are located + +# Get a list of all .lean files in the directory +# lean_files = [f for f in os.listdir(directory) if f.endswith(".lean")] +# lean_files = ["test/file.lean"] +def single(command_list): + results = [] + passed = 0 + total = 0 + for item in tqdm(command_list): + with open("test/test.lean", "w", encoding = 'utf-8') as f: + f.write(item['cmd']) + data = '{"path": "test/test.lean", "allTactics": true}' + # data = '{"cmd": "%s", "allTactics": true}' % item['cmd'] + command = 'echo \'%s\' | lake exe repl' % data + try: + # process = subprocess.Popen(['lake', 'exe', 'repl'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, + # stderr=subprocess.PIPE) + # stdout, stderr = process.communicate(input=data.encode(encoding='utf-8')) + # stdout = stdout.decode('utf-8') + result = subprocess.run(command, shell=True, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout = result.stdout.decode('utf-8') + json_stdout = json.loads(stdout) + if "messages" not in json_stdout.keys(): + passed += 1 + stderr = result.stderr.decode('utf-8') + results.append({ + # 'item': item['content'], + 'stdout': stdout, + 'stderr': stderr, + 'status': 'pass' + }) + except subprocess.CalledProcessError as e: + results.append({ + # 'item': item['content'], + 'error': str(e), + 'status': 'nopass' + }) + total += 1 + + # Calculate pass rate + pass_rate = passed / total * 100 + print(pass_rate) + + # Save results to a JSON file + with open('results.json', 'w') as f: + json.dump({'results': results, 'pass_rate': pass_rate}, f, indent=2, ensure_ascii=False) + + + + +def multi(command_list): + results = [] + passed = 0 + total = 0 + def execute_command(item): + temp_dir = '/data/tmp' + temp_file = os.path.join(temp_dir, f"test_{item['index']}.lean") # Ensure unique filenames + with open(temp_file, "w") as f: + f.write(item['cmd']) + + data = '{"path": "%s", "allTactics": true}' % temp_file + command = f'echo \'{data}\' | lake exe repl' + + try: + result = subprocess.run(command, shell=True, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout = result.stdout.decode('utf-8') + stderr = result.stderr.decode('utf-8') + + if "messages" not in json.loads(stdout): + return {'stdout': stdout, 'stderr': stderr, 'status': 'pass'} + else: + return {'stdout': stdout, 'stderr': stderr, 'status': 'nopass'} + + except subprocess.CalledProcessError as e: + return {'error': str(e), 'status': 'nopass'} + + os.remove(temp_file) + + total = len(command_list) + + with ThreadPoolExecutor(max_workers=32) as executor: + futures = [executor.submit(execute_command, {'index': i, 'cmd': cmd['cmd']}) for i, cmd in enumerate(command_list)] + for future in tqdm(futures, total=total, desc="Processing Commands"): + result = future.result() + results.append(result) + if result['status'] == 'pass': + passed += 1 + + pass_rate = (passed / total) * 100 + print(f"Pass rate: {pass_rate}%") + + with open('results.json', 'w') as f: + json.dump({'results': results, 'pass_rate': pass_rate}, f, indent=2, ensure_ascii=False) + +import re +def remove_simp_pattern_from_end(s): + pattern = r'@\[simp\s*.*?\]$' + return re.sub(pattern, '', s) + +def main(): + input_file= f"/data/haiming/multilevel_isabelle-main/lean4/repl/self_autoformalization/data/mma_filepath/all_basic.jsonl" + + command_list = json.load(open(input_file, 'r', encoding = 'utf-8')) + new_list = [] + for json_item in command_list: + try: + working_env = json_item['working_file'] + statement = json_item['statement_poof'] + json_item['cmd'] = '\n'.join([working_env, statement]) + assert len(statement) > 0 + if len(working_env) < 10000: + new_list.append(json_item) + + except: + import pdb + pdb.set_trace() + + output_file = "/data/haiming/multilevel_isabelle-main/data/lean4_basic/1k_test.jsonl" + with open(output_file, 'w', encoding='utf-8') as file: + json.dump(new_list, file, indent=4, ensure_ascii=False) + + + # multi(new_list) + +if __name__ == '__main__': + main() + diff --git a/pass_rate_multi.py b/pass_rate_multi.py new file mode 100644 index 0000000000000000000000000000000000000000..f8576018ff69e1111963179ccb161976f970c03b --- /dev/null +++ b/pass_rate_multi.py @@ -0,0 +1,48 @@ +import pdb +import subprocess +import re + +# Output file +output_file = "pass_rate_output.txt" + +# Clearing the output file before appending new content +with open(output_file, "w") as file: + file.write("") + +# List of input paths +input_path_lists = [ + "test/zero_shot/wild_test/generation/lean4_random_15k_all/2/1/", +] + +def get_output(input_string): + pattern = r"zero_shot/(\w+)/(.+?)/(\w+)" + match = re.search(pattern, input_string) + if match: + part1 = match.group(1) + part2 = match.group(3) + ".jsonl" + result = "/".join([part1, part2]) + print(result) + else: + print("No match found.") + assert True + return result + +# List of input paths +input_path_lists = [ + "/opt/tiger/auto-info/generate_result/zero_shot/lean4_basic_test/generation/lean4_random_5k/2/1/", + # "/opt/tiger/mariana/auto-info/generate_result/zero_shot/lean4_random_test/generation/lean4_random_5k/2/1/", + # "test/zero_shot/lean4_random_test/generation/lean4_random_15k_all/3/1/", + # "/opt/tiger/mariana/auto-info/generate_result/zero_shot/lean4_basic_test/generation/lean4_random_15k_all/2/1/", + # "/opt/tiger/mariana/auto-info/generate_result/zero_shot/lean4_random_test/generation/lean4_random_15k_all/2/1/", + # "test/zero_shot/lean4_random_test/generation/lean4_random_15k_all/3/1/", + # "test/zero_shot/lean4_basic_test/generation/lean4_random_15k_all/3/1/", + # Add more input paths as needed +] + +# Iterate through the input paths and run the command +for input_path in input_path_lists: + print(f"Running for input path: {input_path}", file=open(output_file, "a")) + command = f"python3 pass_rate_new.py --input_path {input_path} --output_path {get_output(input_path)}" + subprocess.run(command, shell=True, stdout=open(output_file, "a"), stderr=subprocess.STDOUT) + print("\n\n",file=open(output_file, "a")) + diff --git a/pass_rate_multi_notlean.py b/pass_rate_multi_notlean.py new file mode 100644 index 0000000000000000000000000000000000000000..f5f9aa6832aa7f2075e986e3d3f753f3e7cf9a99 --- /dev/null +++ b/pass_rate_multi_notlean.py @@ -0,0 +1,40 @@ +import subprocess +import re + +# Output file +output_file = "pass_rate_output_lean.txt" + +# Clearing the output file before appending new content +with open(output_file, "w") as file: + file.write("") + +# List of input paths +input_path_lists = [ + "/opt/tiger/mariana/auto-info/generate_result/zero_shot/math_train/generation/lean4_random_5k/2/1/", + "/opt/tiger/mariana/auto-info/generate_result/zero_shot/math_train/generation/lean4_random_15k_all/2/1/", + "/opt/tiger/mariana/auto-info/generate_result/zero_shot/gsm8k_train/generation/lean4_random_5k/2/1/", + "/opt/tiger/mariana/auto-info/generate_result/zero_shot/gsm8k_train/generation/lean4_random_15k_all/2/1/", + # "test/zero_shot/wild_test/generation/lean4_random_15k_all/2/1/", + # "test/zero_shot/math_train/generation/lean4_random_15k_all/2/1/", + # "test/zero_shot/gsm8k_train/generation/lean4_random_15k_all/2/1/", +] + +def get_output(input_string): + pattern = r"zero_shot/(\w+)/(.+?)/(\w+)" + match = re.search(pattern, input_string) + if match: + part1 = match.group(1) + part2 = match.group(3) + ".jsonl" + result = "/".join([part1, part2]) + print(result) + else: + print("No match found.") + assert True + return result + +# Iterate through the input paths and run the command +for input_path in input_path_lists: + print(f"Running for input path: {input_path}", file=open(output_file, "a")) + command = f"python3 pass_rate_notlean.py --input_path {input_path} --output_path {get_output(input_path)}" + subprocess.run(command, shell=True, stdout=open(output_file, "a"), stderr=subprocess.STDOUT) + print("\n\n",file=open(output_file, "a")) diff --git a/pass_rate_multi_notlean_pass.py b/pass_rate_multi_notlean_pass.py new file mode 100644 index 0000000000000000000000000000000000000000..2877340a373ebfd495e597d0f6d627a3eb03a0f9 --- /dev/null +++ b/pass_rate_multi_notlean_pass.py @@ -0,0 +1,43 @@ +import subprocess +import re + +# Output file +output_file = "pass_rate_output.txt" + +# Clearing the output file before appending new content +with open(output_file, "w") as file: + file.write("") + +# List of input paths +input_path_lists = [ + "/opt/tiger/auto-info/generate_result/zero_shot/math_train/generation/mistral-qa-gsm8kmath-autoform-forml4-rft-math/1/10", + "/opt/tiger/auto-info/generate_result/zero_shot/math_train/generation/mistral-qa-gsm8kmath-autoform-forml4-rft-math/2/10", + "/opt/tiger/auto-info/generate_result/zero_shot/math_train/generation/mistral-qa-gsm8kmath-autoform-forml4-rft-math/3/10", + # "test/zero_shot/wild_test/generation/lean4_random_15k_all/2/1/", + # "test/zero_shot/math_train/generation/lean4_random_15k_all/2/1/", + # "test/zero_shot/gsm8k_train/generation/lean4_random_15k_all/2/1/", +] + +def get_output(input_string, k): + pattern = r"zero_shot/(\w+)/(.+?)/(\w+)/(\w+)" + match = re.search(pattern, input_string) + if match: + part1 = match.group(1) + part_model = match.group(2) + part2 = match.group(3) + part3 = match.group(4) + f"pass{k}.jsonl" + result = "/".join([part1, part_model, part2, part3]) + print(result) + else: + print("No match found.") + assert True + return result + + +# Iterate through the input paths and run the command +for input_path in input_path_lists: + k = 10 + print(f"Running for input path: {input_path}", file=open(output_file, "a")) + command = f"python3 pass_rate_notlean_test.py --input_path {input_path} --output_path {get_output(input_path, k)} --k {k}" + subprocess.run(command, shell=True, stdout=open(output_file, "a"), stderr=subprocess.STDOUT) + print("\n\n",file=open(output_file, "a")) diff --git a/pass_rate_multi_pass.py b/pass_rate_multi_pass.py new file mode 100644 index 0000000000000000000000000000000000000000..814f3ecd626dd69accad219488f67ce5bb9a6882 --- /dev/null +++ b/pass_rate_multi_pass.py @@ -0,0 +1,112 @@ +import pdb +import subprocess +import re + +# Output file +output_file = "pass_rate_output.txt" + +# Clearing the output file before appending new content +with open(output_file, "w") as file: + file.write("") + +# List of input paths +input_path_lists = [ + "test/zero_shot/wild_test/generation/lean4_random_15k_all/2/1/", +] + +def get_output(input_string, k): + pattern = r"zero_shot/(\w+)/(.+?)/(\w+)" + match = re.search(pattern, input_string) + if match: + part1 = match.group(1) + part2 = match.group(3) + f"pass{k}.jsonl" + result = "/".join([part1, part2]) + print(result) + else: + print("No match found.") + assert True + return result + +# List of input paths +input_path_lists = [ + # "../auto-info/generate_result/zero_shot/gsm8k_train/generation/lean4_random_15k_all/2/10/", + # "../auto-info/generate_result/zero_shot/math_train/generation/lean4_random_15k_all/2/10/", + # "../auto-info/generate_result/zero_shot/wild_test/generation/lean4_rft/1/1", + # "../auto-info/generate_result/zero_shot/wild_test/generation/lean4_rft/2/1", + # "../auto-info/generate_result/zero_shot/wild_test/generation/lean4_rft/3/1", + # "../auto-info/generate_result/zero_shot/wild_test/generation/lean4_verifier/1/1", + # "../auto-info/generate_result/zero_shot/wild_test/generation/lean4_verifier/2/1", + # "../auto-info/generate_result/zero_shot/wild_test/generation/lean4_verifier/3/1", + # "../auto-info/generate_result/zero_shot/wild_test/generation/lean4_verifier_rft/1/1", + # "../auto-info/generate_result/zero_shot/wild_test/generation/lean4_verifier_rft/2/1", + # "../auto-info/generate_result/zero_shot/wild_test/generation/lean4_verifier_rft/3/1", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_basic_test/generation/lean4_rft/1/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_basic_test/generation/lean4_rft/2/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_basic_test/generation/lean4_rft/3/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_random_test/generation/lean4_rft/1/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_random_test/generation/lean4_rft/2/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_random_test/generation/lean4_rft/3/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_basic_test/generation/lean4_verifier/1/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_basic_test/generation/lean4_verifier/2/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_basic_test/generation/lean4_verifier/3/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_random_test/generation/lean4_verifier/1/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_random_test/generation/lean4_verifier/2/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_random_test/generation/lean4_verifier/3/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_basic_test/generation/lean4_verifier_rft/1/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_basic_test/generation/lean4_verifier_rft/2/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_basic_test/generation/lean4_verifier_rft/3/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_random_test/generation/lean4_verifier_rft/1/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_random_test/generation/lean4_verifier_rft/2/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_random_test/generation/lean4_verifier_rft/3/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/wild_test/generation/lean4_rft/1/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/wild_test/generation/lean4_rft/2/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/wild_test/generation/lean4_rft/3/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/wild_test/generation/lean4_verifier/1/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/wild_test/generation/lean4_verifier/2/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/wild_test/generation/lean4_verifier/3/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/wild_test/generation/lean4_verifier_rft/1/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/wild_test/generation/lean4_verifier_rft/2/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/wild_test/generation/lean4_verifier_rft/3/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_15k_train/generation/lean4_random_15k_all/2/20/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_basic_test/generation/lean4_random_15k_all/2/5/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_random_test/generation/lean4_random_15k_all/2/5/", + # "/opt/tiger/mariana/auto-info/generate_result/zero_shot/lean4_random_test/generation/lean4_random_5k/2/1/", + # "test/zero_shot/lean4_random_test/generation/lean4_random_15k_all/3/1/", + # "/opt/tiger/mariana/auto-info/generate_result/zero_shot/lean4_basic_test/generation/lean4_random_15k_all/2/1/", + # "/opt/tiger/mariana/auto-info/generate_result/zero_shot/lean4_random_test/generation/lean4_random_15k_all/2/1/", + # "test/zero_shot/lean4_random_test/generation/lean4_random_15k_all/3/1/", + # "test/zero_shot/lean4_basic_test/generation/lean4_random_15k_all/3/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_basic_test/generation/lean4_random_15k_all_mathrft/1/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_random_test/generation/lean4_random_15k_all_mathrft/1/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/wild_test/generation/lean4_random_15k_all_mathrft/1/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_basic_test/generation/lean4_random_15k_all_mathrft/2/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_random_test/generation/lean4_random_15k_all_mathrft/2/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/wild_test/generation/lean4_random_15k_all_mathrft/2/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_basic_test/generation/lean4_random_15k_all_mathrft/3/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_random_test/generation/lean4_random_15k_all_mathrft/3/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/wild_test/generation/lean4_random_15k_all_mathrft/3/1/", + # "/opt/tiger/auto-info/generate_result/zero_shot/gsm8k_train/generation/lean4_random_15k_all_mathrft/2/10/", + # "/opt/tiger/auto-info/generate_result/zero_shot/math_train/generation/lean4_random_15k_all_mathrft/2/10/", + # "/opt/tiger/auto-info/generate_result/zero_shot/lean4_15k_train/generation/lean4_random_15k_all_mathrft/2/10/", + # Add more input paths as needed + "/opt/tiger/auto-info/generate_result/zero_shot/lean4_basic_test/generation/lean4_random_15k_all_mathrft/2/5/", + "/opt/tiger/auto-info/generate_result/zero_shot/lean4_random_test/generation/lean4_random_15k_all_mathrft/2/5/", + "/opt/tiger/auto-info/generate_result/zero_shot/wild_test/generation/lean4_random_15k_all_mathrft/2/5/", +] + +# Iterate through the input paths and run the command +for input_path in input_path_lists: + k = 5 + if "wild_test" in input_path or "gsm8k_train" in input_path or "math_train" in input_path: + print(f"wild") + print(f"Running for input path: {input_path}", file=open(output_file, "a")) + command = f"python3 pass_rate_notlean_test.py --input_path {input_path} --output_path {get_output(input_path,k)} --k {k}" + subprocess.run(command, shell=True, stdout=open(output_file, "a"), stderr=subprocess.STDOUT) + print("\n\n",file=open(output_file, "a")) + + else: + print(f"lean") + print(f"Running for input path: {input_path}", file=open(output_file, "a")) + command = f"python3 pass_rate_new_test.py --input_path {input_path} --output_path {get_output(input_path, k)} --k {k}" + subprocess.run(command, shell=True, stdout=open(output_file, "a"), stderr=subprocess.STDOUT) + print("\n\n",file=open(output_file, "a")) diff --git a/pass_rate_new.py b/pass_rate_new.py new file mode 100644 index 0000000000000000000000000000000000000000..3c0d0bca1ce5125dc055b24324e3508cb828dd54 --- /dev/null +++ b/pass_rate_new.py @@ -0,0 +1,196 @@ +import os +import subprocess +from argparse import ArgumentParser +import json +from concurrent.futures import ThreadPoolExecutor +from tqdm import tqdm +import glob +import tempfile + +def wrapped_function(item): + results = [] + passed = 0 + total = 0 + + temp_dir = tempfile.gettempdir() + temp_file = os.path.join(temp_dir, f"test.lean") + + with open(temp_file, "w") as f: + f.write(item['cmd']) + + # Rest of the function code... + # Process the item using the temporary file + # ... + + # Clean up the temporary file + data = '{"path": "%s", "allTactics": true}' %(temp_file) + command = 'echo \'%s\' | lake exe repl' % data + + try: + result = subprocess.run(command, shell=True, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout = result.stdout.decode('utf-8') + stderr = result.stderr.decode('utf-8') + # stdout = result.stdout.decode('utf-8') + json_stdout = json.loads(stdout) + if "messages" not in json_stdout.keys(): + passed += 1 + # results.append({'item': item['content'], 'stdout': stdout, 'stderr': stderr, 'status': 'pass'}) + results.append({ 'stdout': stdout, 'stderr': stderr, 'status': 'pass'}) + except subprocess.CalledProcessError as e: + # results.append({'item': item['content'], 'error': str(e), 'status': 'nopass'}) + results.append({ 'error': str(e), 'status': 'nopass'}) + total += 1 + + pass_rate = passed / (passed + total) * 100 + + + return {'results': results, 'pass_rate': pass_rate} + +# Set the directory where your .lean files are located + +# Get a list of all .lean files in the directory +# lean_files = [f for f in os.listdir(directory) if f.endswith(".lean")] +# lean_files = ["test/file.lean"] +def single(command_list, args): + results = [] + passed = 0 + total = 0 + for item in tqdm(command_list): + with open("test/test.lean", "w", encoding = 'utf-8') as f: + f.write(item['cmd']) + data = '{"path": "test/test.lean", "allTactics": true}' + # data = '{"cmd": "%s", "allTactics": true}' % item['cmd'] + command = 'echo \'%s\' | lake exe repl' % data + try: + # process = subprocess.Popen(['lake', 'exe', 'repl'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, + # stderr=subprocess.PIPE) + # stdout, stderr = process.communicate(input=data.encode(encoding='utf-8')) + # stdout = stdout.decode('utf-8') + result = subprocess.run(command, shell=True, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout = result.stdout.decode('utf-8') + json_stdout = json.loads(stdout) + if "messages" not in json_stdout.keys(): + passed += 1 + stderr = result.stderr.decode('utf-8') + results.append({ + # 'item': item['content'], + 'stdout': stdout, + 'stderr': stderr, + 'status': 'pass' + }) + except subprocess.CalledProcessError as e: + results.append({ + # 'item': item['content'], + 'error': str(e), + 'status': 'nopass' + }) + total += 1 + + # Calculate pass rate + pass_rate = passed / total * 100 + print(pass_rate) + + # Save results to a JSON file + with open('results.json', 'w') as f: + json.dump({'results': results, 'pass_rate': pass_rate}, f, indent=2, ensure_ascii=False) + + +def multi(command_list, output_path): + results = [] + passed = 0 + total = 0 + def execute_command(item): + temp_dir = '/opt/jianqiao' + temp_file = os.path.join(temp_dir, f"test_{item['index']}.lean") # Ensure unique filenames + with open(temp_file, "w") as f: + f.write(item['cmd']) + + data = '{"path": "%s", "allTactics": true}' % temp_file + command = f'echo \'{data}\' | lake exe repl' + + try: + result = subprocess.run(command, shell=True, check=True,timeout=600, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout = result.stdout.decode('utf-8') + stderr = result.stderr.decode('utf-8') + + if "messages" not in json.loads(stdout) and not len(stderr): + return {'stdout': stdout, 'stderr': stderr, 'status': 'pass' , 'statement':item['statement'], 'content': item['content']} + else: + return {'stdout': stdout, 'stderr': stderr, 'status': 'nopass', 'statement':item['statement'] , 'content': item['content']} + + except subprocess.TimeoutExpired as e: + return {'error': str(e), 'status': 'nopass_limit', 'statement':item['statement'], 'content': item['content']} + + except subprocess.CalledProcessError as e: + return {'error': str(e), 'status': 'nopass_error', 'statement':item['statement'], 'content': item['content']} + + os.remove(temp_file) + + total = len(command_list) + + with ThreadPoolExecutor(max_workers=32) as executor: + futures = [executor.submit(execute_command, {'index': i, 'cmd': cmd['cmd'], 'statement':cmd['statement'], 'content':cmd['content']}) for i, cmd in enumerate(command_list)] + for future in tqdm(futures, total=total, desc="Processing Commands"): + result = future.result() + results.append(result) + if result['status'] == 'pass': + passed += 1 + + pass_rate = (passed / total) * 100 + print(f"total test: {total}") + print(f"Pass rate: {pass_rate}%") + + output_file = f"pass_rate_results/{output_path}" + # Create the directory if it doesn't exist + os.makedirs(os.path.dirname(output_file), exist_ok=True) + + with open(f"{output_file}", 'w') as f: + json.dump({'results': results, 'pass_rate': pass_rate}, f, indent=2, ensure_ascii=False) + +import re +def remove_simp_pattern_from_end(s): + pattern = r'@\[simp\s*.*?\]$' + return re.sub(pattern, '', s) + +def main(args): + command_list = [] + file_pattern = os.path.join(args.input_path, '[0-9]*.json') + for file_path in glob.glob(file_pattern): + with open(file_path, 'r', encoding='utf-8') as rf: + for line in rf.readlines(): + try: + json_item = json.loads(line) + working_env = json_item['content']['working_file'] + # pdb.set_trace() + # statement = json_item['total output'][0] + + statement = json_item['total output'][0].split("#align")[0] + json_item['statement'] = statement + json_item['cmd'] = '\n\n'.join([working_env, statement]) + assert len(statement) > 0 + # json_item['cmd'] = '\n'.join([working_env, json_item['total output'][0]]) + except: + import pdb + pdb.set_trace() + command_list.append(json_item) + command_list = command_list + results = [] + passed = 0 + total = 0 + multi(command_list, args.output_path) + +if __name__ == '__main__': + arg_parser = ArgumentParser() + arg_parser.add_argument('--data_path', type=str, + default='data/grade-school-math-master/grade_school_math/data/test.jsonl') + arg_parser.add_argument('--input_path', type=str, default='') + arg_parser.add_argument('--cuda_num', type=int, default=8) + arg_parser.add_argument('--output_path', type=str, default='total.json') + arg_parser.add_argument('--generate_method', type=str, + choices=['single', 'sft', 'comp', 'self_consistency', 'single_consistency']) + arg_parser.add_argument('--method', type=str, choices=['main', 'test', 'get_data']) + args = arg_parser.parse_args() + main(args) + + + diff --git a/pass_rate_new_test.py b/pass_rate_new_test.py new file mode 100644 index 0000000000000000000000000000000000000000..7bd59bbea39a54c1423bbf0ffacd575cd871e813 --- /dev/null +++ b/pass_rate_new_test.py @@ -0,0 +1,255 @@ +import os +import subprocess +from argparse import ArgumentParser +import json +from concurrent.futures import ThreadPoolExecutor +from tqdm import tqdm +import glob +import tempfile +import random + +def wrapped_function(item): + results = [] + passed = 0 + total = 0 + + temp_dir = tempfile.gettempdir() + temp_file = os.path.join(temp_dir, f"test.lean") + + with open(temp_file, "w") as f: + f.write(item['cmd']) + + # Rest of the function code... + # Process the item using the temporary file + # ... + + # Clean up the temporary file + data = '{"path": "%s", "allTactics": true}' %(temp_file) + command = 'echo \'%s\' | lake exe repl' % data + + try: + result = subprocess.run(command, shell=True, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout = result.stdout.decode('utf-8') + stderr = result.stderr.decode('utf-8') + # stdout = result.stdout.decode('utf-8') + json_stdout = json.loads(stdout) + if "messages" not in json_stdout.keys(): + passed += 1 + # results.append({'item': item['content'], 'stdout': stdout, 'stderr': stderr, 'status': 'pass'}) + results.append({ 'stdout': stdout, 'stderr': stderr, 'status': 'pass'}) + except subprocess.CalledProcessError as e: + # results.append({'item': item['content'], 'error': str(e), 'status': 'nopass'}) + results.append({ 'error': str(e), 'status': 'nopass'}) + total += 1 + + pass_rate = passed / (passed + total) * 100 + + + return {'results': results, 'pass_rate': pass_rate} + +# Set the directory where your .lean files are located + +# Get a list of all .lean files in the directory +# lean_files = [f for f in os.listdir(directory) if f.endswith(".lean")] +# lean_files = ["test/file.lean"] +def single(command_list, args): + results = [] + passed = 0 + total = 0 + for item in tqdm(command_list): + with open("test/test.lean", "w", encoding = 'utf-8') as f: + f.write(item['cmd']) + data = '{"path": "test/test.lean", "allTactics": true}' + # data = '{"cmd": "%s", "allTactics": true}' % item['cmd'] + command = 'echo \'%s\' | lake exe repl' % data + try: + # process = subprocess.Popen(['lake', 'exe', 'repl'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, + # stderr=subprocess.PIPE) + # stdout, stderr = process.communicate(input=data.encode(encoding='utf-8')) + # stdout = stdout.decode('utf-8') + result = subprocess.run(command, shell=True, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout = result.stdout.decode('utf-8') + json_stdout = json.loads(stdout) + if "messages" not in json_stdout.keys(): + passed += 1 + stderr = result.stderr.decode('utf-8') + results.append({ + # 'item': item['content'], + 'stdout': stdout, + 'stderr': stderr, + 'status': 'pass' + }) + except subprocess.CalledProcessError as e: + results.append({ + # 'item': item['content'], + 'error': str(e), + 'status': 'nopass' + }) + total += 1 + + # Calculate pass rate + pass_rate = passed / total * 100 + print(pass_rate) + + # Save results to a JSON file + with open('results.json', 'w') as f: + json.dump({'results': results, 'pass_rate': pass_rate}, f, indent=2, ensure_ascii=False) + + +def multi(command_list, output_path, k ): + results = [] + passed = 0 + total = 0 + def execute_command(item, index): + temp_dir = '/opt/jianqiao' + def filter_json(json_data): + filtered_data = {} + for key in json_data.keys(): + if key in ['question', 'answer', 'total output', 'results']: + filtered_data[key] = json_data[key] + return filtered_data + result_dict = filter_json(item) + result_dict['results'] = [] + + for i, cmd in enumerate(item['cmd']): + temp_file = os.path.join(temp_dir,f"{index}_test_{i}.lean") # Ensure unique filenames + with open(temp_file, "w") as f: + f.write(cmd) + + data = '{"path": "%s", "allTactics": true}' % temp_file + command = f'echo \'{data}\' | lake exe repl' + + try: + result = subprocess.run(command, shell=True, check=True,timeout=600, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout = json.loads(result.stdout.decode('utf-8')) + stderr = result.stderr.decode('utf-8') + + except subprocess.TimeoutExpired as e: + result_item = {'error': str(e), 'status': 'nopass_limit'} + + except subprocess.CalledProcessError as e: + result_item = {'error': str(e), 'status': 'nopass_error'} + + else: + if "messages" not in stdout and not len(stderr): + result_item = {'stdout': stdout, 'stderr': stderr, 'status': 'pass' } + elif not len(stderr) and "messages" in stdout: + flag = 0 + for me in stdout['messages']: + import pdb + pdb.set_trace() + if me['severity'] == 'error': + flag = 1 + start_line = me['pos']['line'] - 1 + current_column =me['pos']['column'] -1 + for line_n in range(start_line - 1, 0 , -1): + line_len = len(cmd.split('\n')[line_n]) + current_column += line_len + 1 + if not line_len: + break + result_item = {'stdout': stdout, 'stderr': stderr, 'status': 'nopass', 'string_pos':current_column} + break + if not flag : + result_item = {'stdout': stdout, 'stderr': stderr, 'status': 'pass'} + else: + assert len(stderr) + result_item = {'stdout': stdout, 'stderr': stderr, 'status': 'nopass', 'string_pos': 0 } + + result_dict['results'].append(result_item) + return result_dict + + + total = len(command_list) + + with ThreadPoolExecutor(max_workers=1) as executor: + futures = [executor.submit(execute_command, cmd, i) for i, cmd in enumerate(command_list)] + for future in tqdm(futures, total=total, desc="Processing Commands"): + result = future.result() + results.append(result) + # if result['status'] == 'pass': + # passed += 1 + + def calculate_pass(result_list, k): + pass_1_count = 0 + pass_k_count = 0 + + for result in result_list: + results = result.get('results', []) + if results: + for j in range(min(1, len(results))): + if results[j].get('status') == 'pass': + pass_1_count += 1 + break + + for j in range(min(k, len(results))): + if results[j].get('status') == 'pass': + pass_k_count += 1 + break + + pass_1 = pass_1_count / len(result_list) if result_list else 0 + pass_k = pass_k_count / len(result_list) if result_list else 0 + + return pass_1, pass_k + + pass_1, pass_k = calculate_pass(results, k) + print("Pass@1:", pass_1) + print(f"Pass@{k}:", pass_k) + + # pass_rate = (passed / total) * 100 + # print(f"total test: {total}") + # print(f"Pass rate: {pass_rate}%") + + output_file = f"pass_rate_results/{output_path}" + # Create the directory if it doesn't exist + os.makedirs(os.path.dirname(output_file), exist_ok=True) + + with open(f"{output_file}", 'w') as f: + json.dump({'results': results, 'pass_1': pass_1, f"pass_{k}":pass_k}, f, indent=2, ensure_ascii=False) + +import re +def remove_simp_pattern_from_end(s): + pattern = r'@\[simp\s*.*?\]$' + return re.sub(pattern, '', s) + +def main(args): + command_list = [] + file_pattern = os.path.join(args.input_path, '[0-1]*.json') + for file_path in glob.glob(file_pattern): + with open(file_path, 'r', encoding='utf-8') as rf: + for line in rf.readlines(): + try: + json_item = json.loads(line) + working_env = json_item['content']['working_file'] + # pdb.set_trace() + # statement = json_item['total output'][0] + json_item['cmd'] = [] + for output in json_item['total output'][:min(args.k, len(json_item['total output']))]: + statement = output.split("#align")[0] + json_item['cmd'].append('\n\n'.join([working_env, statement])) + json_item['answer'] = json_item['content']['statement_poof'] + assert len(statement) > 0 + # json_item['cmd'] = '\n'.join([working_env, json_item['total output'][0]]) + except: + import pdb + pdb.set_trace() + # import pdb + # pdb.set_trace() + command_list.append(json_item) + multi(command_list, args.output_path, args.k) + +if __name__ == '__main__': + arg_parser = ArgumentParser() + arg_parser.add_argument('--data_path', type=str, + default='data/grade-school-math-master/grade_school_math/data/test.jsonl') + arg_parser.add_argument('--input_path', type=str, default='') + arg_parser.add_argument('--cuda_num', type=int, default=8) + arg_parser.add_argument('--k', type=int, default=1) + arg_parser.add_argument('--output_path', type=str, default='total.json') + arg_parser.add_argument('--generate_method', type=str, + choices=['single', 'sft', 'comp', 'self_consistency', 'single_consistency']) + arg_parser.add_argument('--method', type=str, choices=['main', 'test', 'get_data']) + args = arg_parser.parse_args() + main(args) + + + diff --git a/pass_rate_new_test_allcontent.py b/pass_rate_new_test_allcontent.py new file mode 100644 index 0000000000000000000000000000000000000000..cb7ceb550dc4077eca3bcc217beb7ff6d083da29 --- /dev/null +++ b/pass_rate_new_test_allcontent.py @@ -0,0 +1,255 @@ +import os +import subprocess +from argparse import ArgumentParser +import json +from concurrent.futures import ThreadPoolExecutor +from tqdm import tqdm +import glob +import tempfile +import random +import random;random.seed(42) + + +def wrapped_function(item): + results = [] + passed = 0 + total = 0 + + temp_dir = tempfile.gettempdir() + temp_file = os.path.join(temp_dir, f"test.lean") + + with open(temp_file, "w") as f: + f.write(item['cmd']) + + # Rest of the function code... + # Process the item using the temporary file + # ... + + # Clean up the temporary file + data = '{"path": "%s", "allTactics": true}' %(temp_file) + command = 'echo \'%s\' | lake exe repl' % data + + try: + result = subprocess.run(command, shell=True, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout = result.stdout.decode('utf-8') + stderr = result.stderr.decode('utf-8') + # stdout = result.stdout.decode('utf-8') + json_stdout = json.loads(stdout) + if "messages" not in json_stdout.keys(): + passed += 1 + # results.append({'item': item['content'], 'stdout': stdout, 'stderr': stderr, 'status': 'pass'}) + results.append({ 'stdout': stdout, 'stderr': stderr, 'status': 'pass'}) + except subprocess.CalledProcessError as e: + # results.append({'item': item['content'], 'error': str(e), 'status': 'nopass'}) + results.append({ 'error': str(e), 'status': 'nopass'}) + total += 1 + + pass_rate = passed / (passed + total) * 100 + + + return {'results': results, 'pass_rate': pass_rate} + +# Set the directory where your .lean files are located + +# Get a list of all .lean files in the directory +# lean_files = [f for f in os.listdir(directory) if f.endswith(".lean")] +# lean_files = ["test/file.lean"] +def single(command_list, args): + results = [] + passed = 0 + total = 0 + for item in tqdm(command_list): + with open("test/test.lean", "w", encoding = 'utf-8') as f: + f.write(item['cmd']) + data = '{"path": "test/test.lean", "allTactics": true}' + # data = '{"cmd": "%s", "allTactics": true}' % item['cmd'] + command = 'echo \'%s\' | lake exe repl' % data + try: + # process = subprocess.Popen(['lake', 'exe', 'repl'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, + # stderr=subprocess.PIPE) + # stdout, stderr = process.communicate(input=data.encode(encoding='utf-8')) + # stdout = stdout.decode('utf-8') + result = subprocess.run(command, shell=True, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout = result.stdout.decode('utf-8') + json_stdout = json.loads(stdout) + if "messages" not in json_stdout.keys(): + passed += 1 + stderr = result.stderr.decode('utf-8') + results.append({ + # 'item': item['content'], + 'stdout': stdout, + 'stderr': stderr, + 'status': 'pass' + }) + except subprocess.CalledProcessError as e: + results.append({ + # 'item': item['content'], + 'error': str(e), + 'status': 'nopass' + }) + total += 1 + + # Calculate pass rate + pass_rate = passed / total * 100 + print(pass_rate) + + # Save results to a JSON file + with open('results.json', 'w') as f: + json.dump({'results': results, 'pass_rate': pass_rate}, f, indent=2, ensure_ascii=False) + + +def multi(command_list, output_path, k ): + results = [] + passed = 0 + total = 0 + def execute_command(item, index): + temp_dir = '/opt/jianqiao' + def filter_json(json_data): + filtered_data = {} + for key in json_data.keys(): + if key in ['question', 'answer', 'total output', 'results', 'cmd']: + filtered_data[key] = json_data[key] + return filtered_data + result_dict = filter_json(item) + result_dict['results'] = [] + + for i, cmd in enumerate(item['cmd']): + temp_file = os.path.join(temp_dir,f"{index}_test_{i}.lean") # Ensure unique filenames + with open(temp_file, "w") as f: + f.write(cmd) + + data = '{"path": "%s", "allTactics": true}' % temp_file + command = f'echo \'{data}\' | lake exe repl' + + try: + result = subprocess.run(command, shell=True, check=True,timeout=600, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout = json.loads(result.stdout.decode('utf-8')) + stderr = result.stderr.decode('utf-8') + + except subprocess.TimeoutExpired as e: + result_item = {'error': str(e), 'status': 'nopass_limit'} + + except subprocess.CalledProcessError as e: + result_item = {'error': str(e), 'status': 'nopass_error'} + + else: + if "messages" not in stdout and not len(stderr): + result_item = {'stdout': stdout, 'stderr': stderr, 'status': 'pass' } + elif not len(stderr) and "messages" in stdout: + flag = 0 + for me in stdout['messages']: + if me['severity'] == 'error': + flag = 1 + start_line = me['pos']['line'] - 1 + current_column =me['pos']['column'] -1 + for line_n in range(start_line - 1, 0 , -1): + line_len = len(cmd.split('\n')[line_n]) + current_column += line_len + 1 + if not line_len: + break + result_item = {'stdout': stdout, 'stderr': stderr, 'status': 'nopass', 'string_pos':current_column} + break + if not flag : + result_item = {'stdout': stdout, 'stderr': stderr, 'status': 'pass'} + else: + assert len(stderr) + result_item = {'stdout': stdout, 'stderr': stderr, 'status': 'nopass', 'string_pos': 0 } + + result_dict['results'].append(result_item) + return result_dict + + + total = len(command_list) + + with ThreadPoolExecutor(max_workers=128) as executor: + futures = [executor.submit(execute_command, cmd, i) for i, cmd in enumerate(command_list)] + for future in tqdm(futures, total=total, desc="Processing Commands"): + result = future.result() + results.append(result) + # if result['status'] == 'pass': + # passed += 1 + + def calculate_pass(result_list, k): + pass_1_count = 0 + pass_k_count = 0 + + for result in result_list: + results = result.get('results', []) + if results: + for j in range(min(1, len(results))): + if results[j].get('status') == 'pass': + pass_1_count += 1 + break + + for j in range(min(k, len(results))): + if results[j].get('status') == 'pass': + pass_k_count += 1 + break + + pass_1 = pass_1_count / len(result_list) if result_list else 0 + pass_k = pass_k_count / len(result_list) if result_list else 0 + + return pass_1, pass_k + + pass_1, pass_k = calculate_pass(results, k) + print("Pass@1:", pass_1) + print(f"Pass@{k}:", pass_k) + + # pass_rate = (passed / total) * 100 + # print(f"total test: {total}") + # print(f"Pass rate: {pass_rate}%") + + output_file = f"pass_rate_results/{output_path}" + # Create the directory if it doesn't exist + os.makedirs(os.path.dirname(output_file), exist_ok=True) + + with open(f"{output_file}", 'w') as f: + json.dump({'results': results, 'pass_1': pass_1, f"pass_{k}":pass_k}, f, indent=2, ensure_ascii=False) + +import re +def remove_simp_pattern_from_end(s): + pattern = r'@\[simp\s*.*?\]$' + return re.sub(pattern, '', s) + +def main(args): + command_list = [] + file_pattern = os.path.join(args.input_path, '[0-9]*.json') + for file_path in glob.glob(file_pattern): + with open(file_path, 'r', encoding='utf-8') as rf: + for line in rf.readlines(): + try: + json_item = json.loads(line) + working_env = json_item['content']['working_file'] + # pdb.set_trace() + # statement = json_item['total output'][0] + json_item['cmd'] = [] + for output in json_item['total output'][:min(args.k, len(json_item['total output']))]: + statement = output.split("#align")[0] + json_item['cmd'].append('\n\n'.join([working_env, statement])) + json_item['answer'] = json_item['content']['statement_poof'] + assert len(statement) > 0 + # json_item['cmd'] = '\n'.join([working_env, json_item['total output'][0]]) + except: + import pdb + pdb.set_trace() + # import pdb + # pdb.set_trace() + command_list.append(json_item) + multi(random.sample(command_list, 1000), args.output_path, args.k) + +if __name__ == '__main__': + arg_parser = ArgumentParser() + arg_parser.add_argument('--data_path', type=str, + default='data/grade-school-math-master/grade_school_math/data/test.jsonl') + arg_parser.add_argument('--input_path', type=str, default='') + arg_parser.add_argument('--cuda_num', type=int, default=8) + arg_parser.add_argument('--k', type=int, default=1) + arg_parser.add_argument('--output_path', type=str, default='total.json') + arg_parser.add_argument('--generate_method', type=str, + choices=['single', 'sft', 'comp', 'self_consistency', 'single_consistency']) + arg_parser.add_argument('--method', type=str, choices=['main', 'test', 'get_data']) + args = arg_parser.parse_args() + main(args) + + + diff --git a/pass_rate_notlean.py b/pass_rate_notlean.py new file mode 100644 index 0000000000000000000000000000000000000000..c1c71c4ac201b3c3f41520d2f0a29746d1111bd3 --- /dev/null +++ b/pass_rate_notlean.py @@ -0,0 +1,202 @@ +import os +import subprocess +from argparse import ArgumentParser +import json +from concurrent.futures import ThreadPoolExecutor +from tqdm import tqdm +import tempfile +import glob +import pdb + +def wrapped_function(item): + results = [] + passed = 0 + total = 0 + + temp_dir = tempfile.gettempdir() + temp_file = os.path.join(temp_dir, f"test.lean") + + with open(temp_file, "w") as f: + f.write(item['cmd']) + + # Rest of the function code... + # Process the item using the temporary file + # ... + + # Clean up the temporary file + data = '{"path": "%s", "allTactics": true}' %(temp_file) + command = 'echo \'%s\' | lake exe repl' % data + + try: + result = subprocess.run(command, shell=True, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout = result.stdout.decode('utf-8') + stderr = result.stderr.decode('utf-8') + # stdout = result.stdout.decode('utf-8') + json_stdout = json.loads(stdout) + if "messages" not in json_stdout.keys(): + passed += 1 + # results.append({'item': item['content'], 'stdout': stdout, 'stderr': stderr, 'status': 'pass'}) + results.append({ 'stdout': stdout, 'stderr': stderr, 'status': 'pass'}) + except subprocess.CalledProcessError as e: + # results.append({'item': item['content'], 'error': str(e), 'status': 'nopass'}) + results.append({ 'error': str(e), 'status': 'nopass'}) + total += 1 + + pass_rate = passed / (passed + total) * 100 + + + return {'results': results, 'pass_rate': pass_rate} + +# Set the directory where your .lean files are located + +# Get a list of all .lean files in the directory +# lean_files = [f for f in os.listdir(directory) if f.endswith(".lean")] +# lean_files = ["test/file.lean"] +def single(command_list, output_path): + results = [] + passed = 0 + total = 0 + for item in tqdm(command_list): + with open("test/test.lean", "w", encoding = 'utf-8') as f: + f.write(item['cmd']) + data = '{"path": "test/test.lean", "allTactics": true}' + # data = '{"cmd": "%s", "allTactics": true}' % item['cmd'] + command = 'echo \'%s\' | lake exe repl' % data + + try: + # process = subprocess.Popen(['lake', 'exe', 'repl'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, + # stderr=subprocess.PIPE) + # stdout, stderr = process.communicate(input=data.encode(encoding='utf-8')) + # stdout = stdout.decode('utf-8') + + result = subprocess.run(command, shell=True, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout = result.stdout.decode('utf-8') + json_stdout = json.loads(stdout) + if "messages" not in json_stdout.keys(): + passed += 1 + stderr = result.stderr.decode('utf-8') + results.append({ + # 'item': item['content'], + 'stdout': stdout, + 'stderr': stderr, + 'status': 'pass' + }) + except subprocess.CalledProcessError as e: + results.append({ + # 'item': item['content'], + 'error': str(e), + 'status': 'nopass' + }) + total += 1 + + # Calculate pass rate + pass_rate = passed / total * 100 + print(pass_rate) + + # Save results to a JSON file + with open('results.json', 'w') as f: + json.dump({'results': results, 'pass_rate': pass_rate}, f, indent=2, ensure_ascii=False) + + + + +def multi(command_list, output_path): + results = [] + passed = 0 + total = 0 + def execute_command(item): + temp_dir = '/opt/jianqiao' + temp_file = os.path.join(temp_dir, f"test_{item['index']}.lean") # Ensure unique filenames + with open(temp_file, "w") as f: + f.write(item['cmd']) + + data = '{"path": "%s", "allTactics": true}' % temp_file + command = f'echo \'{data}\' | lake exe repl' + + try: + result = subprocess.run(command, shell=True, check=True,timeout=600, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout = result.stdout.decode('utf-8') + stderr = result.stderr.decode('utf-8') + + if "messages" not in json.loads(stdout) and not len(stderr): + return {'stdout': stdout, 'stderr': stderr, 'status': 'pass' , 'statement':item['statement'], 'content': item['content']} + else: + return {'stdout': stdout, 'stderr': stderr, 'status': 'nopass', 'statement':item['statement'] , 'content': item['content']} + + except subprocess.TimeoutExpired as e: + return {'error': str(e), 'status': 'nopass_limit', 'statement':item['statement'], 'content': item['content']} + + except subprocess.CalledProcessError as e: + return {'error': str(e), 'status': 'nopass_error', 'statement':item['statement'], 'content': item['content']} + + os.remove(temp_file) + + total = len(command_list) + + with ThreadPoolExecutor(max_workers=32) as executor: + futures = [executor.submit(execute_command, {'index': i, 'cmd': cmd['cmd'], 'statement':cmd['statement'], 'content':cmd['content']}) for i, cmd in enumerate(command_list)] + for future in tqdm(futures, total=total, desc="Processing Commands"): + result = future.result() + results.append(result) + if result['status'] == 'pass': + passed += 1 + + pass_rate = (passed / total) * 100 + print(f"Pass rate: {pass_rate}%") + + output_file = f"pass_rate_results/{output_path}" + # Create the directory if it doesn't exist + os.makedirs(os.path.dirname(output_file), exist_ok=True) + + with open(f"{output_file}", 'w') as f: + json.dump({'results': results, 'pass_rate': pass_rate}, f, indent=2, ensure_ascii=False) + +import re +def remove_simp_pattern_from_end(s): + pattern = r'@\[simp\s*.*?\]$' + return re.sub(pattern, '', s) + +def main(args): + import pdb + command_list = [] + # json_filename = 'data/notlean_dependency.json' + json_filename = 'data/basic_working.json' + + json_item = json.load(open(json_filename, encoding='utf-8')) + working_env = json_item['working_file'] + file_pattern = os.path.join(args.input_path, '[0-9]*.json') + for file_path in glob.glob(file_pattern): + with open(file_path, 'r', encoding='utf-8') as rf: + for line in rf.readlines(): + try: + json_item = json.loads(line) + statement = json_item['total output'][0].split("#align")[0] + json_item['statement'] = statement + json_item['cmd'] = '\n\n'.join([working_env, statement]) + assert len(statement) > 0 + # json_item['cmd'] = '\n'.join([working_env, json_item['total output'][0]]) + except: + import pdb + pdb.set_trace() + command_list.append(json_item) + command_list = command_list + results = [] + passed = 0 + total = 0 + multi( command_list, args.output_path) + +if __name__ == '__main__': + arg_parser = ArgumentParser() + arg_parser.add_argument('--data_path', type=str, + default='data/grade-school-math-master/grade_school_math/data/test.jsonl') + arg_parser.add_argument('--input_path', type=str, default='') + arg_parser.add_argument('--cuda_num', type=int, default=8) + arg_parser.add_argument('--output_path', type=str, default='total.json') + arg_parser.add_argument('--generate_method', type=str, + choices=['single', 'sft', 'comp', 'self_consistency', 'single_consistency']) + arg_parser.add_argument('--method', type=str, choices=['main', 'test', 'get_data']) + args = arg_parser.parse_args() + main(args) + + + diff --git a/pass_rate_notlean_test.py b/pass_rate_notlean_test.py new file mode 100644 index 0000000000000000000000000000000000000000..4471f758ac8fe827e2e1f106559782e43bf3d1e5 --- /dev/null +++ b/pass_rate_notlean_test.py @@ -0,0 +1,261 @@ +import os +import subprocess +from argparse import ArgumentParser +import json +from concurrent.futures import ThreadPoolExecutor +from tqdm import tqdm +import tempfile +import glob +import pdb + +def wrapped_function(item): + results = [] + passed = 0 + total = 0 + + temp_dir = tempfile.gettempdir() + temp_file = os.path.join(temp_dir, f"test.lean") + + with open(temp_file, "w") as f: + f.write(item['cmd']) + + # Rest of the function code... + # Process the item using the temporary file + # ... + + # Clean up the temporary file + data = '{"path": "%s", "allTactics": true}' %(temp_file) + command = 'echo \'%s\' | lake exe repl' % data + + try: + result = subprocess.run(command, shell=True, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout = result.stdout.decode('utf-8') + stderr = result.stderr.decode('utf-8') + # stdout = result.stdout.decode('utf-8') + json_stdout = json.loads(stdout) + if "messages" not in json_stdout.keys(): + passed += 1 + # results.append({'item': item['content'], 'stdout': stdout, 'stderr': stderr, 'status': 'pass'}) + results.append({ 'stdout': stdout, 'stderr': stderr, 'status': 'pass'}) + except subprocess.CalledProcessError as e: + # results.append({'item': item['content'], 'error': str(e), 'status': 'nopass'}) + results.append({ 'error': str(e), 'status': 'nopass'}) + total += 1 + + pass_rate = passed / (passed + total) * 100 + + + return {'results': results, 'pass_rate': pass_rate} + +# Set the directory where your .lean files are located + +# Get a list of all .lean files in the directory +# lean_files = [f for f in os.listdir(directory) if f.endswith(".lean")] +# lean_files = ["test/file.lean"] +def single(command_list, output_path): + results = [] + passed = 0 + total = 0 + for item in tqdm(command_list): + with open("test/test.lean", "w", encoding = 'utf-8') as f: + f.write(item['cmd']) + data = '{"path": "test/test.lean", "allTactics": true}' + # data = '{"cmd": "%s", "allTactics": true}' % item['cmd'] + command = 'echo \'%s\' | lake exe repl' % data + + try: + # process = subprocess.Popen(['lake', 'exe', 'repl'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, + # stderr=subprocess.PIPE) + # stdout, stderr = process.communicate(input=data.encode(encoding='utf-8')) + # stdout = stdout.decode('utf-8') + + result = subprocess.run(command, shell=True, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout = result.stdout.decode('utf-8') + json_stdout = json.loads(stdout) + if "messages" not in json_stdout.keys(): + passed += 1 + stderr = result.stderr.decode('utf-8') + results.append({ + # 'item': item['content'], + 'stdout': stdout, + 'stderr': stderr, + 'status': 'pass' + }) + except subprocess.CalledProcessError as e: + results.append({ + # 'item': item['content'], + 'error': str(e), + 'status': 'nopass' + }) + total += 1 + + # Calculate pass rate + pass_rate = passed / total * 100 + print(pass_rate) + + # Save results to a JSON file + with open('results.json', 'w') as f: + json.dump({'results': results, 'pass_rate': pass_rate}, f, indent=2, ensure_ascii=False) + + + + + + +def multi(command_list, output_path, k ): + results = [] + passed = 0 + total = 0 + def execute_command(item, index): + temp_dir = '/opt/jianqiao' + def filter_json(json_data): + filtered_data = {} + for key in json_data.keys(): + if key in ['question', 'answer', 'total output', 'results']: + filtered_data[key] = json_data[key] + return filtered_data + result_dict = filter_json(item) + result_dict['results'] = [] + + for i, cmd in enumerate(item['cmd']): + temp_file = os.path.join(temp_dir,f"{index}_test_{i}.lean") # Ensure unique filenames + with open(temp_file, "w") as f: + f.write(cmd) + + data = '{"path": "%s", "allTactics": true}' % temp_file + command = f'echo \'{data}\' | lake exe repl' + + try: + result = subprocess.run(command, shell=True, check=True,timeout=480, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout = json.loads(result.stdout.decode('utf-8')) + stderr = result.stderr.decode('utf-8') + + except subprocess.TimeoutExpired as e: + result_item = {'error': str(e), 'status': 'nopass_limit'} + + except subprocess.CalledProcessError as e: + result_item = {'error': str(e), 'status': 'nopass_error'} + + else: + if "messages" not in stdout and not len(stderr): + result_item = {'stdout': stdout, 'stderr': stderr, 'status': 'pass' } + elif not len(stderr) and "messages" in stdout: + flag = 0 + for me in stdout['messages']: + if me['severity'] == 'error': + flag = 1 + start_line = me['pos']['line'] - 1 + current_column =me['pos']['column'] -1 + for line_n in range(start_line - 1, 0 , -1): + line_len = len(cmd.split('\n')[line_n]) + current_column += line_len + 1 + if not line_len: + break + result_item = {'stdout': stdout, 'stderr': stderr, 'status': 'nopass', 'string_pos':current_column} + break + if not flag : + result_item = {'stdout': stdout, 'stderr': stderr, 'status': 'pass'} + else: + assert len(stderr) + result_item = {'stdout': stdout, 'stderr': stderr, 'status': 'nopass', 'string_pos': 0 } + + result_dict['results'].append(result_item) + return result_dict + + + total = len(command_list) + + with ThreadPoolExecutor(max_workers=128) as executor: + futures = [executor.submit(execute_command, cmd, i) for i, cmd in enumerate(command_list)] + for future in tqdm(futures, total=total, desc="Processing Commands"): + + result = future.result() + results.append(result) + # if result['status'] == 'pass': + # passed += 1 + + def calculate_pass(result_list, k): + pass_1_count = 0 + pass_k_count = 0 + + for result in result_list: + results = result.get('results', []) + if results: + for j in range(min(1, len(results))): + if results[j].get('status') == 'pass': + pass_1_count += 1 + break + + for j in range(min(k, len(results))): + if results[j].get('status') == 'pass': + pass_k_count += 1 + break + + pass_1 = pass_1_count / len(result_list) if result_list else 0 + pass_k = pass_k_count / len(result_list) if result_list else 0 + + return pass_1, pass_k + + pass_1, pass_k = calculate_pass(results, k) + print("Pass@1:", pass_1) + print(f"Pass@{k}:", pass_k) + + # pass_rate = (passed / total) * 100 + # print(f"total test: {total}") + # print(f"Pass rate: {pass_rate}%") + + output_file = f"pass_rate_results/{output_path}" + # Create the directory if it doesn't exist + os.makedirs(os.path.dirname(output_file), exist_ok=True) + + with open(f"{output_file}", 'w') as f: + json.dump({'results': results, 'pass_1': pass_1, f"pass_{k}":pass_k}, f, indent=2, ensure_ascii=False) + +import re +def remove_simp_pattern_from_end(s): + pattern = r'@\[simp\s*.*?\]$' + return re.sub(pattern, '', s) + +def main(args): + command_list = [] + # json_filename = 'data/notlean_dependency.json' + # json_filename = 'data/basic_working.json' + # json_item = json.load(open(json_filename, encoding='utf-8')) + # working_env = json_item['working_file'] + working_env = '' + + json_filename = 'data/leandojo.txt' + with open(json_filename, 'r') as rf: + for line in rf.readlines(): + working_env += line + file_pattern = os.path.join(args.input_path, '[0-9]*.json') + for file_path in glob.glob(file_pattern): + with open(file_path, 'r', encoding='utf-8') as rf: + for line in rf.readlines(): + json_item = json.loads(line) + json_item['cmd'] = [] + for output in json_item['total output'][:min(args.k, len(json_item['total output']))]: + statement = output.split("#align")[0] + json_item['cmd'].append('\n\n'.join([working_env, statement])) + # json_item['answer'] = json_item['content']['answer'] + command_list.append(json_item) + command_list = command_list + + multi(command_list, args.output_path, args.k) + +if __name__ == '__main__': + arg_parser = ArgumentParser() + arg_parser.add_argument('--data_path', type=str, + default='data/grade-school-math-master/grade_school_math/data/test.jsonl') + arg_parser.add_argument('--input_path', type=str, default='') + arg_parser.add_argument('--cuda_num', type=int, default=8) + arg_parser.add_argument('--output_path', type=str, default='total.json') + arg_parser.add_argument('--k', type=int, default=1) + arg_parser.add_argument('--generate_method', type=str, + choices=['single', 'sft', 'comp', 'self_consistency', 'single_consistency']) + arg_parser.add_argument('--method', type=str, choices=['main', 'test', 'get_data']) + args = arg_parser.parse_args() + main(args) + + + diff --git a/pass_rate_output.txt b/pass_rate_output.txt new file mode 100644 index 0000000000000000000000000000000000000000..9cdc42a8311dc7982ba7ab0b9322da72f0a5ebe9 --- /dev/null +++ b/pass_rate_output.txt @@ -0,0 +1,82 @@ +Running for input path: ../auto-info/generate_result/zero_shot/lean4_basic_test/generation/deepseek-math-7b-base/5/ + Processing Commands: 0%| | 0/981 [00:00 0 + # json_item['cmd'] = '\n'.join([working_env, json_item['total output'][0]]) + except: + import pdb + pdb.set_trace() + command_list.append(json_item) + command_list = command_list + results = [] + passed = 0 + total = 0 + multi( command_list) + +if __name__ == '__main__': + main() + diff --git a/test.json b/test.json new file mode 100644 index 0000000000000000000000000000000000000000..326108e00f9dc83595dd4f81fba5a2f30a8b04c3 --- /dev/null +++ b/test.json @@ -0,0 +1,274 @@ + import Mathlib.Algebra.Star.Unitary + import Mathlib.Data.Nat.ModEq + import Mathlib.NumberTheory.Zsqrtd.Basic + import Mathlib.Tactic.Monotonicity + import Mathlib.Algebra.GroupPower.Order + + #align_import number_theory.pell_matiyasevic from "leanprover-community/mathlib"@"795b501869b9fa7aa716d5fdadd00c03f983a605" + + /-! + # Pell's equation and Matiyasevic's theorem + + This file solves Pell's equation, i.e. integer solutions to `x ^ 2 - d * y ^ 2 = 1` + *in the special case that `d = a ^ 2 - 1`*. + This is then applied to prove Matiyasevic's theorem that the power + function is Diophantine, which is the last key ingredient in the solution to Hilbert's tenth + problem. For the definition of Diophantine function, see `NumberTheory.Dioph`. + + For results on Pell's equation for arbitrary (positive, non-square) `d`, see + `NumberTheory.Pell`. + + ## Main definition + + * `pell` is a function assigning to a natural number `n` the `n`-th solution to Pell's equation + constructed recursively from the initial solution `(0, 1)`. + + ## Main statements + + * `eq_pell` shows that every solution to Pell's equation is recursively obtained using `pell` + * `matiyasevic` shows that a certain system of Diophantine equations has a solution if and only if + the first variable is the `x`-component in a solution to Pell's equation - the key step towards + Hilbert's tenth problem in Davis' version of Matiyasevic's theorem. + * `eq_pow_of_pell` shows that the power function is Diophantine. + + ## Implementation notes + + The proof of Matiyasevic's theorem doesn't follow Matiyasevic's original account of using Fibonacci + numbers but instead Davis' variant of using solutions to Pell's equation. + + ## References + + * [M. Carneiro, _A Lean formalization of Matiyasevič's theorem_][carneiro2018matiyasevic] + * [M. Davis, _Hilbert's tenth problem is unsolvable_][MR317916] + + ## Tags + + Pell's equation, Matiyasevic's theorem, Hilbert's tenth problem + + -/ + + + namespace Pell + + open Nat + + section + + variable {d : ℤ} + + /-- The property of being a solution to the Pell equation, expressed + as a property of elements of `ℤ√d`. -/ + def IsPell : ℤ√d → Prop + | ⟨x, y⟩ => x * x - d * y * y = 1 + #align pell.is_pell Pell.IsPell + + theorem isPell_norm : ∀ {b : ℤ√d}, IsPell b ↔ b * star b = 1 + | ⟨x, y⟩ => by simp [Zsqrtd.ext_iff, IsPell, mul_comm]; ring_nf + #align pell.is_pell_norm Pell.isPell_norm + + theorem isPell_iff_mem_unitary : ∀ {b : ℤ√d}, IsPell b ↔ b ∈ unitary (ℤ√d) + | ⟨x, y⟩ => by rw [unitary.mem_iff, isPell_norm, mul_comm (star _), and_self_iff] + #align pell.is_pell_iff_mem_unitary Pell.isPell_iff_mem_unitary + + theorem isPell_mul {b c : ℤ√d} (hb : IsPell b) (hc : IsPell c) : IsPell (b * c) := + isPell_norm.2 (by simp [mul_comm, mul_left_comm c, mul_assoc, + star_mul, isPell_norm.1 hb, isPell_norm.1 hc]) + #align pell.is_pell_mul Pell.isPell_mul + + theorem isPell_star : ∀ {b : ℤ√d}, IsPell b ↔ IsPell (star b) + | ⟨x, y⟩ => by simp [IsPell, Zsqrtd.star_mk] + #align pell.is_pell_star Pell.isPell_star + + end + + section + + -- Porting note: was parameter in Lean3 + variable {a : ℕ} (a1 : 1 < a) + + private def d (_a1 : 1 < a) := + a * a - 1 + + @[simp] + theorem d_pos : 0 < d a1 := + tsub_pos_of_lt (mul_lt_mul a1 (le_of_lt a1) (by decide) (Nat.zero_le _) : 1 * 1 < a * a) + #align pell.d_pos Pell.d_pos + + -- TODO(lint): Fix double namespace issue + /-- The Pell sequences, i.e. the sequence of integer solutions to `x ^ 2 - d * y ^ 2 = 1`, where + `d = a ^ 2 - 1`, defined together in mutual recursion. -/ + --@[nolint dup_namespace] + def pell : ℕ → ℕ × ℕ + -- Porting note: used pattern matching because `Nat.recOn` is noncomputable + | 0 => (1, 0) + | n+1 => ((pell n).1 * a + d a1 * (pell n).2, (pell n).1 + (pell n).2 * a) + #align pell.pell Pell.pell + + /-- The Pell `x` sequence. -/ + def xn (n : ℕ) : ℕ := + (pell a1 n).1 + #align pell.xn Pell.xn + + /-- The Pell `y` sequence. -/ + def yn (n : ℕ) : ℕ := + (pell a1 n).2 + #align pell.yn Pell.yn + + @[simp] + theorem pell_val (n : ℕ) : pell a1 n = (xn a1 n, yn a1 n) := + show pell a1 n = ((pell a1 n).1, (pell a1 n).2) from + match pell a1 n with + | (_, _) => rfl + #align pell.pell_val Pell.pell_val + + @[simp] + theorem xn_zero : xn a1 0 = 1 := + rfl + #align pell.xn_zero Pell.xn_zero + + @[simp] + theorem yn_zero : yn a1 0 = 0 := + rfl + #align pell.yn_zero Pell.yn_zero + + @[simp] + theorem xn_succ (n : ℕ) : xn a1 (n + 1) = xn a1 n * a + d a1 * yn a1 n := + rfl + #align pell.xn_succ Pell.xn_succ + + @[simp] + theorem yn_succ (n : ℕ) : yn a1 (n + 1) = xn a1 n + yn a1 n * a := + rfl + #align pell.yn_succ Pell.yn_succ + + --@[simp] Porting note (#10618): `simp` can prove it + theorem xn_one : xn a1 1 = a := by simp + #align pell.xn_one Pell.xn_one + + --@[simp] Porting note (#10618): `simp` can prove it + theorem yn_one : yn a1 1 = 1 := by simp + #align pell.yn_one Pell.yn_one + + /-- The Pell `x` sequence, considered as an integer sequence.-/ + def xz (n : ℕ) : ℤ := + xn a1 n + #align pell.xz Pell.xz + + /-- The Pell `y` sequence, considered as an integer sequence.-/ + def yz (n : ℕ) : ℤ := + yn a1 n + #align pell.yz Pell.yz + + section + + /-- The element `a` such that `d = a ^ 2 - 1`, considered as an integer.-/ + def az (a : ℕ) : ℤ := + a + #align pell.az Pell.az + + end + + theorem asq_pos : 0 < a * a := + le_trans (le_of_lt a1) + (by have := @Nat.mul_le_mul_left 1 a a (le_of_lt a1); rwa [mul_one] at this) + #align pell.asq_pos Pell.asq_pos + + theorem dz_val : ↑(d a1) = az a * az a - 1 := + have : 1 ≤ a * a := asq_pos a1 + by rw [Pell.d, Int.ofNat_sub this]; rfl + #align pell.dz_val Pell.dz_val + + @[simp] + theorem xz_succ (n : ℕ) : (xz a1 (n + 1)) = xz a1 n * az a + d a1 * yz a1 n := + rfl + #align pell.xz_succ Pell.xz_succ + + @[simp] + theorem yz_succ (n : ℕ) : yz a1 (n + 1) = xz a1 n + yz a1 n * az a := + rfl + #align pell.yz_succ Pell.yz_succ + + /-- The Pell sequence can also be viewed as an element of `ℤ√d` -/ + def pellZd (n : ℕ) : ℤ√(d a1) := + ⟨xn a1 n, yn a1 n⟩ + #align pell.pell_zd Pell.pellZd + + @[simp] + theorem pellZd_re (n : ℕ) : (pellZd a1 n).re = xn a1 n := + rfl + #align pell.pell_zd_re Pell.pellZd_re + + @[simp] + theorem pellZd_im (n : ℕ) : (pellZd a1 n).im = yn a1 n := + rfl + #align pell.pell_zd_im Pell.pellZd_im + + theorem isPell_nat {x y : ℕ} : IsPell (⟨x, y⟩ : ℤ√(d a1)) ↔ x * x - d a1 * y * y = 1 := + ⟨fun h => + Nat.cast_inj.1 + (by rw [Int.ofNat_sub (Int.le_of_ofNat_le_ofNat <| Int.le.intro_sub _ h)]; exact h), + fun h => + show ((x * x : ℕ) - (d a1 * y * y : ℕ) : ℤ) = 1 by + rw [← Int.ofNat_sub <| le_of_lt <| Nat.lt_of_sub_eq_succ h, h]; rfl⟩ + #align pell.is_pell_nat Pell.isPell_nat + + @[simp] + theorem pellZd_succ (n : ℕ) : pellZd a1 (n + 1) = pellZd a1 n * ⟨a, 1⟩ := by ext <;> simp + #align pell.pell_zd_succ Pell.pellZd_succ + + theorem isPell_one : IsPell (⟨a, 1⟩ : ℤ√(d a1)) := + show az a * az a - d a1 * 1 * 1 = 1 by simp [dz_val] + #align pell.is_pell_one Pell.isPell_one + + theorem isPell_pellZd : ∀ n : ℕ, IsPell (pellZd a1 n) + | 0 => rfl + | n + 1 => by + let o := isPell_one a1 + simp; exact Pell.isPell_mul (isPell_pellZd n) o + #align pell.is_pell_pell_zd Pell.isPell_pellZd + + @[simp] + theorem pell_eqz (n : ℕ) : xz a1 n * xz a1 n - d a1 * yz a1 n * yz a1 n = 1 := + isPell_pellZd a1 n + #align pell.pell_eqz Pell.pell_eqz + + @[simp] + theorem pell_eq (n : ℕ) : xn a1 n * xn a1 n - d a1 * yn a1 n * yn a1 n = 1 := + let pn := pell_eqz a1 n + have h : (↑(xn a1 n * xn a1 n) : ℤ) - ↑(d a1 * yn a1 n * yn a1 n) = 1 := by + repeat' rw [Int.ofNat_mul]; exact pn + have hl : d a1 * yn a1 n * yn a1 n ≤ xn a1 n * xn a1 n := + Nat.cast_le.1 <| Int.le.intro _ <| add_eq_of_eq_sub' <| Eq.symm h + Nat.cast_inj.1 (by rw [Int.ofNat_sub hl]; exact h) + #align pell.pell_eq Pell.pell_eq + + instance dnsq : Zsqrtd.Nonsquare (d a1) := + ⟨fun n h => + have : n * n + 1 = a * a := by rw [← h]; exact Nat.succ_pred_eq_of_pos (asq_pos a1) + have na : n < a := Nat.mul_self_lt_mul_self_iff.1 (by rw [← this]; exact Nat.lt_succ_self _) + have : (n + 1) * (n + 1) ≤ n * n + 1 := by rw [this]; exact Nat.mul_self_le_mul_self na + have : n + n ≤ 0 := + @Nat.le_of_add_le_add_right _ (n * n + 1) _ (by ring_nf at this ⊢; assumption) + Nat.ne_of_gt (d_pos a1) <| by + rwa [Nat.eq_zero_of_le_zero ((Nat.le_add_left _ _).trans this)] at h⟩ + #align pell.dnsq Pell.dnsq + + theorem xn_ge_a_pow : ∀ n : ℕ, a ^ n ≤ xn a1 n + | 0 => le_refl 1 + | n + 1 => by + simp only [_root_.pow_succ, xn_succ] + exact le_trans (Nat.mul_le_mul_right _ (xn_ge_a_pow n)) (Nat.le_add_right _ _) + #align pell.xn_ge_a_pow Pell.xn_ge_a_pow + + theorem n_lt_a_pow : ∀ n : ℕ, n < a ^ n + | 0 => Nat.le_refl 1 + | n + 1 => by + have IH := n_lt_a_pow n + have : a ^ n + a ^ n ≤ a ^ n * a := by + rw [← mul_two] + exact Nat.mul_le_mul_left _ a1 + simp only [_root_.pow_succ, gt_iff_lt] + refine' lt_of_lt_of_le _ this + exact add_lt_add_of_lt_of_le IH (lt_of_le_of_lt (Nat.zero_le _) IH) + #align pell.n_lt_a_pow Pell.n_lt_a_pow + diff --git a/test.lean b/test.lean new file mode 100644 index 0000000000000000000000000000000000000000..7e9c30aa053431799b016dc2455409b332c36fed --- /dev/null +++ b/test.lean @@ -0,0 +1,7 @@ +theorem mathd_algebra_17 + (a : ℝ) + (h₀ : real.sqrt (4 + real.sqrt (16 + 16 * a)) + real.sqrt (1 + real.sqrt (1 + a)) = 6) : + a = 8 := +begin + sorry +end diff --git a/test.log b/test.log new file mode 100644 index 0000000000000000000000000000000000000000..a24ed4d324a353624d98b08fce2ccc5e3b42e4ac --- /dev/null +++ b/test.log @@ -0,0 +1,3 @@ + Processing Commands: 0%| | 0/10 [00:00 "$tmpfile" 2>&1 + + # Compare the output with the expected output + if diff "$tmpfile" "$expectedfile"; then + echo "$base: PASSED" + # Remove the temporary file + rm "$tmpfile" + else + echo "$base: FAILED" + # Remove the temporary file + rm "$tmpfile" + exit 1 + fi + +done + +# Run the Mathlib tests +cp lean-toolchain test/Mathlib/ +cd test/Mathlib/ && ./test.sh