예제 #1
0
파일: Spin.cs 프로젝트: cubeme/safety-sharp
		/// <summary>
		///     Computes the minimal critical sets for the <paramref name="hazard" />.
		/// </summary>
		/// <param name="hazard">The hazard the minimal critical sets should be computed for.</param>
		public void ComputeMinimalCriticalSets(LtlFormula hazard)
		{
			Requires.NotNull(hazard, () => hazard);
			Requires.That(!hazard.Formula.IsTemporal, "The hazard must be a non-temporal formula.");

			var transformedFormula = LtlFormulaTransformation.Transform(hazard);
			var propositionalFormula = ScmVerificationElements.ToPropositionalFormula(transformedFormula);
			var minimalCriticalSets = _analysis.DccaWithPromela(propositionalFormula);

			Console.WriteLine();
			Console.WriteLine();
			Console.WriteLine("======================");
			Console.WriteLine("Minimal Critical Sets:");
			Console.WriteLine("======================");

			foreach (var minimalCriticalSet in minimalCriticalSets)
			{
				Console.Write("{ ");

				Console.Write(String.Join(", ", minimalCriticalSet.Select(fault =>
				{
					var component = String.Join(".", fault.Item1.Reverse().Skip(1));
					return String.Format("{0}.{1}", component, fault.Item2);
				})));

				Console.WriteLine(" }");
			}
		}
예제 #2
0
파일: Spin.cs 프로젝트: cubeme/safety-sharp
		/// <summary>
		///     Checks whether the <paramref name="formula" /> holds.
		/// </summary>
		/// <param name="formula">The formula that should be checked.</param>
		public bool Check(LtlFormula formula)
		{
			Requires.NotNull(formula, () => formula);
			return _analysis.AnalyzeWithPromela(LtlFormulaTransformation.Transform(formula));
		}
예제 #3
0
		protected void Check(LtlFormula actual, Formula expected)
		{
			Check(actual.Formula, expected);
		}
예제 #4
0
		/// <summary>
		///     Returns a <see cref="LtlFormula" /> that applies the equivalence operator to this instance and
		///     <paramref name="formula" />.
		/// </summary>
		/// <param name="formula">The formula that should be equivalent.</param>
		public LtlFormula EquivalentTo(LtlFormula formula)
		{
			Requires.NotNull(formula, () => formula);
			return new LtlFormula(new BinaryFormula(Formula, BinaryFormulaOperator.Equivalence, PathQuantifier.None, formula.Formula));
		}
예제 #5
0
		/// <summary>
		///     Returns a <see cref="LtlFormula" /> that applies the implication operator to this instance (the antecedent) and
		///     <paramref name="formula" /> (the succedent).
		/// </summary>
		/// <param name="formula">The formula representing the succedent of the implication.</param>
		public LtlFormula Implies(LtlFormula formula)
		{
			Requires.NotNull(formula, () => formula);
			return new LtlFormula(new BinaryFormula(Formula, BinaryFormulaOperator.Implication, PathQuantifier.None, formula.Formula));
		}
예제 #6
0
			public C1()
			{
				F = M0() == M2(1, true);
			}
예제 #7
0
		private void CheckArgumentConversion(LtlFormula actual, Formula expected)
		{
			Check(actual, expected);
		}