Skip to content

Rule modules

The single most important architectural choice in Deducible: the engine is separate from the rule-base. The compiler knows how to check a contract; what counts as compliant is supplied by a rule module — plain JSON that a scholar or standards body can author and ratify without touching Rust.

This is what closes the authority gap. Ratification becomes a module, not a fork.

rules/aaoifi.rules.json
{
"authority": "AAOIFI",
"musharakah_mutanaqisah": {
"required_invariants": ["risk_sharing", "no_capital_guarantee", "valuation_specified"],
"constraints": [
{ "code": "RISK-1", "field": "loss_share", "op": "eq", "value": "by_ownership",
"citation": "AAOIFI SS No. 12" }
]
}
}

A module declares, per instrument, the invariants that must hold and the constraints ({ code, field, op, value, citation }) that encode them. The engine loads it and checks the spec against it — data-driven and regime-neutral.

Terminal window
deducible check home.fiqh --rules aaoifi # or: --rules dsn-mui
meta { rules: "dsn-mui"; } # or pin it in the spec

Modules are discovered in ./rules or $FIQHC_RULES_DIR.

The same musharakah_mutanaqisah.fiqh is consistent under AAOIFI but refused under DSN-MUI, which additionally requires an explicit profit-sharing ratio (nisbah):

Terminal window
$ deducible check musharakah_mutanaqisah.fiqh --rules aaoifi
consistent
$ deducible check musharakah_mutanaqisah.fiqh --rules dsn-mui
INV-1 required invariant "nisbah_explicit" is missing (DSN-MUI No. 08).

A riba-disguised loan is refused under both, each with that authority’s own citations.

  • Pluralism, honestly modelled. Fiqh differs between schools and standards bodies; the rule module makes that difference explicit and auditable instead of baking one opinion into the tool.
  • A clean ratification surface. A Shari’ah-advisory firm ratifies one JSON module — a bounded, reviewable artifact — rather than auditing a compiler.
  • The engine stays neutral. It enforces whatever the active, human-authored module says, and reports which authority and citation each verdict rests on.