1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
|
# Copyright (c) 1997-2020
# Ewgenij Gawrilow, Michael Joswig, and the polymake team
# Technische Universität Berlin, Germany
# https://polymake.org
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2, or (at your option) any
# later version: http://www.gnu.org/licenses/gpl.txt.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#-------------------------------------------------------------------------------
object Ideal {
rule initial : GENERATORS {
my $gens = $this->GENERATORS;
my $nvars = $gens->[0]->n_vars();
foreach my $p (@$gens){
if($p->n_vars() != $nvars){
croak("\ninvalid input: Number of variables needs to be the same for all GENERATORS");
return;
}
}
}
precondition : !exists(N_VARIABLES);
precondition : GENERATORS {
$this->GENERATORS->size() > 0;
}
rule initial : GENERATORS, N_VARIABLES {
my $gens = $this->GENERATORS;
my $nvars = $this->N_VARIABLES;
foreach my $p (@$gens){
if($p->n_vars() != $nvars){
croak("\ninvalid input: N_VARIABLES does not agree with the number of variables of the GENERATORS");
return;
}
}
}
precondition : exists(N_VARIABLES);
precondition : exists(GENERATORS);
rule PRIMARY : {
$this->PRIMARY = 1;
}
precondition : PRIME;
weight 0.10;
rule PRIMARY : RADICAL.PRIME {
$this->PRIMARY = $this->RADICAL->PRIME;
}
weight 0.10;
rule ZERO : GENERATORS {
foreach my $p (@{$this->GENERATORS}){
if(!$p->trivial){
$this->ZERO = 0;
return;
}
}
$this->ZERO = 1;
}
weight 1.10;
rule N_VARIABLES : GENERATORS {
$this->N_VARIABLES = $this->GENERATORS->[0]->n_vars();
}
precondition : GENERATORS {
$this->GENERATORS->size() > 0;
}
weight 0.10;
}
object Groebner {
rule initial : {
if (my $order = $this->lookup("ORDER_NAME")) {
$order =~ /^(dp|Dp|lp|Lp|rp|ls|rs|ds|Ds)$/ or croak ("unknown term order");
} elsif ( ! defined($this->lookup("ORDER_VECTOR | ORDER_MATRIX"))) {
croak ("no term order specified");
}
}
rule INITIAL_FORMS : BASIS, ORDER_VECTOR {
$this->INITIAL_FORMS = [ map { $_->initial_form($this->ORDER_VECTOR) } @{$this->BASIS} ];
}
weight 1.10;
rule INITIAL_FORMS : BASIS, ORDER_MATRIX {
$this->INITIAL_FORMS = [ map { $_->initial_form($this->ORDER_MATRIX->row(0)) } @{$this->BASIS} ];
}
weight 1.10;
}
# Local Variables:
# mode: perl
# cperl-indent-level:3
# indent-tabs-mode:nil
# End:
|