fn ensure_answer_recursively(
        &mut self,
        table: TableIndex,
        answer: AnswerIndex,
    ) -> RecursiveSearchResult<EnsureSuccess> {
        info_heading!(
            "ensure_answer_recursively(table={:?}, answer={:?})",
            table,
            answer
        );
        info!("table goal = {:#?}", self.tables[table].table_goal);

        // First, check for a tabled answer.
        if self.tables[table].answer(answer).is_some() {
            info!("answer cached = {:?}", self.tables[table].answer(answer));
            return Ok(EnsureSuccess::AnswerAvailable);
        }

        // If no tabled answer is present, we ought to be requesting
        // the next available index.
        assert_eq!(self.tables[table].next_answer_index(), answer);

        // Next, check if the table is already active. If so, then we
        // have a recursive attempt.
        if let Some(depth) = self.stack.is_active(table) {
            info!("ensure_answer: cycle detected at depth {:?}", depth);

            if self.top_of_stack_is_coinductive_from(depth) {
                return Ok(EnsureSuccess::Coinductive);
            }

            return Err(RecursiveSearchFail::Cycle(Minimums {
                positive: self.stack[depth].dfn,
                negative: DepthFirstNumber::MAX,
            }));
        }

        let dfn = self.next_dfn();
        let depth = self.stack.push(table, dfn);
        let result = self.pursue_next_strand(depth);
        self.stack.pop(table, depth);
        info!("ensure_answer: result = {:?}", result);
        result.map(|()| EnsureSuccess::AnswerAvailable)
    }
/// Ensures that answer with the given index is available from the
/// given table. Returns `Ok` if there is an answer:
///
/// - `EnsureSuccess::AnswerAvailable` means that the answer is
///   cached in the table (and can be fetched with e.g. `self.answer()`).
/// - `EnsureSuccess::Coinductive` means that this was a cyclic
///   request of a coinductive goal and is thus considered true;
///   in this case, the answer is not cached in the table (it is
///   only true in this cyclic context).
///
/// This function first attempts to fetch answer that is cached in
/// the table. If none is found, then we will if the table is on
/// the stack; if so, that constitutes a cycle (producing a new
/// result for the table X required producing a new result for the
/// table X), and we return a suitable result. Otherwise, we can
/// push the table onto the stack and select the next available
/// strand -- if none are available, then no more answers are
/// possible.
Ensures that answer with the given index is available from the
given table. Returns `Ok` if there is an answer.

`EnsureSuccess::AnswerAvailable` means that the answer is
cached in the table (and can be fetched with e.g.

This function first attempts to fetch answer that is cached in
the table. If none is found, then we will if the table is on
the stack; if so, that constitutes a cycle (producing a new
result for the table X required producing a new result for the
table X), and we return a suitable result. Otherwise, we can
push the table onto the stack and select the next available
strand -- if none are available, then no more answers are
possible.
Ensures that answer with the given index is available from the given table . Returns ` Ok ` if there is an answer . ` EnsureSuccess :: AnswerAvailable ` means that the answer is cached in the table ( and can be fetched with e . g . This function first attempts to fetch answer that is cached in the table . If none is found then we will if the table is on the stack ; if so that constitutes a cycle ( producing a new result for the table X required producing a new result for the table X ) and we return a suitable result . Otherwise we can push the table onto the stack and select the next available strand -- if none are available then no more answers are possible .
fn ensure_answer_recursively(
        &mut self,
        table: TableIndex,
        answer: AnswerIndex,
    ) -> RecursiveSearchResult<EnsureSuccess> {
        info_heading!(
            "ensure_answer_recursively(table={:?}, answer={:?})",
            table,
            answer
        );
        info!("table goal = {:#?}", self.tables[table].table_goal);
        // First, check for a tabled answer.
        if self.tables[table].answer(answer).is_some() {
            info!("answer cached = {:?}", self.tables[table].answer(answer));
            return Ok(EnsureSuccess::AnswerAvailable);
        }
        // If no tabled answer is present, we ought to be requesting
        // the next available index.
        assert_eq!(self.tables[table].next_answer_index(), answer);
        // Next, check if the table is already active. If so, then we
        // have a recursive attempt.
        if let Some(depth) = self.stack.is_active(table) {
            info!("ensure_answer: cycle detected at depth {:?}", depth);
            if self.top_of_stack_is_coinductive_from(depth) {
                return Ok(EnsureSuccess::Coinductive);
            }
            return Err(RecursiveSearchFail::Cycle(Minimums {
                positive: self.stack[depth].dfn,
                negative: DepthFirstNumber::MAX,
            }));
        }
        let dfn = self.next_dfn();
        let depth = self.stack.push(table, dfn);
        let result = self.pursue_next_strand(depth);
        self.stack.pop(table, depth);
        info!("ensure_answer: result = {:?}", result);
        result.map(|()| EnsureSuccess::AnswerAvailable)
    }
fn ensure_answer_recursively ( & mut self , table : TableIndex , answer : AnswerIndex , ) -> RecursiveSearchResult < EnsureSuccess > { info_heading ! ( " " table answer ) ; info ! ( " " self tables [ table ] table_goal ) ; // First, check for a tabled answer. if self . tables [ table ] . answer ( answer ) . is_some ( ) { info ! ( " " self tables [ table ] answer ( answer ) ) ; return Ok ( EnsureSuccess :: AnswerAvailable ) ; } // If no tabled answer is present, we ought to be requesting // the next available index. assert_eq ! ( self tables [ table ] next_answer_index ( ) answer ) ; // Next, check if the table is already active. If so, then we // have a recursive attempt. if let Some ( depth ) = self . stack . is_active ( table ) { info ! ( " " depth ) ; if self . top_of_stack_is_coinductive_from ( depth ) { return Ok ( EnsureSuccess :: Coinductive ) ; } return Err ( RecursiveSearchFail :: Cycle ( Minimums { positive : self . stack [ depth ] . dfn , negative : DepthFirstNumber :: MAX , } ) ) ; } let dfn = self . next_dfn ( ) ; let depth = self . stack . push ( table , dfn ) ; let result = self . pursue_next_strand ( depth ) ; self . stack . pop ( table , depth ) ; info ! ( " " result ) ; result . map ( | ( ) | EnsureSuccess :: AnswerAvailable ) }
Ensures that answer with the given index is available from the
given table.
Ensures that answer with the given index is available from the given table .
&mut self
table
TableIndex
answer
AnswerIndex
&mut self
table
TableIndex
answer
AnswerIndex