A<x,y> := PolynomialRing(GF(3),2);
P,homogenize := Homogenization(A);
print("f := The polynomial from math.mit.edu/~drew/FFFc28.txt");
f := x^8*y^2 - 5*x^7*y^3 + 10*x^6*y^4 + 2*x^6*y^2 - x^6*y - 10*x^5*y^5 - 10*x^5*y^3 + 8*x^5*y^2 - x^5*y + 5*x^4*y^6 + x^4*y^5 + 13*x^4*y^4 - 9*x^4*y^3 - x^4*y^2 - x^4*y - x^3*y^7 - 2*x^3*y^6 - 4*x^3*y^5 - 4*x^3*y^4 + 8*x^3*y^3 + 2*x^3*y^2 - x^3*y + x^2*y^7 - x^2*y^6 + 8*x^2*y^5 - 11*x^2*y^4 + 8*x^2*y^3 - 10*x^2*y^2 + 5*x^2*y - 2*x*y^6 + 5*x*y^5 - 10*x*y^4 + 14*x*y^3 - 8*x*y^2 + x*y + y^5 - 3*y^4 + 4*y^3 - 4*y^2 + 3*y - 1;
f := homogenize(f);
XF2 := Scheme(ProjectiveSpace(P),f);
FF := FunctionField(XF2);
AFF := AlgorithmicFunctionField(FF);
plc1 := Places(AFF,1);
divgrp := DivisorGroup(AFF);
div1 := [divgrp ! i : i in plc1];
cuspsum := &+ div1;
load "function_degrees.m";

print("The number of places of degrees 1, 2 is:");
[#Places(AFF,i) : i in [1..2]];
print("There are 9 places of degree 1 and 3 places of degree 2.");
print("");
print("ceil(9/4) = 3 so to show gon_{F_3} > 5 it suffices to look at divisors");
print("of the form cuspsum + D with deg D = 2.");
print("");
print("type(D)=(2) and (1,1):");
Min(&cat[FunctionDegrees(cuspsum+q+r) : q,r in div1]);
print("type(D)=((2,1))");
Min(&cat[FunctionDegrees(cuspsum+q) : q in Places(AFF,2)]);
