Skip to content

Inequality ​

Wolfram's chained-comparison form -- v1 rel1 v2, v2 rel2 v3, ... all at once, letting the relation change partway through the chain (0 <= x < 5).

✓ checked against that system · ! checked, with disagreements (hover a chip)Wolfram LanguageInequality✓
Inequality(v1, rel1, v2, rel2, v3, ...)the conjunction of every consecutive link, where each relᵢ is one of Equal, NotEqual, Less, LessEqual, Greater, GreaterEqual.
Typed signatures
TypePackageApplies
(expression, expression, expression, expression*) -> booleananalyticalways

Domain: Relations

Details
  • A chain that uses the SAME relation throughout (0 < x < 5) is already Less or LessEqual etc. taking more than two arguments -- see those heads. Inequality exists for a chain that MIXES relations (0 <= x < 5), which compute-engine's own n-ary comparison heads don't represent.
  • Evaluates as the And of its pairwise links, applied through the relation heads compute-engine already ships -- so a fully numeric chain folds all the way to True/False, and a symbolic one is left as And of whatever didn't fold.
  • Round-trips with Wolfram, which prints exactly this shape whenever Reduce, FunctionDomain, or a mixed-relation input (0 <= x < 5) produces one -- see packages/wolfram/src/to-wolfram.ts.
  • Declines (leaves the call unevaluated) on a malformed chain -- an even argument count, or something other than one of the six relations in a relation slot.

Examples

Basic #

A numeric chain that holds -- 0 <= 2 and 2 < 5

live ↗
InInequality(0,LessEqual,2,Less,5)\mathrm{Inequality}(0, \mathrm{LessEqual}, 2, \mathrm{Less}, 5)OutTrue\mathrm{True}

A numeric chain that fails -- 0 <= 5 but not 5 < 5

live ↗
InInequality(0,LessEqual,5,Less,5)\mathrm{Inequality}(0, \mathrm{LessEqual}, 5, \mathrm{Less}, 5)OutFalse\mathrm{False}

A symbolic mixed chain simplifies to the And of its links

live ↗
InInequality(0,LessEqual,x,Less,5)\mathrm{Inequality}(0, \mathrm{LessEqual}, x, \mathrm{Less}, 5)Out0≤x∧x<50≤x∧x\lt5
Scope #

A homogeneous chain (same relation throughout) still goes through And here -- write it as Less(0, x, 5) directly for the native n-ary form

live ↗
InInequality(0,Less,x,Less,5)\mathrm{Inequality}(0, \mathrm{Less}, x, \mathrm{Less}, 5)Out0<x∧x<50\lt x∧x\lt5
Possible issues #
About
Examples7
Checked againstWolfram Language 7 agree
CrosswalkWolfram Language

See also: Less, LessEqual, FunctionDomain