abstract algebra – functions in $ mathbb {C}[x_1, x_2, x_3, x_4]$ which disappears for all $ (u ^ 3, u ^ 2v, uv ^ 2, v ^ 3) $ where $ u, v in mathbb {C} $

I want to show that Z = {$ (u ^ 3, u ^ 2v, uv ^ 2, v ^ 3) | u, v in mathbb {C} $} is an algebraic set.
So i need functions in $ mathbb {C} (x_1, x_2, x_3, x_4) $ who disappear for all $ (u ^ 3, u ^ 2v, uv ^ 2, v ^ 3) $ or $ u, v in mathbb {C} $.

I have already discovered that the function $ f_ {uv} (x_1, x_2, x_3, x_4) = -x_1 – 3x_2 – 3x_3 – x_4 + (u + v) ^ 3 $ disappears at $ (u ^ 3, u ^ 2v, uv ^ 2, v ^ 3) $. But how can I find one that disappears for all the complex numbers u, v?

Abstract algebra – The stabilizing monoid counterparts $ M to M $ form a subgroup of $ text {End} (M) $.

Let $ M = $ the free monoid on all symbols $ S $ and consider the semiring $ text {End} (M) $. Addition is concatenation and multiplication is the composition of functions. Let $ F subset M $ to be a finished set. Let $ s: S to F $ to be a given surjective overview map such that $ s ^ 2 (m) = s (m) $ for everyone $ m in S $. Then during the extension $ s $ homomorphically to all $ m $ we have $ s ^ 2 (m) = s ^ 2 (g_1) cdots s ^ 2 (g_k) = s (g_1) cdots s (g_k) = s (m) $ or $ m = g_1 cdots g_k $ and $ g_i in S $.
So this stability under iteration goes to all $ m in M ​​$.

Prop 1. L & # 39; together $ N $ of all $ f in text {End} (M) $ so that its iterations $ f ^ k (m) $ stabilize at $ s (m) $ is closed under composition. So $ N $ is a multiplicative subgroup of $ text {End} (M) $.

Evidence. Is the question.

object-oriented – Draw a UML-style class hierarchy of abstract Python base classes with Python, python-graphviz, and graphviz

Motivation

Abstract basic classes of Python in the collections.abc The module works as mixins and also defines abstract interfaces that invoke common features in Python objects.

Although reading the actual source is quite enlightening, viewing the hierarchy as a graph would be a useful thing for Python programmers.

Unified Modeling Language (UML) is a way to visualize the design of a system.

libraries

Graphviz is a natural choice for this type of output. One can find many examples of people generating this type of outings with the help of Graphviz.

But, to ensure accuracy and completeness, and the ease of modification of the logic used to create them, we need a way to introduce Python classes into Graphviz.

A natural choice is python-graphviz, but we will have to channel the Python into the graphviz interface.

Our graphical grammar

UML communicates features that Python does not have. The use of a smaller subset of relevant features will give us a cleaner and easier to understand graph for those who know less about UML.

Our subset will be class diagrams where:

  • The names of abstract classes, data members, and methods are italicized, concrete implementations are not.
  • The edges (lines) are dotted when the subclass is abstract, and not dotted when the relation is a specialization.
  • We only show is a relationships (class hierarchy) no has a relationships (composition), because that does not really apply to our use case and because the abc The module has no relevant annotations (if we had annotations showing this relationship, we could take care of it, but I do not have any here).

Avoid overloading information in the output

We exclude most methods and default members in object. We also specifically hide other members related to class relationships and implementations that do not directly affect users.

We do not show return types (for example : type) because we miss the annotations in the module.

We do not show + (Public) - (private), and # (protected) symbols, because in Python everything is accessible, and it's just a convention that indicates that users should avoid interfaces preceded by an underscore (_).

The code

I got this environment with Anaconda, who used a new installation and required

$ conda install graphviz python-graphviz

And I did my construction in a notebook using Jupyter Lab.

First and foremost, we import the python-graphviz Digyth object, some functions of the standard library, the collections.abc module for abstract base classes that we want to study, and some types that we want to use to discriminate between objects.

We also put types or methods and members that we want to exclude into a tuple, and put the names of the methods that we also intentionally mask in a set.

from graphviz import Digraph
from inspect import getclasstree, isabstract, classify_class_attrs, signature
import collections.abc
from html import escape
from abc import ABCMeta
from types import WrapperDescriptorType, MethodDescriptorType, BuiltinFunctionType

# usually want to hide default (usually unimplemented) implementations:
# ClassMethodDescriptorType includes dict.fromkeys - interesting/rare- enough?
EXCLUDED_TYPES = ( 
    WrapperDescriptorType, # e.g. __repr__ and __lt__
    MethodDescriptorType, # e.g. __dir__, __format__, __reduce__, __reduce_ex__
    BuiltinFunctionType, # e.g. __new__
                 ) 
