Skip to content

Methodology: how the Mīrāth calculator computes an estate

The engine design, the order it applies the rules, what it leaves to a scholar, and how it is tested.

Exact fractions

Every share is an exact fraction of two whole numbers of any size (BigInt), never a floating-point number. Shares add up to exactly 1, and money amounts are allocated in the smallest currency unit so they add up to the estate exactly.

The order of the calculation

One function runs every estate, for every school, in this order:

  1. Read the heir counts. Invalid input or no heir stops here and is marked for review.
  2. Extended family (dhawū al-arḥām) inherit only when no heir but a spouse remains; otherwise they are shown as excluded.
  3. The grandfather with siblings, by Zayd ibn Thābit's method, including al-muʿādda and al-Akdariyya (not Ḥanafī: there the grandfather excludes the siblings).
  4. al-ʿUmariyyatān.
  5. al-Mushtaraka (Mālikī and Shāfiʿī).
  6. Fixed shares (furūḍ) and exclusion (ḥajb).
  7. ʿAwl: when the fixed shares exceed the estate they are reduced proportionally, and any residuary heir is shown at zero.
  8. The residuary line (ʿaṣaba), down to the paternal cousin, takes what is left, a male taking twice a female where both are present.
  9. Radd by school: a surplus with no residuary heir returns to the fixed-share heirs, spouses excluded. A spouse who is the only heir takes it only in the Ḥanafī school; elsewhere it goes to the bayt al-māl (public treasury) and the case is marked for review.
  10. Build each heir's award and the trace from a single ledger.

The trace

Every result carries an ordered trace. Each step names the rule applied — a fixed share, an exclusion, the residue, ʿawl, radd, the base of the case (aṣl) or its correction (taṣḥīḥ) — the heir it touches, and that heir's share before and after. The calculator's working panel shows this trace and never recomputes a number. The test suite replays every trace and checks that it lands exactly on the final shares.

Four schools, one engine

The school is an input. Where a school holds more than one position, the result carries a note naming the one applied, such as radd by the later Mālikī and Shāfiʿī scholars. Where no relied-upon position could be verified, the engine says the case needs a scholar's review instead of giving a number.

Engine version

This page describes the engine version below. Every result the calculator returns carries the same version string. 0.3.0-sunni4

When the calculator does not give shares

In these cases it says the estate needs a scholar's review:

  • Invalid input: more than one husband, a husband and a wife together, or more than one father, mother, grandfather or grandmother of the same side.
  • No heir entered.
  • A spouse who is the only heir under the Mālikī, Shāfiʿī and Ḥanbalī schools, where the rest goes to the bayt al-māl (public treasury).
  • Combinations of extended family (dhawū al-arḥām) that a school's texts leave open or that the engine does not cover.

Not covered

The calculator has no input for these cases:

  • A missing person (mafqūd).
  • An unborn child (ḥaml).
  • An heir of indeterminate sex (khunthā).
  • Relatives who died together when the order of death is unknown.
  • The Jaʿfarī school: the calculator covers the four Sunni schools only.

Testing

407 of 407 school runs pass. Each case states the expected share of every heir and the classical text it was checked against, and runs once for each school it names. The validation page lists every run with its result.

See every test case

Related