View on GitHub

Exact p-Adics 2

A Magma package for exact p-adic computation

Internals

In this section, we document the generic internal structure common to all p-adic objects.

Contents

Overview

All p-adic objects are a subtype of AnyPadExact, which has attributes including:

There are two direct subtypes of AnyPadExact: StrPadExact representing a structure (or set), and PadExactElt representing an element of such a structure. For example, FldPadExact represents a p-adic field and is a subtype of StrPadExact, and its elements have type FldPadExactElt which is a subtype of PadExactElt. PadExactElt has an additional parent attribute, which must be the parent structure to which the element belongs.

Generic intrinsics

BringToEpoch (x :: AnyPadExact, n :: RngIntElt)

Brings x to epoch n.

BringToEpoch (xs :: [AnyPadExact], n :: RngIntElt)

Brings each x in xs to epoch n.

CanBringToEpoch (x :: AnyPadExact, n :: RngIntElt)

-> BoolElt

Tries to bring x to epoch n. Returns true if successful, or false if the max_epoch of something is exceeded.

CanBringToEpoch (xs :: [AnyPadExact], n :: RngIntElt)

-> BoolElt

Tries to bring each x in xs to epoch n. Returns true if successful, or false if the max_epoch of something is exceeded.

EpochApproximation (xs :: [AnyPadExact], n :: RngIntElt)

-> []

Returns sequence of approximations of xs at epoch n.

EpochApproximation (x :: AnyPadExact, n :: RngIntElt)

-> Any

The approximation of x at epoch n.

Init_AnyPadExact (x :: AnyPadExact)

Init_PadExactElt (x :: PadExactElt)

Init (x :: AnyPadExact)

Init (x :: PadExactElt)

Initializes x.

Parent (x :: PadExactElt)

-> StrPadExact

The parent of x.

BestApproximation (x :: AnyPadExact)

-> Any

The best approximation to x.

ExistsEpochWith (x :: AnyPadExact, pred)

-> BoolElt, RngIntElt

True if there is an epoch of x such that pred(x) is true. If so, returns it.

ExistsEpochWithApproximation (x :: AnyPadExact, pred)

-> BoolElt, RngIntElt

True if there is an epoch of x such that pred(xx) is true, where xx is the corresponding approximation. If so, returns it. False if max_epoch is ever exceeded.

Parameters

FirstEpochWithApproximation (x :: AnyPadExact, pred)

-> RngIntElt

The first epoch whose approximation satisfies the predicate.

Parameters

IncreaseEpochUntil (x :: AnyPadExact, pred)

Increases the epoch of x until pred(x) is true.

IncreaseAbsolutePrecision (x :: PadExactElt, apr)

Increases the absolute precision of x to at least apr.

Approximation (x :: PadExactElt, apr)

-> Any

An approximation of x with absolute precision at least apr.

InterpolateUpTo (x :: AnyPadExact, n :: RngIntElt)

Replaces the approximations of x below n with their interpolations.

InterpolateUpToFirstEpochWithApproximation (x :: AnyPadExact, pred)

-> RngIntElt, RngIntElt

Replaces the approximations of x below n with their interpolations, where n is the first epoch whose approximation satisfies the predicate. Returns the new and old values of n.

Parameters

SetApproximation (x :: AnyPadExact, n :: RngIntElt, xx)

Sets the approximation of x at epoch n to xx.

This is called by BringToEpoch and InterpolateUpTo.

It checks the new approximation is valid by calling IsValidApproximation, then calls SetApproximationHook, then calls InterpolateEpochs if necessary to get missing approximations below n, and then finally updates the list of approximations.

WithDependencies (x :: AnyPadExact, ds :: List)

-> AnyPadExact

A copy of x with the direct dependencies ds.

This is useful if x is some complex expression in ds and you don’t care about the intermediate expressions. It can provide a small speed-up in computing approximations for x.

Parameters

Overloadable intrinsics

The following intrinsics are expected to be overloaded for type-specific behaviour.

InterpolateEpochs (x :: AnyPadExact, n1 :: RngIntElt, n2 :: RngIntElt, xx2)

-> List

Assuming we have an approximation for x at epoch n1, and xx2 is the approximation at epoch n2, returns approximations for the intermediate epochs [n1+1..n2-1]. Usually this will do something simple such as just lowering the precision of xx2 to match each intermediate epoch.

GetApproximation (get, n :: RngIntElt, xds :: List)

-> Any

Given a get_approximation value get, an epoch n and a list of approximations of dependencies at epoch n, returns an approximation at epoch n.

GetApproximation (get :: UserProgram, n :: RngIntElt, xds :: List)

-> Any

Currently, get_approximation is always just a function, and so this just calls it.

SetApproximationHook (x :: AnyPadExact, n :: RngIntElt, ~xx)

Overload this to perform some action when we are about to set the approximation of x at epoch n to xx.

For example, this is used by RngUPol_FldPadExact to ensure all its approximations have the same variable name.

IsValidApproximation (x :: AnyPadExact, n :: RngIntElt, xx)

-> BoolElt, MonStgElt

True if xx is a valid approximation of x at epoch n. If not, also returns an error message.

IsValidApproximation (x :: PadExactElt, n :: RngIntElt, xx)

-> BoolElt, MonStgElt

For p-adic elements, this checks that the approximation is an element of the approximation of the parent, and that it is weakly equal to the current best approximation for x.

UninitializedCopy (x :: AnyPadExact)

-> AnyPadExact

An uninitialized copy of x.

UninitializedCopy (x :: StrPadExact)

-> StrPadExact

For structures, we raise a “cannot copy p-adic structures” error, since equality of structures is defined by equality of id, and this would break it.

UninitializedCopy (x :: PadExactElt)

-> PadExactElt

For elements, we just need to copy the parent.

Version

ExactpAdics_Version ()

-> RngIntElt, RngIntElt, RngIntElt

The version of the ExactpAdics package, as major, minor and patch numbers.

ExactpAdics_Implementation ()

-> RngIntElt

This returns 2, to distinguish this package from ExactpAdics, for which this returns 1.

Global ID

Each p-adic object (AnyPadExact) has a unique id attribute, which is ordered according to dependency.

ExactpAdics_NextId ()

-> RngIntElt

The next global id.

Warnings

For controlling the extent to which errors and warning occur in the package.

ExactpAdics_SetWarningAction (name :: MonStgElt, action :: MonStgElt)

Sets how the warning name is displayed. action is one of:

ExactpAdics_WarningActionIsDefined (name :: MonStgElt)

-> BoolElt, MonStgElt

True if there is a warning action defined for warning name. If so, also returns the action.

ExactpAdics_GetWarningAction (name :: MonStgElt, dflt :: MonStgElt)

-> MonStgElt

The warning action set for warning name, if set, or else dflt.

ExactpAdics_Warn (name :: MonStgElt, msg)

Raises the warning name with message msg.

Parameters