detect_contradicting_if_rules {validatetools} | R Documentation |
Detect contradictory if-rules
Description
Detect whether conditions in conditional if-rules may generate contradictions. Strictly speaking these rules do not make the rule set infeasible but rather make the if-condition unsatisfiable. Semantically speaking these rules are contradicting, because the writer of the rule set did not have the intention to make the condition forbidden.
Usage
detect_contradicting_if_rules(x, ..., verbose = interactive())
Arguments
x |
A validator object. |
... |
Additional arguments passed to |
verbose |
Logical. If |
Details
In general it detects (variations on) cases where:
-
if (A) B
andif (A) !B
, which probably is not intended, but logically equals!A
. -
if (A) B
andif (B) !A
, which probably is not intended but logically equals!A
.
See examples for more details.
Value
A list of contradictions found in the if clauses, or NULL
if none are found.
See Also
Other feasibility:
detect_boundary_cat()
,
detect_boundary_num()
,
detect_infeasible_rules()
,
is_contradicted_by()
,
is_infeasible()
,
make_feasible()
Examples
rules <- validator(
if (nace == "a") export == "y",
if (nace == "a") export == "n"
)
conflicts <- detect_contradicting_if_rules(rules, verbose=TRUE)
print(conflicts)
# this creates a implicit contradiction when income > 0
rules <- validator(
rule1 = if (income > 0) job == "yes",
rule2 = if (job == "yes") income == 0
)
conflicts <- detect_contradicting_if_rules(rules, verbose=TRUE)