HIDE_METHODS = {
    '__init_subclass__',             # error warning, can't get signature
    '_abc_impl', '__subclasshook__', # why see this?
    '__abstractmethods__',
               }

Now we need to create the table (labels) for the graphviz nodes. Graphviz uses a syntax that looks like HTML (but is not).

Here we create a function that takes the class and returns the array from the information we can derive from the class.

def node_label(cls, show_all=False, hide_override=set()):
    italic_format = '{}'.format
    name_format = italic_format if isabstract(cls) else format
    attributes = ()
    methods = ()
    abstractmethods = getattr(cls, "__abstractmethods__", ())
    for attr in classify_class_attrs(cls):
        if ((show_all or attr.name(0) != '_' or attr.name in abstractmethods)
            and not isinstance(attr.object, EXCLUDED_TYPES)
            and attr.name not in hide_override):
            if name in abstractmethods:
                name = italic_format(attr.name)
            else:
                name = attr.name
            if attr.kind in {'property', 'data'}: 
                attributes.append(name)
            else:
                try:
                    args = escape(str(signature(attr.object)))
                except (ValueError, TypeError) as e:
                    print(f'was not able to get signature for {attr}, {repr(e)}')
                    args = '()'
                methods.append(name + args)
    td_align = ''
    line_join = '
