Extract parameters from a domain

10 views
Skip to first unread message

Martin R

unread,
Mar 16, 2026, 3:31:42 AM (3 days ago) Mar 16
to FriCAS - computer algebra system
Dear FriCAS lovers,

is there a nice way to obtain parameters of a domain?  For example, I would like to get the list of variables given

(3) -> F ==> DMP([a,b,c], INT)

Currently, I am extracting it from INFORM:

(4) -> F::INFORM

   (4)  (DistributedMultivariatePolynomial (construct a b c) (Integer))


Best wishes,

Martin

Ralf Hemmecke

unread,
Mar 16, 2026, 4:05:44 AM (3 days ago) Mar 16
to fricas...@googlegroups.com
That you get the parameters from the domain in your given case is
probably just luck. I haven't tried, but I bet, you would be unable to
get the parameters in a situation like

Foo(F: ...): Ring == add
...
foo(): ...
inform := F :: InputForm
extract_variable_list(inform)

because you wouldn't even know at all, whether F has parameters.

The best way to get the parameters of a domain is that the doman itself
exports a function that gives you the respective information.

Ralf

Martin R

unread,
Mar 16, 2026, 9:33:21 AM (3 days ago) Mar 16
to FriCAS - computer algebra system
Would you be in favour of such a signature to POLYCAT?  I am not entirely sure how to do it, would something like

variables: () -> List VarSet

provided that "VarSet has Finite" work?

Best wishes,

Martin

Waldek Hebisch

unread,
Mar 16, 2026, 2:02:10 PM (2 days ago) Mar 16
to 'Martin R' via FriCAS - computer algebra system
On Mon, Mar 16, 2026 at 06:33:21AM -0700, 'Martin R' via FriCAS - computer algebra system wrote:
> Would you be in favour of such a signature to POLYCAT? I am not entirely
> sure how to do it, would something like
>
> variables: () -> List VarSet
>
> provided that "VarSet has Finite" work?
>

Simple way would be to add type-returning functions to PolynomialCategory.
Something like:

PolynomialCategory(R : Join(SemiRng, AbelianMonoid),
E : OrderedAbelianMonoidSup, VarSet : OrderedSet):
Category ==
Join(...) with
baseRing : () -> Join(SemiRng, AbelianMonoid)
exponentMonoid : () -> OrderedAbelianMonoidSup
variableSet : () -> OrderedSet
...
add
baseRing() == R
exponentMonoid() == E
variableSet() == VarSet

There are some usability issues: either we add such "accessor" functions
to all domains/categories or we need a way to guard their use.
The first case requires coordination between domains/categories
and it takes time to settle on good design. In the second case we may
want categories like 'PolynomialCategoryCategory', so that we can check
if something is 'PolynomialCategory' with unknown parameters.
In principle one could also test for presence of apropritate
signatures, this is more tedious but maybe is enough.

--
Waldek Hebisch

Waldek Hebisch

unread,
Mar 16, 2026, 2:11:44 PM (2 days ago) Mar 16
to 'Ralf Hemmecke' via FriCAS - computer algebra system
On Mon, Mar 16, 2026 at 09:05:39AM +0100, 'Ralf Hemmecke' via FriCAS - computer algebra system wrote:
> That you get the parameters from the domain in your given case is probably
> just luck. I haven't tried, but I bet, you would be unable to
> get the parameters in a situation like
>
> Foo(F: ...): Ring == add
> ...
> foo(): ...
> inform := F :: InputForm
> extract_variable_list(inform)
>
> because you wouldn't even know at all, whether F has parameters.

Well, for "normal" domains/categories length of input form is
just 1 + number of parameters, so no problem. More problematic
are things like

Foo(with ...)

that is use of unnamed categories. But Martion is probably
interested in domains and there are severe restrictions on
possible use of categories, so this is probably only
theoretical problem.

Practically, in general context one would have to deal with
input form of records and with fact that mamy domains have
no usable input form. But in restricted context input from
may work OK.

--
Waldek Hebisch

Martin R

unread,
Mar 17, 2026, 5:32:21 AM (2 days ago) Mar 17
to FriCAS - computer algebra system
I would keep it simple, if at all.  My use case is the FriCAS -> SageMath interface.  However, I am now less convinced that the functionality is necessary at all, because

(3) -> DMP([x,y], INT)::INFORM

   (3)  (DistributedMultivariatePolynomial (construct x y) (Integer))
                                                              Type: InputForm


works just fine.

Sorry for the noise,

Martin
Reply all
Reply to author
Forward
0 new messages