# HG changeset patch
# User Simon King
# Date 1331304426 3600
# Node ID 7653d2fd417636a0ae1400009dcfd95457e92e96
# Parent d296d66e789b4c918cf959ad3a06f4343eda6625
#12645: Fix rst markup in sage.combinat.sf.sf and sage.structure.dynamic_class
diff git a/doc/en/reference/combinat/symmetric_functions.rst b/doc/en/reference/combinat/symmetric_functions.rst
 a/doc/en/reference/combinat/symmetric_functions.rst
+++ b/doc/en/reference/combinat/symmetric_functions.rst
@@ 5,6 +5,7 @@ Symmetric Functions
:maxdepth: 2
../sage/combinat/sf/sfa
+ ../sage/combinat/sf/sf
../sage/combinat/sf/classical
../sage/combinat/sf/schur
../sage/combinat/sf/monomial
@@ 20,4 +21,4 @@ Symmetric Functions
../sage/combinat/sf/kschur
../sage/combinat/sf/llt
../sage/combinat/sf/macdonald
 ../sage/combinat/sf/ns_macdonald
\ No newline at end of file
+ ../sage/combinat/sf/ns_macdonald
diff git a/sage/combinat/sf/sf.py b/sage/combinat/sf/sf.py
 a/sage/combinat/sf/sf.py
