Download compiled/apply-rules.md from swedishembedded/knowledge: direct link, hf CLI and curl.
- Browser
- Download file 4.5 kB
-
https://huggingface.co/swedishembedded/knowledge/resolve/main/compiled/apply-rules.md
- Command line
-
hf download hf://swedishembedded/knowledge/compiled/apply-rules.md
-
curl -L -o apply-rules.md https://huggingface.co/swedishembedded/knowledge/resolve/main/compiled/apply-rules.md
title: Applying written rules to a case
tiers: rule 1, procedure 2, example 3, mistakes 2
Applying written rules to a case
For tasks that give short materials (sections of an act, a protocol, a manual) and a case, and ask for the outcome and the amounts due.
Rule
The task's own files and stated rules always win over this page; use this page only for what the task leaves open.
- The material rules, not your memory. Its numbers may differ from similar real rules.
- Use the version in force. An amendment replaces the section it amends; the replaced
number is still printed in the older document and is wrong for the case. See
/knowledge/compiled/which-document-wins.md. - A rule has a condition and a consequence. The consequence follows only if the condition is met by the case facts, read with the condition's exact wording ("more than" is not "at least").
- An exception removes a consequence that would otherwise follow. It matters only when the
rule's own condition is met. So there are three different situations, and the outcome labels
on offer usually distinguish them:
- the condition is met and no exception applies: the right exists;
- the condition is met but an exception applies: the right is taken away;
- the condition is not met: nothing happens at all; the exception is not even reached.
- Each consequence has its own rule. An exception to one right does not touch another. An amount can be due although a right to act is not, and the reverse.
- An amount is computed exactly as the section words it, including any cap, and reported under the name the request gives.
- If the deciding fact is missing from the case, never invent it. See
/knowledge/agent-workflow/missing-information.md.
Procedure
- Read every document in the materials, with its header. Decide which statements are in force.
- Read the case facts. Read the outcome labels and amount names the request offers.
- For each consequence the request asks about (a right, an amount), find its section. Write it as: IF condition THEN consequence, EXCEPT IF exception.
- Test the condition with the case facts. Write the comparison out: "delay 9, threshold more than 12: not met".
- Only if the condition is met, test the exception.
- Choose the outcome label that matches the situation in rule 4. Pick by meaning, not by which sounds most cautious.
- Compute each amount with a script, following its own section: base, rate, count, cap. An exception applies to it only if the text says so.
- Write outcome and amounts in the request's shape; amounts in the format it shows.
Worked example
Illustration only, with invented data. Your task's data differs: take no fact, count or expected result from this example.
Invented material, a library statute.
Section 4.1. A member who returns an item more than 12 days after the due date loses borrowing rights for a month. Section 4.2. Section 4.1 does not apply if the library was closed on the due date. Section 4.3. For each day of delay a fee of 0.2 percent of the item's value is charged, at most 3 percent of its value. Amendment (later date, same authority): Section 4.1 (amended): ... more than 20 days ...
Labels offered: rights_suspended, nothing_happens, suspension_barred. Amount: fee.
Case A. Value 450.00, 16 days late, library open on the due date. In force: 20 days (the amendment). 16 is not more than 20: condition not met. The exception is not reached. Outcome: nothing happens. Fee: 16 x 0.2 = 3.2 percent, capped at 3 percent: 13.50.
Case B. Value 450.00, 25 days late, library closed on the due date. 25 is more than 20: condition met. Exception applies: the suspension is barred. Fee: section 4.2 exempts only section 4.1, so the fee is still due: capped, 13.50.
Case C. Value 450.00, 6 days late, library closed on the due date. Condition not met: nothing happens (not "barred": there was nothing to bar). Fee: 6 x 0.2 = 1.2 percent = 5.40, below the cap of 13.50, so 5.40.
Common mistakes
- Choosing the "right is taken away" label whenever the answer is negative, although the condition was never met.
- Reporting the cap as the amount when the computed amount is lower; or ignoring the cap when it is higher.