# installHilbertFunction -- install a Hilbert function without computation

## Synopsis

• Usage:
installHilbertFunction(M,hf)
• Inputs:
• Consequences:
• The poincare polynomial hf is used as the poincare polynomial for M

## Description

If M is a module, then hf should be the poincare polynomial of M. If M is an ideal, then hf should be the poincare polynomial of comodule M. If M is a matrix, then hf should be the poincare polynomial of cokernel M.

An installed Hilbert function will be used by Gröbner basis computations when possible.

Sometimes you know or are very sure that you know the Hilbert function. For example, in the following example, the Hilbert function of 3 random polynomials should be the same as the Hilbert function for a complete intersection.

 `i1 : R = ZZ/101[a..g];` ```i2 : I = ideal random(R^1, R^{3:-3}); o2 : Ideal of R``` ```i3 : hf = poincare ideal(a^3,b^3,c^3) 3 6 9 o3 = 1 - 3T + 3T - T o3 : ZZ[T]``` `i4 : installHilbertFunction(I, hf)` ```i5 : gbTrace=3 o5 = 3``` ```i6 : time poincare I -- used 0. seconds 3 6 9 o6 = 1 - 3T + 3T - T o6 : ZZ[T]``` ```i7 : time gens gb I; -- registering gb 2 at 0x6351720 -- [gb]{3}(3,3)mmm{4}(2,2)mm{5}(3,3)mmm{6}(2,6)mm{7}(1,4)m{8}(0,2)number of (nonminimal) gb elements = 11 -- number of monomials = 4175 -- ncalls = 10 -- nloop = 29 -- nsaved = 0 -- -- used 0.016 seconds 1 11 o7 : Matrix R <--- R```
In this case, the savings is minimal, but often it can be dramatic.