+++ b/sage/combinat/sf/sf.py
@@ 1,3 +1,6 @@
+"""
+Symmetric functions, with their multiple realizations
+"""
from sage.structure.parent import Parent
from sage.structure.unique_representation import UniqueRepresentation
from sage.categories.all import Rings, GradedHopfAlgebrasWithBasis, ModulesWithBasis
@@ 19,10 +22,16 @@ class SymmetricFunctions(UniqueRepresent
sage: Sym
Symmetric Functions over Rational Field
 Todo: add one example of non trivial computation, and then proceed
 with the detailed explanations
+ .. todo::
+
+ Add one example of non trivial computation, and then proceed
+ with the detailed explanations.
 Todo: expand this tutorial, merging with that of ``MuPADCombinat``
+ .. todo::
+
+ Expand this tutorial, merging with that of ``MuPADCombinat``
+
+ ::
sage: h = Sym.h(); e = Sym.e(); s = Sym.s(); m = Sym.m(); p = Sym.p()
sage: ( ( h[2,1] * ( 1 + 3 * h[2,1]) ) + s[2]. antipode()) . coproduct() # todo: not implemented
@@ 80,9 +89,11 @@ class SymmetricFunctions(UniqueRepresent
p[2, 1, 1]
Badly enough, due to a limitation in Python syntax, one cannot use::
+
sage: p[] # todo: not implemented
Please use instead::
+
sage: p[[]]
p[]
@@ 90,11 +101,11 @@ class SymmetricFunctions(UniqueRepresent
sage: p[2,1,1] + 2 * (p[4] + p[2,1])
2*p[2, 1] + p[2, 1, 1] + 2*p[4]

 ..topic: Algebra structure
+
+ .. rubric:: Algebra structure
Let us explore the other operations of p. First, we can ask for
 the mathematical properties of p:
+ the mathematical properties of p::
sage: p.categories() # todo: not implemented
[The category of multiplicative bases on primitive elements of Sym,
@@ 122,7 +133,7 @@ class SymmetricFunctions(UniqueRepresent
sage: (p.one() + 2 * p[3,1]) * p[4, 2]
p[4, 2] + 2*p[4, 3, 2, 1]
 ..topic: Hopf algebra structure
+ .. rubric:: Hopf algebra structure
p is further endowed with a coalgebra algebra structure (in
fact, it is, up to isomorphism, the unique free algebra on
@@ 136,20 +147,23 @@ class SymmetricFunctions(UniqueRepresent
p[] # p[2] + p[2] # p[]
The coproduct being cocommutative on the generators is cocommutative everywhere::
+
sage: p[2, 1].coproduct() # todo: not implemented
p[] # p[2, 1] + p[1] # p[2] + p[2, 1] # p[] + p[2] # p[1]
The antipode is an antialgebra morphism (Todo: explain what it
 is); on the p basis, it sends the generators to their opposite:
+ is); on the p basis, it sends the generators to their opposite::
sage: p[3].antipode() # todo: not implemented
p[3]
sage: p[1,3,2].antipode() # todo: not implemented
p[2, 3, 1]
 ..topic: Other concrete representations
+ .. rubric:: Other concrete representations
 Todo: demonstrate how to customize the basis names
+ .. todo::
+
+ Demonstrate how to customize the basis names.
Sym admits many other concrete representations::
@@ 159,14 +173,14 @@ class SymmetricFunctions(UniqueRepresent
sage: m = Sym.monomial()
sage: f = Sym.forgotten() # todo: not implemented
 To change from one basis to another, one simply does:
+ To change from one basis to another, one simply does::
sage: m(p[3])
m[3]
sage: m(p[3,2])
m[3, 2] + m[5]
 In general, one can mix up different basis in computations:
+ In general, one can mix up different basis in computations::
sage: p( m[1] * ( e[3]*s[2] + 1 ))
p[1] + 1/12*p[1, 1, 1, 1, 1, 1]  1/6*p[2, 1, 1, 1, 1]  1/4*p[2, 2, 1, 1] + 1/6*p[3, 1, 1, 1] + 1/6*p[3, 2, 1]
@@ 178,15 +192,17 @@ class SymmetricFunctions(UniqueRepresent
sage: P = Jack.P(); J = Jack.J(); Q = Jack.Q() # todo: not implemented
sage: J(P[2,1]) # todo: not implemented
 t can be specialized as follow::
+ It can be specialized as follow::
sage: Sym = SymmetricFunctions(QQ)
sage: Jack = Sym.jack_polynomials(t = 1) # todo: not implemented
sage: P = Jack.P(); J = Jack.J(); Q = Jack.Q() # todo: not implemented
sage: J(P[2,1]) # todo: not implemented
 Todo: introduce a field with degree 1 elements as in
 MuPADCombinat, to get proper plethysm.
+ .. todo::
+
+ Introduce a field with degree 1 elements as in
+ MuPADCombinat, to get proper plethysm.
Similarly one can get HallLittlewood, Macdonald polynomials, etc::
@@ 195,11 +211,13 @@ class SymmetricFunctions(UniqueRepresent
sage: P = Mcd.P(); J = Mcd.J(); Q = Mcd.Q() # todo: not implemented
sage: J(P[2,1]) # todo: not implemented
 Further things to do:
  Use UniqueRepresentation to get rid of all the manual cache handling for the bases
  Devise a mechanism so that pickling bases of symmetric functions pickles
 the coercions which have a cache.
+ .. todo::
+  Use UniqueRepresentation to get rid of all the manual cache
+ handling for the bases
+  Devise a mechanism so that pickling bases of symmetric
+ functions pickles the coercions which have a cache.
+  Use #7980 to handle the multiple realizations
"""
def __init__(self, R):
@@ 309,6 +327,7 @@ class SymmetricFunctions(UniqueRepresent
We override the canonical coercion from the Schur basis to the
powersum basis by a (stupid!) map `s_\lambda\mapsto 2p_\lambda`.
+ ::
sage: Sym = SymmetricFunctions(QQ['zorglub']) # make sure we are not going to screw up later tests
sage: s = Sym.s(); p = Sym.p().dual_basis()
@@ 333,7 +352,7 @@ class SymmetricFunctions(UniqueRepresent
INPUT:
  shorthands  a list (or iterable) of strings (default: ['e', 'h', 'm', 'p', 's'])
+  ``shorthands``  a list (or iterable) of strings (default: ['e', 'h', 'm', 'p', 's'])
EXAMPLES::
@@ 415,17 +434,17 @@ class SymmetricaConversionOnBasis:
"""
INPUT:
  t  a function taking a monomial in CombinatorialFreeModule(QQ, Partitions()), and returning a
 (partition, coefficient) list.
+  ``t``  a function taking a monomial in CombinatorialFreeModule(QQ, Partitions()),
+ and returning a (partition, coefficient) list.
  ``domain``, ``codomain``  parents
+  ``domain``, ``codomain``  parents
Construct a function mapping a partition to an element of ``codomain``.
This is a temporary quick hack to wrap around the existing
symmetrica conversions, without changing their specs.
 EXAMPLES:
+ EXAMPLES::
sage: Sym = SymmetricFunctions(QQ[x])
sage: p = Sym.p(); s = Sym.s()
diff git a/sage/structure/dynamic_class.py b/sage/structure/dynamic_class.py
 a/sage/structure/dynamic_class.py
+++ b/sage/structure/dynamic_class.py
@@ 1,7 +1,7 @@
"""
Dynamic classes
..topic: Why dynamic classes?
+.. rubric:: Why dynamic classes?
The short answer:
@@ 22,15 +22,15 @@ parent, but we won't discuss this point
choose a data structure for the permutations, typically among the
following:
  Stored by cycle type
  Stored by code
  Stored in list notation
  C arrays of short ints (for small permutations)
  python lists of ints (for huge permutations)
  ...
  Stored by reduced word
  Stored as a function
  ...
+ Stored by cycle type
+ Stored by code
+ Stored in list notation
+  C arrays of short ints (for small permutations)
+  python lists of ints (for huge permutations)
+  ...
+ Stored by reduced word
+ Stored as a function
+ ...
Luckily, the Sage library provides (or will provide) classes
implementing each of those data structures. Those classes all share a
@@ 42,7 +42,7 @@ just derive our class from the chosen on
Then we may want to further choose a specific memory behavior (unique
representation, copyonwrite) which (hopefuly) can again be achieved
by inheritance.
+by inheritance::
class MyPermutation(UniqueRepresentation, PermutationCycleType):
...
@@ 50,10 +50,10 @@ by inheritance.
Finaly, we may want to endow the permutations in `S` with further
operations coming from the (algebraic) structure of `S`:
  group operations
  or just monoid operations (for a subset of permutations not stable by inverse)
  poset operations (for left/right/Bruhat order)
  word operations (searching for substrings, patterns, ...)
+ group operations
+ or just monoid operations (for a subset of permutations not stable by inverse)
+ poset operations (for left/right/Bruhat order)
+ word operations (searching for substrings, patterns, ...)
Or any combination thereof. Now, our class typically looks like::
@@ 78,11 +78,11 @@ time. Let us take another standard const
Depending on the structure of `B` and `C`, and possibly on further
options passed down by the user, `A` may be:
  an enumerated set
  a group
  an algebra
  a poset
  ...
+ an enumerated set
+ a group
+ an algebra
+ a poset
+ ...
Or any combination thereof.
@@ 91,7 +91,7 @@ tedious. Furthermore, this would require
lookup the appropriate class depending on the desired combination.
Instead, one may use the ability of Python to create new classes
dynamicaly:
+dynamicaly::
type("class name", tuple of base classes, dictionary of methods)
@@ 100,7 +100,7 @@ address. The purpose of this library is
Sage, and in particular to ensure that the constructed classes are
reused whenever possible (unique representation), and can be pickled.
..topic: combining dynamic classes and Cython classes
+.. rubric:: Combining dynamic classes and Cython classes
Cython classes cannot inherit from a dynamic class (there might be
some partial support for this in the future). On the other hand, such
@@ 121,12 +121,13 @@ from sage.structure.unique_representatio
def dynamic_class(name, bases, cls = None, reduction = None, doccls=None):
r"""
 INPUT::
  ``name``: a string
  ``bases``: a tuple of classes
  ``cls``: a class or None
  ``reduction``: a tuple or None
  ``doccls``: a class or None
+ INPUT:
+
+  ``name``  a string
+  ``bases``  a tuple of classes
+  ``cls``  a class or None
+  ``reduction``  a tuple or None
+  ``doccls``  a class or None
Constructs dynamically a new class ``C`` with name ``name``, and
bases ``bases``. If ``cls`` is provided, then its methods will be
@@ 134,8 +135,8 @@ def dynamic_class(name, bases, cls = Non
module of ``cls`` or from the first base class (``bases`` should
be non empty if ``cls` is ``None``).
 Documentation and source instrospection is taken from doccls, or
 cls if doccls is None, or bases[0] if both are None.
+ Documentation and source instrospection is taken from ``doccls``, or
+ ``cls`` if ``doccls`` is ``None``, or ``bases[0]`` if both are ``None``.
The constructed class can safely be pickled (assuming the
arguments themselves can).
@@ 143,8 +144,8 @@ def dynamic_class(name, bases, cls = Non
The result is cached, ensuring unique representation of dynamic
classes.
 See sage.structure.dynamic_class? for a discussion of the dynamic
 classes paradigm, and its relevance to Sage.
+ See :mod:`sage.structure.dynamic_class` for a discussion of the
+ dynamic classes paradigm, and its relevance to Sage.
EXAMPLES: