def done_click(self): for i in range(len(self.radios)): if self.radios[i].getChecked(): op = Operation(Operation.get_new_id(), self.theorems[i].formula.get_no_of_args_for_unique_form(), self.textbox_scheme.getText(), self.textbox_name.getText(), Operation.EXPRESSION) Operation.global_operations.append(op) Theorem.theorems.append(Theorem(self.theorems[i].formula.get_def_theorem(op),18,"iojo",[])) IO.save() self.hide()
if self.body[i] == FORALL: i += 2 else: return False def get_def_theorem(self, op): i = 0 k=[] while self.body[i] != UNIQUE: i += 2 k.append(self.body[i-1]) return Formula(self.body[:i] + Formula(self.body[i + 2:]).substitute(Formula([self.body[i + 1]]), Formula([op] + k)).body) def get_no_of_args_for_unique_form(self): i = 0 while self.body[2 * i] != UNIQUE: i += 1 return i if __name__ == '__main__': A = Operation("var1", 0, "a", "a", Operation.VARIABLE) B = Operation("var2", 0, "b", "b", Operation.VARIABLE) C = Operation("var3", 0, "c", "c", Operation.VARIABLE) OAS = Operation("var3", 2, "oas", "oas", Operation.EXPRESSION) pok = Operation("erg", 1, "pok", "pok", Operation.EXPRESSION) f = Formula([FORALL, A, UNIQUE, C, EQUALS, A, C]) print(f.get_def_theorem(pok).dump(),Operation.get_new_id()) Operation.get_new_id()