Example #1
0
 def to_mona_s(self, v="0") -> str:
     """Return the MONA encoding of an LTLf Release formula."""
     all_var = new_var(v)
     ex_var = new_var(all_var)
     f1 = self.formulas[0].to_mona_s(v=ex_var)
     f2 = self.formulas[1].to_mona_s(v=all_var)
     return "(all1 {0}: ({1}<={0}&{0}<=max($)) => ({2} | (ex1 {3}: {1} <= {3} & {3} < {0} & {4})))".format(
         all_var, v, f2, ex_var, f1)
Example #2
0
 def to_mona_s(self, v="0") -> str:
     """Return the MONA encoding of an LTLf Until formula."""
     ex_var = new_var(v)
     all_var = new_var(ex_var)
     f1 = self.formulas[0].to_mona_s(v=all_var)
     f2 = self.formulas[1].to_mona_s(v=ex_var)
     return "(ex1 {0}: {1}<={0}&{0}<=max($) & {2} & (all1 {3}: {1}<={3}&{3}<{0} => {4}))".format(
         ex_var, v, f2, all_var, f1)
Example #3
0
 def to_mona_s(self, v="0") -> str:
     """Return the MONA encoding of a PLTLf Since formula."""
     if v != "0":
         ex_var = new_var(v)
         all_var = new_var(ex_var)
         f1 = self.formulas[0].to_mona_s(v=all_var)
         f2 = self.formulas[1].to_mona_s(v=ex_var)
         #return "(ex1 {0}: 0<={0}&{0}<={1} & {2} & (all1 {3}: ({0}<{3}&{3}<={1}) => {4}))".format( ex_var, v, f2, all_var, f1)
         return "(all1 {0}: 0<={0}&{0}<={1} => ({2} | (ex1 {3}: ({0}<{3}&{3}<={1}) &  {4})))".format(
             ex_var, v, f2, all_var, f1)
     else:
         return self.formulas[1].to_mona_s(v)
Example #4
0
 def to_mona(self, v="max($)") -> str:
     """Return the MONA encoding of a PLTLf Past Release formula."""
     ex_var = new_var(v)
     all_var = new_var(ex_var)
     f1 = self.formulas[0].to_mona(v=all_var)
     f2 = (
         PLTLfSince(self.formulas[1:]).to_mona(v=ex_var)
         if len(self.formulas) > 2
         else self.formulas[1].to_mona(v=ex_var)
     )
     return (
         f"~(ex1 {ex_var}: {ex_var} in $ & 0<={ex_var}&{ex_var}<={v} & ~({f2}) & "
         f"(all1 {all_var}: {all_var} in $ & {ex_var}<{all_var}&{all_var}<={v} => ~({f1})))"
     )
Example #5
0
 def to_mona(self, v="max($)") -> str:
     """Return the MONA encoding of a PLTLf Since formula."""
     ex_var = new_var(v)
     all_var = new_var(ex_var)
     f1 = self.formulas[0].to_mona(v=all_var)
     f2 = (PLTLfSince(self.formulas[1:]).to_mona(v=ex_var) if
           len(self.formulas) > 2 else self.formulas[1].to_mona(v=ex_var))
     if v != "max($)":
         return ("(ex1 {0}: 0<={0}&{0}<={1} & {2} & "
                 "(all1 {3}: {0}<{3}&{3}<={1} => {4}))".format(
                     ex_var, v, f2, all_var, f1))
     else:
         return ("(ex1 {0}: 0<={0}&{0}<=max($) & {1} & "
                 "(all1 {2}: {0}<{2}&{2}<=max($) => {3}))".format(
                     ex_var, f2, all_var, f1))
Example #6
0
 def to_mona_s(self, v="0") -> str:
     if v != "0":
         ex_var = new_var(v)
         return "(ex1 {0}: 0<={0}&{0}<={1} & {2})".format(
             ex_var, v, self.f.to_mona_s(ex_var))
     else:
         return self.f.to_mona_s(v)
Example #7
0
 def to_mona(self, v="0") -> str:
     """Return the MONA encoding of an LTLf Until formula."""
     ex_var = new_var(v)
     all_var = new_var(ex_var)
     f1 = self.formulas[0].to_mona(v=all_var)
     f2 = (
         LTLfUntil(self.formulas[1:]).to_mona(v=ex_var)
         if len(self.formulas) > 2
         else self.formulas[1].to_mona(v=ex_var)
     )
     return (
         "(ex1 {0}: {0} in $ & {1}<={0}&{0}<=max($) & {2} & "
         "(all1 {3}: {3} in $ & {1}<={3}&{3}<{0} => {4}))".format(
             ex_var, v, f2, all_var, f1
         )
     )
