Zulip Chat Archive

Stream: new members

Topic: Norm Problem


Wenjie Huang (Jul 26 2025 at 09:06):

Who can help me?
How to prove that the norm of a matrix power is less than or equal to the power of the matrix norm?
Thanks for any guidance!

import Mathlib


variable {n : }
variable [NormedAddCommGroup (Fin n  )] [NormedSpace  (Fin n  )]
variable [NormedRing (Matrix (Fin n) (Fin n) )] [NormedAlgebra  (Matrix (Fin n) (Fin n) )]
variable [NormOneClass (Matrix (Fin n) (Fin n) )]

example  {M : (Matrix (Fin n) (Fin n) )} (k : ) : M ^ k  M ^ k := by
  apply norm_pow_le M k -- why it fails?
  /- failed to synthesize
  NormOneClass (Matrix (Fin n) (Fin n) ℝ)
  -/

Eric Wieser (Jul 26 2025 at 09:18):

Which norm do you want?

Wenjie Huang (Jul 26 2025 at 09:21):

I want this to hold true for the matrix norm.

Eric Wieser (Jul 26 2025 at 09:23):

What you've written above says "let Fin n → ℝ have an arbitrary meaning of + that isn't the natural one".

Wenjie Huang (Jul 26 2025 at 09:26):

sorry, I'll delete this condition. I want this for arbitrary matrix norm.

import Mathlib


variable {n : }
variable [NormedRing (Matrix (Fin n) (Fin n) )] [NormedAlgebra  (Matrix (Fin n) (Fin n) )]
variable [NormOneClass (Matrix (Fin n) (Fin n) )]

example  {M : (Matrix (Fin n) (Fin n) )} (k : ) : M ^ k  M ^ k := by
  apply norm_pow_le M k -- why it fails?
  /- failed to synthesize
  NormOneClass (Matrix (Fin n) (Fin n) ℝ)
  -/

Eric Wieser (Jul 26 2025 at 09:37):

[NormedRing (Matrix (Fin n) (Fin n) ℝ)] says "let matrices have an arbitrary meaning of * and +", unfortunately

Wenjie Huang (Jul 26 2025 at 09:40):

How can I modify this? I want the matrix to maintain its usual ring structure

Eric Wieser (Jul 26 2025 at 09:52):

There is currently no existing way to say "let this existing ring have an arbitrary compatible norm"

Eric Wieser (Jul 26 2025 at 09:52):

If you're happy to pick a particular matrix norm, then you can make things work

Eric Wieser (Jul 26 2025 at 09:56):

docs#Matrix.linftyOpNormedRing is one such norm

Wenjie Huang (Jul 26 2025 at 10:42):

Thanks for your help.
I really need a conclusion that holds for any norm, because I want to prove some conclusions about the convergence of matrix sequences. Is there really no way?

Kenny Lau (Jul 26 2025 at 10:56):

hmm is there a possible argument to be made to unmix norm and ring?

Kenny Lau (Jul 26 2025 at 10:56):

will we ever need to talk about two norms at the same time?

Kenny Lau (Jul 26 2025 at 10:57):

or i guess in this case, two matrix norms (since WithLp wouldnt work on matrix)

Kenny Lau (Jul 26 2025 at 10:58):

Wenjie Huang said:

Thanks for your help.
I really need a conclusion that holds for any norm, because I want to prove some conclusions about the convergence of matrix sequences. Is there really no way?

you can instead prove that in any normed ring, ||x^k|| <= ||x||^k.

Kenny Lau (Jul 26 2025 at 10:58):

it has nothing to do with matrixes

Wenjie Huang (Jul 26 2025 at 11:07):

Yes, I also want to separate the matrix ring and the norm, but our proof of the convergence of the matrix sequence requires the properties of both the matrix and the norm. This is a small part of it, which has nothing to do with the specifics of the matrix, but the whole needs

Kenny Lau (Jul 26 2025 at 11:15):

then why cant you just use the default norm

Wenjie Huang (Jul 26 2025 at 11:18):

I want this proof holds universally for any norm, thereby avoiding the need for repeated derivations across different norm specifications.

Kenny Lau (Jul 26 2025 at 11:19):

but we will only ever have one matrix norm