Another important situation is to compute a Gröbner basis using a different monomial order. In the example below

 ```i8 : R = QQ[a..d]; -- registering polynomial ring 3 at 0x5921580``` ```i9 : I = ideal random(R^1, R^{3:-3}); -- registering gb 3 at 0x6351260 -- [gb]number of (nonminimal) gb elements = 0 -- number of monomials = 0 -- ncalls = 0 -- nloop = 0 -- nsaved = 0 -- o9 : Ideal of R``` ```i10 : time hf = poincare I -- registering gb 4 at 0x6351130 -- [gb]{3}(3)mmm{4}(2)mm{5}(3)mmm{6}(6)mmoooo{7}(4)mooo{8}(2)oonumber of (nonminimal) gb elements = 11 -- number of monomials = 266 -- ncalls = 10 -- nloop = 23 -- nsaved = 1 -- -- used 0.016 seconds 3 6 9 o10 = 1 - 3T + 3T - T o10 : ZZ[T]``` ```i11 : S = QQ[a..d,MonomialOrder=>Eliminate 2] -- registering polynomial ring 4 at 0x5921500 o11 = S o11 : PolynomialRing``` ```i12 : J = substitute(I,S) 4 3 2 6 2 1 3 1 2 10 4 2 8 2 o12 = ideal (-a + a b + -a*b + -b + -a c + --a*b*c + -b c + -a d + 5a*b*d 3 5 4 7 7 5 7 ----------------------------------------------------------------------- 3 2 2 7 2 4 5 2 4 2 1 3 2 + --b d + 4a*c + -b*c + -a*c*d + 10b*c*d + -a*d + -b*d + -c + c d 10 5 3 3 7 2 ----------------------------------------------------------------------- 1 2 3 1 3 2 2 8 3 8 2 2 7 2 + -c*d + 4d , -a + a b + 5a*b + -b + -a c + a*b*c + b c + -a d + 3 4 3 5 3 ----------------------------------------------------------------------- 2 5 2 1 2 1 5 5 2 5 2 1 3 9a*b*d + b d + -a*c + -b*c + -a*c*d + -b*c*d + -a*d + -b*d + -c + 3 2 4 3 6 2 4 ----------------------------------------------------------------------- 10 2 9 2 1 3 4 3 2 8 2 7 3 2 1 6 2 --c d + -c*d + -d , -a + a b + -a*b + -b + 7a c + -a*b*c + -b c + 3 8 5 3 9 4 2 7 ----------------------------------------------------------------------- 2 1 10 2 2 4 2 10 2 7a d + --a*b*d + --b d + 3a*c + -b*c + 8a*c*d + 4b*c*d + --a*d + 10 9 5 3 ----------------------------------------------------------------------- 5 2 1 3 2 1 2 4 3 -b*d + -c + c d + -c*d + -d ) 4 3 5 3 o12 : Ideal of S``` `i13 : installHilbertFunction(J, hf)` ```i14 : gbTrace=3 o14 = 3``` ```i15 : time gens gb J; -- registering gb 5 at 0x676fd10 -- [gb]{3}(3,3)mmm{4}(2,2)mm{5}(3,3)mmm{6}(3,7)mmm{7}(3,8)mmm{8}(3,9)mmm{9}(3,9)m -- mm{10}(2,8)mm{11}(1,5)m{12}(1,3)m{13}(1,3)m{14}(1,3)m{15}(1,3)m{16}(1,3)m -- {17}(1,3)m{18}(1,3)m{19}(1,3)m{20}(1,3)m{21}(1,3)m{22}(1,3)m{23}(1,3)m{24}(1,3)m -- {25}(1,3)m{26}(1,3) --removing gb 0 at 0x63515f0 m{27}(1,3)m{28}(0,2)number of (nonminimal) gb elements = 39 -- number of monomials = 1050 -- ncalls = 46 -- nloop = 57 -- nsaved = 1 -- -- used 0.25 seconds 1 39 o15 : Matrix S <--- S``` ```i16 : selectInSubring(1,gens gb J) o16 = | 130254793832230002516245978058502286386868724706749061979110406571360 ----------------------------------------------------------------------- 0c27+221955863685652702709804340078870871418900027315888577780456238642 ----------------------------------------------------------------------- 838400c26d+464056983451079491353432188172633809448579073379883714113003 ----------------------------------------------------------------------- 4667624242240c25d2-3010950698416360187669568418459267185778675737073837 ----------------------------------------------------------------------- 91861182899350313681600c24d3- ----------------------------------------------------------------------- 14944726596313340733920387484529111430803694879043988068635257268890450 ----------------------------------------------------------------------- 757376c23d4-19739049745250024674342046679193268336984820829128389673688 ----------------------------------------------------------------------- 5038513506133703936c22d5- ----------------------------------------------------------------------- 12408101245352017081685303380305725986618713591422639561315819889784691 ----------------------------------------------------------------------- 70794832c21d6-432126738294400354316580693068500452621479571818401713337 ----------------------------------------------------------------------- 2932306907415079463360c20d7- ----------------------------------------------------------------------- 94357346905607815350098634206484288802356430404774736477644323226185595 ----------------------------------------------------------------------- 38713296c19d8-176470121751171849135378839220133708921382671044460944732 ----------------------------------------------------------------------- 21490003452948527635104c18d9- ----------------------------------------------------------------------- 45637087198040162112843358815890981026727333989773677036933252228693551 ----------------------------------------------------------------------- 049429536c17d10-1220907497685455802789781781791727156187360343014780350 ----------------------------------------------------------------------- 02870900254358475241107472c16d11- ----------------------------------------------------------------------- 22949252943688234309014175744065747103423022354425461871553840673603527 ----------------------------------------------------------------------- 6107916276c15d12-280335000819769182002265619854191650175454210499458868 ----------------------------------------------------------------------- 692664946240904024231709704c14d13- ----------------------------------------------------------------------- 22054730507462496807447592695589085473541391457742533138637619018582667 ----------------------------------------------------------------------- 1187788540c13d14-110015947376784018502061655293036312135311280344939031 ----------------------------------------------------------------------- 736544862411741559302311488c12d15- ----------------------------------------------------------------------- 34226821244015847516735400755896231251488344674807231775464013134009124 ----------------------------------------------------------------------- 826459736c11d16-3086141158811918513268889080424274509564497702129445831 ----------------------------------------------------------------------- 998260160068379524049924c10d17+ ----------------------------------------------------------------------- 14736973466030492146347637844283873089912776459584873566776872448484143 ----------------------------------------------------------------------- 603496285c9d18+27173963275675058464999535341999536120338663489033070302 ----------------------------------------------------------------------- 064931303294909124932110c8d19+ ----------------------------------------------------------------------- 25726864006468296264074747789704581819218432793508743959565831040468127 ----------------------------------------------------------------------- 603912490c7d20+13987359801319012718846797597907029200589871626130282014 ----------------------------------------------------------------------- 788271124769008664621780c6d21+ ----------------------------------------------------------------------- 41151405000133121202489917446681042583072198802887522445409238698011332 ----------------------------------------------------------------------- 94091800c5d22+691912734648881493584119852186636183670704002723480945610 ----------------------------------------------------------------------- 763512422212635537500c4d23+ ----------------------------------------------------------------------- 28684014492255360381998630637928624508462063359307367643438922478014318 ----------------------------------------------------------------------- 7634500c3d24+1045522459664289456073149120848043750524286912950222989372 ----------------------------------------------------------------------- 51728256785613047600c2d25- ----------------------------------------------------------------------- 14200196054387888822505236683572303405703134185189104657735900798325686 ----------------------------------------------------------------------- 807500cd26-403390594517933740931279704350491244913876536864486875222577 ----------------------------------------------------------------------- 3787288437924000d27 | 1 1 o16 : Matrix S <--- S```

## Ways to use installHilbertFunction :

• installHilbertFunction(Ideal,RingElement)
• installHilbertFunction(Matrix,RingElement)
• installHilbertFunction(Module,RingElement)