File: boolean_gb.py

package info (click to toggle)
jas 2.7.200-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 15,732 kB
  • sloc: java: 164,370; python: 14,882; ruby: 14,509; xml: 583; makefile: 545; sh: 349
file content (49 lines) | stat: -rw-r--r-- 1,030 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import sys;

from jas import Ring, PolyRing, ParamIdeal, QQ, ZM, RR
from jas import startLog, terminate


# Boolean coefficient boolean GB
# see S. Inoue and A. Nagai "On the Implementation of Boolean Groebner Bases" in ASCM 2009
# Z_2 regular ring coefficent example


r = PolyRing(RR(ZM(2),3),"x,y",PolyRing.lex);
print "r  = " + str(r);
#print len(r.gens())

[s1,s2,s3,x,y] = r.gens();
one = r.one();

print "one = " + str(one);
print "s1  = " + str(s1);
print "s2  = " + str(s2);
print "s2  = " + str(s3);
print "x   = " + str(x);
print "y   = " + str(y);

brel = [ x**2 - x, y**2 - y ]; 

print "brel = " + str(brel[0]) + ", " + str(brel[1]);

pl = [ ( one + s1 + s2 ) * ( x*y + x +y ), s1 * x + s1, s2 * y + s2, x * y ];
#pl = [ ( one ) * ( x*y + x +y ), s1 * x + s1, s2 * y + s2, x * y ];

pl = pl + brel;


startLog();

f = ParamIdeal(r,list=pl);
print "Ideal: " + str(f);

gb = f.regularGB();
print "boolean GB: " + str(gb);

#ss = gb.stringSlice();
#print "regular string slice: " + str(ss);

terminate();
#sys.exit();