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

Error when defining differentials over GCA's with relations. #34818

Closed
miguelmarco opened this issue Dec 2, 2022 · 23 comments
Closed

Error when defining differentials over GCA's with relations. #34818

miguelmarco opened this issue Dec 2, 2022 · 23 comments

Comments

@miguelmarco
Copy link
Contributor

The following code

sage: A.<a,b,x,u> = GradedCommutativeAlgebra(QQ,degrees=(2,2,3,3))
sage: A = A.quotient(A.ideal([a*u,b*u,x*u]))
sage: A.cdg_algebra({a:u,x:a*b})

Produces an error

...

File ~/sage/src/sage/algebras/commutative_dga.py:253, in Differential.__init__(self, A, im_gens)
    251 for i in A.gens():
    252     if not self(self(i)).is_zero():
--> 253         raise ValueError("The given dictionary does not determine a valid differential")

ValueError: The given dictionary does not determine a valid differential

which is wrong, because the differential is valid in the quotient algebra.

It seems that the computations for the differential are done in the free algebra instead of the quotient one.

CC: @tscrim @jhpalmieri

Component: algebra

Author: Miguel Marco

Branch/Commit: 8ba265b

Reviewer: Travis Scrimshaw

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

@miguelmarco miguelmarco added this to the sage-9.8 milestone Dec 2, 2022
@miguelmarco
Copy link
Contributor Author

@miguelmarco
Copy link
Contributor Author

Commit: fe84785

@miguelmarco
Copy link
Contributor Author

New commits:

fe84785Check for ideal preservation without creating an auxiliary algebra with non-valid differential

@tscrim
Copy link
Collaborator

tscrim commented Dec 6, 2022

comment:3

A few minor things:

-Check that #34818 is solved::
+Check that :trac:`34818` is solved::
         if isinstance(im_gens, (list, tuple)):
-           im_gens = {A.gen(i): x for i, x in enumerate(im_gens)}
-
-        im_gens = {A(a): A(im_gens[a]) for a in im_gens}
+           im_gens = {A.gen(i): A(x) for i, x in enumerate(im_gens)}
+        else:
+            im_gens = {A(a): A(im_gens[a]) for a in im_gens}
         def image_monomial(exponent):
             i = 0
             cexp = list(exponent)
             while i < len(cexp):
-                if cexp[i] == 0:
+                if not cexp[i]:
                     i +=1
                     continue
                 a = A.gen(i)
                 try:
                     da = im_gens[a]
                 except KeyError:
                     da = A.zero()
                 cexp[i] -= 1
-                b = prod([A.gen(j)**cexp[j] for j in range(len(cexp))])
+                b = prod(A.gen(j) ** cexp[j] for j in range(len(cexp)))
                 db = image_monomial(cexp)
-                im =  da * b + (-1)**A._degrees[i]*a*db
-                return(A(im))
+                im =  da * b + (-1)**A._degrees[i] * a * db
+                return A(im)
             return A.zero()
 
         for g in I.gens():
             d = g.dict()
-            res = A(sum([d[ex]*image_monomial(ex) for ex in d]))
+            res = A.sum(d[ex] * image_monomial(ex) for ex in d)
             if not res.is_zero():
-                raise ValueError("The differential does not preserve the ideal")
+                raise ValueError("the differential does not preserve the ideal")

Note that this last change might change a few error messages, but this is to follow a Python convention.

@miguelmarco
Copy link
Contributor Author

comment:4

Your changes look good. Can you push them?

@tscrim
Copy link
Collaborator

tscrim commented Dec 7, 2022

Changed commit from fe84785 to 9fde881

@tscrim
Copy link
Collaborator

tscrim commented Dec 7, 2022

@tscrim
Copy link
Collaborator

tscrim commented Dec 7, 2022

comment:5

Done. I also took the liberty of making all of the error messages in the file follow the Python convention (to help prevent any inconsistencies).


New commits:

9fde881Some small reviewer changes.

@tscrim
Copy link
Collaborator

tscrim commented Dec 7, 2022

Reviewer: Travis Scrimshaw

@miguelmarco
Copy link
Contributor Author

comment:6

Great!

It can be set to positive review if nobody objects.

@fchapoton
Copy link
Contributor

comment:7

pyflakes plugin says

+src/sage/algebras/commutative_dga.py:203:13 local variable 'squares' is assigned to but never used

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 9, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

a8600baRemoving the squares ideal.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 9, 2022

Changed commit from 9fde881 to a8600ba

@tscrim
Copy link
Collaborator

tscrim commented Dec 9, 2022

comment:9

Fixed.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 14, 2022

Changed commit from a8600ba to 2bf730c

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 14, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

2bf730cMerge branch 'develop' into u/tscrim/differential_gca_relations-34818

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 19, 2022

Changed commit from 2bf730c to 8ba265b

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 19, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

8ba265bAddressing pyflakes.

@tscrim
Copy link
Collaborator

tscrim commented Dec 19, 2022

comment:12

Green bot modulo the pyflakes unused variable I just removed.

@tscrim
Copy link
Collaborator

tscrim commented Dec 21, 2022

comment:13

Morally green bot.

@miguelmarco
Copy link
Contributor Author

comment:14

Positive review then?

@tscrim
Copy link
Collaborator

tscrim commented Dec 23, 2022

comment:15

Assuming Frédéric has no further ones, I think so.

@vbraun
Copy link
Member

vbraun commented Jan 5, 2023

Changed branch from u/tscrim/differential_gca_relations-34818 to 8ba265b

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

4 participants