def apply(self, x): if len(x) != 3: raise ValueError(x, ": ", Exists.ExistsHelp) matchTerm = x.get(0) collTerm = self.evaluator.apply(x.get(1)) if not isinstance(collTerm, Collection) and \ not isinstance(collTerm, Tuple): raise ValueError( x.get(2) + " not a CollectionTerm or TupleTerm " + Exists.ExistsHelp) if isinstance(collTerm, Collection): collection = collTerm else: list = [] for i in range(collTerm.size()): list.add(collTerm.get(i)) collection = List(list) constraints = x.get(2) for t in collection: s = matchTerm.match(t) if s is None: continue conSub = constraints.substitute(s) if self.evaluator.apply(conSub).bool_value(): return Boolean.create(True) return Boolean.create(False)
def apply(self, x): matchTuple = x.get(0) zipTerm = x.get(1) sub_f = x.get(2) zipTerm = self.evaluator.apply(zipTerm) zipList = [] for t in zipTerm: zipList.append(t) for i in range(len(zipList) - 1): if len(zipList[i]) != len(zipList[i + 1]): return Boolean.create(False) for i in range(len(zipList[0])): zipArgs = [None] * len(zipList) for j in range(len(zipList)): zipArgs[j] = zipList[j].get(i) zipTuple = Tuple(zipArgs) s = matchTuple.match(zipTuple) if not self.evaluator.apply(sub_f.substitute(s)).bool_value(): return Boolean.create(False) return Boolean.create(True)
def apply(self, x): if x.size() == 0: return Boolean.create(False) for i in range(1, x.size()): if self.evaluator.apply(x.get(i)).bool_value(): return Boolean.create(True) return Boolean.create(False)
def apply(self, x): targets = x.get(0) types = x.get(1) if not isinstance(targets, Tuple): return Boolean.create(True) for i in range(targets.size()): idx = min(i, types.size() - 1) con = Tuple([TYPE, Tuple([QUOTE, targets.get(i)]), types.get(idx)]) if not self.evaluator.apply(con).bool_value(): return Boolean.create(False) return Boolean.create(True)
def apply(self, x): from_term = self.evaluator.apply(x.get(0)) to_term = self.evaluator.apply(x.get(1)) matchConstraint = x.get(2) s = from_term.match(to_term) if s is None: return Boolean.create(False) return self.evaluator.apply(matchConstraint.substitute(s))
def apply(self, x): return Boolean.create(not x.bool_value())
def apply(self, x): return Boolean.create(isinstance(x, Tuple))
def apply(self, args): return Boolean.create(args.get(0) <= args.get(1))
def apply(self, x): return Boolean.create(x[0] != x[1])
def apply(self, x): return Boolean.create(isinstance(x, Numerical))
def apply(self, x): return Boolean.create(isinstance(x, String))
def apply(self, x): return Boolean.create(isinstance(x, Symbolic))
def apply(self, x): return Boolean.create(True)
def apply(self, x): return Boolean.create(isinstance(x, FunctionReference))
def apply(self, x): return Boolean.create(isinstance(x, KeyValue))
def apply(self, x): return Boolean.create(isinstance(x, Variable))
def apply(self, args: Tuple) -> Boolean: C = args[0] k = args[1] return Boolean.create(C.contains_key(k))
def apply(self, x): return Boolean.create(isinstance(x, Integer))
def apply(self, args: Tuple) -> Boolean: x = args.get(0) y = args.get(1) sub = x.match(y) return Boolean.create(sub is not None)
def apply(self, x): return Boolean.create(isinstance(x, Real))
def apply(self, term): return Boolean.create(self.check(self.type_def, term))
def apply(self, x): return Boolean.create(isinstance(x, Collection))