lean4-htt/src/tests/library/deep_copy.cpp
Leonardo de Moura 603dafbaf7 refactor(kernel): remove 'let'-expressions
We simulate it in the following way:
1- An opaque 'let'-expressions (let x : t := v in b) is encoded as
      ((fun (x : t), b) v)
   We also use a macro (let-macro) to mark this pattern.
   Thus, the pretty-printer knows how to display it correctly.

2- Transparent 'let'-expressions are eagerly expanded by the parser.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-24 16:27:27 -07:00

30 lines
732 B
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
*/
#include "util/test.h"
#include "kernel/for_each_fn.h"
#include "kernel/abstract.h"
#include "library/deep_copy.h"
using namespace lean;
static void tst1() {
expr f = Const("f");
expr a = Const("a");
expr x = Var(0);
expr t = Type;
expr z = Const("z");
expr m = mk_metavar("a", Type);
expr F = mk_pi("y", t, mk_lambda("x", t, f(f(f(x, a), Const("10")), f(x, m))));
expr G = deep_copy(F);
lean_assert(F == G);
lean_assert(!is_eqp(F, G));
}
int main() {
save_stack_info();
tst1();
return has_violations() ? 1 : 0;
}