$Assumptions¶
Status: Stable
documented, exercised by the test suite and/or worked examples, with no known limitations recorded.
Description¶
$Assumptions
is the default setting for the Assumptions option used in Simplify and other functions that take assumptions.
Notes
$Assumptions defaults to True (no assumptions). Functions like Assuming temporarily extend $Assumptions for the duration of their body.Examples (7)¶
Every input below was run against the current Mathilda build and its output recorded.
Basic examples (1)¶
Applications (6)¶
The default: no assumptions in force
Assuming extends $Assumptions for the body
A positional assumption is conjoined with $Assumptions
Simplify reads the extended $Assumptions
A direct rebinding, which is what Assuming desugars to
Conjunction of facts, consumed per symbol
Implementation notes¶
Algorithm. $Assumptions is a global assumption store, not a builtin. In
simp_init it is given an OwnValue defaulting to True
(symtab_add_own_value("$Assumptions", ...)). Simplify and Element read it via
read_dollar_assumptions, which fetches the OwnValue's replacement directly
(symtab_get_own_values) and deep-copies it rather than evaluating it — evaluating
would re-fire the rule and, for a bound Element[x, Reals], cause Element to
recurse. Assuming extends it by desugaring to Block[{$Assumptions =
$Assumptions && a}, body]. The accumulated expression is parsed into an
AssumeCtx fact set by assume_ctx_from_expr (simp_assume.c), which flattens
And/List conjunctions and splits Element[{...}, dom] into per-variable facts.
Data structures. A single OwnValue Rule on the $Assumptions symbol in the
symbol table; consumed as an AssumeCtx (flat Expr* fact array) during
simplification.
- A system symbol with default
OwnValueTrue(no assumptions).Assumingtemporarily extends$Assumptionsfor the duration of its body.
Attributes: none registered.
References¶
- Source:
src/simp/simp.c - Specification:
docs/spec/builtins/simplification.md
Notes & additional examples¶
Notes¶
$Assumptions is a global symbol — the default setting for the Assumptions option used by
Simplify, Refine, Element and the other functions that take assumptions. It is not a
builtin; it carries an OwnValue that defaults to True (no assumptions). The consumers
read its value directly rather than evaluating it, so a bound fact such as
Element[x, Reals] does not re-fire while being read.
Assuming[fact, body] temporarily extends it — effectively
Block[{$Assumptions = $Assumptions && fact}, body] — so nested Assuming calls compose and
the rebinding is restored on exit. The accumulated value is flattened into a per-variable fact
set when a consumer needs it. The precedence a consumer applies is uniform: a positional
assumption is conjoined with $Assumptions, whereas an explicit Assumptions -> X option
replaces it.