Reference
Contents
Index
OpenSymbolicRules.UninterpretedHeadsOpenSymbolicRules.BuiltinBackendOpenSymbolicRules.CASProblemOpenSymbolicRules.ElementOfOpenSymbolicRules.OSRDispatchOpenSymbolicRules.OSRInferenceOpenSymbolicRules.OSRPieceOpenSymbolicRules.OSRProofOpenSymbolicRules.OSRProofStepOpenSymbolicRules.OSRRuleOpenSymbolicRules.OperationResultOpenSymbolicRules.PolynomialRootsResultOpenSymbolicRules.SATProblemOpenSymbolicRules.SMTProblemOpenSymbolicRules.SolveOptionsOpenSymbolicRules.SparsePolynomialOpenSymbolicRules.UnivariatePolynomialProblemCommonSolve.solveOpenSymbolicRules.AtomQOpenSymbolicRules.BinomialMatchQOpenSymbolicRules.BinomialQOpenSymbolicRules.ComplexFreeQOpenSymbolicRules.DistOpenSymbolicRules.EqQOpenSymbolicRules.FalseQOpenSymbolicRules.FractionQOpenSymbolicRules.FreeQOpenSymbolicRules.GeQOpenSymbolicRules.GeneralizedBinomialQOpenSymbolicRules.GeneralizedTrinomialQOpenSymbolicRules.GtQOpenSymbolicRules.HalfIntegerQOpenSymbolicRules.HyperbolicQOpenSymbolicRules.IGeQOpenSymbolicRules.IGtQOpenSymbolicRules.ILeQOpenSymbolicRules.ILtQOpenSymbolicRules.IndependentQOpenSymbolicRules.InertTrigQOpenSymbolicRules.IntegerQOpenSymbolicRules.IntegersQOpenSymbolicRules.IntegralFreeQOpenSymbolicRules.InverseFunctionFreeQOpenSymbolicRules.LeQOpenSymbolicRules.LinearMatchQOpenSymbolicRules.LinearQOpenSymbolicRules.LtQOpenSymbolicRules.MemberQOpenSymbolicRules.NeQOpenSymbolicRules.NegQOpenSymbolicRules.NotEqualOpenSymbolicRules.OddQOpenSymbolicRules.PerfectSquareQOpenSymbolicRules.PolyQOpenSymbolicRules.PolynomialQOpenSymbolicRules.PosQOpenSymbolicRules.PowerQOpenSymbolicRules.ProductQOpenSymbolicRules.QuadraticMatchQOpenSymbolicRules.QuadraticQOpenSymbolicRules.RationalQOpenSymbolicRules.SimpOpenSymbolicRules.SubstOpenSymbolicRules.SumQOpenSymbolicRules.TrigQOpenSymbolicRules.TrinomialQOpenSymbolicRules.TrueQOpenSymbolicRules.alpha_equivalentOpenSymbolicRules.assumingOpenSymbolicRules.assumptionsOpenSymbolicRules.beta_reduceOpenSymbolicRules.binder_bodyOpenSymbolicRules.bound_variablesOpenSymbolicRules.build_simplifierOpenSymbolicRules.canonicalOpenSymbolicRules.canonically_equalOpenSymbolicRules.decide_conditionOpenSymbolicRules.differentiateOpenSymbolicRules.discriminantOpenSymbolicRules.entailedOpenSymbolicRules.equality_modelOpenSymbolicRules.evaluated_derivativeOpenSymbolicRules.evaluated_limitOpenSymbolicRules.free_variablesOpenSymbolicRules.from_openmathOpenSymbolicRules.groebner_basisOpenSymbolicRules.is_integerOpenSymbolicRules.is_nonzeroOpenSymbolicRules.is_numericOpenSymbolicRules.is_symbolOpenSymbolicRules.limitOpenSymbolicRules.linear_modelOpenSymbolicRules.linear_satisfiableOpenSymbolicRules.linear_smt_modelOpenSymbolicRules.linear_smt_satisfiableOpenSymbolicRules.load_inference_profileOpenSymbolicRules.neq_readingOpenSymbolicRules.normalize_factOpenSymbolicRules.normalize_sqrtOpenSymbolicRules.occurs_freeOpenSymbolicRules.osr_collectionOpenSymbolicRules.osr_degreeOpenSymbolicRules.osr_numberOpenSymbolicRules.osr_substituteOpenSymbolicRules.piecewise_piecesOpenSymbolicRules.proveOpenSymbolicRules.rational_rootsOpenSymbolicRules.rational_smt_modelOpenSymbolicRules.rational_smt_satisfiableOpenSymbolicRules.resultantOpenSymbolicRules.rule_pathsOpenSymbolicRules.sat_modelOpenSymbolicRules.satisfiableOpenSymbolicRules.select_pieceOpenSymbolicRules.smt_modelOpenSymbolicRules.smt_satisfiableOpenSymbolicRules.squarefree_decompositionOpenSymbolicRules.statusOpenSymbolicRules.to_openmathOpenSymbolicRules.to_osrOpenSymbolicRules.to_sparse_polynomialOpenSymbolicRules.to_symbolic_polynomialOpenSymbolicRules.to_symbolicsOpenSymbolicRules.valueOpenSymbolicRules.verifiedSymbolicUtils.simplifyOpenSymbolicRules.@load_osrOpenSymbolicRules.@load_osr_profile
OpenSymbolicRules.BuiltinBackend — Type
The pure-Julia algorithms bundled with OpenSymbolicRules.jl.
OpenSymbolicRules.CASProblem — Type
Common problem, backend, and result types for CAS operations.
OpenSymbolicRules.ElementOf — Type
ElementOf(var, domain)The OSR form of a membership hypothesis: var lies in domain, which may be a DomainSets.jl domain, an IntervalSets.jl interval, or a Julia type. ∈ builds one for a symbolic term, and the domain predicates read it through entailed.
OpenSymbolicRules.OSRDispatch — Type
OSRDispatch(rules)A rewriter that applies rules to a term the way SymbolicUtils.Rewriters.Chain does — each rule in turn, threading the result — while skipping the rules whose pattern is headed by a different operation.
Selecting candidates costs one dictionary lookup instead of one matcher call per rule, which is what keeps a large rule set, such as the 6000 RUBI integration rules, usable.
OpenSymbolicRules.OSRInference — Type
OSRInferenceOne multi-premise inference declared by an Open Symbolic Rules inference manifest. Values remain JSON-compatible; applying an inference is the responsibility of the host proof engine.
OpenSymbolicRules.OSRPiece — Type
OSRPiece(value, condition)One branch of a Piecewise expression. A final Otherwise branch has no condition of its own, so its condition is nothing.
OpenSymbolicRules.OSRProof — Type
OSRProofThe outcome of an equivalence check. When verified, the two sides rewrite to a common normal_form along left_steps and right_steps, under assumptions.
Every OSR rule is an oriented instance of an equation, so the steps on the right read backwards give a derivation of right from normal_form, and the two chains together form a derivation of left = right.
OpenSymbolicRules.OSRProofStep — Type
OSRProofStep(rule, before, after)One licensed rewrite: rule turned the subterm before into after. A step is local, so it justifies the whole expression only together with congruence — which is exactly how a rewrite tactic works in a proof assistant.
OpenSymbolicRules.OSRRule — Type
OSRRule(name, description, provenance, rule)A callable SymbolicUtils rewrite rule annotated with its stable OSR identity:id and optional machine-readable provenance from the source rule.
OpenSymbolicRules.OperationResult — Type
OperationResultWhat a high-level operation reached, and how that reading should be taken.
An expression on its own cannot say whether it was proved, assumed, or simply not carried out — and an unknown result read as a proved equality is the one mistake this package is built to avoid. An OperationResult says which it is.
The readings are:
| status | meaning |
|---|---|
:proved | a closed form the rules established outright |
:conditional | a closed form, valid where the recorded assumptions hold |
:unevaluated | the operation is still standing in the value |
:inapplicable | the operation does not apply to this argument |
:divergent | the operation has no finite value here |
See status, value, and assumptions.
OpenSymbolicRules.PolynomialRootsResult — Type
Exact rational roots found for a univariate polynomial problem.
OpenSymbolicRules.SATProblem — Type
A propositional CNF formula whose literals use the DIMACS convention.
OpenSymbolicRules.SMTProblem — Type
A CNF problem with atoms owned by one built-in SMT theory.
OpenSymbolicRules.SolveOptions — Type
Resource and evidence requirements supplied to a CAS operation.
OpenSymbolicRules.SparsePolynomial — Type
Exact sparse multivariate polynomial primitives for algebraic backends.
OpenSymbolicRules.UnivariatePolynomialProblem — Type
An exact nonzero polynomial in one declared variable.
CommonSolve.solve — Method
solve(equation, variable; backend=BuiltinBackend(), options=SolveOptions())Solve the exact univariate rational-polynomial fragment of an Equation. The returned PolynomialRootsResult contains every rational root, its multiplicity, the unresolved residual factor, and whether the result is complete. Non-polynomial equations are rejected rather than approximated.
OpenSymbolicRules.AtomQ — Method
AtomQ(u)Return whether u has no arguments of its own.
OpenSymbolicRules.BinomialMatchQ — Method
BinomialMatchQ(u, x)Return whether u already has the shape a + b*x^n that the rules downstream pattern-match against.
OpenSymbolicRules.BinomialQ — Method
BinomialQ(u, x)
BinomialQ(u, x, n)Return whether u is written as a + b*x^n, with a, b, and the exponent all free of x, optionally of that exponent.
The degenerate forms count: x^n alone is one with a = 0 and b = 1.
This reads the written shape, where RUBI's BinomialQ first normalizes its argument. It therefore declines some expressions RUBI would accept — which leaves a rewrite unapplied rather than risking an invalid one — and makes it agree with BinomialMatchQ, so the normalization rules guarded by BinomialQ(u, x) && Not(BinomialMatchQ(u, x)) never fire.
OpenSymbolicRules.ComplexFreeQ — Method
ComplexFreeQ(u)Return whether u mentions no complex number.
OpenSymbolicRules.Dist — Method
Dist(u, v, x)Return u*v.
RUBI writes Dist[u, v, x] to push the factor u inside v, whether v is a sum or an integral. The value it denotes is u*v whichever it does, so the product is the whole of its meaning; only the shape of the answer differs, and that shape is what the rules downstream restore.
OpenSymbolicRules.EqQ — Method
EqQ(u, v)Return whether u and v are provably equal. Two closed arithmetic expressions are compared by value and two identical terms are equal by construction; nothing else counts as a proof, so an unproved equality is reported as false and the guarded rewrite is skipped.
OpenSymbolicRules.FalseQ — Method
FalseQ(u)Return whether u is literally the Boolean false.
OpenSymbolicRules.FractionQ — Method
FractionQ(us...)Return whether every argument is an exact rational number that is not an integer.
OpenSymbolicRules.FreeQ — Method
FreeQ(expr, var)Returns true if expr has no free occurrence of var. Equivalent to Mathematica's FreeQ, and used primarily to identify constants relative to an integration or differentiation variable.
Binders are respected: an occurrence bound by an enclosing Lambda, Forall, or Exists is not an occurrence of the free variable, so Lambda(x, Sin(x)) is free of x.
Either side may be a collection. A quantifier binds a list, so var may be the whole binder and the predicate then asks about every variable it declares; and RUBI writes FreeQ[{a, b, m}, x], so expr may be a list whose every element must be free of the variable. When var is neither a variable nor a collection, expr is searched for it structurally instead.
OpenSymbolicRules.GeQ — Method
GeQ(u, v)
GeQ(u, v, w)Return whether the real values of the arguments are non-increasing.
OpenSymbolicRules.GeneralizedBinomialQ — Method
GeneralizedBinomialQ(u, x)
GeneralizedBinomialMatchQ(u, x)Return whether u is written as a*x^q + b*x^n, with a, b, q, and n free of x and the two exponents distinct.
Two power terms with no constant one is what separates this from an ordinary binomial a + b*x^n.
OpenSymbolicRules.GeneralizedTrinomialQ — Method
GeneralizedTrinomialQ(u, x)
GeneralizedTrinomialMatchQ(u, x)Return whether u is written as a*x^q + b*x^n + c*x^(2n-q), with a, b, c, q, and n free of x.
The third exponent standing at 2n - q is what distinguishes it from any three-power sum, and the ordinary trinomial is the case q = 0.
OpenSymbolicRules.GtQ — Method
GtQ(u, v)
GtQ(u, v, w)Return whether the real values of the arguments are strictly decreasing, so GtQ(u, v, w) means u > v > w. Arguments that are not closed real expressions make the predicate false.
OpenSymbolicRules.HalfIntegerQ — Method
HalfIntegerQ(us...)Return whether every argument is an odd multiple of one half.
OpenSymbolicRules.HyperbolicQ — Method
HyperbolicQ(u)Return whether u is a hyperbolic function, or an application of one.
OpenSymbolicRules.IGeQ — Method
IGeQ(u, n)Return whether u is an integer greater than or equal to n.
OpenSymbolicRules.IGtQ — Method
IGtQ(u, n)Return whether u is an integer strictly greater than n.
OpenSymbolicRules.ILeQ — Method
ILeQ(u, n)Return whether u is an integer less than or equal to n.
OpenSymbolicRules.ILtQ — Method
ILtQ(u, n)Return whether u is an integer strictly less than n.
OpenSymbolicRules.IndependentQ — Method
IndependentQ(u, x)Return whether u is free of x. RUBI's other spelling of FreeQ.
OpenSymbolicRules.InertTrigQ — Method
InertTrigQ(u...)Return whether every argument is one of RUBI's inert circular heads, spelled in lower case to keep it from being evaluated.
OpenSymbolicRules.IntegerQ — Method
IntegerQ(u)Return whether u is provably an integer, either by value or by hypothesis.
OpenSymbolicRules.IntegersQ — Method
IntegersQ(us...)Return whether every argument is provably an integer.
OpenSymbolicRules.IntegralFreeQ — Method
IntegralFreeQ(u)Return whether u leaves no unsolved integral inside it.
OpenSymbolicRules.InverseFunctionFreeQ — Method
InverseFunctionFreeQ(u, x)Return whether u contains no inverse function of x.
A logarithm or an inverse circular or hyperbolic function is only in the way when it involves x: Log(a) leaves an integrand alone, Log(x) does not.
OpenSymbolicRules.LeQ — Method
LeQ(u, v)
LeQ(u, v, w)Return whether the real values of the arguments are non-decreasing.
OpenSymbolicRules.LinearMatchQ — Method
LinearMatchQ(u, x)Return whether u is already written in the shape a + b*x, with a and b free of x.
RUBI distinguishes being linear from being written linearly. LinearQ asks about the degree; this asks whether the expression already has the shape the rules downstream pattern-match against. The pair drives the normalization rules, which fire exactly when something is linear but not yet in that shape, so reading this as a second spelling of LinearQ would make those rules loop.
A collection is read the way FreeQ reads one: every element must match.
OpenSymbolicRules.LinearQ — Method
LinearQ(u, x)Return whether u is a polynomial of degree one in x.
OpenSymbolicRules.LtQ — Method
LtQ(u, v)
LtQ(u, v, w)Return whether the real values of the arguments are strictly increasing.
OpenSymbolicRules.MemberQ — Method
MemberQ(collection, u)Return whether u occurs in collection, which may be a Julia collection or a canonical List term.
OpenSymbolicRules.NeQ — Method
NeQ(u, v)Return whether u and v are provably different. Symbolic terms are not unequal merely because their structures differ: without a proof the predicate returns false and the guarded rewrite is skipped.
OpenSymbolicRules.NegQ — Method
NegQ(u)Return whether u is provably negative, either by value or by hypothesis.
OpenSymbolicRules.NotEqual — Method
NotEqual(a, b)Predicate to check whether an inequality is established. This is the OSR spelling of RUBI's NeQ and shares its conservative semantics.
OpenSymbolicRules.OddQ — Method
OddQ(u)Return whether u is an odd integer.
OpenSymbolicRules.PerfectSquareQ — Method
PerfectSquareQ(u)Return whether u is provably a perfect square: a positive rational whose square root is rational, or a power with an even exponent.
Anything else answers false, which leaves the guarded rewrite unapplied rather than claiming a root that was not established.
OpenSymbolicRules.PolyQ — Method
PolyQ(u, x)
PolyQ(u, x, n)Return whether u is a polynomial in x, optionally of degree exactly n.
OpenSymbolicRules.PolynomialQ — Method
PolynomialQ(u, x)Return whether u is a polynomial in x.
OpenSymbolicRules.PosQ — Method
PosQ(u)Return whether u is provably positive, either by value or by hypothesis.
OpenSymbolicRules.PowerQ — Method
PowerQ(u)Return whether u is a canonical Power term.
OpenSymbolicRules.ProductQ — Method
ProductQ(u)Return whether u is a canonical Multiply term.
OpenSymbolicRules.QuadraticMatchQ — Method
QuadraticMatchQ(u, x)Return whether u is written as a + b*x + c*x^2, with a, b, and c free of x. The squared term must be there; the others may be absent.
OpenSymbolicRules.QuadraticQ — Method
QuadraticQ(u, x)Return whether u is a polynomial of degree two in x.
OpenSymbolicRules.RationalQ — Method
RationalQ(us...)Return whether every argument is an exact rational number. A floating-point value is not exact and is therefore rejected.
OpenSymbolicRules.Simp — Method
Simp(u)
Simp(u, x)Return u.
The corpus writes both arities: Simp[u] 200 times and Simp[u, x] 518 times.
RUBI writes Simp[u, x] for "u, tidied up with respect to x". Tidying is optional: the expression it names is u either way, so returning u is exact rather than approximate, and the rewrite that produced it stays valid.
What matters is that it is not an inert head. A rule whose result is wrapped in an uninterpreted Simp can never be matched by the rule that should come next, which stops the rewrite chain after one step — two thirds of the problems that stalled in section 1.1.1 stalled on Simp or ExpandIntegrand.
ExpandIntegrand is deliberately not given the same reading. It too denotes an expression equal to its argument, but Int(ExpandIntegrand(u, x), x) would then become the integral it came from, and the rewrite would not terminate.
OpenSymbolicRules.Subst — Method
Subst(expression, variable, replacement)Substitute variable by replacement in expression.
This is the operational reading required by OSR-E-012 for the Subst utility head emitted by integration rules. It delegates to osr_substitute, so lexical binders are respected and a replacement cannot be captured by a lambda, quantifier, or other OSR binder.
OpenSymbolicRules.SumQ — Method
SumQ(u)Return whether u is a canonical Add term.
OpenSymbolicRules.TrigQ — Method
TrigQ(u)Return whether u is a circular function, or an application of one.
OpenSymbolicRules.TrinomialQ — Method
TrinomialQ(u, x)
TrinomialMatchQ(u, x)Return whether u is written as a + b*x^n + c*x^(2n), with a, b, c, and n free of x.
The second exponent being twice the first is what distinguishes a trinomial from any three-term sum. Like BinomialQ, this reads the written shape where RUBI normalizes first, so the two spellings agree.
OpenSymbolicRules.TrueQ — Method
TrueQ(u)Return whether u is the truth value, which is how RUBI reads an unset flag such as $UseGamma. Anything else, symbol or number, is not.
OpenSymbolicRules.alpha_equivalent — Method
alpha_equivalent(left, right)Return whether two expressions are equal up to a consistent renaming of their bound variables. Free variables are compared by name.
julia> using OpenSymbolicRules, SymbolicUtils
julia> @syms x y;
julia> OpenSymbolicRules.alpha_equivalent(Lambda(x, Sin(x)), Lambda(y, Sin(y)))
trueOpenSymbolicRules.assuming — Method
assuming(f, assumptions...)Executes a function f within a context where the provided assumptions hold true. Useful for providing local hypotheses to the CAS.
Example:
assuming(x > 0) do
simplify(Abs(x), rules)
endOpenSymbolicRules.assumptions — Method
assumptions(result)Return the facts a :conditional result was reached under, and nothing for the other readings.
OpenSymbolicRules.beta_reduce — Method
beta_reduce(expression)Carry out every Apply(Lambda(variable, body), argument) in expression, replacing it with body with argument put for variable.
The OSR expression grammar requires a head to be a name (OSR-X-004), so a lambda cannot stand in head position and an application needs a head of its own. That is what Apply is for, and reducing it is the capture-avoiding substitution osr_substitute already performs.
A rule set that differentiates term by term needs this: the structural rules return a lambda whose body applies the lambdas the base rules returned, and without reduction the answer keeps them nested instead of composing. An application whose head is not a lambda is left alone, because the rule that will produce one may not have fired yet.
julia> using OpenSymbolicRules, SymbolicUtils
julia> @syms x y;
julia> beta_reduce(Apply(Lambda(x, Sin(x)), y))
Sin(y)OpenSymbolicRules.binder_body — Method
binder_body(expr)Return the body a binder term scopes over.
OpenSymbolicRules.bound_variables — Method
bound_variables(expr)Return the variable names the binder term expr introduces, or nothing when expr binds nothing.
OpenSymbolicRules.build_simplifier — Method
build_simplifier(rules::AbstractVector)Builds a fixed-point bottom-up rewriter from a vector of SymbolicUtils rules. Rules are applied through an OSRDispatch, which skips the rules whose pattern is headed by a different operation than the term at hand.
OpenSymbolicRules.canonical — Method
canonical(expression)Return a deterministic normal form of expression.
Normalizing is not evaluating. It folds what is already closed, drops what does nothing, and fixes an order where one is sound; it never decides anything the expression left open, and a head this package does not evaluate keeps its place with its operands normalized.
What it does:
- evaluates a closed arithmetic subterm exactly, so
x^(3 - 1)becomesx^2and a correct answer stops reading as a wrong one; - writes a rational whose denominator is one as that integer;
- drops an identity operand —
x + 0,x * 1,x^1— which is sound for every additive group and every multiplicative monoid, matrices included; - orders the summands of a sum, addition being commutative wherever it is defined.
What it deliberately does not do:
- reorder the factors of a product. An OSR expression carries no shape information, so a factor may be a matrix or a tensor and the order is part of the meaning;
- turn
x^0into1, which holds only wherexis nonzero; - change precedence, associativity, or the domain of anything.
canonical is idempotent.
OpenSymbolicRules.canonically_equal — Method
canonically_equal(left, right)Return whether two expressions have the same normal form.
This is a structural test after normalization, not a proof of mathematical equality: two expressions that differ only in what canonical deliberately leaves alone still compare unequal.
OpenSymbolicRules.decide_condition — Method
decide_condition(condition)Decide a Piecewise condition, returning true, false, or nothing when it is undecided.
A condition is decided when it is a Boolean literal, when it is a relation over closed arithmetic expressions, or when it — or its negation — is an active hypothesis. And, Or, and Not combine those answers with three-valued logic, so a conjunction with one false operand is false even when the other is unknown.
OpenSymbolicRules.differentiate — Method
differentiate(expression, variable, rules)Differentiate expression with respect to variable using an OSR rule set.
Derivative binds its variable in a Lambda, as the OpenMath fns1#lambda symbol prescribes, so this builds Derivative(Lambda(variable, expression)), rewrites it with rules, and returns the body of the lambda it reaches. There is no second expression tree: the argument and the answer are the one canonical OSR representation throughout.
An operation the rule set cannot carry out stays a Derivative term. That is an unevaluated expression rather than a closed form nobody reached, and evaluated_derivative says which one came back.
mode = :status returns an OperationResult instead: the value beside the reading it should be given, so an unevaluated operation cannot be mistaken for a proved equality.
julia> rules = @load_osr_profile("path/to/Calculus");
julia> differentiate(Sin(x), x, rules)
Cos(x)The example is not a doctest: it needs the Calculus rule set, which lives in its own repository and is not checked out beside the package by default.
OpenSymbolicRules.discriminant — Method
discriminant(polynomial) -> Rational{BigInt}Return the exact discriminant of a nonzero univariate rational polynomial. The value is computed from the Sylvester resultant with its formal derivative, so it is zero exactly when the polynomial has a repeated root over an algebraic closure. Constants and linear polynomials have discriminant one.
OpenSymbolicRules.entailed — Method
entailed(subject, property)Return whether the hypotheses in scope prove property of subject.
Each hypothesis is asked on its own, so the answer is sound but does not combine two hypotheses into a third: x ∈ ℤ proves integrality and x > 0 proves positivity, yet neither alone proves that x is a positive integer.
OpenSymbolicRules.equality_model — Method
equality_model(constraints) -> Union{Dict{Symbol,Symbol}, Nothing}Return the equivalence-class representative for every term occurring in a satisfiable ground equality problem, or nothing if its disequalities contradict the equality closure. The returned map is a checkable model for the equality theory: equal terms have equal representatives.
OpenSymbolicRules.evaluated_derivative — Method
evaluated_derivative(expression)Return whether expression holds no Derivative still waiting to be carried out.
OpenSymbolicRules.evaluated_limit — Method
evaluated_limit(expression)Return whether expression holds no Limit still waiting to be taken.
OpenSymbolicRules.free_variables — Method
free_variables(expr)Return the names that occur free in expr. A name bound by an enclosing Lambda, Forall, or Exists is not free.
julia> using OpenSymbolicRules, SymbolicUtils
julia> @syms x y;
julia> OpenSymbolicRules.free_variables(Lambda(x, Add(x, y)))
Set{Symbol} with 1 element:
:yOpenSymbolicRules.from_openmath — Function
from_openmath(object)Convert a typed OpenMath object into an OSR/SymbolicUtils expression. This function is available when the optional OpenMath.jl extension is loaded.
OpenSymbolicRules.groebner_basis — Method
groebner_basis(generators; ordering=:grevlex)Compute a reduced Gröbner basis with Buchberger's algorithm over the rational coefficient field. This pure-Julia reference implementation prioritizes exact results and traceable invariants over large-system performance.
OpenSymbolicRules.is_integer — Method
is_integer(x)Predicate to check if x is an integer, by value or by hypothesis.
OpenSymbolicRules.is_nonzero — Method
is_nonzero(x)Returns whether x is provably nonzero. For symbolic values, this requires an explicit IsNonzero(x) assumption or a sign assumption; an unknown value is deliberately not treated as nonzero.
OpenSymbolicRules.is_numeric — Method
is_numeric(x)Predicate to check if x denotes a numeric constant. A closed arithmetic expression such as Add(1, 2) is numeric; an expression containing a symbol is not.
OpenSymbolicRules.is_symbol — Method
is_symbol(x)Return whether x is a variable rather than a compound expression or a literal.
A rule that binds a variable of the problem — the variable of an integral, a derivative, a sum, or a limit — is valid only when that operand really is a variable. RUBI writes this restriction as Int[integrand, x_Symbol], and a rule that loses it is unsound rather than merely incomplete: Int[x_^m_., x_Symbol] without it matches a constant integrand and returns a closed form that is not its antiderivative.
OpenSymbolicRules.limit — Method
limit(expression, variable, point, rules; direction=BothSides)Take the limit of expression as variable approaches point, using an OSR rule set.
Limit carries its point, its approach, and a lambda-bound expression, so this assembles Limit(point, direction, Lambda(variable, expression)) and rewrites it. The arguments are taken in the order a reader expects rather than the order the term stores them.
A limit the rule set does not cover stays a Limit term, which is the honest answer: no value was established.
OpenSymbolicRules.linear_model — Method
linear_model(constraints) -> Union{Dict{Symbol,Rational{BigInt}}, Nothing}Return an exact rational model for a satisfiable conjunction of linear constraints, or nothing if it is inconsistent. The model is reconstructed from the Fourier–Motzkin elimination layers and satisfies strict bounds without floating point approximation.
OpenSymbolicRules.linear_satisfiable — Method
linear_satisfiable(constraints) -> BoolDecide conjunctions of linear constraints over exact rational arithmetic using Fourier–Motzkin elimination. A constraint represents Σ coefficients[variable] * variable relation bound, where relation is one of :le, :lt, or :eq. Strict inequalities are preserved exactly.
This is a theory solver for a future pure-Julia DPLL(T) engine; it does not use floating point arithmetic, a native library, or an external SMT process.
OpenSymbolicRules.linear_smt_model — Method
linear_smt_model(clauses, atoms) -> Union{NamedTuple, Nothing}Return a checkable model for a satisfiable linear DPLL(T) problem. The result has booleans, a DIMACS-variable assignment, and rationals, the exact rational assignment for the selected linear-theory branch. Return nothing when the problem is unsatisfiable.
OpenSymbolicRules.linear_smt_satisfiable — Method
linear_smt_satisfiable(clauses, atoms) -> BoolDecide a propositional CNF formula whose atoms are exact rational linear constraints. clauses uses DIMACS literals and atoms maps each positive atom number to a LinearConstraint. The solver combines the local pure-Julia DPLL search with Fourier–Motzkin theory consistency checks.
Negated equality is expanded exactly into its strict-less-than and strict-greater-than theory branches.
OpenSymbolicRules.load_inference_profile — Method
load_inference_profile(root, profile)Load the structured multi-premise inferences declared by a named OSR inference profile. This function does not execute inferences.
OpenSymbolicRules.neq_reading — Method
neq_reading()
neq_reading!(reading)Read, or select, how NeQ answers when neither equality nor inequality was established.
:proved_distinct, the default, answers false: a predicate answers true only when the property is established, so an unproved inequality leaves its rewrite unapplied.
:not_proved_equal answers true instead, which is how RUBI reads the same guard. NeQ[m, -1] then holds for a symbolic m, on the reading that the rule it guards is valid wherever m is not -1 and that the case m == -1 is caught by an earlier rule in the ordered profile. That is a different and weaker claim, and the rewrites it admits are conditional on an assumption nobody recorded, so it is off by default. It exists because the choice between the two readings has a measurable cost that is better decided with numbers than by argument.
Either reading still refuses to call provably equal things different.
OpenSymbolicRules.normalize_fact — Method
normalize_fact(fact)Return the OSR facts a hypothesis stands for.
A host may spell a membership hypothesis in its own type — Symbolics.jl builds a VarDomainPairing for x ∈ 2..5 once it is loaded — so a hypothesis is normalised to ElementOf when it enters the context, and the entailment rules then only ever see OSR facts.
OpenSymbolicRules.normalize_sqrt — Method
normalize_sqrt(value)Construct an exact OSR square-root expression for a numeric integer or rational literal. Perfect squares become exact numbers; otherwise a bounded perfect square factor is extracted and the remaining Sqrt head retains the OpenMath arith1#root semantics. Negative and nonnumeric values remain unevaluated.
OpenSymbolicRules.occurs_free — Method
occurs_free(expr, name)Return whether name occurs free in expr. This answers the single question FreeQ asks without materialising the whole free-variable set, and it stops at the first free occurrence.
OpenSymbolicRules.osr_collection — Method
osr_collection(expr)Return the elements of a collection expression, or nothing when expr is not one. SymbolicUtils keeps a vector of plain values as a literal but wraps a vector holding symbolic expressions in an array_literal term, so a collection reaches this library in either shape.
OpenSymbolicRules.osr_degree — Method
osr_degree(expr, variable)Return the degree of expr as a polynomial in variable, or nothing when expr is not a polynomial built from canonical arithmetic heads. A subterm free of variable is a coefficient of degree zero, whatever its own shape.
OpenSymbolicRules.osr_number — Method
osr_number(expr)Return the exact numeric value of a closed OSR arithmetic expression, or nothing when expr still contains a symbol, uses a head with no arithmetic meaning, or does not denote a number at all.
julia> using OpenSymbolicRules
julia> OpenSymbolicRules.osr_number(Power(2, -1))
1//2
julia> OpenSymbolicRules.osr_number(Add(1, 2))
3OpenSymbolicRules.osr_substitute — Method
osr_substitute(expr, variable => replacement)Substitute replacement for the free occurrences of variable in expr. The substitution is capture-avoiding: a binder whose variable occurs free in replacement is alpha-renamed first, so the replacement keeps referring to the same variable it did outside the binder.
julia> using OpenSymbolicRules, SymbolicUtils
julia> @syms x y;
julia> OpenSymbolicRules.osr_substitute(Lambda(y, Add(x, y)), x => y)
Lambda(y1, Add(y, y1))OpenSymbolicRules.piecewise_pieces — Method
piecewise_pieces(expr)Return the branches of a Piecewise expression in declaration order, or nothing when expr is not a piecewise.
OpenSymbolicRules.prove — Method
prove(left, right, rules; assumptions=nothing)
prove(equation, rules; assumptions=nothing)Search for a rewrite path between two expressions and return the OSRProof that records it.
Both sides are normalised with rules and the normal forms are compared up to a renaming of bound variables, so the search succeeds exactly when the two sides are joinable by the rule set. This is sound but incomplete: a rule set that is not confluent may fail to join two equivalent expressions, which is why a failure is reported as unproved rather than as a disproof.
@syms x
rules = @load_osr_profile("path/to/Trigonometry")
proof = prove(Add(Power(Sin(x), 2), Power(Cos(x), 2)), 1, rules)
verified(proof) # trueOpenSymbolicRules.rational_roots — Method
rational_roots(polynomial) -> Vector{NamedTuple}Return every rational root of a nonzero univariate rational polynomial and its exact multiplicity. Irreducible factors of degree greater than one are omitted; this function never approximates algebraic or transcendental roots.
OpenSymbolicRules.rational_smt_model — Method
rational_smt_model(clauses, atoms) -> Union{NamedTuple, Nothing}Return Boolean and exact rational witnesses for rational_smt_satisfiable. The Boolean assignments use the caller's equality/disequality atom semantics, not the internal equality normalization.
OpenSymbolicRules.rational_smt_satisfiable — Method
rational_smt_satisfiable(clauses, atoms) -> BoolDecide a DPLL(T) problem containing exact rational linear atoms and equality or disequality atoms over the same rational variables. Equality atoms are translated to x - y = 0; disequality atoms are translated with the exact strict-order branching already used by the linear theory. This entry point is not for uninterpreted equality terms, which belong to smt_satisfiable.
OpenSymbolicRules.resultant — Method
Return the exact Sylvester resultant of two univariate rational polynomials.
OpenSymbolicRules.rule_paths — Method
rule_paths(root; profile=nothing)Return the ordered rewrite manifests declared by an OSR repository or its rules directory. With profile, return the named rewrite profile.
OpenSymbolicRules.sat_model — Method
sat_model(clauses) -> Union{Dict{Int,Bool}, Nothing}Return a Boolean model for a satisfiable DIMACS CNF formula, or nothing when it is unsatisfiable. The returned dictionary is a directly checkable witness: every input clause contains at least one literal whose variable has the stated truth value.
OpenSymbolicRules.satisfiable — Method
satisfiable(clauses) -> BoolDecide a propositional CNF formula using a pure-Julia DPLL implementation. Each inner vector is a disjunction and the outer vector is a conjunction. Literals use the DIMACS convention: positive n denotes variable n, and negative -n denotes its negation. Literal zero is invalid.
This is deliberately a SAT foundation, not a claim to support all SMT theories. It is the Boolean kernel on which a pure-Julia DPLL(T) layer can add equality, rational arithmetic, and other theory solvers with explicit proof evidence.
OpenSymbolicRules.select_piece — Method
select_piece(expr)Reduce a Piecewise expression to the value of the branch that applies, or return it unchanged when the applicable branch is not settled.
Branches are examined in order. A branch is taken once its condition is decided true and every earlier condition is decided false; an undecided condition stops the search, because a later branch may not overtake one that might yet apply.
OpenSymbolicRules.smt_model — Method
smt_model(clauses, atoms) -> Union{NamedTuple, Nothing}Return a checkable model for CNF clauses over ground equality atoms. The result contains the Boolean booleans assignment and the equality classes map, or nothing when the problem is unsatisfiable.
OpenSymbolicRules.smt_satisfiable — Method
smt_satisfiable(clauses, atoms) -> BoolDecide CNF Boolean clauses over ground equality atoms. Clauses use DIMACS literals and atoms maps each positive number to an EqualityConstraint. This is a pure-Julia DPLL(T) entry point for the equality theory.
OpenSymbolicRules.squarefree_decomposition — Method
squarefree_decomposition(polynomial) -> Vector{NamedTuple}Factor a nonzero univariate rational polynomial into monic square-free factors and their positive multiplicities. The scalar leading coefficient is omitted: the returned factors describe the root structure exactly over an algebraic closure and can be used directly by exact factorization or solving backends.
OpenSymbolicRules.status — Method
status(result)Return how a result should be read: one of :proved, :conditional, :unevaluated, :inapplicable, or :divergent.
OpenSymbolicRules.to_openmath — Function
to_openmath(expression)Convert an OSR/SymbolicUtils expression into a typed OpenMath object. This function is available when the optional OpenMath.jl extension is loaded.
OpenSymbolicRules.to_osr — Function
to_osr(expr)Converts Symbolics.jl operations into OpenSymbolicRules.jl pedagogical format. Requires loading Symbolics first (using Symbolics).
OpenSymbolicRules.to_sparse_polynomial — Method
to_sparse_polynomial(expression, variables) -> SparsePolynomialConvert a SymbolicUtils expression to an exact polynomial over ℚ. Variables are explicitly named to prevent accidental conversion of parameters or non-polynomial subexpressions. Only addition, multiplication, non-negative integer powers, and exact rational coefficients are admitted.
OpenSymbolicRules.to_symbolic_polynomial — Method
to_symbolic_polynomial(polynomial, variables)Rebuild a SymbolicUtils expression from an exact sparse polynomial. The map must associate every polynomial variable name with its symbolic expression.
OpenSymbolicRules.to_symbolics — Function
to_symbolics(expr)Converts OpenSymbolicRules.jl pedagogical format back into Symbolics.jl operations. Requires loading Symbolics first (using Symbolics).
OpenSymbolicRules.value — Method
value(result)Return the expression a result reached. For an :unevaluated result that is the operation still standing, not a closed form.
OpenSymbolicRules.verified — Method
verified(proof)Return whether a rewrite path between the two sides was found.
A verified proof is sound: every step is a rule application whose constraints held where it fired. An unverified one is not a disproof — the rule set may simply lack the path — so the two sides are reported as unproved rather than unequal.
SymbolicUtils.simplify — Method
simplify(expr, rules::AbstractVector; mode::Symbol=:fast, on_step=nothing)Applies a set of OSR rules to an expression until it stops changing. Supported modes:
:fast: standard execution (default). Returns the result.:trace: returns a tuple(result, steps_array)where each step is a NamedTuple(rule, before, after).
Set on_step to a callback to observe each rewrite without requiring output from this library. Rules loaded by @load_osr are OSRRule values, so trace steps expose their stable name and human-readable description.
OpenSymbolicRules.@load_osr — Macro
@load_osr("path/to/rule.json")Load an Open Symbolic Rules JSON file at compile-time and return a vector of SymbolicUtils.jl rules.
OpenSymbolicRules.@load_osr_profile — Macro
@load_osr_profile("repository/path"[, :profile])Compile the complete default or named rewrite manifest of an OSR repository. The repository path is relative to the caller source file.
OpenSymbolicRules.UninterpretedHeads — Module
UninterpretedHeadsSymbolic functions standing for OSR operations this package does not evaluate.
An operator a rule file declares carries an OpenMath symbol, so it denotes a definite mathematical operation; when no implementation of it is reachable, what is missing is the evaluation, not the meaning. Such a head becomes a symbolic function here rather than in the module that loaded the rule file, so loading a rule file introduces no name into the caller's scope and shadows nothing.
See also the Internal reference for developer helpers.