コード例 #1
0
 /// <summary> Records hint for a cmd in the final passified Boogie program</summary>
 /// <param name="cmd">command</param>
 /// <param name="block">block containing command</param>
 /// <param name="exprVC">the computed VC for the expression in the command</param>
 /// <param name="postVC">the computed postcondition of the command</param>
 /// <param name="resultVC">Wlp(cmd, postVC)</param>
 /// <param name="subsumptionOption">The subsumption option for this cmd.</param>
 public static void NextVcHintForBlock(
     Cmd cmd,
     Block block,
     VCExpr exprVC,
     VCExpr postVC,
     VCExpr resultVC,
     CommandLineOptions.SubsumptionOption subsumptionOption
     )
 {
     if (CommandLineOptions.Clo.GenerateIsaProgNoProofs)
     {
         return;
     }
     vcHintManager.NextHintForBlock(cmd, block, exprVC, postVC, resultVC, subsumptionOption);
 }
コード例 #2
0
        //hints must be provided in a backwards manner (from last to first command)
        public void NextHintForBlock(
            Cmd cmd,
            Block block,
            VCExpr exprVC,
            VCExpr postVC,
            VCExpr resultVC,
            CommandLineOptions.SubsumptionOption subsumption)
        {
            VCHint           vcHint;
            List <LemmaDecl> requiredDecls;

            if (cmd is AssumeCmd assumeCmd)
            {
                vcHint = AssumeStmtHint(assumeCmd, exprVC, postVC, resultVC, out requiredDecls);
            }
            else if (cmd is AssertCmd assertCmd)
            {
                vcHint = AssertStmtHint(assertCmd, exprVC, postVC, subsumption, out requiredDecls);
            }
            else
            {
                throw new ProofGenUnexpectedStateException(GetType(), "expected an assert or assume cmd");
            }

            if (!_blockTo.TryGetValue(block, out var vcHintBlock))
            {
                vcHintBlock = new VCHintBlock(block);
                _blockTo.Add(block, vcHintBlock);
            }

            if (requiredDecls != null)
            {
                vcHintBlock.AddRequiredDecls(requiredDecls);
            }

            vcHintBlock.AddHint(cmd, vcHint);
        }
コード例 #3
0
        /// <summary>
        ///     If no lemma is required for the proof, then <paramref name="decl" /> is null.
        /// </summary>
        private VCHint AssertStmtHint(
            AssertCmd cmd,
            VCExpr exprVC,
            VCExpr postVC,
            CommandLineOptions.SubsumptionOption subsumption,
            out List <LemmaDecl> requiredDecls)
        {
            requiredDecls = null;

            if (exprVC.Equals(VCExpressionGenerator.False) || postVC.Equals(VCExpressionGenerator.False))
            {
                return(new AssertSimpleHint(AssertSimpleHint.AssertSimpleType.ASSERT_FALSE));
            }

            if (exprVC.Equals(VCExpressionGenerator.True))
            {
                return(new AssertSimpleHint(AssertSimpleHint.AssertSimpleType.ASSERT_TRUE));
            }

            if (postVC.Equals(VCExpressionGenerator.True))
            {
                _vcRewriteLemmaGen.RequiredVcRewrite(cmd.Expr, false, out requiredDecls);
                return(new AssertSimpleHint(AssertSimpleHint.AssertSimpleType.NO_CONJ, new VCExprHint(requiredDecls)));
            }

            _vcRewriteLemmaGen.RequiredVcRewrite(cmd.Expr, false, out requiredDecls);
            if (
                subsumption == CommandLineOptions.SubsumptionOption.Always ||
                subsumption == CommandLineOptions.SubsumptionOption.NotForQuantifiers && !(exprVC is VCExprQuantifier)
                )
            {
                return(new AssertSimpleHint(AssertSimpleHint.AssertSimpleType.SUBSUMPTION,
                                            new VCExprHint(requiredDecls)));
            }
            return(new AssertSimpleHint(AssertSimpleHint.AssertSimpleType.CONJ, new VCExprHint(requiredDecls)));
        }