{"id":50731329,"url":"https://github.com/leanprover/lp-tactic","last_synced_at":"2026-06-10T09:00:50.148Z","repository":{"id":359328994,"uuid":"1245449209","full_name":"leanprover/lp-tactic","owner":"leanprover","description":"The by lp and maximize tactics, LPBackend registry, solveVerified drivers. Factored out of kim-em/soplex (issue #50).","archived":false,"fork":false,"pushed_at":"2026-06-09T02:14:48.000Z","size":137,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-09T02:18:26.442Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Lean","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leanprover.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-05-21T08:25:52.000Z","updated_at":"2026-06-09T02:14:51.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/leanprover/lp-tactic","commit_stats":null,"previous_names":["kim-em/lp-tactic","leanprover/lp-tactic"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/leanprover/lp-tactic","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leanprover%2Flp-tactic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leanprover%2Flp-tactic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leanprover%2Flp-tactic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leanprover%2Flp-tactic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leanprover","download_url":"https://codeload.github.com/leanprover/lp-tactic/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leanprover%2Flp-tactic/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34144680,"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-10T02:00:07.152Z","response_time":89,"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":[],"created_at":"2026-06-10T09:00:28.089Z","updated_at":"2026-06-10T09:00:50.138Z","avatar_url":"https://github.com/leanprover.png","language":"Lean","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LPTactic\n\n[![Lean](https://img.shields.io/badge/Lean-4.31.0--rc1-blue.svg)](./lean-toolchain)\n[![License](https://img.shields.io/github/license/leanprover/lp-tactic.svg)](./LICENSE)\n\n\u003e **New here? Start at [`leanprover/lp`](https://github.com/leanprover/lp)** — the entry\n\u003e point for the `lp` / `maximize` tactics and the verified LP solver. This repository is one\n\u003e package of that family: the tactics and the backend registry.\n\nThe `by lp` and `maximize` tactics — Π₂ linear-rational-arithmetic\ngoals reduced to LP solves, with the dual multipliers reconstructed\ninto kernel-checked Lean proof terms — plus the `LPBackend` registry\n(`registerBackend`, `resolveBackend`, `availableBackends`), the\ndefault-backend dispatcher (`LP.dispatchSolveExact`), and\nthe backend-pluggable verified-solve driver (`solveVerifiedWith`).\n\n**No `moreLinkArgs`. No FFI dependency.** All solver calls go\nthrough `LPBackend` values fetched from the registry. A consumer\nwho only wants to verify externally-produced certificates can\ndepend on this package plus\n[`leanprover/lp-verify`](https://github.com/leanprover/lp-verify) with zero\nnative deps. For an actual default-FFI `by lp`, also depend on\n[`leanprover/lp-backend-soplex-ffi`](https://github.com/leanprover/lp-backend-soplex-ffi)\n(or use the meta-package\n[`leanprover/lp`](https://github.com/leanprover/lp), which bundles\nthe FFI backend by default).\n\n## Quickstart\n\n```lean\nrequire LPTactic from git \"https://github.com/leanprover/lp-tactic\" @ \"main\"\nrequire LPBackendSoplexFFI from git\n  \"https://github.com/leanprover/lp-backend-soplex-ffi\" @ \"main\"\n```\n\n```lean\nimport LPTactic\nimport LPBackendSoplexFFI  -- self-registers \"soplex-ffi\" at priority 10\n\nexample (a b : Rat) (_ : 2 * a + b ≤ 5) (_ : a - b ≤ 1) :\n    3 * a ≤ 6 := by lp\n```\n\nWithout any backend registered, `by lp` reports a structured\n\"no usable backend\" diagnostic listing every registered backend and\nits probe verdict — so the failure mode is obvious.\n\n## Carriers\n\n`by lp` and `maximize` work over a family of ordered carriers, not just `Rat`:\n\n- **`Rat`, `Int`, `Dyadic`, `Nat`** — out of the box (core types).\n- **`Real`, or any `Lean.Grind` ordered field of characteristic 0** — once\n  Mathlib is imported (it supplies the instances).\n\n```lean\nexample (a b : Int) (_ : 2 * a + b ≤ 5) (_ : a - b ≤ 1) : 3 * a ≤ 6 := by lp\nexample (a b : Nat) (_ : 2 * a + b ≤ 5) (_ : a + b ≤ 3) : 3 * a + 2 * b ≤ 8 := by lp\n-- with `import Mathlib`:\nexample (a b : ℝ)  (_ : 2 * a + b ≤ 5) (_ : a - b ≤ 1) : 3 * a ≤ 6 := by lp\n```\n\nThe LP sent to the solver is always over ℚ; only the reconstructed proof term is\nover the carrier. `lp` proves ℚ-valid (Farkas) implications — integrality and\ncuts stay with `omega`/`cutsat`, so `Nat` subtraction (truncating) and `Int`/`Nat`\ndivision are rejected rather than mis-modelled.\n\n## Layout\n\n```\nLPTactic.lean              # top-level import\nLPTactic/Basic.lean        # solveVerifiedWith, defaultDenomBudget\nLPTactic/Registry.lean     # registerBackend, resolveBackend, availableBackends\nLPTactic/Dispatch.lean     # dispatchSolveExact (registry-driven default)\nLPTactic/Q.lean            # kernel-reducible rational literals\nLPTactic/LP.lean           # `lp` and `maximize` tactic frontend\nLPTactic/LP/Types.lean     # LinExpr + parser/normalizer lemma toolkit\nLPTactic/LP/Parse.lean     # goal parsing\nLPTactic/LP/Problem.lean   # tactic-side Problem construction\nLPTactic/LP/Atomic.lean    # direct-certificate path + carrier dispatch\nLPTactic/LP/Exists.lean    # existential-witness LP path\nLPTactic/LP/Forall.lean    # inner-∀ + Benders subproblem paths\nLPTactic/LP/Maximize.lean  # `maximize` tactic body\nLPTactic/LP/BackendOption.lean\n                           # the `lp.backend` option + per-call override\nLPTactic/LP/Certificate.lean\n                           # Q-literal rendering + residual helpers (Rat groundwork)\nLPTactic/LP/CarrierCertificate.lean\n                           # the carrier-parametrized certificate engine (CarrierMethods)\nLPTactic/LP/CarrierLemmas.lean\n                           # macros stamping out the per-carrier monomorphic lemma blocks\nLPTactic/LP/RingCertificate.lean\n                           # shared ordered-comm-ring assembly (Int, Dyadic)\nLPTactic/LP/RatCertificate.lean,   (lemmas in Types.lean)\nLPTactic/LP/IntCertificate.lean,   IntGeneric.lean\nLPTactic/LP/NatCertificate.lean,   NatGeneric.lean\nLPTactic/LP/DyadicCertificate.lean, DyadicGeneric.lean\nLPTactic/LP/FieldCertificate.lean, FieldGeneric.lean\n                           # per-carrier engine instances + their static lemmas\nLPTactic/LP/Frontend.lean  # syntax elaboration entry point\nLPTacticTest/              # `lake test` suites (registry + goal shapes)\n```\n\nDeclarations live under `namespace LP` (public API such as\n`LP.solveVerifiedWith` and the registry) and\n`namespace LP.Tactic.LP` (tactic internals), so consumers writing\n`LP.solveVerifiedWith` or `by lp` resolve to the same definitions\nregardless of which package owns them. The synchronous,\nFFI-specialised `LP.solveVerified` (`Except`-typed) lives in\n`leanprover/lp-backend-soplex-ffi`, not here.\n\n## Licence\n\n[Apache License 2.0](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleanprover%2Flp-tactic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleanprover%2Flp-tactic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleanprover%2Flp-tactic/lists"}