Ejemplo n.º 1
0
void Master::processCollectedInputQuery0()
{
    CALL("processCollectedInputQuery0()");
    Clause* newClause;

    switch (_continuation)
    {
    case Continuation_Init:
        break;
    case Continuation_InputQueryClause0_ProcessCollectedInput:
    // same as below
    case Continuation_EliminateDefinitions_ProcessCollectedInput:
        goto process_next_retained_clause;
    default:
        ICP("ICP0");
        RuntimeError::report("Bad _continuation in VK::Master::processCollectedInputQuery0()");
    };


    if (_parameters.outputStreamForGenerated)
        _freshClause.output(*_parameters.outputStreamForGenerated << "% GEN "
                            << statNumOfGeneratedCl() << ' ') << '\n';
    _freshClause.ProcessCollected(_retainedNewClauses);

process_next_retained_clause:
    while (_retainedNewClauses.dequeue(newClause))
    {
        ASSERT(newClause->mainSet() == Clause::MainSetNew);

        if (newClause->isAnswer())
        {
            rememberAnswer0(newClause);
            _proof = newClause;
            return;
        };
        _continuation = Continuation_Init;

        makePassive0(newClause);
        if (_parameters.backward_subsumption) backSubsumeBy(newClause);
        if (_parameters.backward_demodulation > 0)
        {
            ASSERT(!newClause->flag(Clause::FlagInQueueForBackSimplification));
            _queueForBackSimplification.enqueue(newClause);
            newClause->setFlag(Clause::FlagInQueueForBackSimplification);
        };
        integratePassive(newClause);
    };
    ASSERT(_retainedNewClauses.empty());
}; // void Master::processCollectedInputQuery0()
Ejemplo n.º 2
0
void Master::processCollected0()
{
    CALL("processCollected0()");
    Clause* newClause;
    switch (_continuation)
    {
    case Continuation_Init:
        break;
    case Continuation_InputQueryClause0_BackSimplify:
    // same as below
    case Continuation_EliminateDefinitions_BackSimplify:
    // same as below
    case Continuation_MainLoop0_ProcessNewInference:
    // same as below
    case Continuation_MainLoop0_BackSimplify:
        goto process_retained;
    default:
        ICP("ICP0");
        RuntimeError::report("Bad _continuation in VK::Master::processCollected0()");
    };

    if (_parameters.outputStreamForGenerated) _freshClause.output(*_parameters.outputStreamForGenerated << "% GEN " << statNumOfGeneratedCl() << ' ') << '\n';
    _freshClause.ProcessCollected(_retainedNewClauses);


process_retained:
    while (_retainedNewClauses.dequeue(newClause))
    {

        ASSERT(newClause->mainSet() == Clause::MainSetNew);
        if (newClause->isAnswer())
        {
            rememberAnswer0(newClause);
            _proof = newClause;
            return;
        };

        _continuation = Continuation_Init;

        makePassive0(newClause);
        if (newClause->weight() > _parameters.maxWeight)
        {

            enqueueForDisposal(newClause);
            _statRecycled++;

        }
        else
        {
            if (_parameters.backward_subsumption)
                if (backSubsumeBy(newClause))
                    if (_parameters.orphan_murder)
                        killActiveOrphans0();

            if (_parameters.backward_demodulation > 0)
            {
                ASSERT(!newClause->flag(Clause::FlagInQueueForBackSimplification));

                _queueForBackSimplification.enqueue(newClause);

                newClause->setFlag(Clause::FlagInQueueForBackSimplification);
            };

            integratePassive(newClause);

            eliminateAllocationBufferDeficit0();
        };
    };
}; // void Master::processCollected0()
Ejemplo n.º 3
0
void Master::backSimplify()
{
    CALL("backSimplify()");
    Clause* backSimplified;
    bool someActiveSimplified;
    switch (_continuation)
    {
    case Continuation_Init:
        break;
    case Continuation_InputQueryClause0_BackSimplify:
    // same as below
    case Continuation_EliminateDefinitions_BackSimplify:
    // same as below
    case Continuation_MainLoop0_BackSimplify:
        someActiveSimplified = true;
        goto process_new_inference;
    default:
        ICP("ICP0");
        RuntimeError::report("Bad _continuation in VK::Master::backSimplify()");
    };

    ASSERT((_parameters.backward_demodulation > 0) ||
           _queueForBackSimplification.empty());
    _backwardDemodulationSemaphore = true;
    someActiveSimplified = false;
    if (_parameters.backward_demodulation > 0)
    {
next_simplifier:
        if (_queueForBackSimplification.dequeue(_currentSimplifier))
        {
            ASSERT(_currentSimplifier->flag(Clause::FlagInQueueForBackSimplification));
            _currentSimplifier->clearFlag(Clause::FlagInQueueForBackSimplification);
            if (backDemodulationQuery(_currentSimplifier))
            {
next_back_demodulated:
                if (nextBackDemodulated())
                {
                    _statBackSimplified++;

                    if (collectBackSimplified())
                    {
                        _currentSimplifier->setFlag(Clause::FlagHasChildren);
                        backSimplified = _backDemodulation.simplified();

                        someActiveSimplified = someActiveSimplified
                                               || (backSimplified->mainSet() == Clause::MainSetActive)
                                               || (backSimplified->mainSet() == Clause::MainSetDefinitions);

                        backSimplified->setFlag(Clause::FlagHasChildren);

                        enqueueForDisposal(backSimplified);

process_new_inference:
                        processCollected0(); // not before enqueueForDisposal(backSimplified)!

                        if (_proof)
                        {
                            terminate(Proof);
                            return;
                        };

                        _continuation = Continuation_Init;

                        if (_passive.Total() >= _parameters.maxPassive)
                        {
                            terminate(MaxPassive);
                            _backwardDemodulationSemaphore = false;
                            return;
                        };
                    }
                    else
                    {
                        if (_freshClause.WasTautology())
                        {
                            backSimplified = _backDemodulation.simplified();

                            enqueueForDisposal(backSimplified);
                        };
                    };
                    internalTick0();
                    goto next_back_demodulated;
                }; // if (nextBackDemodulated())
            };

            goto next_simplifier;
        }; // if (_queueForBackSimplification.dequeue(_currentSimplifier))
        if (_parameters.orphan_murder && someActiveSimplified) killActiveOrphans0();
    };
    _backwardDemodulationSemaphore = false;
}; // void Master::backSimplify()