/// <summary> /// And operation of two Zen List of bool. /// </summary> /// <param name="ma">list a.</param> /// <param name="mb">list b.</param> /// <returns>list of a and b.</returns> public static Zen <IList <bool> > And(this Zen <IList <bool> > ma, Zen <IList <bool> > mb) { var index = mb.Length(); var ret = ma.Select(_ => Language.And(ma.At(index -= 1).Value(), mb.At(index).Value())); return(ret); }
/// <summary> /// A pairwise invariant for a list of elements. /// </summary> /// <param name="list">The list.</param> /// <param name="f">The pairwise invariant.</param> /// <returns>A zen value for the invariant.</returns> internal static Zen <bool> PairwiseInvariant <T>(Zen <IList <T> > list, Func <Zen <T>, Zen <T>, Zen <bool> > f) { return(list.Case( empty: true, cons: (hd1, tl1) => tl1.Case( empty: true, cons: (hd2, tl2) => Language.And(f(hd1, hd2), PairwiseInvariant(tl1, f))))); }
public void TestAndException2() { Language.And(true, null); }
public void TestAndException1() { Language.And(null, true); }
/// <summary> /// Gets a Zen expression from a path constraint. /// </summary> /// <returns>The Zen expression.</returns> public Zen <bool> GetExpr() { return(Language.And(this.Conjuncts.ToArray())); }