Examples of finite enumerated sets¶
- class sage.categories.examples.finite_enumerated_sets.Example[source]¶
- Bases: - UniqueRepresentation,- Parent- An example of a finite enumerated set: \(\{1,2,3\}\). - This class provides a minimal implementation of a finite enumerated set. - See - FiniteEnumeratedSetfor a full featured implementation.- EXAMPLES: - sage: C = FiniteEnumeratedSets().example() sage: C.cardinality() 3 sage: C.list() [1, 2, 3] sage: C.an_element() 1 - >>> from sage.all import * >>> C = FiniteEnumeratedSets().example() >>> C.cardinality() 3 >>> C.list() [1, 2, 3] >>> C.an_element() 1 - This checks that the different methods of the enumerated set \(C\) return consistent results: - sage: TestSuite(C).run(verbose = True) running ._test_an_element() . . . pass running ._test_cardinality() . . . pass running ._test_category() . . . pass running ._test_construction() . . . pass running ._test_elements() . . . Running the test suite of self.an_element() running ._test_category() . . . pass running ._test_eq() . . . pass running ._test_new() . . . pass running ._test_nonzero_equal() . . . pass running ._test_not_implemented_methods() . . . pass running ._test_pickling() . . . pass pass running ._test_elements_eq_reflexive() . . . pass running ._test_elements_eq_symmetric() . . . pass running ._test_elements_eq_transitive() . . . pass running ._test_elements_neq() . . . pass running ._test_enumerated_set_contains() . . . pass running ._test_enumerated_set_iter_cardinality() . . . pass running ._test_enumerated_set_iter_list() . . . pass running ._test_eq() . . . pass running ._test_new() . . . pass running ._test_not_implemented_methods() . . . pass running ._test_pickling() . . . pass running ._test_some_elements() . . . pass - >>> from sage.all import * >>> TestSuite(C).run(verbose = True) running ._test_an_element() . . . pass running ._test_cardinality() . . . pass running ._test_category() . . . pass running ._test_construction() . . . pass running ._test_elements() . . . Running the test suite of self.an_element() running ._test_category() . . . pass running ._test_eq() . . . pass running ._test_new() . . . pass running ._test_nonzero_equal() . . . pass running ._test_not_implemented_methods() . . . pass running ._test_pickling() . . . pass pass running ._test_elements_eq_reflexive() . . . pass running ._test_elements_eq_symmetric() . . . pass running ._test_elements_eq_transitive() . . . pass running ._test_elements_neq() . . . pass running ._test_enumerated_set_contains() . . . pass running ._test_enumerated_set_iter_cardinality() . . . pass running ._test_enumerated_set_iter_list() . . . pass running ._test_eq() . . . pass running ._test_new() . . . pass running ._test_not_implemented_methods() . . . pass running ._test_pickling() . . . pass running ._test_some_elements() . . . pass 
- class sage.categories.examples.finite_enumerated_sets.IsomorphicObjectOfFiniteEnumeratedSet(ambient=An example of a finite enumerated set: {1, 2, 3})[source]¶
- Bases: - UniqueRepresentation,- Parent- ambient()[source]¶
- Return the ambient space for - self, as per- Sets.Subquotients.ParentMethods.ambient().- EXAMPLES: - sage: C = FiniteEnumeratedSets().IsomorphicObjects().example(); C The image by some isomorphism of An example of a finite enumerated set: {1,2,3} sage: C.ambient() An example of a finite enumerated set: {1,2,3} - >>> from sage.all import * >>> C = FiniteEnumeratedSets().IsomorphicObjects().example(); C The image by some isomorphism of An example of a finite enumerated set: {1,2,3} >>> C.ambient() An example of a finite enumerated set: {1,2,3} 
 - lift(x)[source]¶
- INPUT: - x– an element of- self
 - Lifts - xto the ambient space for- self, as per- Sets.Subquotients.ParentMethods.lift().- EXAMPLES: - sage: C = FiniteEnumeratedSets().IsomorphicObjects().example(); C The image by some isomorphism of An example of a finite enumerated set: {1,2,3} sage: C.lift(9) 3 - >>> from sage.all import * >>> C = FiniteEnumeratedSets().IsomorphicObjects().example(); C The image by some isomorphism of An example of a finite enumerated set: {1,2,3} >>> C.lift(Integer(9)) 3 
 - retract(x)[source]¶
- INPUT: - x– an element of the ambient space for- self
 - Retracts - xfrom the ambient space to- self, as per- Sets.Subquotients.ParentMethods.retract().- EXAMPLES: - sage: C = FiniteEnumeratedSets().IsomorphicObjects().example(); C The image by some isomorphism of An example of a finite enumerated set: {1,2,3} sage: C.retract(3) 9 - >>> from sage.all import * >>> C = FiniteEnumeratedSets().IsomorphicObjects().example(); C The image by some isomorphism of An example of a finite enumerated set: {1,2,3} >>> C.retract(Integer(3)) 9