{"id":51527127,"url":"https://github.com/leanprover/hex-row-reduce","last_synced_at":"2026-07-08T23:00:28.877Z","repository":{"id":368106641,"uuid":"1283537836","full_name":"leanprover/hex-row-reduce","owner":"leanprover","description":"Executable row reduction (RREF) and span/nullspace over hex-matrix. Mathlib-free. Published from hex-dev.","archived":false,"fork":false,"pushed_at":"2026-07-08T06:25:29.000Z","size":146,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-07-08T08:11:59.689Z","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:42:46.000Z","updated_at":"2026-07-08T06:25:33.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/leanprover/hex-row-reduce","commit_stats":null,"previous_names":["kim-em/hex-row-reduce","leanprover/hex-row-reduce"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/leanprover/hex-row-reduce","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leanprover%2Fhex-row-reduce","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leanprover%2Fhex-row-reduce/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leanprover%2Fhex-row-reduce/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leanprover%2Fhex-row-reduce/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leanprover","download_url":"https://codeload.github.com/leanprover/hex-row-reduce/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leanprover%2Fhex-row-reduce/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35280682,"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-08T02:00:06.796Z","response_time":61,"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-08T23:00:17.698Z","updated_at":"2026-07-08T23:00:28.861Z","avatar_url":"https://github.com/leanprover.png","language":"Lean","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hex-row-reduce\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` provides Gauss-Jordan row reduction to reduced row echelon\nform over a field, together with row-span and nullspace computations built on\nit. This library depends only on [`hex-matrix`](https://github.com/leanprover/hex-matrix).\nSee [`hex-row-reduce-mathlib`](https://github.com/leanprover/hex-row-reduce-mathlib)\nfor the correspondence with Mathlib's types and theory.\n\n# Quickstart\n\nAdd to your `lakefile.toml`:\n\n```toml\n[[require]]\nname = \"hex-row-reduce\"\ngit = \"https://github.com/leanprover/hex-row-reduce.git\"\nrev = \"main\"\n```\n\n```lean\nimport HexRowReduce\n\nopen Hex\n\n-- A 2×3 matrix over the rationals with a dependent second row.\ndef M : Matrix Rat 2 3 := Matrix.ofFn fun i j =\u003e (i + 1) * (j + 1 : Rat)\n\n#eval (Matrix.rowReduce M).rank          -- 1, the rank\n#eval (Matrix.rowReduce M).echelon       -- the reduced row echelon form\n#eval (Matrix.rowReduce M).transform     -- T with T * M = echelon\n\n#eval Matrix.spanContains M (Vector.ofFn fun j =\u003e (j + 1 : Rat))  -- true\n#eval Matrix.spanCoeffs M (Vector.ofFn fun j =\u003e (j + 1 : Rat))    -- the coefficients\n\n#eval Matrix.nullspace M                 -- a basis for the nullspace\n```\n\n# Functionality\n\n- `rowReduce`: Gauss-Jordan reduction of a matrix over a field, returning the\n  rank, the reduced row echelon form, the invertible transform matrix, and the\n  pivot columns;\n- `rowReduce_rank`: the rank read off the reduction;\n- `spanCoeffs` and `spanContains`: solve for row-combination coefficients of a\n  vector, or test row-span membership;\n- `rowCombination`: the linear combination of the rows of a matrix;\n- `nullspace` and `nullspaceBasisMatrix`: a basis for the nullspace, one vector\n  per free column, as a vector of vectors or as a matrix of columns.\n\n# Verification\n\nOver a field the reduction is fully proven. The headline theorem states that\n`rowReduce` always meets the reduced-row-echelon contract `IsRowReduced` (pivots\nsorted and equal to 1, all other pivot-column entries zero, trailing rows zero,\nand an invertible transform with `transform * M = echelon`):\n\n```lean\ntheorem rowReduce_isRowReduced (M : Matrix R n m) : IsRowReduced M (rowReduce M)\n```\n\nThe row-span wrappers are sound, with `spanCoeffs_sound`:\n\n```lean\ntheorem spanCoeffs_sound [Lean.Grind.Field R] [DecidableEq R]\n    (M : Matrix R n m) (v : Vector R m) (c : Vector R n) :\n    spanCoeffs M v = some c → rowCombination M c = v\n```\n\nThe nullspace basis is both sound and complete, `nullspace_sound` and\n`nullspace_complete`:\n\n```lean\ntheorem nullspace_sound [Lean.Grind.Field R] [DecidableEq R] (M : Matrix R n m)\n    (k : Fin (m - rowReduce_rank M)) :\n    M * (nullspace M).get k = 0\n\ntheorem nullspace_complete [Lean.Grind.Field R] [DecidableEq R] (M : Matrix R n m)\n    (v : Vector R m) :\n    M * v = 0 → ∃ c : Vector R (m - rowReduce_rank M), nullspaceBasisMatrix M * c = v\n```\n\nThe identification with Mathlib's linear-algebra theory lives in\n[`hex-row-reduce-mathlib`](https://github.com/leanprover/hex-row-reduce-mathlib).\n\n# Reference manual\n\nThe hex reference manual covers this library 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","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleanprover%2Fhex-row-reduce","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleanprover%2Fhex-row-reduce/lists"}