2013-08-04 16:37:52 +00:00
|
|
|
/*
|
|
|
|
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
|
2014-01-10 02:09:53 +00:00
|
|
|
#include "kernel/io_state.h"
|
|
|
|
#include "kernel/kernel_decls.h"
|
2013-08-04 16:37:52 +00:00
|
|
|
|
|
|
|
namespace lean {
|
2013-12-30 19:46:03 +00:00
|
|
|
// See src/builtin/kernel.lean for signatures.
|
2013-09-02 16:11:53 +00:00
|
|
|
extern expr const TypeU;
|
2013-08-06 03:06:07 +00:00
|
|
|
|
|
|
|
/** \brief Return the Lean Boolean type. */
|
2013-08-06 18:27:14 +00:00
|
|
|
expr mk_bool_type();
|
2013-09-02 16:11:53 +00:00
|
|
|
extern expr const Bool;
|
2013-11-26 19:30:18 +00:00
|
|
|
bool is_bool(expr const & e);
|
2013-08-04 16:37:52 +00:00
|
|
|
|
2013-08-06 03:06:07 +00:00
|
|
|
/** \brief Create a Lean Boolean value (true/false) */
|
2013-08-06 18:27:14 +00:00
|
|
|
expr mk_bool_value(bool v);
|
2013-09-02 16:11:53 +00:00
|
|
|
extern expr const True;
|
|
|
|
extern expr const False;
|
2013-08-06 03:06:07 +00:00
|
|
|
/** \brief Return true iff \c e is a Lean Boolean value. */
|
2013-08-04 16:37:52 +00:00
|
|
|
bool is_bool_value(expr const & e);
|
2013-08-06 03:06:07 +00:00
|
|
|
/**
|
|
|
|
\brief Convert a Lean Boolean value into a C++ Boolean value.
|
|
|
|
\pre is_bool_value(e)
|
|
|
|
*/
|
2013-08-04 16:37:52 +00:00
|
|
|
bool to_bool(expr const & e);
|
2013-08-06 03:06:07 +00:00
|
|
|
/** \brief Return true iff \c e is the Lean true value. */
|
2013-08-04 16:37:52 +00:00
|
|
|
bool is_true(expr const & e);
|
2013-08-06 03:06:07 +00:00
|
|
|
/** \brief Return true iff \c e is the Lean false value. */
|
2013-08-04 16:37:52 +00:00
|
|
|
bool is_false(expr const & e);
|
2013-08-05 21:23:43 +00:00
|
|
|
|
2014-01-16 23:07:51 +00:00
|
|
|
expr mk_eq_fn();
|
|
|
|
bool is_eq_fn(expr const & e);
|
|
|
|
inline expr mk_eq(expr const & A, expr const & lhs, expr const & rhs) { return mk_app(mk_eq_fn(), A, lhs, rhs); }
|
|
|
|
inline bool is_eq(expr const & e) { return is_app(e) && is_eq_fn(arg(e, 0)); }
|
|
|
|
|
2013-08-07 03:21:43 +00:00
|
|
|
inline expr Implies(expr const & e1, expr const & e2) { return mk_implies(e1, e2); }
|
2013-08-06 18:27:14 +00:00
|
|
|
inline expr And(expr const & e1, expr const & e2) { return mk_and(e1, e2); }
|
|
|
|
inline expr Or(expr const & e1, expr const & e2) { return mk_or(e1, e2); }
|
|
|
|
inline expr Not(expr const & e) { return mk_not(e); }
|
|
|
|
inline expr Exists(expr const & A, expr const & P) { return mk_exists(A, P); }
|
2014-01-10 02:09:53 +00:00
|
|
|
// inline expr hEq(expr const & A, expr const & l, expr const & r) { return mk_eq(A, l, r); }
|
2013-08-06 03:06:07 +00:00
|
|
|
|
2014-01-02 21:03:25 +00:00
|
|
|
void import_kernel(environment const & env, io_state const & ios);
|
2013-08-04 16:37:52 +00:00
|
|
|
}
|