Exemple #1
0
 def __init__(self, FOL: SimpleNamespace, ST: SimpleNamespace):
     self._defined = ST.Nin
     vars = VarBuilder()
     self._formula = (FOL.Forall(
         vars.universal('u'),
         FOL.Forall(
             vars.universal('v'),
             FOL.Equiv(ST.In(vars['u'], vars['v']),
                       FOL.Not(ST.Nin(vars['u'], vars['v']))))))
     pass
 def __init__(self, index: int, FOL: SimpleNamespace, ST: SimpleNamespace):
     def recurse_create_forall(count: int,
                               vars: VarBuilder, 
                               index: int = 0) -> Node:
         if index == count:
             return None
         else:
             return FOL.Forall(
                     vars.universal("u_{}".format(index)),
                     recurse_create_forall(count, vars, index+1))
     def recurse_create_or(count: int,
                           check_var: str,
                           vars: VarBuilder, 
                           index: int = 0) -> Node:
         eq_formula = FOL.Eq(vars[check_var], vars["u_{}".format(index)])
         if index + 1 == count:
             return eq_formula 
         else:
             return FOL.Or(
                     eq_formula,
                     recurse_create_or(count, check_var, vars, index+1))
     self._defined = (ST.InductiveFormation, 3)
     vars = VarBuilder()
     root_member_foralls = recurse_create_forall(index, vars)
     tail_member_foralls = root_member_foralls
     while tail_member_foralls.right() is not None:
         tail_member_foralls = tail_member_foralls.right()
     members = vars.values()
     tail_member_foralls.set_right(
         FOL.Forall(
             vars.universal("Set"),
             FOL.Equiv(
                 FOL.Eq(
                     vars["Set"],
                     ST.InductiveFormation(index, *members)
                 ),
                 FOL.Forall(
                     vars.universal("x"),
                     FOL.Equiv(
                         ST.In(vars["x"], vars["Set"]),
                         recurse_create_or(index, "x", vars)
                     )
                 )
             )
         )
     )
     self._formula = root_member_foralls
     pass
Exemple #3
0
 def __init__(self, FOL: SimpleNamespace, ST: SimpleNamespace):
     self._defined = ST.Subset
     vars = VarBuilder()
     self._formula = (FOL.Forall(
         vars.universal("Set"),
         FOL.Forall(
             vars.universal("Subset"),
             FOL.Equiv(
                 ST.Subset(vars["Subset"], vars["Set"]),
                 FOL.Forall(
                     vars.universal("u"),
                     FOL.Impl(
                         ST.In(vars["u"], vars["Subset"]),
                         ST.In(vars["u"], vars["Set"]),
                     ))))))
     pass
Exemple #4
0
 def __init__(self, FOL: SimpleNamespace, ST: SimpleNamespace):
     vars = VarBuilder()
     self._formula = (FOL.Forall(
         vars.universal('u'),
         FOL.Forall(
             vars.universal('v'),
             FOL.Exists(
                 vars.existential('Pair'),
                 FOL.Forall(
                     vars.existential('x'),
                     FOL.Equiv(
                         ST.In(vars['x'], vars['Pair']),
                         FOL.Or(
                             FOL.Eq(vars['x'], vars['u']),
                             FOL.Eq(vars['x'], vars['v']),
                         )))))))
     pass
 def __init__(self, FOL: SimpleNamespace, ST: SimpleNamespace):
     self._defined = FOL.DefOp
     vars = VarBuilder()
     # TODO: the problem here that this node depends on the function being defined
     # So it can only be applied based on a concrete function definition? or can we provide 
     # a recipe?
     # making this work nicely needs a refactoring, every entity eg function must be expressible as a partially-expanded parametrizable 
     # node
     # TBC
     self._formula = (
         FOL.Forall(
             vars.universal("f"),
             FOL.Equiv(
                 FOL.Eq(
                     vars["f"],
                     None
                 ),
                 None
             )
         )
     )
     pass
Exemple #6
0
 def __init__(self, FOL: SimpleNamespace, ST: SimpleNamespace):
     vars = VarBuilder()
     self._formula = (FOL.Forall(vars.universal('u'),
                                 ST.Nin(vars['u'], ST.Empty())))