Subject: Ssreflect Users Discussion List
List archive
- From: Mohit Tekriwal <>
- To:
- Subject: [ssreflect] Using mathcomp libraries
- Date: Wed, 23 Dec 2020 23:29:48 -0500
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=Pass ; spf=None
- Ironport-phdr: 9a23:A7/b4RSON1Q349g5pXR/Dy0Qftpsv+yvbD5Q0YIujvd0So/mwa6yZRaN2/xhgRfzUJnB7Loc0qyK6v+mAzRQqs3c+Fk5M7V0HycfjssXmwFySOWkMmbcaMDQUiohAc5ZX0Vk9XzoeWJcGcL5ekGA6ibqtW1aFRrwLxd6KfroEYDOkcu3y/qy+5rOaAlUmTaxe7x/IAi0oAnLqMUanYhvJqk/xxbJv3BFZ/lYyWR0KFyJgh3y/N2w/Jlt8yRRv/Iu6ctNWrjkcqo7ULJVEi0oP3g668P3uxbDSxCP5mYHXWUNjhVIGQnF4wrkUZr3ryD3q/By2CiePc3xULA0RTGv5LplRRP0lCsKMSMy/WfKgcJyka1bugqsqRxjzIDbb46bKflwcK3Dc90dXmdBQt9RVyldDoO8c4cDEewMNvtYoYnnoFsOqAOzCw6rBOPvyz9ImmL907Mk3OQiCwHG3QIhEMgKsH/Jq9j1KKISUee1zKnJ0TXOdO5W2TL86IfUchAtu++DUq9tccfIz0QkCgzKgEmKp4P/IzOVyvoCs3Kd7+d4W+yiimEqpQ9wrzWuyMkhi5XFi4AVxF3K6yl03Ik4KMO6RUNmbtCpEJVeuj2HO4Z2TM4vQGVltTokx7AEvZO1fC4Hw4kkyR7Hc/GLbZSE7xb5WOuSITp0nm9pdbO+ihqo/kWty/XwW8i23VpQsyZIltbBumoT2xHd6cWLUOVx80mh1DuJygvd8PtLIVoumqreM5MhwqA/lp4UsUnbGy/5gkT2jKuPekUl/eik9v3rYrvpq5KdLYN0hQb+MqMhmsy7H+s0KBQBX2+e+eik1b3j+1P2QKlSg/EojqXUtIrWKMcbq6KjHgNY04cu5wywAjqnyNgYmGMILFNBeBKJlYjpPFTOLejkDfe6hFSskDZrx+zdM738B5XNL2TMkLf7cblj9kFc1RI/zcpD6JJMFrEBPPXzV1fqtNzDFB82LQK0w+L5B9phyoMTQnmPA6+cMKPKq1CE/OMvI++WZI8UojnxMfYl5+S9xUM+zEQGZ6Sn2ZYcdFi5GO5nKgOXeynCmNAEREINvgsiBNDni0eDTjdXLyKuWqU85y0TFYenBoeFS4yw1u/SlBynF4FbMzgVQmuHFm3lIt3dBqU8LRmKK8okqQQqELisT4h7iEOrvQ7+jrtgd6/apnNeupXk29x4oebUkENqrGAmP4Gmy2iIClpMsCYQXTZvhfJipE12yhGO3bUq26UJR+wW3OtAV0IBDbCZyuV7D97oXQeYJ4WUTVetQpOrDSxjF98=
Hello,
I am trying to use the matrix algebra package in mathcomp and I am having
trouble understanding how to instantiate the matrices and prove certain
properties on it.
For example, I want to instantiate the matrix:
A= [ 1, 2; 3, 4]
and be able to access any element Aij. The entries of A are reals.
Using the Coquelicot definition of matrix, I can define the matrix as:
Definition A:= mk_matrix 2%nat 2%nat (fun i j=>
if (andb (eqb i 0) (eqb j 0)) then 1 else
if (andb (eqb i 0) (eqb j 1)) then 2 else
if (andb (eqb i 1) (eqb j 0)) then 3 else 4).
To access an element at index (0,1), I can use the following definition:
Definition A01:= coeff_mat 0 A 0%nat 1%nat.
Compute A01.
That gives me 2.
I tried the following in mathcomp:
Definition A1 := @matrix_of_fun _ 2%nat 2%nat matrix_key (fun i j=>
if (andb (eqb i 0) (eqb j 0)) then 1 else
if (andb (eqb i 0) (eqb j 1)) then 2 else
if (andb (eqb i 1) (eqb j 0)) then 3 else 4).
Definition A1_00:= A1 (inord 0) (inord 0).
Compute A1_00.
That gives me:
let......: (fun _ : 'I_2 * 'I_2 => R) (inord 0, inord 0)
instead of 2.
Also, when trying to prove that the trace of A is 5 in mathcomp:
Lemma trace_is_5: mxtrace A1 = 5.
I get the following error message:
The term "A1" has type "'M_2"
while it is expected to have type
"'M_?n".
Am I missing something? How do I use the theorems/lemmas defined in mathcomp
for specific matrices ?
It would be really nice if someone can provide inputs on this issue.
Thanking you,
Mohit Tekriwal.
- [ssreflect] Using mathcomp libraries, Mohit Tekriwal, 12/24/2020
- Re: [ssreflect] Using mathcomp libraries, Laurent Thery, 12/24/2020
Archive powered by MHonArc 2.6.19+.