コード例 #1
0
ファイル: AbsyQuant.cs プロジェクト: luckysunda/hice-dt
        // if the user says ( forall x :: forall y :: { f(x,y) } ... ) we transform it to
        // (forall x, y :: { f(x,y) } ... ) otherwise the prover ignores the trigger
        private void MergeAdjecentQuantifier()
        {
            QuantifierExpr qbody = Body as QuantifierExpr;

            if (!(qbody != null && (qbody is ForallExpr) == (this is ForallExpr) && Triggers == null))
            {
                return;
            }
            qbody.MergeAdjecentQuantifier();
            if (qbody.Triggers == null)
            {
                return;
            }
            Body = qbody.Body;
            TypeParameters.AddRange(qbody.TypeParameters);
            Dummies.AddRange(qbody.Dummies);
            Triggers = qbody.Triggers;
            if (qbody.Attributes != null)
            {
                if (Attributes == null)
                {
                    Attributes = qbody.Attributes;
                }
                else
                {
                    QKeyValue p = Attributes;
                    while (p.Next != null)
                    {
                        p = p.Next;
                    }
                    p.Next = qbody.Attributes;
                }
            }
        }
コード例 #2
0
ファイル: QuantifierSplitter.cs プロジェクト: dbremner/dafny
        internal static IEnumerable<Expression> SplitQuantifier(QuantifierExpr quantifier)
        {
            var body = quantifier.Term;
              var binary = body as BinaryExpr;

              if (quantifier is ForallExpr) {
            IEnumerable<Expression> stream;
            if (binary != null && (binary.Op == BinaryExpr.Opcode.Imp || binary.Op == BinaryExpr.Opcode.Or)) {
              stream = SplitAndStich(binary, BinaryExpr.Opcode.And);
            } else {
              stream = SplitExpr(body, BinaryExpr.Opcode.And);
            }
            foreach (var e in stream) {
              var tok = new NestedToken(quantifier.tok, e.tok);
              yield return new ForallExpr(tok, quantifier.TypeArgs, quantifier.BoundVars, quantifier.Range, e, CopyAttributes(quantifier.Attributes)) { Type = quantifier.Type };
            }
              } else if (quantifier is ExistsExpr) {
            IEnumerable<Expression> stream;
            if (binary != null && binary.Op == BinaryExpr.Opcode.And) {
              stream = SplitAndStich(binary, BinaryExpr.Opcode.Or);
            } else {
              stream = SplitExpr(body, BinaryExpr.Opcode.Or);
            }
            foreach (var e in stream) {
              var tok = new NestedToken(quantifier.tok, e.tok);
              yield return new ExistsExpr(tok, quantifier.TypeArgs, quantifier.BoundVars, quantifier.Range, e, CopyAttributes(quantifier.Attributes)) { Type = quantifier.Type };
            }
              } else {
            yield return quantifier;
              }
        }
コード例 #3
0
ファイル: StandardVisitor.cs プロジェクト: luckysunda/hice-dt
 public virtual QuantifierExpr VisitQuantifierExpr(QuantifierExpr node)
 {
     Contract.Requires(node != null);
     Contract.Ensures(Contract.Result <QuantifierExpr>() != null);
     node = cce.NonNull((QuantifierExpr)this.VisitBinderExpr(node));
     if (node.Triggers != null)
     {
         node.Triggers = this.VisitTrigger(node.Triggers);
     }
     return(node);
 }
コード例 #4
0
 public override QuantifierExpr VisitQuantifierExpr(QuantifierExpr node)
 {
     currentTrigger = node.Triggers;
     while (currentTrigger != null)
     {
         foreach (var e in currentTrigger.Tr)
         {
             VisitExpr(e);
         }
         currentTrigger = currentTrigger.Next;
     }
     return(base.VisitQuantifierExpr(node));
 }
コード例 #5
0
ファイル: AbsyQuant.cs プロジェクト: luckysunda/hice-dt
 public override QuantifierExpr VisitQuantifierExpr(QuantifierExpr node)
 {
     // don't go into quantifier expression or its triggers, since the terms in there may have more bound variables
     // (note, with only the VisitBinderExpr override below, we'd still be visiting triggers, which we don't want to do)
     return(node);
 }
コード例 #6
0
ファイル: AbsyQuant.cs プロジェクト: luckysunda/hice-dt
 public NeverTriggerCollector(QuantifierExpr p)
 {
     Contract.Requires(p != null);
     parent = p;
 }
コード例 #7
0
ファイル: QuantifierSplitter.cs プロジェクト: dbremner/dafny
 private static bool AllowsSplitting(QuantifierExpr quantifier)
 {
     bool splitAttr = true;
       return !Attributes.ContainsBool(quantifier.Attributes, "split", ref splitAttr) || splitAttr;
 }
コード例 #8
0
 public override QuantifierExpr VisitQuantifierExpr(QuantifierExpr node)
 {
   currentTrigger = node.Triggers;
   while (currentTrigger != null)
   {
     foreach (var e in currentTrigger.Tr)
     {
       VisitExpr(e);
     }
     currentTrigger = currentTrigger.Next;
   }
   return base.VisitQuantifierExpr(node);
 }
コード例 #9
0
ファイル: StandardVisitor.cs プロジェクト: qunyanm/boogie
 public virtual QuantifierExpr VisitQuantifierExpr(QuantifierExpr node) {
   Contract.Requires(node != null);
   Contract.Ensures(Contract.Result<QuantifierExpr>() != null);
   node = cce.NonNull((QuantifierExpr)this.VisitBinderExpr(node));
   if (node.Triggers != null) {
     node.Triggers = this.VisitTrigger(node.Triggers);
   }
   return node;
 }
コード例 #10
0
ファイル: StandardVisitor.cs プロジェクト: qunyanm/boogie
 public override QuantifierExpr VisitQuantifierExpr(QuantifierExpr node)
 {
     Contract.Ensures(Contract.Result<QuantifierExpr>() == node);
     this.VisitBinderExpr(node);
     if (node.Triggers != null)
     {
         this.VisitTrigger(node.Triggers);
     }
     return node;
 }
コード例 #11
0
ファイル: ICEHoudini.cs プロジェクト: Chenguang-Zhu/ICE-C5
            public override QuantifierExpr VisitQuantifierExpr(QuantifierExpr node)
            {
                var oldE = existentialExpr;

                if (node is ExistsExpr)
                    existentialExpr = (node as ExistsExpr);

                node = base.VisitQuantifierExpr(node);

                existentialExpr = oldE;
                return node;
            }
コード例 #12
0
ファイル: AbsyQuant.cs プロジェクト: qunyanm/boogie
 public override QuantifierExpr VisitQuantifierExpr(QuantifierExpr node) {
   // don't go into quantifier expression or its triggers, since the terms in there may have more bound variables
   // (note, with only the VisitBinderExpr override below, we'd still be visiting triggers, which we don't want to do)
   return node;
 }
コード例 #13
0
ファイル: AbsyQuant.cs プロジェクト: qunyanm/boogie
 public NeverTriggerCollector(QuantifierExpr p) {
   Contract.Requires(p != null);
   parent = p;
 }
コード例 #14
0
 public override QuantifierExpr VisitQuantifierExpr(QuantifierExpr node)
 {
     // Don't remove this implementation! Triggers should be duplicated in VisitBinderExpr.
     return((QuantifierExpr)this.VisitBinderExpr(node));
 }