AbstractAlgebra.jl icon indicating copy to clipboard operation
AbstractAlgebra.jl copied to clipboard

Add some is_known methods, use one in conformance tests

Open fingolfin opened this issue 10 months ago • 1 comments

  • Implement is_known(characteristic, ::NCRing)
  • Implement is_known(is_perfect, ::Field)
  • Implement is_known(is_finite, ::NCRing)
  • Use is_known in conformance tests
  • Add a fallback for is_known(characteristic, ::NCRing)

This PR is my own experiment to see how much work it takes to make is_known (and related functions like my _implements / can_compute) work. Turns out quite a few methods need to be added here in AA, but luckily these then cover many different ring implementations. Only further "leaf ring types" need to provide further is_known methods.

One problem that remains is how to prevent people from adding a fast method for foobar but then forgetting to add a matching is_known(foobar, x) method. This can happen easily, and in fact it will be the case right now for many rings in Nemo/Hecke/Oscar simply because they existed before we created is_known.

We really want to avoid that because otherwise is_known becomes much less useful. One way to tackle this would be by using the conformance tests to enforce this to a level.

The final two commits in this PR try to do this for characteristic. But they might be controversial, so please have a close look at them specifically.

fingolfin avatar Feb 13 '25 10:02 fingolfin

I think your comments reveal that it is not clear what is_known will be used for. In the context here, it seems that is_known is becoming part of the interface for rings/fields, but without writing down what is explicitly required:

  • every field type must implement is_known(typeof(characteristic), F::Field)? Or
  • for every field type characteristic(F::Field) must be "fast"?

But this also raises the question which functions to add. For example, what is the point of having is_known(::typeof(characteristic), F::Field)?

  • Why would we want characterstic to be available via is_known, or
  • do we want everything available via is_known?

On the other hand, a less systematic use of is_known (and this is how it is/was used before in the various customs variations of is_known) is:

  • there is no formal interface and the developers know what they doing?

thofma avatar Feb 13 '25 11:02 thofma