/// <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})\""); }
/// <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 AnalysisResult <SafetySharpRuntimeModel> CheckInvariant(CoupledExecutableModelCreator <SafetySharpRuntimeModel> createModel, Formula invariant) { Requires.NotNull(createModel, nameof(createModel)); 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(createModel, $"--invariant=\"({ConstructionStateName} == 1) || ({transformationVisitor.TransformedFormula})\"")); }
/// <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})\"")); }