Ask Your Question
1

define a finite semiring

asked 2022-07-11 22:45:31 +0100

Max Alekseyev gravatar image

updated 2023-01-09 23:59:56 +0100

tmonteil gravatar image

What would be the simplest way to define the semiring with elements $\{0, 1\}$ with the logical OR ($|$) operation as addition and the standard integer multiplication?

At very least it should be accepted by PolynomialRing as the domain for coefficients.

edit retag flag offensive close merge delete

Comments

Is this GF(2)?

dan_fulea gravatar imagedan_fulea ( 2022-07-13 12:47:09 +0100 )edit

No. In $GF(2)$ we have $1+1=0$, while here $1+1=1$.

Max Alekseyev gravatar imageMax Alekseyev ( 2022-07-13 13:39:12 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2022-07-27 17:39:32 +0100

Max Alekseyev gravatar image

updated 2022-10-17 23:04:24 +0100

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(GF(2), use_min=False)
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2022-07-11 22:45:31 +0100

Seen: 168 times

Last updated: Oct 17 '22