/***********************************************
 12-03-01.m -- test solubility question

***********************************************/

intrinsic RandomCurve(d::RngIntElt : range := 2) -> Crv
{}
   A<x,y> := AffinePlane(Rationals());
   f := &+[ Random(-range,range)*x^i*y^j : i in [0..d], j in [0..d] | i + j le d];
   X := Scheme(A,f);
   Z := ProjectiveClosure(X);
   PP<x,y,z> := AmbientSpace(Z);
   C := Curve(Z);
   return C, GeometricGenus(C);
end intrinsic;

intrinsic GaloisGroup(C::Crv, y::RngElt) -> Grp
{}
   F := DefiningPolynomial(C);
   R := PolynomialRing(FieldOfFractions(Parent(y)));
   phi := hom<Parent(F) -> R | R.1,y,1>;
   f := Factorization(phi(F))[1][1];
   return GaloisGroup(f);
end intrinsic;

intrinsic SolvablePoint(C::Crv, ymin::RngIntElt, ymax::RngIntElt, denom::RngIntElt) -> SeqEnum
{}
   return [y/denom : y in [ymin..ymax] | IsSolvable(GaloisGroup(C,y/denom))];
end intrinsic;