Kenny Lau (Jul 26 2025 at 11:19):

also, could you tell us what is the actual result you want to prove?

Kenny Lau (Jul 26 2025 at 11:19):

convergence kind of requires completeness

Kenny Lau (Jul 26 2025 at 11:20):

and if you’re complete, then any norms are equivalent right

Wenjie Huang (Jul 26 2025 at 11:20):

I want to prove that the spectral radius of a matrix is less than or equal to any norm of the matrix

Kenny Lau (Jul 26 2025 at 11:21):

could you be more specific about “any norm”?

Wenjie Huang (Jul 26 2025 at 11:22):

What I want to prove is that the matrix norm is compatible with the matrix ring.

Aaron Liu (Jul 26 2025 at 11:22):

Can't you just arbitrarily scale the norm to be smaller than the spectral radius?

Aaron Liu (Jul 26 2025 at 11:23):

If it really is "any" norm

Kenny Lau (Jul 26 2025 at 11:24):

can you define the “norm”s in your sentence?

Kenny Lau (Jul 26 2025 at 11:25):

can you make a statement in maths without using the word norm?

Wenjie Huang (Jul 26 2025 at 11:25):

These is the proposition I want to prove,
image.png

Aaron Liu (Jul 26 2025 at 11:26):

That looks like it's referring to some particular norm which was defined earlier

Kenny Lau (Jul 26 2025 at 11:26):

without the word norm

Wenjie Huang (Jul 26 2025 at 11:29):

image.png
It's all definition about norm.

Kenny Lau (Jul 26 2025 at 11:31):

seems like 2 is the key point

Kenny Lau (Jul 26 2025 at 11:32):

in current mathlib there is no way to talk about an arbitrary compatible norm i’m afraid

Kenny Lau (Jul 26 2025 at 11:33):

could you explain why we might want different matrix norms?

Wenjie Huang (Jul 26 2025 at 11:33):

Oh, so we have to pick a specific norm

Kenny Lau (Jul 26 2025 at 11:33):

it’s not impossible to make a new typeclass of compatible norms

Kenny Lau (Jul 26 2025 at 11:34):

@Yakov Pechersky has done excellent work in the valuation library, (but it’s not about norm)

Wenjie Huang (Jul 26 2025 at 11:34):

I am currently working on the formalization of numerical algebra and have encountered many problems related to norms.

Kenny Lau (Jul 26 2025 at 11:35):

@Wenjie Huang if you really feel like this is the right thing to do, i would suggest you to define a new typeclass

Kenny Lau (Jul 26 2025 at 11:35):

or a new structure

Kenny Lau (Jul 26 2025 at 11:35):

i don’t have a computer right now

Wenjie Huang (Jul 26 2025 at 11:35):

OK, I'll try it and thank you for your suggestions

Kenny Lau (Jul 26 2025 at 11:36):

so the pseudocode looks like

structure Norm (k) [NormedField k] (E) [Module k E] where
  norm : E -> R
  axioms

Kenny Lau (Jul 26 2025 at 11:37):

refer to how NormedSpace does it, but make it a structure instead of class

Wenjie Huang (Jul 26 2025 at 11:38):

Ok , I'll refer to it

Kenny Lau (Jul 26 2025 at 11:40):

which book is this?

Wenjie Huang (Jul 26 2025 at 11:43):

I am trying to formalize many classic theorems in numerical linear algebra, using the textbook

Eric Wieser (Jul 26 2025 at 11:56):

We already have a similar structure as docs#Seminorm

Eric Wieser (Jul 26 2025 at 11:56):

docs#AlgebraNorm ?

Eric Wieser (Jul 26 2025 at 11:58):

That looks like what you want

Wenjie Huang (Jul 26 2025 at 12:04):

OK, I'll try it

Kenny Lau (Jul 26 2025 at 12:22):

what is the name of the book?

Wenjie Huang (Jul 26 2025 at 12:39):

This is a Chinese textbook called Numerical Linear Algebra
image.pnghttps://img9.doubanio.com/view/subject/l/public/s24944214.jpg

Wenjie Huang (Jul 26 2025 at 12:50):

So is something like this?

import Mathlib