Example #8
0
 def to_mona(self, v="0") -> str:
     """Return the MONA encoding of a PLTLf Historically formula."""
     all_var = new_var(v)
     if v != "0":
         return "(all1 {0}: (0<={0}&{0}<={1}) => {2})".format(
             ex_var, v, self.f.to_mona(all_var))
     else:
         return self.f.to_mona_s(v)
Example #9
0
 def to_mona(self, v="0") -> str:
     """Return the MONA encoding of a PLTLf Once formula."""
     if v != "0":
         ex_var = new_var(v)
         return "(ex1 {0}: 0<={0}&{0}<={1} & {2})".format(
             ex_var, v, self.f.to_mona(ex_var))
     else:
         return self.f.to_mona("0")
Example #10
0
 def to_mona_s(self, v="0") -> str:
     ex_var = new_var(v)
     if v != "0":
         return "(ex1 {0}: {0}={1}+1 & {2})".format(
             ex_var, v, self.f.to_mona_s(ex_var))
     else:
         return "(ex1 {0}: {0}=1 & {1})".format(ex_var,
                                                self.f.to_mona_s(ex_var))
Example #11
0
 def to_mona(self, v="max($)") -> str:
     """Return the MONA encoding of a PLTLf Before formula."""
     ex_var = new_var(v)
     if v != "max($)":
         return "(ex1 {0}: {0}={1}-1 & {0}>=0 & {2})".format(
             ex_var, v, self.f.to_mona(ex_var))
     else:
         return "(ex1 {0}: {0}=max($)-1 & max($)>0 & {1})".format(
             ex_var, self.f.to_mona(ex_var))
Example #12
0
 def to_mona(self, v="0") -> str:
     """Return the MONA encoding of an LTLf Next formula."""
     ex_var = new_var(v)
     if v != "0":
         return "(ex1 {0}: {0}={1}+1 & {2})".format(ex_var, v,
                                                    self.f.to_mona(ex_var))
     else:
         return "(ex1 {0}: {0}=1 & {1})".format(ex_var,
                                                self.f.to_mona(ex_var))
Example #13
0
 def to_mona_s(self, v="0") -> str:
     """Return the MONA encoding of an LTLf WeakNext formula."""
     ex_var = new_var(v)
     if v != "0":
         return "(({1} = max($)) | (ex1 {0}: {0}={1}+1 & {2}))".format(
             ex_var, v, self.f.to_mona_s(ex_var))
     else:
         return "((0 = max($)) | (ex1 {0}: {0}=1 & {1}))".format(
             ex_var, self.f.to_mona_s(ex_var))
Example #14
0
 def to_mona_s(self, v="0") -> str:
     """Return the MONA encoding of a PLTLf Before formula."""
     ex_var = new_var(v)
     if v == "0":
         return "(true)"
     elif v == "max($)":
         return "(({2} = 0) | (ex1 {0}: {0}=max($)-1 & max($)>0 & {1}))".format(
             ex_var, self.f.to_mona_s(ex_var), v)
     else:
         return "(({1} = 0)|(ex1 {0}: {0}={1}-1 & {0}>=0 & {2}))".format(
             ex_var, v, self.f.to_mona_s(ex_var))
Example #15
0
 def to_mona_s(self, v="0") -> str:
     all_var = new_var(v)
     return "(all1 {0}: {1}<={0}&{0}<=max($) => {2})".format(
         all_var, v, self.f.to_mona_s(v=all_var))
Example #16
0
 def to_mona(self, v="0") -> str:
     """Return the MONA encoding of an LTLf Always formula."""
     all_var = new_var(v)
     return "(all1 {0}: {1}<={0}&{0}<=max($) => {2})".format(
         all_var, v, self.f.to_mona(v=all_var))
Example #17
0
 def to_mona_s(self, v="0") -> str:
     ex_var = new_var(v)
     return "(ex1 {0}: {1}<={0}&{0}<=max($) & {2})".format(
         ex_var, v, self.f.to_mona_s(v=ex_var))
Example #18
0
 def to_mona(self, v="0") -> str:
     """Return the MONA encoding of an LTLf Eventually formula."""
     ex_var = new_var(v)
     return "(ex1 {0}: {1}<={0}&{0}<=max($) & {2})".format(
         ex_var, v, self.f.to_mona(v=ex_var))