Skip to content

setOrbitsRepresentatives gives Nothing #5

@Jaxan

Description

@Jaxan

Hi!

I am using the setOrbitsRepresentatives function now, but I run into a problem where it returns Nothing (and I am not sure it should do that...)
I am printing some debug info in my algorithm, and this is what I get (first line is the set, second line are the representatives given by setOrbitsRepresentatives):

{[a₁,a₂,a₃] : a₁ = a₂ for a₁,a₂,a₃ ∊ 𝔸, [a₁,a₂,a₃,a₄] : a₁ ≠ a₂ ∧ (a₁ = a₃ ∨ a₂ = a₃) for a₁,a₂,a₃,a₄ ∊ 𝔸, [a₁,a₂,a₃,a₄,a₅] : a₁ ≠ a₂ ∧ a₁ ≠ a₃ ∧ a₂ ≠ a₃ for a₁,a₂,a₃,a₄,a₅ ∊ 𝔸}
{Nothing, Just [0,0,0], Just [1,0,0,0], Just [1,1,0], Just [2,3,2,2], Just [2,3,2,3], Just [2,3,3,2], Just [3,4,3,5], Just [3,4,4,5], Just [3,4,5,3,3], Just [3,4,5,3,4], Just [3,4,5,3,5], Just [3,4,5,4,3], Just [3,4,5,4,4], Just [3,4,5,4,5], Just [3,4,5,5,3], Just [3,4,5,5,4], Just [3,4,5,5,5], Just [4,5,6,4,7], Just [4,5,6,5,7], Just [4,5,6,6,7], Just [4,5,6,7,4], Just [4,5,6,7,5], Just [4,5,6,7,6], Just [4,5,6,7,7], Just [5,6,7,8,9]}

However, when I try to reproduce the bug in ghci, the set is represented differently internally, so it doesn't show the bug...

Prelude NLambda> let x = NLambda.filter (\[a,b,c] -> a `eq` b) (replicateAtoms 3) `union` NLambda.filter (\[a,b,c,d] -> a `neq` b /\ (a `eq` c \/ b `eq` c)) (replicateAtoms 4) `union` NLambda.filter (\[a,b,c,d,e] -> a `neq` b /\ a `neq` c /\ b `neq` c) (replicateAtoms 5)
Prelude NLambda> x
{[a₁,a₁,a₂] : for a₁,a₂ ∊ 𝔸, [a₁,a₂,a₃,a₄] : a₁ ≠ a₂ ∧ (a₁ = a₃ ∨ a₂ = a₃) for a₁,a₂,a₃,a₄ ∊ 𝔸, [a₁,a₂,a₃,a₄,a₅] : a₁ ≠ a₂ ∧ a₁ ≠ a₃ ∧ a₂ ≠ a₃ for a₁,a₂,a₃,a₄,a₅ ∊ 𝔸}
Prelude NLambda> setOrbitsRepresentatives x
{Just [0,0,0], Just [1,0,0,0], Just [1,1,0], Just [2,3,2,2], Just [2,3,2,3], Just [2,3,3,2], Just [3,4,3,5], Just [3,4,4,5], Just [3,4,5,3,3], Just [3,4,5,3,4], Just [3,4,5,3,5], Just [3,4,5,4,3], Just [3,4,5,4,4], Just [3,4,5,4,5], Just [3,4,5,5,3], Just [3,4,5,5,4], Just [3,4,5,5,5], Just [4,5,6,4,7], Just [4,5,6,5,7], Just [4,5,6,6,7], Just [4,5,6,7,4], Just [4,5,6,7,5], Just [4,5,6,7,6], Just [4,5,6,7,7], Just [5,6,7,8,9]}

I will try to find a smaller example.

My current work around is to simply ignore the Nothing, but I'm not sure that is the right way to go.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions