diff --git a/docs/method.rst b/docs/method.rst index 71cfa1f..b6410a9 100644 --- a/docs/method.rst +++ b/docs/method.rst @@ -1,12 +1,11 @@ Method ====== -The method chapters state the mathematics behind symident: the notion of identifiability it -decides, how the rank of the observability-identifiability matrix is computed and when the order -is sufficient, how non-identifiable directions are obtained in closed form and proven, how a model -is reduced to identifiable parameters, and how the parameter values with the same output are -counted. Every statement that rests on random points comes with an error probability or is named -in the result. +The method chapters state the mathematics behind symident: the rank of the +observability-identifiability matrix and when the order is sufficient, non-identifiable directions +in closed form and their proofs, the reduction to identifiable parameters, and the count of +parameter values with the same output. Every statement that rests on random points comes with an +error probability or is named in the result. .. toctree:: :maxdepth: 1 @@ -29,8 +28,7 @@ Notation and terms \dot x = f(x, u, \eta), \qquad x(t_0) = x_0(\eta), with states :math:`x \in \mathbb{R}^{n_x}`, parameters :math:`\eta`, start time :math:`t_0`, -inputs :math:`u = u(t, \eta)`, i.e., given functions of time such as a dose set by an event, -and an observation function :math:`h = (h_1, \dots, h_{n_y})` with one component per +given inputs :math:`u = u(t, \eta)`, and an observation function :math:`h = (h_1, \dots, h_{n_y})` with one component per observable. The *coordinates* :math:`\theta \in \Theta \subseteq \mathbb{R}^d` are the estimated parameters and the free initial values; they give the parameters by a *parametrization* :math:`\eta = \eta(\theta)` and the initial value :math:`x_0(\theta)`, and @@ -98,8 +96,8 @@ Structural identifiability and Lie symmetries The model is *locally structurally identifiable* at :math:`\theta` if no nearby :math:`\tilde\theta \ne \theta` has the same output. *Structural* means that the question -is decided by the equations alone, as if the observables were known exactly and continuously, -and for generic :math:`\theta`. +is decided by the equations alone, for exact and continuous observables and generic +:math:`\theta`. A continuous family of coordinate values with the same output is the orbit of a *Lie symmetry*, a local one-parameter group :math:`\Phi_\lambda` of transformations of diff --git a/docs/method/conditions.rst b/docs/method/conditions.rst index 5a3a0ee..9639832 100644 --- a/docs/method/conditions.rst +++ b/docs/method/conditions.rst @@ -14,244 +14,146 @@ Conditions and events The rows of the conditions :math:`c = 1, \dots, C` are stacked over the shared coordinates, so that :math:`\ker \mathrm{OIM} = \bigcap_c \ker \mathrm{OIM}^{(c)}`. -A segment starts from the end of the previous one, propagated over the *gap* -:math:`\Delta t_i` between the events. To separate directions that exist only for particular -event timings from generic ones, the gaps are placed on the line -:math:`\Delta t_i = \varepsilon\, \Delta t_i^{0}` through the actual gaps :math:`\Delta -t_i^{0}`, and the rank is taken over the Laurent series :math:`\mathbb{F}_p((\varepsilon))` in -the formal variable :math:`\varepsilon`. The kernel at :math:`\varepsilon = 1` is read from -Padé forms, i.e., rational functions of :math:`\varepsilon` matching the series of each kernel -entry, that further coefficients confirm; this acceptance is heuristic and gives a basis of the -kernel only. - -The rows after a gap are power series in :math:`\varepsilon` whose coefficients belong to a -family of functions fixed by the model. Their rank, at points uniform modulo :math:`p`, -therefore gives an upper bound of the rank over the series, with error terms that enter the -order bound. The *gap order* :math:`M`, the number of coefficients kept, rises until the -truncated rank reaches this bound, which proves :math:`M` sufficient; a truncated rank above -the bound refutes it, and nothing is certified. A symbolic event time gives no bound, since it -moves the boundary and shifts the series and the event state outside the family. Without bound -(``equilibrate``, recast terms, such an event time) or at ``reconst_control(gap_order_cap=)``, -the rank is a lower bound, and ``info["limits"]`` says where :math:`M` stopped. - -**Many conditions.** With 24 or more conditions of one segment each, without unknown inputs, -recast terms or, at rest, conserved totals, the analysis runs on a subset :math:`S` of the -conditions. The conditions are taken one of each *structure* in turn, a structure being the set -of coordinates that reach the output of a condition at some Lie order. At a random point, a -condition joins :math:`S` where the rows of the condition raise the rank of the rows of the -conditions before it, or where it is the first to reach a coordinate; the rows go to two orders -past the largest first order of a coordinate, and again to the order the analysis of :math:`S` -reaches, with the conditions of :math:`S` first. At rest the rows of a condition are those on -:math:`\theta` after the resting states of the condition are eliminated. Since the rows of -:math:`S` are rows of the whole problem, +A segment starts from the end of the previous one, propagated over the *gap* :math:`\Delta t_i` +between the events. To separate directions that exist only for particular event timings from +generic ones, the gaps are placed on the line :math:`\Delta t_i = \varepsilon\, \Delta t_i^{0}` +through the actual gaps :math:`\Delta t_i^{0}`, and the rank is taken over the Laurent series +:math:`\mathbb{F}_p((\varepsilon))`. The kernel at :math:`\varepsilon = 1` is read from Padé forms +of the kernel entries that further coefficients confirm; this acceptance is heuristic and gives a +basis of the kernel only. + +The coefficients of the rows after a gap belong to a family of functions fixed by the model, so +their rank at points uniform modulo :math:`p` bounds the rank over the series from above. The *gap +order* :math:`M`, the number of coefficients kept, rises until the truncated rank reaches this +bound, which proves :math:`M` sufficient. Without a bound (``equilibrate``, recast terms, a +symbolic event time) or at ``reconst_control(gap_order_cap=)``, the rank is a lower bound, and +``info["limits"]`` says where :math:`M` stopped. + +**Many conditions.** With many conditions of one segment each, the analysis runs on a subset +:math:`S` of the conditions, chosen at a random point so that each added condition raises the rank +or reaches a new coordinate. Since the rows of :math:`S` are rows of the whole problem, .. math:: \operatorname{rank} \mathrm{OIM} \;\ge\; \operatorname{rank} \mathrm{OIM}^{(S)} = d - k -for the :math:`k` directions :math:`\xi_1, \dots, \xi_k` found on :math:`S`. The upper bound -needs each :math:`\xi_j` to be a symmetry of every condition :math:`c \notin S`, which is -proven in one of four ways: no coordinate of the support of :math:`\xi_j` reaches the output of -:math:`c`, so that every row of :math:`c` vanishes on the support; :math:`\xi_j` is -proportional to an exact scaling of the whole model, checked on one condition per group of -equal monomials; the lift of the closed form of :math:`\xi_j` is proven on :math:`c` as in -:ref:`proofs-over-q`; or, at rest, the output identities hold at the resting states of :math:`c`. -Then :math:`\ker \mathrm{OIM} \supseteq \operatorname{span}(\xi_1, \dots, \xi_k)` and -the two ranks agree, proven when every :math:`\xi_j` is exact on :math:`S`. A condition where a -direction leaves the kernel at a random point, or where none of the four applies, joins -:math:`S` and the analysis repeats; where :math:`S` would hold more than half of the conditions, -or a direction has no exact closed form, every condition is analyzed. ``info["selection"]`` -lists :math:`S` and how the other conditions are covered; ``SYMIDENT_NOSELECT=1`` analyzes every -condition. +for the :math:`k` directions :math:`\xi_j` found on :math:`S`. The upper bound needs each +:math:`\xi_j` to be a symmetry of every condition :math:`c \notin S`, proven when no coordinate of +the support reaches the output of :math:`c`, when :math:`\xi_j` is proportional to an exact scaling, +or when the lift of the closed form, or at rest the output identities, are proven on :math:`c` +(:ref:`proofs-over-q`). A condition where none applies joins :math:`S`. ``info["selection"]`` lists +:math:`S`; ``SYMIDENT_NOSELECT=1`` analyzes every condition. .. _steady-states: Resting states -------------- -With ``equilibrate=True`` every condition starts at rest: the initial value is a *resting -state* :math:`x^\ast(\theta)` with :math:`f(x^\ast, 0, \eta) = 0`, inputs at zero. The -*balances* of a condition are the components of :math:`f` cleared to polynomials, and the -*resting variety* :math:`W` is the closure of :math:`\{(\theta, x) : f(x, 0, \eta(\theta)) = -0\}`. No closed form of the resting state is needed: at each point the balances are solved over -:math:`\mathbb{F}_p`, by linear elimination, by resultants for coupled subsystems of one or two -states, or by msolve :cite:p:`Berthomieu2021`. Only msolve excludes states at zero, by a Rabinowitsch -variable :math:`\tau` with :math:`\tau \prod_i x_i = 1`, and a resting state solved modulo one -prime is not resampled at another. The kernel is taken in coordinates and resting states -jointly, with the tangency of a direction :math:`(\xi_\theta, \xi_x)` to :math:`W` as extra -rows rather than through the implicit function theorem. Let :math:`N` be the states that are -neither the pivot of a conserved total (below), nor an input, nor at zero at rest, and -:math:`f_N` their balances. The tangency rows are +With ``equilibrate=True`` every condition starts at rest: the initial value is a *resting state* +:math:`x^\ast(\theta)` with :math:`f(x^\ast, 0, \eta) = 0`, inputs at zero. The *balances* of a +condition are the components of :math:`f` cleared to polynomials, and the *resting variety* +:math:`W` is the closure of :math:`\{(\theta, x) : f(x, 0, \eta(\theta)) = 0\}`. No closed form of +the resting state is needed: at each point the balances are solved over :math:`\mathbb{F}_p`, by +elimination or by msolve :cite:p:`Berthomieu2021`. The kernel is taken in coordinates and resting +states jointly, with the tangency of a direction :math:`(\xi_\theta, \xi_x)` to :math:`W` as extra +rows. With :math:`N` the states that are neither the pivot of a conserved total, nor an input, nor +at zero at rest, and :math:`f_N` their balances, the tangency rows are .. math:: J_x\, \xi_{x_N} + J_\theta\, \xi_\theta = 0, \qquad J_x = \partial_{x_N} f_N, \quad - J_\theta = \partial_\theta f_N, - -where the columns of :math:`\partial_x f` at the pivots are columns of :math:`J_\theta`, since -the resting value of a pivot is a coordinate; inputs and states at zero enter as rows that hold -them at zero. One balance per total is dropped, that of the pivot. This is exact: each total -:math:`\sum_i a_i x_i` gives :math:`\sum_i a_i f_i = 0`, and the coefficient matrix -:math:`C_P` of the totals at the pivots is invertible, so :math:`f_P = -C_P^{-1} C_N f_N` -vanishes wherever :math:`f_N` does. The full :math:`\partial_x f` is singular with a total, the -reduced :math:`J_x` is square; it is the *resting Jacobian*. A proven rank also needs the -resting Jacobian of every condition solved at the point itself invertible at the base point; -otherwise the rank is a lower bound. + J_\theta = \partial_\theta f_N . + +Dropping the balance of each pivot is exact: each total :math:`\sum_i a_i x_i` gives :math:`\sum_i +a_i f_i = 0`, and the coefficient matrix :math:`C_P` of the totals at the pivots is invertible, so +:math:`f_P = -C_P^{-1} C_N f_N` vanishes wherever :math:`f_N` does. The square :math:`J_x` is the +*resting Jacobian*. A proven rank also needs the resting Jacobian of every condition invertible at +the base point; otherwise the rank is a lower bound. **Branches.** A *branch* is an irreducible component of :math:`W` over :math:`\mathbb{Q}`. By -default the first condition draws the resting states and solves the balances for the -*turnover rates*, one rate per state that enters the balance of the state linearly (the *forward seed*); -this names the component that the drawn values parametrize. Where a balance has several roots -over :math:`\mathbb{F}_p`, the first nonzero one found is taken and named in -``info["branches"]``: by the factor over :math:`\mathbb{Q}(\theta)` it solves where a balance -splits into factors, else as *conjugate*. Conjugate means that the lexicographic Gröbner basis -of the balances, states at zero removed, has at a point the *shape* -:math:`x_1 - g_1(x_n), \dots, x_{n-1} - g_{n-1}(x_n), P(x_n)` with an irreducible *eliminant* -:math:`P`. Other points take their root on that branch or, without one, are left out. -Conjugate roots have equal rank, and an eliminant irreducible at a point is irreducible over -:math:`\mathbb{Q}(\theta)`. - -**Zero at rest.** A state rests at zero when the right-hand side of the state, with the inputs at zero, is -linear in it with a coefficient that is nonzero while the other such states are zero. In a -reaction network, a species that is consumed but not produced rests at zero as the single -reactant of a consuming reaction, as does the single reactant of positive weight in a reaction -that lowers a weight no reaction raises (a *sink*; a weight assigns each species a number in -:math:`[0, 1]`). Of several such reactants, as in :math:`A + B \to 0`, the first is set to zero -(``info["branches"]``). A state with right-hand side zero at rest, and the pivot of a conserved -total (below), has a free resting value, the initial value. Rates are read at generic values, -so a catalyst at rest is nonzero. Where the coefficient of a state of a total at zero holds -other states, as for :math:`\dot B = B\,(k_1 A - k_2)`, the resting set has a second branch -with the state away from zero, where the coefficient vanishes; ``info["branches"]`` names it, -and ``free_initial`` naming the state takes it. ``free_initial`` naming a state at zero on every -resting state is an error. - -**Conserved totals.** A linear combination :math:`T = \sum_i a_i x_i` of states that the -right-hand sides conserve is a *total*; the coefficients may hold parameters, such as volumes. -Totals are read from the stoichiometry of a reaction network or from the linear laws of the -ODEs, unless given. The basis read off consists of nonnegative laws where these span the laws, -the extreme rays of the cone of nonnegative laws with the fewest species first, so that it does -not depend on the order of the species and each total is positive on the parameter space; a -total with coefficients of both signs is named in ``info["limits"]`` under ``reduce_cq``, which -takes it positive. - -Under ``equilibrate`` each total leaves one resting value free, which one species of the total, -the *pivot*, holds as initial value. The pivots form a set :math:`P` of species, one per -independent total, with an invertible coefficient matrix :math:`C_P`. ``free_initial`` names -them; otherwise they are chosen by the structure of the model, in this order: not at zero at -rest, not an input and not the base of a free power, a coefficient without parameters, in the -fewest totals, observed. Where several sets tie by these criteria, up to six are analyzed and the -result with the best rank status, rank, levels and kinds is kept, so that the result does not -depend on the names or the order of the states and totals. With another pivot the resting -value of another state is the coordinate, so the generators differ, but their spans agree after -the map to the parameters and all resting states at a common resting point. Where directions -stay open, other valid sets are tried as well. ``info["settings"]["free_initial"]`` holds the -pivots of the result. - -With ``reduce_cq`` the pivots are eliminated instead, :math:`x_P = C_P^{-1} (T - C_N x_N)`, and -the values :math:`T` of the totals become coordinates (``info["settings"]["eliminated"]``); the -pivots are chosen as above, except that unobserved species are eliminated first. An event that changes -a species :math:`x_i` of a total changes the total by :math:`a_i\,(E(x_i) - x_i)`, with -:math:`E(x_i)` the value after the event; like every event value it reads the states before the -events. The total is then a state without dynamics, so the segments after the event see the new -total, and an event on an eliminated species changes only the totals. Both parametrizations -describe the same resting variety, so ``reduce_cq`` gives the same rank and the same span of the -directions, mapped to the same space, as the pivots. - -**Rank at the resting start.** Under ``equilibrate`` the rank is that at the declared resting -start, whose coordinates fix the level set of each total. The ceiling of the order certificate -(:ref:`sufficient-lie-order`) is the generic rank on the whole resting variety, so the computed rank -cannot exceed the rank along the trajectories from the declared start; it can only fall short of -it, and is then reported as a lower bound (a singular resting Jacobian, an order not proven -sufficient) or covered by the error bound (a random point). The exact scalings bound the rank -from above, so a rank at that bound proves the order sufficient without random points, with -``info["order_bound"]`` zero. - -**Diagonal start.** Conditions sharing :math:`\theta` have coupled resting states. Rank and -kernel are generic on the joint variety of the conditions, -:math:`\{(\theta, x_1, \dots, x_C) : (\theta, x_c) \in W_c\}`, so any point of it over -:math:`\mathbb{F}_p((\varepsilon))` off an exceptional subvariety gives them. symident seeks a -set :math:`P_Z` of free parameters whose value zero makes all conditions equal to the first, -and the largest set :math:`X_Z` of states whose value zero is then invariant; at -:math:`\theta_{P_Z} = 0`, :math:`x_{X_Z} = 0` the forward seed is a resting point -:math:`\hat z` of all conditions. Along :math:`\theta(\varepsilon) = \hat\theta + \varepsilon\, -\zeta`, with :math:`\zeta` the values of :math:`P_Z` at the sample point, Newton steps lift each -condition to a power series, +default the first condition draws the resting states and solves the balances for the *turnover +rates*, one rate per state that enters the balance of the state linearly (the *forward seed*), which +names the component that the drawn values parametrize. Where a balance has several roots, the one +taken is named in ``info["branches"]``, by the factor over :math:`\mathbb{Q}(\theta)` it solves, or +as *conjugate* where the balances have an irreducible eliminant; conjugate roots have equal rank, +and an eliminant irreducible at a point is irreducible over :math:`\mathbb{Q}(\theta)`. A +state rests at zero when the right-hand side, with the inputs at zero, is linear in it with a +coefficient nonzero at rest; a second branch with the state away from zero is named there and taken +by ``free_initial``. + +**Conserved totals.** A linear combination :math:`T = \sum_i a_i x_i` of states that the right-hand +sides conserve is a *total*; the coefficients may hold parameters, such as volumes, and the basis +read off is positive on the parameter space where possible. Under ``equilibrate`` each total leaves +one resting value free, held by one species of the total, the *pivot*, as initial value. +``free_initial`` names the pivots, otherwise they are chosen by the structure of the model, so that +the result does not depend on the names or the order of the states; other pivots give generators +with the same span. With ``reduce_cq`` the pivots are eliminated, :math:`x_P = C_P^{-1} (T - C_N +x_N)`, and the totals become coordinates, with the same rank and span of directions. + +**Rank at the resting start.** The ceiling of the order certificate (:ref:`sufficient-lie-order`) +is the generic rank on the whole resting variety, so the computed rank cannot exceed the rank along +the trajectories from the declared start; it can only fall short of it, and is then reported as a +lower bound or covered by the error bound. The exact scalings bound the rank from above, so a rank +at that bound proves the order sufficient without random points, with ``info["order_bound"]`` zero. + +**Diagonal start.** Conditions sharing :math:`\theta` have coupled resting states. Rank and kernel +are generic on the joint variety :math:`\{(\theta, x_1, \dots, x_C) : (\theta, x_c) \in W_c\}`, so +a generic point of it over :math:`\mathbb{F}_p((\varepsilon))` gives them. symident seeks +parameters whose value zero makes all conditions equal, so that a common resting point :math:`\hat +z` exists, and lifts each condition along :math:`\theta(\varepsilon) = \hat\theta + \varepsilon\, +\zeta` to a power series by Newton steps, .. math:: x_{c,k} = -J_c(\hat z)^{-1}\, [\varepsilon^k]\, f_c\big(x_{c, 0`, -:math:`j = 1, \dots, n_\gamma`. The *declared signs* are the domain declared by ``positive`` -and the start sides declared by ``regimes``. Conditions that the declared signs decide are -resolved; a factor of odd multiplicity of an undecided one is a *switching function* -:math:`\gamma_j`, with *switching surface* :math:`\Gamma_j = \{\gamma_j = 0\}`. A sign vector -:math:`\sigma \in \{+1, -1\}^{n_\gamma}` gives a smooth *regime* :math:`(F_\sigma, h_\sigma)`, -the field and the observables where every :math:`\gamma_j` has the sign :math:`\sigma_j`. A -*root event* (``root`` in place of ``time``) adds the root expression as a switching function -and resets the target state, the *event state*, on :math:`\Gamma_j`. - -**Regimes.** A direction counts only if it is a symmetry of every regime the declared signs -allow. Without ``regimes``, every sign vector counts unless the declared positivity decides -the sign of :math:`\gamma_a - \gamma_b` or :math:`\gamma_a + \gamma_b` against it; none is -dropped for parameter values or for not being reached, so the result holds for every initial -state. A parameter that acts only in a regime excluded by a decided condition stays a -coordinate, with the unit direction :math:`\partial_{\theta_i}` as exact direction. Each -allowed regime enters as a *copy* of the model, i.e., the rows of that regime with initial -states of their own and the parameters shared, from the start of the condition and, with -other regimes allowed, as a copy switched into it (``info["switching"]["conditions"]``). - -**Entry points.** The state at a switch is unknown, so a direction counts only if it is a -symmetry from every point of the surface. A state that starts at zero in every condition, that -every allowed regime keeps at zero with finite derivatives in such states, and that no later -event moves, is zero along every trajectory. It is dropped (``info["zero_states"]``), and a -coordinate that only such states read is a separate direction :math:`\partial_{\theta_i}`; -``info["limits"]`` names a condition with further such states. For a copy switched into a -regime, other invariant sets of the start, such as the level set of a conserved total, are not -used, so the rank of a model with switches can exceed the rank along the trajectories from the -declared start. This concerns switches only; under ``equilibrate`` without switches the rank -cannot exceed it (:ref:`steady-states`). - -**Visibility.** Two regimes :math:`\sigma, \sigma'` are *neighbors* at :math:`\Gamma_j` when -they differ only in the sign of :math:`\gamma_j`. The switch is *visible* when for some -neighbors, observable :math:`h_i` and order :math:`k` +Each switch condition, a comparison or the argument of ``Heaviside()``, ``sign()``, ``abs()``, +``max()`` or ``min()``, is a sign condition :math:`\gamma_j(x, \eta, t) > 0`. The *declared signs* +are the domain declared by ``positive`` and the start sides declared by ``regimes``. Conditions that +the declared signs decide are resolved; a factor of odd multiplicity of an undecided one is a +*switching function* :math:`\gamma_j`, with *switching surface* :math:`\Gamma_j = \{\gamma_j = 0\}`. +A sign vector :math:`\sigma` gives a smooth *regime* :math:`(F_\sigma, h_\sigma)`. A *root event* +(``root`` in place of ``time``) adds the root expression as a switching function and resets the +target state on :math:`\Gamma_j`. + +**Regimes and entry points.** A direction counts only if it is a symmetry of every regime the +declared signs allow, from the start of each condition and from every point of a surface, since the +state at a switch is unknown. Without ``regimes``, no sign vector is dropped for parameter values +or for not being reached, so the result holds for every initial state. A state that every allowed +regime keeps at zero from a zero start is dropped (``info["zero_states"]``). Other invariant sets of +the start are not used for a copy switched into a regime, so the rank with switches can exceed the +rank along the trajectories from the declared start; without switches it cannot +(:ref:`steady-states`). + +**Visibility.** Two regimes are *neighbors* at :math:`\Gamma_j` when they differ only in the sign of +:math:`\gamma_j`. The switch is *visible* when for some neighbors, observable :math:`h_i` and order +:math:`k` .. math:: \big(L_{F_\sigma}^k h_{\sigma,i} - L_{F_{\sigma'}}^k h_{\sigma',i}\big)\big|_{\Gamma_j} - \ne 0 . + \ne 0 , -A nonzero Taylor coefficient at a point of :math:`\Gamma_j`, modulo a prime, proves this. The -switch is *invisible*, or *hidden*, when for every pair the observables agree and every state -reaching them has the same right-hand side, so that every Lie derivative agrees, and -*undecided* otherwise. A root event surface counts as visible. +proven by a nonzero Taylor coefficient at a point of :math:`\Gamma_j` modulo a prime; *hidden* +when the observables and the right-hand sides of every state reaching them agree; and *undecided* +otherwise. A root event surface counts as visible. **The rule.** Let :math:`\tau_e` be the time and :math:`E_e` the map of the states of event -:math:`e`. A direction :math:`v` is reported non-identifiable when, in every condition, it lies -at the start in a distribution :math:`\mathcal{D} = \operatorname{span}\{Y_1, \dots, Y_m\}` of -fields on parameters and states with +:math:`e`. A direction :math:`v` is reported non-identifiable when, in every condition, it lies at +the start in a distribution :math:`\mathcal{D} = \operatorname{span}\{Y_1, \dots, Y_m\}` of fields +on parameters and states with .. math:: @@ -381,87 +240,49 @@ fields on parameters and states with Y_i(\tau_e) = 0, \qquad \mathrm{D}E_e\, Y_i(z) \in \mathcal{D}\big(E_e(z)\big) \ \text{for every event and reset}, -and, at a surface that is not visible and that some :math:`Y_i` moves, for every pair of -neighbors +and, at a surface that is not visible and that some :math:`Y_i` moves, for every pair of neighbors .. math:: \big(F_\sigma - F_{\sigma'}\big)\big|_{\Gamma_j} \in \mathcal{D}, \qquad \big(h_\sigma - h_{\sigma'}\big)\big|_{\Gamma_j} = 0 . -The events and resets are those of the condition: an event that names conditions (``cond``) acts in -those only. No :math:`Y_i` moves a fixed symbol, an input or time. The direction is -:math:`v = \big(\xi, X(x_0)\big)`, with the derivative of the initial values along :math:`X` as -state part (under ``equilibrate``, of the resting state of each regime). Along every regime -flow, :math:`v` stays in :math:`\mathcal{D}` and keeps the observables to first order; at a -visible surface :math:`v` is tangent, so the crossing time stays; at a hidden one the crossing -may move, but the jump lies in :math:`\mathcal{D}` and the observables agree. The rule therefore -never reports a direction that changes the observables, for any sequence of the listed regimes. - -**Lower bound.** The directions of the rule satisfy the rows of copies of the model, whose rank -bounds the rank from below: - -- each regime from the start of each condition, with the events of the condition; -- each regime from a generic point of each visible surface linear in a state, where a direction - of the rule is tangent to the surface; -- each regime from a generic point, when a switch of the condition is not visible; -- each copy switched at a fixed time into every other regime of the condition, with outputs - along *words* of two regimes, :math:`L_{F_\sigma}^a L_{F_{\sigma'}}^b h_{\sigma'}`; -- the switching time :math:`t_j(\theta)` of every visible switch in time alone. - -The *fresh coordinates* are the entry states of the copies that start at surface points. The -kernel of all these rows, projected onto :math:`\theta`, contains every direction of the rule; -a kernel dimension :math:`k_\Delta` gives the lower bound :math:`d - k_\Delta`. A minor that is -nonzero at the sample point modulo a prime is nonzero as a rational function over -:math:`\mathbb{Q}`, so the rank modulo a prime at a point bounds the generic rank from below. -The projection off the fresh coordinates is a difference of two ranks, -:math:`\operatorname{rank} J - \operatorname{rank} J_F` with :math:`J_F` the fresh columns, and can -rise at a special point. It is proven where the fresh columns that enter a row have full column -rank at the sample point: generically :math:`\operatorname{rank} J_F` is then their number, and -:math:`\operatorname{rank} J` at the point bounds the generic one from below. A fresh column -enters no row when the state it starts reaches no observable of the copy. The reach is taken -with the *held* states of the copy at their start values: a set of states whose start values -are free of fresh coordinates and whose right-hand sides vanish identically there, with finite -derivatives, in every regime of the copy. Such states keep their start values, so every Lie -derivative of the copy is one of the fields restricted to that level set. - -Rows of fewer copies keep every direction of the rule in their kernel, so their projection is -an upper bound on the dimension of the rule. The copies without fresh coordinates are taken -first: rows of full rank there prove the full rank, and no other copy is stacked. Otherwise, -where the fresh columns of some start points drop rank at the sample point, the rows of the -other copies give a proven dimension; equal to the dimension of all rows, it proves the -projection. Else the projection is checked with the kernel at a point uniform modulo the -verification prime, and proven there by the same column test. With equal dimension there and -no such proof it is ``verified``, with the chance by :cite:p:`Schwartz1980` that a maximal minor of the -stacked rows or of their fresh columns vanishes there, else a lower bound -(``info["projection"]``, ``info["rank_status"]``). +No :math:`Y_i` moves a fixed symbol, an input or time. Along every regime flow, :math:`v` stays in +:math:`\mathcal{D}` and keeps the observables to first order; at a visible surface :math:`v` is +tangent, so the crossing time stays; at a hidden one the crossing may move, but the jump lies in +:math:`\mathcal{D}` and the observables agree. The rule therefore never reports a direction that +changes the observables, for any sequence of the allowed regimes. + +**Lower bound.** The directions of the rule satisfy the rows of copies of the model: each regime +from the start of each condition, from generic points of the surfaces, and switched at fixed times +into the other regimes, with outputs along *words* :math:`L_{F_\sigma}^a L_{F_{\sigma'}}^b +h_{\sigma'}`. A kernel dimension :math:`k_\Delta` of these rows, projected onto :math:`\theta` off +the *fresh coordinates*, the entry states at surface points, gives the lower bound :math:`d - +k_\Delta`. The projection is proven where the fresh columns have full column rank at the sample +point, ``verified`` with the chance by :cite:p:`Schwartz1980` that a maximal minor vanishes at a +point uniform modulo the verification prime, else a lower bound (``info["projection"]``, +``info["rank_status"]``). **Upper bound.** The candidates are the scalings of :ref:`scalings`, the closed forms of the kernel -of the rows above and the unit direction :math:`\partial_{\theta_i}` of every coordinate; those -failing a condition of the rule are dropped until the family passes. Each identity is tested at -a point with rational coordinates and then proven by symbolic simplification to zero; -:math:`\ell` candidates left, independent at such a point, bound the rank by :math:`d - \ell`. -If :math:`\ell = k_\Delta`, the rank is :math:`d - k_\Delta` and the candidates span the -non-identifiable directions; otherwise :math:`d - k_\Delta` is a lower bound, -``info["switching"]["uncertified"]`` names the rejected candidates, and the unproven kernel -directions, which satisfy only necessary conditions, appear under +and the unit direction of every coordinate; those failing a condition of the rule are dropped until +the family passes, each identity proven by symbolic simplification. :math:`\ell` candidates left, +independent at a point, bound the rank by :math:`d - \ell`. If :math:`\ell = k_\Delta`, the rank is +:math:`d - k_\Delta` and the candidates span the non-identifiable directions; otherwise :math:`d - +k_\Delta` is a lower bound, ``info["switching"]["uncertified"]`` names the rejected candidates, +and the unproven kernel directions appear under ``info["switching"]["candidates"]``, not as symmetries. For an undecided switch the rule accepts tangency or a hidden jump and the rows omit the surface, so both bounds stay valid. -**Unknown inputs.** The input is continuous where a trajectory crosses a surface and analytic -between crossings; the derivatives of the input may jump at a crossing. The input direction -:math:`G_\sigma = \partial_w F_\sigma`, over the inputs that no observable of :math:`\sigma` -reads, joins the bracket condition, +**Unknown inputs.** The input is continuous at a crossing and analytic between crossings. The input +direction :math:`G_\sigma = \partial_w F_\sigma` joins the bracket condition, .. math:: [Y_i, F_\sigma] = \sum_k c_{ik}\, Y_k + a_{i\sigma}\, G_\sigma , -with rational functions :math:`c_{ik}` and :math:`a_{i\sigma}`, and -:math:`v = \sum_i \beta_i Y_i` changes the input in :math:`\sigma` by :math:`-\sum_i \beta_i -a_{i\sigma}`; an input that an observable reads stays unchanged. Where :math:`G_\sigma \in -\mathcal{D}` the change is free. Otherwise it must not jump where a trajectory crosses -:math:`\Gamma_j` from :math:`\sigma` into a neighbor :math:`\sigma'`: on :math:`\Gamma_j`, +and :math:`v = \sum_i \beta_i Y_i` changes the input in :math:`\sigma` by :math:`-\sum_i \beta_i +a_{i\sigma}`. Where :math:`G_\sigma \notin \mathcal{D}`, the change must not jump where a trajectory +crosses :math:`\Gamma_j` into a neighbor :math:`\sigma'`: on :math:`\Gamma_j`, .. math:: @@ -469,36 +290,22 @@ a_{i\sigma}`; an input that an observable reads stays unchanged. Where :math:`G_ - \frac{Y_i(\gamma_j)}{F_\sigma(\gamma_j)} \sum_k e_k\, a_{k\sigma'} = 0 , \qquad F_\sigma - F_{\sigma'} = \sum_k e_k Y_k , -the last term counting only at a hidden surface that :math:`Y_i` moves, whose crossing then -shifts. A switch is visible only through orders :math:`k \le r_i`, with :math:`r_i` the lowest -order at which an input can enter :math:`L^k h_i`, read from the symbols of each order; higher -orders hold input derivatives. The jets of each copy are nuisance coordinates (see -:ref:`inputs`), with a start of their own per copy and, at a surface point, the -input value shared by the two neighbors. A copy from a generic point of each regime replaces the -copy switched at a fixed time, which would restart the input off the surfaces, where the changes -of two regimes differ. The rank status is the weaker of the projections off the jets and off the -fresh coordinates. The rule holds per condition, so each condition needs a separate input, -renamed in ``conditions``. - -**Listed regimes.** With ``regimes``, the rule, the rows and the candidates use the listed -regimes of each condition, and a surface counts only with listed regimes on both sides. -Parameters of other regimes stay coordinates and are reported non-identifiable. A sign of -:math:`\gamma_j(x_0)` decided by the declared signs must agree with the first entry, else an -error is raised; an undecided one is declared by ``regimes`` and listed under ``declared`` in -``info["switching"]["conditions"]`` and in ``info["assumptions"]["starts"]``. - -**Limits.** Each of the following is an error, never a result: - -- a surface in the parameters alone whose side ``regimes`` does not give; -- a condition on a switched expression; -- more than 4096 sign vectors; -- ``gauge``, ``reduce_cq``, ``free_initial``, ``engine="symbolic"``; -- a state named ``time``; -- under ``equilibrate``, a resting state without closed form; -- an infeasible listed regime, or a start that contradicts the initial values; -- with unknown inputs: an input read by several conditions, a switch on an input, an event after - the start, an initial or event value that reads an input. +the last term counting only at a hidden surface that :math:`Y_i` moves. The jets of each copy are +nuisance coordinates (:ref:`inputs`). The rule holds per condition, so each condition needs a +separate input, renamed in ``conditions``. + +**Listed regimes.** With ``regimes``, the rule, the rows and the candidates use the listed regimes +of each condition, and a surface counts only with listed regimes on both sides. Parameters of other +regimes stay coordinates and are reported non-identifiable. A start side not decided by the declared +signs is listed under ``info["assumptions"]["starts"]``. +**Limits.** Each of the following is an error, never a result: a surface in the parameters alone +whose side ``regimes`` does not give; a condition on a switched expression; more than 4096 sign +vectors; ``gauge``, ``reduce_cq``, ``free_initial``, ``engine="symbolic"``; a state named +``time``; under ``equilibrate``, a resting state without closed form; an infeasible listed regime or +a start that contradicts the initial values; with unknown inputs, an input read by several +conditions, a switch on an input, an event after the start, or an initial or event value that reads +an input. .. _petab-mapping: @@ -506,18 +313,15 @@ PEtab problems -------------- :func:`~symident.read_petab` maps a PEtab problem :cite:p:`Schmiester2021` onto these elements. -Each experiment with measurements is one condition; the estimated parameters are the -coordinates, the other parameters take their nominal values. A preequilibration is the resting -start of ``equilibrate`` (:ref:`steady-states`), with the preequilibration condition in place of -the inputs at zero, and the condition of the experiment as events at the start; it has to be part -of every experiment or of none, since all conditions start alike. +Each experiment with measurements is one condition; the estimated parameters are the coordinates, +the other parameters take their nominal values. A preequilibration is the resting start of +``equilibrate`` (:ref:`steady-states`), with the preequilibration condition in place of the inputs +at zero and the condition of the experiment as events at the start; it has to be part of every +experiment or of none. An experiment without preequilibration whose measurements are all at :math:`t = \infty` is a -*readout at rest*. The output of the experiment is the observables at the resting state :math:`x^\ast(\theta)` of -the condition, :math:`h(x^\ast(\theta), \eta(\theta))`, which is the output of the experiment -under the premise that the trajectory from the start of the condition converges to that resting -state. The experiment enters as a resting start under the condition of the experiment, with no -event after it: the trajectory stays at rest, the output is constant, and only the rows of order -zero at the resting state enter, with the tangency rows of :ref:`steady-states`. Readouts at rest and preequilibrated experiments mix; a -readout at rest next to an experiment that starts without preequilibration is read as a -trajectory, with a warning. +*readout at rest*: the output is :math:`h(x^\ast(\theta), \eta(\theta))` at the resting state of the +condition, under the premise that the trajectory converges to that resting state. Only the rows of +order zero at the resting state enter, with the tangency rows of :ref:`steady-states`. A readout at +rest next to an experiment that starts without preequilibration is read as a trajectory, with a +warning. diff --git a/docs/method/global.rst b/docs/method/global.rst index 5430e95..3c4f18d 100644 --- a/docs/method/global.rst +++ b/docs/method/global.rst @@ -23,49 +23,22 @@ The fiber --------- A model with directions is reduced first (:func:`~symident.reduce`); the reduced model is -locally identifiable, so the *fiber* :math:`\Psi_N^{-1}(\Psi_N(\theta^\ast))` is finite. The -fiber at a point :math:`\theta^\ast` is the solution set of the polynomial system that equates the -Taylor coefficients of the observables up to order :math:`N` with their values at -:math:`\theta^\ast`, away from zeros of coordinates and denominators. msolve -:cite:p:`Berthomieu2021` counts the points of the system over the algebraic closure modulo a prime, an upper bound -for the size of the fiber of the model, which more equations can only lower. As in SIAN -:cite:p:`Hong2020`, the derivatives of the states at the start are unknowns of the system, tied by the -Taylor coefficients of :math:`D(x)\,\dot x = N(x)` and :math:`E(x)\, g = M(x)`. Every -observable starts one order above the highest of the orders whose next coefficient adds no rank to -the Jacobian in the coordinates: at a given start, a coefficient that adds no rank can still remove -points. The orders rise together until the count is the same at two successive steps, or equals -the size of the orbit of the proven candidates, one if there are none, which no higher order -changes, since more equations give a fiber within the one before and the orbit stays in it. The -count of a block is the number of distinct values of a random linear form in the coordinates on -the points of the block: msolve gives the reduced Gröbner basis, the standard monomials span the -quotient, and the number of distinct eigenvalues of the multiplication by the form is the degree of -the square-free part of the minimal polynomial of that multiplication. Points that differ only in the derivatives of the states, or that are -multiple, count once. The series of a known input is a number, a variable -that a linear equation fixes to a number is substituted, a derivative that enters one equation -only, there linearly with a numeric coefficient, leaves with that equation, and the rest splits -into blocks without a shared variable, whose fibers multiply. msolve runs over :math:`\mathbb{F}_p` -with the probabilistic sparse linear algebra of msolve. - -*Stages.* A block is counted stage by stage. Let :math:`A` be a set of variables of the block, :math:`P_A` -the equations and factors of the saturation that read only variables in :math:`A`, and :math:`P_R` -the others. A point of the block is a pair :math:`(a, r)` with :math:`P_A(a) = 0` and -:math:`P_R(a, r) = 0`, the factors nonzero, so the points of the block are the disjoint union over -the points :math:`a` of :math:`P_A` of the points of :math:`P_R(a, \cdot)`, and the count of the -block is the sum of the counts of the rest at each :math:`a`. This holds for every :math:`A`; the -block triangular form of the incidence of equations and variables :cite:p:`Dulmage1958` only proposes one: -a maximum matching of equations to variables, the graph in which a variable points to the variables -the matched equation of the variable reads, and as :math:`A` the smallest proper set closed under this graph that -holds a strongly connected part of more than one variable, so that the equations in :math:`P_A` -match every variable of :math:`A`. The block is first counted at once under an eighth of ``msolve_entries``, -since the rest after a stage is often small. Then msolve gives the rational parametrization of -:math:`P_A`; where every distinct root of the eliminating polynomial lies in -:math:`\mathbb{F}_p` (in :math:`\mathbb{Q}` for the count over :math:`\mathbb{Q}`, at most 16 -roots), each point is substituted, the fixings above run again, and the rest is counted by stages; -otherwise the block is counted at once. Over :math:`\mathbb{Q}` the stage is first -solved modulo a prime and skipped where a point lies outside :math:`\mathbb{F}_p`, since rational -points reduce to points in :math:`\mathbb{F}_p` for a prime that divides no denominator; the choice -of the route never changes the count. Points :math:`a` that differ only in the derivatives of the states count apart, so -the sum is never below the number of points with distinct coordinates. +locally identifiable, so the *fiber* :math:`\Psi_N^{-1}(\Psi_N(\theta^\ast))` is finite. It is +the solution set of the polynomial system that equates the Taylor coefficients of the +observables up to order :math:`N` with their values at :math:`\theta^\ast`, away from zeros of +coordinates and denominators. As in SIAN :cite:p:`Hong2020`, the derivatives of the states at the +start are unknowns of the system, tied by the Taylor coefficients of :math:`D(x)\,\dot x = N(x)` +and :math:`E(x)\, g = M(x)`. msolve :cite:p:`Berthomieu2021` counts the points over the algebraic +closure of :math:`\mathbb{F}_p`; the count is the number of distinct values of a random linear form +in the coordinates, so points that differ only in the derivatives of the states, or that are +multiple, count once. It bounds the size of the fiber of the model, and more equations can only +lower it. The orders rise until the count is the same at two successive steps or equals the orbit +of the proven maps, which no higher order changes. + +The system splits into blocks without a shared variable, whose counts multiply. A block may be +counted in *stages*: with :math:`P_A` the equations that read only the variables :math:`A`, the count +is the sum over the points of :math:`P_A` of the counts of the rest. This holds for every +:math:`A`; the block triangular form of :cite:p:`Dulmage1958` proposes one. .. _fiber-features: @@ -74,60 +47,35 @@ Conditions, events, resting states and switches The conditions are stacked as in the local analysis: each has separate derivatives, the coordinates are shared. After an event the gaps are :math:`\varepsilon\, \Delta t_i^0` as in -:ref:`conditions-events`: the state at the end of a gap is the series of the segment before -evaluated at :math:`\varepsilon\, \Delta t_i^0`, the event maps it to the start of the next -segment, and every coefficient after the event is a power series in :math:`\varepsilon`, kept up -to the *gap order*, which rises with the order. A segment whose start holds coordinates, an event -at an estimated time, is expanded at the start of the condition on the flow continued backward, -so that the coefficients of the segment depend on the time of the event. Under ``equilibrate`` the start of a -condition is the solution of the balances over :math:`\mathbb{Q}(\theta)`, exponentials of the coordinates -included, with the inputs at zero, -the states that are coordinates at their free resting value and the states without dynamics at -their initial value; where the balances have more than one rational solution, the one with the -most states away from zero, and none without one rational solution. States that no observable -depends on are left out. With switches, as in :ref:`switching`, each condition enters from the -start in the regime of the start, decided at a random point, and each allowed regime as a copy -whose start is free on a switching surface :math:`\gamma_j = 0` to an allowed neighbor: at the point -the surface is solved for a state in which it is linear, and in the fiber -:math:`\gamma_j(z', \theta') = 0` is an equation; the clock and the jets of known inputs of a copy -start at known values. A map is ``exact`` with a map of the states in every regime that takes each -surface to itself, :math:`\gamma_j(\varphi(x), \sigma(\theta)) = c\, \gamma_j(x, \theta)` with -:math:`c` free of the states and positive on :math:`\Theta`. A switch on the parameters alone puts -the model in one regime and is not handled. A map reconstructed from the fiber is -checked on the coefficients four orders further up, in :math:`t` and in :math:`\varepsilon`; a -map that fails shows a fiber too large at that order, and the orders rise. +:ref:`conditions-events`, and every coefficient after the event is a power series in +:math:`\varepsilon`, kept up to the gap order. Under ``equilibrate`` the start of a condition is +the rational solution of the balances over :math:`\mathbb{Q}(\theta)`, and none without one. With +switches (:ref:`switching`), each allowed regime enters as a copy whose start is free on a +switching surface :math:`\gamma_j = 0`, an equation of the fiber. A map is ``exact`` with a map of +the states in every regime that takes each surface to itself, :math:`\gamma_j(\varphi(x), +\sigma(\theta)) = c\, \gamma_j(x, \theta)` with :math:`c` free of the states and positive on +:math:`\Theta`. A switch on the parameters alone is not handled. A map reconstructed from the fiber +is checked on coefficients of higher order; a map that fails shows a fiber too large at that +order, and the orders rise. .. _rational-form: Rational form of the fiber -------------------------- -The fiber needs a model rational in the states and coordinates. Three rewrites before the count -keep the fiber. A coordinate :math:`\theta` that enters only through :math:`b^{c\theta}`, with -rational :math:`c`, is read as :math:`X = b^{\theta/L}`, :math:`L` the common denominator of the -exponents, a bijection of :math:`\mathbb{R}` onto the positive reals; a map is reported back as -:math:`\theta' = L \log_b \sigma(X)`, so a swap stays a swap and a discrete scaling becomes a -translation. An observable :math:`h` for which :math:`e^{c h}` is rational, :math:`c \in \{1, -\log 10, \log 2\}`, is replaced by :math:`e^{c h}`, one of the form :math:`e^{r}` by :math:`r`, -and an odd power :math:`r^{p/q}` by :math:`r`: these maps are injective where the observable is -real, so two values of the coordinates have the same output before the rewrite if and only if -they have it after. A factor :math:`e^{a t}`, with :math:`a` free of the states and the clock, -becomes a state :math:`E` with :math:`\dot E = a E` and :math:`E(0) = 1`, whose unique solution it -is; this needs conditions that start at :math:`t = 0`. A coordinate :math:`\theta` that -enters only through :math:`e^{c/\theta}`, with rational :math:`c`, is read as :math:`X = e^{a/\theta}`, :math:`a` -the positive rational greatest common divisor of these :math:`c`, so that :math:`X` enters with integer powers; -:math:`\theta \mapsto X` is a bijection of the positive reals onto :math:`(1, \infty)` and of the negative reals -onto :math:`(0, 1)`, and a map is reported back as :math:`\theta' = a / \log \sigma(X)`. The counts in the domain -take :math:`X > 0`, which holds :math:`\theta` real but not positive. A state without dynamics that starts at a -number and that every event sets to a number, such as a clamped input, is that number within each segment, and is -substituted there where a non-rational term reads it. ``info["discrete"]["rewrites"]`` lists the rewrites, and a -term that stays non-rational is named in the error. - -**Non-rational terms.** A term :math:`\varphi(\psi)` of the states that these rewrites -leave, :math:`\varphi` an exponential, a logarithm or a power :math:`b^\mu` with a non-integer -exponent and :math:`\psi` rational, becomes :math:`W \nu` (:math:`W + \nu` for the logarithm), -innermost first, with a new state :math:`\nu` and a new coordinate :math:`W = \varphi(\psi_0)`, -:math:`\psi_0` the value at the start: +The fiber needs a model rational in the states and coordinates. Rewrites that are bijective on +the real values in question keep the fiber: a coordinate that enters only through :math:`b^{c\theta}` +or :math:`e^{c/\theta}` with rational :math:`c` is replaced by that power, an observable +:math:`h` with rational :math:`e^{c h}` by :math:`e^{c h}`, an odd power :math:`r^{p/q}` by +:math:`r`, a factor :math:`e^{a t}` by a state :math:`E` with :math:`\dot E = a E`, :math:`E(0) = +1`, and a positive state read only through :math:`\log x` and powers by :math:`L = \log x`. Maps +are reported in the original coordinates. ``info["discrete"]["rewrites"]`` lists the rewrites. + +**Relaxed model.** A term :math:`\varphi(\psi)` of the states that remains, :math:`\varphi` an +exponential, a logarithm or a power :math:`b^\mu` with non-integer exponent and :math:`\psi` +rational, becomes :math:`W \nu` (:math:`W + \nu` for the logarithm), innermost first, with a new +state :math:`\nu` and a new coordinate :math:`W = \varphi(\psi_0)`, :math:`\psi_0` the value at the +start: .. math:: @@ -135,174 +83,88 @@ innermost first, with a new state :math:`\nu` and a new coordinate :math:`W = \v \dot\nu = \nu\, \dot\psi,\ \ \mu\, \nu\, \frac{\dot b}{b},\ \ \frac{\dot\psi}{\psi}, \qquad \nu(0) = 1,\ 1,\ 0 . -A term of the coordinates alone becomes a new coordinate :math:`P`, the :math:`W` of a term with the -same start or an integer power of it, and a coordinate that no -equation reads afterwards is dropped where one :math:`P` determines it on the positive reals -(:math:`b^\mu` or :math:`\log b` with :math:`b = c\, \theta^{\pm 1}`, or :math:`e^{a \theta^{\pm 1} + d}`, -with :math:`c, \mu, a, d` free of :math:`\theta`). A positive state :math:`x` that the model reads only through -:math:`\log x`, through the factor :math:`x` of :math:`\dot x = x R` and through observables :math:`x^k` with an -integer :math:`k \neq 0` is replaced first by :math:`L = \log x`, with :math:`\dot L = R`, the observable -:math:`k L` and the start :math:`P = \log x_0`. This keeps the fiber: :math:`x = e^L` is the unique positive -solution, :math:`x^k \mapsto k \log x` is injective on the positive reals, and :math:`x_0 \mapsto P` is a -bijection onto the reals, so :math:`x_0` is dropped and no relation between a :math:`W` and :math:`x_0` is lost. A term with a known input or the clock, and a root or rational -power, whose start is algebraic, are not rewritten. The *relaxed model* is rational in -:math:`\tilde\theta = (\theta, W, P)`, and the output of the model is the relaxed output on the graph -:math:`\Gamma` of :math:`\theta \mapsto \omega(\theta)`, the starts of the new coordinates. -``discrete()`` counts the relaxed model modulo the continuous directions, as above, and -``info["discrete"]["relaxed"]`` lists the terms, the starts and the dropped coordinates. +A term of the coordinates alone becomes a new coordinate :math:`P`, and a coordinate that no +equation reads afterwards is dropped where one :math:`P` determines it on the positive reals. The +*relaxed model* is rational in :math:`\tilde\theta = (\theta, W, P)`, and the output of the model +is the relaxed output on the graph :math:`\Gamma` of :math:`\theta \mapsto \omega(\theta)`, the +starts of the new coordinates. ``info["discrete"]["relaxed"]`` lists the terms, the starts and the +dropped coordinates. *Proposition.* Suppose (a) every direction of the relaxed model that moves a :math:`W` is exact, a scaling or a shift of the :math:`W` it moves by constants, and moves no coordinate read by a start :math:`\omega`, with an invertible matrix of the weights and shifts on the :math:`W` these -directions move, (b) no direction moves a coordinate read by the start -of a :math:`W` that no scaling moves, and (c) these starts are algebraically independent over -:math:`\mathbb{Q}(\theta)`. Then at a generic point the fiber of the model has at most :math:`k` -connected components, :math:`k` the count of the relaxed model modulo the continuous directions, and exactly -:math:`k` where :math:`k = 1` or where the exact maps of the relaxed model that fix every -:math:`W` and every coordinate read by a start have an orbit of :math:`k` points. - -*Proof.* By (a) these directions reach every value of the :math:`W` they move from any point (every -positive value for a scaling), -and by (c) the image of :math:`\theta \mapsto (\theta, \omega(\theta))` on the other :math:`W` is -Zariski dense, so a generic :math:`\theta` lies on a generic orbit of the relaxed model. A point -:math:`\theta'` of the fiber of the model gives the point :math:`(\theta', \omega(\theta'))` of -the relaxed fiber. On an orbit :math:`O` of the relaxed fiber, the :math:`W` that no scaling -moves and, by (b), the coordinates their starts read are constant, so either no point of -:math:`O` or every point after one group element meets these starts; the element :math:`s(q)` of -the directions of (a) that brings :math:`q \in O` to the starts of the moved :math:`W` is unique -and continuous in :math:`q` by (a), since these directions fix what the starts read. So :math:`O \cap \Gamma` is -empty or the image of the connected :math:`O` under :math:`q \mapsto s(q)\, q`, and the fiber of -the model is the union of at most :math:`k` connected sets. A map that fixes the :math:`W` and -what the starts read takes :math:`\Gamma` to itself, so an orbit of :math:`k` points meets +directions move, (b) no direction moves a coordinate read by the start of a :math:`W` that no +scaling moves, and (c) these starts are algebraically independent over :math:`\mathbb{Q}(\theta)`. +Then at a generic point the fiber of the model has at most :math:`k` connected components, +:math:`k` the count of the relaxed model modulo the continuous directions, and exactly :math:`k` +where :math:`k = 1` or where the exact maps of the relaxed model that fix every :math:`W` and every +coordinate read by a start have an orbit of :math:`k` points. + +*Proof.* By (c) a generic :math:`\theta` lies on a generic orbit of the relaxed model, and a point +:math:`\theta'` of the fiber gives the point :math:`(\theta', \omega(\theta'))` of the relaxed +fiber. On a relaxed orbit :math:`O`, the :math:`W` that no scaling moves and, by (b), what their +starts read are constant; by (a) a unique group element :math:`s(q)`, continuous in :math:`q`, +brings :math:`q \in O` to the starts of the moved :math:`W`. So :math:`O \cap \Gamma` is empty or +the connected image of :math:`O` under :math:`q \mapsto s(q)\, q`. A map that fixes the :math:`W` +and what the starts read takes :math:`\Gamma` to itself, so an orbit of :math:`k` points meets :math:`k` relaxed orbits on :math:`\Gamma`. :math:`\square` For exponentials alone, (c) holds where the Jacobian of the exponents :math:`\psi_0` in the -coordinates has full rank at a random point: an integer combination of the :math:`\psi_0` that -is constant has a zero differential, and the lemma of Kolchin and Ostrowski in :ref:`non-rational` -gives the independence. For logarithms alone the same holds with :math:`\mathrm{d} \log -\psi_0`: a combination :math:`\sum_i c_i \log \psi_{0,i}` that is rational has a differential with -simple poles only, so it is constant. Otherwise (c) is a premise, named in +coordinates has full rank, by the lemma of Kolchin and Ostrowski in :ref:`non-rational`, and for +logarithms alone likewise with :math:`\mathrm{d} \log \psi_0`. Otherwise (c) is a premise, named in ``certificate["premise"]``, and the certificate is ``axiom``. Where (a) or (b) fails, -``certificate["relaxed_why"]`` names the direction, the count is not reported (``count`` None, -the relaxed count under ``relaxed["count"]``), and the certificate is ``open``. - -**Free powers of a state at 0.** A power :math:`x^{c_0 + c\alpha}` of a state -:math:`x` that starts at the number 0, with integers :math:`c_0 \ge 0`, :math:`c > 0` and a -coordinate :math:`\alpha` declared positive, has no start :math:`\psi_0 \neq 0` to relax. With -:math:`k` and :math:`c_x` as in :ref:`singular-starts`, :math:`x^\alpha = Z N` with :math:`Z = -c_x^\alpha` and the *normalized power* :math:`N = (x/c_x)^\alpha = \tilde S Q`, :math:`\tilde S = -t^{k\alpha}`, a series in :math:`t` and :math:`\tilde S` whose coefficients are polynomials in -:math:`\alpha`, the coefficients of :math:`x` and :math:`1/c_x`. The model with :math:`x^\alpha = 0` -gives the coefficients of :math:`x` of layer 0; :math:`k` is the first order at which the coefficient is -nonzero at a random point, which shows it nonzero as a function, and the coefficients below -:math:`k` are computed over :math:`\mathbb{Q}(\theta)` and vanish identically. - -:math:`Z` leaves the model in one of three ways. (i) It cancels against a factor -:math:`c_x^{-\alpha}`: the model is written in :math:`N`. (ii) The model is invariant under -:math:`Z \mapsto \lambda Z`, :math:`P_i \mapsto \lambda^{q_i} P_i` for the new coordinates -:math:`P_i = b_i^{q_i \alpha}` of the relaxation above: then the output depends on -:math:`Z` and :math:`P_i` only through :math:`\tilde P_i = P_i Z^{-q_i} = (b_i / c_x)^{q_i \alpha}`, -the model is taken on the slice :math:`Z = 1` with :math:`\tilde P_i` in place of :math:`P_i`, and a -:math:`\tilde P_i` determines a dropped coordinate as before where :math:`c_x` is positive on the -domain and free of it. The map from :math:`\theta` to the slice is then a bijection, so this step -needs no premise. (iii) Otherwise :math:`Z` is a new coordinate :math:`W` with the start -:math:`c_x^\alpha`, under the proposition above. :math:`c_x` must be positive on the domain by the -declared signs and free of the known inputs. - -In the prolonged model each state has the coefficients :math:`x_{n,m}` of index :math:`n` and -layer :math:`m`, standing for :math:`t^{n - km + km\alpha}`, and the derivative of index :math:`n` -is :math:`\lambda_{n+1,m}\, x_{n+1,m}`, :math:`\lambda_{n,m} = n - km + km\alpha`. The -coefficients :math:`Q_n` are unknowns with :math:`n\, c_x Q_n = \sum_{j=1}^n (\alpha j + j - n) -x_{k+j} Q_{n-j}`, :math:`Q_0 = 1`, and :math:`N` has :math:`Q_{n-k}` in index :math:`n` and layer -:math:`m+1` for layer :math:`m` of :math:`Q`; :math:`c_x = x_{k,0}` is saturated. Let :math:`v_N = 0` -and :math:`v_i = 1 + \min_j v_j` over the states and :math:`N` that the right-hand side of state -:math:`i` reads, and :math:`v_h = \min_j v_j` over those an observable reads. By induction on the -index, every term of layer :math:`m \ge 1` of state :math:`i` has :math:`n - km \ge v_i` where -the base has :math:`v_x \ge k`, so that every term of :math:`Q` has :math:`n - km \ge 0`; a power -with :math:`v_x < k` enters the dynamics of the base below :math:`t^k` and is refused. Unknowns -exist only for these terms, layer :math:`m` up to :math:`\lfloor N/k \rfloor` at order :math:`N`, -and only up to the index that the outputs read: an observable reads the states at the order of the observable, the -equation of index :math:`n` of a state reads the right-hand side at index :math:`n - 1`, and -:math:`N` reads the base at the same index. The unknowns above are determined by the ones below and -change no count. - -**Lemma.** Let :math:`c_x` have one sign on the domain, and let the coefficient :math:`d = -h_{v_h + k, 1}` of an observable :math:`h` have one sign on the domain. Then every point -:math:`\theta'` of the domain with the output of a generic :math:`\theta` has :math:`\alpha' = \alpha`. - -*Proof.* The expansions converge (:ref:`singular-starts`) and have exponents :math:`e = (n - km) + km -\alpha'`. At :math:`\theta'`, :math:`c_x \neq 0` gives the same :math:`k`; the terms of layer -:math:`m \ge 1` have :math:`n - km \ge v_h`, so for :math:`\alpha' > 0` the least exponent among -them is :math:`e' = v_h + k\alpha'`, attained by :math:`d(\theta') \neq 0` alone. Likewise -:math:`e = v_h + k\alpha` with :math:`d(\theta) \neq 0`, and :math:`e \notin \mathbb{Q}` for -generic :math:`\alpha`. The layers 0 have integer exponents. If :math:`e < e'`, the term -:math:`t^e` has the coefficient :math:`d(\theta) \neq 0` at :math:`\theta` and none at -:math:`\theta'`, as :math:`e` is no integer and lies below :math:`e'`; this contradicts the lemma of -:ref:`singular-starts`. If :math:`e' < e` and :math:`k\alpha'` is no integer, the same holds for -:math:`t^{e'}`. If :math:`k\alpha'` is an integer, every exponent at -:math:`\theta'` is an integer and :math:`t^e` again has no coefficient at :math:`\theta'`. So :math:`e -= e'` and :math:`\alpha' = \alpha`. :math:`\square` - -The coefficients :math:`c_x` and :math:`d` are computed over :math:`\mathbb{Q}(\theta)`, and one -sign means numerator and denominator positive or negative by the declared signs; where this is not -shown the condition is a premise, ``certificate["premise"]``, and a count otherwise ``verified`` is -``axiom``. The fiber then has the equation :math:`\alpha' = \alpha` and the equations of all -layers, and the bound of the verified count takes the degrees of all of them. The maps are -reconstructed and checked as before but have no state maps, since :math:`N` is no rational -function of the states, and the exact count of the field of the outputs is not taken. -``info["discrete"]["start_powers"]`` names per power :math:`k`, :math:`c_x`, the observable, -:math:`d` and the premises. One such power per condition is taken, without events. - -**Resting states inside a term.** Under ``equilibrate`` the start of the relaxed model is a resting -state, and a state :math:`x_H` inside a transcendental term has a resting value that solves a -transcendental balance. Such resting values :math:`R_H` become coordinates of a *resting chart*: the -transcendental terms at rest are leaves :math:`W = \varphi(\psi(R_H, \theta))`, the balances of the other states -are solved one at a time where each is linear in the state it belongs to, and one coordinate :math:`p_h` per state of -:math:`H` that enters the remaining balances linearly is solved from them, with an invertible coefficient matrix -(a nonzero determinant at a random rational point, which proves it nonzero as a function). Coordinates without a -declared sign come first, then those in the fewest balances. The chart +``certificate["relaxed_why"]`` names the direction, the count is not reported, and the certificate +is ``open``. + +**Free powers of a state at 0.** A power :math:`x^{c_0 + c\alpha}` of a state that starts at 0, +with a positive coordinate :math:`\alpha`, has no start to relax. With :math:`k` and :math:`c_x` as +in :ref:`singular-starts`, :math:`x^\alpha = Z N`, :math:`Z = c_x^\alpha` and :math:`N = (x / +c_x)^\alpha` a series in :math:`t` and :math:`t^{k\alpha}` with coefficients polynomial in +:math:`\alpha`. :math:`Z` cancels, is absorbed by a scaling of the new coordinates, or becomes a new +coordinate under the proposition above. + +**Lemma.** Let :math:`c_x` have one sign on the domain, and let :math:`d`, the coefficient of the +term :math:`t^{v_h + k\alpha}`, :math:`v_h` an integer, of least exponent among the terms of an observable :math:`h` that read +:math:`N`, have one sign on the domain. Then every point :math:`\theta'` of the domain with the +output of a generic :math:`\theta` has :math:`\alpha' = \alpha`. + +*Proof.* The expansions converge, and :math:`e = v_h + k\alpha \notin \mathbb{Q}` for generic +:math:`\alpha`. If :math:`e' = v_h + k\alpha' \ne e`, the smaller exponent, or :math:`e` where +:math:`k\alpha'` is an integer, has a nonzero coefficient on one side only, which the independence +of the powers of :math:`t` (:ref:`singular-starts`) excludes. :math:`\square` + +Where one sign is not shown, the condition is a premise and the count is ``axiom``. The fiber then +has the equation :math:`\alpha' = \alpha`, and the exact count is not taken +(``info["discrete"]["start_powers"]``). + +**Resting states inside a term.** Under ``equilibrate`` a resting value inside a transcendental +term solves a transcendental balance. Such resting values :math:`R_H` become coordinates of a +*resting chart*, with the terms at rest as leaves :math:`W` and the other resting states and one +coordinate :math:`p_h` per state of :math:`H` solved from the balances where these are linear: .. math:: (\theta \setminus p,\ R_H) \mapsto \big(\theta,\ x^\ast\big), \qquad - p = p(\theta \setminus p, R_H, W), \quad x^\ast_H = R_H, \quad x^\ast_N = x^\ast_N(\theta, R_H, W), - -is a bijection onto the points :math:`(\theta, x^\ast)` of the resting set where the coefficient matrix and the -coefficients of the solved states do not vanish: :math:`R_H` reads :math:`x^\ast_H` off a point, and the -balances, linear in :math:`x^\ast_N` and :math:`p`, have the given point as their unique solution. The output of -a point of the resting set is the output from the resting state of the point, so the fiber of the model, as a set of points -:math:`(\theta, x^\ast)`, is the fiber in the chart; the chart model, rational up to the leaves :math:`W` and -with the start :math:`(R_H, x^\ast_N)`, is relaxed as above. In the chart the leaves are exponentials of -coordinates, so (c) follows from the rank of their exponents as before. Several resting states with the same -:math:`\theta` are distinct points of the fiber. The declared sign of :math:`p` is no sign of a chart coordinate, -so the counts in the domain do not hold it (``info["limits"]``). An event on a state inside a term, a known input, -a condition grid and a trafo of the states are not handled. A model with directions and a term of the states is -relaxed first; where the relaxed count bounds the fiber (no ``relaxed_why``), the reduction of the model itself is -skipped. - -**Unknown inputs.** An unknown input enters the fiber through the jets at the start, -unknowns that are no coordinates: the chain of :ref:`inputs` with free starts. A -point of the fiber is then a value of the coordinates with some input of the same output, and -points that differ only in the jets count once. An observable of *relative degree* :math:`r` in the -input :math:`w`, the least order whose Lie derivative reads a jet of :math:`w`, has + p = p(\theta \setminus p, R_H, W), \quad x^\ast_H = R_H, \quad x^\ast_N = x^\ast_N(\theta, R_H, W). + +The chart is a bijection onto the points of the resting set where the coefficients do not vanish, +so the fiber in the chart is the fiber of the model; it is relaxed as above, and (c) follows from +the rank of the exponents. The counts in the domain do not hold the declared sign of :math:`p` +(``info["limits"]``). + +**Unknown inputs.** An unknown input enters the fiber through the jets at the start, unknowns that +are no coordinates (:ref:`inputs`); points that differ only in the jets count once. An observable +of *relative degree* :math:`r` in the input :math:`w`, the least order whose Lie derivative reads a +jet of :math:`w`, has .. math:: L^{r + m} h = \partial_w (L^r h)\, w^{(m)} + (\text{terms in } w, \dots, w^{(m - 1)}), \qquad \partial_w L^r h \ne 0, -by induction on :math:`m`, since :math:`L^r h` reads :math:`w` but no derivative of it. So the -Taylor coefficient of order :math:`n` reads exactly the jets up to :math:`n - r`; :math:`r` comes -from symbolic Lie derivatives over :math:`\mathbb{Q}`. At the orders of a count, the jets above the -highest order that an observable reads are zero: no output coefficient up to these orders depends -on them, so the coordinates of the fiber are the same, and the equations of the derivatives of the -states, which read them, keep no free direction. An unknown of the system that is no coordinate -and enters no equation is left out, which keeps the coordinates of every point. The model has one -condition, no events, switches or ``equilibrate``, and the exact count by the field of the -outputs is not taken. A map :math:`\sigma` is ``checked`` where the equations of the fiber four -orders higher, with the coordinates at :math:`\sigma(\theta)`, have a solution modulo a prime at -random points, and ``exact`` where the map of the states fails without the inputs and a map -:math:`\psi(x, \theta, w)` of the input values, solved where linear, satisfies +so the Taylor coefficient of order :math:`n` reads exactly the jets up to :math:`n - r`, and higher +jets are set to zero without changing the coordinates of the fiber. A map :math:`\sigma` is ``exact`` where a map :math:`\psi(x, \theta, w)` of the input +values, with :math:`\varphi` reading no input, satisfies .. math:: @@ -310,37 +172,26 @@ random points, and ``exact`` where the map of the states fails without the input h(\varphi(x), \sigma(\theta), \psi) = h(x, \theta, w), \qquad \varphi(x_0(\theta)) = x_0(\sigma(\theta)) -over :math:`\mathbb{Q}(x, \theta, w)`, :math:`\varphi` reading no input. Then :math:`(\varphi(x(t)), -\psi(x(t), \theta, w(t)))` solves the model at :math:`\sigma(\theta)` with the output of the -solution at :math:`\theta`; ``state_maps`` lists :math:`\psi` under the name of the input. +over :math:`\mathbb{Q}(x, \theta, w)`; then :math:`(\varphi(x(t)), \psi(x(t), \theta, w(t)))` +solves the model at :math:`\sigma(\theta)` with the same output. The model has one condition, no +events, switches or ``equilibrate``. .. _maps: Maps between the points of the fiber ------------------------------------ -Permutations of the coordinates are tested before the count. If :math:`\sigma` permutes the -coordinates and keeps every Taylor coefficient :math:`c`, then :math:`c(\sigma(\theta)) = -c(\theta)` gives :math:`\partial_i c(\theta) = (\partial_{\sigma(i)} c)(\sigma(\theta))`, so -:math:`c` depends on :math:`\theta_i` if and only if it depends on :math:`\theta_{\sigma(i)}`, and -:math:`\sigma` maps each coordinate onto one with the same set of coefficients that depend on it. -These sets come from one evaluation of the Jacobian at a random point modulo a prime. The -transpositions within each class of equal sets, and then the products of two transpositions that -fail alone, are tested on the coefficients up to four orders past the rank criterion at a random -point modulo the prime, and a candidate that passes is proven as below or kept as ``checked``. -The candidates join the maps of the fiber; they need no count, which only decides whether the -maps are complete. - -Where the other points are rational functions :math:`\sigma_j(\theta)`, they are reconstructed -without matching points across samples. For a coordinate :math:`\theta_i`, the characteristic -polynomial :math:`\prod_j (Z - \sigma_{j,i}(\theta))` over the fiber is invariant under -permutations of the points, so the coefficients are rational functions of :math:`\theta`; msolve -gives them modulo a prime from the rational univariate representation, and they are -interpolated as the generators are. A linear factor over :math:`\mathbb{Q}(\theta)` is a rational -:math:`\sigma_{j,i}`. Coordinates with the fewest arguments come first, until their rational -roots separate the points of the fiber; each other coordinate is then interpolated on each -point, labeled by those roots. A map is ``checked`` when the coefficients agree at random -rational points, and ``exact`` with a map :math:`\varphi` of the states such that +*Permutations* of the coordinates are tested first: a permutation that keeps every Taylor +coefficient maps each coordinate onto one with the same set of coefficients that depend on it, which +limits the candidates. + +Where the other points of the fiber are rational functions :math:`\sigma_j(\theta)`, they are +reconstructed without matching points across samples: for a coordinate :math:`\theta_i`, the +polynomial :math:`\prod_j (Z - \sigma_{j,i}(\theta))` is invariant under permutations of the +points, so the coefficients are rational in :math:`\theta`, interpolated from the rational +univariate representation of msolve, and a linear factor over :math:`\mathbb{Q}(\theta)` is a +rational :math:`\sigma_{j,i}`. A map is ``checked`` when the coefficients agree at random rational +points, and ``exact`` with a map :math:`\varphi` of the states such that .. math:: @@ -348,610 +199,281 @@ rational points, and ``exact`` with a map :math:`\varphi` of the states such tha h(\varphi(x), \sigma(\theta)) = h(x, \theta), \qquad \varphi(x_0(\theta)) = x_0(\sigma(\theta)) -over :math:`\mathbb{Q}(x, \theta)`: :math:`\varphi` is :math:`\sigma` on a state whose initial value -is a coordinate, a different one per state, and the identity on the others, with :math:`x \mapsto x^c` for a state -that starts at 1 with :math:`\dot x = x\, R` where :math:`R(\sigma) = c\, R` for a rational -:math:`c`, or, where these fail, the -solution of :math:`h(\varphi(x), \sigma(\theta)) = h(x, \theta)` and the Lie derivatives of these -equations where they are linear in :math:`\varphi`, or :math:`\varphi` affine in the states of the -block that :math:`\sigma` reaches, the states whose right-hand side or start holds a coordinate -that :math:`\sigma` moves, closed under the states that read them, and the identity elsewhere, with -coefficients solved from the identities where they are linear in them. With events, each segment has such a map, and -at each event :math:`\varphi_{\text{after}}(E(x, \theta)) = E(\varphi_{\text{before}}(x), -\sigma(\theta))`, in every condition. The ``exact`` maps generate a group :math:`G`; at a point -outside the fixed sets of the elements of :math:`G` the orbit is :math:`|G|` points of the fiber. When -:math:`|G|` equals the count, the count is final (``count_final``): the exact maps give a lower -bound equal to the upper one. ``info["discrete"]["certificate"]`` lists the state maps, :math:`|G|`, -the count and the prime. ``complete`` is ``"exact"`` where the field fixed by the exact maps lies -in the field of the output coefficients, which proves the fiber to be the orbit (:ref:`exact-count`); else ``"verified"`` where a count over :math:`\mathbb{Q}` at a random integer point -equals the orbit, with the probability ``count_bound`` that the fiber at a generic point has more -points. Otherwise the certificate names the step that is not proven: that the count modulo the -prime at a random point is the count over :math:`\mathbb{C}` at a generic point, an axiom -(``complete: "axiom"``, with ``count_bound_why``). A map with a positivity certificate for each -image coordinate preserves :math:`\Theta`; a map with an image coordinate negative on -:math:`\Theta` never meets it; otherwise the conditions on :math:`\theta` are listed. Where the fiber is -proven to be the orbit and every element of the group either preserves :math:`\Theta` or never meets -it, ``count_domain`` is one plus the number of elements that preserve it, exactly. Ordering the -coordinates and keeping in each orbit the point that is least in the first coordinate a map -moves gives a *fundamental domain*, a set of inequalities such as :math:`k_{01} < k_{12}`. - -The counts in :math:`\Theta` at the sample points end at the work limits of the global analysis, and -where the proven maps account for the count, the points are the orbits. Over :math:`\mathbb{Q}`, -msolve isolates the real points in boxes, refined until each box decides -the sign of every coordinate declared positive; the count in :math:`\Theta` follows at rational -sample points. Where the rational maps of the next paragraph account for every point counted at a -sample point, and the images give the coefficients of the point exactly, the point and the images are the -fiber, and the count needs no isolation. The number of points in :math:`\Theta` is constant only between the hypersurfaces -on which two points meet or a point crosses the boundary of :math:`\Theta`, so the count is -reported per point and never taken as a global verdict. +over :math:`\mathbb{Q}(x, \theta)`, with :math:`\varphi_{\text{after}}(E(x, \theta)) = +E(\varphi_{\text{before}}(x), \sigma(\theta))` at each event. Candidates for :math:`\varphi` are +read from the initial values, from the observables and from affine maps on the states that +:math:`\sigma` reaches; the identities decide. + +The ``exact`` maps generate a group :math:`G`; at a generic point the orbit is :math:`|G|` points +of the fiber. When :math:`|G|` equals the count, the count is final (``count_final``). +``complete`` is ``"exact"`` where the fiber is proven to be the orbit (:ref:`exact-count`), +``"verified"`` where a count over :math:`\mathbb{Q}` equals the orbit with the probability +``count_bound`` of more points, else ``"axiom"``: that the count modulo the prime at a random point +is the count over :math:`\mathbb{C}` at a generic point (``count_bound_why``). + +A map with a positivity certificate for each image coordinate preserves :math:`\Theta`; a map +with an image coordinate negative on :math:`\Theta` never meets it; otherwise the conditions on +:math:`\theta` are listed. Where the fiber is the orbit and every element of :math:`G` either +preserves :math:`\Theta` or never meets it, ``count_domain`` is the exact number of points in +:math:`\Theta`. Keeping in each orbit the point least in the first coordinate a map moves gives a +*fundamental domain*, a set of inequalities such as :math:`k_{01} < k_{12}`. Otherwise msolve +isolates the real points at sample points; the number of points in :math:`\Theta` is constant only +between the hypersurfaces on which two points meet or a point crosses the boundary of +:math:`\Theta`, so it is reported per point and never taken as a global verdict. .. _exact-count: The exact count --------------- -Let :math:`L = \mathbb{Q}(\theta)`, :math:`G` the group of the ``exact`` maps -of :ref:`maps`, acting on :math:`L` by :math:`\sigma(f) = f \circ \sigma`, and -:math:`c` the Taylor coefficients of the observables at the start of the experiments, the first -segment of each condition, with the known inputs at the values drawn for them. Let :math:`T` be -the fiber at a generic point :math:`\theta` for these inputs: the values :math:`\sigma` over -:math:`\overline{L}` with the output of :math:`\theta`. A value with the output of :math:`\theta` -for every input lies in :math:`T`. +Let :math:`L = \mathbb{Q}(\theta)`, :math:`G` the group of the ``exact`` maps acting on :math:`L` +by :math:`\sigma(f) = f \circ \sigma`, and :math:`c` the Taylor coefficients of the observables at +the start of each condition, with the known inputs at the values drawn for them. Let :math:`T` be +the fiber at a generic point :math:`\theta` for these inputs, the values :math:`\sigma` over +:math:`\overline{L}` with the output of :math:`\theta`. *Theorem.* Let :math:`F = \mathbb{Q}(c)` and :math:`\alpha \in L` with :math:`P_\alpha(Z) = -\prod_{\sigma \in G} (Z - \sigma(\alpha)) \in F[Z]` and :math:`L = F(\alpha)`. Then :math:`T` is the orbit of -:math:`\theta` under :math:`G`, of :math:`|G|` points. - -*Proof.* The output is a function of :math:`\theta` whose coefficients generate a field -:math:`\mathbb{Q}(\Psi) \supseteq F`, and :math:`L` is finite over it, since it is finite over -:math:`F`. A point :math:`\sigma \in T` has coordinates algebraically independent over -:math:`\mathbb{Q}` (the output there has transcendence degree :math:`n`), so :math:`\theta \mapsto \sigma` -defines an embedding of :math:`L` into :math:`\overline{L}` over :math:`\mathbb{Q}(\Psi)`, and every -such embedding gives a point of :math:`T`; so :math:`|T| = [L : \mathbb{Q}(\Psi)]` in characteristic -0. The exact maps keep the output, so the orbit of :math:`\theta` lies in :math:`T`. :math:`\alpha` -is a root of :math:`P_\alpha \in F[Z]`, of degree :math:`|G|`, so :math:`|T| = [L : -\mathbb{Q}(\Psi)] \le [L : F] = [F(\alpha) : F] \le |G|`. :math:`\square` - -The test of the theorem has no random step: random points only propose candidates, and each -candidate is checked exactly. Membership in :math:`F` is proven as a tower: a function is in -:math:`F` once it is a rational function of output coefficients and of functions already shown in -:math:`F`, :math:`f = A(w)/B(w)`, by the identity :math:`A(w(\theta))\, \mathrm{den}_f(\theta) = -\mathrm{num}_f(\theta)\, B(w(\theta))` with :math:`B(w(\theta)) \ne 0`, checked as polynomials in -:math:`\theta` over a common denominator. The output coefficients enter as quotients of polynomials in -:math:`\theta` over powers of a shared list of factors, the denominators of the starts of the states and the values of the -denominators of the right-hand sides and observables at the start, from the Taylor recursion of -:math:`D(x)\, x' = N(x)` order by order: a sum takes the largest power of each factor, so that no gcd is -needed and the denominators grow linearly with the order. The candidates :math:`A, B` come from linear algebra -modulo primes at random points, with rising degree, rebuilt over :math:`\mathbb{Q}`. The functions -shown in :math:`F` are: - -- *Coefficients of input-output relations.* Let :math:`\phi_1, \dots, \phi_r` be the monomials of - degree at most :math:`\delta` in the derivatives of each observable up to an order chosen per observable, - which leaves it out where negative, and in the known inputs that the right-hand sides read, with - their derivatives, the configurations taken with the fewest monomials first (for more - than three observables each one alone and all at one order) and those holding one that gave - relations left out, and :math:`M(c)` the - matrix of the Taylor coefficients of :math:`\phi_j` along the trajectory of the first condition, - whose entries are polynomials in output coefficients and the input values. A vector - :math:`\lambda(\theta)` with :math:`\sum_j \lambda_j \phi_j(g, u) = 0` along every trajectory - lies in the kernel of :math:`M(c(\theta))`; this is checked exactly, the derivatives of the - observables as Lie derivatives, a polynomial identity in the states, the inputs and the - coordinates. Where the rank of :math:`M` at one point modulo a prime is :math:`r - s` and - :math:`s` such vectors are proven, each the identity on the same :math:`s` columns, they are the - basis of the kernel over :math:`\mathbb{Q}(\theta)` with that identity, since a nonzero minor at - one point is nonzero over :math:`\mathbb{Q}(\theta)`; the same basis solves the system over - :math:`F`, so the entries of the basis lie in :math:`F` by Cramer's rule. They are interpolated as - rational functions of the parameters from the relations among the :math:`\phi_j` at random states - for random values of the parameters, the other coordinates held at one value, as polynomials of all - entries at once, else over the denominator of one entry; the identity check decides. Rational right-hand sides and observables enter as rational functions of the states. -- *Coefficients of projections.* A *profile* :math:`h` gives per observable :math:`g_r` a number - :math:`h_r` such that the derivatives :math:`g_r^{(k)}`, :math:`k < h_r`, of all observables are - algebraically independent over :math:`L` and the next derivative of each one is algebraic over - them; the rank of their Jacobian in the states at a random point modulo a prime proposes it, in - rounds over the observables and one observable after the other. The *projection* of - :math:`g_i` is a polynomial relation of :math:`g_i^{(h_i)}` with these derivatives and the input - states read, the generator of the ideal of the relations in these variables :cite:p:`Dong2023`. The - monomials :math:`\phi_j` of the projection are the support of the kernel of the values of the monomials at random - states, for one random value of the parameters, modulo a prime: first with rising total degree - and degree in :math:`g_i^{(h_i)}`, at most 1500 monomials, then inside bounds on the Newton - polytope of the projection, at most 10000, then again by degrees, at most 6000: the largest - sets of degrees below a cap that doubles, since one without a relation holds none of the - smaller ones, and where the kernel has more than one vector, the least set with one. The bounds - on the Newton polytope are counts of points. Let :math:`\Phi` be the map from the states to the - base functions (the derivatives and the inputs of the projection), the parameters at their - value, on a slice of the states: those whose columns keep the Jacobian of :math:`\Phi` at rank - :math:`|\Phi| - 1` stay free, the others take random values, so that the image is dense in the - hypersurface :math:`P = 0` of the projection and a generic point of it has the same number - :math:`k` of preimages. For a weight vector :math:`w` of nonnegative integers and random vectors - :math:`c, b`, the points of the slice with :math:`\Phi(x) = c + b\, t^w` lie over the roots of - :math:`P(c + b\, t^w)`, a polynomial in :math:`t` of degree :math:`\max_{m \in \mathrm{supp}\, - P} \langle w, m \rangle`, :math:`k` points over each; with :math:`c = 0` and :math:`t \ne 0` - over the nonzero roots, :math:`\max - \min` of :math:`\langle w, m \rangle` in number. msolve - :cite:p:`Berthomieu2021` counts the solutions of these systems over the algebraic closure of - :math:`\mathrm{GF}(p)`, the denominators of the base functions inverted by a new unknown, and - :math:`k` as the number of solutions of :math:`\Phi(x) = \Phi(x_0)` at a random :math:`x_0`. - The weights are the total degree, each base function alone, the order of each derivative plus - one and the reverse order, and random weights in :math:`\{0, \dots, 3\}` while more than 10000 - monomials meet the bounds. A point modulo a prime that is not generic can make a count too small - and leave a monomial of :math:`P` out; then the kernel has no vector or the identity check below - fails, so the bounds, like the rest of the support, only propose. :cite:p:`Dong2023` computes the - projections by resultants over :math:`\mathbb{Q}(\theta)`, the extraneous factors removed by a - membership test along power series solutions; here the support comes from one kernel at one - value of the parameters, and the coefficients as follows. The coefficients are normalized at the one of - least degree on a random line and interpolated as rational functions of the parameters over one - denominator :math:`D`: a monomial where the restriction to every line parallel to an axis is a - power of the variable, else interpolated from the values :math:`D(\theta) = \ell(1) / \ell(0)` - with :math:`D(\beta) = 1`, :math:`\ell` the denominator of a random combination of the - coefficients on the line :math:`\beta + t (\theta - \beta)`; the numerators :math:`a_j D` by - sparse interpolation :cite:p:`BenOr1988` or in the box of their degrees per parameter, rebuilt over - :math:`\mathbb{Q}` from more primes, at most 32, until two successive reconstructions agree. The projections of - a profile are found first and taken with the fewest monomials first. A derivative is - :math:`N / (Q^a E^b)`, :math:`Q` the product of the distinct denominators of the right-hand sides - and :math:`E` the denominator of the observable, by :math:`L(N / (Q^a E^b)) = (\tilde N Q E - N - (a \tilde Q E + b \tilde E Q)) / (Q^{a + 2} E^{b + 1})` with :math:`L(P) = \tilde P / Q`, so that - the relation :math:`\sum_j a_j \phi_j = 0` is checked as one identity of polynomials in the states - and coordinates, each term over the powers of :math:`Q` and :math:`E` that it lacks, without gcds. - With rank :math:`r - 1` of :math:`M` at one point modulo a prime, :math:`r` the number of - monomials, the coefficients lie in :math:`F` as in the item before. Every step that proposes - (the profile, the monomials, the degrees, the interpolation) can only make the search fail, - never prove a wrong function. -- *Coefficients of relations by elimination.* Where the projections give no proof, the states are - eliminated as in :cite:p:`Hong2020` (StructuralIdentifiability.jl), with python-flint: the equation of an - observable is differentiated along the flow, the derivatives of the states are removed with the - equations of the model, and one state at a time is removed by a resultant over - :math:`\mathbb{Z}[\theta]`, the determinant of the Bezout matrix (the Sylvester matrix where one - degree is one) after the greatest common divisors of the rows and columns. Every polynomial of - this process vanishes along every trajectory: the equations of the model do, and derivatives, - combinations and resultants of such polynomials do. Of the irreducible factors of such a - polynomial and of the divisors taken out, one vanishes along every trajectory: along one - trajectory their product is zero in the domain of power series, so one factor is, and the - coordinates and starts at which a given factor vanishes along the trajectory form a closed subset - of the open set without a pole at the start, so one of these finitely many subsets is all of it. - A factor nonzero at a point of a trajectory at random coordinates modulo a prime is not that one, - so the product of the factors that vanish at three such points vanishes along every trajectory, - without a random step. The relation of an observable at the end is the only one on the support - where the rank of the Taylor coefficients of the monomials along the trajectory is one less than - their number at a point modulo a prime, as for the projections; the coefficients over one of - fewest terms then lie in :math:`F`, and those whose gradients in the parameters raise the rank - at a random point modulo a prime, fewest terms first, with as many more, join the functions - shown. Where a state :math:`x_i` is removed, an equation :math:`A x_i + B` of degree one in it - (one of the two equations, else their first subresultant, a combination of both) whose - coefficient :math:`A` is nonzero at a point of a trajectory gives :math:`x_i(0) = -B / A`, rational - in the output coefficients, the coordinates and the starts of the states removed after it: the - start lies in :math:`F` once these do. The elimination runs in a separate process while the share of - ``search_entries`` for the relations is not spent and ends at ``elimination_terms``. -- the coordinates that :math:`G` fixes and the coefficients of :math:`P_\alpha`, each a rational - function of the functions before it on the same coordinates, then of small systems of them (the - functions shown in :math:`F` whose coordinates not yet shown lie in those of the function and at - most two more, each divided by the largest monomial in the coordinates shown that divides the - numerator and by the denominator where that reads coordinates shown only, again a function in - :math:`F`, with the coordinates shown that they read, in degrees counted apart for both), then of - all of them, then with the output coefficients added lowest order first; the traces :math:`\sum_{\sigma \in G} \sigma(\theta_i)` of the moved - coordinates and sums over :math:`G` of monomials in them join where they are proven. - -:math:`\alpha` is a moved coordinate with :math:`|G|` distinct images, else a combination of two -or three, with the simplest images. :math:`L = F(\alpha)` is shown coordinate by coordinate, each a -member of :math:`F(\alpha)` once shown, in two ways: - -- as a rational function of functions in :math:`F`, of :math:`\alpha` and of the coordinates shown - before, checked as above; -- for the start of a state :math:`x_i`, by a relation :math:`\sum_j \lambda_j \phi_j(g, u) + x_i - \sum_k \mu_k \psi_k(g, u) = 0` along every trajectory, :math:`\psi_k` the monomials of one degree - less, found and checked as the input-output relations, with :math:`\sum_k \mu_k \psi_k` nonzero - also at the start, and with coefficients rational in parameters already shown in - :math:`F(\alpha)`: at the start, :math:`x_i(0) = -\sum_j \lambda_j \phi_j / \sum_k \mu_k \psi_k`, - with :math:`\phi_j, \psi_k` there polynomials in output coefficients and input values. Fixed - starts join :math:`F` the same way. Such a state :math:`x_i(t)` is the same quotient along the - whole trajectory, so the Taylor coefficients of the state lie in :math:`F` as well, and it joins the - observables of the relations that follow. After the relations among at most 40 of these - monomials, the projection of :math:`x_i` gives it: the relation of - :math:`x_i` with the derivatives :math:`g_r^{(k)}`, :math:`k < h_r`, of degree one in - :math:`x_i`, found, interpolated and checked as a projection, with :math:`\sum_k \mu_k \psi_k` - nonzero at the start shown by the value at one point modulo a prime. Where :math:`x_i` is algebraic - of higher degree over these derivatives, the base takes also :math:`g_r^{(h_r)}` of one observable, at a degree - below the degree :math:`d_r` of the projection of :math:`g_r` in it: the monomials of lower degree in :math:`g_r^{(h_r)}` are a - normal form modulo the projection, so no multiple of it enters the kernel. - -The relations are tried in the order: monomials of the item on input-output relations up to 120, -projections, the elimination, then the others up to 300; the relations of a start among the -monomials up to 40 and then up to 300, after the projection of the start. A configuration or a -profile that needs the derivative of one with more than 5000 terms is left out. The search ends at -the work limits ``search_entries``, ``msolve_entries`` and ``elimination_terms``, or where the relations are tried and none is found. Past a -limit the count is reported without the exact certificate, and the certificate names what was not -reached. A call of msolve fails past the address space ``memory`` of ``discrete()``, 8 GiB by -default. -Constants of the model that are no coordinates are known symbols :math:`\kappa`: :math:`\mathbb{Q}` -is replaced by :math:`\mathbb{Q}(\kappa)` throughout, and the theorem holds for generic values of the -constants. ``info["discrete"]["certificate"]["exact"]`` lists the functions with their expressions, -the relations used and :math:`\alpha`, and ``complete: "exact"``. A short count modulo a prime comes first: where it equals the orbit of the proven candidates, or ends without a count, the -exact count is tried with the group of the candidates, and where it holds, neither the full count -nor the reconstruction of the maps runs. A second search, with the group of all exact maps, starts -from the functions the first one proved to lie in :math:`F`. - -Where the search stops before :math:`L = F(\alpha)` is shown, the functions :math:`f_1, \dots, -f_m` it proved to lie in :math:`F` are counted instead of expressed. Every point of :math:`T` has -the values :math:`f_i(\theta)`, so :math:`T` lies in the fiber of :math:`\theta \mapsto (f(\theta), -c_0(\theta), \dots, c_N(\theta))` for any orders :math:`N`, the starts entering through the output -coefficients. The orders are those of the rank criterion with the gradients of the :math:`f_i` in the -basis first, so that the :math:`f_i` stand for the higher coefficients; the route runs only where -they lower the orders. The :math:`f_i` of least degree whose gradients raise the rank, with as many -more, are counted first, then all of them. As in the count, the orders start one above and rise, -at most to those of the rank criterion of the outputs alone, until the count modulo the prime at a -random point is below :math:`2|G|`; then the count over -:math:`\mathbb{Q}` of the next paragraph, with these :math:`f_i` as pins, bounds :math:`|T|`, and -a count :math:`k` with :math:`|G| \le k < 2|G|` gives :math:`|T| = |G|`, since :math:`|G|` divides -:math:`|T|` (*The orbit* in :ref:`several-experiments`). The smaller variety of the bound takes the -:math:`n` rows from the :math:`f_i` and the output coefficients, those of least degree first. -``certificate["pinned"]`` lists the functions counted, the orders, the counts modulo the prime and -over :math:`\mathbb{Q}`, the bound with the bits of the point and the Bezout number, or why the -route gave none. - -*Coefficients of a large projection, verified.* Where the elimination gives no relation for the -observable of a projection with more than 1500 terms, a few coefficients of the projection join the -:math:`f_i` with an error bound. Let -:math:`S` be the support of :math:`r` monomials :math:`\phi_j` in the base functions :math:`b_v = -N_v / \prod_k F_k^{e_{vk}}`, found as above. - -(a) The Taylor coefficients of the :math:`\phi_j` along the trajectory have rank :math:`r - 1` at a -random point modulo a prime, so at most one relation on :math:`S` holds along the trajectory, and if -one exists, the coefficients over one of them lie in :math:`F` by Cramer's rule, as above. +\prod_{\sigma \in G} (Z - \sigma(\alpha)) \in F[Z]` and :math:`L = F(\alpha)`. Then :math:`T` is the +orbit of :math:`\theta` under :math:`G`, of :math:`|G|` points. + +*Proof.* The coefficients of the output generate a field :math:`\mathbb{Q}(\Psi) \supseteq F`. A +point :math:`\sigma \in T` has algebraically independent coordinates, so :math:`\theta \mapsto +\sigma` defines an embedding of :math:`L` over :math:`\mathbb{Q}(\Psi)`, and every such embedding +gives a point of :math:`T`; so :math:`|T| = [L : \mathbb{Q}(\Psi)]`. The orbit lies in :math:`T`, +and :math:`|T| \le [L : F] = [F(\alpha) : F] \le |G|`. :math:`\square` + +The test has no random step: random points only propose candidates, each checked exactly. +Membership in :math:`F` is proven as a tower: :math:`f = A(w)/B(w)` lies in :math:`F` when +:math:`w` are output coefficients or functions already shown in :math:`F`, by the identity +:math:`A(w(\theta))\, \mathrm{den}_f(\theta) = \mathrm{num}_f(\theta)\, B(w(\theta))` with +:math:`B(w(\theta)) \ne 0`, checked as polynomials in :math:`\theta`. The functions shown in +:math:`F` are: + +- *Coefficients of input-output relations.* A vector :math:`\lambda(\theta)` with :math:`\sum_j + \lambda_j \phi_j(g, u) = 0` along every trajectory, :math:`\phi_j` monomials in the derivatives + of the observables and the known inputs, lies in the kernel of the matrix :math:`M(c)` of the + Taylor coefficients of the :math:`\phi_j`. The relation is checked exactly as a polynomial + identity in states, inputs and coordinates. Where the rank of :math:`M` at one point is :math:`r + - s` and :math:`s` such vectors are proven, they are the basis of the kernel over + :math:`\mathbb{Q}(\theta)`, and the entries lie in :math:`F` by Cramer's rule. +- *Coefficients of projections.* The *projection* of an observable :math:`g_i` is the polynomial + relation of :math:`g_i^{(h_i)}` with the algebraically independent derivatives of all observables + below their orders :math:`h_r`, the generator of the ideal of these relations :cite:p:`Dong2023`. + :cite:p:`Dong2023` computes projections by resultants over :math:`\mathbb{Q}(\theta)`; here the + support is proposed by kernels at random points modulo a prime, bounded by counts of points on the + Newton polytope, and the coefficients are interpolated as rational functions, sparse after + :cite:p:`BenOr1988`. Every proposing step can only make the search fail; the identity check + decides, and the coefficients lie in :math:`F` as in the item before. +- *Coefficients of relations by elimination.* The states are eliminated as in + :cite:p:`Hong2020`, one at a time by resultants over :math:`\mathbb{Z}[\theta]`. Every polynomial + of this process vanishes along every trajectory, and of the irreducible factors one does, since + the power series along a trajectory form a domain and the closed sets where a given factor + vanishes cover the parameter space; the product of the factors that vanish at three random + trajectory points therefore vanishes along every trajectory, without a random step. A remaining + equation of degree one in a removed state gives the start of that state in :math:`F`. +- the coordinates that :math:`G` fixes, the coefficients of :math:`P_\alpha` and traces over + :math:`G`, each shown as a rational function of the functions before. + +:math:`\alpha` is a moved coordinate with :math:`|G|` distinct images, or a combination of a few. +:math:`L = F(\alpha)` is shown coordinate by coordinate, each as a rational function of functions in +:math:`F`, of :math:`\alpha` and of the coordinates shown before, the start of a state also by a +relation of degree one in that start along every trajectory. The search ends at the work limits +``search_entries``, ``msolve_entries`` and ``elimination_terms``; past a limit the certificate names +what was not reached. Constants of the model that are no coordinates are known symbols +:math:`\kappa`: :math:`\mathbb{Q}` is replaced by :math:`\mathbb{Q}(\kappa)`, and the theorem holds +for generic values of the constants. ``info["discrete"]["certificate"]["exact"]`` lists the +functions, the relations and :math:`\alpha`. + +**Pinned count.** Where the search stops before :math:`L = F(\alpha)` is shown, the functions +:math:`f_1, \dots, f_m` proven to lie in :math:`F` are counted instead. Every point of :math:`T` +has the values :math:`f_i(\theta)`, so :math:`T` lies in the fiber of :math:`\theta \mapsto +(f(\theta), c_0(\theta), \dots, c_N(\theta))`, at orders lower than those of the outputs alone. +:math:`|G|` divides :math:`|T|` (*The orbit* in :ref:`several-experiments`), so a count :math:`k` +over :math:`\mathbb{Q}` with :math:`|G| \le k < 2|G|` gives :math:`|T| = |G|`, with the bound of +:ref:`verified-count`. ``certificate["pinned"]`` lists the functions, the orders, the counts and +the bound. + +**Coefficients of a large projection, verified.** Where the elimination gives no relation, a few +coefficients of a projection join the :math:`f_i` with an error bound. Let :math:`S` be the support +of :math:`r` monomials :math:`\phi_j`. (a) The Taylor coefficients of the :math:`\phi_j` have rank +:math:`r - 1` at a random point modulo a prime, so at most one relation on :math:`S` holds, with +coefficients in :math:`F`. (b) The relation exists, verified. A trial takes :math:`r + 6` random states and a random :math:`\theta` modulo a prime :math:`q` uniform among the primes from :math:`2^{29}` to the largest -engine prime. Times :math:`\prod_k F_k^{T_k}`, :math:`T_k = \max_j t_{jk}`, :math:`t_{jk} = \sum_v -m_{jv} e_{vk}`, a row of the values of the :math:`\phi_j` becomes the values of the polynomials -:math:`P_j = \prod_v N_v^{m_{jv}} \prod_k F_k^{T_k - t_{jk}}` of degree :math:`d_j`. Without a -relation, the determinant of the first :math:`r` rows is a nonzero polynomial in :math:`\theta` and -the states, of degree at most :math:`D = \sum_j d_j` and with integer coefficients whose content -is at most :math:`H`, :math:`\log_2 H \le \log_2 r! + \sum_j \log_2 \|P_j\|_1`, the norms -bounded by those of the :math:`N_v` and :math:`F_k` cleared to integers. A kernel of the values -makes it vanish at the point. At most :math:`\lceil \log_2 H / 29 \rceil` of the primes divide the -content, and the primes drawn from number at least :math:`N` by :math:`x / \ln x < \pi(x) < 1.25506\, -x / \ln x` :cite:p:`Rosser1962`; a row where a denominator vanishes is drawn again, which conditions on an -event of probability :math:`a \ge 1 - (r + 6) \deg \prod_k F_k / (q - 1)`. So a trial shows a -kernel with probability at most :math:`\varepsilon = D / ((2^{29} - 1)\, a) + \lceil \log_2 H / 29 -\rceil / N` by :cite:p:`Schwartz1980`, and :math:`k = 5` independent trials, each with a kernel of one -vector, with probability at most :math:`\varepsilon^k`. - -(c) The coefficients. Where a coefficient :math:`c_{j_0}` is a monomial in the parameters, the -others over it are Laurent polynomials. Axis lines through a random point, of 24 points at the -start, show such a :math:`j_0`: the quotient of every other entry by it has a power of :math:`t` -as denominator on every line, which gives the range of the exponents of each entry per parameter. -The entries with the fewest exponent vectors in their ranges are interpolated by Ben-Or and Tiwari -:cite:p:`BenOr1988` modulo two primes and rebuilt over :math:`\mathbb{Q}`, those whose gradients raise -the rank first, until the rank of the gradients of all entries found on the lines, then as many -more. At every trial of (b) each of them equals the entry of the kernel over entry :math:`j_0`. A -wrong function :math:`w = M / (L\, \theta^a)` would make :math:`M C_{j_0} - L\, \theta^a C_j`, with -:math:`C` the cofactors of the first :math:`r - 1` rows, a nonzero polynomial that vanishes at the -point, so a trial passes with probability at most :math:`\varepsilon_w`, as :math:`\varepsilon` -with the degree and the height of :math:`w` added, and :math:`k` trials with -:math:`\varepsilon_w^k`. - -These functions join the :math:`f_i` of the count, and where they -are counted, the bound of the count is that over :math:`\mathbb{Q}` plus :math:`\varepsilon^k` and -:math:`\varepsilon_w^k` per function counted. ``certificate["pinned"]["relation"]`` lists the -functions, the monomial :math:`j_0`, the trials, the kernels, :math:`D`, :math:`\log_2 H` and the -probabilities, ``relation_bound`` their sum and ``count_bound_q`` the bound over -:math:`\mathbb{Q}` alone. +engine prime. Without a relation, the determinant of :math:`r` rows of the cleared values +:math:`P_j` is a nonzero polynomial of degree at most :math:`D = \sum_j \deg P_j` with content at +most :math:`H`, :math:`\log_2 H \le \log_2 r! + \sum_j \log_2 \|P_j\|_1`. With :math:`N` the number +of primes in the range, bounded by :math:`x / \ln x < \pi(x) < 1.25506\, x / \ln x` +:cite:p:`Rosser1962`, and :math:`a \ge 1 - (r + 6) \deg \prod_k F_k / (q - 1)` the probability that +no denominator vanishes, a trial shows a kernel with probability at most + +.. math:: + + \varepsilon = \frac{D}{(2^{29} - 1)\, a} + \frac{\lceil \log_2 H / 29 \rceil}{N} + +by :cite:p:`Schwartz1980`, and :math:`k = 5` independent trials with probability at most +:math:`\varepsilon^k`. + +(c) A coefficient :math:`w` interpolated as a Laurent polynomial over a monomial coefficient +:math:`c_{j_0}` passes every trial; a wrong one would make a nonzero cofactor polynomial vanish, so +:math:`k` trials pass with probability at most :math:`\varepsilon_w^k`, :math:`\varepsilon_w` as +:math:`\varepsilon` with the degree and height of :math:`w` added. + +The bound of the count is that over :math:`\mathbb{Q}` (``count_bound_q``) plus +:math:`\varepsilon^k` and :math:`\varepsilon_w^k` per function counted (``relation_bound``). .. _verified-count: The verified count ------------------ -Where the exact count is not found, the count is taken again over -:math:`\mathbb{Q}`, by the rational parametrization of msolve, at an integer point -:math:`\theta^\ast` uniform in :math:`\{1, \dots, 2^b\}^n`. A count :math:`k` there bounds the -fiber: +Where the exact count is not found, the count is taken again over :math:`\mathbb{Q}`, by the +rational parametrization of msolve, at an integer point :math:`\theta^\ast` uniform in +:math:`\{1, \dots, 2^b\}^n`. A count :math:`k` there bounds the fiber: .. math:: :label: eq-count-bound \Pr\big[|T| > k\big] \le \frac{(N_u + 2D)\, D}{2^b}, -with :math:`N_u` the number of unknowns and :math:`D` the Bezout number below; :math:`b \ge 64` -is chosen so that the bound is at most :math:`10^{-6}`, up to :math:`b = 256` -(``count_bits``, ``bezout``). The bound holds for a model without events and switches, with every -start a coordinate, a number, a rational function of the coordinates or a jet of an unknown input -(*Unknown inputs* below), at orders no lower than those of the rank criterion; otherwise, or where the count differs, the count stays under the -axiom of :ref:`certificates` and ``count_bound_why`` names the reason. msolve is taken to be -correct. The count over :math:`\mathbb{Q}` calls msolve per block, plain and, where that fails, with a -separating linear form. Before a count, modulo a prime or over :math:`\mathbb{Q}`, a variable :math:`v` that an -equation :math:`a v + b\, m` sets to a monomial :math:`m` free of :math:`v` is substituted, a -coordinate only for a monomial in coordinates: on the variety :math:`v` is a function of the other -unknowns, so the substitution maps the points one to one onto those of the smaller system, and -points with distinct coordinates keep distinct coordinates. The count, and the bound below, which -is computed for the system before the substitution, do not change. Equations of the fiber with more -than 400000 terms, or with a power, product or sum of series of more terms while they are built, or -with more than 10000 unknowns, are not counted: the count stops at that order, and ``limits`` names -the limit. - -*The system.* The unknowns :math:`u = (x, z, w)` are the coordinates, the derivatives of the -states at the start and the variable of the saturation. The Taylor coefficients :math:`b(\theta)` -of the observables are rational functions; written over one denominator :math:`q(\theta)`, the -equations of the fiber become :math:`F_1, \dots, F_s \in \mathbb{Q}[\theta, u]`: the equations of -the model, the output equations :math:`\sum_l E_l(u)\, q\, b_{k-l} - q M_k(u)` and -:math:`w\, s(u) - 1`, with :math:`s` the product of the coordinates and the denominators at the -start. Their degrees in :math:`\theta` follow from the recursion of the series run on degree -bounds instead of values, a division adding the numerator of the divisor to the denominators. -:math:`V = V(F) \subset \mathbb{A}^{n + N_u}` has degree at most :math:`D = \prod_i \deg F_i`, by -the Bezout inequality :math:`\deg(V \cap W) \le \deg V \deg W` :cite:p:`Heintz1983`. - -*Step 1: the points of T are isolated.* For :math:`\sigma \in T` the point :math:`P_\sigma = -(\theta, \sigma, z(\sigma), 1/s)` lies on :math:`V`. The Jacobian of :math:`F` in :math:`u` has -full column rank there: the equation :math:`\mathrm{den}(x)\, z_0 = \mathrm{num}(x)` of a start -rational in the coordinates has the coefficient :math:`\mathrm{den}(\sigma) \ne 0`, the equation of -the derivative of order :math:`k + 1` of a state has the coefficient :math:`(k + 1) D_i(x_0)`, -nonzero by the saturation, and no derivative of higher order, so the derivatives are local -functions of :math:`x`; then the output equations have the Jacobian :math:`-E_0 \cdot \partial_x -\Psi_N` up to a triangular factor, and the rank criterion gives :math:`\operatorname{rank} -\partial_x \Psi_N = n` at a random point modulo a prime, so at every point whose coordinates are -algebraically independent over :math:`\mathbb{Q}`, as those of :math:`\sigma` are. So -:math:`P_\sigma` is an isolated point of :math:`V` over :math:`K = \mathbb{Q}(\theta)` and lies on -the union :math:`V_0` of the components of :math:`V` of dimension :math:`n` that dominate the -coordinates, which has at most :math:`D` points over :math:`\theta`. - -*Step 2: polynomials of bounded degree.* For each unknown :math:`u_j` the closure of the image of -:math:`V_0` under :math:`(\theta, u) \mapsto (\theta, u_j)` is a hypersurface :math:`V(E_j)`, -:math:`E_j \in \mathbb{Q}[\theta, U]` square-free, of degree at most :math:`D`, since a linear map -does not raise the degree. A linear form :math:`\lambda(x)` with integer coefficients separates the -at most :math:`D` values of :math:`x` on :math:`V_0` over :math:`\theta`; the image under -:math:`(\theta, u) \mapsto (\theta, \lambda(x))` is :math:`V(E_\lambda)`, of degree at most -:math:`D`, square-free in :math:`U` over :math:`K`, so :math:`R_\lambda = -\operatorname{Res}_U(E_\lambda, \partial_U E_\lambda) \in \mathbb{Q}[\theta]` is nonzero, of degree -at most :math:`(2D - 1) D`. - -*Step 3: specialization.* Let :math:`a_j`, :math:`a_\lambda` be the leading coefficients in -:math:`U` and :math:`\Delta = a_\lambda R_\lambda \prod_j a_j`, nonzero of degree at most -:math:`(N_u + 2D) D`; by :cite:p:`Schwartz1980` :math:`\Delta(\theta^\ast) = 0` with probability at most -the right side of :eq:`eq-count-bound`. Suppose :math:`\Delta(\theta^\ast) \ne 0`. The map -:math:`\theta \mapsto \theta^\ast` extends to a place of :math:`\bar K` with residue field -:math:`\bar{\mathbb{Q}}` (Chevalley's extension theorem). Every :math:`u_j` of a point of -:math:`V_0` is a root of :math:`E_j` with a leading coefficient nonzero at :math:`\theta^\ast`, so -finite at the place, and the point maps to a solution of :math:`F(\theta^\ast, u) = 0` with -:math:`w` finite, so away from the saturation. The values :math:`\lambda(x)` are the roots of -:math:`E_\lambda`, and with :math:`a_\lambda R_\lambda \ne 0` at :math:`\theta^\ast` they stay -distinct. The series at :math:`\theta^\ast` is the same recursion as over :math:`K`; without a -division by zero, :math:`q(\theta^\ast) \ne 0` and the values are those of :math:`b`, so the system -solved is :math:`F(\theta^\ast, \cdot)` up to nonzero factors. The substitutions of the fixed -variables, the derivatives that leave with their equation and the saturation by one variable per -block keep the values of :math:`x`. The system solved then has at least :math:`|T|` points with -distinct :math:`x`, and the count of msolve, the degree of the rational parametrization, at least -the number of distinct solutions, is at least :math:`|T|`. Counted by stages, each point of a stage is -exact and rational, and the sum over these points of the degrees of the rest is at least the number of -points with distinct :math:`x`, again at least :math:`|T|`. - -*A smaller variety.* The same steps hold for :math:`V' \subset \mathbb{A}^{n} \times -\mathbb{A}^{n + 1}` in :math:`(\theta, x, w)`, cut out by :math:`n` output equations -:math:`\mathrm{num}_i(x)\, \mathrm{den}_i(\theta) - \mathrm{num}_i(\theta)\, \mathrm{den}_i(x)` whose -gradients in :math:`x` are independent at a random point modulo a prime, and by :math:`w\, s'(x) = -1`, :math:`s'` the product of the coordinates, the denominators of the starts and the denominators of -the right-hand sides and observables at the start. A point of :math:`T` is an isolated point of -:math:`V'` over :math:`K`, since these gradients are independent at every point with algebraically -independent coordinates. A point of :math:`T` satisfies every output equation, so the specialization of the point, -with :math:`s' \ne 0` there, gives the derivatives at the start and a solution of the system solved. -With :math:`D' = (1 + \deg s') \prod_i \deg(\mathrm{num}_i\, \mathrm{den}_i)` and :math:`n + 1` -unknowns in place of :math:`D` and :math:`N_u`, the smaller of the two bounds is used. - -*Pins.* A function :math:`f = a/b` that the search of the exact count proves to lie in :math:`F` -takes the same value at every point of :math:`T`: with :math:`f = A(c)/B(c)` and :math:`c(\sigma) = -c(\theta)`, :math:`f(\sigma) = f(\theta)`. The count, the counts at the sample points and the -verified count therefore add the equation :math:`a(x)\, b(\theta) - b(x)\, a(\theta)` per such -function, of degree at most :math:`2 \max(\deg a, \deg b)` in :math:`(\theta, x)`, which only removes -points outside :math:`T`; a coordinate so proven becomes the linear equation :math:`x_i = -\theta_i` and is substituted. Every point of :math:`T` satisfies these equations, so Steps 1 to 3 -hold for :math:`V` with them, and the smaller variety takes the :math:`p` pinned coordinates, each of -degree one, with :math:`n - p` output equations whose gradients are independent modulo the pinned -columns, :math:`D' = (1 + \deg s') \prod_i \deg(\mathrm{num}_i\, \mathrm{den}_i)` over these -:math:`n - p` equations. - -*Unknown inputs.* The jets :math:`v` of the inputs that the output coefficients read (*Unknown -inputs in the count* below) are coordinates of the point, drawn uniform in :math:`\{1, \dots, -2^b\}` with :math:`\theta^\ast`, and :math:`K = \mathbb{Q}(\theta, \hat v)`; the jets above them are -zero in the system and at the point. The unknowns :math:`u` add these jets and the derivatives of -the chains, and :math:`D` takes the degrees in :math:`(\theta, \hat v, u)`, the series run on -degree bounds with the jets of the point as variables. Step 1 needs the Jacobian of the output -coefficients in :math:`(x, v)` of full column rank :math:`n + q`, :math:`q` the number of jets -read; it is checked at a random point modulo a prime, and a minor that is not zero there is not -zero over :math:`\mathbb{Q}`, so the rank holds at every point with algebraically independent -coordinates. A point :math:`(\sigma, v_\sigma)` with the output of :math:`(\theta, \hat v)` is -one: :math:`(\theta, \hat v)` is an isolated solution of :math:`b(\cdot) = b(\sigma, v_\sigma)`, -so algebraic over :math:`\mathbb{Q}(\sigma, v_\sigma)`, which therefore has transcendence degree -:math:`n + q`. The derivatives of the states and of the chains are local functions of :math:`(x, -v)` as before, the chain equations having the coefficient :math:`k + 1`. Steps 2 and 3 hold as -stated with :math:`\theta` replaced by :math:`(\theta, \hat v)`; the bound of -Equation :eq:`eq-count-bound` keeps the same form, since it does not depend on the number of -coordinates of the point. The smaller variety is not used, since the output equations of that variety are in -:math:`x` alone. +with :math:`N_u` the number of unknowns and :math:`D` the Bezout number below; :math:`b \ge 64` is +chosen so that the bound is at most :math:`10^{-6}` (``count_bits``, ``bezout``). The bound holds +for a model without events and switches, with every start a coordinate, a number, a rational +function of the coordinates or a jet of an unknown input, at orders no lower than those of the +rank criterion; otherwise the count stays under the axiom of :ref:`certificates`, and +``count_bound_why`` names the reason. msolve is taken to be correct. + +*The system.* The unknowns :math:`u` are the coordinates, the derivatives of the states at the +start and the variable :math:`w` of the saturation :math:`w\, s(u) = 1`, :math:`s` the product of +the coordinates and the denominators at the start. Cleared over one denominator, the equations +:math:`F_1, \dots, F_s \in \mathbb{Q}[\theta, u]` define :math:`V` of degree at most :math:`D = +\prod_i \deg F_i` by the Bezout inequality :cite:p:`Heintz1983`. + +*Step 1: the points of T are isolated.* For :math:`\sigma \in T` the Jacobian of :math:`F` in +:math:`u` has full column rank at the point of :math:`\sigma`: the equations of the derivatives are +triangular with nonzero diagonal, and the output equations have the Jacobian :math:`-E_0 \cdot +\partial_x \Psi_N` up to a triangular factor, of rank :math:`n` at every point with algebraically +independent coordinates by the rank criterion. So the point lies on the union :math:`V_0` of the +components of :math:`V` that dominate the coordinates, at most :math:`D` points over +:math:`\theta`. + +*Step 2: polynomials of bounded degree.* The image of :math:`V_0` under :math:`(\theta, u) \mapsto +(\theta, u_j)` is a hypersurface :math:`V(E_j)` of degree at most :math:`D`, and so is that under a +separating linear form :math:`\lambda(x)`, square-free over :math:`\mathbb{Q}(\theta)`, with +discriminant :math:`R_\lambda \in \mathbb{Q}[\theta]` nonzero of degree at most :math:`(2D - 1) D`. + +*Step 3: specialization.* Let :math:`\Delta = a_\lambda R_\lambda \prod_j a_j` with the leading +coefficients :math:`a`, nonzero of degree at most :math:`(N_u + 2D) D`; by :cite:p:`Schwartz1980` +:math:`\Delta(\theta^\ast) = 0` with probability at most the right side of :eq:`eq-count-bound`. +Otherwise, by Chevalley's extension theorem, every point of :math:`V_0` specializes to a solution at +:math:`\theta^\ast` away from the saturation, and the values of :math:`\lambda` stay distinct, so +the system solved has at least :math:`|T|` points with distinct :math:`x`, and the count of msolve +is at least :math:`|T|`. A count by stages adds exact counts over rational points and gives the +same bound. + +*A smaller variety.* The same steps hold for the variety in :math:`(\theta, x, w)` cut out by +:math:`n` output equations whose gradients in :math:`x` are independent at a random point and by +the saturation, with :math:`D' = (1 + \deg s') \prod_i \deg(\mathrm{num}_i\, \mathrm{den}_i)` and +:math:`n + 1` unknowns; the smaller of the two bounds is used. + +*Pins.* A function :math:`f = a/b` proven to lie in :math:`F` takes the same value at every point +of :math:`T`, so the equation :math:`a(x)\, b(\theta) - b(x)\, a(\theta)` removes points outside +:math:`T` only, and Steps 1 to 3 hold with it. + +*Unknown inputs.* The jets :math:`v` that the output coefficients read are drawn with +:math:`\theta^\ast`, and :math:`\theta` is replaced by :math:`(\theta, \hat v)`. Step 1 needs the +Jacobian of the output coefficients in :math:`(x, v)` of full column rank, checked at a random +point. Equation :eq:`eq-count-bound` keeps the same form; the smaller variety is not used. .. _several-experiments: Several experiments ------------------- -The fiber of one experiment needs the Taylor coefficients up to an order -near the number of coordinates over the number of observables, and the degrees of the equations grow -with the order. Experiments that share the parameters need lower orders: :math:`K` copies of the -model with the parameters :math:`\theta` shared and starts :math:`x_0^1, \dots, x_0^K` of their own, -each with another draw of the known inputs. Let :math:`T(\theta, x_0)` be the fiber of one -experiment, :math:`T_K` the fiber of the :math:`K` experiments at :math:`(\theta, x_0^1, \dots, -x_0^K)`, and :math:`\pi` the projection onto :math:`(\theta', x_0'^1)`; always :math:`\pi(T_K) -\subseteq T(\theta, x_0^1)`. The route takes a model with one condition and no events, switches or -clock in the equations, every state with a free start: a coordinate that nothing else reads -:cite:p:`OvchinnikovPogudinThompson2023,Ovchinnikov2022`. +The fiber of one experiment needs Taylor coefficients up to an order near the number of +coordinates over the number of observables, and the degrees grow with the order. :math:`K` +experiments that share :math:`\theta` and have starts :math:`x_0^1, \dots, x_0^K` of their own +need lower orders :cite:p:`OvchinnikovPogudinThompson2023,Ovchinnikov2022`. Let :math:`T_K` be the +fiber of the :math:`K` experiments and :math:`\pi` the projection onto :math:`(\theta', +x_0'^1)`; always :math:`\pi(T_K) \subseteq T(\theta, x_0^1)`. The route takes a model with one +condition, no events, switches or clock in the equations, and every start a free coordinate. *Proposition 1.* If :math:`\dot x = f(x, \theta, u)` at a constant input :math:`u` has no nonconstant rational first integral over :math:`\mathbb{Q}(\theta, u)`, then :math:`\pi(T_K) = T(\theta, x_0^1)` at a generic point. -*Proof.* Let :math:`\kappa` be the jets of the known inputs at the start, :math:`\Theta'(\theta, -x_0, \kappa)` the finite set of the :math:`\theta'` of :math:`T(\theta, x_0)`, and :math:`e` the -coefficients of :math:`\prod_{\theta' \in \Theta'} (Z - \lambda(\theta'))` for a linear form -:math:`\lambda`. :math:`T` is cut out by finitely many output equations over :math:`\mathbb{Q}( -\theta, x_0, \kappa)` and is stable under the automorphisms of the algebraic closure over this -field, so :math:`e \in \mathbb{Q}(\theta, x_0, \kappa_0, \dots, \kappa_M)` for some :math:`M`. The -experiment that starts at time :math:`s` from :math:`x(s)`, with the jets :math:`\kappa(s)` of the -inputs there, has the output shifted by :math:`s`, for :math:`\theta` and for every :math:`\theta' -\in \Theta'`; so :math:`\Theta'` is constant along the flow of :math:`X = f \cdot \partial_x + -\sum_j \kappa_{j+1} \partial_{\kappa_j}`, and :math:`X e = 0`. In :math:`X e` only -:math:`\kappa_{M+1} \partial_{\kappa_M} e` reads :math:`\kappa_{M+1}`, so :math:`e` does not read -:math:`\kappa_M`, and down to :math:`\kappa_0`: :math:`f(x, \theta, \kappa_0) \cdot \partial_x e = -0` for every :math:`\kappa_0`, a rational first integral at a constant input, so :math:`e \in -\mathbb{Q}(\theta)`. :math:`\Theta'` therefore does not depend on the starts or the inputs: for -:math:`(\theta', x_0'^1) \in T(\theta, x_0^1)` each experiment :math:`k` has an :math:`x_0'^k` with -:math:`(\theta', x_0'^k) \in T(\theta, x_0^k)`, and these form a point of :math:`T_K` over -:math:`(\theta', x_0'^1)`. :math:`\square` - -*Conservation laws.* Where linear forms :math:`\ell(x) = C(\theta)\, x` in the states, :math:`C` of -rank :math:`c` with entries rational in the parameters, satisfy :math:`C f = 0` identically in the -states and inputs, symident finds a basis of them over :math:`\mathbb{Q}(\theta)` and takes the -premise on the level sets: if the system restricted to :math:`\ell = \gamma` has no nonconstant -rational first integral over :math:`\mathbb{Q}(\theta, \gamma, u)`, every rational first integral -:math:`h` of :math:`f` is a function of :math:`\ell`, since :math:`h` restricted to a generic level set -is constant there. The pairs :math:`(\theta', \ell_{\theta'}(x_0'))` over :math:`T(\theta, x_0)` are -then, as in the proof, functions of :math:`(\theta, \ell_\theta(x_0))` alone, :math:`\ell_{\theta'}` being -constant along the flow at :math:`\theta'`; so the experiments start on the level set of the first: -per law, a pivot state of the reduced echelon form of :math:`C` starts at the value that makes -:math:`\ell(x_0^k) = \ell(x_0^1)`, a rational function of the coordinates, and Proposition 1 holds for the -fiber of these experiments. - -The twisted oscillator :math:`\dot x_1 = (\omega + x_3) x_2`, :math:`\dot x_2 = -\omega x_1`, -:math:`\dot x_3 = 0`, :math:`h = (x_2, x_3)` of :cite:p:`OvchinnikovPogudinThompson2023` (Example 2.7) -shows that the premise is needed: :math:`x_3` is a first integral, one experiment leaves -:math:`\omega` and :math:`-(\omega + x_3)`, and two experiments with different :math:`x_3` leave -:math:`\omega` alone. - -*The premise at one point.* A system :math:`\dot x = F(x)` analytic at an equilibrium :math:`x^\ast` -has at most as many functionally independent rational first integrals near :math:`x^\ast` as the -dimension of the span of :math:`\{k \in \mathbb{Z}^n \setminus 0 : \sum_i k_i \lambda_i = 0\}`, -:math:`\lambda` the eigenvalues of :math:`DF(x^\ast)` :cite:p:`CongLlibreZhang2011` (Theorem 1): none where -the eigenvalues are linearly independent over :math:`\mathbb{Z}`. The parameters (the constant -inputs and known constants among them) where :math:`F`, cleared of denominators, has a nonconstant -rational first integral :math:`A/B` with :math:`\deg A, \deg B \le d` form a closed set :math:`S_d` -defined over :math:`\mathbb{Q}`: :math:`A/B` is one exactly where :math:`A \wedge B \ne 0` and -:math:`B\, L A - A\, L B = 0`, :math:`L` the Lie derivative, a condition linear in :math:`A \wedge -B` and so closed on the Grassmannian of planes of polynomials of degree at most :math:`d`, whose -projection onto the parameters is closed since the Grassmannian is projective. A point -:math:`\theta^\ast`, rational or algebraic, outside every :math:`S_d` puts a generic point outside -every :math:`S_d`: the premise of Proposition 1 holds. - -*The test.* symident takes the constant inputs at random values and the equilibrium first: the -states at random values away from zero, the parameters in products of parameters at random values -until the balances are linear in the others, and those solved over the field :math:`F` of the point -(:math:`\mathbb{Q}`, or :math:`\mathbb{Q}(\alpha)` below), in a random order of the parameters; a -point that forces a parameter to zero is not taken. Where the balances have no such solution, it -draws :math:`\theta^\ast`, solves :math:`f = 0` and :math:`\ell = \gamma^\ast` at random -:math:`\gamma^\ast` with msolve over :math:`\mathbb{Q}`, and takes each Galois orbit of the at most -120 equilibria as a number field :math:`F = \mathbb{Q}[s]/(W)`, :math:`W` monic over -:math:`\mathbb{Z}` of degree at most 12. :math:`J = Df(x^\ast)` over :math:`F` splits into diagonal -blocks, the strongly connected components of the nonzero entries. :math:`CJ = 0` gives :math:`J` the -eigenvalue 0 at least :math:`c` times, and the eigenvalues of :math:`J` on the tangent space of the -level set are the others. With :math:`\chi_j` the characteristic polynomial of block :math:`j` -without the factor :math:`z^{m_j}`, :math:`\sum_j m_j = c`, of degree :math:`n_j`, these eigenvalues -are linearly independent over :math:`\mathbb{Q}` if +*Proof.* The coefficients :math:`e` of :math:`\prod_{\theta'} (Z - \lambda(\theta'))` over the +:math:`\theta'` of :math:`T(\theta, x_0)` are rational in :math:`\theta`, :math:`x_0` and the input +jets :math:`\kappa_0, \dots, \kappa_M`. Starting the experiment later along the trajectory shifts +the output for :math:`\theta` and every :math:`\theta'`, so :math:`X e = 0` for :math:`X = f \cdot +\partial_x + \sum_j \kappa_{j+1} \partial_{\kappa_j}`. Only :math:`\kappa_{M+1} +\partial_{\kappa_M} e` reads :math:`\kappa_{M+1}`, so :math:`e` reads no jet, and :math:`f \cdot +\partial_x e = 0` makes :math:`e` a first integral, hence :math:`e \in \mathbb{Q}(\theta)`. The set +of :math:`\theta'` therefore does not depend on the start, and each :math:`(\theta', x_0'^1)` extends +to a point of :math:`T_K`. :math:`\square` + +The premise is needed: the twisted oscillator of :cite:p:`OvchinnikovPogudinThompson2023` +(Example 2.7) has a first integral and a second point for one experiment only. Under linear +conservation laws :math:`C(\theta) f = 0` the premise is taken on the level sets, and the +experiments start on the level set of the first. + +*The premise at one point.* A system analytic at an equilibrium :math:`x^\ast` has at most as many +functionally independent rational first integrals near :math:`x^\ast` as the dimension of the span +of the integer relations :math:`\sum_i k_i \lambda_i = 0` among the eigenvalues of +:math:`DF(x^\ast)` :cite:p:`CongLlibreZhang2011`. The parameters with a rational first integral of +degree at most :math:`d` form a closed set :math:`S_d` defined over :math:`\mathbb{Q}`, by a +condition linear on a Grassmannian, which is projective. A point outside every :math:`S_d` puts a +generic point outside every :math:`S_d`: the premise holds. + +*The test.* symident draws an equilibrium over a number field :math:`F` and takes :math:`J = +Df(x^\ast)` in diagonal blocks. With :math:`\chi_j` the characteristic polynomial of block +:math:`j` without the eigenvalue 0 of the laws, the eigenvalues on the level set are linearly +independent over :math:`\mathbb{Q}` if (a) the Galois group of each :math:`\chi_j` over :math:`F` acts 2-transitively on the roots, -(b) the splitting fields :math:`L_j` of the blocks with :math:`n_j \ge 2` are pairwise distinct, and +(b) the splitting fields of the blocks of degree at least 2 are pairwise distinct, and (c) the traces :math:`t_j` of the blocks are linearly independent over :math:`\mathbb{Q}`. -*Proof.* The group :math:`G` of the compositum over :math:`F` permutes the eigenvalues, so the -:math:`F`-linear relations among them form a submodule :math:`R` of :math:`\bigoplus_j F^{n_j}`. -:math:`F^{n_j}` is the trivial module plus :math:`V_j`, the vectors of sum zero, which is absolutely -irreducible since the permutation character of a 2-transitive group is the trivial character plus an -irreducible one :cite:p:`Isaacs1976` (Chapter 5); :math:`G` acts on :math:`V_j` faithfully through -:math:`\mathrm{Gal}(L_j/F)`, so by (b) the :math:`V_j` are pairwise non-isomorphic. :math:`R` is the -sum of the intersections of :math:`R` with the isotypic parts. :math:`R \supseteq V_j` would make -two roots of :math:`\chi_j` equal, which is irreducible by (a) and so separable; so :math:`R` lies -in the span of the block sums, and a relation over :math:`\mathbb{Q}` is :math:`\sum_j c_j t_j = 0` -with :math:`c_j \in \mathbb{Q}`, which (c) excludes. :math:`\square` For one block this is a case of -:cite:p:`Girstmair1999`: with the Galois group :math:`S_n`, the only linear relation among the roots is a -vanishing trace. - -(a) and (b) follow from Frobenius elements. At a prime :math:`\mathfrak{p} = (p, s - \tau)` of -degree one, with :math:`W` square-free modulo :math:`p` (so that :math:`\mathbb{Z}[s]` is maximal at -:math:`p`), the entries of :math:`J` integral at :math:`p` and :math:`\chi_j` square-free modulo -:math:`\mathfrak{p}`, the degrees of the irreducible factors of :math:`\chi_j` modulo -:math:`\mathfrak{p}` are the cycle type of a Frobenius element on the roots (Dedekind, -:cite:p:`Neukirch1999`, Chapter I). Reduction commutes with the characteristic polynomial, so it is taken -of :math:`J` modulo :math:`\mathfrak{p}`. The multiplicity of the eigenvalue 0 of a block over -:math:`F` is at most the one modulo :math:`\mathfrak{p}`, and the multiplicities add up to at least -:math:`c`; a prime where those modulo :math:`\mathfrak{p}` add up to :math:`c` gives the -:math:`m_j`. An :math:`n_j`-cycle makes the group transitive, an :math:`(n_j - 1)`-cycle then -2-transitive; a cycle type with one 2-cycle and odd cycles otherwise gives a transposition, and the -group is :math:`S_{n_j}` (``group``). Equal splitting fields would let one Frobenius element act on -both blocks, with the same order: a prime at which the orders differ proves (b). The primes are read -from 10007 on, at most 3000 prime ideals. Rational traces of two blocks are always dependent over -:math:`\mathbb{Q}`, and so are traces that an identity of the balances ties with a factor rational -in the states; where (c) fails with :math:`r` blocks, the point is drawn again in -:math:`\mathbb{Q}(\alpha)`, :math:`\alpha` a root of an irreducible polynomial of degree :math:`r`, -the states of a chosen equilibrium as well. The test refuses, with the reason, where the eigenvalue -0 is more frequent than the laws give (a state without dynamics is a law) or a single trace is 0, -the equilibria form a family, or the primes read do not show the cycles. -``info["discrete"]["experiments"]["first_integrals"]`` holds :math:`\theta^\ast`, :math:`F`, the -equilibrium and per block the primes of the cycles. - -*The count.* For :math:`K = 2, \dots, \min(8, \lceil n_\theta / n_y \rceil + 1)`, :math:`n_\theta` -the coordinates other than the starts and :math:`n_y` the observables, the stacked model gets the -orders of the rank criterion; the :math:`K` with the lowest highest order is taken, the fewest -experiments among equal ones, and the orders rise as in the count of one experiment. The count -modulo :math:`p` is that of the distinct values of a random linear form in :math:`(\theta', x_0'^1)` -on the points of each block (the projection of a product is the product of the projections); a -coordinate outside the projection is substituted as a jet is, a coordinate inside only for a -monomial in the coordinates inside, and a count by stages adds the counts of the rest over the -points of a stage, at least the number of distinct projections. - -*The verified count.* :eq:`eq-count-bound` holds for the :math:`K` experiments as one model, with -the projection: in Step 2, :math:`\lambda` is a linear form in :math:`(\theta', x_0'^1)` that -separates the projections of the at most :math:`D` points of :math:`V_0` over :math:`\mathbb{Q}( -\theta, x_0^1, \dots, x_0^K)`, and in Step 3 the values of :math:`\lambda` stay distinct at the -random point, so the solutions there have at least :math:`|\pi(T_K)|` distinct projections, with -:math:`D` and :math:`N_u` those of the stacked system. Over :math:`\mathbb{Q}` a block of at most 64 -points counts the distinct values of the projected coordinates on the points of the rational -parametrization: with :math:`w` the square-free eliminating polynomial, :math:`\mathbb{Q}[t]/(w)` is -the algebra of functions on the points, and the dimension of the subalgebra the projected -coordinates generate, found by exact linear algebra, is the number of their distinct values; a -larger block counts all points. Either count bounds :math:`|\pi(T_K)|`, and by Proposition 1 it +*Proof.* The :math:`F`-linear relations among the eigenvalues form a module for the Galois group of +the compositum. By (a) each block splits into the trivial module and an absolutely irreducible +:math:`V_j` :cite:p:`Isaacs1976`, pairwise non-isomorphic by (b); :math:`V_j` in the relations would +make two roots equal. So a relation lies in the span of the block sums, :math:`\sum_j c_j t_j = 0`, +which (c) excludes. :math:`\square` For one block this is a case of :cite:p:`Girstmair1999`. + +(a) and (b) follow from Frobenius elements: at a prime of degree one where :math:`\chi_j` is +square-free, the degrees of the factors modulo the prime are the cycle type of a Frobenius element +(Dedekind, :cite:p:`Neukirch1999`). Where the test cannot decide, it refuses with the reason; +``info["discrete"]["experiments"]["first_integrals"]`` holds the point, the equilibrium and the +primes. + +*The count.* Equation :eq:`eq-count-bound` holds for the stacked model with the projection: +:math:`\lambda` in Step 2 separates the projections of the points of :math:`V_0`, so the solutions +at the random point have at least :math:`|\pi(T_K)|` distinct projections, which by Proposition 1 bounds :math:`|T|`. -*The orbit.* The exact maps form a group :math:`G` that acts on :math:`T` without fixed points at a -generic point: an element that fixes a point of :math:`T` fixes a point with algebraically -independent coordinates and is the identity. So :math:`T` is a union of orbits of :math:`|G|` -points, :math:`|G|` divides :math:`|T|`, and a count below :math:`2|G|` proves :math:`|T| = |G|`: -``count_final``, ``complete: "verified"`` with ``count_bound`` where the count over -:math:`\mathbb{Q}` is below :math:`2|G|`, else ``"axiom"``. The certificate lists the route -(``route``: the number of experiments, the orders, the count and the premise) and adds the premise -and the divisibility to ``proven``. ``experiments`` of :meth:`~symident.Symmetries.discrete` takes -the route first, with ``True`` or a number of experiments; by default it runs where a short count of -one experiment finds none, after the exact count and before the full count. Where the count of one experiment fails too, the count of the experiments stands for it -without maps. A fixed start (a known initial value, a start at rest, :math:`\nu(0) = 1` of the -relaxed model, a start fixed by a reduction), events, conditions, switches or the clock in the -equations leave the route out, and ``info["discrete"]["experiments"]["why"]`` names the reason. +*The orbit.* An element of :math:`G` that fixes a point of :math:`T` fixes a point with +algebraically independent coordinates and is the identity. So :math:`T` is a union of orbits of +:math:`|G|` points, :math:`|G|` divides :math:`|T|`, and a count below :math:`2|G|` proves +:math:`|T| = |G|`: ``count_final``, ``complete: "verified"`` with ``count_bound`` where the count +over :math:`\mathbb{Q}` is below :math:`2|G|`, else ``"axiom"``. The certificate adds the premise and the +divisibility to ``proven``; ``experiments`` of :meth:`~symident.Symmetries.discrete` selects the +route. .. _monodromy: Monodromy and certified points ------------------------------ -Where the exact maps have an orbit smaller than the count, or no count exists, points of the fiber -are proposed numerically at a random rational point :math:`\theta^\ast`. The coefficients are -evaluated by the recursion of the series in complex floating point, with gradients in the -coordinates, never expanded. :math:`n` coefficients :math:`c_I` whose gradients are independent at a -random point modulo a prime, lowest order first, form a square system :math:`c_I(x) = w`. The -coordinates range over :math:`\mathbb{C}^n`, which is irreducible, so the monodromy group of -:math:`c_I` acts transitively on the fiber of :math:`c_I` over a value off the branch locus -:cite:p:`Duff2019`: from :math:`x = \theta^\ast` over :math:`w_0 = c_I(\theta^\ast)`, the known points are -tracked along the triangle :math:`w_0 \to w_1 \to w_2 \to w_0`, :math:`w_1, w_2` random complex -vectors, by an Euler predictor and a Newton corrector with step control, and the end points join -the known ones, until five triangles add none or as many points of the fiber as the count are -known. This runs where :math:`c_I` has at most 200 points modulo a prime at a random point, since -the fiber of :math:`c_I` holds the fiber of the model several times over; otherwise, or where it -stops short, the points are the roots of the rational parametrization of msolve over -:math:`\mathbb{Q}` at :math:`\theta^\ast`, taken numerically. A point is kept where every coefficient -up to the order of the count agrees with the one at :math:`\theta^\ast` to a relative -:math:`10^{-7}`. ``info["discrete"]["monodromy"]`` lists the number of points, the source, the -number of points of :math:`c_I` modulo the prime, the boxes below and the maps. +Where the exact maps have an orbit smaller than the count, points of the fiber are proposed +numerically at a random rational point :math:`\theta^\ast`. :math:`n` coefficients :math:`c_I` with +independent gradients form a square system :math:`c_I(x) = w`; :math:`\mathbb{C}^n` is irreducible, +so the monodromy group acts transitively on the fiber of :math:`c_I` over a value off the branch +locus :cite:p:`Duff2019`, and tracking the known points around random loops in :math:`w` finds the +others. A point is kept where every coefficient up to the order of the count agrees +(``info["discrete"]["monodromy"]``). *Proposition* (Krawczyk :cite:p:`Krawczyk1969,Moore1977,Rump2010`). Let :math:`\phi: U \to \mathbb{C}^n` be holomorphic, :math:`X \subset U` a product of closed complex rectangles :math:`X_i` with radii @@ -959,46 +481,19 @@ be holomorphic, :math:`X \subset U` a product of closed complex rectangles :math matrix of rectangles that holds :math:`\partial \phi(\xi)` for every :math:`\xi \in X`. Let :math:`E = I - Y J(X)` and :math:`K = m - Y \phi(m) + E\, (X - m)` in rectangle arithmetic. If :math:`K_i` lies in the interior of :math:`X_i` and :math:`\sum_j |E_{ij}|\, r_j < r_i` for every -:math:`i`, with :math:`|E_{ij}|` the largest modulus on the rectangle, then :math:`\phi` has exactly one -zero in :math:`X`, and :math:`\partial \phi` is invertible there. - -*Proof.* Let :math:`k(x) = x - Y \phi(x)`. For :math:`x, x' \in X` the segment between them lies in -the convex :math:`X`, and :math:`\phi_l(x) - \phi_l(x') = \int_0^1 \partial \phi_l(x' + s(x - x'))\, ds\, -(x - x')`; the integral lies in the closed convex row :math:`J_l(X)`. So :math:`k(x) - k(x') = (I - -Y \bar J)(x - x')` with every row of :math:`\bar J` in :math:`J(X)`, the entries of :math:`I - Y -\bar J` lie in those of :math:`E`, and in the norm :math:`\max_i |v_i| / r_i` the map :math:`k` is -a contraction on :math:`X`. With :math:`x' = m`, :math:`k(x) \in K \subset X`. By Banach's fixed -point theorem :math:`k` has exactly one fixed point :math:`x^\ast` in :math:`X`. The row sums give -:math:`\|I - Y \bar J\| < 1` for every such :math:`\bar J`, so :math:`Y \bar J` and :math:`Y` are -invertible: :math:`Y \phi(x^\ast) = 0` gives :math:`\phi(x^\ast) = 0`, every zero of :math:`\phi` in -:math:`X` is a fixed point of :math:`k`, and :math:`\partial \phi(x^\ast)` is invertible. :math:`\square` - -For a kept point :math:`\hat x`, :math:`\phi = c_{I'} - c_{I'}(\theta^\ast)` with :math:`n` rows -:math:`I'` of the coefficients up to the order of the count, chosen by a QR decomposition with -pivoting of the Jacobian at :math:`\hat x` with rows of unit norm, :math:`m = \hat x`, :math:`Y` a -floating-point inverse of the Jacobian at :math:`\hat x` and radii :math:`10^{-10}` and then -:math:`10^{-7}` times :math:`1 + |\hat x_i|`. :math:`\phi(m)` and :math:`J(X)` are evaluated by the same -recursion in rectangle arithmetic: every operation in IEEE double precision is correctly rounded, so -the result moved by one floating-point number outward encloses the exact one, and the enclosures -hold the exact values for every point of the operands; :math:`\theta^\ast` and the constants enter -as enclosures of the rationals. Boxes with disjoint rectangles in some coordinate hold distinct -zeros, so the boxes kept, pairwise disjoint, prove that many simple zeros of :math:`\phi` -(``certified``). These are zeros of the square system: a point of the fiber needs every -coefficient equal, an identity that no enclosure shows, since an overdetermined system loses the -solutions under any perturbation. The certified boxes are therefore no lower bound of the count; -the lower bound is the orbit of the exact maps. Where the enclosures of the recursion grow past the -radii, the point stays without a box. - -A map is read from a point :math:`\hat x \ne \theta^\ast`: each image coordinate is matched to -:math:`c\, \theta_j^{\pm 1}` or :math:`\theta_i + d` with Gaussian rationals :math:`c, d` of -denominators up to 12 that reproduce :math:`\hat x_i`, and a combination is kept where the -coefficients at two random points and their images agree to a relative :math:`10^{-7}`. Nothing is -concluded from these numbers: a map proposed so is ``exact`` once the identities of :ref:`maps` -hold over :math:`\mathbb{Q}(i)(x, \theta)`, and then joins the group :math:`G`. A map -over :math:`\mathbb{Q}(i)` whose image of a real point is not real never meets :math:`\Theta`. For -such maps the theorem of the exact count holds as stated: the proof uses that the orbit of -:math:`\theta` lies in :math:`T` and has :math:`|G|` points, that :math:`P_\alpha \in F[Z]`, whose -coefficients are checked to lie in :math:`\mathbb{Q}(\theta)`, and that :math:`L = F(\alpha)`. +:math:`i`, then :math:`\phi` has exactly one zero in :math:`X`, and :math:`\partial \phi` is +invertible there. + +*Proof.* :math:`k(x) = x - Y \phi(x)` maps :math:`X` into :math:`K \subset X` by the mean value +theorem and is a contraction in the norm :math:`\max_i |v_i| / r_i`, so it has one fixed point; the +row sums make :math:`Y` invertible, so the fixed points of :math:`k` are the zeros of :math:`\phi`. +:math:`\square` + +The enclosures are evaluated in rectangle arithmetic rounded outward, so disjoint boxes prove that +many simple zeros of the square system (``certified``). A point of the fiber needs every +coefficient equal, an overdetermined identity that no enclosure shows, so the certified boxes are no +lower bound of the count; the lower bound is the orbit of the exact maps. A map read from a point +is ``exact`` only once the identities of :ref:`maps` hold over :math:`\mathbb{Q}(i)(x, \theta)`. .. _certificates: diff --git a/docs/method/local.rst b/docs/method/local.rst index a8f0c6e..bc5b350 100644 --- a/docs/method/local.rst +++ b/docs/method/local.rst @@ -63,13 +63,11 @@ Ranks over finite fields ------------------------ symident evaluates :math:`\mathrm{OIM}_N` exactly over :math:`\mathbb{F}_p` in a compiled -*modular engine*: the Lie derivatives as power series in time truncated at order :math:`N`, -the derivatives with respect to :math:`\theta` as dual numbers, all rows at a point in one pass -:cite:p:`Sedoglavic2002`. A point can only underestimate the generic rank, and a random point does so -with small probability :cite:p:`Schwartz1980,Zippel1979`. The rank of the result is taken at the -base point, as the largest over the four engine primes. Randomness enters through the points -uniform modulo the verification prime: one point that checks the rank of the *saturation*, -i.e., of the order chosen, and the points that check closed forms. +*modular engine*: the Lie derivatives as power series in time truncated at order :math:`N`, the +derivatives with respect to :math:`\theta` as dual numbers :cite:p:`Sedoglavic2002`. A point can +only underestimate the generic rank, and a random point does so with small probability +:cite:p:`Schwartz1980,Zippel1979`. The rank is taken at the base point, as the largest over the +engine primes, and checked at points uniform modulo the verification prime. .. _sufficient-lie-order: @@ -140,49 +138,29 @@ the same matrix, so there one order without change of rank is final at the point itself. **The set** :math:`S`. Without ``equilibrate``, :math:`S` consists of the starts shifted by a -subspace :math:`U` of the states, -:math:`S = \{z_0(\theta) + (b, 0, 0) : \theta \in \Theta,\ b \in U\}`, with :math:`U` the -smallest subspace for which :math:`F` stays in :math:`U \times \{0\} \times \mathbb{R}` on -:math:`S`. It is built from :math:`U = \{0\}` by adding the state part of :math:`F` at a random -point of the current :math:`S` until that part lies in :math:`U`. This covers a start at rest, -a subsystem at rest, states that stay at zero, fixed initial values, and linear relations the -dynamics keeps. Under ``equilibrate`` every start is a resting point, and :math:`S` is the -resting variety of the condition (:ref:`steady-states`), on which :math:`f = 0`; a generic point of it -is a random coordinate value with the resting state solved there (the first of 24 draws with a -root). In both cases the rank at the start is taken at the base point. Where the start does -not reach :math:`\rho_S`, e.g., on the level set of a nonlinear conserved quantity, no order -is proven sufficient. The order then stops after a *plateau*, three orders without change of -rank (``SYMIDENT_LIEPLATEAU``), and the result says that the Lie order is not proven -sufficient. - -**Conditions and events.** The rows of several conditions are stacked, and their row space -stops changing once that of every condition has stopped, so every condition is expanded to -a separate order. An event moves the start of the next segment: a state replaced by a value of -the coordinates is removed from :math:`U`, a value added keeps :math:`U`, and an event that -multiplies a state or reads the states adds that state's direction to :math:`U`. The -proposition extends to the power series of :ref:`conditions-events` and is checked at a -vanishing gap. - -**Random points.** :math:`U` and :math:`\rho_S` are taken at points uniform modulo the -verification prime :math:`p`. They are wrong only where a polynomial vanishes: the state part -of :math:`F` at the step that ends :math:`U`, or a minor of size :math:`\rho_S` of the rows of -an order, both composed with the start. Since the generic ranks rise strictly up to their final -value, orders up to the number of columns plus one reveal a wrong plateau. A point is the first of -the draws without a pole of the starts, up to 8, or on a resting variety the first with a root, up -to 24. The probability of a wrong certificate is bounded in :ref:`order-bound`. - -**Without a stopping rule.** A direction that is an exact symmetry, i.e., a scaling under -which every expression is homogeneous (:ref:`scalings`) or a field with the identities of -:ref:`proofs-over-q`, lies in the kernel at every order, so a rank that together with such -independent directions gives :math:`d` is proven for all orders. ``engine="symbolic"`` computes -the Lie derivatives over the rational functions and confirms the order by an exact rank: -where the rows at the initial values reach the generic rank, a nonvanishing minor makes every -later row a combination of earlier ones. Where no order is proven sufficient, a *saturation -guard* (``verify=True``) takes the rank at the base point again six orders further -(``SYMIDENT_VERIFY_MARGIN``) and the gap order of :ref:`conditions-events` two orders further. -If the rank grows, the detection is repeated from that order, up to three times; if it still -grows, the rank is a lower bound, ``info["verification"]`` says where, and a reduction is -refused. +subspace :math:`U` of the states, :math:`S = \{z_0(\theta) + (b, 0, 0) : \theta \in \Theta,\ b \in +U\}`, with :math:`U` the smallest subspace for which :math:`F` stays in :math:`U \times \{0\} +\times \mathbb{R}` on :math:`S`, built by adding the state part of :math:`F` at random points of +:math:`S`. This covers a start at rest, states that stay at zero, fixed initial values, and linear +relations the dynamics keeps. Under ``equilibrate`` :math:`S` is the resting variety of the +condition (:ref:`steady-states`). In both cases the rank at the start is taken at the base point. +Where the start does not reach :math:`\rho_S`, e.g., on the level set of a nonlinear conserved +quantity, the order stops after a *plateau* of three orders without change of rank +(``SYMIDENT_LIEPLATEAU``), and the result says that the Lie order is not proven sufficient. + +**Conditions and events.** Every condition is expanded to a separate order. An event that replaces +a state by a value of the coordinates removes that state from :math:`U`, an event that multiplies a +state or reads the states adds it, and the proposition extends to the power series of +:ref:`conditions-events`. :math:`U` and :math:`\rho_S` are taken at points uniform modulo the +verification prime; the error is bounded in :ref:`order-bound`. + +**Without a stopping rule.** A direction that is an exact symmetry (:ref:`scalings`, +:ref:`proofs-over-q`) lies in the kernel at every order, so a rank that together with such +independent directions gives :math:`d` is proven for all orders. ``engine="symbolic"`` confirms +the order by an exact rank over the rational functions. Where no order is proven sufficient, a +*saturation guard* (``verify=True``) takes the rank again at higher Lie and gap orders +(``SYMIDENT_VERIFY_MARGIN``) and repeats the detection where it grows; if it still grows, the rank +is a lower bound, ``info["verification"]`` says where, and a reduction is refused. .. _order-bound: @@ -196,15 +174,12 @@ the Schwartz-Zippel lemma :cite:p:`Schwartz1980,Zippel1979`: a nonzero polynomia :math:`A^m`, for a finite subset :math:`A` of the field, with probability at most :math:`D / |A|`. A wrong certificate of the Lie or gap order needs a polynomial to vanish at one of the random -points of :ref:`sufficient-lie-order` or :ref:`conditions-events`: the step that ends the -subspace :math:`U`, or a minor of the rows of an order. The degree of the polynomial is that of the rational system -the modular engine evaluates, with exponentials, free powers and trigonometric functions as -separate states, multiplied by the degree :math:`\deg z_0` of the start, and on a resting variety -by the Bezout number of the balances, Equation :eq:`eq-rest-bound`. The probabilities add up to -``info["order_bound"]``, each multiplied by the number of points drawn until the point was taken, -since the point taken is wrong only if one of them is; ``info["order_draws"]`` is the largest such -number, and the points of the gap order are drawn once. ``info["order_bound_why"]`` names the -reason for a missing bound. +points of :ref:`sufficient-lie-order` or :ref:`conditions-events`. The degree of the polynomial is +that of the rational system the modular engine evaluates, multiplied by the degree :math:`\deg z_0` +of the start, and on a resting variety by the Bezout number of the balances, Equation +:eq:`eq-rest-bound`. The probabilities, each multiplied by the number of points drawn until the +point was taken, add up to ``info["order_bound"]``; ``info["order_bound_why"]`` names the reason +for a missing bound. .. _non-rational: @@ -212,11 +187,9 @@ Non-rational terms ------------------ The modular engine needs rational functions. Elementary functions are therefore recast into -rational form :cite:p:`Savageau1987`, type by type in a fixed order and innermost first within a type; -a nesting across that order, such as :math:`\sin(\exp x)` or :math:`\exp(\arctan x)`, is -refused. A term :math:`\nu = \varphi(\psi)` with :math:`\psi` rational in the states becomes a -new state with right-hand side :math:`\varphi'(\psi)\, \sum_j \partial_{x_j} \psi \, f_j`, -which is rational in :math:`\nu` and :math:`\psi` for +rational form :cite:p:`Savageau1987`, innermost first. A term :math:`\nu = \varphi(\psi)` with +:math:`\psi` rational in the states becomes a new state with right-hand side :math:`\varphi'(\psi)\, +\sum_j \partial_{x_j} \psi \, f_j`, which is rational in :math:`\nu` and :math:`\psi` for .. math:: @@ -225,106 +198,50 @@ which is rational in :math:`\nu` and :math:`\psi` for \arctan(\psi):\ \ \frac{1}{1 + \psi^2}, \qquad \operatorname{artanh}(\psi):\ \ \frac{1}{1 - \psi^2}, -and for :math:`\arcsin`, :math:`\arccos`, :math:`\operatorname{arsinh}` and -:math:`\operatorname{arcosh}` contains a square root, which is recast in turn. Trigonometric -functions go through :math:`\tan(\psi/2)`. A *free power* :math:`b^\mu`, with a parameter -:math:`\mu` as exponent, becomes a state :math:`B = b^\mu` with companion :math:`L_b = \log b`, -so that the field is rational and :math:`\mu` enters through :math:`\partial B / \partial \mu -= B L_b`. - -Under ``equilibrate`` a power :math:`b^\mu` of a positive rational number :math:`b` is -rewritten first: next to a power :math:`c^\mu` of a symbol -:math:`c` with the same exponent, :math:`c` stands for :math:`b c` throughout, -:math:`(b c)^\mu` being a power of one symbol, and the result is mapped back. Otherwise -:math:`b` is a constant with :math:`\log b` taken independent of the other constants, as for -logarithms of numbers in log coordinates (named in ``info["limits"]``). +and for the other inverse functions contains a square root, which is recast in turn. +Trigonometric functions go through :math:`\tan(\psi/2)`. A *free power* :math:`b^\mu`, with a +parameter :math:`\mu` as exponent, becomes a state :math:`B = b^\mu` with companion :math:`L_b = +\log b`, so that :math:`\mu` enters through :math:`\partial B / \partial \mu = B L_b`. A nesting the +recast cannot order, such as :math:`\sin(\exp x)`, is refused. A new state starts at :math:`\varphi(\psi)` of the initial state. Where this depends on the -coordinates, a transcendental :math:`\varphi` becomes a separate input of the modular engine, -a *leaf*, drawn independently of the argument and tied to it by relation rows -:math:`\mathrm{d}\nu = \varphi'(\psi)\, \mathrm{d}\psi`: a transcendental graph lies in no proper -variety, so a random point on it is generic. With several transcendental constants, such as -:math:`e` and :math:`\pi`, this needs their algebraic independence, which follows from -Schanuel's conjecture and is not proven. An algebraic :math:`\varphi`, a root or rational power, -is exact: through :math:`L = \log \psi` when :math:`\psi` is affine in one coordinate, else by -the root modulo the prime at each sample point, over primes in which every root of the model -exists. Logarithms, fractional powers and bases of free powers are real for a positive argument. -The rank and the kernel are taken at generic points, where every argument is nonzero, so the -detection needs no sign. An argument that the declared signs do not make positive on -:math:`\Theta`, also in initial and event values, is named in ``info["limits"]``. An observable -:math:`\kappa \sum_i a_i \log \rho_i + \beta`, with rational :math:`\rho_i` and constants -:math:`\kappa, a_i, \beta`, is strictly monotone in :math:`\prod_i \rho_i^{a_i} e^{\beta/\kappa}` -and is analyzed as that product. - -An event after the start reads the states just before it. There the state propagated across the -gaps is a power series in the gap lengths whose constant term :math:`\bar x` is the state at zero -gaps, the initial state with the earlier events of the condition applied. A transcendental -:math:`\varphi(\psi(x))` in an event value is the leaf :math:`\varphi(\bar\psi)`, -:math:`\bar\psi = \psi(\bar x)`, times or plus a series in :math:`\psi(x) - \bar\psi`, - -.. math:: - - e^{\psi} = e^{\bar\psi}\, e^{\psi - \bar\psi}, \qquad - \log \psi = \log \bar\psi + \log\Bigl(1 + \frac{\psi - \bar\psi}{\bar\psi}\Bigr), \qquad - \psi^\alpha = e^{\alpha \log \psi}, \qquad - \sin \psi = \sin \bar\psi \cos(\psi - \bar\psi) + \cos \bar\psi \sin(\psi - \bar\psi), - -and since :math:`\psi(x) - \bar\psi` has no constant term, each series ends at the truncation -order; :math:`\cos` and :math:`\tan` follow from the addition theorems. An event on a state -moves the new states of the recast with it, :math:`\nu` to -:math:`\varphi` of :math:`\psi` after the event, so a dose added to a state under a free power -moves :math:`B` and :math:`L_b`, and in log coordinates :math:`L = \log x` becomes -:math:`\log(e^{L} + d)`. Under ``equilibrate`` :math:`\bar x` is the resting state, a -coordinate, and an event at the start takes the leaves at it alone. - -**Terms of resting states.** Under ``equilibrate`` a transcendental term -:math:`\varphi(\psi(x, \theta))` of the states is a leaf :math:`W` in the balances as well, the -same leaf as the initial value of the new state :math:`\nu`. The balances are then rational in -the resting states, the coordinates and the leaves, and the relation rows -:math:`\mathrm{d}W = \varphi'(\psi)\, \mathrm{d}\psi` tie each leaf to the state columns and the -coordinates of the joint kernel (:ref:`steady-states`). The leaves are drawn independently of the -resting states, and the resting states are solved from the balances at the drawn values. Let -:math:`M = \{(\theta, x, W) : f(x, \theta, W) = 0,\ W = \varphi(\psi(x, \theta))\}` be the -resting set and :math:`A` the component of the algebraic set :math:`\{f(x, \theta, W) = 0\}` on -which the drawn points lie. Rank and kernel are rational in :math:`(\theta, x, W)`, so their -generic values on :math:`A` are those on :math:`M` when :math:`M` is Zariski dense in :math:`A`. -This holds under two conditions. First, let :math:`H` be the states and :math:`\theta_A` the -coordinates inside the arguments :math:`\psi`. The resting values :math:`x_H` vary independently -of :math:`\theta_A`, i.e., the tangent space of the resting set projects onto the coordinates -:math:`(\theta_A, x_H)`. Then :math:`(\theta_A, x_H)` and further coordinates form a chart of -:math:`M` in which every argument is rational. Second, no nontrivial integer combination of the -arguments is constant, which the recast ensures by one leaf per basis term, as for leaves of -coordinates. The density then follows from a classical lemma, the exponential case of the -Kolchin-Ostrowski theorem :cite:p:`Kolchin1968`, which extends the case of integrals :cite:p:`Ostrowski1946` -to exponentials of integrals: exponentials :math:`e^{\psi_1}, \dots, e^{\psi_n}` of rational -functions :math:`\psi_i \in \mathbb{C}(z)` are algebraically independent over -:math:`\mathbb{C}(z)` if and only if no nontrivial integer combination :math:`\sum_i n_i \psi_i` -is constant. Proof of the direction used: an algebraic relation reads -:math:`\sum_a c_a(z)\, e^{\langle a, \psi \rangle} = 0` with rational :math:`c_a \neq 0` and -distinct integer vectors :math:`a`, whose exponents differ pairwise by nonconstant functions. On -a generic line through the domain this stays so, with one variable :math:`t`. Take a relation -with the fewest terms, divide by the last term and differentiate in :math:`t`. The constant term -drops, and the other terms :math:`r_j e^{h_j}` become :math:`(r_j' + r_j h_j') e^{h_j}`, a -shorter relation, so every :math:`r_j' + r_j h_j' = 0`. Then :math:`e^{h_j}` is a constant over -:math:`r_j`, a rational function, which a nonconstant rational :math:`h_j` excludes. Logarithms -of rational functions no product of integer powers of which is constant, such as distinct -irreducible factors, are algebraically independent in the same way, and a half-angle tangent -:math:`\tan(\psi/2)` is rational in :math:`e^{i\psi}`. Ax's theorem :cite:p:`Ax1971`, a functional form -of Schanuel's conjecture, generalizes the lemma. The image of :math:`M` is therefore dense in -the space of the chart and the leaves, which has the dimension of :math:`A` where the resting -Jacobian is invertible, and :math:`M` is dense in :math:`A`. The first condition is checked at -the base point; where it fails, an ``InputError`` names the states. An example is -:math:`\dot x = k - x e^{x/k}`, whose resting value no coordinate outside the exponent moves. - -A state that enters the balances only through leaves, such as :math:`x` in :math:`\dot x = p - k -\sin x`, leaves the resting Jacobian singular with the leaves drawn. The resting value of such a -state is drawn, and one leaf of the state that enters the balance becomes a resting unknown, -solved from the balance; the points remain points of :math:`A`. -``info["settings"]["rest_leaves"]`` lists the resting states inside transcendental terms with -their leaves, and under ``drawn`` the states whose resting value is drawn. A leaf of a resting -state is one coordinate for all conditions, so conditions with different resting models are -refused for such a state. A root or rational power of an expression in the states in the resting -model has no leaf and is refused. +coordinates, a transcendental :math:`\varphi` becomes a separate input of the engine, a *leaf*, +drawn independently of the argument and tied to it by relation rows :math:`\mathrm{d}\nu = +\varphi'(\psi)\, \mathrm{d}\psi`: a transcendental graph lies in no proper variety, so a random +point on it is generic. With several transcendental constants, such as :math:`e` and :math:`\pi`, +this needs their algebraic independence, which follows from Schanuel's conjecture and is not +proven. An algebraic :math:`\varphi`, a root or rational power, is exact. Rank and kernel are taken +at generic points, where every argument is nonzero, so the detection needs no sign; an argument that +the declared signs do not make positive on :math:`\Theta` is named in ``info["limits"]``. + +**Terms of resting states.** Under ``equilibrate`` a transcendental term :math:`\varphi(\psi(x, +\theta))` is a leaf :math:`W` in the balances as well, tied to states and coordinates by +:math:`\mathrm{d}W = \varphi'(\psi)\, \mathrm{d}\psi`, and the resting states are solved at the drawn +leaves. Let :math:`M = \{(\theta, x, W) : f(x, \theta, W) = 0,\ W = \varphi(\psi(x, \theta))\}` be +the resting set and :math:`A` the component of :math:`\{f(x, \theta, W) = 0\}` on which the drawn +points lie. Rank and kernel are rational, so their generic values on :math:`A` are those on +:math:`M` when :math:`M` is Zariski dense in :math:`A`. This holds when the resting values of the +states inside the arguments vary independently of the coordinates inside them, which gives a chart +of :math:`M` with rational arguments, and no nontrivial integer combination of the arguments is +constant, which the recast ensures. The density then follows from the exponential case of the +Kolchin-Ostrowski theorem :cite:p:`Kolchin1968,Ostrowski1946`: + +**Lemma.** Exponentials :math:`e^{\psi_1}, \dots, e^{\psi_n}` of rational functions :math:`\psi_i +\in \mathbb{C}(z)` are algebraically independent over :math:`\mathbb{C}(z)` if and only if no +nontrivial integer combination :math:`\sum_i n_i \psi_i` is constant. + +*Proof of the direction used.* A relation reads :math:`\sum_a c_a(z)\, e^{\langle a, \psi \rangle} += 0` with rational :math:`c_a \ne 0` and exponents that differ pairwise by nonconstant functions, +also on a generic line. In a relation with the fewest terms, divided by the last term and +differentiated, every :math:`r_j' + r_j h_j' = 0`, so :math:`e^{h_j}` is a constant over a rational +function, which a nonconstant rational :math:`h_j` excludes. :math:`\square` + +Logarithms of rational functions no product of integer powers of which is constant are +algebraically independent in the same way, and :math:`\tan(\psi/2)` is rational in +:math:`e^{i\psi}`; Ax's theorem :cite:p:`Ax1971` generalizes the lemma. The first condition is +checked at the base point; where it fails, an ``InputError`` names the states, as for :math:`\dot x += k - x e^{x/k}`. ``info["settings"]["rest_leaves"]`` lists the resting states inside +transcendental terms. .. _singular-starts: @@ -332,110 +249,70 @@ Singular starts --------------- The Lie series of Equation :eq:`eq-lie-series` needs an output that is analytic at the start. -Two kinds of terms are not, although the output is analytic for :math:`t > t_0`: a quotient -whose numerator and denominator both vanish at the start, such as the fraction of a species in -one compartment when every compartment starts empty, and a free power :math:`x^\alpha` of a state -that starts at 0. In both cases the output has an expansion at :math:`t_0` whose -coefficients are rational in :math:`\theta`, and these coefficients take the place of the Lie -derivatives. In the following, :math:`t_0 = 0`. - -**Quotients at 0/0.** Let the right-hand side be analytic at the start and let the observable -read the states through a quotient :math:`N/D` whose denominator vanishes at :math:`z_0`. The -states are power series in :math:`t`, and so are :math:`N` and :math:`D`. Let :math:`v` be the -smallest order with :math:`D_v(\theta) \not\equiv 0`. Then +Two kinds of terms are not, although the output is analytic for :math:`t > t_0`: a quotient whose +numerator and denominator both vanish at the start, and a free power :math:`x^\alpha` of a state +that starts at 0. In both cases the output has an expansion at :math:`t_0 = 0` whose coefficients +are rational in :math:`\theta`, and these take the place of the Lie derivatives. + +**Quotients at 0/0.** Let the observable read the states through a quotient :math:`N/D` whose +denominator vanishes at :math:`z_0`, and :math:`v` the smallest order with :math:`D_v(\theta) \not +\equiv 0`. Then .. math:: :label: eq-laurent \frac{N}{D} = t^{-v}\, \frac{N}{D_v + D_{v+1} t + \dots}, -a Laurent series whose coefficients are rational in :math:`\theta` where :math:`D_v(\theta) \ne -0`, and a power series when :math:`N` vanishes to order :math:`v` as well. The engine evaluates -every reciprocal outside the right-hand sides whose operand starts at 0 in this form, after the -states, with the dual numbers inside the coefficients: an operand :math:`a = t^{v}(U + M)`, -with :math:`U` a power series of nonzero constant value and :math:`M` the terms below -:math:`t^v`, which lie in the dual part and the monomials of the gap lengths, has the inverse -:math:`t^{-v} U^{-1} \sum_e (-M U^{-1})^e`, a finite sum since :math:`M` is nilpotent. Each -division costs :math:`v` orders, so the states are expanded further until every output is known -to the Lie order. Rows are the gradients of the coefficients of the output, and the -argument of :ref:`oim` holds for them -unchanged, since it uses only that the coefficients determine the output near the start. -The valuation :math:`v` is taken at the base point, where :math:`D_k(\theta) = 0` for -:math:`k < v` holds together with the gradient; a point where a coefficient that is not -identically zero vanishes gives the expansion of that point, whose rank is a lower bound. A pole -of the output itself is refused, and so is a reciprocal of an operand that starts at 0 inside -the right-hand sides. +a Laurent series whose coefficients are rational in :math:`\theta` where :math:`D_v(\theta) \ne 0`. +The rows are the gradients of these coefficients; the argument of :ref:`oim` holds unchanged, since +it uses only that the coefficients determine the output near the start. A pole of the output +itself is refused. The stopping rule of :ref:`sufficient-lie-order` extends to these outputs. Let :math:`u(t) = -\partial_{z_0} g(t)` be the gradient of the output with respect to the start, a Laurent -series, possibly with a pole: away from the start the quotient is defined, and a start moved -off :math:`D = 0` gives a denominator of order 0. - -**Lemma.** Let :math:`U_\infty` be the span of the coefficients of :math:`u`. Then -:math:`\dim U_\infty \le \rho_S`. - -*Proof.* :math:`\dim U_\infty` is the number of functions among the components -:math:`u_i(t)` that are linearly independent over :math:`\mathbb{R}`, which equals the rank of -their Wronskian matrix :math:`\big(u^{(j)}(t)\big)_{j \ge 0}` over the meromorphic functions. -Along the solution :math:`\varphi_t(z_0)`, the chain rule gives :math:`u^{(j)}(t) = \partial_z -L_F^j h\big(\varphi_t(z_0)\big)\, \Phi(t)` with the invertible fundamental matrix :math:`\Phi(t) -= \partial \varphi_t / \partial z_0`. For small :math:`t > 0`, :math:`\varphi_t(z_0)` is a point -of :math:`S`, which is invariant under the flow, where the output is defined, so by the lemma of -:ref:`sufficient-lie-order` the rank is at most :math:`\rho_S`. :math:`\square` - -The rows of the coordinates are the coefficients of :math:`\partial_\theta g = u\, -\partial_\theta z_0`. If the coefficients of :math:`u` up to order :math:`N`, those of negative -order included, reach rank :math:`\rho_S` at the start, they span :math:`U_\infty`, and the -rows up to order :math:`N` span all rows: the order is proven sufficient, as in the proposition -there. The coefficients at the base point are those of generic :math:`\theta` unless the base -point lies where a leading coefficient vanishes; this event is not counted in +\partial_{z_0} g(t)`, a Laurent series. + +**Lemma.** Let :math:`U_\infty` be the span of the coefficients of :math:`u`. Then :math:`\dim +U_\infty \le \rho_S`. + +*Proof.* :math:`\dim U_\infty` is the rank of the Wronskian matrix :math:`(u^{(j)}(t))_{j \ge 0}`. +By the chain rule :math:`u^{(j)}(t) = \partial_z L_F^j h(\varphi_t(z_0))\, \Phi(t)` with the +invertible fundamental matrix :math:`\Phi(t)`, and for small :math:`t > 0`, :math:`\varphi_t(z_0)` +is a point of :math:`S` where the output is defined, so the rank is at most :math:`\rho_S`. +:math:`\square` + +If the coefficients of :math:`u` up to order :math:`N`, those of negative order included, reach +rank :math:`\rho_S` at the start, they span :math:`U_\infty`, and the order is proven sufficient. +The event that the base point lies where a leading coefficient vanishes is not counted in ``info["order_bound"]``. **Free powers of a state at 0.** Let a state :math:`x` start at 0 in every condition and enter through powers :math:`x^{c_0 + c\alpha}`, with integers :math:`c_0 \ge 0`, :math:`c > 0` and a -coordinate :math:`\alpha > 0` as exponent. Generically :math:`x = c_x t^k (1 + O(t))` with -:math:`k \ge 1` and :math:`c_x \neq 0`, so :math:`x^\alpha` behaves as :math:`t^{k\alpha}`, which -is not analytic at 0 for :math:`\alpha \notin \mathbb{N}`. The recast :math:`B = x^\alpha` of -:ref:`non-rational` needs :math:`x \ne 0` at the start. Instead, with the formal variable -:math:`S = (c_x t^k)^\alpha`, +coordinate :math:`\alpha > 0`. Generically :math:`x = c_x t^k (1 + O(t))` with :math:`k \ge 1` and +:math:`c_x \ne 0`. With the formal variable :math:`S = (c_x t^k)^\alpha`, .. math:: :label: eq-start-power x^\alpha = S\, Q, \qquad Q = \Big(\frac{x}{c_x t^k}\Big)^{\alpha}, -where :math:`Q` is a power series in :math:`t` with constant term 1. Every state and output -becomes a power series in :math:`t` and :math:`S`. A coefficient of :math:`t^n S^m`, kept with -the *index* :math:`n` (the exponent of :math:`t` at :math:`\alpha = 1`, so :math:`n \ge km`), -stands for the function :math:`t^{n - km + km\alpha}`. Differentiation in :math:`t` maps it to -:math:`\lambda_{n,m} = n + km(\alpha - 1)` times the coefficient of index :math:`n - 1`, so the -states follow from :math:`\lambda_{n+1,m}\, x_{n+1,m} = f_{n,m}`, and :math:`Q` from the -derivation of the index, :math:`n Q_n = A_0^{-1} \sum_{j=1}^{n} (\alpha j + j - n)\, A_j Q_{n-j}` -with :math:`A = x / (c_x t^k)` and :math:`Q_0 = A_0^\alpha`, where :math:`A_0 - 1` is nilpotent. -:math:`Q_n` needs :math:`x` up to index :math:`n + k`, which is the index of :math:`S Q_n`, so the -recursion runs order by order as for analytic outputs. The coefficients :math:`d_{n,m}` of an -output are rational in :math:`\theta` where no :math:`\lambda` vanishes, which holds for -:math:`\alpha > 0`: :math:`\lambda_{n,m} \ge \min(1, \alpha)\, n`. The same bound shows that the -series converges for small :math:`t > 0`: the recursion divides by at least :math:`\min(1, \alpha)` -times the divisor of a Taylor series, so Cauchy's majorant of the right-hand side divided by -:math:`\min(1, \alpha)` dominates it. - -**Lemma.** For distinct real numbers :math:`q_1, \dots, q_r`, the functions :math:`t^{q_j}` and -:math:`t^{q_j} \log t` are linearly independent over :math:`\mathbb{R}` on every interval -:math:`(0, \varepsilon)`, also as terms of convergent sums whose exponents have no accumulation -point. - -*Proof.* Let :math:`\sum_j (a_j + b_j \log t)\, t^{q_j} = 0` with :math:`q_1 < q_2 < \dots` and -:math:`j` the first index with :math:`(a_j, b_j) \neq 0`. Divided by :math:`t^{q_j}`, the other -terms tend to 0 as :math:`t \to 0^+`, since :math:`t^\delta \log t \to 0` for :math:`\delta > 0`, -while :math:`a_j + b_j \log t` does not. :math:`\square` - -For :math:`\alpha \notin \mathbb{Q}`, distinct :math:`(n, m)` give distinct exponents -:math:`n - km + km\alpha`, and with several powers the exponents :math:`n + \sum_i k_i m_i -(\alpha_i - 1)` are distinct when :math:`1, \alpha_1, \dots, \alpha_K` are linearly independent -over :math:`\mathbb{Q}`; this holds for generic coordinates if the exponents are distinct -coordinates, and two powers of states at 0 with the same exponent are refused. The gradient of -the output is +where :math:`Q` is a power series in :math:`t` with constant term 1. Every state and output becomes +a power series in :math:`t` and :math:`S`; a coefficient of :math:`t^n S^m`, the *index* :math:`n` +and the *layer* :math:`m`, stands for :math:`t^{n - km + km\alpha}`, and differentiation multiplies +it by :math:`\lambda_{n,m} = n + km(\alpha - 1) \ge \min(1, \alpha)\, n`. So the coefficients +:math:`d_{n,m}` are rational in :math:`\theta` for :math:`\alpha > 0`, and the series converges for +small :math:`t > 0` by a Cauchy majorant. + +**Lemma.** For distinct real numbers :math:`q_j`, the functions :math:`t^{q_j}` and :math:`t^{q_j} +\log t` are linearly independent over :math:`\mathbb{R}` on every interval :math:`(0, +\varepsilon)`, also as terms of convergent sums whose exponents have no accumulation point. + +*Proof.* In a relation, divide by the term of least exponent with a nonzero coefficient +:math:`a_j + b_j \log t`; the other terms tend to 0 as :math:`t \to 0^+`, and :math:`a_j + b_j +\log t` does not. :math:`\square` + +For :math:`\alpha \notin \mathbb{Q}` distinct :math:`(n, m)` give distinct exponents, and with +several powers this holds where the exponents are distinct coordinates; two powers of states at 0 +with the same exponent are refused. The gradient of the output is .. math:: @@ -443,24 +320,10 @@ the output is + m\, d_{n,m} \big(\alpha\, \partial_\theta c_x / c_x + \log c_x\, \partial_\theta \alpha\big) + km\, d_{n,m} \log t\; \partial_\theta \alpha\Big)\, t^{n - km + km\alpha}, -so by the lemma a direction lies in the kernel if and only if it annihilates the vectors in -parentheses without the logarithm of :math:`t` and, separately, the vectors :math:`km\, d_{n,m}\, -\partial_\theta \alpha`. Once a coefficient with :math:`m > 0` is nonzero, the latter span -:math:`\partial_\theta \alpha`, and the transcendental term :math:`\log c_x\, \partial_\theta -\alpha` lies in their span. The rows are therefore :math:`\partial_\theta d_{n,m} + m\, -d_{n,m}\, \alpha\, \partial_\theta c_x / c_x`, rational in :math:`\theta`, and one row -:math:`\partial_\theta \alpha`. With several powers, the rows of the logarithm are -:math:`\sum_i k_i m_i\, \partial_\theta \alpha_i`; the engine refuses an expansion in which the -vectors :math:`(k_i m_i)_i` of the nonzero coefficients do not span every power that occurs. -The engine computes :math:`d_{n,m}` with :math:`S` held fixed in the dual numbers and adds the -term of :math:`c_x`, the leading coefficient of :math:`x`, from the dual of :math:`c_x`. The ranks -are taken at random points, where :math:`\alpha` is generic. - -Truncation at the Lie order :math:`N` keeps the indices :math:`n \le N`, and each power of -:math:`S` counts :math:`k` orders, so the monomials have total degree at most :math:`N/k` in the -:math:`S`. Every coefficient computed is exact, and the rank grows to the final value with -:math:`N`. The stopping rule does not apply: the rows :math:`\partial_z L_F^j h` do not exist at -the start, and a start moved off :math:`x = 0` changes the type of the expansion, so no start -reaches the ceiling. The order stops after the plateau and the saturation guard, the result -says that the Lie order is not proven sufficient, and ``info["limits"]`` names the power. Events, +so by the lemma the rows are :math:`\partial_\theta d_{n,m} + m\, d_{n,m}\, \alpha\, +\partial_\theta c_x / c_x`, rational in :math:`\theta`, and one row :math:`\partial_\theta \alpha`, +which also absorbs the transcendental term :math:`\log c_x\, \partial_\theta \alpha`. The stopping +rule does not apply: a start moved off :math:`x = 0` changes the type of the expansion, so no start +reaches the ceiling. The order stops after the plateau and the saturation guard, the Lie order is +reported as not proven sufficient, and ``info["limits"]`` names the power. Events, ``equilibrate`` and a state that starts at 0 in one condition only are refused for such powers. diff --git a/docs/method/proofs.rst b/docs/method/proofs.rst index 652004f..60dfdb6 100644 --- a/docs/method/proofs.rst +++ b/docs/method/proofs.rst @@ -19,12 +19,8 @@ event value the weight zero, and every initial value and replaced or added event weight of the state. These conditions are linear in the weights and read off the exponents of the monomials of all expressions together; their integer solutions form a lattice, the *integer kernel*, and a basis of it gives the scalings exactly. They are taken out first and checked -again symbolically. A power :math:`x^e` whose exponent :math:`e` holds no state and only -coordinates of weight zero has the weight :math:`e\,\alpha_x`, since -:math:`(e^{\alpha_x \lambda} x)^e = e^{e \alpha_x \lambda} x^e` on the principal branch, also for -a state that starts at 0; the recast :math:`E = \theta^e` of a free power of a coordinate has -the weight :math:`e\,\alpha_\theta`, and :math:`L = \log \theta` is translated by -:math:`\alpha_\theta`. A scaling that holds only on an invariant set, such as +again symbolically. A power :math:`x^e` whose exponent holds no state and only coordinates of +weight zero has the weight :math:`e\,\alpha_x`, also for a state that starts at 0. A scaling that holds only on an invariant set, such as :math:`(k_1, k_2) \mapsto (e^\lambda k_1, e^\lambda k_2)` for :math:`\dot x = k_1 - k_2 x` started at rest, is not an exact symmetry and fails the check. The scaling of the example in Equation :eq:`eq-example` is exact, with weights :math:`(0, 0, -1, 1, 1)`. @@ -35,75 +31,39 @@ General directions ------------------ The other non-identifiable directions are *general directions*. The coordinates are ordered with -the initial values of the free states first, in the order of the model, followed by the -parameters in a fixed sorted order. Gauss-Jordan elimination of the rows takes the pivot -columns from left to right, and a *free coordinate* is one without pivot, whose column depends -on the columns to the left. Each kernel vector has the component one on one free coordinate and -zero on the others; every other component is then a rational function of the coordinates. -Alternatively, a direction is fitted in log coordinates, :math:`\xi_i / \theta_i`, and multiplied -back, or chosen with the smallest support outside the scalings, with the component one on the -leftmost coordinate of the support. - -The components are reconstructed from samples. Perturbation finds the variables of each entry; -the entry is sampled at many points and primes and fitted by dense interpolation, by sparse -interpolation after :cite:p:`BenOr1988` or by univariate rational interpolation along lines, and it is -lifted to rational coefficients by the Chinese remainder theorem and rational reconstruction -:cite:p:`Wang1982`. The *route*, as ``Symmetry.route`` names it, is one of - -- ``fit``: rational reconstruction from samples over several primes; ``read-off``: a fast pass - that reads Laurent monomials on the support, with the other coordinates held; ``fit per - prime``: points that each prime solves, joined by the Chinese remainder theorem; each possibly - ``in log coordinates`` and with the kind of fit in parentheses, ``constant``, ``dense`` (a - monomial table up to ``degree_cap``) or ``sparse``; -- ``forward fit per prime``: under ``equilibrate``, with the resting states drawn and the - turnover rates solved, as in the forward seed; -- ``narrow fit``: the kernel restricted to the columns of the support of one direction, in which - it is one-dimensional, with ``exchange groups`` where coordinates that enter only through their - sum or their product were held at the base point and substituted back; ``narrow read-off``: - entries constant, or constant multiples of the coordinates (a scaling on the support), read at - the base point and held at two fresh points; ``narrow (a column without rows)``: the direction - along a coordinate whose column of the kernel matrix vanishes; ``jets (order k)``: the - generator read from the Taylor coefficients of the kernel entries along a support of at most - six coordinates. With many conditions the narrow route reads the kernels of a *cover*, the - conditions whose rows reach the rank of all of them at the base point, and finds the - coordinates that move a direction by whether the direction still annihilates the rows with a - group of coordinates perturbed, from jets seeded along the direction; each closed form is then - checked on every condition; -- ``homotopy fit``: the fit along lines below. - -A *sample bank* of points over the union of the relevant coordinates, with kernels per point and -prime, is shared by all dense fits. Before it is reported, every closed form, and a direction -along one coordinate that fills the kernel, is checked at seeded points uniform modulo the -verification prime, the *kernel check* of :ref:`kernel-check`; under ``equilibrate`` on the -coordinates the closed form states, from which the resting-state copies per condition follow. - -A direction that no sampling route closes is fitted along lines :math:`\theta_b + \mu\, -\delta` through the base point: the kernel entries become power series in :math:`\mu` (under -``equilibrate`` with the resting state continued along the line), and Padé forms on a *star*, -several lines in independent directions :math:`\delta`, are fitted as rational functions. An -entry that is not rational in the parameters alone is fitted in parameters and resting states -modulo their balances, the state :math:`x` of condition :math:`c` being named ``x_c``. Each -entry is checked at a prime outside those of the fit, and the direction against the kernel at -two points uniform modulo the verification prime. ``reconst_control(homotopy=False)`` turns -this route off. +the initial values of the free states first, followed by the parameters in a fixed sorted order. +Gauss-Jordan elimination of the rows takes the pivot columns from left to right, and a *free +coordinate* is one without pivot. Each kernel vector has the component one on one free coordinate +and zero on the others; every other component is then a rational function of the coordinates. +Alternatively, a direction is fitted in log coordinates, :math:`\xi_i / \theta_i`, or chosen with +the smallest support outside the scalings. + +The components are reconstructed from samples at many points and primes, by dense or sparse +interpolation :cite:p:`BenOr1988` or by rational interpolation along lines, and lifted to rational +coefficients by the Chinese remainder theorem and rational reconstruction :cite:p:`Wang1982`. The +*route*, ``Symmetry.route``, says how: ``fit``, ``read-off`` and ``fit per prime`` sample the kernel +(``forward fit per prime`` with drawn resting states), the ``narrow`` routes and ``jets (order k)`` +restrict it to the support of one direction, and ``homotopy fit`` fits Padé forms along lines through +the base point, also in parameters and resting states (the state :math:`x` of condition :math:`c` +named ``x_c``). + +Before it is reported, every closed form is checked at seeded points uniform modulo the +verification prime, the *kernel check* of :ref:`kernel-check`. .. _orbit-geometry: Orbit geometry -------------- -Each direction with a closed form is classified by the geometry of the orbits, -``Symmetry.kind``, up to a common factor :math:`c(\theta)` of the components: - -- a *scaling*, :math:`\xi_i = c\, w_i \theta_i` with numbers :math:`w_i`, has lines in - logarithmic coordinates as orbits and monomial invariants; a pin - :math:`\theta_i = 1` meets every orbit once; -- a *translation*, :math:`\xi_i = c\, v_i` with numbers :math:`v_i`, has lines in linear - coordinates as orbits and linear invariants. It is proven like a scaling, from the linear - structure of the model: the right-hand sides, observables, initial values and events do not - change along :math:`v`, checked over :math:`\mathbb{Q}`, with the field on the states where - :math:`v` moves initial values. In the positive orthant an orbit ends on the boundary, so the - section lies on a face, :math:`\theta_i = 0`, reached in the limit; +Each direction with a closed form is classified by the geometry of the orbits, ``Symmetry.kind``, +up to a common factor :math:`c(\theta)` of the components: + +- a *scaling*, :math:`\xi_i = c\, w_i \theta_i` with numbers :math:`w_i`, has lines in logarithmic + coordinates as orbits and monomial invariants; a pin :math:`\theta_i = 1` meets every orbit once; +- a *translation*, :math:`\xi_i = c\, v_i` with numbers :math:`v_i`, has lines as orbits and linear + invariants. It is proven like a scaling, from the linear structure of the model. In the positive + orthant an orbit ends on the boundary, so the section lies on a face, :math:`\theta_i = 0`, + reached in the limit; - every other direction is *curved*. Translations and curved directions are general directions (``Symmetry.type``). The labels @@ -115,24 +75,18 @@ translations and the curved directions. Invariant fields and gauge -------------------------- -Some directions follow from the model equations without sampling. For a model with resting -states, a *global symmetry* is a field of one regime, found by a detection of that regime with -free initial values and extended to the initial and event values, that lies in the kernel. A -*static subsystem* is a set of states at rest that no event moves; parameters that only the -balances of the subsystem hold give fields that leave every such rest in place. Both are reported with these -names as route. Where every direction of the kernel lies in the span of fields that satisfy the -conditions of :ref:`proofs-over-q` at random points, the *invariant fields*, the rank holds at every -order (``info["rank_fields"]``), with an error bound in ``info["rank_fields_bound"]``. (A) is -checked as a zero and (B), (C) as membership in the span, at two random points; a wrong identity -passes only where a polynomial vanishes there, which the bound covers. Membership at random -points shows (B) and (C) as identities over the rational functions, the hypothesis of the -proposition in :ref:`proofs-over-q`, with coefficients that may have poles on the trajectory. - -With ``gauge``, the detection first finds the scalings and fixes one coordinate per scaling, as -a basis of the weights in the order of preference given and, with general directions, the one -that leaves the fewest nonzero entries in the remaining kernel. A second pass with these -coordinates fixed reconstructs the general directions. Without ``gauge``, -``info["gauge_suggestion"]`` names this choice. +Some directions follow from the model equations without sampling: a *global symmetry*, a field of +one regime with free initial values that lies in the kernel, and a *static subsystem*, a set of +states at rest that no event moves, whose parameters give fields that leave the rest in place. +Where every direction of the kernel lies in the span of fields that satisfy the conditions of +:ref:`proofs-over-q` at random points, the *invariant fields*, the rank holds at every order +(``info["rank_fields"]``), with an error bound in ``info["rank_fields_bound"]``: (A) is checked as +a zero and (B), (C) as membership in the span at two random points, which shows them as identities +over the rational functions, the hypothesis of the proposition in :ref:`proofs-over-q`. + +With ``gauge``, the detection first finds the scalings and fixes one coordinate per scaling, in the +order of preference given, then reconstructs the general directions with these coordinates fixed. +Without ``gauge``, ``info["gauge_suggestion"]`` names this choice. .. _proofs-over-q: @@ -141,13 +95,12 @@ Proofs over Q A closed form is *proven* when it is shown to be a symmetry without random points. For a scaling this is the check of :ref:`scalings`. For a general direction, symident *lifts* the direction to a -field :math:`Y = \xi_\theta\, \partial_\theta + \xi_x\, \partial_x` on parameters and states, -i.e., it finds state components :math:`\xi_x`, and proves the conditions below over -:math:`\mathbb{Q}` for every regime of a condition, with event maps :math:`E_e` between the -regimes. They are stated for fields :math:`X_1, \dots, X_m` per regime and the unit directions -:math:`\partial_u` of parameters :math:`u` that enter no regime, whose span is -:math:`\mathcal{D}`; :math:`X'_l` are the fields of the regime after an event, and :math:`v` is -the direction lifted onto the start :math:`z_0`. +field :math:`Y = \xi_\theta\, \partial_\theta + \xi_x\, \partial_x` on parameters and states and +proves the conditions below over :math:`\mathbb{Q}` for every regime of a condition, with event maps +:math:`E_e` between the regimes. They are stated for fields :math:`X_1, \dots, X_m` per regime and +the unit directions :math:`\partial_u` of parameters :math:`u` that enter no regime, whose span is +:math:`\mathcal{D}`; :math:`X'_l` are the fields of the regime after an event, and :math:`v` is the +direction lifted onto the start :math:`z_0`. .. math:: :label: eq-fields @@ -161,68 +114,39 @@ the direction lifted onto the start :math:`z_0`. \end{aligned} with :math:`a` numbers and :math:`c, c'` rational functions of states and parameters, which may -have poles. A proof over :math:`\mathbb{Q}` takes the lift as the one field of each regime, with -:math:`[F, Y] = 0` and :math:`\mathrm{D}E_e\, Y = Y' \circ E_e`; the invariant fields of -:ref:`invariant-fields` take the fields of the regimes. Where :math:`[F, Y] \neq 0`, the -proof takes as :math:`X_l` the lift together with the lifts proven before, and (B) and (C) with -coefficients solved at a random point and checked over :math:`\mathbb{Q}` on the other -coordinates: :math:`[F, Y] = \lambda Y + \sum_j \mu_j Z_j` holds, e.g., for a translation of -two initial values whose sum the dynamics keeps, where the flow scales :math:`Y`. With unknown -inputs the jets of an input, the input included, take no identity: their components are the -prolongation :math:`\xi_{w_{j+1}} = F(\xi_{w_j}) + \lambda \xi_{w_j} + \sum_j \mu_j \xi^{Z_j}_{w_j}`, -which makes (B) hold there, so a field whose parameter components hold the input is allowed. -Components are tried as found, canonical, over a common denominator and divided by each of their -first four components. +have poles. The fields are the lift alone, with :math:`[F, Y] = 0`, or the lift together with the +lifts proven before, with coefficients solved at a random point and checked over :math:`\mathbb{Q}`. +With unknown inputs the jets take no identity, since the prolongation of the input component makes +(B) hold there. **Proposition.** Under (A) to (D) the direction lies in the kernel at every Lie order and every gap length. -*Proof.* Let :math:`\mathcal{A}` be the rational functions :math:`\varphi` of a regime with :math:`X_l(\varphi) = 0` -and :math:`\partial_u \varphi = 0` for all :math:`l, u`. By (A), :math:`h \in \mathcal{A}`. By (B), -:math:`X_l(F \varphi) = F(X_l \varphi) - [F, X_l](\varphi) = 0`, and :math:`[F, \partial_u] = 0`, so :math:`F` -maps :math:`\mathcal{A}` into itself; by (C), :math:`\varphi \circ E_e \in \mathcal{A}` for :math:`\varphi` in :math:`\mathcal{A}` of the -next regime. Let :math:`\mathcal{A}_k` be the functions of segment :math:`k` built from the outputs of the segment -and from :math:`\varphi \circ E_e` with :math:`\varphi \in \mathcal{A}_{k+1}` by Lie derivatives along -:math:`F`. They lie in :math:`\mathcal{A}` and are analytic along the trajectory, as is every expression -of the model where it is defined. With :math:`z^{(k)}` the start of segment :math:`k` and -:math:`\varphi_t` the flow of :math:`F`, the claim is that the derivative of -:math:`\chi(z^{(k)})` along :math:`v` vanishes for every :math:`\chi \in \mathcal{A}_k`. For -:math:`k = 1` it is :math:`\sum_l a_l\, X_l(\chi)(z_0) + \sum_u a_u\, \partial_u \chi(z_0) = 0` -by (D). If it holds for -:math:`k`, the derivative of :math:`\chi(\varphi_t(z^{(k)}))` along :math:`v` is analytic -in :math:`t` on the segment, and the derivatives at :math:`t = 0` are those of -:math:`L_F^j \chi \in \mathcal{A}_k` at :math:`z^{(k)}`, which vanish, so it vanishes on the -whole segment. With :math:`\chi` an output this is the kernel of every row; with -:math:`\chi = \varphi \circ E_e` at the event time, which :math:`v` does not move, it is the claim -for :math:`k + 1`. :math:`\square` - -The proof needs (B) and (C) as identities of rational functions only. The flow need not keep -the span :math:`\mathcal{D}`: for :math:`X = x^2\, \partial_y` and :math:`F = \partial_x`, -:math:`[F, X] = (2/x)\, X`, yet the flow moves :math:`\partial_y` from :math:`x = -1` to -:math:`x = 0`, where :math:`\mathcal{D} = 0`. The proof follows the functions that the fields -annihilate instead, which a drop of rank does not affect. The identities are proven over -:math:`\mathbb{Q}` per state equation, observable, initial value and event, by symbolic -cancellation. The state components are the closed form read on the states, the initial-value -identities solved for the parameters that set the initial values, a combination of the -symmetries of the model equations, or a solution on the *support* of the direction. The -identities of the lift are linear in :math:`\xi_x`. The support starts at the states whose -equation, initial value or output reads a parameter that the direction moves and grows by the -states whose equations read it; on it, :math:`\xi_x` is a polynomial of degree one in the states, -and of degree two on at most 12 states, solved from the identities at random points modulo a -prime. The lift of :math:`c(\theta)\, Y` is :math:`c(\theta)` times the lift of :math:`Y`, so the -coefficients are read as rational numbers, from two primes, times a factor :math:`c(\theta)`: -one, a component, a component divided by the coordinate it moves, or the inverse of the common -denominator of the components, where the quotient agrees at two parameter points. Otherwise up to -8 coefficients are solved over the rational functions of the parameters from as many independent -identities at points with small coordinates. The solution is a candidate; the identities over -:math:`\mathbb{Q}` decide. The regimes of conditions with the same initial values try the lift of -the first such regime first. - -An identity is first evaluated modulo the prime :math:`2^{61} - 1` at a random point; a nonzero -value refutes it exactly. Otherwise the numerator is expanded in a polynomial ring over -:math:`\mathbb{Q}` with a cap on the terms of every polynomial and on the term products of one -multiplication; past a cap the identity is undecided, and the direction keeps the level of the -kernel check. +*Proof.* Let :math:`\mathcal{A}` be the rational functions :math:`\varphi` of a regime with +:math:`X_l(\varphi) = 0` and :math:`\partial_u \varphi = 0` for all :math:`l, u`. By (A), +:math:`h \in \mathcal{A}`. By (B), :math:`X_l(F \varphi) = F(X_l \varphi) - [F, X_l](\varphi) = 0`, +so :math:`F` maps :math:`\mathcal{A}` into itself; by (C), :math:`\varphi \circ E_e \in \mathcal{A}` +for :math:`\varphi` in :math:`\mathcal{A}` of the next regime. Let :math:`\mathcal{A}_k` be the +functions of segment :math:`k` built from the outputs and from :math:`\varphi \circ E_e`, +:math:`\varphi \in \mathcal{A}_{k+1}`, by Lie derivatives along :math:`F`; they are analytic along +the trajectory. The claim is that the derivative of :math:`\chi(z^{(k)})` along :math:`v` vanishes +for every :math:`\chi \in \mathcal{A}_k`, :math:`z^{(k)}` the start of segment :math:`k`. For +:math:`k = 1` this is (D). If it holds for :math:`k`, the derivative of +:math:`\chi(\varphi_t(z^{(k)}))` along :math:`v` is analytic in :math:`t` with vanishing +derivatives :math:`L_F^j \chi` at :math:`t = 0`, so it vanishes on the segment; with :math:`\chi` an +output this is the kernel of every row, with :math:`\chi = \varphi \circ E_e` at the event time, +which :math:`v` does not move, the claim for :math:`k + 1`. :math:`\square` + +The proof needs (B) and (C) as identities of rational functions only. The flow need not keep the +span :math:`\mathcal{D}`: for :math:`X = x^2\, \partial_y` and :math:`F = \partial_x`, :math:`[F, X] += (2/x)\, X`, yet :math:`\mathcal{D} = 0` at :math:`x = 0`. The proof follows the functions that the +fields annihilate instead, which a drop of rank does not affect. + +The identities are proven over :math:`\mathbb{Q}` per state equation, observable, initial value and +event, by symbolic cancellation. They are linear in :math:`\xi_x`, whose candidates come from the +closed form, the initial values, symmetries of the model equations, or a solve at random points; the +identities decide. A nonzero value modulo a prime refutes an identity exactly; an identity past the +work caps is undecided, and the direction keeps the level of the kernel check. .. _unproven: @@ -230,29 +154,12 @@ Unproven directions ------------------- ``info["proof"]`` lists every direction that no proof closes, with the ``support`` and the -``reason`` of each failed route: - -- ``lift of the closed form: [Y, F] on x does not vanish``: the field with state components read - from the closed form is no symmetry, and no other lift was found. -- ``output is not a polynomial in t``: the output identities decide only outputs polynomial in - time. -- ``no combination of the regime fields moves the parameters alike``, ``no combined lift`` (with - the cause, such as more than 8 regimes or work above ``reconst_control(exact_work_cap=)``): the - regimes need state components that agree on the parameters. -- ``events after the start``, ``an event at the start``, ``an input switches on at the start``: - the proof at the resting states covers a start at rest with the inputs at rest that no event - follows or changes. With events, states that no event reaches and that rest alone, such as a - subsystem driving the states the events set, become constant coordinates on their resting - variety, parametrized by a linearly entering parameter; the field holds the component of each - resting state that keeps the variety tangent, and the following states :math:`s` get components - :math:`\xi_s = A s + a`, with a matrix :math:`A` and a vector :math:`a` solved from the - identities of regimes, outputs and events. This covers one resting condition, with reason - ``resting subsystem as coordinates`` and the failing identity. -- ``an inverted power recast``, ``the resting states have no rational parametrization``, ``more - than 8 resting states per condition``: a balance solved for a recast power, without rational - parametrization by the parameters, or with more than the 8 states for which the resting - Jacobian is inverted symbolically stays unproven, the last also in ``info["limits"]``. -- ``no exact proof with these nuisance coordinates``: the unknown-input coordinates have no lift. +``reason`` of each failed route: a lift whose bracket with :math:`F` does not vanish on the states, +an output that is not polynomial in time, regimes whose fields do not move the parameters alike, +events after a resting start, a resting state without rational parametrization, or unknown-input +coordinates without a lift. Where resting subsystems with events are taken as constant coordinates, +the reason is ``resting subsystem as coordinates`` with the failing identity; a limit is also named +in ``info["limits"]``. .. _kernel-check: @@ -282,15 +189,13 @@ route, such as a static subsystem or the forward fit, is checked at particular p stays ``checked``. **The bound at rest.** Under ``equilibrate`` a check point draws the coordinates uniformly modulo -:math:`p` and solves the balances :math:`f_i` of each condition there. A point counts where, -unless linear elimination solves the balances, every state is nonzero. The resting states are -algebraic, not rational, in the coordinates, so the Schwartz-Zippel lemma (:ref:`order-bound`) is applied on the resting -variety. Let :math:`Z` be an irreducible component of the resting variety with -:math:`\dim Z = d`, and :math:`P` a polynomial of degree :math:`D` that does not vanish on -:math:`Z`; :math:`V(P)` denotes the zero set of :math:`P` and a *hypersurface* the zero set of one nonzero -polynomial. Then :math:`Z \cap V(P)` has degree at most :math:`D \deg Z \le D \prod_i \deg f_i`, -the *Bezout number* of the balances :cite:p:`Heintz1983`, the projection of this intersection to the coordinates lies in a -hypersurface of at most that degree :cite:p:`Heintz1983`, and therefore +:math:`p` and solves the balances :math:`f_i` of each condition there. The resting states are +algebraic in the coordinates, so the Schwartz-Zippel lemma (:ref:`order-bound`) is applied on the +resting variety. Let :math:`Z` be an irreducible component of the resting variety and :math:`P` a +polynomial of degree :math:`D` that does not vanish on :math:`Z`. Then :math:`Z \cap V(P)` has +degree at most :math:`D \deg Z \le D \prod_i \deg f_i`, the *Bezout number* of the balances +:cite:p:`Heintz1983`, the projection to the coordinates lies in a hypersurface of at most that +degree, and therefore .. math:: :label: eq-rest-bound @@ -298,30 +203,21 @@ hypersurface of at most that degree :cite:p:`Heintz1983`, and therefore \Pr_\theta\big[\exists x:\ (\theta, x) \in Z,\ P(\theta, x) = 0\big] \le \frac{D\, \deg Z}{p}. -Let :math:`D_\theta` and :math:`D_x` be the columns of :math:`D_N` for the coordinates and for the -states, and :math:`\operatorname{adj}` the adjugate matrix. With :math:`J_x` invertible, a closed -form :math:`v` extends to the kernel of the joint rows exactly where +With :math:`D_\theta` and :math:`D_x` the columns of :math:`D_N` for coordinates and states, a +closed form :math:`v` extends to the kernel of the joint rows exactly where .. math:: - \det(J_x)\, D_\theta v - D_x \operatorname{adj}(J_x)\, J_\theta v = 0 . - -Multiplied by :math:`\det(J_x)`, this identity also vanishes at a check point with a singular -Jacobian, and it does not vanish on the component where :math:`J_x` is invertible at one -resting point of the condition, which is checked. The degree of the identity is the degree :math:`D` of the -cleared kernel identity with the start as coordinates plus :math:`2 \sum_i (\deg f_i - 1)`. A -closed form that reads resting states of further conditions, ``x_c``, lives on the product of -their varieties over :math:`\theta`. The solves leave the component only above a proper -subvariety of the coordinates of degree at most :math:`\prod_i \deg f_i`, the zeros of the -pivots of a linear elimination or the projection of the other components, provided every root -taken lies on one component over :math:`\mathbb{Q}(\theta)`: a rest solved by linear elimination, -or interior roots conjugate over :math:`\mathbb{Q}(\theta)` (``info["branches"]``), on a split -factor where a balance splits. In Equation :eq:`eq-kernel-bound` the degree :math:`D` is then -replaced by :math:`(D + 2 \sum_i (\deg f_i - 1)) \prod_i \deg f_i + \sum \prod_i \deg f_i`, the -products and the sum taken over the conditions read. Without such a component (branches not -decided), with resting states continued along a line at the check points, or with a power or -exponential in the balances, a direction that the proof leaves open is ``checked``, and -``info["bound"]`` gives the reason. + \det(J_x)\, D_\theta v - D_x \operatorname{adj}(J_x)\, J_\theta v = 0 , + +an identity of degree :math:`D + 2 \sum_i (\deg f_i - 1)` that does not vanish on the component +where :math:`J_x` is invertible at one resting point, which is checked. The solves leave the +component only above a subvariety of degree at most :math:`\prod_i \deg f_i`, provided every root +taken lies on one component over :math:`\mathbb{Q}(\theta)` (``info["branches"]``). In Equation +:eq:`eq-kernel-bound` the degree :math:`D` is then replaced by :math:`(D + 2 \sum_i (\deg f_i - 1)) +\prod_i \deg f_i + \sum \prod_i \deg f_i`, over the conditions read. Without such a component, or +with a power or exponential in the balances, a direction that the proof leaves open is ``checked``, +and ``info["bound"]`` gives the reason. **What the bounds exclude.** The bounds above are probabilities over the points modulo :math:`p`. They exclude the chance that :math:`p` divides the *content* of an integer identity, the greatest diff --git a/docs/method/reduction.rst b/docs/method/reduction.rst index 256b2c2..3fee709 100644 --- a/docs/method/reduction.rst +++ b/docs/method/reduction.rst @@ -4,78 +4,56 @@ Reduction A reduction replaces the coordinates by combinations that the output determines :cite:p:`Chappell1998,Evans2000,Massonis2023`, the invariants :math:`I_l(\theta)` with :math:`X(I_l) = 0` :cite:p:`Olver1986`. The directions are reduced in *blocks*, sets of directions with overlapping supports, each block with the group :math:`G` generated by the flows of the generators of the block. -symident searches, within degree bounds, monomial, polynomial and rational invariants (with a -denominator in one coordinate), Darboux polynomials and exponential factors :cite:p:`Prelle1983,Goriely2001`, i.e., polynomials :math:`P` and exponentials :math:`e^{P/Q}` that :math:`X` -multiplies by a polynomial, and invariants by separable quadrature, i.e., by integrating -:math:`\mathrm{d}\theta_i / \xi_i = \mathrm{d}\theta_j / \xi_j` where it separates, and by an -integrating factor. The invariants become new parameters, :math:`I_l(\theta) = q_l`, and the -remaining coordinates are expressed through them. The invariants are coordinates on the orbit -space :math:`\Theta / G`, a *chart*, and the trafo is the section in these coordinates. A chart is -returned only where it is valid on the declared domain, the positive orthant by default; -``Reduction.partial`` names the directions whose chart covers the domain only in part, and -``alternatives=True`` also returns the charts of the other valid choices of the fixed -coordinates. Among the charts, one with total coverage comes before a rational one. +symident searches, within degree bounds, monomial, polynomial and rational invariants, Darboux +polynomials and exponential factors :cite:p:`Prelle1983,Goriely2001`, i.e., polynomials :math:`P` +and exponentials :math:`e^{P/Q}` that :math:`X` multiplies by a polynomial, and invariants by +separable quadrature and by an integrating factor. The invariants become new parameters, +:math:`I_l(\theta) = q_l`, coordinates on the orbit space :math:`\Theta / G`, a *chart*, and the +trafo is the section in these coordinates. A chart is returned only where it is valid on the +declared domain, the positive orthant by default; ``Reduction.partial`` names the directions whose +chart covers the domain only in part, and ``alternatives=True`` also returns the charts of the other +valid choices of the fixed coordinates. .. _red-scalings: Scalings -------- -A scaling is removed by fixing one of the coordinates it moves at one, such as an initial value or a -scale, a *pin*. Every orbit of a scaling meets the hypersurface :math:`\theta_i = 1` of a moved -coordinate once, so the result is a *global section*: a one-to-one map of the new parameters onto -a *global cross-section*, a set meeting every orbit exactly once, with the invariants as global -coordinates on the orbit space :math:`\Theta / G`. In the example of Equation :eq:`eq-example`, -:math:`A_0 = 1` meets every orbit of the scaling once. A direction along one coordinate is pinned -like a scaling; every orbit meets the pin where a *sign certificate*, a proof that an expression -has one sign on :math:`\Theta`, shows that the generator component on the pinned coordinate has -one sign, else the orbits can be the intervals between the zeros of that component, and the pin -is listed under ``unproven``. - -The pinned coordinates of a block of scalings, the *transversal* of the block, are chosen among the -coordinates of the support that are not fixed: subsets :math:`T` of the size of the block, taken -in the order of the coordinates, for which the columns :math:`W_T` of the weight matrix -:math:`W` are invertible and :math:`W_T^{-1} W` has integer entries, so that every other -coordinate becomes a monomial of the new parameters; for many candidates a greedy choice by the number of scalings moving each -coordinate. Without a certified transversal the block keeps the invariants only -(``invariant_only``). A scaling keeps the sign of every coordinate, so a pin on a coordinate that -is not declared positive misses the orbits where that coordinate is negative or zero; transversals -of positive coordinates come first. Where the only transversal outside the support of the general -directions is such a signed one, the pins :math:`\theta_T = 1` are taken on positive coordinates -inside that support, and each general generator :math:`X` becomes :math:`X - \sum_i \lambda_i -S_i`, with the scalings :math:`S_i = \sum_c W_{ic} \theta_c \partial_{\theta_c}` and -:math:`\lambda` solved from :math:`\sum_i \lambda_i W_{it} \theta_t = \xi_t` for :math:`t \in T`, -divided by the greatest common divisor of the numerators of the components. The matrix -:math:`(W_{it} \theta_t)` is invertible where the pins are positive, so the new generators span the -same distribution as before together with the scalings, and they leave :math:`\theta_T = 1` in -place. Every orbit meets :math:`\theta_T = 1`; there, the orbits of the new generators are the -intersections with the orbits of all directions, so the certificates of the general block hold for -the whole group. Of up to four positive transversals, the one with the shortest new generators is -kept. Before the search for invariants, a block of several general generators is -split by *module reduction*: an elimination order with few new nonzero entries, found at random -points modulo a prime and repeated exactly, gives combinations of the generators with smaller -supports, and independent ones form separate blocks. +A scaling is removed by fixing one of the coordinates it moves at one, a *pin*. Every orbit of a +scaling meets the hypersurface :math:`\theta_i = 1` of a moved positive coordinate once, so the +result is a *global section*: a one-to-one map of the new parameters onto a *global +cross-section*, a set meeting every orbit exactly once. In the example of Equation +:eq:`eq-example`, :math:`A_0 = 1` meets every orbit of the scaling once. A direction along one +coordinate is pinned like a scaling where a *sign certificate*, a proof that an expression has one +sign on :math:`\Theta`, shows that the generator component on the pinned coordinate has one sign; +else the pin is listed under ``unproven``. + +The pinned coordinates of a block of scalings, the *transversal*, are coordinates :math:`T` for +which the columns :math:`W_T` of the weight matrix :math:`W` are invertible and :math:`W_T^{-1} W` +has integer entries, so that every other coordinate becomes a monomial of the new parameters; +without one the block keeps the invariants only (``invariant_only``). A pin on a coordinate not +declared positive misses the orbits where that coordinate is not positive, so positive transversals +come first. Where these lie in the support of general directions, each general generator :math:`X` +becomes :math:`X - \sum_i \lambda_i S_i`, with the scalings :math:`S_i`, so that it leaves the pins +in place and spans the same distribution together with the scalings. A block of several general +generators is split by *module reduction* into combinations with smaller supports. .. _red-linear: Linear flows ------------ -A block of :math:`r` general generators is a *linear flow* when, in the -coordinates :math:`\tilde\theta_i = \theta_i` for a moved coordinate that is not declared -positive and :math:`\tilde\theta_i = \log \theta_i` for a positive one, every component -:math:`\tilde\xi_i` depends only on the coordinates :math:`u` that the block does not move, and -no declared bound involves a moved coordinate. The generators then commute, and the orbit of a -point is the affine set :math:`\{(u, \tilde\theta + \Xi(u) s) : s \in \mathbb{R}^r\}`, with -:math:`\Xi(u)` the matrix of the components, on which every moved coordinate takes every real -value. Pins :math:`\tilde\theta_P = 0` on :math:`r` moved coordinates :math:`P` whose minor -:math:`\det \Xi_P(u)` has one sign on :math:`\Theta` give a global section: -:math:`\tilde\theta_P + \Xi_P(u) s = 0` has exactly one solution on every orbit, so the section is -``injective`` and ``reach``-es every orbit. The invariants are -:math:`\tilde\theta_N - \Xi_N(u) \Xi_P(u)^{-1} \tilde\theta_P` for the other moved coordinates -:math:`N`, and a linear coordinate is pinned to 0, a positive one to 1. This stage runs before -the search for invariants. Among the pin sets, a coordinate that enters only the observables (an -offset of the observation function) is preferred, an initial value is taken last. +A block of :math:`r` general generators is a *linear flow* when, in the coordinates +:math:`\tilde\theta_i = \theta_i` for a moved coordinate that is not declared positive and +:math:`\tilde\theta_i = \log \theta_i` for a positive one, every component :math:`\tilde\xi_i` +depends only on the coordinates :math:`u` that the block does not move, and no declared bound +involves a moved coordinate. The generators then commute, and the orbit of a point is the affine +set :math:`\{(u, \tilde\theta + \Xi(u) s) : s \in \mathbb{R}^r\}`. Pins :math:`\tilde\theta_P = 0` +on :math:`r` moved coordinates whose minor :math:`\det \Xi_P(u)` has one sign on :math:`\Theta` give +a global section: :math:`\tilde\theta_P + \Xi_P(u) s = 0` has exactly one solution on every orbit, +so the section is ``injective`` and ``reach``-es every orbit. The invariants are +:math:`\tilde\theta_N - \Xi_N(u) \Xi_P(u)^{-1} \tilde\theta_P` for the other moved coordinates, and +a linear coordinate is pinned to 0, a positive one to 1. .. _red-general: @@ -83,93 +61,54 @@ General blocks -------------- For a block of :math:`r` general generators the invariants :math:`I(\theta) = q` are solved for -coordinates :math:`\theta_s = R(q, \vartheta)`, with :math:`r` *gauge coordinates* :math:`\vartheta` left. Every -level set :math:`\Lambda_q = \{\theta \in \Theta : I(\theta) = q\}` is one orbit when +coordinates :math:`\theta_s = R(q, \vartheta)`, with :math:`r` *gauge coordinates* :math:`\vartheta` +left. Every level set :math:`\Lambda_q = \{\theta \in \Theta : I(\theta) = q\}` is one orbit when -1. :math:`R(q, \vartheta)` is the unique solution for every gauge value, so :math:`\Lambda_q` is the graph - of :math:`R(q, \cdot)` over :math:`\mathcal{G}_q = \{\vartheta : (R(q, \vartheta), \vartheta) \in \Theta\}`; +1. :math:`R(q, \vartheta)` is the unique solution for every gauge value, so :math:`\Lambda_q` is the + graph of :math:`R(q, \cdot)` over :math:`\mathcal{G}_q = \{\vartheta : (R(q, \vartheta), + \vartheta) \in \Theta\}`; 2. the :math:`r \times r` minor of the generator components on :math:`\vartheta` has one sign on - :math:`\Theta`, so every orbit is :math:`r`-dimensional and open in :math:`\Lambda_q` (for - generators with poles, the minor of the fields times their denominators); + :math:`\Theta`, so every orbit is :math:`r`-dimensional and open in :math:`\Lambda_q`; 3. :math:`\mathcal{G}_q` is connected. -The set :math:`\mathcal{G}_q` is given by one inequality :math:`\pi_k(q, \vartheta) > 0` per positive -solved coordinate and square-root factor. It is connected when every inequality is convex in -:math:`\vartheta` (affine, a concave quadratic, or, in one positive gauge coordinate, a polynomial with at -most one sign change and so, by Descartes' rule of signs, at most one positive root), or when a -gauge coordinate enters every inequality affinely with a coefficient of known sign, so that the -*fibers*, the sets of that coordinate at fixed other gauge coordinates, are intervals and the set -is connected with the projection, decided the same way. Square roots in :math:`\vartheta`, or of a single -positive invariant, are first removed by a square substitution, which is one to one on the -positive half-line. The *section point* :math:`\hat\theta(q)` then lies in :math:`\Lambda_q` and, -by a *positivity certificate*, a proof that each entry is positive on the domain, in -:math:`\Theta`. +:math:`\mathcal{G}_q` is given by one inequality :math:`\pi_k(q, \vartheta) > 0` per positive +solved coordinate. It is connected when every inequality is convex in :math:`\vartheta`, or when a +gauge coordinate enters every inequality affinely with a coefficient of known sign and the +projection is connected, decided the same way. The *section point* :math:`\hat\theta(q)` then lies +in :math:`\Lambda_q` and, by a *positivity certificate*, a proof that each entry is positive on the +domain, in :math:`\Theta`. -**Split products.** Sections equate *balances*, monomials or summands of the invariants. An -invariant :math:`A - B` whose two summands each have one sign on :math:`\Theta` takes both signs -across the orbits, and the orbits of either sign leave the domain on different faces. For such an -invariant the products :math:`u v = 1` of a positive coordinate :math:`u` of :math:`A` and one -:math:`v` of :math:`B` are candidates as well. They are tried after the other balances, alone or -with one other balance, as many balances as generators, and only where the Jacobian of the -logarithms of the balance ratios along the generators, a determinant of polynomials over positive -denominators, has one sign on :math:`\Theta` by a sign certificate: the section is then transversal -to the orbits everywhere. Injectivity, ``reach`` and the positivity of the entries are proven as for -any section. - -**Section charts.** Where the section point solved from the invariants holds a root, the section -itself can still be rational, and the count of discrete symmetries (:meth:`Symmetries.discrete`), -which needs a rational reduced model, takes it so: when every orbit meets it (total coverage) exactly once -(``injective``), and the balances of the section solve, one after the other, for a coordinate of degree one with a -coefficient of one sign, each solved coordinate certified of the declared sign, the remaining -coordinates of the section are the new parameters. The trafo is then rational and maps their domain -one to one onto the points of the section in :math:`\Theta`, hence onto the orbits; the meaning of -a new parameter is the coordinate of the section point of the orbit, solved from the invariants. +**Sections.** Sections equate *balances*, monomials or summands of the invariants. Where the +section point holds a root but the section itself is rational, a *section chart* takes the remaining +coordinates of the section as new parameters, which the count of discrete symmetries +(:meth:`Symmetries.discrete`) needs. **Coverage.** ``reach`` says that every level set of the invariants is one orbit; with *total coverage* every orbit then meets the section, under *partial coverage* exactly the orbits whose -invariants lie where the solved entries are positive. Under declared bounds, i.e., expressions in -``positive``, an entry without positivity certificate is kept, with partial coverage, and listed -under ``unproven``. Without bounds it is kept only when the search found no section certified on -the whole domain, and only where a sampled orbit has every entry positive: the transformation then -covers the orbits on which the ``sign_conditions``, the entries as inequalities in :math:`q`, -hold, the sampled one among them, and no others. A positivity certificate treats an *atom*, a -non-polynomial subterm such as :math:`\log x`, as positive only where the sign of the atom is proven; an -AM-GM certificate, a lower bound by the inequality of arithmetic and geometric means over pairs of -terms, is strict only by the positive remainder the pairs leave, on a term free of coordinates -that are not declared positive where there are any. - -**Face sections.** A *face* is a boundary set :math:`\theta_f = 0` for coordinates -:math:`\theta_f` of the block; a section on a face lies outside :math:`\Theta` and is reached only -in a limit. It is tried first, and once one is found no other is searched; the new parameters are -the coordinates of the face point, not invariants. With :math:`\theta_f` as gauge coordinates, -the conditions above make every level set one orbit, and :math:`R(q, \theta_f) \to R(q, 0) > 0` -puts the face point :math:`(0, R(q, 0))` in the closure of every orbit of :math:`\Lambda_q`. The -output, constant along the orbit, equals that at the face point when the model is continuous -there: no model expression has a pole at the face, every denominator in the block parameters has -one sign there, and under ``equilibrate`` :math:`x^\ast(\theta)` has a limit. For that limit each -generator is lifted to a field :math:`\tilde X = X + \xi_x \partial_x` tangent to the resting -variety, by the state components of an exact direction or by the implicit derivative -:math:`\xi_x = -J_x^{-1} J_\theta \xi_\theta`; exactly verified invariants of the lifted fields -that solve for the moved states and stay positive at :math:`\theta_f = 0` give the limit along -every orbit. The implicit derivative needs :math:`J_x` regular: proven when :math:`\det J_x` has -one sign on :math:`\Theta`, else checked at random points. Without a lift, the resting state is -continuous when :math:`f` is affine in the states with a resting Jacobian of one sign at the face, -else it is checked at random face points; a checked resting state sets ``face_level`` and -``level`` of the block to ``checked``. +invariants lie where the solved entries are positive. Under declared bounds an entry without +positivity certificate is kept, with partial coverage, and listed under ``unproven``. Without bounds +it is kept only where no section is certified on the whole domain, and the transformation then +covers the orbits on which the ``sign_conditions``, the entries as inequalities in :math:`q`, hold. + +**Face sections.** A *face* is a boundary set :math:`\theta_f = 0`; a section on a face lies outside +:math:`\Theta` and is reached only in a limit. With :math:`\theta_f` as gauge coordinates, the +conditions above make every level set one orbit, and :math:`R(q, \theta_f) \to R(q, 0) > 0` puts the +face point in the closure of every orbit of :math:`\Lambda_q`. The output equals that at the face +point when the model is continuous there: no model expression has a pole at the face, and under +``equilibrate`` the resting state has a limit, shown by invariants of the generators lifted to the +resting variety, :math:`\xi_x = -J_x^{-1} J_\theta \xi_\theta`, proven where :math:`\det J_x` has +one sign on :math:`\Theta`, else checked at random face points (``face_level``). **Injectivity.** That every orbit meets the cross-section :math:`\mathcal{C}` at most once -(``injective``) is proven, for any number of generators, when the solved coordinates recover every -point of :math:`\mathcal{C}` from the invariants, :math:`\hat\theta(I(\theta)) = \theta` on -:math:`\mathcal{C}`, since two points of one orbit have equal invariants. The identity is shown -over :math:`\mathbb{Q}` on a parametrization of the positive points of :math:`\mathcal{C}`, -monomial where the section equates monomials, else by solving each equation for a coordinate of -degree one; the claim is made for sections with total coverage off a face. For one generator it -also holds when :math:`X` changes the pinned coordinate, or the logarithm of the quotient of the -two sides of the section equation, with one sign on :math:`\Theta`. +(``injective``) is proven when the solved coordinates recover every point of :math:`\mathcal{C}` +from the invariants, :math:`\hat\theta(I(\theta)) = \theta` on :math:`\mathcal{C}`, shown over +:math:`\mathbb{Q}` on a parametrization of the positive points of :math:`\mathcal{C}`. For one +generator it also holds when :math:`X` changes the pinned coordinate with one sign on +:math:`\Theta`. **Zero limits.** With ``zero_limits=True`` each block reports which coordinates can be set to zero: -everywhere, under a condition, or in a limit along the orbits when the face is mapped into itself -by the generators, and whether this is certain (``to_dict()["zero_compatibility"]``). +everywhere, under a condition, or in a limit along the orbits, and whether this is certain +(``to_dict()["zero_compatibility"]``). An unproven claim is listed under ``unproven`` of the block and makes the block ``open``; a block is ``verified`` or ``checked`` when a direction or a face resting state has that level, else @@ -181,39 +120,29 @@ detection again on the reduced model (``Reduction.checks["loop"]``). Unknown inputs -------------- -In a model with ``unknown_inputs`` :math:`w`, a direction changes the input -trajectory together with :math:`\theta` and the initial values, so a section in :math:`(\theta, -x_0)` gives the output of a point only with another input. The reduction keeps the inputs free and -proves, per direction, that they absorb the change, in one of two ways; a direction with neither -proof is not reduced, and the reason names the inputs. For a model with one condition, no events -and no ``equilibrate``, :math:`\dot x = f(x, \theta, w, u)`, output :math:`h(x, \theta)`, with the -time derivative :math:`D = f \cdot \partial_x`: - -*Inversion.* Suppose there are as many observables as unknown inputs, none reads an input, and the -matrix :math:`M = \partial_w D(h)` has a determinant that is not zero as a rational function. Let -:math:`(\hat\theta, \hat x_0, \hat w)`, :math:`\hat w` continuous, give the output :math:`\hat g` -on :math:`[0, T]` with :math:`\det M \ne 0` along the trajectory. Then every :math:`(\theta', -x_0')` with :math:`h(x_0', \theta') = \hat g(0)` gives :math:`\hat g` with an input :math:`w'` -wherever :math:`D(h)(x', \theta', w') = \dot{\hat g}` has a continuous solution :math:`w'` in the -domain of the inputs with a state :math:`x'` of :math:`\dot x' = f(x', \theta', w')`, -:math:`x'(0) = x_0'`, on :math:`[0, T]`; near :math:`(\hat\theta, \hat x_0)` it does. - -*Proof.* :math:`e(t) = h(x'(t), \theta') - \hat g(t)` has :math:`\dot e = D(h)(x', \theta', w') - -\dot{\hat g} = 0` and :math:`e(0) = 0`. Near the trajectory, the implicit function theorem solves -:math:`D(h)(x, \theta, w) = \dot{\hat g}(t)` for :math:`w = W(t, x, \theta)`, continuous in -:math:`t` and :math:`C^1` in :math:`(x, \theta)` on a neighborhood of the compact graph of -:math:`(\hat x, \hat\theta, \hat w)`, and the solution of :math:`\dot x = f(x, \theta, W)` -exists on :math:`[0, T]` for data near :math:`(\hat x_0, \hat\theta)` by continuous dependence. -:math:`\square` - -Every exact direction :math:`X` has :math:`X(h) = 0` at the start, the rows of order zero, so the -orbits of :math:`X` in :math:`(\theta, x_0)` keep :math:`h(x_0, \theta)`, and a section of the directions, chosen -as for a model without inputs, gives the output of every point under the condition above. - -*Pointwise lift.* Suppose the direction, up to a factor, has parameter components -:math:`\xi_\theta(\theta)`, state components :math:`\xi_x(\theta, x)` (the components on the -initial values read as functions of the states), and input components :math:`\xi_w(\theta, x, -w)` solved from the identities +In a model with ``unknown_inputs`` :math:`w`, a direction changes the input trajectory together with +:math:`\theta` and the initial values. The reduction keeps the inputs free and proves, per +direction, that they absorb the change, in one of two ways; a direction with neither proof is not +reduced. For a model with one condition, no events and no ``equilibrate``, :math:`\dot x = f(x, +\theta, w, u)`, output :math:`h(x, \theta)`, with :math:`D = f \cdot \partial_x`: + +*Inversion.* Suppose there are as many observables as unknown inputs, none reads an input, and +:math:`M = \partial_w D(h)` has a determinant that is not zero as a rational function. Let +:math:`(\hat\theta, \hat x_0, \hat w)` give the output :math:`\hat g` on :math:`[0, T]` with +:math:`\det M \ne 0` along the trajectory. Then every :math:`(\theta', x_0')` near +:math:`(\hat\theta, \hat x_0)` with :math:`h(x_0', \theta') = \hat g(0)` gives :math:`\hat g` with +some continuous input :math:`w'`. + +*Proof.* The implicit function theorem solves :math:`D(h)(x, \theta, w) = \dot{\hat g}(t)` for +:math:`w = W(t, x, \theta)` near the trajectory, the solution of :math:`\dot x = f(x, \theta, W)` +exists on :math:`[0, T]` by continuous dependence, and :math:`e = h(x', \theta') - \hat g` has +:math:`\dot e = 0`, :math:`e(0) = 0`. :math:`\square` + +Every exact direction keeps :math:`h(x_0, \theta)`, so a section chosen as without inputs gives the +output of every point under this condition. + +*Pointwise lift.* Suppose the direction has components :math:`\xi_\theta(\theta)`, +:math:`\xi_x(\theta, x)` and :math:`\xi_w(\theta, x, w)` with .. math:: :label: eq-input-lift @@ -221,32 +150,19 @@ w)` solved from the identities D(\xi_x) = V(f), \qquad V(h) = 0, \qquad V = \xi_\theta\, \partial_\theta + \xi_x\, \partial_x + \xi_w\, \partial_w , -over :math:`\mathbb{Q}`, and a given initial value :math:`x_0(\theta)` moves with the parameters, -:math:`\xi_x(\theta, x_0(\theta)) = \xi_\theta \cdot \partial_\theta x_0`. Let -:math:`\Phi_\varepsilon` be the flow of :math:`V`. On :math:`[0, T]` set :math:`\theta(\varepsilon)`, -:math:`x(t, \varepsilon)` and :math:`w(t, \varepsilon)` to the components of -:math:`\Phi_\varepsilon(\hat\theta, \hat x(t), \hat w(t))`; by compactness they exist for -:math:`|\varepsilon| < \varepsilon_0`, and :math:`(\theta, x)` follows the flow of -:math:`(\xi_\theta, \xi_x)`, which reads no input, so :math:`x` is :math:`C^1` in :math:`t`. Then -:math:`x(\cdot, \varepsilon)` solves the model with :math:`\theta(\varepsilon)` and the input -:math:`w(\cdot, \varepsilon)` and gives :math:`\hat g`. - -*Proof.* With :math:`R = \partial_t x - f(x, \theta, w)`, :math:`\partial_\varepsilon \partial_t x -= \partial_t \xi_x(\theta, x) = \partial_x \xi_x\, \partial_t x` and :math:`\partial_\varepsilon -f(x, \theta, w) = V(f) = D(\xi_x) = \partial_x \xi_x\, f`, so :math:`\partial_\varepsilon R = -\partial_x \xi_x\, R` with :math:`R(t, 0) = 0`, hence :math:`R = 0`; and :math:`\partial_\varepsilon -h(x, \theta) = V(h) = 0`. :math:`\square` - -The orbits of :math:`\xi_\theta` thus keep the output as long as the input stays in the domain of the inputs, -:math:`w > 0` where declared positive; near every point it does. The reduction removes the field -:math:`\xi_\theta` on the parameters, with the invariants, sections and coverage of the parameter -field; the initial values of the states and the inputs stay free in the reduced model. A lift with -:math:`\xi_w = 0` is a symmetry of the model, reduced as without inputs. ``Reduction.blocks`` holds -per block ``inputs``: the inputs, the proof (``"inversion"`` with the ``determinant``, or -``"lift"`` with the components), and the ``condition`` on the input and the trajectory, which the -report repeats. The section claims of the block, ``reach`` and ``injective``, are those of the -orbits of the field the reduction removes; that the section point gives the output rests on this -condition. +over :math:`\mathbb{Q}`, and a given initial value moves with the parameters. Then the flow of +:math:`V` applied to :math:`(\hat\theta, \hat x(t), \hat w(t))` gives, for small :math:`\varepsilon`, +a solution of the model with :math:`\theta(\varepsilon)` and the input :math:`w(\cdot, \varepsilon)` +and the output :math:`\hat g`. + +*Proof.* With :math:`R = \partial_t x - f(x, \theta, w)`, Equation :eq:`eq-input-lift` gives +:math:`\partial_\varepsilon R = \partial_x \xi_x\, R` with :math:`R(t, 0) = 0`, hence :math:`R = 0`, +and :math:`\partial_\varepsilon h = V(h) = 0`. :math:`\square` + +The reduction removes the field :math:`\xi_\theta` as long as the input stays in the domain of the +inputs; initial values and inputs stay free. ``Reduction.blocks`` holds per block ``inputs``: the +proof (``"inversion"`` with the ``determinant``, or ``"lift"`` with the components) and the +``condition`` on the input and the trajectory, on which the section claims rest. .. _red-branches: @@ -256,13 +172,10 @@ Branches of discrete symmetries For a reduction, each image of the fundamental domain under the maps is a *branch*. Where a map :math:`\sigma` has one hypersurface :math:`q = 0` as fixed set and exchanges the two sides of it, :math:`q(\sigma(\theta)) = -c\, q(\theta)` with :math:`c > 0` on :math:`\Theta`, the branches are -the sides :math:`s\, q > 0`, :math:`s = \pm 1`, named by the inequality, and :math:`q = 0` is their -boundary. On a side, :math:`\delta = s\, q(\theta) > 0` replaces a coordinate :math:`x` in which -:math:`q` is linear; :math:`x` is chosen by structure, a solution :math:`x(\delta, \theta')` with a -positivity certificate first, then the smaller expression, so that neither the chart nor the name of -the branch depends on the names or the order of the parameters. The chart maps free values in the -positive orthant into the side and is chained with the section of the continuous symmetries. It is -``injective`` where the coefficient of :math:`x` in :math:`q` has a sign certificate, since -:math:`\delta = s\, q(\theta)` inverts it, and it ``reach``-es the whole side where -:math:`x(\delta, \theta')` has a positivity certificate; a claim without certificate is listed -under ``unproven``. A fiber of more than two points has no branch charts. +the sides :math:`s\, q > 0`, :math:`s = \pm 1`. On a side, :math:`\delta = s\, q(\theta) > 0` +replaces a coordinate :math:`x` in which :math:`q` is linear, chosen by structure so that neither +the chart nor the name of the branch depends on the names of the parameters. The chart is chained +with the section of the continuous symmetries; it is ``injective`` where the coefficient of +:math:`x` in :math:`q` has a sign certificate, and it ``reach``-es the whole side where :math:`x(\delta, +\theta')` has a positivity certificate; a claim without certificate is listed under ``unproven``. A +fiber of more than two points has no branch charts.