{"id":51428394,"url":"https://github.com/leanprover/hex-row-reduce-mathlib","last_synced_at":"2026-07-05T03:00:29.882Z","repository":{"id":368106718,"uuid":"1283547169","full_name":"leanprover/hex-row-reduce-mathlib","owner":"leanprover","description":"Mathlib correspondence proofs for hex-row-reduce. Published from hex-dev.","archived":false,"fork":false,"pushed_at":"2026-07-03T21:57:48.000Z","size":32,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-07-03T23:27:16.081Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://kim-em.github.io/hex-dev/find/?domain=Verso.Genre.Manual.section\u0026name=hex-row-reduce","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":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-06-29T02:57:41.000Z","updated_at":"2026-07-03T21:57:52.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/leanprover/hex-row-reduce-mathlib","commit_stats":null,"previous_names":["kim-em/hex-row-reduce-mathlib","leanprover/hex-row-reduce-mathlib"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/leanprover/hex-row-reduce-mathlib","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leanprover%2Fhex-row-reduce-mathlib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leanprover%2Fhex-row-reduce-mathlib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leanprover%2Fhex-row-reduce-mathlib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leanprover%2Fhex-row-reduce-mathlib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leanprover","download_url":"https://codeload.github.com/leanprover/hex-row-reduce-mathlib/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leanprover%2Fhex-row-reduce-mathlib/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35141966,"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-07-05T02:00:06.290Z","response_time":100,"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-07-05T03:00:23.112Z","updated_at":"2026-07-05T03:00:29.837Z","avatar_url":"https://github.com/leanprover.png","language":"Lean","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hex-row-reduce-mathlib\n\nPart of [`hex`](https://github.com/kim-em/hex-dev), a computer algebra\nlibrary for Lean 4. The aim is fast executable code, fully verified, built\nwith spec-driven development.\n\n`hex-row-reduce-mathlib` is the Mathlib bridge for\n[`hex-row-reduce`](https://github.com/leanprover/hex-row-reduce). It proves that\nthe executable row reduction, rank, row span, and nullspace agree with\nMathlib's noncomputable linear-algebra definitions. It depends on\n[`hex-row-reduce`](https://github.com/leanprover/hex-row-reduce),\n[`hex-matrix-mathlib`](https://github.com/leanprover/hex-matrix-mathlib), and\nMathlib.\n\n# Quickstart\n\nAdd to your `lakefile.toml`:\n\n```toml\n[[require]]\nname = \"hex-row-reduce-mathlib\"\ngit = \"https://github.com/leanprover/hex-row-reduce-mathlib.git\"\nrev = \"main\"\n```\n\n```lean\nimport HexRowReduceMathlib\n\nopen HexMatrixMathlib\n\n-- The computed rank agrees with Mathlib's `Matrix.rank`.\n#check @rank_eq\n\n-- The computed nullspace basis spans exactly the kernel of `mulVecLin`.\n#check @nullspace_span_eq_ker\n\n-- The executable span-membership test agrees with `Submodule.span`.\n#check @spanContains_iff_mem_span\n```\n\n# Functionality\n\nThe library transports the executable row-reduction data of an\n`Hex.Matrix R n m` to Mathlib's function-based matrix `matrixEquiv M`, then\nstates the correspondence theorems:\n\n- `vectorEquiv_rowCombination`: an executable row combination transports to\n  Mathlib's `Fintype.linearCombination` over the rows of `matrixEquiv M`;\n- `spanCoeffs_eq_linearCombination` and `spanContains_iff_mem_span`: the\n  executable span witnesses and the decidable span-membership test agree with\n  `Submodule.span`;\n- `rowReduce_echelon_row_mem_span` and\n  `rowReduce_mem_span_echelon_of_mem_span`: row reduction preserves the row\n  span, in both directions;\n- `nullspace_mem_ker` and `nullspace_span_eq_ker`: the computed nullspace\n  basis lies in, and spans, `LinearMap.ker (Matrix.mulVecLin (matrixEquiv M))`;\n- `rank_eq`: the rank from row reduction equals `Matrix.rank (matrixEquiv M)`.\n\n# Verification\n\nOver a `Field R`, the correspondence is fully proven. The computed rank,\nrow span, and nullspace are computable witnesses for Mathlib's noncomputable\n`Matrix.rank`, `Submodule.span`, and `LinearMap.ker` definitions.\n\nRank, `rank_eq`:\n\n```lean\ntheorem rank_eq [Field R]\n    {M : Hex.Matrix R n m} {D : Hex.Matrix.RowEchelonData R n m}\n    (E : Hex.Matrix.IsRowReduced M D) :\n    D.rank = _root_.Matrix.rank (matrixEquiv M)\n```\n\nNullspace, `nullspace_span_eq_ker`:\n\n```lean\ntheorem nullspace_span_eq_ker [Field R]\n    {M : Hex.Matrix R n m} {D : Hex.Matrix.RowEchelonData R n m}\n    (E : Hex.Matrix.IsRowReduced M D) :\n    Submodule.span R (Set.range fun k : Fin (m - D.rank) =\u003e vectorEquiv (E.nullspace.get k)) =\n      LinearMap.ker (_root_.Matrix.mulVecLin (matrixEquiv M))\n```\n\nSpan, `spanContains_iff_mem_span`:\n\n```lean\ntheorem spanContains_iff_mem_span [Field R] [DecidableEq R]\n    {M : Hex.Matrix R n m} {D : Hex.Matrix.RowEchelonData R n m}\n    (E : Hex.Matrix.IsRowReduced M D) (v : Vector R m) :\n    E.toIsEchelonForm.spanContains v = true ↔\n      vectorEquiv v ∈ Submodule.span R (Set.range (_root_.Matrix.row (matrixEquiv M)))\n```\n\nThe executable row reduction itself lives in\n[`hex-row-reduce`](https://github.com/leanprover/hex-row-reduce).\n\n# Reference manual\n\nThe hex reference manual covers this library and its computational base at\n\u003chttps://kim-em.github.io/hex-dev/find/?domain=Verso.Genre.Manual.section\u0026name=hex-row-reduce\u003e.\n\n# Contributing\n\nDevelopment happens in the [`hex-dev`](https://github.com/kim-em/hex-dev)\nmonorepo, not in this published mirror. Contributions are welcome as pull\nrequests to the `SPEC/` directory: describe the behaviour you want, and\nleave the implementation to the maintainer.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleanprover%2Fhex-row-reduce-mathlib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleanprover%2Fhex-row-reduce-mathlib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleanprover%2Fhex-row-reduce-mathlib/lists"}