feat(library/user_recursors): add get_num_minors
This commit is contained in:
parent
ccdaa524f7
commit
eae26cdfae
2 changed files with 11 additions and 1 deletions
|
@ -22,6 +22,16 @@ bool recursor_info::is_minor(unsigned pos) const {
|
|||
return true;
|
||||
}
|
||||
|
||||
unsigned recursor_info::get_num_minors() const {
|
||||
unsigned r = m_num_args;
|
||||
lean_assert(r >= get_motive_pos());
|
||||
r -= get_motive_pos();
|
||||
lean_assert(m_major_pos >= get_first_index_pos());
|
||||
lean_assert(r >= m_major_pos - get_first_index_pos() + 1);
|
||||
r -= (m_major_pos - get_first_index_pos() + 1);
|
||||
return r;
|
||||
}
|
||||
|
||||
recursor_info::recursor_info(name const & r, name const & I, list<unsigned> const & univ_pos,
|
||||
bool dep_elim, unsigned num_args, unsigned major_pos,
|
||||
list<optional<unsigned>> const & params_pos, list<unsigned> const & indices_pos,
|
||||
|
|
|
@ -42,13 +42,13 @@ public:
|
|||
unsigned get_motive_pos() const { return get_num_params(); }
|
||||
unsigned get_first_index_pos() const { return m_major_pos - get_num_indices(); }
|
||||
unsigned get_major_pos() const { return m_major_pos; }
|
||||
/** \brief Return position of the recursor parameters in the major premise. */
|
||||
list<optional<unsigned>> const & get_params_pos() const { return m_params_pos; }
|
||||
/** \brief Return position of the recursor indices in the major premise. */
|
||||
list<unsigned> const & get_indices_pos() const { return m_indices_pos; }
|
||||
list<bool> const & get_produce_motive() const { return m_produce_motive; }
|
||||
bool has_dep_elim() const { return m_dep_elim; }
|
||||
bool is_minor(unsigned pos) const;
|
||||
unsigned get_num_minors() const;
|
||||
|
||||
void write(serializer & s) const;
|
||||
static recursor_info read(deserializer & d);
|
||||
|
|
Loading…
Reference in a new issue