Esempio n. 1
0
 def definition(self, ldf):
     label = ldf.label
     df = ldf.formula
     df = compile_defn(df)
     self.domain.definitions.append(ldf.clone([label, df]))
     self.domain.updates.append(DerivedUpdate(df))
     self.domain.symbol_order.append(df.args[0].rep)
Esempio n. 2
0
 def definition(self, ldf):
     label = ldf.label
     df = ldf.formula
     df = compile_defn(df)
     self.add_definition(ldf.clone([label, df]))
     self.domain.updates.append(DerivedUpdate(df))
     self.domain.symbol_order.append(df.args[0].rep)
     if not self.domain.sig.contains_symbol(df.args[0].rep):
         add_symbol(df.args[0].rep.name, df.args[0].rep.sort)
Esempio n. 3
0
 def derived(self,df):
     try:
         rel = df.args[0]
         with ASTContext(rel):
           sym = add_symbol(rel.relname,get_relation_sort(self.domain.sig,rel.args,df.args[1]))
         df = sortify_with_inference(df)
         self.domain.all_relations.append((sym,len(rel.args)))
         self.domain.relations[sym] = len(rel.args)
         self.domain.concepts.append(df)
         self.domain.updates.append(DerivedUpdate(df))
     except ValueError:
         raise IvyError(df,"definition of derived relation must be a cube")
Esempio n. 4
0
 def derived(self, ldf):
     try:
         label = ldf.label
         df = ldf.formula
         lhs = df.args[0]
         sym = ivy_logic.add_symbol(
             lhs.rep, ivy_logic.TopFunctionSort(len(lhs.args)))
         df = compile_defn(df)
         ivy_logic.remove_symbol(sym)
         add_symbol(df.args[0].rep.name, df.args[0].rep.sort)
         self.domain.all_relations.append((sym, len(lhs.args)))
         self.domain.relations[sym] = len(lhs.args)
         self.domain.definitions.append(ldf.clone([label, df]))
         self.domain.updates.append(DerivedUpdate(df))
         self.domain.symbol_order.append(sym)
     except ValueError:
         raise IvyError(df, "definition of derived relation must be a cube")