# $$p$$-Adic Capped Absolute Elements¶

$$p$$-Adic Capped Absolute Elements

Elements of $$p$$-Adic Rings with Absolute Precision Cap

AUTHORS:

• David Roe
• Genya Zaytman: documentation
• David Harvey: doctests

Initialization.

EXAMPLES:

sage: a = Zp(5)(1/2,3); a
3 + 2*5 + 2*5^2 + O(5^3)
sage: type(a)
sage: TestSuite(a).run()


Returns a new element with absolute precision decreased to absprec. The precision never increases.

INPUT:

• absprec – an integer

OUTPUT:

self with precision set to the minimum of self's precision and prec

EXAMPLES:

sage: R = Zp(7,4,'capped-abs','series'); a = R(8); a.add_bigoh(1)
1 + O(7)

sage: k = ZpCA(3,5)
sage: a = k(41); a
2 + 3 + 3^2 + 3^3 + O(3^5)
2 + 3 + 3^2 + 3^3 + O(3^5)
2 + 3 + 3^2 + O(3^3)

is_equal_to(_right, absprec=None)

Determines whether the inputs are equal modulo $$\pi^{\mbox{absprec}}$$.

INPUT:

• right – a $$p$$-adic element with the same parent
• absprec – an integer, infinity, or None

EXAMPLES:

sage: R = ZpCA(2, 6)
sage: R(13).is_equal_to(R(13))
True
sage: R(13).is_equal_to(R(13+2^10))
True
sage: R(13).is_equal_to(R(17), 2)
True
sage: R(13).is_equal_to(R(17), 5)
False
sage: R(13).is_equal_to(R(13+2^10),absprec=10)
Traceback (most recent call last):
...
PrecisionError: Elements not known to enough precision

is_zero(absprec=None)

Determines whether this element is zero modulo $$\pi^{\mbox{absprec}}$$.

If absprec is None, returns True if this element is indistinguishable from zero.

INPUT:

• absprec – an integer, infinity, or None

EXAMPLES:

sage: R = ZpCA(17, 6)
sage: R(0).is_zero()
True
sage: R(17^6).is_zero()
True
sage: R(17^2).is_zero(absprec=2)
True
sage: R(17^6).is_zero(absprec=10)
Traceback (most recent call last):
...
PrecisionError: Not enough precision to determine if element is zero

list(lift_mode='simple', start_val=None)

Returns a list of coefficients of $$p$$ starting with $$p^0$$.

For each lift mode, this function returns a list of $$a_i$$ so that this element can be expressed as

$\pi^v \cdot \sum_{i=0}^\infty a_i \pi^i$

where $$v$$ is the valuation of this element when the parent is a field, and $$v = 0$$ otherwise.

Different lift modes affect the choice of $$a_i$$. When lift_mode is 'simple', the resulting $$a_i$$ will be non-negative: if the residue field is $$\mathbb{F}_p$$ then they will be integers with $$0 \le a_i < p$$; otherwise they will be a list of integers in the same range giving the coefficients of a polynomial in the indeterminant representing the maximal unramified subextension.

Choosing lift_mode as 'smallest' is similar to 'simple', but uses a balanced representation $$-p/2 < a_i \le p/2$$.

Finally, setting lift_mode = 'teichmuller' will yield Teichmuller representatives for the $$a_i$$: $$a_i^q = a_i$$. In this case the $$a_i$$ will also be $$p$$-adic elements.

INPUT:

• lift_mode'simple', 'smallest' or 'teichmuller' (default 'simple')
• start_val – start at this valuation rather than the default ($$0$$ or the valuation of this element). If start_val is larger than the valuation of this element a ValueError is raised.

Note

Use slice operators to get a particular range.

EXAMPLES:

sage: R = ZpCA(7,6); a = R(12837162817); a
3 + 4*7 + 4*7^2 + 4*7^4 + O(7^6)
sage: L = a.list(); L
[3, 4, 4, 0, 4]
sage: sum([L[i] * 7^i for i in range(len(L))]) == a
True
sage: L = a.list('smallest'); L
[3, -3, -2, 1, -3, 1]
sage: sum([L[i] * 7^i for i in range(len(L))]) == a
True
sage: L = a.list('teichmuller'); L
[3 + 4*7 + 6*7^2 + 3*7^3 + 2*7^5 + O(7^6),
O(7^5),
5 + 2*7 + 3*7^3 + O(7^4),
1 + O(7^3),
3 + 4*7 + O(7^2),
5 + O(7)]
sage: sum([L[i] * 7^i for i in range(len(L))])
3 + 4*7 + 4*7^2 + 4*7^4 + O(7^6)


If the element has positive valuation then the list will start with some zeros:

sage: a = R(7^3 * 17)
sage: a.list()
[0, 0, 0, 3, 2]

precision_absolute()

The absolute precision of this element.

This is the power of the maximal ideal modulo which this element is defined.

EXAMPLES:

sage: R = Zp(7,4,'capped-abs'); a = R(7); a.precision_absolute()
4

precision_relative()

The relative precision of this element.

This is the power of the maximal ideal modulo which the unit part of this element is defined.

EXAMPLES:

sage: R = Zp(7,4,'capped-abs'); a = R(7); a.precision_relative()
3

teichmuller_list()

Returns a list $$[a_0, a_1,\ldots, a_n]$$ such that

• $$a_i^q = a_i$$, where $$q$$ is the cardinality of the residue field,
• self equals $$\sum_{i = 0}^n a_i \pi^i$$, and
• if $$a_i \ne 0$$, the absolute precision of $$a_i$$ is self.precision_relative() - i

EXAMPLES:

sage: R = ZpCA(5,5); R(14).list('teichmuller') #indirect doctest
[4 + 4*5 + 4*5^2 + 4*5^3 + 4*5^4 + O(5^5),
3 + 3*5 + 2*5^2 + 3*5^3 + O(5^4),
2 + 5 + 2*5^2 + O(5^3),
1 + O(5^2),
4 + O(5)]

unit_part()

Returns the unit part of this element.

EXAMPLES:

sage: R = Zp(17,4,'capped-abs', 'val-unit')
sage: a = R(18*17)
sage: a.unit_part()
18 + O(17^3)
sage: type(a)
sage: R(0).unit_part()
O(17^0)

val_unit()

Returns a 2-tuple, the first element set to the valuation of this element, and the second to the unit part of this element.

For a zero element, the unit part is O(p^0).

EXAMPLES:

sage: R = ZpCA(5)
sage: a = R(75, 6); b = a - a
sage: a.val_unit()
(2, 3 + O(5^4))
sage: b.val_unit()
(6, O(5^0))


Unpickles a capped absolute element.

EXAMPLES:

sage: from sage.rings.padics.padic_capped_absolute_element import make_pAdicCappedAbsoluteElement
sage: R = ZpCA(5)
sage: a = make_pAdicCappedAbsoluteElement(R, 17*25, 5); a
2*5^2 + 3*5^3 + O(5^5)


Constructs new element with given parent and value.

INPUT:

• x – value to coerce into a capped absolute ring
• absprec – maximum number of digits of absolute precision
• relprec – maximum number of digits of relative precision

EXAMPLES:

sage: R = ZpCA(3, 5)
sage: R(2)
2 + O(3^5)
sage: R(2, absprec=2)
2 + O(3^2)
sage: R(3, relprec=2)
3 + O(3^3)
sage: R(Qp(3)(10))
1 + 3^2 + O(3^5)
sage: R(pari(6))
2*3 + O(3^5)
sage: R(pari(1/2))
2 + 3 + 3^2 + 3^3 + 3^4 + O(3^5)
sage: R(1/2)
2 + 3 + 3^2 + 3^3 + 3^4 + O(3^5)
sage: R(mod(-1, 3^7))
2 + 2*3 + 2*3^2 + 2*3^3 + 2*3^4 + O(3^5)
sage: R(mod(-1, 3^2))
2 + 2*3 + O(3^2)
sage: R(3 + O(3^2))
3 + O(3^2)

lift()

sage: R = ZpCA(3) sage: R(10).lift() 10 sage: R(-1).lift() 3486784400

multiplicative_order()

Returns the minimum possible multiplicative order of this element.

OUTPUT: the multiplicative order of self. This is the minimum multiplicative order of all elements of $$\mathbb{Z}_p$$ lifting self to infinite precision.

EXAMPLES:

sage: R = ZpCA(7, 6)
sage: R(1/3)
5 + 4*7 + 4*7^2 + 4*7^3 + 4*7^4 + 4*7^5 + O(7^6)
sage: R(1/3).multiplicative_order()
+Infinity
sage: R(7).multiplicative_order()
+Infinity
sage: R(1).multiplicative_order()
1
sage: R(-1).multiplicative_order()
2
sage: R.teichmuller(3).multiplicative_order()
6

residue(absprec=1)

Reduces this element modulo p^absprec.

INPUT:

• absprec - an integer

OUTPUT:

element of $$\mathbb{Z}/p^{\mbox{absprec}} \mathbb{Z}$$self reduced modulo p^absprec.

EXAMPLES:

sage: R = Zp(7,4,'capped-abs'); a = R(8); a.residue(1)
1


The canonical inclusion from the ring of integers to a capped absolute ring.

EXAMPLES:

sage: f = ZpCA(5).coerce_map_from(ZZ); f
Ring Coercion morphism:
From: Integer Ring
To:   5-adic Ring with capped absolute precision 20

