Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in initialisation of species #12649

Closed
hivert opened this issue Mar 9, 2012 · 9 comments
Closed

Bug in initialisation of species #12649

hivert opened this issue Mar 9, 2012 · 9 comments

Comments

@hivert
Copy link

hivert commented Mar 9, 2012

The following specification is valid:

sage: Set0  = species.SetSpecies()
sage: Set1  = species.SetSpecies(min=1)
sage: Set2  = species.SetSpecies(min=2)
sage: Four = species.CombinatorialSpecies()
sage: Four.define(Set2(Four) + Set1*Set0(Four))

However, the following code breaks

sage: Four.generating_series()[1]
[...]
ValueError: generator already executing

Strangely enough, adding some seemingly unrelated instruction work
around it::

sage: Set0  = species.SetSpecies()
sage: Set1  = species.SetSpecies(min=1)
sage: Set2  = species.SetSpecies(min=2)

sage: Set2(Set1).generating_series()[1]
0

sage: Four = species.CombinatorialSpecies()
sage: Four.define(Set2(Four) + Set1*Set0(Four))
sage: Four.generating_series()[1]
1
sage: Four.generating_series()[4]
52/3
sage: Four.generating_series()
x + 2*x^2 + 16/3*x^3 + 52/3*x^4 + O(x^5)

Florent

CC: @sagetrac-sage-combinat @mantepse

Component: combinatorics

Keywords: Species, LazyPowerSeries

Issue created by migration from https://trac.sagemath.org/ticket/12649

@hivert
Copy link
Author

hivert commented Apr 25, 2013

comment:1

Here is a smaller code which triggers the problem:

Z     = species.SingletonSpecies()
Set2  = species.SetSpecies(min=2)
NMult   = species.CombinatorialSpecies()
NMult.define(Set2(Z+NMult))
NMult.generating_series()[0]

@jdemeyer jdemeyer modified the milestones: sage-5.11, sage-5.12 Aug 13, 2013
@mwhansen
Copy link
Contributor

comment:3

Fixed in #15673.

@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.1, sage-6.2 Jan 30, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.2, sage-6.3 May 6, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.3, sage-6.4 Aug 10, 2014
@fchapoton
Copy link
Contributor

comment:7

will this be fixed by the recent refactoring ?

maybe check also other tickets with "species" keyword ?

@mantepse
Copy link
Collaborator

comment:8

Yes, this already works. However, you have to be explicit about the valuation of Four now, because it cannot determine that it doesn't have valuation 0.

(I admit I don't see right now whether it should be able to determine that the valuation is not 0 - do you?)

sage: Set0  = species.SetSpecies()
sage: Set1  = species.SetSpecies(min=1)
sage: Set2  = species.SetSpecies(min=2)
sage: Four = species.CombinatorialSpecies(min=1)
sage: Four.define(Set2(Four) + Set1*Set0(Four))

sage: Four.generating_series()
z + 2*z^2 + 16/3*z^3 + 52/3*z^4 + 944/15*z^5 + 11008/45*z^6 + 313664/315*z^7 + O(z^8)

sage: Four.isotype_generating_series()
z + 3*z^2 + 10*z^3 + 40*z^4 + 170*z^5 + 785*z^6 + 3770*z^7 + O(z^8)
sage: Four.cycle_index_series()
p[1] + (2*p[1,1]+p[2]) + (16/3*p[1,1,1]+4*p[2,1]+2/3*p[3]) + (52/3*p[1,1,1,1]+16*p[2,1,1]+3*p[2,2]+8/3*p[3,1]+p[4]) + (944/15*p[1,1,1,1,1]+208/3*p[2,1,1,1]+20*p[2,2,1]+32/3*p[3,1,1]+8/3*p[3,2]+4*p[4,1]+2/5*p[5]) + (11008/45*p[1,1,1,1,1,1]+944/3*p[2,1,1,1,1]+120*p[2,2,1,1]+12*p[2,2,2]+416/9*p[3,1,1,1]+64/3*p[3,2,1]+14/9*p[3,3]+16*p[4,1,1]+6*p[4,2]+8/5*p[5,1]+p[6]) + (313664/315*p[1,1,1,1,1,1,1]+22016/15*p[2,1,1,1,1,1]+2096/3*p[2,2,1,1,1]+112*p[2,2,2,1]+1888/9*p[3,1,1,1,1]+416/3*p[3,2,1,1]+40/3*p[3,2,2]+88/9*p[3,3,1]+208/3*p[4,1,1,1]+40*p[4,2,1]+8/3*p[4,3]+32/5*p[5,1,1]+8/5*p[5,2]+4*p[6,1]+2/7*p[7]) + O^8

@mantepse
Copy link
Collaborator

comment:9

Yes, I am eager to close all the other tickets. However, I want #34552 to be in the develop branch first.

@mantepse
Copy link
Collaborator

comment:10

Hm, I think it should know that the valuation is greater than 0. The valuation of Set1 * Set0(Four) is greater than zero, because the valuation of Set1 is.

Set2 is not a polynomial (because it is not 'exact'), so Set2.__call__ is only defined if its argument has valuation at least 1. Thus we might as well assume that its valuation is at least 1.

I'm not sure yet.

@mantepse
Copy link
Collaborator

Changed keywords from Species to Species, LazyPowerSeries

@mantepse
Copy link
Collaborator

comment:12

We actually thought about this situation (I forgot), and introduced a check parameter for __call__. Of course, it is not passed by the species code.

I am still not sure what the best solution might be.

@mantepse
Copy link
Collaborator

Fixed by #36284.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants