Books / Law as Code in Practice: French Family Benefits / Chapter 6
Part III · Chapter 6
Housing Aid: The APL Formula and the K Coefficient

Contents of Law as Code in Practice: French Family Benefits
By the end you can distinguish the formula amount from the amount after subsequent adjustments, and identify the reading used for K.
Lawyer: the legal source of the formula.
Analyst: which component is being compared.
Developer: exact arithmetic and source-linked operations.
A new housing card
The Garniers rent an ordinary house. Their ALF calculation is not the formula for a logement-foyer — a collective residence. We switch to a fictional retired couple in a general-category residence autonomy, zone II, no dependants, paying €495 a month, with annual resources of €12,500. The legal month is March 2026.
Predict: can rounding K upward instead of downward change Af?
The text
Article D. 832-24 CCH, in the pinned edition applicable in March 2026, gives Af = K × (E−E0). Coefficient de prise en charge → share covered by aid → coefficient_prise_en_charge; Équivalence de loyer et de charges locatives minimale → minimum rent-and-charges equivalent → equivalence_loyer_minimale. E is the eligible rent-and-charges equivalent after applying its ceiling; in this case E = €495. Thus Af = 0.52 × (€495 − €218.12546) = €143.9747608.
Article D. 832-25 describes K as:
arrondi à deux décimales par défaut
English gloss: rounded down to two decimal places. The formula itself is published as an image. This model uses the text of the repealed R. 351-61 and R. 351-61-1 to read that formula, retaining both source references. That is a working reading; it is not a verification that the image and the earlier text have identical content.
The model
rule CoefficientPriseEnChargeAPLGeneral(m: Menage, parts: Decimal, ressources: Money) strict {
when secteur_logement_foyer(m) and aide_demandee(m, APL)
and type_logement_foyer(m, GENERAL)
and nombre_parts(m, parts) and ressources_retenues(m, ressources);
then coefficient_prise_en_charge(m, coefficient_k_general(ressources, parts));
}
Labels and source anchors are left out. The general-category function follows the working formula K = 0.95 − (R − r × N)/(cm × N), with the statutory downward rounding and cap. The household supplies facts, while the canon supplies dated parameters and operations.
| Component | Established value |
|---|---|
| Number of parts N | 1.8 |
| Minimum rent equivalent E0 | €218.12546 |
| K after downward rounding | 0.52 |
| Formula amount Af | €143.9747608 |
| Monthly aid after the fixed reduction, minimum-expenditure check and contribution-representative rounding step; before CRDS | €138.694873804 |
Recorded on 11 October 2026 with law 0.1.12. N and K are checked in the proof of the formula answer. These are calculated components, not a claim that the fund transfers every displayed decimal to a bank account.
Change one thing
A neighbouring query proposes €146.7435062, corresponding to K = 0.53 rounded upward. Rounding this case’s unrounded K to the nearest hundredth would also give 0.52. The proposed amount is not established. It is a comparison query, not a second run adopting a different K reading. The displayed wording specifies the downward direction; the model does not replace it with nearest rounding.
What this gives the fund
A reviewer can follow each component separately: the parts, the coefficient, the minimum equivalent, the formula amount and the later adjustments. A question about K can be investigated at that step without confusing it with a CRDS deduction or a bank-payment presentation.
Where Catala stands on this
Catala’s exact decimal arithmetic is well suited to a statutory formula, and its money conversion has a defined cent rounding (Catala book, ch. 5.2). In Arxo, the rule, dated parameters and pinned source anchors form part of the executable answer. Catala 1.3.0 has no dedicated built-in form binding the result to a pinned publication’s hash; the team can maintain that archive in its application. Here the fund can inspect the source of K and the earlier-text working reading beside the component it produced. We do not compare numerical results from another implementation in this chapter.
Record and inspect
These commands require a local repository checkout and an installed law executable. Start at the repository root.
cd corpus/laws/fr/apl/examples/foyer-coefficient-k
law ask . --case CoupleResidenceAutonomie --query-json queries/aide-formule.json --out "$(mktemp -d)"
python3 check.py --law "$(command -v law)"
The local case package includes the five saved questions and a hand computation. Its check inspects N, K, applied rules and the formula’s source anchors, then executes the declared test twin.
Exercise
- Which direction does par défaut specify?
- Is Af the amount after all adjustments?
- Why does the model retain the repealed articles as well as D. 832-25?