section()

Returns a map back to the ring of integers that approximates an element by an integer.

EXAMPLES:

sage: f = ZpCA(5).coerce_map_from(ZZ).section()
sage: f(ZpCA(5)(-1)) - 5^20
-1


The map from a capped absolute ring back to the ring of integers that returns the the smallest non-negative integer approximation to its input which is accurate up to the precision.

Raises a ValueError if the input is not in the closure of the image of the ring of integers.

EXAMPLES:

sage: f = ZpCA(5).coerce_map_from(ZZ).section(); f
Set-theoretic ring morphism:
From: 5-adic Ring with capped absolute precision 20
To:   Integer Ring


The inclusion map from the rationals to a capped absolute ring that is defined on all elements with non-negative $$p$$-adic valuation.

EXAMPLES:

sage: f = ZpCA(5).convert_map_from(QQ); f
Generic morphism:
From: Rational Field
To:   5-adic Ring with capped absolute precision 20


A class for common functionality among the $$p$$-adic template classes.

INPUT:

• parent – a local ring or field
• x – data defining this element. Various types are supported, including ints, Integers, Rationals, PARI p-adics, integers mod $$p^k$$ and other Sage p-adics.
• absprec – a cap on the absolute precision of this element
• relprec – a cap on the relative precision of this element

EXAMPLES:

sage: Zp(17)(17^3, 8, 4)
17^3 + O(17^7)

lift_to_precision(absprec=None)

Returns another element of the same parent with absolute precision at least absprec, congruent to this $$p$$-adic element modulo the precision of this element.

INPUT:

• absprec – an integer or None (default: None), the absolute precision of the result. If None, lifts to the maximum precision allowed.

Note

If setting absprec that high would violate the precision cap, raises a precision error. Note that the new digits will not necessarily be zero.

EXAMPLES:

sage: R = ZpCA(17)
sage: R(-1,2).lift_to_precision(10)
16 + 16*17 + O(17^10)
sage: R(1,15).lift_to_precision(10)
1 + O(17^15)
sage: R(1,15).lift_to_precision(30)
Traceback (most recent call last):
...
PrecisionError: Precision higher than allowed by the precision cap.
sage: R(-1,2).lift_to_precision().precision_absolute() == R.precision_cap()
True

sage: R = Zp(5); c = R(17,3); c.lift_to_precision(8)
2 + 3*5 + O(5^8)
sage: c.lift_to_precision().precision_relative() == R.precision_cap()
True


Fixed modulus elements don’t raise errors:

sage: R = ZpFM(5); a = R(5); a.lift_to_precision(7)
5 + O(5^20)
sage: a.lift_to_precision(10000)
5 + O(5^20)


Returns a list of coefficients of the uniformizer $$\pi$$ starting with $$\pi^0$$ up to $$\pi^n$$ exclusive (padded with zeros if needed).

For a field element of valuation $$v$$, starts at $$\pi^v$$ instead.

INPUT:

• n - an integer
• lift_mode - ‘simple’, ‘smallest’ or ‘teichmuller’

EXAMPLES:

sage: R = Zp(7,4,'capped-abs'); a = R(2*7+7**2); a.padded_list(5)
[0, 2, 1, 0, 0]
sage: R = Zp(7,4,'fixed-mod'); a = R(2*7+7**2); a.padded_list(5)
[0, 2, 1, 0, 0]


For elements with positive valuation, this function will return a list with leading 0s if the parent is not a field:

sage: R = Zp(7,3,'capped-rel'); a = R(2*7+7**2); a.padded_list(5)
[0, 2, 1, 0, 0]
sage: R = Qp(7,3); a = R(2*7+7**2); a.padded_list(5)
[2, 1, 0, 0]
[2, 1]

unit_part()

Returns the unit part of this element.

This is the $$p$$-adic element $$u$$ in the same ring so that this element is $$\pi^v u$$, where $$\pi$$ is a uniformizer and $$v$$ is the valuation of this element.

Unpickle capped absolute elements.

INPUT:

• cls – the class of the capped absolute element.
• parent – the parent, a $$p$$-adic ring
• value – a Python object wrapping a celement, of the kind accepted by the cunpickle function.
• absprec – a Python int or Sage integer.

EXAMPLES:

sage: from sage.rings.padics.padic_capped_absolute_element import unpickle_cae_v2, pAdicCappedAbsoluteElement
sage: R = ZpCA(5,8)
sage: a = unpickle_cae_v2(pAdicCappedAbsoluteElement, R, 42, int(6)); a
2 + 3*5 + 5^2 + O(5^6)
sage: a.parent() is R
True


#### Previous topic

$$p$$-Adic Capped Relative Elements