예제 #1
0
    // the product basis a x b.
    public ProofBasis(ProofBasis a, ProofBasis b)
    {
        var productPremises = new List <Expression>();

        productPremises.AddRange(a.Premises);
        foreach (var bPremise in b.Premises)
        {
            productPremises.Add(bPremise.Substitute(a.Substitution));
        }

        var productSubstitution = Compose(a.Substitution, b.Substitution);

        Premises     = productPremises;
        Substitution = productSubstitution;
    }
예제 #2
0
    public override bool Equals(object o)
    {
        if (!(o is ProofBasis))
        {
            return(false);
        }

        ProofBasis that = o as ProofBasis;

        if (this.Premises.Count != that.Premises.Count)
        {
            return(false);
        }

        for (int i = 0; i < Premises.Count; i++)
        {
            if (!this.Premises[i].Equals(that.Premises[i]))
            {
                return(false);
            }
        }

        if (this.Substitution.Count != that.Substitution.Count)
        {
            return(false);
        }

        foreach (var assignment in this.Substitution.Keys)
        {
            if (!that.Substitution.ContainsKey(assignment))
            {
                return(false);
            }

            if (!this.Substitution[assignment].Equals(that.Substitution[assignment]))
            {
                return(false);
            }
        }

        return(true);
    }
예제 #3
0
 public void Add(ProofBasis basis)
 {
     ProofBasisCollection.Add(basis);
 }
예제 #4
0
 public bool Contains(ProofBasis basis)
 {
     return(ProofBasisCollection.Contains(basis));
 }