File size: 969 Bytes
8d3e73e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8a7a9dd
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
def parse_tl_formula(tl_spec: str) -> str:
    """Validate the tl specification."""
    if 'G "' in tl_spec:
        tl_spec = tl_spec.replace('G "', 'F "')
    tl_spec = tl_spec.replace("-", "_")
    if tl_spec[0] == "\n":
        tl_spec = tl_spec[1:]

    if tl_spec[0] in ["F"]:
        return f"P=? [{tl_spec}]"

    if tl_spec[0] in ["G"]:
        tl_spec = tl_spec[1:]
        return f"P=? [F {tl_spec}]"

    # if any(op in tl_spec for op in ["F", "G", "U"]):
    #     return f"P=? [F ({tl_spec})]"

    return f"P=? [F {tl_spec}]"


def parse_proposition_set(proposition_set: list[str]) -> list[str]:
    """Parse the proposition set."""
    return [prop.replace("-", "_") for prop in proposition_set]


def parse_tl_specification(tl_spec: str) -> str:
    """Parse the tl specification."""
    return tl_spec.replace("-", "_")


def parse_until_to_next_frame(tl_spec: str) -> str:
    """Parse the tl specification."""
    return tl_spec.replace("U", "& F")