Summer 2025 REU on Formalization
This post supplements the post here
Here I'm going to give examples of results formalized by the students
during the summer program; (the actual proof(s) are elided here --
that is what the statement sorry is all about -- but can be found
in the repo).
We spent much of the time formalizing statements in linear algebra, for example in the following setting:
noncomputable section
open Module
open LinearMap
open LinearMap (BilinForm)
-- V, V₁ and V₂ are vector spaces over the field k
variable {k V V₁ V₂ :Type} [Field k]
[AddCommGroup V] [Module k V]
[AddCommGroup V₁] [Module k V₁]
[AddCommGroup V₂] [Module k V₂]
-- an isometry between (V₁,β₁) and (V₂,β₂) is a linear equivalence
-- V₁ ≃ₗ[k] V₂ together with a proof that this equivalence is compatible
-- with the given bilinear forms
structure Isometries
(β₁:BilinForm k V₁)
(β₂:BilinForm k V₂)
where
-- the linear equivalence
equiv : V₁ ≃ₗ[k] V₂
-- the compatibility assertion
compat : ∀ (x y : V₁), β₁ x y = β₂ (equiv x) (equiv y)
-- Notation so that `V₁ ≃[k,β₁,β₂] V₂` denotes `Isometries β₁ β₂`
notation:100 lhs:100 "≃[" field:100 "," lhb:100 ","
rhb:100 "]" rhs:100 =>
Isometries (k:= field) (V₁ := lhs) (V₂ := rhs) lhb rhb
isometries via bases
If
(V_1,\beta_1)and(V_2,\beta_2)are pairs consisting of a finite dimensional vector space together with a bilinear form, then there is an isometry betweenV_1andV_2if and only if there are basesb_1ofV_1andb_2ofV_2such that the matrix of\beta_1with respect tob_1is the same as the matrix of\beta_2with respect tob_2.
Here is the formal statement:
theorem equiv_via_matrices {ι:Type} [Fintype ι] [DecidableEq ι]
(β₁ : BilinForm k V₁) (β₂ : BilinForm k V₂)
(b₁ : Basis ι k V₁) :
Nonempty (V₁ ≃[k,β₁,β₂] V₂) ↔ ∃ b₂:Basis ι k V₂,
(BilinForm.toMatrix b₁ β₁) = (BilinForm.toMatrix b₂ β₂) := k:TypeV₁:TypeV₂:Typeinst✝⁶:Field kinst✝⁵:AddCommGroup V₁inst✝⁴:Module k V₁inst✝³:AddCommGroup V₂inst✝²:Module k V₂ι:Typeinst✝¹:Fintype ιinst✝:DecidableEq ιβ₁:BilinForm k V₁β₂:BilinForm k V₂b₁:Basis ι k V₁⊢ Nonempty (Isometries β₁ β₂) ↔ ∃ b₂, (BilinForm.toMatrix b₁) β₁ = (BilinForm.toMatrix b₂) β₂ All goals completed! 🐙
characterization of non-degenerate alternating forms
Any two non-degenerate alternating bilinear forms on spaces of the same dimension are equivalent.
def alternate_iso
{β₁: BilinForm k V₁} {β₂: BilinForm k V₂}
(balt₁: IsAlt β₁) (balt₂: IsAlt β₂)
(hd₁: β₁.Nondegenerate) (hd₂: β₂.Nondegenerate)
[FiniteDimensional k V₁] [FiniteDimensional k V₂]
(h: Module.finrank k V₁ = Module.finrank k V₂) :
V₁ ≃[k,β₁,β₂] V₂ := k:TypeV:TypeV₁:TypeV₂:Typeinst✝⁸:Field kinst✝⁷:AddCommGroup Vinst✝⁶:Module k Vinst✝⁵:AddCommGroup V₁inst✝⁴:Module k V₁inst✝³:AddCommGroup V₂inst✝²:Module k V₂β₁:BilinForm k V₁β₂:BilinForm k V₂balt₁:IsAlt β₁balt₂:IsAlt β₂hd₁:β₁.Nondegeneratehd₂:β₂.Nondegenerateinst✝¹:FiniteDimensional k V₁inst✝:FiniteDimensional k V₂h:finrank k V₁ = finrank k V₂⊢ Isometries β₁ β₂
All goals completed! 🐙
characterization of reflexive forms
A bilinear form
βis reflexive ifβ(x,y) = 0 \Rightarrow β(y,x) = 0for everyx,y \in V.
Any reflexive form is either alternating -- i.e. β(x,x) = 0 for
every x -- or symmetric -- i.e. β(x,y) = β(y,x) for all x,y.
theorem refl_is_alt_or_symm {β: BilinForm k V} (h: β.IsRefl)
[FiniteDimensional k V] :
β.IsAlt ∨ β.IsSymm := k:TypeV:Typeinst✝³:Field kinst✝²:AddCommGroup Vinst✝¹:Module k Vβ:BilinForm k Vh:β.IsReflinst✝:FiniteDimensional k V⊢ β.IsAlt ∨ β.IsSymm All goals completed! 🐙
Cassels-Pfister Theorem
Let φ be a quadratic form on the vector space
Vand letf \in k[X]. If there is a vectorv \in V \otimes_k k(X)such that\phi(v) = fthen there is a vectorw \in V \otimes_k k[X]such that\phi(w) = f.
(see [Elman, Karpenko & Merkurjev, "The algebraic and geometric theory of quadratic forms", Theorem 17.3]).
open Polynomial -- so we can write k[X] for `Polynomial k`
theorem cassels_pfister (φ : QuadraticForm k V) [Invertible (2 : k)]
(f : k[X]) (v : TensorProduct k (RatFunc k) V)
(h : φ.baseChange (RatFunc k) v = f) :
∃ (w : TensorProduct k k[X] V), φ.baseChange k[X] w = f := k:TypeV:Typeinst✝³:Field kinst✝²:AddCommGroup Vinst✝¹:Module k Vφ:QuadraticForm k Vinst✝:Invertible 2f:k[X]v:TensorProduct k (RatFunc k) Vh:(QuadraticForm.baseChange (RatFunc k) φ) v = ↑f⊢ ∃ w, (QuadraticForm.baseChange k[X] φ) w = f All goals completed! 🐙
A formalized proof can be found in the repository, here.