Esempio n. 1
0
def defhyp(name, prop):
    """Declare a constant of type bool, add it to the
    list of hypotheses.
    
    Arguments:
    - `name`: the name of the hypothesis
    - `prop`: the proposition
    """
    c = defconst(name, prop)
    typing.infer(c.type, type=e.Bool(), ctxt=conf.current_ctxt())
    conf.current_ctxt().hyps[name] = c.type
    return c
Esempio n. 2
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. 3
0
                        .format(name, root))


###############################################################################
#
# Equality and basic sorts
#
###############################################################################


def equals(e1, e2):
    return And(Sub(e1, e2), Sub(e2, e1))


#create a single instance of Bool() and Type().
Bool = e.Bool()
Bool.info.update(st_typ)

Type = e.Type()
Type.info.update(st_typ)


@with_info(st_typ)
def mktype(name, **kwargs):
    """
    
    Arguments:
    - `name`:
    """
    return Const(name, Type, **kwargs)