Backtracking Facts for a Trigger #
For DMFA/RMFA-like conditions, we need to be able to backtrack which facts are necessarily present when a trigger is loaded. This file starts with very basic auxiliary definitions for this endeavor.
For a rule, we need to be able to obtain a fresh constant for each variable that only occurs in the body. This is doen using the GetFreshInhabitant typeclass.
Equations
- r.fresh_consts_for_pure_body_vars forbidden_constants = GetFreshInhabitant.fresh_n forbidden_constants r.pure_body_vars.length
Instances For
The number of fresh constants obtained matches the number of variables.
For each variable, the index of the fresh constant introduced for this variable matches the index of the variable.
Getting the variable at the index of the corresponding fresh constant returns the original variable.
The rule id of a SkolemFS (Skolem Function Symbol) is valid if there is a rule with this id.
Instances For
The disjunct index of a SkolemFS (Skolem Function Symbol) if the rule corresponding the its rule id indeed has enough head disjuncts.
Equations
- sfs.disjunctIndex_valid rl ruleId_valid = (sfs.disjunctIndex < (rl.get_by_id sfs.ruleId ruleId_valid).head.length)
Instances For
The arity of a SkolemFS (Skolem Function Symbol) is valid if it matches the frontier length of the rule corresponding to its rule id.