Ask Your Question
1

simplifying expressions in GF(2)

asked 2015-02-16 03:45:32 +0100

freako89 gravatar image

updated 2015-02-16 03:46:12 +0100

Hi guys,

I know that for a variable $x$ in $GF(2)$, $x^2 = x$, and $2x=0$.

How do I simplify a polynomial expression in $GF(2)$ in the Sage interface?

For example, I should obtain

$$(a+b+1)^2=a^2+b^2+1+2a+2b+2ab=a+b+1$$

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2015-02-16 14:35:21 +0100

vdelecroix gravatar image

The simplest is to work over boolean polynomials

sage: B.<a,b> = BooleanPolynomialRing(2)
sage: (a+b+1)^2
a + b + 1

But you can also use the more general quotient of polynomial rings (notice that in GF(2) a equals -a)

sage: R.<a,b> = PolynomialRing(GF(2), 'a,b')
sage: Rbar = R.quotient([a^2+a, b^2+b])
sage: abar,bbar = Rbar.gens()
sage: abar
abar
sage: (abar+bbar+1)^2
abar + bbar + 1
edit flag offensive delete link more
0

answered 2015-02-16 09:56:59 +0100

rws gravatar image

I'm not sure why you think that x^2=x and Sage gives

sage: R.<a,b> = PolynomialRing(GF(2), 'a,b')
sage: (a+b+1)^2
a^2 + b^2 + 1
edit flag offensive delete link more

Comments

The question is how to manipulate expressions involving variables which are assumed to live in GF(2). In this context, x, a, b, etc. are thought of as elements in GF(2), not as indeterminates of polynomial rings over in GF(2). The question mentions polynomial expressions in such variables, but this does not mean formal polynomials.

slelievre gravatar imageslelievre ( 2015-02-16 14:44:21 +0100 )edit

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: 2015-02-16 03:45:32 +0100

Seen: 481 times

Last updated: Feb 16 '15