fix(kernel): remove ios hack

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2014-01-02 13:03:25 -08:00
parent 9c5fa72f56
commit b81d3309b9
11 changed files with 18 additions and 22 deletions

View file

@ -559,15 +559,15 @@ static lean_extension & to_ext(environment const & env) {
void init_frontend(environment const & env, io_state & ios, bool no_kernel) { void init_frontend(environment const & env, io_state & ios, bool no_kernel) {
ios.set_formatter(mk_pp_formatter(env)); ios.set_formatter(mk_pp_formatter(env));
if (!no_kernel) { if (!no_kernel) {
import_kernel(env); import_kernel(env, ios);
import_nat(env); import_nat(env, ios);
} }
} }
void init_test_frontend(environment const & env, io_state & ios) { void init_test_frontend(environment const & env, io_state & ios) {
env->set_trusted_imported(true); env->set_trusted_imported(true);
init_frontend(env, ios); init_frontend(env, ios);
import_int(env); import_int(env, ios);
import_real(env); import_real(env, ios);
} }
void init_test_frontend(environment const & env) { void init_test_frontend(environment const & env) {
io_state ios; io_state ios;

View file

@ -171,8 +171,7 @@ MK_CONSTANT(forall_intro_fn, name("ForallIntro"));
MK_CONSTANT(exists_elim_fn, name("ExistsElim")); MK_CONSTANT(exists_elim_fn, name("ExistsElim"));
MK_CONSTANT(exists_intro_fn, name("ExistsIntro")); MK_CONSTANT(exists_intro_fn, name("ExistsIntro"));
void import_kernel(environment const & env) { void import_kernel(environment const & env, io_state const & ios) {
io_state ios;
env->import("kernel", ios); env->import("kernel", ios);
} }
} }

View file

@ -218,6 +218,6 @@ inline expr ExistsElim(expr const & A, expr const & P, expr const & B, expr cons
expr mk_exists_intro_fn(); expr mk_exists_intro_fn();
inline expr ExistsIntro(expr const & A, expr const & P, expr const & a, expr const & H) { return mk_app(mk_exists_intro_fn(), A, P, a, H); } inline expr ExistsIntro(expr const & A, expr const & P, expr const & a, expr const & H) { return mk_app(mk_exists_intro_fn(), A, P, a, H); }
class io_state;
void import_kernel(environment const & env); void import_kernel(environment const & env, io_state const & ios);
} }

View file

@ -7,9 +7,9 @@ Author: Leonardo de Moura
#include "library/arith/arith.h" #include "library/arith/arith.h"
namespace lean { namespace lean {
void import_arith(environment const & env) { void import_arith(environment const & env, io_state const & ios) {
import_nat(env); import_nat(env, ios);
import_int(env); import_int(env, ios);
import_real(env); import_real(env, ios);
} }
} }

View file

@ -14,5 +14,5 @@ class environment;
/** /**
\brief Import all arithmetic related builtin libraries. \brief Import all arithmetic related builtin libraries.
*/ */
void import_arith(environment const & env); void import_arith(environment const & env, io_state const & ios);
} }

View file

@ -156,8 +156,7 @@ static register_builtin_fn nat_to_int_blt("nat_to_int", []() { return mk_nat_to_
MK_CONSTANT(nat_sub_fn, name({"Nat", "sub"})); MK_CONSTANT(nat_sub_fn, name({"Nat", "sub"}));
MK_CONSTANT(nat_neg_fn, name({"Nat", "neg"})); MK_CONSTANT(nat_neg_fn, name({"Nat", "neg"}));
void import_int(environment const & env) { void import_int(environment const & env, io_state const & ios) {
io_state ios;
env->import("Int", ios); env->import("Int", ios);
} }

View file

@ -90,7 +90,7 @@ class environment;
\brief Import Integer number library in the given environment (if it has not been imported already). \brief Import Integer number library in the given environment (if it has not been imported already).
It will also load the natural number library. It will also load the natural number library.
*/ */
void import_int(environment const & env); void import_int(environment const & env, io_state const & ios);
void open_int(lua_State * L); void open_int(lua_State * L);
} }

View file

@ -115,8 +115,7 @@ MK_CONSTANT(nat_lt_fn, name({"Nat", "lt"}));
MK_CONSTANT(nat_gt_fn, name({"Nat", "gt"})); MK_CONSTANT(nat_gt_fn, name({"Nat", "gt"}));
MK_CONSTANT(nat_id_fn, name({"Nat", "id"})); MK_CONSTANT(nat_id_fn, name({"Nat", "id"}));
void import_nat(environment const & env) { void import_nat(environment const & env, io_state const & ios) {
io_state ios;
env->import("Nat", ios); env->import("Nat", ios);
} }

View file

@ -55,7 +55,7 @@ inline expr nIf(expr const & c, expr const & t, expr const & e) { return mk_if(N
class environment; class environment;
/** \brief Import Natural number library in the given environment (if it has not been imported already). */ /** \brief Import Natural number library in the given environment (if it has not been imported already). */
void import_nat(environment const & env); void import_nat(environment const & env, io_state const & ios);
void open_nat(lua_State * L); void open_nat(lua_State * L);
} }

View file

@ -157,8 +157,7 @@ MK_CONSTANT(real_lt_fn, name({"Real", "lt"}));
MK_CONSTANT(real_gt_fn, name({"Real", "gt"})); MK_CONSTANT(real_gt_fn, name({"Real", "gt"}));
MK_CONSTANT(nat_to_real_fn, name("nat_to_real")); MK_CONSTANT(nat_to_real_fn, name("nat_to_real"));
void import_real(environment const & env) { void import_real(environment const & env, io_state const & ios) {
io_state ios;
env->import("Real", ios); env->import("Real", ios);
} }

View file

@ -67,7 +67,7 @@ inline expr rIf(expr const & c, expr const & t, expr const & e) { return mk_if(R
class environment; class environment;
/** \brief Import (basic) Real number library in the given environment (if it has not been imported already). */ /** \brief Import (basic) Real number library in the given environment (if it has not been imported already). */
void import_real(environment const & env); void import_real(environment const & env, io_state const & ios);
/** \brief Coercion from int to real */ /** \brief Coercion from int to real */
expr mk_int_to_real_fn(); expr mk_int_to_real_fn();