Skip to content

Commit

Permalink
gh-38940: Fix flaky simplicial set test
Browse files Browse the repository at this point in the history
    
Fixes #38888 .

This test has been failing sporadically recently e.g. https://github.com
/sagemath/sage/actions/runs/11733902583/job/32689016794?pr=38938 .

From my understanding of simplicial set, the two `sigma_1` are actually
representing two different cells (the wedge looks like a "8" shape), but
because they both come from `S1` (the 1-sphere i.e. circle), they get
the same name.

SageMath does some magic during doctest so that dict entries are sorted,
but the problem is

```
        At this point, comparison between v and w is random, based on
        their location in memory. ::
```

so with some chance it fails.

This change should make it deterministic --- since the two faces are
named `sigma_1` and `sigma_1'`, the comparison should be by custom
name…?

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [x] I have created tests covering the changes. (not applicable)
- [x] I have updated the documentation and checked the documentation
preview.
    
URL: #38940
Reported by: user202729
Reviewer(s): Tobias Diez
  • Loading branch information
Release Manager committed Dec 8, 2024
2 parents d9bf3bf + f070aa3 commit 2fe0ab0
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions src/sage/categories/simplicial_sets.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,29 +444,31 @@ def covering_map(self, character):
sage: # needs sage.graphs sage.groups
sage: S1 = simplicial_sets.Sphere(1)
sage: W = S1.wedge(S1)
sage: S1_ = simplicial_sets.Sphere(1)
sage: S1_.n_cells(1)[0].rename("sigma_1'")
sage: W = S1.wedge(S1_)
sage: G = CyclicPermutationGroup(3)
sage: a, b = W.n_cells(1)
sage: C = W.covering_map({a : G.gen(0), b : G.one()}); C
Simplicial set morphism:
From: Simplicial set with 9 non-degenerate simplices
To: Wedge: (S^1 v S^1)
Defn: [(*, ()), (*, (1,2,3)), (*, (1,3,2)), (sigma_1, ()),
(sigma_1, ()), (sigma_1, (1,2,3)), (sigma_1, (1,2,3)),
(sigma_1, (1,3,2)), (sigma_1, (1,3,2))]
--> [*, *, *, sigma_1, sigma_1, sigma_1, sigma_1, sigma_1, sigma_1]
Defn: [(*, ()), (*, (1,2,3)), (*, (1,3,2)), (sigma_1', ()),
(sigma_1', (1,2,3)), (sigma_1', (1,3,2)), (sigma_1, ()),
(sigma_1, (1,2,3)), (sigma_1, (1,3,2))]
--> [*, *, *, sigma_1', sigma_1', sigma_1', sigma_1, sigma_1, sigma_1]
sage: C.domain()
Simplicial set with 9 non-degenerate simplices
sage: C.domain().face_data()
{(*, ()): None,
(*, (1,2,3)): None,
(*, (1,3,2)): None,
(sigma_1', ()): ((*, ()), (*, ())),
(sigma_1', (1,2,3)): ((*, (1,2,3)), (*, (1,2,3))),
(sigma_1', (1,3,2)): ((*, (1,3,2)), (*, (1,3,2))),
(sigma_1, ()): ((*, (1,2,3)), (*, ())),
(sigma_1, ()): ((*, ()), (*, ())),
(sigma_1, (1,2,3)): ((*, (1,3,2)), (*, (1,2,3))),
(sigma_1, (1,2,3)): ((*, (1,2,3)), (*, (1,2,3))),
(sigma_1, (1,3,2)): ((*, ()), (*, (1,3,2))),
(sigma_1, (1,3,2)): ((*, (1,3,2)), (*, (1,3,2)))}
(sigma_1, (1,3,2)): ((*, ()), (*, (1,3,2)))}
"""
from sage.topology.simplicial_set import AbstractSimplex, SimplicialSet
from sage.topology.simplicial_set_morphism import SimplicialSetMorphism
Expand Down Expand Up @@ -530,20 +532,22 @@ def cover(self, character):
sage: # needs sage.graphs sage.groups
sage: S1 = simplicial_sets.Sphere(1)
sage: W = S1.wedge(S1)
sage: S1_ = simplicial_sets.Sphere(1)
sage: S1_.n_cells(1)[0].rename("sigma_1'")
sage: W = S1.wedge(S1_)
sage: G = CyclicPermutationGroup(3)
sage: (a, b) = W.n_cells(1)
sage: C = W.cover({a : G.gen(0), b : G.gen(0)^2})
sage: C.face_data()
{(*, ()): None,
(*, (1,2,3)): None,
(*, (1,3,2)): None,
(sigma_1', ()): ((*, (1,3,2)), (*, ())),
(sigma_1', (1,2,3)): ((*, ()), (*, (1,2,3))),
(sigma_1', (1,3,2)): ((*, (1,2,3)), (*, (1,3,2))),
(sigma_1, ()): ((*, (1,2,3)), (*, ())),
(sigma_1, ()): ((*, (1,3,2)), (*, ())),
(sigma_1, (1,2,3)): ((*, (1,3,2)), (*, (1,2,3))),
(sigma_1, (1,2,3)): ((*, ()), (*, (1,2,3))),
(sigma_1, (1,3,2)): ((*, ()), (*, (1,3,2))),
(sigma_1, (1,3,2)): ((*, (1,2,3)), (*, (1,3,2)))}
(sigma_1, (1,3,2)): ((*, ()), (*, (1,3,2)))}
sage: C.homology(1) # needs sage.modules
Z x Z x Z x Z
sage: C.fundamental_group()
Expand Down

0 comments on commit 2fe0ab0

Please sign in to comment.