feat(frontends/lean/elaborator): add hard coded coercion from bool to Prop
This commit is contained in:
parent
b5f006d229
commit
a7c8cbc548
2 changed files with 12 additions and 0 deletions
|
|
@ -298,6 +298,11 @@ optional<expr> elaborator::ensure_has_type(expr const & e, expr const & e_type,
|
|||
type_context::approximate_scope scope(m_ctx);
|
||||
if (is_def_eq(e_type, type))
|
||||
return some_expr(e);
|
||||
|
||||
// Coercion from bool => Prop
|
||||
if (is_constant(e_type, get_bool_name()) && type == mk_Prop())
|
||||
return some_expr(mk_eq(m_ctx, e, mk_constant(get_bool_tt_name())));
|
||||
|
||||
return none_expr();
|
||||
}
|
||||
|
||||
|
|
|
|||
7
tests/lean/run/elab_bool.lean
Normal file
7
tests/lean/run/elab_bool.lean
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
variable b : bool
|
||||
|
||||
#elab if b then tt else ff
|
||||
|
||||
#elab if b && b then tt else ff
|
||||
|
||||
#elab if b ∧ b then tt else ff
|
||||
Loading…
Add table
Reference in a new issue