theorem lemma_1
    {n : Type*} [Fintype n] [DecidableEq n]
    (A : Matrix n n ) (p : AlgebraNorm  (Matrix n n )) :
    (spectralRadius  A).toReal  p A := by
  sorry

Yiming Fu (Jul 26 2025 at 13:19):

Why don't we have AlgebraNorm.toNormedAlgebra, simliar to docs#RingNorm.toNormedRing.

Eric Wieser (Jul 27 2025 at 11:08):

That looks like a mistake to me

Eric Wieser (Jul 27 2025 at 11:08):

I think we should have that, PR welcome

Jireh Loreaux (Jul 27 2025 at 20:50):

But as someone mentioned in the other thread, these also need the forgetful inheritance versions that replace the topology, uniformity or bornology.

Eric Wieser (Jul 27 2025 at 20:55):

Or rather, the ones that don't replace it and use an existing instance

Jireh Loreaux (Jul 27 2025 at 21:50):

indeed, what I mean was: allow the user to replace the default inherited topology with the pre-existing one.

Kenny Lau (Jul 27 2025 at 21:54):

can we have both a canonical instance but also allow for other compatible norms?

Kenny Lau (Jul 27 2025 at 21:55):

this is exactly the kind of issues we ran into in local class field theory

Kenny Lau (Jul 27 2025 at 21:55):

(yes, there are other solutions, but I think I would be happiest with this approach instead)

Jireh Loreaux (Jul 27 2025 at 21:57):

I'm not sure what you mean. You want a Norm as an instance, but you also want access to other norms? You need type synonyms for the other norms. Or else you need to use something like docs#Seminorm which isn't a class.

Kenny Lau (Jul 27 2025 at 21:58):

i'm talking about adding onto the existing mathlib structure

Jireh Loreaux (Jul 27 2025 at 21:58):

Adding what onto the existing structure?

Kenny Lau (Jul 27 2025 at 22:02):

axiom  : Type

structure Norm (X : Type) : Type where
  toFun : X  

axiom supNorm (n : Nat) : Norm (Fin n  )

noncomputable instance {n} : Inhabited (Norm (Fin n  )) where
  default := supNorm n

class CompleteSpace (X : Type) (norm : Norm X := by exact default) : Prop where
  exists_limit_of_cauchy : 1 + 1 = 2

axiom L2Norm (n : Nat) : Norm (Fin n  )

instance complete_supNorm (n) : CompleteSpace (Fin n  ) := sorry
instance complete_L2Norm (n) : CompleteSpace (Fin n  ) (L2Norm n) := sorry

#print complete_supNorm
#print complete_L2Norm

Jireh Loreaux (Jul 27 2025 at 23:01):

I still don't understand what you want to do by looking at this code.

  1. CompleteSpace is about uniformities, not norms exactly.
  2. In your example, the uniformities induced by these norms are provably equal
  3. You can still have type synonyms
  4. In fact, we do have the type synonym docs#WithLp (or docs#PiLp, or docs#EuclideanSpace), and moreover, these type synonyms have been constructed with the explicit intent to make the uniformities not just provably equal, but definitionally equal.

Jireh Loreaux (Jul 27 2025 at 23:02):

So CompleteSpace (EuclideanSpace 𝕜 n) is either already in Mathlib, or else trivial to prove.

Robert Maxton (Jul 28 2025 at 06:00):

It definitely would be a shame to have to commit to a specific norm; one of the cool/useful/surprising properties of matrix norms is that it almost never matters which one you pick

Kenny Lau (Jul 28 2025 at 08:29):

@Jireh Loreaux I want to allow other norms on the same type without introducing type synonyms.

Jireh Loreaux (Jul 28 2025 at 12:13):

But what does it even mean to allow other norms? What do you want to do with them exactly? And why doesn't a type synonym (or a local instance) suffice?

Jireh Loreaux (Jul 28 2025 at 12:20):

I'm not sure if this would address your desires, but potentially, we could have a predicate on docs#Seminorm called Seminorm.IsCompatible saying that the uniformity induced by a given seminorm is equal to the existing uniformity.

Jireh Loreaux (Jul 28 2025 at 12:26):

Robert Maxton said:

it almost never matters which one you pick

I beg to differ. I would argue that this is only applicable if you all you care about is properties generically true in Banach algebras.

