Exemple #1
0
    def get_proof_term(self, thy, t):
        if t.arg1 == zero:
            cv = rewr_conv("times_def_1")
        elif t.arg == zero:
            cv = rewr_conv("mult_0_right")
        elif t.arg1 == one:
            cv = rewr_conv("mult_1_left")
        elif t.arg == one:
            cv = rewr_conv("mult_1_right")
        elif is_times(t.arg1):
            cmp = compare_atom(t.arg1.arg, t.arg)
            if cmp == term_ord.GREATER:
                cv = then_conv(swap_times_r(), arg1_conv(norm_mult_atom()))
            elif cmp == term_ord.EQUAL:
                if is_binary(t.arg):
                    cv = then_conv(rewr_conv("mult_assoc"),
                                   arg_conv(nat_conv()))
                else:
                    cv = all_conv()
            else:
                cv = all_conv()
        else:
            cmp = compare_atom(t.arg1, t.arg)
            if cmp == term_ord.GREATER:
                cv = rewr_conv("mult_comm")
            elif cmp == term_ord.EQUAL:
                if is_binary(t.arg):
                    cv = nat_conv()
                else:
                    cv = all_conv()
            else:
                cv = all_conv()

        return cv.get_proof_term(thy, t)
Exemple #2
0
    def get_proof_term(self, thy, t):
        if is_binary(t):
            cv = all_conv()
        elif is_Suc(t):
            cv = then_conv(rewr_conv("add_1_right", sym=True), norm_full())
        elif is_plus(t):
            cv = then_conv(binop_conv(norm_full()), norm_add_polynomial())
        elif is_times(t):
            cv = then_conv(binop_conv(norm_full()), norm_mult_polynomial())
        else:
            cv = all_conv()

        return cv.get_proof_term(thy, t)
Exemple #3
0
 def get_proof_term(self, thy, t):
     if is_conj(t.arg1):
         return then_conv(
             rewr_conv("conj_assoc", sym=True),
             arg_conv(norm_conj_assoc_clauses())).get_proof_term(thy, t)
     else:
         return all_conv().get_proof_term(thy, t)
Exemple #4
0
 def get_proof_term(self, thy, t):
     if t.arg == one:
         return rewr_conv("mult_1_right").get_proof_term(thy, t)
     elif t.arg1 == one:
         return rewr_conv("mult_1_left").get_proof_term(thy, t)
     else:
         return all_conv().get_proof_term(thy, t)
Exemple #5
0
 def get_proof_term(self, thy, t):
     if is_times(t) and is_binary(t.arg):
         return all_conv().get_proof_term(thy, t)
     elif is_binary(t):
         return rewr_conv("mult_1_left", sym=True).get_proof_term(thy, t)
     else:
         return rewr_conv("mult_1_right", sym=True).get_proof_term(thy, t)
Exemple #6
0
 def get_proof_term(self, t):
     if t.is_conj():
         return then_conv(
             binop_conv(norm_conj_assoc()),
             norm_conj_assoc_clauses()
         ).get_proof_term(t)
     else:
         return all_conv().get_proof_term(t)
Exemple #7
0
 def get_proof_term(self, thy, t):
     n = t.arg  # remove Suc
     if n == zero:
         return all_conv().get_proof_term(thy, t)
     elif n == one:
         return rewr_conv("one_Suc").get_proof_term(thy, t)
     elif n.head == bit0:
         return rewr_conv("bit0_Suc").get_proof_term(thy, t)
     else:
         return then_conv(rewr_conv("bit1_Suc"),
                          arg_conv(self)).get_proof_term(thy, t)
Exemple #8
0
    def get_proof_term(self, thy, t):
        if t.arg1 == zero:
            cv = rewr_conv("plus_def_1")
        elif t.arg == zero:
            cv = rewr_conv("add_0_right")
        elif is_plus(t.arg1):
            cmp = compare_monomial(t.arg1.arg, t.arg)
            if cmp == term_ord.GREATER:
                cv = then_conv(swap_add_r(), arg1_conv(norm_add_monomial()))
            elif cmp == term_ord.EQUAL:
                cv = then_conv(rewr_conv("add_assoc"),
                               arg_conv(combine_monomial(thy)))
            else:
                cv = all_conv()
        else:
            cmp = compare_monomial(t.arg1, t.arg)
            if cmp == term_ord.GREATER:
                cv = rewr_conv("add_comm")
            elif cmp == term_ord.EQUAL:
                cv = combine_monomial(thy)
            else:
                cv = all_conv()

        return cv.get_proof_term(thy, t)