Beispiel #1
0
		/// <summary>
		///   Checks whether the <paramref name="invariant" /> holds in all states of the <paramref name="model" />.
		/// </summary>
		/// <param name="model">The model that should be checked.</param>
		/// <param name="invariant">The invariant that should be checked.</param>
		public AnalysisResult CheckInvariant(ModelBase model, Formula invariant)
		{
			Requires.NotNull(model, nameof(model));
			Requires.NotNull(invariant, nameof(invariant));

			var visitor = new IsStateFormulaVisitor();
			visitor.Visit(invariant);

			if (!visitor.IsStateFormula)
				throw new InvalidOperationException("Invariants must be non-temporal state formulas.");

			var transformationVisitor = new LtsMinLtlTransformer();
			transformationVisitor.Visit(invariant);

			return Check(model, invariant,
				$"--invariant=\"({RuntimeModel.ConstructionStateName} == 1) || ({transformationVisitor.TransformedFormula})\"");
		}
Beispiel #2
0
        /// <summary>
        ///   Checks whether the <paramref name="formula" /> holds in all states of the <paramref name="model" />.
        /// </summary>
        /// <param name="createModel">The creator for the model that should be checked.</param>
        /// <param name="invariant">The invariant that should be checked.</param>
        internal InvariantAnalysisResult CheckInvariant(CoupledExecutableModelCreator <SafetySharpRuntimeModel> createModel, Formula invariant)
        {
            Requires.NotNull(createModel, nameof(createModel));
            Requires.NotNull(invariant, nameof(invariant));

            if (!invariant.IsStateFormula())
            {
                throw new InvalidOperationException("Invariants must be non-temporal state formulas.");
            }

            var transformationVisitor = new LtsMinLtlTransformer();

            transformationVisitor.Visit(invariant);

            return(Check(createModel,
                         $"--invariant=\"({ConstructionStateName} == 1) || ({transformationVisitor.TransformedFormula})\""));
        }
Beispiel #3
0
        /// <summary>
        ///   Checks whether the <paramref name="formula" /> holds in all states of the <paramref name="model" />.
        /// </summary>
        /// <param name="createModel">The creator for the model that should be checked.</param>
        /// <param name="formula">The formula that should be checked.</param>
        public AnalysisResult <SafetySharpRuntimeModel> Check(CoupledExecutableModelCreator <SafetySharpRuntimeModel> createModel, Formula formula)
        {
            Requires.NotNull(createModel, nameof(createModel));
            Requires.NotNull(formula, nameof(formula));

            var visitor = new IsLtlFormulaVisitor();

            visitor.Visit(formula);

            if (!visitor.IsLtlFormula)
            {
                throw new NotSupportedException("CTL model checking is currently not supported with LtsMin.");
            }

            var transformationVisitor = new LtsMinLtlTransformer();

            transformationVisitor.Visit(new UnaryFormula(formula, UnaryOperator.Next));

            return(Check(createModel, $"--ltl=\"{transformationVisitor.TransformedFormula}\""));
        }
Beispiel #4
0
        /// <summary>
        ///   Checks whether the <paramref name="formula" /> holds in all states of the <paramref name="model" />.
        /// </summary>
        /// <param name="model">The model that should be checked.</param>
        /// <param name="formula">The formula that should be checked.</param>
        public AnalysisResult Check(ModelBase model, Formula formula)
        {
            Requires.NotNull(model, nameof(model));
            Requires.NotNull(formula, nameof(formula));

            var visitor = new IsLtlFormulaVisitor();

            visitor.Visit(formula);

            if (!visitor.IsLtlFormula)
            {
                throw new NotSupportedException("CTL model checking is currently not supported with LtsMin.");
            }

            var transformationVisitor = new LtsMinLtlTransformer();

            transformationVisitor.Visit(new UnaryFormula(formula, UnaryOperator.Next));

            return(Check(model, formula, $"--ltl=\"{transformationVisitor.TransformedFormula}\""));
        }
Beispiel #5
0
        /// <summary>
        ///   Checks whether the <paramref name="invariant" /> holds in all states of the <paramref name="model" />.
        /// </summary>
        /// <param name="model">The model that should be checked.</param>
        /// <param name="invariant">The invariant that should be checked.</param>
        public AnalysisResult CheckInvariant(ModelBase model, Formula invariant)
        {
            Requires.NotNull(model, nameof(model));
            Requires.NotNull(invariant, nameof(invariant));

            var visitor = new IsStateFormulaVisitor();

            visitor.Visit(invariant);

            if (!visitor.IsStateFormula)
            {
                throw new InvalidOperationException("Invariants must be non-temporal state formulas.");
            }

            var transformationVisitor = new LtsMinLtlTransformer();

            transformationVisitor.Visit(invariant);

            return(Check(model, invariant,
                         $"--invariant=\"({RuntimeModel.ConstructionStateName} == 1) || ({transformationVisitor.TransformedFormula})\""));
        }
Beispiel #6
0
		/// <summary>
		///   Checks whether the <paramref name="formula" /> holds in all states of the <paramref name="model" />.
		/// </summary>
		/// <param name="model">The model that should be checked.</param>
		/// <param name="formula">The formula that should be checked.</param>
		public AnalysisResult Check(ModelBase model, Formula formula)
		{
			Requires.NotNull(model, nameof(model));
			Requires.NotNull(formula, nameof(formula));

			var visitor = new IsLtlFormulaVisitor();
			visitor.Visit(formula);

			if (!visitor.IsLtlFormula)
				throw new NotSupportedException("CTL model checking is currently not supported with LtsMin.");

			var transformationVisitor = new LtsMinLtlTransformer();
			transformationVisitor.Visit(new UnaryFormula(formula, UnaryOperator.Next));

			return Check(model, formula, $"--ltl=\"{transformationVisitor.TransformedFormula}\"");
		}