# Rational equation check

`rational-equation-check` · version 1.0.0 · Numbers & math · free, no key needed

Check a chained claim like 1/2 + 1/3 = 5/6 < 1 exactly; returns the first false relation or division by zero.

**Use when you need to: verify a chain of fraction equalities · check an equation between fraction expressions · is this fraction identity true.**

## Decide before calling

Read the [versioned contract](/v1/tools/rational-equation-check/versions/1.0.0) and the supported scope below. Reuse `rational-equation-check@1.0.0` when your input, required output and limits match it. Choose another approach for an unsupported operation.

## Explain the choice

"I can use `rational-equation-check@1.0.0` for verify a chain of fraction equalities. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."

## Supported

- verify a chain of fraction equalities
- check an equation between fraction expressions
- is this fraction identity true
- validate an inequality between fractions exactly
- check each step of a fraction equation chain
- confirm egyptian fraction decomposition
- אימות שוויון בין ביטויי שברים

## Not supported

- solving for an unknown
- approximate (≈) or tolerance-based comparison
- decimal literals or exponents
- symbolic identities with variables

## Behavior

- Reference: ISO/IEC 10967-2:2001 (LIA-2) exact-result terminology; exact arithmetic over the rationals with canonical reduced form; RFC 8259 sec. 6 integer grammar and sec. 7 strings.
- equation := expr (REL expr)+ with REL = != < <= > >= or U+2260, U+2264, U+2265; a REL b REL c means (a REL b) and (b REL c). ==, =>, =< and relations inside parentheses are invalid_input.
- Each expr uses the integer/fraction grammar of rational-expression-check: + - * / ( ), unary minus, RFC 8259 int literals, U+2212 U+00D7 U+00F7 accepted, positions as 0-based code point offsets.
- Check order: the whole equation is tokenised and parsed first (errors); then segments are evaluated left to right and, after segment i, link i - 1 is checked. The first division_by_zero or relation_false stops the check.
- relation_false reports segment_index (right side), link_index, the ASCII relation, both canonical values and difference = left - right; division_by_zero reports the position and divisor_text of the zero divisor. relations_checked counts links that held; segment_values lists the segments evaluated.
- Limits: 4096 UTF-8 bytes, 1024 tokens, 64 segments, nesting depth 64, 500 digits per literal or reduced intermediate value; over a limit is limit_exceeded.

## Input

- `equation` (string, required): min length 1

## Output

- `valid` (boolean, required)
- `reason` (one of null, "division_by_zero", "relation_false", required)
- `relations_checked` (integer, required): min 0
- `segment_values` (array of string, required): max items 64; each pattern `^-?(0|[1-9][0-9]*)(/[1-9][0-9]*)?$`
- `first_discrepancy` (object or null, required)
- `reference_version` (constant "ISO/IEC 10967-2:2001 (LIA-2) exact-result terminology; exact arithmetic over the rationals with canonical reduced form; RFC 8259 sec. 6 integer grammar and sec. 7 strings", required)

## Limits

- max expression bytes: 4096
- max tokens: 1024
- max depth: 64
- max value digits: 500
- max segments: 64

## Example

Request input:

```json
{
  "equation": "2/5 = 1/3 + 1/15"
}
```

Response:

```json
{
  "result": {
    "valid": true,
    "reason": null,
    "relations_checked": 1,
    "segment_values": [
      "2/5",
      "2/5"
    ],
    "first_discrepancy": null,
    "reference_version": "ISO/IEC 10967-2:2001 (LIA-2) exact-result terminology; exact arithmetic over the rationals with canonical reduced form; RFC 8259 sec. 6 integer grammar and sec. 7 strings"
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "rational-equation-check",
  "version": "1.0.0",
  "input": {
    "equation": "2/5 = 1/3 + 1/15"
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/rational-equation-check/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"equation":"2/5 = 1/3 + 1/15"}'
```

The machine-readable contract is at [/v1/tools/rational-equation-check/versions/1.0.0](/v1/tools/rational-equation-check/versions/1.0.0).

### CLI

```sh
node cli.mjs run rational-equation-check 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [Rational expression check](/tools/rational-expression-check): Check a claimed exact rational value of an integer/fraction expression; reports the true value and the difference.
- [Lp primal feasibility check](/tools/lp-primal-feasibility-check): Check that a claimed LP point satisfies x >= 0 and Ax <= b exactly; report the first violated bound or row.
- [Rational trace check](/tools/rational-trace-check): Check a step-by-step rational calculation trace; reports the first step whose operand, operator or result disagrees.
- [Polynomial identity check](/tools/polynomial-identity-check): Check a polynomial identity over exact rationals by expanding both sides; report the lowest disagreeing coefficient.
- [Chi square decomposition check](/tools/chi-square-decomposition-check): Check a claimed Pearson chi-square, its per-cell (O-E)^2/E terms and df exactly; returns the first wrong term.
- [Dimension equation check](/tools/dimension-equation-check): Check both sides of an equation have the same dimension (optionally a claimed one); returns the first bad node or side.
