001    package aima.logic.fol.inference.proof;
002    
003    import java.util.ArrayList;
004    import java.util.Collections;
005    import java.util.List;
006    import java.util.Map;
007    
008    import aima.logic.fol.kb.data.Chain;
009    import aima.logic.fol.parsing.ast.Term;
010    import aima.logic.fol.parsing.ast.Variable;
011    
012    /**
013     * @author Ciaran O'Reilly
014     * 
015     */
016    public class ProofStepChainReduction extends AbstractProofStep {
017            private List<ProofStep> predecessors = new ArrayList<ProofStep>();
018            private Chain reduction = null;
019            private Chain nearParent, farParent = null;
020            private Map<Variable, Term> subst = null;
021    
022            public ProofStepChainReduction(Chain reduction, Chain nearParent,
023                            Chain farParent, Map<Variable, Term> subst) {
024                    this.reduction = reduction;
025                    this.nearParent = nearParent;
026                    this.farParent = farParent;
027                    this.subst = subst;
028                    this.predecessors.add(farParent.getProofStep());
029                    this.predecessors.add(nearParent.getProofStep());
030            }
031    
032            //
033            // START-ProofStep
034            public List<ProofStep> getPredecessorSteps() {
035                    return Collections.unmodifiableList(predecessors);
036            }
037    
038            public String getProof() {
039                    return reduction.toString();
040            }
041    
042            public String getJustification() {
043                    return "Reduction: " + nearParent.getProofStep().getStepNumber() + ","
044                                    + farParent.getProofStep().getStepNumber() + " " + subst;
045            }
046            // END-ProofStep
047            //
048    }