{"id":51527129,"url":"https://github.com/leanprover/hex-gram-schmidt-mathlib","last_synced_at":"2026-07-08T23:00:29.284Z","repository":{"id":367252948,"uuid":"1279164696","full_name":"leanprover/hex-gram-schmidt-mathlib","owner":"leanprover","description":"Mathlib correspondence proofs for hex-gram-schmidt","archived":false,"fork":false,"pushed_at":"2026-07-08T04:24:37.000Z","size":315,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-07-08T06:09:52.207Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://kim-em.github.io/hex-dev/find/?domain=Verso.Genre.Manual.section\u0026name=hex-gram-schmidt","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-24T12:38:05.000Z","updated_at":"2026-07-08T04:24:41.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/leanprover/hex-gram-schmidt-mathlib","commit_stats":null,"previous_names":["kim-em/hex-gram-schmidt-mathlib","leanprover/hex-gram-schmidt-mathlib"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/leanprover/hex-gram-schmidt-mathlib","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leanprover%2Fhex-gram-schmidt-mathlib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leanprover%2Fhex-gram-schmidt-mathlib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leanprover%2Fhex-gram-schmidt-mathlib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leanprover%2Fhex-gram-schmidt-mathlib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leanprover","download_url":"https://codeload.github.com/leanprover/hex-gram-schmidt-mathlib/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leanprover%2Fhex-gram-schmidt-mathlib/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:19.321Z","updated_at":"2026-07-08T23:00:29.277Z","avatar_url":"https://github.com/leanprover.png","language":"Lean","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hex-gram-schmidt-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-gram-schmidt-mathlib` is the Mathlib bridge for\n[`hex-gram-schmidt`](https://github.com/leanprover/hex-gram-schmidt). It\nidentifies the executable dense-matrix Gram-Schmidt basis with Mathlib's\n`InnerProductSpace.gramSchmidt`, and the fraction-free integer\ncoefficients with Bareiss determinants. It depends on\n[`hex-gram-schmidt`](https://github.com/leanprover/hex-gram-schmidt) and on\nMathlib.\n\n# Quickstart\n\nAdd to your `lakefile.toml`:\n\n```toml\n[[require]]\nname = \"hex-gram-schmidt-mathlib\"\ngit = \"https://github.com/leanprover/hex-gram-schmidt-mathlib.git\"\nrev = \"main\"\n```\n\n```lean\nimport HexGramSchmidtMathlib\n\nopen Hex\n\n-- Each row of the executable integer Gram-Schmidt basis matches Mathlib's\n-- `gramSchmidt` after casting the row into Euclidean space.\n#check @GramSchmidtMathlib.int_basis_row_eq_gramSchmidt\n\n-- Mathlib's real inner product agrees with the executable rational dot product.\n#check @GramSchmidtMathlib.rowToEuclidean_inner\n\n-- The fraction-free integer coefficients are Bareiss determinants.\n#check @GramSchmidt.Int.scaledCoeffs_eq_scaledCoeffMatrix_bareiss\n```\n\n# Functionality\n\nThe proof-facing API splits into two parts.\n\n- The view `GramSchmidtMathlib.rowToEuclidean` from a rational dense row\n  into `EuclideanSpace ℝ (Fin m)`, with its additivity, scaling, and\n  inner-product transfer lemmas (`rowToEuclidean_add`,\n  `rowToEuclidean_smul`, `rowToEuclidean_inner`).\n- The rowwise correspondences `rat_basis_row_eq_gramSchmidt` and\n  `int_basis_row_eq_gramSchmidt` between the executable basis and Mathlib's\n  `InnerProductSpace.gramSchmidt`.\n- The integer determinantal layer: `gramDet_eq_prod_normSq`,\n  `scaledCoeffs_eq_scaledCoeffMatrix_bareiss`, and `scaledCoeffs_eq`,\n  relating the leading Gram determinants and the scaled coefficients to\n  Bareiss determinants of the [`hex-matrix`](https://github.com/leanprover/hex-matrix)\n  Gram matrices.\n\n# Verification\n\nThe rowwise correspondence with Mathlib's orthogonalization is fully\nproven. Over the rationals:\n\n```lean\ntheorem rat_basis_row_eq_gramSchmidt (b : Matrix Rat n m) (i : Fin n) :\n    rowToEuclidean ((Hex.GramSchmidt.Rat.basis b).row i) =\n      InnerProductSpace.gramSchmidt ℝ (ratRowFamily b) i\n```\n\nand the integer version, casting the integer rows first:\n\n```lean\ntheorem int_basis_row_eq_gramSchmidt (b : Matrix Int n m) (i : Fin n) :\n    rowToEuclidean ((Hex.GramSchmidt.Int.basis b).row i) =\n      InnerProductSpace.gramSchmidt ℝ (intRowFamily b) i\n```\n\nThe fraction-free integer surface is identified with Bareiss\ndeterminants. Below the diagonal the scaled coefficients are exactly:\n\n```lean\ntheorem scaledCoeffs_eq_scaledCoeffMatrix_bareiss\n    (b : Matrix Int n m) (i j : Fin n) (hji : j.val \u003c i.val) :\n    GramSchmidt.entry (scaledCoeffs b) i j =\n      Matrix.bareiss (GramSchmidt.scaledCoeffMatrix b i j hji)\n```\n\nand for an independent matrix the leading Gram determinant is the product\nof squared Gram-Schmidt norms:\n\n```lean\ntheorem gramDet_eq_prod_normSq (b : Matrix Int n m)\n    (hli : independent b) (k : Nat) (hk : k ≤ n) :\n    (gramDet b k hk : Rat) = gramSchmidtNormProduct b k hk\n```\n\nThe executable Gram-Schmidt algorithm and its own algebraic API live in\n[`hex-gram-schmidt`](https://github.com/leanprover/hex-gram-schmidt).\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-gram-schmidt\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-gram-schmidt-mathlib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleanprover%2Fhex-gram-schmidt-mathlib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleanprover%2Fhex-gram-schmidt-mathlib/lists"}