Upgrade to Pro — share decks privately, control downloads, hide ads and more …

わかったつもりになる Gröbner 基底

わかったつもりになる Gröbner 基底

Haskell で計算機代数勉強会(http://partake.in/events/451a51b0-b18e-4e01-bda4-423bf57f4051 )での発表資料です。Gröbner 基底についての簡単な導入と計算法についての紹介です。

Hiromi Ishii

May 04, 2013
Tweet

More Decks by Hiromi Ishii

Other Decks in Technology

Transcript

  1. ࣗݾ঺հ ੴҪେւʢa.k.a. @mr_konnʣ Twitter: @mr_konn Blog: http:/ /blog.konn-san.com/ Web: http:/

    /konn-san.com/ Haskell lover ૣҴాେֶ਺ֶՊ࢛೥ ຊ౰͸ϩδοΫͷਓؒͷഺ͕ࠓ೥͸ԑ͋ͬͯ୅ ਺زԿʢಛʹ Gröbner جఈʣ ͷݚڀࣨʹ computational-algebra ͷ࡞ऀ 13೥5݄4೔౔༵೔
  2. Gröbner جఈ “άϨϒφʔ͖͍ͯ” ͱಡΉ 1960s: ኍதฏ༞ɺB. Buchberger Β͕ಠཱʹൃݟ Gröbner ͸

    Buchberger ͷࢣঊͷ໊લ ኍத͸ಛҟ఺ղফͷͨΊʹߟ͑ͨ 13೥5݄4೔౔༵೔
  3. Gröbner جఈ “άϨϒφʔ͖͍ͯ” ͱಡΉ 1960s: ኍதฏ༞ɺB. Buchberger Β͕ಠཱʹൃݟ Gröbner ͸

    Buchberger ͷࢣঊͷ໊લ ኍத͸ಛҟ఺ղফͷͨΊʹߟ͑ͨ ٕज़ͷਐาͰܭࢉग़དྷΔΑ͏ʹͳΓԠ༻͕ग़Δ 13೥5݄4೔౔༵೔
  4. Gröbner جఈ “άϨϒφʔ͖͍ͯ” ͱಡΉ 1960s: ኍதฏ༞ɺB. Buchberger Β͕ಠཱʹൃݟ Gröbner ͸

    Buchberger ͷࢣঊͷ໊લ ኍத͸ಛҟ఺ղফͷͨΊʹߟ͑ͨ ٕज़ͷਐาͰܭࢉग़དྷΔΑ͏ʹͳΓԠ༻͕ग़Δ ମ্ଟ߲ࣜ؀ͷΠσΞϧͷੑ࣭ͷΑ͍ੜ੒ݩ 13೥5݄4೔౔༵೔
  5. ମ্ͷଟ߲ࣜ؀ k[X1 , …, Xn ] = {k Λ܎਺ͱ͢Δ n-ม਺ଟ߲ࣜશମ} ม਺ͷ਺͕ࣗ໌ͳ࣌͸ k[] = k[X1

    , …, Xn ] ͱॻ͘ ࣗવʹ଍͠ࢉɺҾ͖ࢉɺֻ͚ࢉ͕ఆٛͰ͖Δʢׂ Γࢉ͸ग़དྷΔͱ͸ݶΒͳ͍ʣ ྫɿX1 2 + 2 X1 X2  + X2 2 ∈ k[X1 , X2 ], y2 − x ∈ k[x, y] 13೥5݄4೔౔༵೔
  6. ΠσΞϧ ؀ R ͷ෦෼ू߹ I ͕ ΠσΞϧ Ͱ͋Δͱ͸ 1. ೚ҙͷ

    x, y ∈ I ʹ͍ͭͯ x − y ∈ I 2.೚ҙͷ c ∈ R, x ∈ I ʹ͍ͭͯ cx ∈ I ഒ਺֓೦ͷ҃ΔछͷҰൠԽʹͳ͍ͬͯΔ ΠσΞϧ I ʹଐ͢Δ ⇔ I ͷݩͰׂΕΔ a ͕ b ͷഒ਺ ⇔ ⟨a⟩ ⊆ ⟨b⟩ ఆٛ 13೥5݄4೔౔༵೔
  7. ੜ੒ݩ ্ͷ ⟨f1 ,…, fr ⟩ ͸͖ͬ͞ͷΠσΞϧͷఆٛΛຬͨ͢ɻ ٯʹɺମ্ଟ߲ࣜ؀ͷΠσΞϧ͸ɺద౰ͳ f1 ,…, fr ʹ

    ΑΓɺ͢΂ͯ͜ͷܗͰॻ͚ΔʢHilbert ͷجఈఆཧʣ f1 , … , fr ∈ k[ ] ʹ͍ͭͯɺ ⟨f1 ,…, fr ⟩ := {a1 f1  +…+ ar fr ∣ ai  ∈ k[] (i = 1, … r)} Λ f1 ,…, fr ʹΑΓੜ੒͞ΕΔΠσΞϧͱ͍͏ɻ I = ⟨f1 ,…, fr ⟩ ͷ࣌ɺ f1 ,…, fr Λ I ͷجఈɺ·ͨ͸ ੜ੒ݩͱݺͿɻ ఆٛ 13೥5݄4೔౔༵೔
  8. Α͍ੑ࣭ʁ ࠨͷ໰୊Λߟ͑Δ f1 ͱ f2 ͷ “࠷େެ໿ࣜ” f = GCD(f1

    ,  f2 ) ͕Θ ͔Ε͹Α͍ I = ⟨ f ⟩ ͱͳΔͷͰɺ ͋ͱ͸ g, h Λ f Ͱׂ Γ੾ΕΔ͔ݟΔ f1  = x3 + x2 + x + 1 f2  = x2 − x − 2 I = ⟨ f1 ,  f2 ⟩ ⊆ k[x] ͱ͢Δͱɺg = x3 − 1,  h = x2 + 1 ͸ͦΕͧΕ I ʹଐ͔͢ʁ ໰୊ 1 13೥5݄4೔౔༵೔
  9. ࠷େެ໿ࣜͷٻΊํ Euclid ͷޓআ๏Λ࢖͏ ੔਺͚ͩͰͳ͘ɺׂΓࢉݪཧ͕੒ཱ͢Δ೚ ҙͷ؀Ͱ࢖͑Δ ੔਺ͷ৔߹ɿ͋Δݩ͕ ⟨a, b⟩ ʹଐ͢Δ ɹ㱻

    a, b ͰׂΕΔ ɹ㱻 a, b ͷ࠷େެ໿਺ͰׂΕΔ ಉ༷ͷ͜ͱ͕Ұม਺ଟ߲ࣜ؀Ͱ΋੒ཱ 13೥5݄4೔౔༵೔
  10. Euclid ͷޓআ๏ ೖྗɿf, g 1. f  Λ g ͰׂΓࢉͨ͠༨ΓΛ r0 ͱ͢Δ

    2.g  Λ r0 ͰׂΓࢉͨ͠༨ΓΛ r1 ͱ͢Δ 3.r0   Λ r1 ͰׂΓࢉͨ͠༨ΓΛ r2 ͱ͢Δ 4.ҎԼθϩʹͳΔ·Ͱ܁Γฦ͠ ग़ྗɿθϩͰͳ͍࠷ޙͷ rn 13೥5݄4೔౔༵೔
  11. ଟม਺ͷ৔߹ f1  = X2Y − 1 f2  = X3 − Y2 − X I = ⟨ f1 ,  f2 ⟩

    ⊆ k[X, Y] ͱ͢Δͱɺ g = X2Y2 − X3Y − XY − 1 ͸ I ʹଐ͔͢ʁ ໰୊ 2 13೥5݄4೔౔༵೔
  12. ଟม਺ͷ৔߹ ೋม਺ͷ৔߹Λߟ͑Δ f1  = X2Y − 1 f2  = X3 − Y2 − X I = ⟨ f1 ,  f2

    ⟩ ⊆ k[X, Y] ͱ͢Δͱɺ g = X2Y2 − X3Y − XY − 1 ͸ I ʹଐ͔͢ʁ ໰୊ 2 13೥5݄4೔౔༵೔
  13. ଟม਺ͷ৔߹ ೋม਺ͷ৔߹Λߟ͑Δ f1 ͱ f2 ͷ “࠷େެ໿ࣜ” ͷΑ͏ͳ෺Λߟ͑ΒΕ Δ͔ʁ f1

     = X2Y − 1 f2  = X3 − Y2 − X I = ⟨ f1 ,  f2 ⟩ ⊆ k[X, Y] ͱ͢Δͱɺ g = X2Y2 − X3Y − XY − 1 ͸ I ʹଐ͔͢ʁ ໰୊ 2 13೥5݄4೔౔༵೔
  14. ଟม਺ͷ৔߹ ೋม਺ͷ৔߹Λߟ͑Δ f1 ͱ f2 ͷ “࠷େެ໿ࣜ” ͷΑ͏ͳ෺Λߟ͑ΒΕ Δ͔ʁ f1

     = X2Y − 1 f2  = X3 − Y2 − X I = ⟨ f1 ,  f2 ⟩ ⊆ k[X, Y] ͱ͢Δͱɺ g = X2Y2 − X3Y − XY − 1 ͸ I ʹଐ͔͢ʁ ໰୊ 2 ➡ ग़དྷͳ͍ʂ 13೥5݄4೔౔༵೔
  15. ଟ߲ࣜͷදݱ ୯߲ࣜॱংͷલʹɺଟ߲ࣜͷදݱʹ͍ͭͯ จࣈͱࢦ਺ͷྻʢ1, x2, xy, y2 ͳͲʣΛ୯߲ࣜͱ͍ ͍ɺͦΕͧΕʹ܎਺Λॻ͚ͯՃ͑ͨ΋ͷΛଟ߲ࣜ ͱݺͿͷͩͬͨ จࣈͷؒʹॱ൪ΛܾΊΕ͹ɺ୯߲ࣜ͸੔਺ͷϕΫ

    τϧͱಉҰࢹग़དྷΔ x > y ͱ͢Ε͹ɺx2 ↔ (2, 0), xy ↔ (1, 1),  1 ↔ (0, 0) ͱݴ͏۩߹ʹରԠ͢Δ ͦ͜Ͱ n-ม਺୯߲ࣜશମΛℤn ≥0 ͱಉҰࢹ͢Δ 13೥5݄4೔౔༵೔
  16. ୯߲ࣜॱংͷิ଍ 3 ͷඇෛੑͷ৚݅͸ɺશॱংੑͱՃ๏ੑͷԼͰ ҎԼͷೋͭͱಉ஋ ੔ྻੑɿ೚ҙͷۭͰͳ͍ ℤn ≥0 ͷ෦෼ू߹͕ < ʹؔͯ͠࠷খ஋Λ࣋ͭ

    ߱࠯৚݅ɿ > ʹؔ͢ΔແݶԼ߱ྻ " " " α0  > α1  > α2  > ⋯ > αn  > ⋯ ͸ଘࡏ͠ͳ͍ 13೥5݄4೔౔༵೔
  17. ୯߲ࣜॱংͷิ଍ 3 ͷඇෛੑͷ৚݅͸ɺશॱংੑͱՃ๏ੑͷԼͰ ҎԼͷೋͭͱಉ஋ ੔ྻੑɿ೚ҙͷۭͰͳ͍ ℤn ≥0 ͷ෦෼ू߹͕ < ʹؔͯ͠࠷খ஋Λ࣋ͭ

    ߱࠯৚݅ɿ > ʹؔ͢ΔແݶԼ߱ྻ " " " α0  > α1  > α2  > ⋯ > αn  > ⋯ ͸ଘࡏ͠ͳ͍ ͜ΕΒ͸ɺΞϧΰϦζϜͷఀࢭੑͷূ໌Ͱ࢖͏ 13೥5݄4೔౔༵೔
  18. ୯߲ࣜॱংͷྫ ҎԼ α = (a1 , …, an ), β = (b1 , …, bn ) ͱ͢Δ ࣙॻࣜॱং

    >lex ͸୯߲ࣜॱং α >lex β :⟺ a1  = b1 , …, ai−1  = bi−1 ,  ai  > bi ٯࣙॻࣜॱং >revlex ͸୯߲ࣜॱংͰͳ͍ α >revlex β :⟺ ai+1  = bi+1 , …, an  = bn ,  ai  < bi ʢ※࠷ޙͷෆ౳߸ͷ޲͖ʹ஫ҙʂʣ 13೥5݄4೔౔༵೔
  19. ୯߲ࣜॱংͷྫ ࣍਺෇͖ࣙॻࣜॱং >grlex ͸୯߲ࣜॱং α >grlex β :⟺ ∣α∣ > ∣β∣ or

    (∣α∣=∣β∣ and α >lex β) ͨͩ͠ ∣α∣ = a1  + ⋯ + an ʢશ࣍਺ʣ ࣍਺෇͖ٯࣙॻࣜॱং >grevlex ͸୯߲ࣜॱং α >grevlex β :⟺ ∣α∣>∣β∣ or (∣α∣=∣β∣ and α >revlex β) 13೥5݄4೔౔༵೔
  20. ໿ଋ ୯߲ࣜॱং > Λݻఆ͢Δɻଟ߲ࣜ f ʹݱΕΔ ʢ܎਺ൈ͖ͷʣ୯߲ࣜͷதͰɺ> ʹ͍ͭͯ࠷ େͱͳΔ΋ͷΛઌ಄୯߲ࣜͱӠ͍ɺLM(f) Ͱ

    ද͢ɻLM(f) ͷ܎਺Λઌ಄܎਺ͱ͍͍ɺLC(f) Ͱද͢ɻLT(f) = LC(f) LM(f) Λઌ಄߲ͱݺͿɻ 13೥5݄4೔౔༵೔
  21. ྫ f = x + 2y2w + 3z3 (x >

    y > z >w) >lex ɿLM(f) = x, LC(f) = 1, LT(f) = x >grlex ɿLM(f) = y2w, LC(f) = 2, LT(f) = 2y2w >grevlex ɿLM(f) = z3, LC(f) = 3, LT(f) = 3z3 13೥5݄4೔౔༵೔
  22. ࣮ྫɿଟม਺ͷׂΓࢉ a1  =  a2  =  XY − 1 Y2 − 1 X2Y + XY2 + Y2 XY − 1, Y2 − 1

    Ͱ X2Y + XY2 + Y2 ΛׂΔɻࣙॻࣜॱংΛ࢖͏ɻ 13೥5݄4೔౔༵೔
  23. ࣮ྫɿଟม਺ͷׂΓࢉ a1  =  X  a2  =  XY − 1 Y2 − 1 X2Y + XY2 + Y2 X2Y − X

    XY2 + X + Y2 ্͔ΒҰͭ߱Ζͯ͠ɺ߱ႈͷॱʹฒ΂Δ 13೥5݄4೔౔༵೔
  24. ࣮ྫɿଟม਺ͷׂΓࢉ a1  =  X  +  a2  =  XY − 1 Y2 − 1 X2Y + XY2 + Y2

    X2Y − X XY2 + X + Y2 ઌ಄߲ʹ஫໨ɻ XY − 1 ͰׂΕΔɻ 13೥5݄4೔౔༵೔
  25. ࣮ྫɿଟม਺ͷׂΓࢉ a1  =  X  +  Y a2  =  XY − 1 Y2 − 1

    X2Y + XY2 + Y2 X2Y − X XY2 + X + Y2 XY2 − Y X + Y2 + Y ઌఔͱಉ༷ʹܭࢉɻ 13೥5݄4೔౔༵೔
  26. ࣮ྫɿଟม਺ͷׂΓࢉ a1  =  X  +  Y a2  =  XY − 1 Y2 − 1

    X2Y + XY2 + Y2 X2Y − X XY2 + X + Y2 XY2 − Y X + Y2 − Y ઌ಄߲ʹ஫໨ɻXY, Y2 ͲͪΒͰ΋ׂΕͳ͍ɻ 13೥5݄4೔౔༵೔
  27. ࣮ྫɿଟม਺ͷׂΓࢉ a1  =  X  +  Y a2  =  1 XY − 1

    Y2 − 1 X2Y + XY2 + Y2 X2Y − X XY2 + X + Y2 XY2 − Y X + Y2 − Y X ׂΕͳ͍ͷͰ X ͸༨Γͱͯ͠ԣʹΑ͚Δ Y2 − Y 13೥5݄4೔౔༵೔
  28. ࣮ྫɿଟม਺ͷׂΓࢉ a1  =  X  +  Y a2  =  1 XY − 1

    Y2 − 1 X2Y + XY2 + Y2 X2Y − X XY2 + X + Y2 XY2 − Y X + Y2 − Y X Y2 − Y ઌ಄߲ʹ஫໨ɻ XY ͸ແཧͩ 13೥5݄4೔౔༵೔
  29. ࣮ྫɿଟม਺ͷׂΓࢉ a1  =  X  +  Y a2  =  1 XY − 1

    Y2 − 1 X2Y + XY2 + Y2 X2Y − X XY2 + X + Y2 XY2 − Y X + Y2 − Y X Y2 ͰׂΕΔͷͰɺׂΔɻ Y2 − Y Y2 − 1 Y + 1 13೥5݄4೔౔༵೔
  30. ࣮ྫɿଟม਺ͷׂΓࢉ a1  =  X  +  Y a2  =  1 XY − 1

    Y2 − 1 X2Y + XY2 + Y2 X2Y − X XY2 + X + Y2 XY2 − Y X + Y2 − Y X Y2 − Y Y2 − 1 Y + 1 Y 1 0 1 Y, 1 ڞʹͲͷ߲Ͱ΋ׂΕͳ͍ͷͰԣʹΑ͚Δ 13೥5݄4೔౔༵೔
  31. ࣮ྫɿଟม਺ͷׂΓࢉ a1  =  X  +  Y a2  =  1 XY − 1

    Y2 − 1 X2Y + XY2 + Y2 X2Y − X XY2 + X + Y2 XY2 − Y X + Y2 − Y X Y2 − Y Y2 − 1 Y + 1 Y 1 0 1 r = X + Y + 1 Α͚ͨͷΛ଍ͯ͠ɺ༨Γ r ͕ग़Δ 13೥5݄4೔౔༵೔
  32. ࣮ྫɿଟม਺ͷׂΓࢉ a1  =  X  +  Y a2  =  1 XY − 1

    Y2 − 1 X2Y + XY2 + Y2 X2Y − X XY2 + X + Y2 XY2 − Y X + Y2 − Y X Y2 − Y Y2 − 1 Y + 1 Y 1 0 1 r = X + Y + 1 X2Y + XY2 + Y2 = (XY − 1) (X+Y) + (Y2 − 1) ⋅1 + X + Y + 1 13೥5݄4೔౔༵೔
  33. ༨Γͷ໰୊ a1  =  X + 1 a2  = X  Y2 − 1

    XY − 1 X2Y + XY2 + Y2 X2Y − X XY2 + X + Y2 XY2 − X 2X + Y2 2X Y2 Y2 − 1 1 0 1 r = 2X + 1 X2Y + XY2 + Y2 = (XY − 1) X + (Y2 − 1)(X + 1) + 2X + 1 13೥5݄4೔౔༵೔
  34. Gröbner جఈ ୯߲ࣜॱং > ΛҰͭݻఆ͢Δɻଟ߲ࣜ؀ͷΠσΞ ϧ I ⊆ k[] ʹ͍ͭͯɺI ͷ༗ݶ෦෼ू߹

    G = {g1, …, gn } ⊆ I ͕࣍ͷ৚݅Λຬͨ͢ͱ͖ɺG ͸ > ʹؔ͢ Δ I ͷ Gröbner جఈ Ͱ͋Δͱݴ͏ɻ ⟨LT(I)⟩ = ⟨LT(g1 ), …, LT(gn )⟩ (i.e. ⟨LT(f) ∣ f ∈ I ⟩ = ⟨LT(g1 ), …, LT(gn )⟩) ఆٛ 13೥5݄4೔౔༵೔
  35. Gröbner جఈͷੑ࣭ ೚ҙͷଟ߲ࣜ؀ΠσΞϧʹର͠ Gröbner جఈ͕ଘࡏ͢Δ ΠσΞϧ I ͷ Gröbner جఈ

    G = {g1 , …, gk } ͸ I Λੜ੒ ͢ΔɻଈͪɺI = ⟨g1 , …, gk ⟩ ఆཧ 13೥5݄4೔౔༵೔
  36. Gröbner جఈͷੑ࣭ ೚ҙͷଟ߲ࣜ؀ΠσΞϧʹର͠ Gröbner جఈ͕ଘࡏ͢Δ ΠσΞϧ I ͷ Gröbner جఈ

    G = {g1 , …, gk } ͸ I Λੜ੒ ͢ΔɻଈͪɺI = ⟨g1 , …, gk ⟩ Gröbner جఈʹΑΔׂΓࢉͷ༨Γ͸ॱ൪ʹґΒͳ͍ɻ ఆཧ 13೥5݄4೔౔༵೔
  37. Gröbner جఈͷੑ࣭ ೚ҙͷଟ߲ࣜ؀ΠσΞϧʹର͠ Gröbner جఈ͕ଘࡏ͢Δ ΠσΞϧ I ͷ Gröbner جఈ

    G = {g1 , …, gk } ͸ I Λੜ੒ ͢ΔɻଈͪɺI = ⟨g1 , …, gk ⟩ Gröbner جఈʹΑΔׂΓࢉͷ༨Γ͸ॱ൪ʹґΒͳ͍ɻ Gröbner جఈͰׂͬͨ༨Γ͕θϩͰ͋Δࣄͱ I ʹଐ͢Δ ͜ͱ͸ಉ஋ɿ r = f ̅G = 0 ⟺ f ∈ I ఆཧ 13೥5݄4೔౔༵೔
  38. Buchberger ΞϧΰϦζϜ Gröbner جఈ͕ศརͦ͏ͳͷ͸Θ͔ͬͨ ۩ମతͳܭࢉ๏ɿBuchberger ΞϧΰϦζϜ ४උతͳఆٛɿf, g ∈ k[] ͷ S-ଟ߲ࣜ S(f,

    g) := ɹɹ ɹɹ f − ɹɹ  ɹɹg LCM(LT(f), LT(g)) LT(f) LCM(LT(f), LT(g)) LT(g) 13೥5݄4೔౔༵೔
  39. Buchberger ΞϧΰϦζϜ Gröbner جఈ͕ศརͦ͏ͳͷ͸Θ͔ͬͨ ۩ମతͳܭࢉ๏ɿBuchberger ΞϧΰϦζϜ ४උతͳఆٛɿf, g ∈ k[] ͷ S-ଟ߲ࣜ S(f,

    g) := ɹɹ ɹɹ f − ɹɹ  ɹɹg f, g ͷઌ಄߲ಉ࢜Λଧফ͠߹Θͤͨ෺ LCM(LT(f), LT(g)) LT(f) LCM(LT(f), LT(g)) LT(g) 13೥5݄4೔౔༵೔
  40. Buchberger ΞϧΰϦζϜ Gröbner جఈ͕ศརͦ͏ͳͷ͸Θ͔ͬͨ ۩ମతͳܭࢉ๏ɿBuchberger ΞϧΰϦζϜ ४උతͳఆٛɿf, g ∈ k[] ͷ S-ଟ߲ࣜ S(f,

    g) := ɹɹ ɹɹ f − ɹɹ  ɹɹg f, g ͷઌ಄߲ಉ࢜Λଧফ͠߹Θͤͨ෺ ͨͩ͠ LCM((a1 , …, an ), (b1 , …, bn ))  := (max{a1 , b1 }, …, max{an , bn }) LCM(LT(f), LT(g)) LT(f) LCM(LT(f), LT(g)) LT(g) 13೥5݄4೔౔༵೔
  41. Buchberger ൑ఆ๏ I ⊆ k[]ɿΠσΞϧɹɹ >ɿ୯߲ࣜॱং G = {g1 , …, gk } ⊆ IɿI ͷੜ੒ݩ G’ = (g1 , …, gk )ɿG

    ͷݩΛద౰ʹฒ΂ͨ΋ͷ ͜ͷͱ͖ҎԼͷೋͭ͸ಉ஋ɿ 1. G ͸ > ʹؔ͢Δ I ͷ Gröbner جఈ 2.S(gi , gk )G’ = 0ɹ(∀ i < j) ఆཧ 13೥5݄4೔౔༵೔
  42. ؆୯ͳ࣮૷ buchberger :: [Polynomial k ord n] → [Polynomial k

    ord n] buchberger ideal = fst $ until (null ∘ snd) loop (ideal, calc ideal) where loop (ggs, acc) = let cur = nub $ ggs ++ acc in (cur, calc cur) calc acc = [ q | f ← acc, g ← acc, f ≠ g , let q = sPolynomial f g `mod` acc , q ≠ zero ] 13೥5݄4೔౔༵೔
  43. lex Ͱܭࢉ͢Δͱʁ G = {x2y − 1, x3 − y2 − x, y3 + xy − x,  − y3 − xy + x, y5 + y4 +  y3 + x2 − x − 1,  − y5 − y4 − y3 − x2 + x + 1,  − y6 − y5 − y4 −  y3 + x + y − 1, y7 + 2y6 + 2y5 + 2y4 + 2y3 − y2 − 2x + 1, y6 +  y5 + y4 + y3 − x − y + 1,  − y7 − 2y6 − 2y5 − 2y4 − 2y3 + y2 +  2x − 1,  − y9 − 2y8 − 3y7 + y4 − 4y + 3,  − 1 / 2y10 − 3 / 2y9 −  5 / 2y8 − 7 / 2y7 + 1 / 2y5 + 1 / 2y4 − 9 / 2y + 7 / 2, y7 − y2 + 2y  − 1, 1 / 2y8 + y7 − 1 / 2y3 + 3 / 2y − 1,  − y7 + y2 − 2y + 1,  −  y8 − 2y7 + y3 − 3y + 2,  − 1 / 2y9 − 3 / 2y8 − 5 / 2y7 + 1 / 2y4 + 

    1 / 2y3 − 7 / 2y + 5 / 2, y9 + 2y8 + 3y7 − y4 + 4y − 3, y8 + 2y7 −  y3 + 3y − 2, 1 / 2y7 − 1 / 2y2 + y − 1 / 2, 1 / 2y10 + 3 / 2y9 + 5 /  2y8 + 7 / 2y7 − 1 / 2y5 − 1 / 2y4 + 9 / 2y − 7 / 2,  − 1 / 2y8 − y7  + 1 / 2y3 − 3 / 2y + 1, 1 / 2y9 + 3 / 2y8 + 5 / 2y7 − 1 / 2y4 − 1 /  2y3 + 7 / 2y − 5 / 2,  − 1 / 2y7 + 1 / 2y2 − y + 1 / 2} 13೥5݄4೔౔༵೔
  44. ۃখɾඃ໿Gröbnerجఈ Buchberger ΞϧΰϦζϜͰٻΊͨجఈʹ͸ແବ͕͋Δ ۃখɾඃ໿ Gröbner جఈʂ Gröbnerجఈ G ͕ۃখ ⇔ ೚ҙͷ

    i ʹ͍ͭͯ LC(gi ) = 1, LT(gi ) ͸Ͳͷ LT(gj ) (j ≠ i) Ͱ΋ׂΕͳ͍ 13೥5݄4೔౔༵೔
  45. ۃখɾඃ໿Gröbnerجఈ Buchberger ΞϧΰϦζϜͰٻΊͨجఈʹ͸ແବ͕͋Δ ۃখɾඃ໿ Gröbner جఈʂ Gröbnerجఈ G ͕ۃখ ⇔ ೚ҙͷ

    i ʹ͍ͭͯ LC(gi ) = 1, LT(gi ) ͸Ͳͷ LT(gj ) (j ≠ i) Ͱ΋ׂΕͳ͍ G ͕ඃ໿  ⇔ ೚ҙͷ i ʹ͍ͭͯ LC(gi ) = 1 ͔ͭ  gi ͷͲͷ߲΋ LT(gj ) (j ≠ i) Ͱ΋ׂΕͳ͍ 13೥5݄4೔౔༵೔
  46. ඃ໿ Gröbner جఈͷҰҙੑ Gröbner جఈ͸ෳ਺ଘࡏ͠͏Δ buchberger ͰٻΊͨ෺ɺͦ ͷۃখԽ……etc ͦΕΒ͸ඃ໿Խ͢Ε͹Ұக͢ Δʂʢ୯߲ࣜॱং͕ಉ͡ͳΒʣ

    I ⊆ k[]ɿΠσΞϧ >ɿ୯߲ࣜॱং I ͷ > ʹ͍ͭͯͷඃ ໿ Gröbner جఈ͸Ұ ҙʹఆ·Δ ఆཧ 13೥5݄4೔౔༵೔
  47. ඃ໿ Gröbner جఈͷҰҙੑ Gröbner جఈ͸ෳ਺ଘࡏ͠͏Δ buchberger ͰٻΊͨ෺ɺͦ ͷۃখԽ……etc ͦΕΒ͸ඃ໿Խ͢Ε͹Ұக͢ Δʂʢ୯߲ࣜॱং͕ಉ͡ͳΒʣ

    ΠσΞϧ͕౳͍͔͠Ͳ͏͔Λɺ ඃ໿ Gröbner جఈͷੜ੒ݩ͕ ౳͍͔͠Ͱ൑ఆग़དྷΔʂ I ⊆ k[]ɿΠσΞϧ >ɿ୯߲ࣜॱং I ͷ > ʹ͍ͭͯͷඃ ໿ Gröbner جఈ͸Ұ ҙʹఆ·Δ ఆཧ 13೥5݄4೔౔༵೔
  48. ඃ໿Խͷखଓ ·ͣۃখԽΛߦ͏ 1. G ͷ֤ݩΛ࠷ߴ࣍܎਺Ͱׂͬͯ LC(p) = 1 2. (2)

    ͷ৚݅Λຬͨ͞ͳ͍෺ΛऔΓআ͘ 13೥5݄4೔౔༵೔
  49. ඃ໿Խͷखଓ ·ͣۃখԽΛߦ͏ 1. G ͷ֤ݩΛ࠷ߴ࣍܎਺Ͱׂͬͯ LC(p) = 1 2. (2)

    ͷ৚݅Λຬͨ͞ͳ͍෺ΛऔΓআ͘ ͦΕΛඃ໿Խ͢Δ 1. p ∈ G ΛऔΓɺp’ = p̅G \ {p}, G’ = G \ {p} ∪ {p’} ͱ͢Δ 2. q ∈ G’ \ {p’} ʹ͍ͭͯಉ༷ͷࣄΛ͢ΔɻҎԼಉจɻ 13೥5݄4೔౔༵೔
  50. ࣮૷ྫ దٓΞοϓσʔτ͢Δඞཁ͕͋ΔͷͰ ST Ͱָͯ͠ॻ͍ͨ ඃ໿Խͷ࣮૷΋ಉ༷ minimizeGroebnerBasis :: (Field k, IsPolynomial

    k n, IsMonomialOrder order) ⇒ [OrderedPolynomial k ord n] → [OrderedPolynomial k ord n] minimizeGroebnerBasis bs = runST $ do left ← newSTRef bs right ← newSTRef [] whileM_ (not . null <$> readSTRef left) $ do f : xs ← readSTRef left writeSTRef left xs ys ← readSTRef right if any (λg → leadingMonomial g `divs` leadingMonomial f) xs ∨ any (λg → leadingMonomial g `divs` leadingMonomial f) ys then writeSTRef right ys else writeSTRef right (monoize f : ys) readSTRef right 13೥5݄4೔౔༵೔
  51. θϩ؆໿ؔ܎ ʮׂͬͯ༨ΓθϩʯΛҰൠԽͨ͠ͷ͕࣍ ଟ߲ࣜ f ∈ k[] ͕ G = {g1 , …, gk } ⊆ k[] Λ ๏ͱͯ͠θϩʹ؆໿ʢه߸ɿ

    f →G 0ʣ͞ΕΔ  ⇔ f = a1 g1  + ⋯ + ak gk (ai  ∈ k[]) ͔ͭ [ai gi  = 0 ·ͨ͸ deg(f) ≥ deg(ai gi )] ୠ͠ɺdeg(f) ͸ f ͷଟॏ࣍਺ deg(f) = LM(f) ఆٛ 13೥5݄4೔౔༵೔
  52. վྑ Buchberger ൑ఆ๏ ࣮͸ Buchberger ൑ఆ๏͸θϩ؆໿Ͱे෼ʂ I ⊆ k[]ɿΠσΞϧɹɹ >ɿ୯߲ࣜॱং G = {g1 , …, gk } ⊆ IɿI

    ͷੜ੒ݩ ͜ͷͱ͖ҎԼͷೋͭ͸ಉ஋ɿ 1. G ͸ > ʹؔ͢Δ I ͷ Gröbner جఈ 2. S(gi , gj )  →G   0ɹ(∀ i < j) ఆཧ 13೥5݄4೔౔༵೔
  53. ޓ͍ʹૉ൑ఆ ೋ൪໨ͷ৚͕݅࢖͑Δʂ x3 ͱ z4 ͸ޓ͍ʹૉͳͷͰ S(x3 + y, z4) →G 0 ͱͳΔ ɹɹɹ

    S(x3 + y, z4) = yz4 ɹɹɹ∴  S(x3 + y, z4)G = y ≠ 0 ࠓ·Ͱͷ൑ఆ๏ͩͱແବʹׂΓࢉΛ͢Δʂ ͲΕ͘Β͍վળʁ 13೥5݄4೔౔༵೔
  54. Benchmark lex01 grlex01 grevlex01 lex03 grlex03 grevlex03 0ms 22.5ms 45ms

    67.5ms 90ms simple prime grlex02 grevlex02 0.9s 1s 1.1s 1.2s 1.3s grlex04 grevlex04 0μs 150μs 300μs 450μs 600μs I1  = ⟨x2 + y2 + z2 − 1, x2 + y2 + z2 − 2x, 2x − 3y − z⟩ I2  = ⟨x2y − 2xy − 4z − 1, z − y2, x3 − 4zy⟩ I3  = ⟨2S − ay, b2 − (x2 + y2), c2 − ((a − x)2 + y2)⟩" I4  = ⟨z5 + y4 + x3 − 1, z3 + y3 + x2 − 1⟩ 13೥5݄4೔౔༵೔
  55. syzygy (h1 , …, hs ) ∈ k[]s ͕ F = (f1 , …, fs

    ) ⊆ k[]s ͷ ઌ಄߲ͷ syzygy  :⇔ h1 LT(f1 ) + ⋯ + hs LT(fs ) = 0 F ͷઌ಄߲ syzygy ͷશମΛ S(F) ͱॻ͘ɻ ఆٛ 13೥5݄4೔౔༵೔
  56. syzygy (h1 , …, hs ) ∈ k[]s ͕ F = (f1 , …, fs

    ) ⊆ k[]s ͷ ઌ಄߲ͷ syzygy  :⇔ h1 LT(f1 ) + ⋯ + hs LT(fs ) = 0 F ͷઌ಄߲ syzygy ͷશମΛ S(F) ͱॻ͘ɻ T ⊆ S(F) ͕ S(F) ͷجఈ  ⇔ S(F) ͷͲͷݩ΋ T ͷݩͷ༗ ݶݸͷ࿨Ͱॻ͚Δɻ ఆٛ 13೥5݄4೔౔༵೔
  57. syzygy (h1 , …, hs ) ∈ k[]s ͕ F = (f1 , …, fs

    ) ⊆ k[]s ͷ ઌ಄߲ͷ syzygy  :⇔ h1 LT(f1 ) + ⋯ + hs LT(fs ) = 0 F ͷઌ಄߲ syzygy ͷશମΛ S(F) ͱॻ͘ɻ T ⊆ S(F) ͕ S(F) ͷجఈ  ⇔ S(F) ͷͲͷݩ΋ T ͷݩͷ༗ ݶݸͷ࿨Ͱॻ͚Δɻ ei  = (0, …, 0, 1, 0, …, 0) (i ൪໨͚ͩ 1) ͱॻ͘͜ͱʹ͢ Δɻ͜ͷͱ͖ ͱஔ͘ͱɺ S(fi , fj ) = Sij  ⋅ F ʢ಺ੵʣͱͳΔɻ LCM(LT(fi ), LT(fj )) LT(fi) LCM(LT(fi ), LT(fj )) LT(fj) Sij  :=  ei −   ej ఆٛ 13೥5݄4೔౔༵೔
  58. syzygy ͷجఈͱθϩ؆໿ I ⊆ k[]ɿΠσΞϧɹɹ >ɿ୯߲ࣜॱং G = {g1 , …, gk } ⊆ IɿI ͷੜ੒ݩ S ⊆ S(G)ɿG ͷઌ಄߲

    syzygy ͷجఈ ͜ͷͱ͖ҎԼͷೋͭ͸ಉ஋ɿ 1. G ͸ > ʹؔ͢Δ I ͷ Gröbner جఈ 2.೚ҙͷ T ∈ S ʹର͠ɺ T ⋅ G = ∑ k i = 1 ti gi  →G   0ɹ(∀ i < j) ఆཧ 13೥5݄4೔౔༵೔
  59. S-ଟ߲ࣜͱ syzygy ࣮͸ Sij ͷશମ͸ S(G) ͷجఈ ༨෼ͳجఈ΋͍ࠞͬͯ͡Δ F = (x2y2 + z, xy2 − y, x2y + yz) S12

     = (1,  -x, 0) S13  = (1, 0,  -y) S23  = (0, x,  -y) S13  − S12  = (0, x,  -y) = S23 ∴ S23 ͸ཁΒͳ͍ࢠ 13೥5݄4೔౔༵೔
  60. S-ଟ߲ࣜͱ syzygy ࣮͸ Sij ͷશମ͸ S(G) ͷجఈ ༨෼ͳجఈ΋͍ࠞͬͯ͡Δ F = (x2y2 + z, xy2 − y, x2y + yz) S12

     = (1,  -x, 0) S13  = (1, 0,  -y) S23  = (0, x,  -y) S13  − S12  = (0, x,  -y) = S23 ∴ S23 ͸ཁΒͳ͍ࢠ ༨෼ͳجఈΛ༧Ί൑ఆग़དྷͳ͍͔ʁ 13೥5݄4೔౔༵೔
  61. ແବͳ syzygy جఈͷ൑ఆ G = (g1 , …, gs ) gi , gj , gk  ∈ G ⊆

    {Sij ∣ 1 ≤ j < k ≤ s}ɿS(G) ͷجఈ LT(gk ) ∣ LCM(LT(gi ), LT(gj )) ͔ͭ Sik , Sjk  ∈  ⇒  S \ {Sij } ΋ S(G) ͷجఈ ໋୊ 13೥5݄4೔౔༵೔
  62. ແବͳ syzygy جఈͷ൑ఆ G = (g1 , …, gs ) gi , gj , gk  ∈ G ⊆

    {Sij ∣ 1 ≤ j < k ≤ s}ɿS(G) ͷجఈ LT(gk ) ∣ LCM(LT(gi ), LT(gj )) ͔ͭ Sik , Sjk  ∈  ⇒  S \ {Sij } ΋ S(G) ͷجఈ ໋୊ ͜ΕͰׂΓࢉͷճ਺Λେ෯ʹݮΒͤΔʂ 13೥5݄4೔౔༵೔
  63. վྑ൛ Buchbergerɾվ ೖྗɿ F = (f1 , …, fs ) ॳظԽɿB := {(i, j)∣1 ≤ i < j ≤ s}ʢsyzygyجఈͷީิʣ G := F t := s

    खॱɿ B = ∅ ͱͳΔ·Ͱ࣍Λ܁Γฦ͢ɿ 1. (i, j) ∈ B Λ೚ҙʹબͿ 13೥5݄4೔౔༵೔
  64. վྑ൛ Buchbergerɾվ ೖྗɿ F = (f1 , …, fs ) ॳظԽɿB := {(i, j)∣1 ≤ i < j ≤ s}ʢsyzygyجఈͷީิʣ G := F t := s

    खॱɿ B = ∅ ͱͳΔ·Ͱ࣍Λ܁Γฦ͢ɿ 1. (i, j) ∈ B Λ೚ҙʹબͿ 2. LCM(LT(fi ), LT(fj ))  ≠  LT(fi ) LT(fj ) ͔ͭ Test(fi , fj , B) ِ͕ͳΒ 13೥5݄4೔౔༵೔
  65. վྑ൛ Buchbergerɾվ ೖྗɿ F = (f1 , …, fs ) ॳظԽɿB := {(i, j)∣1 ≤ i < j ≤ s}ʢsyzygyجఈͷީิʣ G := F t := s

    खॱɿ B = ∅ ͱͳΔ·Ͱ࣍Λ܁Γฦ͢ɿ 1. (i, j) ∈ B Λ೚ҙʹબͿ 2. LCM(LT(fi ), LT(fj ))  ≠  LT(fi ) LT(fj ) ͔ͭ Test(fi , fj , B) ِ͕ͳΒ 1. S := S(fi , fj )G 13೥5݄4೔౔༵೔
  66. վྑ൛ Buchbergerɾվ ೖྗɿ F = (f1 , …, fs ) ॳظԽɿB := {(i, j)∣1 ≤ i < j ≤ s}ʢsyzygyجఈͷީิʣ G := F t := s

    खॱɿ B = ∅ ͱͳΔ·Ͱ࣍Λ܁Γฦ͢ɿ 1. (i, j) ∈ B Λ೚ҙʹબͿ 2. LCM(LT(fi ), LT(fj ))  ≠  LT(fi ) LT(fj ) ͔ͭ Test(fi , fj , B) ِ͕ͳΒ 1. S := S(fi , fj )G 2. S ≠ 0 ͳΒ͹ t = t + 1, ft  = S, G = G ∪ {ft }, B = B ∪ {(i, t)∣1 ≤ i ≤ t − 1} 13೥5݄4೔౔༵೔
  67. վྑ൛ Buchbergerɾվ ೖྗɿ F = (f1 , …, fs ) ॳظԽɿB := {(i, j)∣1 ≤ i < j ≤ s}ʢsyzygyجఈͷީิʣ G := F t := s

    खॱɿ B = ∅ ͱͳΔ·Ͱ࣍Λ܁Γฦ͢ɿ 1. (i, j) ∈ B Λ೚ҙʹબͿ 2. LCM(LT(fi ), LT(fj ))  ≠  LT(fi ) LT(fj ) ͔ͭ Test(fi , fj , B) ِ͕ͳΒ 1. S := S(fi , fj )G 2. S ≠ 0 ͳΒ͹ t = t + 1, ft  = S, G = G ∪ {ft }, B = B ∪ {(i, t)∣1 ≤ i ≤ t − 1} 3. B = B \ {(i, j)} 13೥5݄4೔౔༵೔
  68. վྑ൛ Buchbergerɾվ ೖྗɿ F = (f1 , …, fs ) ॳظԽɿB := {(i, j)∣1 ≤ i < j ≤ s}ʢsyzygyجఈͷީิʣ G := F t := s

    खॱɿ B = ∅ ͱͳΔ·Ͱ࣍Λ܁Γฦ͢ɿ 1. (i, j) ∈ B Λ೚ҙʹબͿ 2. LCM(LT(fi ), LT(fj ))  ≠  LT(fi ) LT(fj ) ͔ͭ Test(fi , fj , B) ِ͕ͳΒ 1. S := S(fi , fj )G 2. S ≠ 0 ͳΒ͹ t = t + 1, ft  = S, G = G ∪ {ft }, B = B ∪ {(i, t)∣1 ≤ i ≤ t − 1} 3. B = B \ {(i, j)} ग़ྗɿG 13೥5݄4೔౔༵೔
  69. վྑ൛ Buchbergerɾվ ೖྗɿ F = (f1 , …, fs ) ॳظԽɿB := {(i, j)∣1 ≤ i < j ≤ s}ʢsyzygyجఈͷީิʣ G := F t := s

    खॱɿ B = ∅ ͱͳΔ·Ͱ࣍Λ܁Γฦ͢ɿ 1. (i, j) ∈ B Λ೚ҙʹબͿ 2. LCM(LT(fi ), LT(fj ))  ≠  LT(fi ) LT(fj ) ͔ͭ Test(fi , fj , B) ِ͕ͳΒ 1. S := S(fi , fj )G 2. S ≠ 0 ͳΒ͹ t = t + 1, ft  = S, G = G ∪ {ft }, B = B ∪ {(i, t)∣1 ≤ i ≤ t − 1} 3. B = B \ {(i, j)} ग़ྗɿG ୠ͠Test(fi , fj , B) ⇔ ∃ k ≠ i, j [(i, k), (i, j) ∉ B, LT(fk ) ∣ LCM(LT(fi ), LT(fj ))] 13೥5݄4೔౔༵೔
  70. ࣮૷ syzygyBuchberger ideal = runST $ do bases ← newSTRef

    { Entry LM(f) f | f ← ideal } pairs ← newSTRef {(f, g) | (f, g) ← combinations ideal } len ← newSTRef $ length ideal whileM_ (not . null <$> readSTRef pairs) $ do Just ((f, g), rest) ← viewMin <$> readSTRef pairs bases0 ← readSTRef bases b .= rest let redundant = any (λ(Entry _ h) → h ∉ {f, g} ∧ (all (∉ rest) [(f, h), (g, h)]) ∧ LM(h) | LCM(LM(f), LM(g))) bases when (LCM(LM(f), LM(g)) ≠ LM(f) LM(g) ∧ not redundant) $ do len0 ← readSTRef len let s = S(f, g) `mod` map payload (toList bases0) when (s ≠ zero) $ do pairs += { (q, s) | Entry _ q ← qs } bases %= insert (Entry LM(s) s) len *= 2 map payload . toList <$> readSTRef bases 13೥5݄4೔౔༵೔
  71. Benchmark lex01 grlex01 grevlex01 lex03 grlex03 grevlex03 0ms 22.5ms 45ms

    67.5ms 90ms simple prime syzygy grlex02 grevlex02 0s 0.375s 0.75s 1.125s 1.5s grlex04 grevlex04 0μs 150μs 300μs 450μs 600μs 13೥5݄4೔౔༵೔
  72. Benchmark lex01 grlex01 grevlex01 lex03 grlex03 grevlex03 0ms 22.5ms 45ms

    67.5ms 90ms simple prime syzygy grlex02 grevlex02 0s 0.375s 0.75s 1.125s 1.5s grlex04 grevlex04 0μs 150μs 300μs 450μs 600μs ଎͗ͯ͢ݟ͑ͳ͍…… 13೥5݄4೔౔༵೔
  73. ޓ͍ʹૉ൑ఆͱͷൺֱ lex01 grlex01 grevlex01 lex03 grlex03 grevlex03 0ms 2.5ms 5ms

    7.5ms 10ms grlex02 grevlex02 0s 0.375s 0.75s 1.125s 1.5s grlex04 grevlex04 58μs 59.25μs60.5μs61.75μs 63μs prime syzygy 13೥5݄4೔౔༵೔
  74. ޓ͍ʹૉ൑ఆͱͷൺֱ lex01 grlex01 grevlex01 lex03 grlex03 grevlex03 0ms 2.5ms 5ms

    7.5ms 10ms grlex02 grevlex02 0s 0.375s 0.75s 1.125s 1.5s grlex04 grevlex04 58μs 59.25μs60.5μs61.75μs 63μs prime syzygy ͦΕͰ΋଎͍ ʂ 13೥5݄4೔౔༵೔
  75. selection strategy normal strategy ઌ಄߲ͷ LCM ͕ৗʹ࠷খʹͳΔ΋ͷ lex ॱংͳͲ࣍਺Λอͨͳ͍ॱংͰ͸ٯޮՌ sugar

    strategy Ծ૝తͳ੪࣍Խ࣍਺͕࠷খͷ෺ΛબͿ ͍ͣΕ΋ಉ཰ҰҐ͕ग़ͨΒૣ͘ग़ͯདྷͨํΛબͿ 13೥5݄4೔౔༵೔
  76. selection strategy normal strategy ઌ಄߲ͷ LCM ͕ৗʹ࠷খʹͳΔ΋ͷ lex ॱংͳͲ࣍਺Λอͨͳ͍ॱংͰ͸ٯޮՌ sugar

    strategy Ծ૝తͳ੪࣍Խ࣍਺͕࠷খͷ෺ΛબͿ ͍ͣΕ΋ಉ཰ҰҐ͕ग़ͨΒૣ͘ग़ͯདྷͨํΛબͿ ͜ͷ৚݅Λൈ͔͢ͱڪ͘͠஗͘ͳΔ…… 13೥5݄4೔౔༵೔
  77. sugar ଟ߲ࣜ (fi , fj ) ͷ sugar Λ࣍ͷΑ͏ʹఆΊΔɻ Sfᵢ  = deg(fi

    ), Sfⱼ  = deg(fj ) Sf ɿgiven Ͱ t ͕୯߲ࣜͳΒ Stf  = deg(t) + Sf 13೥5݄4೔౔༵೔
  78. sugar ଟ߲ࣜ (fi , fj ) ͷ sugar Λ࣍ͷΑ͏ʹఆΊΔɻ Sfᵢ  = deg(fi

    ), Sfⱼ  = deg(fj ) Sf ɿgiven Ͱ t ͕୯߲ࣜͳΒ Stf  = deg(t) + Sf f = g + h ͷ࣌ɺSf  = max(Sg , Sf ) 13೥5݄4೔౔༵೔
  79. sugar ଟ߲ࣜ (fi , fj ) ͷ sugar Λ࣍ͷΑ͏ʹఆΊΔɻ Sfᵢ  = deg(fi

    ), Sfⱼ  = deg(fj ) Sf ɿgiven Ͱ t ͕୯߲ࣜͳΒ Stf  = deg(t) + Sf f = g + h ͷ࣌ɺSf  = max(Sg , Sf ) (fi , fj ) ͷ sugar ͸ɺ্ʹैͬͯܭࢉͨ͠ S-ଟ ߲ࣜͷ sugar ͱ͢Δɻ 13೥5݄4೔౔༵೔
  80. ࣮૷ syzygyBuchbergerWithStrategy strategy ideal = runST $ do let gens

    = zip [1..] ideal bases ← newSTRef { Entry LM(f) f | (_, f) ← gens } pairs ← newSTRef { Entry (calcWeight strategy f g, j) (f, g) | ((i, f), (j, g)) ← combinations ideal } len ← newSTRef $ length ideal whileM_ (not . null <$> readSTRef pairs) $ do Just (Entry _ (f, g), rest) ← viewMin <$> readSTRef pairs -- தུ when (s ≠ zero) $ do pairs += { Entry (calcWeight strategy q s, j) (q, s) | Entry _ q ← qs | j ← [len0 + 1 ..] } bases %= insert (Entry LM(s) s) len *= 2 map payload . toList <$> readSTRef bases ॏΈΛ௥Ճ͢Δ͚ͩͰ࣮૷ग़དྷͯ͠·ͬͨ…… 13೥5݄4೔౔༵೔
  81. Benchmark lex01 grlex01 grevlex01 lex03 grlex03 grevlex03 0ms 0.15ms 0.3ms

    0.45ms 0.6ms grlex02 grevlex02 16ms 17ms 18ms 19ms 20ms grlex04 grevlex04 58μs 58.1μs 58.2μs58.3μs58.4μs syzygy sugar 13೥5݄4೔౔༵೔
  82. Benchmarkʢ࿦จ൛ʣ grevlex01 lex02 grevlex02 0ms 10ms 20ms 30ms 40ms grevlex03

    0ms 700ms1400ms2100ms 2800ms syzygy sugar lex01 0ms 0.5ms 1ms 1.5ms 2ms I1  = ⟨35y4 − 10xy2 − 210y2z + 3x2 + 30xz − 105z2 + 140yt − 21u,  5xy3 − 140y3z − 3x2y + 45xyz − 420yz2 + 210y2t − 25xt + 70zt + 126yu⟩ I2  = ⟨x + y + z + w, xy + yz + zw + wx, xyz + yzw + zwx + wxy, xyzw − 1⟩ɹ I3  = ⟨x31 − x6 − x − y, x8 − z, x10 − t⟩ 13೥5݄4೔౔༵೔
  83. ৄ͘͠͸ίʔυࢀর -- | N-ary Monomial. IntMap contains degrees for each

    xi. type Monomial (n :: Nat) = Vector Int n -- | Monomial with monomial order. newtype OrderedMonomial (ord :: ⋆) n = OrderedMonomial { getMonomial :: Monomial n } deriving instance (Eq (Monomial n)) ⇒  Eq (OrderedMonomial ordering n) type MonomialOrder = ∀n. Monomial n → Monomial n → Ordering -- | Class to lookup ordering from its (type-level) name. class IsOrder (ordering :: ⋆) where cmpMonomial :: Proxy ordering → MonomialOrder -- | Class for Monomial orders. class IsOrder name ⇒ IsMonomialOrder name where 13೥5݄4೔౔༵೔
  84. ৄ͘͠͸ίʔυࢀর data Lex = Lex data Revlex = Revlex data

    Grevlex = Grevlex lex :: MonomialOrder lex Nil Nil = EQ lex (x :- xs) (y :- ys) = x `compare` y <> xs `lex` ys lex _ _ = error "cannot happen" revlex :: Monomial n → Monomial n → Ordering revlex (x :- xs) (y :- ys) = xs `revlex` ys <> y `compare` x revlex Nil Nil = EQ revlex _ _ = error "cannot happen!" graded :: (Monomial n → Monomial n → Ordering) → (Monomial n → Monomial n → Ordering) graded cmp xs ys = comparing totalDegree xs ys <> cmp xs ys instance IsOrder Grevlex where cmpMonomial _ = graded revlex instance IsOrder Revlex where cmpMonomial _ = revlex 13೥5݄4೔౔༵೔
  85. ΠσΞϧ hack data Ideal r = ∀n. Ideal (Vector r

    n) instance Eq r ⇒ Eq (Ideal r) where (≡) = (≡) `on` generators generators :: Ideal r → [r] generators (Ideal is) = toList is addToIdeal :: r → Ideal r → Ideal r addToIdeal i (Ideal is) = Ideal (i :- is) toIdeal :: NoetherianRing r ⇒ [r] → Ideal r toIdeal = foldr addToIdeal (Ideal Nil) 13೥5݄4೔౔༵೔
  86. ΠσΞϧ hack data Ideal r = ∀n. Ideal (Vector r

    n) instance Eq r ⇒ Eq (Ideal r) where (≡) = (≡) `on` generators generators :: Ideal r → [r] generators (Ideal is) = toList is addToIdeal :: r → Ideal r → Ideal r addToIdeal i (Ideal is) = Ideal (i :- is) toIdeal :: NoetherianRing r ⇒ [r] → Ideal r toIdeal = foldr addToIdeal (Ideal Nil) ΠσΞϧ͸Ϧετ……Ͱ͸ͳ͍ʂ 13೥5݄4೔౔༵೔
  87. ΠσΞϧ hack data Ideal r = ∀n. Ideal (Vector r

    n) instance Eq r ⇒ Eq (Ideal r) where (≡) = (≡) `on` generators generators :: Ideal r → [r] generators (Ideal is) = toList is addToIdeal :: r → Ideal r → Ideal r addToIdeal i (Ideal is) = Ideal (i :- is) toIdeal :: NoetherianRing r ⇒ [r] → Ideal r toIdeal = foldr addToIdeal (Ideal Nil) ΠσΞϧ͸Ϧετ……Ͱ͸ͳ͍ʂ ඇৗʹਂԕͳΔཧ༝ʹΑΓଘࡏྔԽ͞Εͨ sized-vector 13೥5݄4೔౔༵೔
  88. ΠσΞϧ hack data Ideal r = ∀n. Ideal (Vector r

    n) instance Eq r ⇒ Eq (Ideal r) where (≡) = (≡) `on` generators generators :: Ideal r → [r] generators (Ideal is) = toList is addToIdeal :: r → Ideal r → Ideal r addToIdeal i (Ideal is) = Ideal (i :- is) toIdeal :: NoetherianRing r ⇒ [r] → Ideal r toIdeal = foldr addToIdeal (Ideal Nil) ΠσΞϧ͸Ϧετ……Ͱ͸ͳ͍ʂ ඇৗʹਂԕͳΔཧ༝ʹΑΓଘࡏྔԽ͞Εͨ sized-vector ফڈΠσΞϧͷܭࢉͷ࣌ʹ҉໧ཪʹܕΛ߹ΘͤΔҝ 13೥5݄4೔౔༵೔
  89. ⁋᧒Λ߹Θͤʹ༻ҙ͞Εͨ data Monomorphic k = ∀a. Monomorphic (k a) --

    | A types which have the monomorphic representation. class Monomorphicable k where -- | Monomorphic representation type MonomorphicRep k :: ⋆ -- | Promote the monomorphic value to the polymophic one. promote :: MonomorphicRep k → Monomorphic k -- | Demote the polymorphic value to the monomorphic representation. demote :: Monomorphic k → MonomorphicRep k -- | Convinience function to demote polymorphic types -- into monomorphic one directly. demote' :: Monomorphicable k ⇒ k a → MonomorphicRep k demote' = demote ∘ Monomorphic -- | Demote polymorphic nested types directly into -- monomorphic representation. demoteComposed :: Monomorphicable (f :∘: g) ⇒ f (g a) → MonomorphicRep (f :∘: g) demoteComposed = demote ∘ Monomorphic ∘ Comp 13೥5݄4೔౔༵೔
  90. ੍໿෇͚ͯΔײ͡ thEliminationIdeal :: ( IsMonomialOrder ord, Field k, IsPolynomial k

    m , IsPolynomial k (m :-: n) , (n ≼ m) ~ True) ⇒ SNat n → Ideal (OrderedPolynomial k ord m) → Ideal (OrderedPolynomial k ord (m ⊖ n)) thEliminationIdeal n = case singInstance n of SingInstance → mapIdeal (changeOrderProxy Proxy) ∘ thEliminationIdealWith (weightedEliminationOrder n) n 13೥5݄4೔౔༵೔
  91. ੍໿෇͚ͯΔײ͡ thEliminationIdeal :: ( IsMonomialOrder ord, Field k, IsPolynomial k

    m , IsPolynomial k (m :-: n) , (n ≼ m) ~ True) ⇒ SNat n → Ideal (OrderedPolynomial k ord m) → Ideal (OrderedPolynomial k ord (m ⊖ n)) thEliminationIdeal n = case singInstance n of SingInstance → mapIdeal (changeOrderProxy Proxy) ∘ thEliminationIdealWith (weightedEliminationOrder n) n Gröbner جఈΛ࢖͏ͱɺ࿈ཱํఔ͔ࣜΒจࣈΛফ ڈग़དྷΔʢ͍͢͝ʂʣ 13೥5݄4೔౔༵೔
  92. ੍໿෇͚ͯΔײ͡ thEliminationIdeal :: ( IsMonomialOrder ord, Field k, IsPolynomial k

    m , IsPolynomial k (m :-: n) , (n ≼ m) ~ True) ⇒ SNat n → Ideal (OrderedPolynomial k ord m) → Ideal (OrderedPolynomial k ord (m ⊖ n)) thEliminationIdeal n = case singInstance n of SingInstance → mapIdeal (changeOrderProxy Proxy) ∘ thEliminationIdealWith (weightedEliminationOrder n) n Gröbner جఈΛ࢖͏ͱɺ࿈ཱํఔ͔ࣜΒจࣈΛফ ڈग़དྷΔʢ͍͢͝ʂʣ n จࣈ໨·ͰΛফڈ͍ͨ͠㱺 ม਺͸࠷௿Ͱ΋ n ݸ 13೥5݄4೔౔༵೔
  93. ূ໌ͯ͠Δײ͡ intersection :: ∀ r k n ord. ( IsMonomialOrder

    ord, Field r, IsPolynomial r k, IsPolynomial r n , IsPolynomial r (k ⊕ n) ) ⇒ Vector (Ideal (OrderedPolynomial r ord n)) k → Ideal (OrderedPolynomial r ord n) intersection Nil = Ideal $ singletonV one intersection idsv@(_ :- _) = let sk = sLengthV idsv sn = sing :: SNat n ts = genVars (sk %+ sn) tis = zipWith (λ ideal t → mapIdeal ((t *) . shiftR sk) ideal) (toList idsv) ts j = foldr appendIdeal (principalIdeal (one - foldr (+) zero ts)) tis in case plusMinusEqR sn sk of Eql → case propToBoolLeq (plusLeqL sk sn) of LeqTrueInstance → thEliminationIdeal sk j 13೥5݄4೔౔༵೔
  94. ࠷ޙʹ͍͍͍ͨ͜ͱ ؼೲ๏͸ίετ͕͔͔Δ ূ໌͸࣮ߦ࣌ʹ஗Ԇ͞ΕΔ͔Βλμ͡Όͳ͍ γϯάϧτϯ΋ίετ͕͔͔Δ Haskell ͰͷґଘܕͰ࣮༻తͳΞϓϦॻ͘ͷ͸Ή͍ͣ HP ඪ४ఴ෇ͷ GHC 7.4.*

    ͸Ϋι ίϯύΠϧ͢Δ౓ʹ rm *.hi *.o ͠ͳ͍ͱܕػೳ͕࢖ ͑ͳ͍ छଟ૬ͳ֎෦ϥΠϒϥϦͱϦϯΫग़དྷͳ͍ 13೥5݄4೔౔༵೔
  95. ࠷ޙʹ͍͍͍ͨ͜ͱ ؼೲ๏͸ίετ͕͔͔Δ ূ໌͸࣮ߦ࣌ʹ஗Ԇ͞ΕΔ͔Βλμ͡Όͳ͍ γϯάϧτϯ΋ίετ͕͔͔Δ Haskell ͰͷґଘܕͰ࣮༻తͳΞϓϦॻ͘ͷ͸Ή͍ͣ HP ඪ४ఴ෇ͷ GHC 7.4.*

    ͸Ϋι ίϯύΠϧ͢Δ౓ʹ rm *.hi *.o ͠ͳ͍ͱܕػೳ͕࢖ ͑ͳ͍ छଟ૬ͳ֎෦ϥΠϒϥϦͱϦϯΫग़དྷͳ͍ Ҋ֎ܕͷ⁋᧒͸͋͏ 13೥5݄4೔౔༵೔
  96. ࢀߟจݙ D. Cox, J. Little and D. O’Shea. Ideals, Varieties

    and Algorithms. UTM. Springer. A. Giovini, T. Moran, G. Niesi, L. Robbiano and C. Traverse. "One sugar cube, please" OR Selection strategies in the Buchberger algorithm. ᑸݩ. άϨϒφʔجఈ͸໘ന͍ʂ. ߨٛ࿥. 2012೥౓ૣҴాେֶجװཧ޻ֶ෦਺ֶՊ୅਺ֶC1 ߨٛࢿྉ 13೥5݄4೔౔༵೔