Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

answered 2 years ago

Max Alekseyev gravatar image

Luckily this semiring is subsemiring of InfinityRing:

sage: from sage.matrix.operation_table import OperationTable
sage: R = InfinityRing
sage: OperationTable([R(0),R(1)], operation=operator.add, names='digits')
+  0 1
 +----
0| 0 0
1| 1 1
sage: OperationTable([R(0),R(1)], operation=operator.mul, names='digits')
*  0 1
 +----
0| 0 0
1| 0 1
click to hide/show revision 2
No.2 Revision

Luckily this semiring is a subsemiring of InfinityRing:

sage: from sage.matrix.operation_table import OperationTable
sage: R = InfinityRing
sage: OperationTable([R(0),R(1)], operation=operator.add, names='digits')
+  0 1
 +----
0| 0 0
1| 1 1
sage: OperationTable([R(0),R(1)], operation=operator.mul, names='digits')
*  0 1
 +----
0| 0 0
1| 0 1
click to hide/show revision 3
No.3 Revision

Luckily this semiring is a subsemiring of InfinityRing:

sage: from sage.matrix.operation_table import OperationTable
sage: R = InfinityRing
sage: OperationTable([R(0),R(1)], operation=operator.add, names='digits')
+  0 1
 +----
0| 0 0
1| 1 1
sage: OperationTable([R(0),R(1)], operation=operator.mul, names='digits')
*  0 1
 +----
0| 0 0
1| 0 1

There is however a bug in addition, which I reported at https://trac.sagemath.org/ticket/34231

click to hide/show revision 4
No.4 Revision

Luckily this semiring is a subsemiring of InfinityRing:

sage: from sage.matrix.operation_table import OperationTable
sage: R = InfinityRing
sage: OperationTable([R(0),R(1)], operation=operator.add, names='digits')
+  0 1
 +----
0| 0 0
0          # here we a bug: it should be 0 1
1| 1 1
sage: OperationTable([R(0),R(1)], operation=operator.mul, names='digits')
*  0 1
 +----
0| 0 0
1| 0 1

There is however a bug in addition, which I reported at https://trac.sagemath.org/ticket/34231

click to hide/show revision 5
No.5 Revision

OPTION #1. Luckily this semiring is a subsemiring of InfinityRing:

sage: from sage.matrix.operation_table import OperationTable
sage: R = InfinityRing
sage: OperationTable([R(0),R(1)], operation=operator.add, names='digits')
+  0 1
 +----
0| 0 0          # here we a bug: it should be 0 1
1| 1 1
sage: OperationTable([R(0),R(1)], operation=operator.mul, names='digits')
*  0 1
 +----
0| 0 0
1| 0 1

There is however a bug in addition, which I reported at https://trac.sagemath.org/ticket/34231


OPTION #2. Another approach is to use TropicalSemiring as follows:

R = TropicalSemiring(Zmod(2),use_min=False)
click to hide/show revision 6
No.6 Revision

OPTION #1. Luckily this semiring is a subsemiring of InfinityRing:

sage: from sage.matrix.operation_table import OperationTable
sage: R = InfinityRing
sage: OperationTable([R(0),R(1)], operation=operator.add, names='digits')
+  0 1
 +----
0| 0 1
1| 1 1
sage: OperationTable([R(0),R(1)], operation=operator.mul, names='digits')
*  0 1
 +----
0| 0 0
1| 0 1

There is however a bug in addition, which I reported at https://trac.sagemath.org/ticket/34231


OPTION #2. Another approach is to use TropicalSemiring as follows:

R = TropicalSemiring(Zmod(2),use_min=False)
TropicalSemiring(GF(2), use_min=False)