Zulip Chat Archive
Stream: maths
Topic: Is Finset totally ordered?
Christopher Hoskin (Oct 01 2023 at 22:54):
Given an arbitrary (ι : Type*)
, given (F : Finset ι)
is it possible to pick some 1,...,n
in ℕ
to represent the elements of F
? Or more generally to totally order the elements of F
?
(Given a Quadratic map Q
and an element a
of a free module, I'm wondering if it's possible to represent Q(a)
as an upper triangular matrix?)
Alex J. Best (Oct 01 2023 at 23:00):
There are some equivalences defined near https://leanprover-community.github.io/mathlib4_docs/Mathlib/Data/Fintype/Card.html#Finset.equivFin that might be helpful
Christopher Hoskin (Oct 02 2023 at 06:44):
Ah, thanks! This makes sense:
variable (ι : Type*)
variable (F : Finset ι)
variable (a b : ι) (ha: a ∈ F) (hb : b ∈ F )
#check F.equivFin.toFun ⟨a,ha⟩ < F.equivFin.toFun ⟨b,hb⟩
Vincent Beffara (Oct 02 2023 at 06:51):
Or you could use docs#Finset.toList
Christopher Hoskin (Oct 02 2023 at 07:15):
For block matrices I need a map into a Type with LT
https://github.com/leanprover-community/mathlib4/blob/master/Mathlib/LinearAlgebra/Matrix/Block.lean#L55 so I think F.equivFin.toFun
works better for that?
Christopher Hoskin (Oct 02 2023 at 22:05):
After spending the evening thinking about it, this is where I've got to:
variable {ι : Type*}
variable {R : Type*} [CommSemiring R]
variable (Q : QuadraticForm R (ι →₀ R))
noncomputable def e (i : ι) : (ι →₀ R) := Finsupp.single i (1 : R)
noncomputable def UTmatrix (a : (ι →₀ R)) : Matrix ι ι R := Matrix.of fun i j =>
haveI := Classical.decEq ι
if H : i ∈ a.support ∧ j ∈ a.support then
if (a.support.equivFin.toFun ⟨i,H.1⟩) = (a.support.equivFin.toFun ⟨j,H.2⟩) then
Q (e i)
else if (a.support.equivFin.toFun ⟨i,H.1⟩) < (a.support.equivFin.toFun ⟨j,H.2⟩) then
Q.exists_companion.choose (e i) (e j)
else
(0 : R)
else
(0 : R)
Eric Wieser (Oct 02 2023 at 22:49):
You should drop the .toFun
s there, that's not the preferred spelling
Christopher Hoskin (Jul 20 2024 at 08:07):
Antoine Chambert-Loir (Jul 20 2024 at 12:39):
Isn't it simpler to just assume a LinearOrder on iota? Which could be transferred via equivFin if necessary?
Eric Wieser (Jul 20 2024 at 12:42):
Antoine, I'm not quite sure if you're responding to the original or most recent message, but docs#QuadraticMap.toBilin assumes a linear order, while the non-constructive docs#LinearMap.BilinMap.toQuadraticMap_surjective does not.
Eric Wieser (Jul 20 2024 at 12:42):
(those links won't become valid for a few hours)
Eric Wieser (Jul 20 2024 at 12:45):
Regarding the original question, it does seem like there should be a Fintype ι → Trunc (LinearOrder ι)
somewhere.
Eric Wieser (Jul 20 2024 at 12:46):
But as you say, you could just make do with the equiv with Fin
and do your work there instead
Antoine Chambert-Loir (Jul 20 2024 at 16:54):
I was indeed responding to a mixture of the most recent messages, sorry.
Antoine Chambert-Loir (Jul 20 2024 at 16:57):
Regarding the usefulness of some Fintype ι → Trunc (LinearOrder ι)
, there are many instances of this kind to have (one for every abstract existence theorem), and it is probably tedious to enter them all by hand. (Well orderings, bases, fixed points, minimal elements, etc.) What would be a sustainable design so that they are easily accessed, in a relatively standard way, without any risk of missing one.
Antoine Chambert-Loir (Jul 20 2024 at 16:59):
For example, docs#Finite.equivFin is just an invocation of docs#Finite.exists_equiv_fin. It would probably be nice to have them created using a @[choose]
tag.
Last updated: May 02 2025 at 03:31 UTC