Skip to content

04 — The Compiler Pipeline

Core claim: The engine executes in exactly 6 phases. The ordering is not arbitrary — Phase 0 and Phase 1 must precede Phase 2 to resolve the Ghost Pressure Paradox. ʿAwl and Radd are unified into a single normalization formula in Phase 4.


Phase 0: H → H' Attribute Exclusion
Phase 1: H' → flags Ghost Pressure Evaluation
Phase 2: H' → S Person Exclusion (Axiom α)
Phase 3: S → shares Share Assignment (Axiom β)
Phase 4: shares → normalized Normalization (Axiom γ)
Phase 5: normalized → integer Taṣḥīḥ (LCM integer normalization)

Phase 0 — Attribute Exclusion ($H \to H’$)

Section titled “Phase 0 — Attribute Exclusion ($H \to H’$)”

Input: Raw heir set $H$ (all potential heirs). Output: Attribute-filtered set $H’$.

Remove all heirs who are blocked by attribute (حجب الأوصاف):

$$H’ = H \setminus {h \mid h \text{ is a murderer, slave, or of different religion}}$$

An attribute-excluded heir is “as if non-existent” — they cast no pressure whatsoever.

Source: faraid/hajb.md — “المحجوب بوصفٍ وجودُه كعدمه… فلا يحجب أحدًا لا حرمانًا ولا نقصانًا”

Why Phase 0 is critical: The original pipeline (v2) started with Ghost Pressure on $H$. But if $H$ contains a murderer-brother, the pipeline would falsely count him as a sibling for pressure purposes, halving the mother’s share from $\frac{1}{3}$ to $\frac{1}{6}$. This was identified by Professors 1 and 3 (see 07-professor-adjudication.md) as a genuine flaw, now corrected.


Phase 1 — Ghost Pressure Evaluation ($H’ \to \text{flags}$)

Section titled “Phase 1 — Ghost Pressure Evaluation ($H’ \to \text{flags}$)”

Input: Attribute-filtered set $H’$. Output: Boolean pressure flags (not a modified heir set — just metadata).

Scan $H’$ for conditions that will affect share assignment in Phase 3:

FlagCondition on $H’$Effect
has_descendant$\exists h \in H’: j = 1, c = 1$Halves spouse shares; shifts parent shares
has_male_descendant$\exists h \in H’: j = 1, g = 1, c = 1$Father/Grandfather become farḍ + ʿaṣaba
sibling_count$|\{h \in H’: j = 3,; d = 1\}|$$\ge 2$ reduces mother from $\frac{1}{3}$ to $\frac{1}{6}$

The Ghost Pressure Paradox — Resolved:

The paradox: siblings who will be eliminated by the father in Phase 2 still reduce the mother’s share. The classical rule is explicit:

“أما المحجوب بشخص: فلا يحجب أحداً حرماناً، وقد يحجبه نقصانًا” — faraid/hajb.md

“One excluded by a person cannot exclude anyone totally, but may still reduce their share.”

By evaluating pressure on $H’$ (which still contains person-excludable heirs) rather than on $S$ (which doesn’t), the pipeline correctly implements this rule.

Example: Father, Mother, 2 Brothers.

  • Phase 0: No attribute exclusions. $H’ = {\text{Father, Mother, 2 Brothers}}$.
  • Phase 1: sibling_count = 2 → mother will be halved. has_descendant = false.
  • Phase 2: Father ($j=2, d=1$) eliminates Brothers ($j=3, d=1$) via Axiom $\alpha$. $S = {\text{Father, Mother}}$.
  • Phase 3: Mother gets $\frac{1}{6}$ (not $\frac{1}{3}$), because Phase 1 flagged $\ge 2$ siblings.
  • The brothers are gone, but their ghost pressure persists.

Phase 2 — Person Exclusion ($H’ \to S$) — Axioms $\alpha_1 + \alpha_2$

Section titled “Phase 2 — Person Exclusion ($H’ \to S$) — Axioms $\alpha_1 + \alpha_2$”

Input: Attribute-filtered set $H’$ and pressure flags from Phase 1. Output: Survivor set $S$.

Phase 2 applies both axioms in sequence:

For each heir, check whether any other heir in $H’$ is their specific واسطة (intermediary). The intermediary is the person through whom this heir connects to the deceased.

Cascade rules:

  • Descendants ($j=1$): blocked by male ancestor at $d-1$
  • Ascendants ($j=2$): grandfathers by closer paternal male; grandmothers by male descendants, mother, or (paternal GM only) father
  • Collaterals ($j=3$, direct siblings): blocked by father (all $q$), or GF in Ḥanafī ($\epsilon_3’$)
  • Collaterals ($j=3$, nephews $d \ge 2$): blocked by father, OR sibling-ancestor at $d-1$, OR surviving GF
  • Uterine siblings ($j=3$, $q=3$, $d=1$): also blocked by GF — by consensus of all schools (Source: faraid/jaddma'aikhwah.md:35)
  • Nephews ($j=3$, $d \ge 2$): also blocked by GF (Source: faraid/jaddma'aikhwah.md:36)
  • Uncles ($j=4$, $d=1$): blocked by male non-maternal sibling
  • Cousins ($j=4$, $d \ge 2$): blocked by male non-maternal sibling, OR uncle-ancestor at $d-1$

Exception $\epsilon_1$ (maternal immunity): Uterine siblings are immune to blocking by their own intermediary (the mother) — by unanimous consensus.

Exception $\epsilon_2$ (Ḥanbalī only): Paternal grandmother is immune to blocking by the father.

Special handling for $\epsilon_3$ (Grandfather-Sibling, Jumhūr only):

If grandfather ($j=2, d \ge 2$) and siblings ($j=3, d=1$) coexist, they are not eliminated by each other under $\alpha_1$. Both survive into $S$. The grandfather’s share is then determined by the $\max$ optimization in Phase 4.

2b — $\alpha_2$: ʿAṣaba Ranking (within strata)

Section titled “2b — $\alpha_2$: ʿAṣaba Ranking (within strata)”

After $\alpha_1$ filtering, within each $(j, d)$ stratum where $j \in {3, 4}$, among ʿaṣaba-candidate males with $q \in {1, 2}$: keep only those with the stratum-minimum $q$.

Why males only: Female heirs have undetermined roles at this stage (farḍ, ʿaṣaba bi-l-ghayr, or ʿaṣaba maʿa al-ghayr). Their role is resolved in Phase 3 against the post-$\alpha_2$ survivor set. This is the correct behavior: if a PaternalBrother is removed here, his PaternalSister has no same-$q$ rescuer → she keeps her farḍ.

Note: Phase 4 applies an additional $\alpha_2$ quwwa filter within the ʿaṣaba assignments pool (after Phase 3 has resolved female roles). This handles cases like FullSister-as-ʿaṣaba-maʿa-al-ghayr ($q=1$) outranking PaternalBrother ($q=2$). Heirs with $q=9$ (GF, direct ancestors/descendants) are exempt from this filter.


Phase 3 — Share Assignment ($S \to \text{shares}$) — Axiom $\beta$

Section titled “Phase 3 — Share Assignment ($S \to \text{shares}$) — Axiom $\beta$”

Input: Survivor set $S$ and pressure flags from Phase 1. Output: Rational share for each survivor.

Using the pressure flags and the heir’s vector, assign base farḍ:

HeirConditionShare
HusbandNo descendant heir$\frac{1}{2}$
HusbandDescendant heir exists$\frac{1}{4}$
WifeNo descendant heir$\frac{1}{4}$
WifeDescendant heir exists$\frac{1}{8}$
MotherNo descendant, $< 2$ siblings, not ʿUmariyyatān$\frac{1}{3}$
MotherDescendant exists OR $\ge 2$ siblings$\frac{1}{6}$
MotherʿUmariyyatān case$\frac{1}{3}$ of remainder
FatherDescendant heir exists$\frac{1}{6}$ (+ ʿaṣaba if no male descendant)
Daughter (solo)$\frac{1}{2}$
Daughters (2+)$\frac{2}{3}$ shared
Son’s Daughter (solo)With 1 daughter at $d^*$$\frac{1}{6}$ (completion at $d^*+1$ only)
Full Sister (solo)No descendant, no father/grandfather$\frac{1}{2}$
Maternal sibling (solo)$\frac{1}{6}$
Maternal siblings (2+)$\frac{1}{3}$ shared (1:1 gender ratio)

GD Topup Rule (Female Descendants): Let $d^$ = the shallowest depth with eligible female descendants (those without a same-depth male rescuer). The 2/3 group ceiling is exhausted at $d^$. Shares for female descendants are:

$$\text{share at } d = \begin{cases} \frac{1}{2} & d = d^,; n_{d^} = 1 \ \frac{2}{3} \cdot \frac{\text{count}}{n_{d^}} & d = d^,; n_{d^} > 1 \ \frac{1}{6} \cdot \frac{\text{count}}{n_{d^+1}} & d = d^+1,; n_{d^} = 1 \text{ (topup)} \ 0 & d > d^*+1 \text{ (ceiling exhausted)} \end{cases}$$

where $n_k$ = total female count at depth $k$. This ensures the 2/3 ceiling is hit at $d^*$ and never overshot by deeper generations.

After farḍ assignment, identify ʿaṣaba heirs:

  1. ʿAṣaba bi-l-nafs: Males with no farḍ assignment (son, brother, uncle, etc.).
  2. ʿAṣaba bi-l-ghayr: Female farḍ heir converted by a male in the same jiha at equal or lower daraja.
  3. ʿAṣaba maʿa al-ghayr: Sisters become ʿaṣaba when daughters exist (derived — $\epsilon_5$).

Step 3c: ʿUmariyyatān check (derived — $\epsilon_6$)

Section titled “Step 3c: ʿUmariyyatān check (derived — $\epsilon_6$)”

If $S = {\text{Spouse, Mother, Father}}$ exactly (no descendants, no siblings):

  • Spouse takes farḍ.
  • Mother takes $\frac{1}{3}$ of the remainder (not $\frac{1}{3}$ of total).
  • Father takes what’s left.

This prevents the father-gets-less-than-mother violation.

Step 3d: Grandfather-Sibling optimization (Jumhūr — $\epsilon_3$)

Section titled “Step 3d: Grandfather-Sibling optimization (Jumhūr — $\epsilon_3$)”

If both grandfather and siblings survived Phase 2:

$$\text{Grandfather} = \max\left(\text{Muqāsama}, ; \frac{1}{3}\text{ of total}, ; \frac{1}{6}\text{ of total}\right)$$

Siblings split the remainder.


Phase 4 — Normalization ($\text{shares} \to \text{normalized}$) — Axiom $\gamma$

Section titled “Phase 4 — Normalization ($\text{shares} \to \text{normalized}$) — Axiom $\gamma$”

Input: Raw shares from Phase 3. Output: Normalized shares summing to exactly 1.

Define the normalization pool $P$ and locked heirs $L$:

$$\text{share}(h) = \begin{cases} \text{farḍ}(h) & \text{if } h \in L \quad \text{(locked — share unchanged)} \[8pt] \dfrac{\text{farḍ}(h)}{\displaystyle\sum_{p \in P} \text{farḍ}(p)} \times R & \text{if } h \in P \quad \text{(normalized)} \end{cases}$$

where $R = 1 - \displaystyle\sum_{h \in L} \text{share}(h)$.

ScenarioPool $P$Locked $L$$R$Name
ʿAṣaba exists$\emptyset$All farḍ heirsNormal (ʿaṣaba takes remainder)
$\Sigma > 1$, no ʿaṣabaAll farḍ heirs$\emptyset$$1$ʿAwl
$\Sigma < 1$, no ʿaṣaba, no spouseAll farḍ heirs$\emptyset$$1$Radd (no spouse)
$\Sigma < 1$, no ʿaṣaba, spouse presentBlood farḍ heirsSpouse$1 - \text{farḍ}(\text{spouse})$Radd (with spouse)

Key finding: ʿAwl and Radd-without-spouse use the identical formula. The only difference: in ʿAwl, $\sum_P \text{farḍ} > 1$ so everyone gets less; in Radd, $\sum_P \text{farḍ} < 1$ so everyone gets more. They are the same operation with different inputs.

Case: Wife, Mother, Daughter.

HeirfarḍPool?
Wife$\frac{1}{8}$Locked
Mother$\frac{1}{6}$Pool
Daughter$\frac{1}{2}$Pool
  • $\sum_P = \frac{1}{6} + \frac{1}{2} = \frac{2}{3}$
  • $R = 1 - \frac{1}{8} = \frac{7}{8}$
  • Mother: $\frac{1/6}{2/3} \times \frac{7}{8} = \frac{1}{4} \times \frac{7}{8} = \frac{7}{32}$
  • Daughter: $\frac{1/2}{2/3} \times \frac{7}{8} = \frac{3}{4} \times \frac{7}{8} = \frac{21}{32}$
  • Check: $\frac{4}{32} + \frac{7}{32} + \frac{21}{32} = \frac{32}{32} = 1$ ✓

This matches the classical result with Jāmiʿa = 32.

Case: Wife, 2 Daughters, Father, Mother. Base = 24.

Heirfarḍ
Wife$\frac{1}{8}$ (= $\frac{3}{24}$)
2 Daughters$\frac{2}{3}$ (= $\frac{16}{24}$)
Father$\frac{1}{6}$ (= $\frac{4}{24}$)
Mother$\frac{1}{6}$ (= $\frac{4}{24}$)
  • $\sum = \frac{3 + 16 + 4 + 4}{24} = \frac{27}{24} > 1$
  • $P$ = all heirs, $R = 1$.
  • Each share: $\frac{\text{farḍ}(h)}{27/24} = \frac{\text{farḍ}(h) \times 24}{27}$
  • Wife: $\frac{3}{27}$, Daughters: $\frac{16}{27}$, Father: $\frac{4}{27}$, Mother: $\frac{4}{27}$
  • Check: $\frac{3 + 16 + 4 + 4}{27} = \frac{27}{27} = 1$ ✓

Classical result: base 24 ʿawls to 27.


Phase 5 — Taṣḥīḥ (Integer Normalization)

Section titled “Phase 5 — Taṣḥīḥ (Integer Normalization)”

Input: Normalized rational shares. Output: Integer shares with a common base (the muṣaḥḥaḥ / مُصَحَّح).

Convert every share to a whole number so the estate can be physically divided. This is the classical التصحيح operation.

  1. Express all shares with a common denominator (the aṣl / أصل المسألة, or its ʿawl/radd modification).
  2. Check if each group’s total shares divide evenly among group members (the rounding check).
  3. If not (انكسار — fractional breakage), find the smallest multiplier (جزء السهم) by:
    • For each group with breakage: compute wafq (GCD) of shares and head-count, or use full head-count if they’re coprime.
    • If multiple groups have breakage: take the LCM of the per-group multipliers.
  4. Multiply the entire base by this multiplier.

Source: faraid/tashih.md — full algorithm with examples.

The engine outputs:

$$(\text{muṣaḥḥaḥ}, ; {(h_i, \text{sahm}i)}{i \in S})$$

where muṣaḥḥaḥ is the common base and sahm is each heir’s integer share.

Algebraic properties guaranteed:

  1. All values are in $\mathbb{Z}^+$ (positive integers).
  2. $\sum_i \text{sahm}_i = \text{muṣaḥḥaḥ}$.
  3. Each heir’s share divides evenly among the individuals in their group.

These properties are what enable the extension operators (Munāsakhat, Mafqūd) to compose outputs — see 06-core-vs-extensions.md.


┌─────────────────────────────────────────────────┐
│ CORE ENGINE F(H) │
│ │
│ H ──Phase 0──▶ H' ──Phase 1──▶ flags │
│ │ │ │
│ ▼ │ │
│ Phase 2 ◀──────────────┘ │
│ │ │
│ ▼ │
│ S ──Phase 3──▶ shares ──Phase 4──▶ normalized │
│ │ │
│ ▼ │
│ Phase 5 │
│ │ │
│ ▼ │
│ (muṣaḥḥaḥ, suhūm) │
└─────────────────────────────────────────────────┘

  • Original pipeline design: my findings/faraid_axioms.md
  • Ghost pressure source: faraid/hajb.md
  • Radd mechanics: faraid/radd.md
  • ʿAwl mechanics: faraid/awl.md
  • Taṣḥīḥ algorithm: faraid/tashih.md
  • Base computation: faraid/tasil.md
  • Professor corrections (Phase 0): 07-professor-adjudication.md