Example #1
0
 def update_theory(self):
     theory = list(self.get_axioms())
     # axioms of the derived relations TODO: used only the
     # referenced ones, but we need to know abstract domain for
     # this
     for ldf in self.definitions:
         cnst = ldf.formula.to_constraint()
         if all(
                 isinstance(p, il.Variable)
                 for p in ldf.formula.args[0].args):
             if not isinstance(ldf.formula, il.DefinitionSchema):
                 #                    theory.append(ldf.formula) # TODO: make this a def?
                 ax = ldf.formula
                 ax = ax.to_constraint() if isinstance(ax.rhs(),
                                                       il.Some) else ax
                 if ldf.formula.args[0].args:
                     ax = il.ForAll(ldf.formula.args[0].args, ax)
                 theory.append(ax)  # TODO: make this a def?
     # extensionality axioms for structs
     for sort in sorted(self.sort_destructors):
         destrs = self.sort_destructors[sort]
         if any(d.name in self.sig.symbols for d in destrs):
             ea = il.extensionality(destrs)
             if il.is_epr(ea):
                 theory.append(ea)
     # exclusivity axioms for variants
     for sort in sorted(self.variants):
         sort_variants = self.variants[sort]
         if any(v.name in self.sig.sorts for v in sort_variants):
             ea = il.exclusivity(self.sig.sorts[sort], sort_variants)
             theory.append(ea)  # these are always in EPR
     self.theory = lu.Clauses(theory)
Example #2
0
 def update_theory(self):
     theory = list(self.get_axioms())
     # axioms of the derived relations TODO: used only the
     # referenced ones, but we need to know abstract domain for
     # this
     for ldf in self.definitions:
         cnst = ldf.formula.to_constraint()
         if all(isinstance(p,il.Variable) for p in ldf.formula.args[0].args):
             theory.append(cnst) # TODO: make this a def?
     # extensionality axioms for structs
     for sort in sorted(self.sort_destructors):
         destrs = self.sort_destructors[sort]
         if any(d.name in self.sig.symbols for d in destrs):
             ea = il.extensionality(destrs)
             if il.is_epr(ea):
                 theory.append(ea)
     self.theory = lu.Clauses(theory)