Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Reviewer changes: delete is_cdvr functions and friends, add abstract_…
Browse files Browse the repository at this point in the history
…method to precision_absolute and precision_relative, add some tests
  • Loading branch information
roed314 committed Sep 7, 2013
1 parent 664322f commit 9e6ddb8
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 60 deletions.
62 changes: 28 additions & 34 deletions src/sage/categories/complete_discrete_valuation.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@
class CompleteDiscreteValuationRings(Category_singleton):
"""
The category of complete discrete valuation rings
EXAMPLES::
sage: Zp(7) in CompleteDiscreteValuationRings()
True
sage: QQ in CompleteDiscreteValuationRings()
False
sage: QQ[['u']] in CompleteDiscreteValuationRings()
True
sage: Qp(7) in CompleteDiscreteValuationRings()
False
sage: TestSuite(CompleteDiscreteValuationRings()).run()
"""
def super_categories(self):
"""
Expand All @@ -32,23 +44,8 @@ def super_categories(self):
"""
return [DiscreteValuationRings()]

class ParentMethods:
def is_cdvr(self):
"""
Return True if this ring is complete DVR.
EXAMPLES::
sage: Zp(7).is_cdvr()
True
sage: K.<u> = QQ[[]]
sage: K.is_cdvr()
True
"""
return True

class ElementMethods:
@abstract_method
def precision_absolute(self):
"""
Return the absolute precision of this element.
Expand All @@ -61,8 +58,8 @@ def precision_absolute(self):
sage: x.precision_absolute()
21
"""
pass

@abstract_method
def precision_relative(self):
"""
Return the relative precision of this element.
Expand All @@ -75,12 +72,22 @@ def precision_relative(self):
sage: x.precision_relative()
20
"""
pass


class CompleteDiscreteValuationFields(Category_singleton):
"""
The category of complete discrete valuation fields
EXAMPLES::
sage: Zp(7) in CompleteDiscreteValuationFields()
False
sage: QQ in CompleteDiscreteValuationFields()
False
sage: LaurentSeriesRing(QQ,'u') in CompleteDiscreteValuationFields()
True
sage: Qp(7) in CompleteDiscreteValuationFields()
True
sage: TestSuite(CompleteDiscreteValuationFields()).run()
"""

def super_categories(self):
Expand All @@ -92,20 +99,8 @@ def super_categories(self):
"""
return [DiscreteValuationFields()]

class ParentMethods:
def is_cdvf(self):
"""
Return True if this ring is a field equipped with a discrete valuation
for which it is complete.
EXAMPLES::
sage: Qp(7).is_cdvf()
True
"""
return True

class ElementMethods:
@abstract_method
def precision_absolute(self):
"""
Return the absolute precision of this element.
Expand All @@ -118,8 +113,8 @@ def precision_absolute(self):
sage: x.precision_absolute()
21
"""
pass

@abstract_method
def precision_relative(self):
"""
Return the relative precision of this element.
Expand All @@ -132,4 +127,3 @@ def precision_relative(self):
sage: x.precision_relative()
20
"""
pass
38 changes: 12 additions & 26 deletions src/sage/categories/discrete_valuation.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
class DiscreteValuationRings(Category_singleton):
"""
The category of discrete valuation rings
EXAMPLES::
sage: GF(7)[['x']] in DiscreteValuationRings()
True
sage: TestSuite(DiscreteValuationRings()).run()
"""
def super_categories(self):
"""
Expand Down Expand Up @@ -65,21 +71,6 @@ def residue_field(self):
Rational Field
"""

def is_dvr(self):
"""
Return True if this ring is DVR.
EXAMPLES::
sage: Zp(7).is_dvr()
True
sage: K.<u> = QQ[[]]
sage: K.is_dvr()
True
"""
return True

class ElementMethods:
@abstract_method
def valuation(self):
Expand Down Expand Up @@ -139,6 +130,12 @@ def lcm(self,other):
class DiscreteValuationFields(Category_singleton):
"""
The category of discrete valuation fields
EXAMPLES::
sage: Qp(7) in DiscreteValuationFields()
True
sage: TestSuite(DiscreteValuationFields()).run()
"""

def super_categories(self):
Expand Down Expand Up @@ -178,17 +175,6 @@ def residue_field(self):
Rational Field
"""

def is_dvf(self):
"""
Return True if this ring is a field equipped with a discrete valuation.
EXAMPLES::
sage: Qp(7).is_cdvf()
True
"""
return True

class ElementMethods:
@abstract_method
def valuation(self):
Expand Down

0 comments on commit 9e6ddb8

Please sign in to comment.