Hi all,
I recently formalized a proof of the Laplace expansion of
determinants (~ mdetlap), which I think would be useful to pull to
the main part of set.mm. Because the formula makes calculation
based on the row and column indices of the element of the matrix,
I'm using matrix with integer indices (in contrast with the rest
of the development on matrices which is based on arbitrary sets).
I chose indices in ` ( 1 ... N ) ` , so that the
top-left matrix element is a11 (in set.mm written `
( 1 A 1 ) ` ). It seems using indices starting from one is
the convention used for mathematics, I have not found yet a
reference with indices starting at zero (and neither did Norm),
however we would like to run this through the community. Most
programming languages start indices with zero, with the exception
of R and several others.
In set.mm words indices start with zero.
What's your opinion? Should matrix indices start with one or zero?
Thanks for your input!
BR,
_
Thierry
PS. I would later like to define a "literal" matrix function
which would be used like this to transform words (for any matrix
size up to 8x8) into matrices :
( litMat ` <" <" A B C "> <" D E F "> <" G H I "> "> )
This would allow a bridge/conversion.
--
You received this message because you are subscribed to the Google Groups "Metamath" group.
To unsubscribe from this group and stop receiving emails from it, send an email to metamath+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/metamath/0173f6ec-7faf-41a8-816d-7becca681ba0n%40googlegroups.com.
My vote is also in favor of starting with 0, or even better, doing everything over generic finite sets when possible and falling back on ( 0 ..^ N ). I realize that close correspondence with papers is considered important here but mathematicians write for their own ease. In a math paper, you can write either a_0, ..., a_(n-1) or a_1, ..., a_n - which is easier? Besides the strictness of a few inequalities this is probably the only difference, so a_1, ..., a_n is preferred because it is very slightly shorter.In formalization, we should also write for our own ease. In this case, that means better interfacing with the theory of finite words, which uses ( 0 ..^ N ). There are also other reasons to prefer 0 based indexing but in this case I think consistency with words (viewed as 1D vectors) is more important than that.
I'm willing to rewrite the theorems I have now with ( 1 ... N ) into ( 0
..^ N ) if such is the choice of the community, but I don't see any
efficient and clear way to make it working in a flexible way for both at
the same time.
Thanks for all feedback!
There are valid arguments on both sides, so we need Norm or Mario
to do a final call.
--
You received this message because you are subscribed to the Google Groups "Metamath" group.
To unsubscribe from this group and stop receiving emails from it, send an email to metamath+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/metamath/7eeabd5a-29c3-431b-aaba-87f457827d53n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/metamath/d605c6c1-20ff-3b46-228b-4645c704db08%40gmx.net.
I will reiterate my suggestion to use finite sets for indexing when possible, which sidesteps the question
Indeed, we do have matrix vector multiplication, ` maVecMul `,
introduced by Alexander, and used in his proof of Cramer's rule.
That operation considers vectors as functions of a single
variable, indexed by any finite set.
This can only identify with Words (` Word X `, which can be input as ` <" A B C "> ` ) if that set is of the form ` ( 0 ..^ N ) ` ...
_
Thierry
To view this discussion on the web visit https://groups.google.com/d/msgid/metamath/CAFXXJSspwoKtV5cGUwenJJ4MF4js-a_mzhVyi-7vi9KAkkJKRw%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/metamath/d5e41385-2659-49b1-8176-011144637d9dn%40googlegroups.com.
Le 2 sept. 2020 à 18:54, Mario Carneiro <di....@gmail.com> a écrit :
To view this discussion on the web visit https://groups.google.com/d/msgid/metamath/CAFXXJSvm%3D0YNAOj_ZF8XBvuoWbfaTEHVsymViqGnX0czV6tHhw%40mail.gmail.com.
I’ve done a mock-up of this conversion (including index translation), you can find it here:
On the other hand, does any one have any idea or suggestion about how I could have expressed the Laplace expansion without integer indices, on any finite set index?
To view this discussion on the web visit https://groups.google.com/d/msgid/metamath/1F73E402-F4BB-4446-9AA6-D0C287C40186%40gmx.net.
Note that an expression such as <" <" A B C "> <" D E F "> <" G H I "> "> has the type (0..^N) -> ((0..^N) -> R), which would have to be converted anyway to match the expected I x I -> R type used by square matrices. If we take I to be (0..^N) then this is just an uncurry, but if the official index set for matrices is instead (1...N) then the index remapping could be performed at the same time.
On 02/09/2020 23:25, 'fl' via Metamath wrote:
The best to do is redefine the <" ...>" operator so that it takes (1 ... N) as its set of indices and then fix up all the proofs referring to the definition.
You should have only one definition for matrices, tuples and words since all that is the same story. Or at most two: one with a abstract finite
set of indices and another one with (1... N).
Like mentioned by Norm in the original thread about index start
for words, I'm afraid that would be a huge work, there are already
hundreds of theorems making use of that range.
That's why I would like to ask the same about matrices now, before
writing more theorems within whichever convention.
Of course we shall try to use arbitrary sets whenever possible...
which leads me to the other point:
On the other hand, does any one have any idea or suggestion about how I could have expressed the Laplace expansion without integer indices, on any finite set index?
The laplace expansion of the determinant (just one level of expansion, not recursive) requires a choice of row to expand over (which is an element of the index set), and then it's an unordered finite sum. No integers needed.
Yes, but what is the factor you apply to each submatrix determinant ? The textbooks all have ` -1 ^ ( i + j ) ` , where i and j are integer indices. Of course, start index does not matter, but where do those numbers come from when working with arbitrary sets?
_
Thierry
--
You received this message because you are subscribed to the Google Groups "Metamath" group.
To unsubscribe from this group and stop receiving emails from it, send an email to metamath+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/metamath/004ddf15-75e7-4bcb-90ec-94b021bfe12fn%40googlegroups.com.
Wouldn’t they be clearly differentiated in a type theory setup? How does coq/lean treat those? Are they the same concept or separated ones?
To view this discussion on the web visit https://groups.google.com/d/msgid/metamath/CACZd_0wnkT5GnnRE7BuQKtuj0BTc5QWvGjQTotmKHTAE4t48fQ%40mail.gmail.com.
In Coq and Lean, the structure of inductive types, specifically the peano natural numbers starting at 0, *strongly* prefers 0-based indexing. The difference is stark enough that it's not really ever a discussion. You can do induction on nat, you can't do induction on positive nat (at least the version that is baked into the language doesn't give you this, you have to use a theorem that amounts to an index conversion under the hood). ZFC is more free in this regard because any definition is as good as any other from the point of view of the automation, but there is still friction associated with conversions.My argument for 0-based matrices is at this point entirely one of uniformity. Changing 300 theorems with a silly index change is not an automatic job so it will be a lot of work, and the gain is small (and since I'm on Dijkstra's side in this argument, the gain is negative from my POV). Unlike Norm I don't think that rigid adherence to the textbook formulations of things is necessarily a good idea, as long as I think the author would agree that the reformulation is essentially equivalent (the "mathematician's equal"). It is easier to get this confirmation when you have actual practicing mathematicians on staff, as it were; there are a lot of mathematicians getting into lean these days and the 0-based thing hasn't caused one bit of dissent that I have heard.Here's the definition of a matrix: https://leanprover-community.github.io/mathlib_docs/find/matrix/src . It uses arbitrary finite sets, but further down the page you will see some theorems like https://leanprover-community.github.io/mathlib_docs/find/matrix.sub_left/src that specialize to the type "fin n", which is lean's version of our (0..^n). It is defined as {i : nat | i < n}, where nat is the inductive type of nonnegative integers. The type (1...n) would be the more cumbersome {i : nat | 0 < i /\ i <= n}, which has an extra conjunct that would have to be dealt with whenever you destructure the type (and working directly from the stated definition is much more common in lean than metamath). This is the sort of extra friction I am talking about - it's not just changing numbers in a few places.Mario
On Wed, Sep 2, 2020 at 3:52 PM 'Stanislas Polu' via Metamath wrote:
Wouldn’t they be clearly differentiated in a type theory setup? How does coq/lean treat those? Are they the same concept or separated ones?-stan
--
You received this message because you are subscribed to the Google Groups "Metamath" group.
To unsubscribe from this group and stop receiving emails from it, send an email to metamath+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/metamath/f016fb42-418a-4f6c-89f7-6b423a982710n%40googlegroups.com.
No, I'm not proposing a translation to or from lean.
--
You received this message because you are subscribed to the Google Groups "Metamath" group.
To unsubscribe from this group and stop receiving emails from it, send an email to metamath+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/metamath/dbe9dbee-4317-4ca2-ac27-9740c8e9ed74n%40googlegroups.com.
I think there has been a slow march from one-based indexing to zero based indexing in computing.
Many systems designed two decades ago supported one based indexing, such as R and matlab/octave. But newer systems are pretty much uniformly zero-based.
I realize that abstract mathematics is not the same as computing, but they do influence each other.
Apparently essentially 100% of linear algebra textbooks start at 1.
--
You received this message because you are subscribed to the Google Groups "Metamath" group.
To unsubscribe from this group and stop receiving emails from it, send an email to metamath+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/metamath/cf9c496f-fbda-42b2-ba01-f1f17a6fee53n%40googlegroups.com.
I think there is no consensus to use index sets starting with 1, especially not for tuples/words (actually, there was a consensus to start with 0 for words, see discussion in https://groups.google.com/g/metamath/c/UwTUuNPgaB0/m/NdWefzG4AgAJ).
Regarding matrices, I am also in favour of starting with 1, but Norm's argument is only for one of many criteria discussed here.