private void Prove(TypeSafeContext z3, TermAst p) { Console.WriteLine("To PROVE: {0}", z3.ToString(z3.MkNot(p))); z3.AssertCnstr(z3.MkNot(p)); z3.Display(System.Console.Out); TypeSafeModel model = null; LBool result = z3.CheckAndGetModel(ref model); switch (result) { case LBool.True: Console.WriteLine("false"); model.Display(System.Console.Out); model.Dispose(); break; case LBool.False: Console.WriteLine("true"); break; case LBool.Undef: Console.WriteLine("unknown"); break; } }
public virtual DataType ProcessTerm(TermAst term) { var firstType = ProcessFactor(term.Factor); if (term.OpFactors.Count == 0) { return(firstType); } if (!DataTypeHelper.IsLongOrDouble(firstType)) { throw new SemanticException($"First factor type {firstType} is not int or double"); } char suffix = DataTypeHelper.Suffix(firstType); foreach (var(op, factor) in term.OpFactors) { Debug.Assert(op.Value == Lexical.Tokens.Operator.Mult || op.Value == Lexical.Tokens.Operator.Divide); var factorType = ProcessFactor(factor); if (factorType != firstType) { throw new SemanticException($"Factor type '{factorType}' should equal to first type '{firstType}'"); } if (CodeGenerationEnabled) { if (op.Value == Lexical.Tokens.Operator.Mult) { ExpressionBucket.AddSingle("mul." + suffix); } else { ExpressionBucket.AddSingle("div." + suffix); } } } // list check ok return(firstType); }