Esempio n. 1
0
 def aux_fun(goal, context, _):
     New_S = LADR_Solver()
     #TODO: this is an abominable hack!
     g = goal.prop
     for i, v in reversed(list(enumerate(goal.tele.vars))):
         g = Bound(Forall(v), goal.tele.types[i], abstract_expr([v], g))
     b = New_S.prove("prover9 -t{0!s}".format(timeout), g, context, unfold)
     if b:
         return []
     else:
         return [goal]
Esempio n. 2
0
 def aux_fun(goal, context, _):
     New_S = LADR_Solver()
     #TODO: this is an abominable hack!
     g = goal.prop
     for i, v in reversed(list(enumerate(goal.tele.vars))):
         g = Bound(Forall(v), goal.tele.types[i], abstract_expr([v], g))
     b = New_S.prove("mace4 -t{0!s} -n{1!s}".format(timeout, size), g, context, unfold)
     if b:
         return []
     else:
         return [goal]
Esempio n. 3
0
def sig(var, codom):
    """Create the term
    Sig x:A.B from its constituents
    
    Arguments:
    - `var`: a constant expr
    - `codom`: an expression possibly containing var
    """
    if var.is_const():
        codom_abs = e.abstract_expr([var.name], codom)
        return e.Bound(e.Sig(var.name), var.type, codom_abs)
    else:
        mess = "Expected {0!s} to be a constant".format(var)
        raise e.ExprError(mess, var)
Esempio n. 4
0
def exists(var, prop):
    """Create the term
    exists x:A.t from its constituents
    
    Arguments:
    - `var`: a constant expr
    - `prop`: an expression possibly containing var
    """
    if var.is_const():
        prop_abs = e.abstract_expr([var.name], prop)
        return e.Bound(e.Exists(var.name), var.type, prop_abs)
    else:
        mess = "Expected {0!s} to be a constant".format(var)
        raise e.ExprError(mess, var)
Esempio n. 5
0
def sig(var, codom):
    """Create the term
    Sig x:A.B from its constituents
    
    Arguments:
    - `var`: a constant expr
    - `codom`: an expression possibly containing var
    """
    if var.is_const():
        codom_abs = e.abstract_expr([var.name], codom)
        return e.Bound(e.Sig(var.name), var.type, codom_abs)
    else:
        mess = "Expected {0!s} to be a constant".format(var)
        raise e.ExprError(mess, var)
Esempio n. 6
0
def exists(var, prop):
    """Create the term
    exists x:A.t from its constituents
    
    Arguments:
    - `var`: a constant expr
    - `prop`: an expression possibly containing var
    """
    if var.is_const():
        prop_abs = e.abstract_expr([var.name], prop)
        return e.Bound(e.Exists(var.name), var.type, prop_abs)
    else:
        mess = "Expected {0!s} to be a constant".format(var)
        raise e.ExprError(mess, var)
Esempio n. 7
0
def pi(var, codom, impl=None):
    """Create the term
    Pi x:A.B from its constituents
    
    Arguments:
    - `var`: a constant expr
    - `codom`: an expression possibly containing var
    - `impl`: a flag which notes if the argument is implicit.
    """
    if var.is_const():
        codom_abs = e.abstract_expr([var.name], codom)
        ret = e.Bound(e.Pi(var.name), var.type, codom_abs)
        if impl:
            ret.info['implicit'] = True
        return ret
    else:
        mess = "Expected {0!s} to be a constant".format(var)
        raise e.ExprError(mess, var)
Esempio n. 8
0
def pi(var, codom, impl=None):
    """Create the term
    Pi x:A.B from its constituents
    
    Arguments:
    - `var`: a constant expr
    - `codom`: an expression possibly containing var
    - `impl`: a flag which notes if the argument is implicit.
    """
    if var.is_const():
        codom_abs = e.abstract_expr([var.name], codom)
        ret = e.Bound(e.Pi(var.name), var.type, codom_abs)
        if impl:
            ret.info['implicit'] = True
        return ret
    else:
        mess = "Expected {0!s} to be a constant".format(var)
        raise e.ExprError(mess, var)
Esempio n. 9
0
def abst(var, body):
    """Create the term
    lambda x:A.t from its constituents
    
    Arguments:
    - `var`: a constant expr
    - `body`: an expression possibly containing var
    """
    if var.is_const():
        ty, _ = mvar_infer(var.type)
        if ty.equals(e.Bool()):
            body = enrich(var.name, var.type, body)
        else:
            pass
        body_abs = e.abstract_expr([var.name], body)
        return e.Bound(e.Abst(var.name), var.type, body_abs)
    else:
        print var.__class__
        mess = "Expected {0!s} to be a constant".format(var)
        raise e.ExprError(mess, var)
Esempio n. 10
0
def abst(var, body):
    """Create the term
    lambda x:A.t from its constituents
    
    Arguments:
    - `var`: a constant expr
    - `body`: an expression possibly containing var
    """
    if var.is_const():
        ty, _ = mvar_infer(var.type)
        if ty.equals(e.Bool()):
            body = enrich(var.name, var.type, body)
        else:
            pass
        body_abs = e.abstract_expr([var.name], body)
        return e.Bound(e.Abst(var.name), var.type, body_abs)
    else:
        print var.__class__
        mess = "Expected {0!s} to be a constant".format(var)
        raise e.ExprError(mess, var)
Esempio n. 11
0
 def visit_bound(self, expr, *args, **kwargs):
     var, open_expr = e.open_bound_fresh(expr)
     new_open_expr = self.visit(open_expr)
     dom = self.visit(expr.dom)
     return e.Bound(expr.binder, dom,
                    e.abstract_expr([var], new_open_expr))