/**************************************************************************
*
* p-adic-height.m  -- p-adic height pairing
*
* William Stein, April 2001
*                                                                        
***************************************************************************/


intrinsic H3(P::CrvEllPt, p::RngIntElt) -> FldLoc
   {The naive p-adic height of P.}
   E := Parent(P);
   require Type(BaseRing(E)) eq FldRat : "The parent of argument 1 must be defined over Q.";

   Qp := pAdicField(p);

   if P[3] eq 0 then // the point at infinity.
      return Qp!0;
   end if;

   a_1,_,a_3,_,_ := Explode(aInvariants(E));

   x := Qp!(P[1]/P[3]);
   y := Qp!(P[2]/P[3]);
   denom := Qp!(Denominator(P[2]/P[3]));   // G(P)^3
   alpha := (2*y + a_1*x + a_3)/2;
   return denom*alpha/3;
end intrinsic;

intrinsic h3(P::CrvEllPt, p::RngIntElt) -> FldLoc
   {Approximation of the canonical p-adic height of P.}
   E := Parent(P);
   require Type(BaseRing(E)) eq FldRat : "The parent of argument 1 must be defined over Q.";

end intrinsic;

