R/detect_contradicting_if_rules.R
detect_contradicting_if_rules.Rd
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.
detect_contradicting_if_rules(x, ..., verbose = interactive())
A list of contradictions found in the if clauses, or NULL
if none are found.
In general it detects (variations on) cases where:
if (A) B
and if (A) !B
, which probably is not intended, but logically equals !A
.
if (A) B
and if (B) !A
, which probably is not intended but logically equals !A
.
See examples for more details.
Other feasibility:
detect_boundary_cat()
,
detect_boundary_num()
,
detect_infeasible_rules()
,
is_contradicted_by()
,
is_infeasible()
,
make_feasible()
rules <- validator(
if (nace == "a") export == "y",
if (nace == "a") export == "n"
)
conflicts <- detect_contradicting_if_rules(rules, verbose=TRUE)
#> 1 contradiction(s) with if clauses found:
#> When nace == "a":
#> V1: if (nace == "a") export == "y"
#> V2: if (nace == "a") export == "n"
print(conflicts)
#> $`nace == "a"`
#> [1] "V1" "V2"
#>
# 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)
#> 1 contradiction(s) with if clauses found:
#> When income > 0:
#> rule2: if (job == "yes") income == 0
#> rule1: if (income > 0) job == "yes"