package at.ac.tuwien.dbai.alternation.examples;
/** Monotone Circuit Value Problem **/
atm MCVP(Circuit circuit,boolean[] input,int outIndex) {
Circuit.Gate<Circuit.GateTypes>  gate=circuit.getOutGate(outIndex);

    state evaluate {
        switch(gate.type)
        {
            case INPUT:
            if (input[circuit.getInputIndex(gate)]==true){
                accept;
            } else {
                reject;
            }
            case AND:
            forall{
                for(Circuit.Gate<Circuit.GateTypes> tempGate: gate.getIn()){
                    evaluate{
                        gate=tempGate;
                    }
                }
            }
            case OR:
            exists{
                for(Circuit.Gate<Circuit.GateTypes> tempGate: gate.getIn()){
                    evaluate{
                        gate=tempGate;
                    }
                }
            }
            case OUTPUT:
            exists{
                for(Circuit.Gate<Circuit.GateTypes> tempGate: gate.getIn()){
                    evaluate{
                        gate=tempGate;
                    }
                }
            }
            default: reject;
        }
    }
}