Yakov Pechersky (Jul 28 2025 at 13:22):

Possible API:

import Mathlib

open Uniformity

variable {X : Type*}

def PseudoMetricSpace.isEquiv (f g : PseudoMetricSpace X) : Prop :=
  f.toUniformSpace = g.toUniformSpace

lemma PseudoMetricSpace.isEquiv.eq_uniformity {f g : PseudoMetricSpace X}
      (h : f.isEquiv g) :
    𝓤[f.toUniformSpace] = 𝓤[g.toUniformSpace] := sorry

lemma PseudoMetricSpace.isEquiv.eq_topology {f g : PseudoMetricSpace X} (h : f.isEquiv g) :
    f.toUniformSpace.toTopologicalSpace = g.toUniformSpace.toTopologicalSpace := sorry

lemma PseudoMetricSpace.isEquiv.of_normedField {f g : NormedField X} {c C : NNReal}
    (h :  x : X, c * f.norm x  g.norm x  g.norm x  C * f.norm x) :
    f.isEquiv g.toPseudoMetricSpace := sorry

lemma PseudoMetricSpace.isEquiv.of_normedField_rpow {f g : NormedField X} {α : NNReal} ( : α < 1)
    (h :  x : X, (f.norm x) ^ α.toReal = g.norm x) :
    f.isEquiv g.toPseudoMetricSpace := sorry

Yakov Pechersky (Jul 28 2025 at 13:26):

A possible application (if I understand correctly): one has an extension L/K of nonarch local fields, and wants to emply docs#spectralNorm_unique_field_norm_ext. It's not obvious that the preexisting norm instance is such that the hypothesis ∀ (x : K), f ((algebraMap K L) x) = ‖x‖ holds true. However, by equivalence of norms over normed fields, there is another norm where that will be true, under some power scaling α. So getting that α allows one to construct the desired topological hom from K to L.

Bhavik Mehta (Jul 28 2025 at 16:09):

Kenny Lau said:

Jireh Loreaux I want to allow other norms on the same type without introducing type synonyms.

In https://leanprover-community.github.io/mathlib4_docs/Mathlib/Analysis/Matrix.html we have three different norms on Matrix (with no type synonyms)

Eric Wieser (Jul 28 2025 at 16:43):

That file needs some design work; my goal at the time was just to show that we had the machinery to build those instances

Eric Wieser (Jul 28 2025 at 16:43):

At minimum we should scope each collection of instances to make it easier to enable them all at once

Eric Wieser (Jul 28 2025 at 16:44):

Type synonyms are a little annoying because matrix notation like transpose is tied to Matrix.transpose and not a notation class.

Jireh Loreaux (Jul 28 2025 at 17:26):

Definitely they should be scoped instances.

Jireh Loreaux (Jul 28 2025 at 17:26):

Indeed, I'm familiar with the pain of type synonyms on docs#Matrix (see, for instance, docs#CStarMatrix). @Frédéric Dupuis suggested to me privately the possibility of a MatrixLike type class. At the time I dismissed it thinking there wouldn't be sufficient shared API, but perhaps this was stupid.

Jireh Loreaux (Jul 28 2025 at 17:38):

But as for @Kenny Lau 's problems, I'm still not sure exactly what they are. I want a concrete example of something he wants to do, but is obstructed, or otherwise unjustifiably hindered, because he can't work with multiple norms simultaneously.

Something that comes to my mind: it's quite inconvenient (without resorting to type synonyms) to say that all norms on a (fixed) finite dimensional space are equivalent. I mean, sure, you can say docs#LinearEquiv.toContinuousLinearEquiv, but that has not much content when you want E = F but possibly different norms and you consider docs#LinearEquiv.refl .

Kenny Lau (Jul 29 2025 at 08:13):

@Jireh Loreaux it's what Yakov pointed out. In the setting of local fields, there's an arbitrary norm on K and L (which yes, you can solve with attribute [-instance], but that also removes the uniform structure etc.), and you can't prove that L is a normed vector space over K because their norms don't exactly agree

Eric Wieser (Aug 01 2025 at 22:29):

Jireh Loreaux said:

Definitely they should be scoped instances.

#27855


Last updated: Dec 20 2025 at 21:32 UTC