Skip to content

make // more useful #2400

@thofma

Description

@thofma

Problem

As we were reminded of in oscar-system/Oscar.jl#5960, // can lead to nonsense:

julia> RR,_ = residue_ring(ZZ, 100)
(Integers modulo 100, Map: ZZ -> ZZ/(100))

julia> a = RR(9)
9

julia> parent(a)
Integers modulo 100

julia> W = parent(a//a)
Fraction field
  of integers modulo 100

julia> new_j = 10*W(1)
10

julia> inv_new_j = 1/new_j
1//10

julia> inv_new_j^2
Error showing value of type AbstractAlgebra.Generic.FracFieldElem{zzModRingElem}:
ERROR: Impossible inverse in Integers modulo 100

julia> weird = (inv_new_j)^2;

julia> is_zero(1//weird)
true

A possible solution

When we introduced the fraction fields, we did not have the total field of fractions. Nowadays, for a ring R we could do the following:

  • if is_domain_type(R), do what we do now,
  • if !is_domain_type(R), construct total_field_of_fractions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions