private void GenerateDRAGraph(bool isRabin) { try { EnableDisableUI(false); string ltl = TextBox_Prop.Text; if (!isRabin) { ltl = "! " + ltl; } BuchiAutomata BA = LTL2BA.FormulaToBA(ltl, options, new CommonToken(0, "")); ltl2ba.Node LTLHeadNode = LTL2BA.ParseLTL(ltl, options, new CommonToken(0, "")); timer.Reset(); timer.Start(); bool islive = LivenessChecking.isLiveness(BA); timer.Stop(); this.Label_IsSafety.Tag = timer.Elapsed.TotalSeconds; if (!islive) { //this.Label_IsSafety.Text = "The formula is a safety property (checked in " + timer.Elapsed.TotalSeconds + "s)."; this.Label_IsSafety.Text = string.Format(Resources.The_formula_is_a_safety_property__checked_in__0__s__, timer.Elapsed.TotalSeconds); } timer.Reset(); timer.Start(); DRA dra = BA2DRAConverter.ConvertBA2DRA(BA, LTLHeadNode); timer.Stop(); gViewer.Graph = dra.AutomatonToDot(); gViewer.AutoSize = true; this.StatusLabel_Status.Tag = timer.Elapsed.TotalSeconds; if (isRabin) { this.StatusLabel_Status.Text = string.Format(Resources.Rabin_Automata_Generated_with__0__Nodes__1__Edges__checked_in__2_s__, (gViewer.Graph.NodeCount - 1), (gViewer.Graph.EdgeCount - 1), timer.Elapsed.TotalSeconds); } else { this.StatusLabel_Status.Text = string.Format(Resources.Streett_Automata_Generated_with__0__Nodes__1__Edges__checked_in__2_s__, (gViewer.Graph.NodeCount - 1), (gViewer.Graph.EdgeCount - 1), timer.Elapsed.TotalSeconds); } StatusLabel_Accept.Visible = false; if (this.TextBox_Prop.Items.Contains(TextBox_Prop.Text)) { this.TextBox_Prop.Items.Add(TextBox_Prop.Text); } } catch (Exception ex) { MessageBox.Show(Resources.The_input_LTL_is_not_correct__ + ex.Message, PAT.Common.Ultility.Ultility.APPLICATION_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); } EnableDisableUI(true); }
/// <summary> /// The GUI initialization method is invoked before the verification so that the verification options are passed /// into the assertion. /// </summary> /// <param name="target">The model checking form or null in the console mode</param> /// <param name="behavior"></param> /// <param name="engine"></param> public override void UIInitialize(ISynchronizeInvoke target, int behavior, int engine) { base.UIInitialize(target, behavior, engine); hasFairness = true; switch (SelectedBahaviorName) { case Constants.COMPLETE_BEHAVIOR: FairnessType = FairnessType.NO_FAIRNESS; hasFairness = false; break; case Constants.BEHAVIOR_EVENT_LEVEL_WEAK_FAIRNESS: FairnessType = FairnessType.EVENT_LEVEL_WEAK_FAIRNESS; break; case Constants.BEHAVIOR_EVENT_LEVEL_STRONG_FAIRNESS: FairnessType = FairnessType.EVENT_LEVEL_STRONG_FAIRNESS; break; case Constants.BEHAVIOR_PROCESS_LEVEL_WEAK_FAIRNESS: FairnessType = FairnessType.PROCESS_LEVEL_WEAK_FAIRNESS; break; case Constants.BEHAVIOR_PROCESS_LEVEL_STRONG_FAIRNESS: FairnessType = FairnessType.PROCESS_LEVEL_STRONG_FAIRNESS; break; case Constants.BEHAVIOR_GLOBAL_FAIRNESS: FairnessType = FairnessType.GLOBAL_FAIRNESS; break; } CalculateParticipatingProcess = FairnessType == FairnessType.PROCESS_LEVEL_WEAK_FAIRNESS || FairnessType == FairnessType.PROCESS_LEVEL_STRONG_FAIRNESS || MustAbstract; if (!IsSafety) { IsNegateLiveness = hasFairness || LivenessChecking.isLiveness(BA); if (!IsNegateLiveness) { //direct decide the verification result if possible. if (!BA.HasAcceptState) { VerificationOutput.VerificationResult = VerificationResultType.VALID; } } } else { //direct decide the verification result if possible. if (!BA.HasAcceptState) { VerificationOutput.VerificationResult = VerificationResultType.INVALID; } } }
public virtual void SeteBAs(BuchiAutomata ba, BuchiAutomata positiveBA) { negationLTLBuchi = ba; //this is a safety if (!LivenessChecking.isLiveness(positiveBA)) { //AssertType = AssertionType.LTLSafety; IsSafety = true; BA = positiveBA; } else { BA = ba; } }
private void Button_Generate_Click(object sender, System.EventArgs e) { try { EnableDisableUI(false); timer.Reset(); timer.Start(); BuchiAutomata BA = LTL2BA.FormulaToBA(TextBox_Prop.Text, options, new CommonToken(0, "")); timer.Stop(); gViewer.Graph = LTL2BA.AutomatonToDot(BA); gViewer.AutoSize = true; //this.StatusLabel_Status.Text = "Büchi Automata Generated with " + (gViewer.Graph.NodeCount - 1) + " Nodes " + (gViewer.Graph.EdgeCount - 1) + " Edges (checked in " + timer.Elapsed.TotalSeconds + "s)."; this.StatusLabel_Status.Text = string.Format(Resources.Büchi_Automata_Generated_with__0__Nodes__1__Edges__checked_in__2__s__, (gViewer.Graph.NodeCount - 1), (gViewer.Graph.EdgeCount - 1), timer.Elapsed.TotalSeconds); this.StatusLabel_Status.Tag = timer.Elapsed.TotalSeconds; timer.Reset(); timer.Start(); bool islive = LivenessChecking.isLiveness(BA); timer.Stop(); this.Label_IsSafety.Tag = timer.Elapsed.TotalSeconds; if (!islive) { this.Label_IsSafety.Text = string.Format(Resources.The_formula_is_a_safety_property__checked_in__0__s__, timer.Elapsed.TotalSeconds); } if (this.TextBox_Prop.Items.Contains(TextBox_Prop.Text)) { this.TextBox_Prop.Items.Add(TextBox_Prop.Text); } StatusLabel_Accept.Visible = true; } catch (Exception ex) { MessageBox.Show(Resources.The_input_LTL_is_not_correct__ + ex.Message, PAT.Common.Ultility.Ultility.APPLICATION_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); } EnableDisableUI(true); }
private AssertionBase createLTLAssertion(AssertionExpr assertion, string options) { Spec.ExecProcessDatabase.TryGetValue(assertion.Target, out DefinitionRef execProc); ADLAssertionLTL assertLTL = null; if (execProc != null) { String ltl = assertion.Expression.Trim(); // Update LTL state if (ltl.IndexOf(".") != -1) { ltl = ltl.Replace('.', '_'); } // create ADLAssertionLTL assertLTL = new ADLAssertionLTL(execProc, ltl); BuchiAutomata PositiveBA = LTL2BA.FormulaToBA(ltl, options, null); // default to false for x operator U X V T F R NOT SUPPORTED for now bool hasXoperator = false; PositiveBA.HasXOperator = hasXoperator; if (!LivenessChecking.isLiveness(PositiveBA)) { assertLTL.SeteBAs(null, PositiveBA); } else { BuchiAutomata BA = LTL2BA.FormulaToBA("!(" + ltl + ")", options, null); //.Replace(".", Ultility.Ultility.DOT_PREFIX) BA.HasXOperator = hasXoperator; assertLTL.SeteBAs(BA, PositiveBA); } } else { throw new Exception("Unknown target process for assertion"); } return(assertLTL); }