public override InvariantAnalysisResult CheckInvariant(CoupledExecutableModelCreator <SafetySharpRuntimeModel> createModel, Formula formula)
        {
            var checker = new QualitativeChecker <SafetySharpRuntimeModel>(createModel);

            checker.Configuration = _analysisConfiguration;
            return(checker.CheckInvariant(formula));
        }
        /// <summary>
        ///   Checks whether the <paramref name="invariant" /> holds in all states of the <paramref name="model" />. The appropriate
        ///   model checker is chosen automatically.
        /// </summary>
        /// <param name="model">The model that should be checked.</param>
        /// <param name="invariant">The invariant that should be checked.</param>
        public static AnalysisResult <SafetySharpRuntimeModel> CheckInvariant(ModelBase model, Formula invariant)
        {
            var createModel        = SafetySharpRuntimeModel.CreateExecutedModelCreator(model, invariant);
            var qualitativeChecker = new QualitativeChecker <SafetySharpRuntimeModel> {
                Configuration = TraversalConfiguration
            };

            return(qualitativeChecker.CheckInvariant(createModel, formulaIndex: 0));
        }
        /// <summary>
        ///   Checks whether the <paramref name="invariant" /> holds in all states of the <paramref name="model" />. The appropriate
        ///   model checker is chosen automatically.
        /// </summary>
        /// <param name="model">The model that should be checked.</param>
        /// <param name="invariant">The invariant that should be checked.</param>
        public static SafetySharpInvariantAnalysisResult CheckInvariant(ModelBase model, Formula invariant)
        {
            var createModel        = SafetySharpRuntimeModel.CreateExecutedModelCreator(model, invariant);
            var qualitativeChecker = new QualitativeChecker <SafetySharpRuntimeModel>(createModel)
            {
                Configuration = TraversalConfiguration
            };
            var result = qualitativeChecker.CheckInvariant(formulaIndex: 0);

            return(SafetySharpInvariantAnalysisResult.FromInvariantAnalysisResult(result, createModel));
        }
Beispiel #4
0
        public override AnalysisResult <SafetySharpRuntimeModel> CheckInvariant(CoupledExecutableModelCreator <SafetySharpRuntimeModel> createModel, Formula formula)
        {
            var formulaIndex = Array.FindIndex(createModel.StateFormulasToCheckInBaseModel, stateFormula =>
            {
                var isEqual = IsFormulasStructurallyEquivalentVisitor.Compare(stateFormula, formula);
                return(isEqual);
            }
                                               );

            if (formulaIndex == -1)
            {
                throw new Exception($"Input formula is not checked directly. Use {nameof(AnalysisTestsWithQualitative)} instead");
            }

            return(modelChecker.CheckInvariant(createModel, formulaIndex));
        }
Beispiel #5
0
 public override AnalysisResult <SafetySharpRuntimeModel> CheckInvariant(CoupledExecutableModelCreator <SafetySharpRuntimeModel> createModel, Formula formula)
 {
     return(modelChecker.CheckInvariant(createModel, formula));
 }