'.join attr_section = f"
{td_align}{line_join(attributes)}" method_section = f"
{td_align}{line_join(methods)}" return f"""< {attr_section} {method_section}
{name_format(cls.__name__)}
>"""

The code above gives us a way to create the tables for the nodes.

Now, we define a function that takes a classtree (the type returned by inspect.getclasstree(classes)) and returns a Digraph appropriate object to display an image.

def generate_dot(
    classtree, show_all=False, 
    hide_override=HIDE_METHODS, show_object=False):
    """recurse through classtree structure 
    and return a Digraph object
    """
    dot = Digraph(
        name=None, comment=None,
        filename=None, directory=None, format='svg', 
        engine=None, encoding='utf-8', 
        graph_attr=None, 
        node_attr=dict(shape='none'),
        edge_attr=dict(
            arrowtail='onormal',
            dir='back'),
        body=None, strict=False)
    def recurse(classtree):
        for classobjs in classtree:
            if isinstance(classobjs, tuple):
                cls, bases = classobjs
                if show_object or cls is not object:
                    dot.node(
                        cls.__name__, 
                        label=node_label(cls, show_all=show_all, 
                                         hide_override=hide_override))
                for base in bases:
                    if show_object or base is not object:
                        dot.edge(base.__name__, cls.__name__, 
                                 style="dashed" if isabstract(base) else 'solid')
            if isinstance(classobjs, list):
                recurse(classobjs)
    recurse(classtree)
    return dot

And the use:

classes = (c for c in vars(collections.abc).values() if isinstance(c, ABCMeta))
classtree = getclasstree(classes, unique=True)

dot = generate_dot(classtree, show_all=True, show_object=True)
#print(dot.source) # far too verbose...
dot

We do show_object=True here, but since everything is an object in Python, it's a little redundant and will be at the top of every class hierarchy, so I think it's safe to use the default show_object=False for regular use.

dot.render('abcs', format='png')

Gives us the following PNG file (since Stack Overflow does not allow us to display SVGs):

ABC class hierarchy

Suggestions for future work

An expert in Python or Graphviz could find some important things that we missed here.

we could factorize some features and write some tests.

We could also look for and manage annotations for data members normally held in __dict__.

We could also not handle all the ways to create Python objects as we should.

I have mainly used the following code example to model the construction classes of the node table:

from abc import abstractmethod, ABCMeta
from inspect import isabstract, isfunction, classify_class_attrs, signature

class NodeBase(metaclass=ABCMeta):
    __slots__ = 'slota', 'slotb'
    @abstractmethod
    def abstract_method(self, bar, baz=True):
        raise NotImplementedError        
    def implemented_method(self, bar, baz=True):
        return True
    @property
    @abstractmethod
    def abstract_property(self):
        raise NotImplementedError
    @property
    def property(self):
        return False

class NodeExample(NodeBase):
    __slots__ = 'slotc'

NE = NodeExample

Abstract algebra – Attach a root to a field that already contains this element

I know that we can take an irreducible polynomial $ f $ on a field K $ and make an extension containing a root of $ f $ by construction $ K (x) / (f) $. What happens if $ f $ is actually reducible? For example, what is $ mathbb Q ( sqrt2) (x) / (x ^ 2 – 2) $ look like?

My apologies for the vague question. I guess I ask what kind of structure it is (in particular, I can not say if it's still a field). Which parts depend on the nature of $ f $ or K $?

abstract algebra – $ (R, m) $ is a local Noetherian ring with $ m $ maximal ideal. Say $ p in Spec (R) $ and $ p neq $ m. Is there $ n $ s.t. $ m ^ n subset p $?

$ (R, m) $ is the local noetherian ring with $ m $ maximum ideal. Say $ p in Spec (R) $ and $ p neq $ m. Certainly $ p subset m $ by the proximity of $ R $.

$ textbf {Q:} $ Is there $ n $ S. T. $ m ^ n subset p $? My consideration is the following. It follows from Artin-Reese Lemma, that $ cap_i m ^ i = 0 $. $ m $ is f.g. say $ x_1, dots, x_k $. I can not even say $ x_i ^ l = $ 0 for some people $ l $ great. It is very possible that all these $ x_i ^ l not in cap_ {j geq l} m ^ j $. I must note that if $ (R, m) $ is the evaluation ring, so there is evaluation topology to $ m ^ k subset I $ for any ideal $ I $ treated as $ 0 district.

abstract algebra – Another ring of integers in a cubic extension

I tried to solve the following problem:

Let $ alpha $ denote a root of $ p = x ^ 3 – x – 4 $ and let $ K = mathbb {Q} ( alpha) $. Find the entire ring of K $and show that K $ a class number $ 1 $.

I've already proven that $ {1, alpha, ( alpha + alpha ^ 2) / 2 } $ is a $ mathbb {Z} $-based; however, I do not know how to show that the ring of the integers of K $ is precisely $ mathbb {Z} (( alpha + alpha ^ 2) / 2) $. It's clear that $ mathbb {Z} (( alpha + alpha ^ 2) / 2) $ is a substring of the whole number ring, but why all this, that is, how can we generate $ alpha $ like a $ mathbb {Z} $linear combination of $ ( alpha + alpha ^ 2) / $ 2 and its different powers?

python – Use composition rather than inheritance and abstract classes

I have a tool that displays data in a certain format. For example, it can display a list of dogs in a CSV or JSON format.
In the code, there were many places where I had to check the format and display the data in that format. The only difference between code blocks is in data calls.
Some of them call get_name() and get_id() while others call get_type() etc.
I've tried to create an abstract class that presents the display method and the derived classes have the get_block (for JSON), get_line (for CSV) and so on.
The code looks like:

class DisplayingFormatEnum(Enum):
    OPTION_A = 'user-option-a'
    OPTION_B = 'user-option-b'


class DisplayingFormat(ABC):
    def get_row(data):
        pass

    def get_block(data):
        pass

    def get_line(data):
        pass

    def display_format_table(self):
        table = PrettyTable(self.title)
        for d in self.data:
            table.add_row(self.get_row(d))
        print(table)

    def print_json(self):
        result = ()
        for d in self.data:
            block = self.get_block(d)
            result.append(block)
        print(result)

    def display_format_dsv(self):
        for d in self.data:
            print(f"{self.get_line(d)}")

    def display_format_list(self):
        if self.result_format == 'table':
            self.display_format_table()
        elif self.result_format == 'json':
            self.display_format_json()
        else:
            self.display_format_dsv()


class DisplayingFormatPeople(DisplayingFormat):
    def __init__(self, people, result_format, enum_type):
        if not isinstance(enum_type, DisplayingFormatEnum):
            raise DisplayingFormatError("Entity must be an instance of DisplayingFormatEnum Enum")

        if enum_type.value == DisplayingFormatEnum.OPTION_A.value:
            self.title = TITLE_OPTION_A('people')
        else:
            raise DisplayingFormatError(f"DisplayingFormatPeople can only use {DisplayingFormatEnum.OPTION_A.value} as a valid enum_type. Invalid enum_type: {enum_type.value}")

        self.result_format = result_format
        self.data = people
        self.enum_type = enum_type

    def get_row(self, person):
        return (person.get_name(), person.get_id())

    def get_block(self, person):
        block = {}
        block(self.title(0)) = person.get_name()
        block(self.title(1)) = person.get_id()
        return block

    def get_line(self, person):
        return ';'.join((person.get_name(), person.id()))


class DisplayingFormatCars(DisplayingFormat):
    def __init__(self, cars, result_format, enum_type):
        if not isinstance(enum_type, DisplayingFormatEnum):
            raise DisplayingFormatError("Entity must be an instance of DisplayingFormatEnum Enum")

        if enum_type.value == DisplayingFormatEnum.OPTION_A.value:
            self.title = TITLE_OPTION_A('cars')
        else:
            raise DisplayingFormatError(f"DisplayingFormatProjects can only use {DisplayingFormatEnum.OPTION_A.value} as a valid enum_type. Invalid enum_type: {enum_type.value}")

        self.result_format = result_format
        self.data = cars
        self.enum_type = enum_type

    def get_row(self, car):
        return (car.get_type())

    def get_block(self, car):
        block = {}
        block(self.title(0)) = car.get_type()
        return block

    def get_line(self, car):
        return car.get_type()


class DisplayingFormatDogs(DisplayingFormat):
    def __init__(self, dogs, result_format, enum_type):
        if not isinstance(enum_type, DisplayingFormatEnum):
            raise DisplayingFormatError("Entity must be an instance of DisplayingFormatEnum Enum")

        if enum_type.value == DisplayingFormatEnum.OPTION_A.value:
            self.title = TITLE_OPTION_A('dogs')
        elif enum_type.value == DisplayingFormatEnum.OPTION_B.value:
            self.title = TITLE_OPTION_B('dogs')
        else:
            error_line  = "DisplayingFormatDogs can only use {DisplayingFormatEnum.OPTION_A.value} and {DisplayingFormatEnum.OPTION_B.value} as valid entities."
            error_line += "Invalid enum_type: {enum_type.value}"
            raise DisplayingFormatError(f"{error_line}")

        self.result_format = result_format
        self.data = dogs
        self.enum_type = enum_type

    def get_row(self, dog):
        return (dog.get_nickname(), dog.get_type())

    def get_block(self, dog):
        block = {}
        block(self.title(0)) = dog.get_nickname()
        block(self.title(2)) = dog.get_type()
        return block

    def get_line(self, dog):
        return ';'.join((dog.get_nickname(), dog.get_type()))


class DisplayingFormatError(Exception):
    pass

I believe this code is a good use of inheritance, but I do not think it complies with the rule "composition on inheritance".
I'm afraid of future unexplained changes that will require me to change this code.
How do I change my code to follow this rule?

magento2 – Magento 2: the class of the abstract controller is not replaced

I'm trying to replace an abstract class vendor/magento/module-sales/Controller/Adminhtml/Order/Create.php using di.xml But it does not work.
I need to make some method changes protected function _processActionData($action = null).

/vendor/magento/module-sales/Controller/Adminhtml/Order/Create.php

namespace MagentoSalesControllerAdminhtmlOrder;
   abstract class Create extends MagentoBackendAppAction
   {
      protected function _processActionData($action = null)
      { ....
      }

/app/code/CustomAPI/Product/etc/di.xml




/app/code/CustomAPI/Product/Controller/Adminhtml/Order/Create.php

namespace CustomAPIProductControllerAdminhtmlOrder

 class Create extends MagentoSalesControllerAdminhtmlOrderCreate
 {

Abstract algebra – What is the ONLY discrete evaluation ring missing in the affine line?

Let k be an algebraically closed field and K a function field of dimension 1 on it. Then we have that projective 1-space $ P ^ 1 $ on k is isomorphic to the abstract variety $ C_ {K / k} $ (using the terminology and notation as in the Hartshornes book) whose underlying space is the set of discrete evaluation rings of K / k. In addition, we know that the affine line lacks the "point to infinity" with respect to $ P ^ 1 $.

My question is: what is the corresponding discrete evaluation ring that corresponds to the infinite stem?

I know that if we integrate $ A ^ 1 $ in $ P ^ 1 $ by mapping x to (x, 1), then the missing point is simply (1,0) and whose stem is isomorphic to $ k (x, y) _ {(y)} $ but it's isomorphic to the stem $ k (x, y) _ {(x)} $ in (0,1), which is strange in that it implies that the only missing discrete evaluation ring is actually isomorphic to another which is not ??

abstract algebra – Element of odd degree on $ mathbb {Q} $

I am working on the following problem:

Let $ alpha $ to be an element of strange degree on $ mathbb {Q} $. Prove it $ alpha $ is in the field $ mathbb {Q} ( beta) $ generated on $ mathbb {Q} $ through $ beta = alpha + frac {1} { alpha} $.

I do not know how to approach this one. Yes $ alpha $ is an element of strange degree on $ mathbb {Q} $, I know that the corresponding minimal polynomial of $ alpha $ more than $ mathbb {Q} $ at an odd degree, call it $ n $. Since then $ alpha $ is degree algebraic $ n $ more than $ mathbb {Q} $, my idea was to show that $ beta $ is algebraic on $ mathbb {Q} $ degree higher than $ n $. So, that would mean that $ mathbb {Q} ( alpha) $ is actually a subfield of $ mathbb {Q} ( beta) $, and so it would follow that $ alpha $ is contained in the field $ mathbb {Q} ( beta) $.

How can I show that $ beta $ is algebraic of degree higher than $ n $ more than $ mathbb {Q} $ ? Does this equate to exploiting the equation $ beta = alpha + frac {1} { alpha} $ ? I do not automatically know that, for example, $ alpha ^ n = 0 $so I did not know how to prove what I want.

Thank you!