Skip to content

simplify

simplify_json_logic(rule)

Simplify a given JSON Logic rule.

Parameters:

Name Type Description Default
rule Dict

parsed JSON Logic rule definition

required

Returns:

Type Description

simplified JSON Logic rule definition after applying the simplifiers

Source code in json_logic_asp/simplifier/simplify.py
 6
 7
 8
 9
10
11
12
13
14
15
16
17
def simplify_json_logic(rule: Dict):
    """
    Simplify a given JSON Logic rule.

    :param rule: parsed JSON Logic rule definition
    :return: simplified JSON Logic rule definition after applying the simplifiers
    """

    if not isinstance(rule, dict):
        raise ValueError("Expected a dictionary to be simplified")

    return simplify_node(rule)