956f203a55
The directory bindings/lua was getting too big and had too many dependencies. Moreover, it was getting too painful to edit/maintain two different places. Now, the bindings for module X are in the directory that defines X. For example, the bindings for util/name.cpp are located at util/name.cpp. The only exception is the kernel. We do not want to inflate the kernel with Lua bindings. The bindings for the kernel classes are located at bindings/kernel_bindings. Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
61 lines
2.2 KiB
C++
61 lines
2.2 KiB
C++
/*
|
|
Copyright (c) 2013 Microsoft Corporation. All rights reserved.
|
|
Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
Author: Leonardo de Moura
|
|
*/
|
|
#pragma once
|
|
#include "util/lua.h"
|
|
#include "kernel/expr.h"
|
|
#include "kernel/builtin.h"
|
|
#include "util/numerics/mpz.h"
|
|
|
|
namespace lean {
|
|
/** \brief Natural numbers type */
|
|
expr mk_nat_type();
|
|
extern expr const Nat;
|
|
|
|
/** \brief Return the value of type Natural number that represents \c v. */
|
|
expr mk_nat_value(mpz const & v);
|
|
inline expr mk_nat_value(unsigned v) { return mk_nat_value(mpz(v)); }
|
|
inline expr nVal(unsigned v) { return mk_nat_value(v); }
|
|
bool is_nat_value(expr const & e);
|
|
mpz const & nat_value_numeral(expr const & e);
|
|
|
|
/** \brief Addition, Nat::add : Nat -> Nat -> Nat */
|
|
expr mk_nat_add_fn();
|
|
inline expr nAdd(expr const & e1, expr const & e2) { return mk_app(mk_nat_add_fn(), e1, e2); }
|
|
|
|
/** \brief Multiplication, Nat::mul : Nat -> Nat -> Nat */
|
|
expr mk_nat_mul_fn();
|
|
inline expr nMul(expr const & e1, expr const & e2) { return mk_app(mk_nat_mul_fn(), e1, e2); }
|
|
|
|
/** \brief Less than or equal to, Nat::le : Nat -> Nat -> Bool */
|
|
expr mk_nat_le_fn();
|
|
inline expr nLe(expr const & e1, expr const & e2) { return mk_app(mk_nat_le_fn(), e1, e2); }
|
|
|
|
/** \brief Greater than or equal to, Nat::ge : Nat -> Nat -> Bool */
|
|
expr mk_nat_ge_fn();
|
|
inline expr nGe(expr const & e1, expr const & e2) { return mk_app(mk_nat_ge_fn(), e1, e2); }
|
|
|
|
/** \brief Less than, Nat::lt : Nat -> Nat -> Bool */
|
|
expr mk_nat_lt_fn();
|
|
inline expr nLt(expr const & e1, expr const & e2) { return mk_app(mk_nat_lt_fn(), e1, e2); }
|
|
|
|
/** \brief Greater than, Nat::gt : Nat -> Nat -> Bool */
|
|
expr mk_nat_gt_fn();
|
|
inline expr nGt(expr const & e1, expr const & e2) { return mk_app(mk_nat_gt_fn(), e1, e2); }
|
|
|
|
/** \brief Identity function for natural numbers, Nat::id : Nat -> Nat */
|
|
expr mk_nat_id_fn();
|
|
inline expr nId(expr const & e) { return mk_app(mk_nat_id_fn(), e); }
|
|
|
|
/** \brief If-then-else for natural numbers */
|
|
inline expr nIf(expr const & c, expr const & t, expr const & e) { return mk_if(Nat, c, t, e); }
|
|
|
|
class environment;
|
|
/** \brief Import Natural number library in the given environment (if it has not been imported already). */
|
|
void import_nat(environment & env);
|
|
|
|
void open_nat(lua_State * L);
|
|
}
|