{"id":51166350,"url":"https://github.com/kiranandcode/leanslop","last_synced_at":"2026-06-26T19:02:28.479Z","repository":{"id":332861946,"uuid":"1135280558","full_name":"kiranandcode/leanslop","owner":"kiranandcode","description":"LeanSlop: LLM-slop black box automation for the Lean4 theorem prover","archived":false,"fork":false,"pushed_at":"2026-01-15T22:19:48.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-16T01:45:36.791Z","etag":null,"topics":["ai4math","lean4","llm","theorem-proving"],"latest_commit_sha":null,"homepage":"","language":"Lean","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kiranandcode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-15T22:08:36.000Z","updated_at":"2026-01-15T22:26:16.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/kiranandcode/leanslop","commit_stats":null,"previous_names":["kiranandcode/leanslop"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/kiranandcode/leanslop","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiranandcode%2Fleanslop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiranandcode%2Fleanslop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiranandcode%2Fleanslop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiranandcode%2Fleanslop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kiranandcode","download_url":"https://codeload.github.com/kiranandcode/leanslop/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiranandcode%2Fleanslop/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34829415,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-26T02:00:06.560Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai4math","lean4","llm","theorem-proving"],"created_at":"2026-06-26T19:02:22.407Z","updated_at":"2026-06-26T19:02:28.471Z","avatar_url":"https://github.com/kiranandcode.png","language":"Lean","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"logo.svg\" alt=\"LeanSlop\" width=\"500\"/\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cem\u003eslop slop slop slop slop\u003c/em\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"#quickstart\"\u003eQuickstart\u003c/a\u003e •\n  \u003ca href=\"#configuration\"\u003eConfiguration\u003c/a\u003e •\n  \u003ca href=\"#the-slop-tactic\"\u003eUsage\u003c/a\u003e •\n  \u003ca href=\"#contributing\"\u003eContributing\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\n# LeanSlop: LLM-slop black box automation for the Lean4 theorem prover\nLeanSlop is an LLM-powered proof assistant for Lean 4. It integrates\ndirectly into your editor, allowing you to invoke AI models to help\ncomplete proofs without leaving your workflow. \n\nIn essence, LeanSlop works like this:\n\n- Configure your preferred model (OpenAI, Anthropic, or others) via environment variables.\n- Call `slop?` within any proof to request AI-generated tactic suggestions.\n- LeanSlop analyzes your proof state, queries the model, and returns candidate tactics.\n- Review suggestions inline and accept the ones that work.\n\n## Building\n\nWith [elan](https://github.com/leanprover/elan) installed, `lake build` should suffice.\n\n## Adding LeanSlop to Your Project\n\nTo use LeanSlop in a Lean 4 project, first add this package as a\ndependency. Add the following require in your `lakefile.toml`:\n```toml\n[[require]]\nname = \"leanslop\"\ngit = \"https://github.com/kiranandcode/leanslop\"\n```\n\nFor lake users, instead in your `lakefile.lean`, add\n\n```lean\nrequire leanslop from git \"https://github.com/kiranandcode/leanslop\"\n```\n\nYou also need to make sure that your `lean-toolchain` file contains the same version of Lean 4 as LeanSlop's.\n\nNow set your API key as an environment variable:\n\n```bash\nexport OPENAI_API_KEY=\"sk-...\"\n# or\nexport ANTHROPIC_API_KEY=\"sk-ant-...\"\n```\n\nThe following test file should now compile:\n\n```lean\nimport LeanSlop\n\nexample : α → α := by\n  slop?\n```\n\n## Quickstart\n\nHere's a simple example demonstrating LeanSlop in action:\n\n```lean\nimport LeanSlop\n\n-- Set the model (ensure the appropriate API key is set in your environment)\nset_option slop.model \"gpt-4.1\"\n\ndef sum_upto : Nat → Nat\n  | 0 =\u003e 0\n  | n + 1 =\u003e n + 1 + sum_upto n\n\nexample : 2 * sum_upto n = n * (n + 1) := by\n  slop?\n```\n\nWhen you invoke `slop?`, LeanSlop will:\n\n1. Serialize the current proof state (hypotheses, goal, and relevant context).\n2. Query your configured LLM with a prompt designed for Lean 4 tactic generation.\n3. Parse the model's response and display suggested tactics.\n4. If a suggestion closes the goal, it will be highlighted for easy acceptance.\n\n## Configuration\n\nLeanSlop can be configured via Lean options:\n\n| Option                     | Type   | Default                        | Description                                                               |\n|----------------------------|--------|--------------------------------|---------------------------------------------------------------------------|\n| `slop.model`               | String | `\"claude-sonnet-4-5-20250929\"` | The model to use for `slop?`                                              |\n| `slop.max_refine_attempts` | Int    | `3`                            | The number of times to use Lean compiler feedback to refine LLM responses |\n| `slop.cheap_model`         | String | `claude-haiku-4-5-20251001`    | The model to use for the cheaper `plap?` command.                         |\n| `slop.system_prompt`       | String | ...It's a good prompt ma'am    | The system prompt to send to the LLM in each request                                                                          |\n\nExample configuration:\n\n```lean\nset_option slop.model \"claude-sonnet-4-20250514\"\nset_option slop.max_refine_attempts 3\n```\n\n## Supported Models\n\nLeanSlop supports any OpenAI-compatible or Anthropic API. Set the appropriate environment variable:\n\n| Provider  | Environment Variable | Example Models                                       |\n|-----------|----------------------|------------------------------------------------------|\n| OpenAI    | `OPENAI_API_KEY`     | `gpt-4.1`, `gpt-4o`, `o1`                            |\n| Anthropic | `ANTHROPIC_API_KEY`  | `claude-sonnet-4-20250514`, `claude-opus-4-20250514` |\n\n## The `slop?` Tactic\n\nThe main entry point is the `slop?` tactic. In its simplest form:\n\n```lean\nexample : P → P := by\n  slop?\n```\n\nThe LLM is sent:\n- the entire prefix of the current file so far\n- the definitions of all symbols used in the goal\n- the current goal state\n\nThis means you can proviude hints to the LLM by inserting comments\ninto your lean proof:\n\n```lean\nexample : P ∧ Q → Q ∧ P := by\n  -- try using And.intro and And.left/right\n  slop?\n```\n\n### Accepting Suggestions\n\nWhen `slop?` returns suggestions, you can:\n\n- Click on a suggestion to replace `slop?` with that tactic\n- Copy suggestions to try them manually\n\n## Caveats\n\n- **Cost**: Each `slop?` call makes an API request. Be mindful of usage.\n- **Determinism**: LLM outputs are non-deterministic. The same proof state may yield different suggestions across runs.\n- **Verification**: All suggestions are type-checked by Lean before being shown, but you should still review them for correctness and style.\n\n## Contributing\n\nPull requests are welcome! Make sure your changes build!\n\n```bash\nlake build\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkiranandcode%2Fleanslop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkiranandcode%2Fleanslop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkiranandcode%2Fleanslop/lists"}