lean4-htt/src/library/compiler/simp_inductive.h
Leonardo de Moura 124b4d37fe feat(library/compiler): port simp_inductive to the new compiler stack
This commit also fixes a bug in the old `simp_inductive` module, and
removes now obsolete files (`compiler_step_visitor` and `old_util`).
2018-10-08 16:58:43 -07:00

32 lines
1.3 KiB
C++

/*
Copyright (c) 2016 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Author: Leonardo de Moura
*/
#pragma once
#include "kernel/environment.h"
#include "library/abstract_context_cache.h"
#include "library/compiler/procedure.h"
namespace lean {
/** \brief Replaces cases_on, projections and constructor applications with _cases.idx and _cnstr.idx.
Projections are adjusted to take only relevant fields into account.
\remark nat.cases_on, nat.succ and nat.zero are ignored. */
expr simp_inductive(environment const & env, expr const & e);
/** \brief Return non-none idx iff \c e is of the form _cnstr.idx */
optional<unsigned> is_internal_cnstr(expr const & e);
/** \brief Return non-none n iff \c e is of the form _cases.n */
optional<unsigned> is_internal_cases(expr const & e);
/** \brief Return true iff 'e' is an internal cases, a nat.cases_on,
or a VM builtin cases. That is, it returns true for constants
that produce branching during code generation. */
bool is_vm_supported_cases(environment const & env, expr const & e);
/** \brief Return the number of minor premises for a vm supported cases construct. */
unsigned get_vm_supported_cases_num_minors(environment const & env, expr const & fn);
void initialize_simp_inductive();
void finalize_simp_inductive();
}