Learn R Programming

validatetools (version 0.6.1)

detect_contradicting_if_rules: 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())

Value

A list of contradictions found in the if clauses, or NULL if none are found.

Arguments

x

A validator object.

...

Additional arguments passed to detect_if_clauses.

verbose

Logical. If TRUE, print the results.

Details

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.

See Also

Other feasibility: detect_boundary_cat(), detect_boundary_num(), detect_infeasible_rules(), is_contradicted_by(), is_infeasible(), make_feasible()

Examples

Run this code
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)

Run the code above in your browser using DataLab