Use this theorem
Create a project
lake +leanprover/lean4:v4.35.0 new myproject std.toml cd myprojectStandard template, not
math: themathtemplate adds its own Mathlib requirement pinned to the Lean release tag, not to the Mathlib commit this package is built and tested with, so you would get a second, different Mathlib. Mathlib comes in through this package. Skip this step in an existing project with the same Lean and Mathlib.Add the dependency to
lakefile.toml[[require]] name = "formalizations" git = "https://github.com/karlesmarin/formalizations" rev = "v0.15.0"Import the minimal module
import Formalizations.Reusable.LinearAlgebraIn a file of the project, e.g.
Example.lean.Paste the example
open Formalizations.Reusable Matrix open scoped Kronecker open PowerSeries in open scoped PowerSeries in /-- Integer orthonormal columns are signed unit vectors in distinct rows. -/ example (A : Matrix (Fin 3) (Fin 2) ℤ) (hA : Aᵀ * A = 1) : ∃ f : Fin 2 → Fin 3, Function.Injective f ∧ ∀ j, (fun i => A i j) = Pi.single (f j) 1 ∨ (fun i => A i j) = Pi.single (f j) (-1) := int_columns_of_transpose_mul_self hASteps 3 and 4 together are a complete Lean file:
FormalizationsTest/ReusableLinearAlgebraExample.leanat v0.15.0, compiled by the CI.Fetch and check
lake update lake lean Example.leanlake updatefetches this package and Mathlib, and Mathlib's update hook downloads the compiled Mathlib (lake exe cache get).lake lean Example.leanbuilds the imports of the file (steps 3 and 4) and checks it. If the file belongs to alean_libof your project,lake build <lib>does the same. Avoid a barelake buildin a project from the standard template: its default target is the executable, whose link compiles every imported Mathlib module to native code. Same versions required: Leanv4.35.0, Mathlibf0b4c81.
Alternative: import Formalizations.Reusable imports the whole layer (all areas).
If an integer m × n matrix A satisfies AᵀA = I, every column j is \(±e_{f(j)}\) for an injective f : n → m (signed unit vectors in distinct rows); in particular an integer vector with v·v = 1 is ±e_i. False over ℚ.
Lean statement
theorem int_columns_of_transpose_mul_self {m n : Type*} [Fintype m] [DecidableEq m] [Fintype n]
[DecidableEq n] {A : Matrix m n ℤ} (hA : Aᵀ * A = 1) :
∃ f : n → m, Function.Injective f ∧
∀ j, (fun i => A i j) = Pi.single (f j) 1 ∨ (fun i => A i j) = Pi.single (f j) (-1)Links
- This theorem in
Formalizations/Reusable/LinearAlgebra.lean(lines 259–275 at v0.15.0) - Archive theorem
IntOrthonormal.columns_of_transpose_mul_self - Archive theorem
IntOrthonormal.eq_single_of_dotProduct_self_eq_one - The example in
FormalizationsTest/ReusableLinearAlgebraExample.lean - API documentation (doc-gen4)
Lean docstring
Integer orthonormal columns are signed unit vectors. If an integer m × n matrix satisfies Aᵀ A = 1, then every column j is ± Pi.single (f j) 1 for an injective f : n → m: the nonzero entries of distinct columns lie in distinct rows. The one-vector case (an integer vector with v ⬝ᵥ v = 1 is ± Pi.single i 1) is IntOrthonormal.eq_single_of_dotProduct_self_eq_one. False over ℚ: (3/5, 4/5) has norm one.
- Archive:
IntOrthonormal.columns_of_transpose_mul_self(Formalizations.LinearAlgebra.Matrix.IntOrthonormal; alsoIntOrthonormal.eq_single_of_dotProduct_self_eq_one); a piece of the design table (first step of the integer lengths ofP_H, signed graphs). - Classical reference: textbook (sums of integer squares).
- Example: the columns of
!![0, 1; -1, 0]are-e₁ande₀.
Upstream
Mathlib has signed permutation matrices but not this characterization of integer matrices with orthonormal columns
Depends on, in this repository
None besides the archive module (repo_dependencies = []).