Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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

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

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

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

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)

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)