internal override Automaton <BDD> getAutomatonBDD(SimpleList <Variable> variables, IBDDAlgebra alg, int nrOfLabelBits) { var pos1 = variables.IndexOf(var1); var pos2 = variables.IndexOf(var2); if (pos1 < 0 || pos2 < 0) { throw new AutomataException(AutomataExceptionKind.InvalidWS1Sformula_UnknownVariable); } var aut = BasicAutomata.MkSubset(pos1 + nrOfLabelBits, pos2 + nrOfLabelBits, alg); return(aut); }
internal override Automaton <IMonadicPredicate <BDD, T> > GetAutomatonX(SimpleList <Variable> variables, ICartesianAlgebraBDD <T> alg, bool singletonSetSemantics) { var pos1 = GetVarIndex(var1, variables); var pos2 = GetVarIndex(var2, variables); if (singletonSetSemantics) { return(BasicAutomata.MkMin1 <T>(pos1, pos2, alg)); } else { return(BasicAutomata.MkMin2 <T>(pos1, pos2, alg)); } }
internal override Automaton <BDD> GetAutomatonBDD(SimpleList <Variable> variables, IBDDAlgebra alg, int nrOfLabelBits, bool singletonSetSemantics) { var pos1 = GetVarIndex(var1, variables); var pos2 = GetVarIndex(var2, variables); if (singletonSetSemantics) { return(BasicAutomata.MkMax1(pos1 + nrOfLabelBits, pos2 + nrOfLabelBits, alg)); } else { return(BasicAutomata.MkMax2(pos1 + nrOfLabelBits, pos2 + nrOfLabelBits, alg)); } }
internal override Automaton <BDD> getAutomatonBDD(SimpleList <WS1SVariable <T> > variables, IBDDAlgebra alg, int nrOfLabelBits) { var pos1 = variables.IndexOf(var1); var pos2 = variables.IndexOf(var2); if (pos1 < 0 || pos2 < 0) { throw new AutomataException(AutomataExceptionKind.InvalidWS1Sformula_UnknownVariable); } pos1 = pos1 + nrOfLabelBits; pos2 = pos2 + nrOfLabelBits; return(BasicAutomata.MkLess(pos1, pos2, alg)); }
/// <summary> /// Constructs the automaton. The formula must be closed. /// </summary> public Automaton <T> GetAutomaton(IBooleanAlgebra <T> elementAlgebra) { var css = elementAlgebra as CharSetSolver; if (css != null) { var ws1s = this.ToWS1S(); var aut = ws1s.GetAutomatonBDD(css, (int)css.Encoding) as Automaton <T>; return(aut); } else { var ws1s = this.ToWS1S(); var aut = ws1s.GetAutomaton(new BDDAlgebra <T>(elementAlgebra)); return(BasicAutomata.Restrict(aut)); } }
internal override Automaton <IMonadicPredicate <BDD, T> > getAutomaton(SimpleList <Variable> variables, ICartesianAlgebraBDD <T> ca) { var k = variables.IndexOf(var); if (k < 0) { throw new AutomataException(AutomataExceptionKind.InvalidWS1Sformula_UnknownVariable); } if (var.IsFirstOrder) { return(BasicAutomata.MkLabelOfPosition(k, pred, ca)); } else { return(BasicAutomata.MkLabelOfSet(k, pred, ca)); } }
internal override Automaton <BDD> GetAutomatonBDD(SimpleList <Variable> variables, IBDDAlgebra alg, int nrOfLabelBits) { var pos1 = variables.IndexOf(var1); var pos2 = variables.IndexOf(var2); if (pos1 < 0) { throw new ArgumentOutOfRangeException("variables", string.Format("does not contain {0}", var1)); } if (pos2 < 0) { throw new ArgumentOutOfRangeException("variables", string.Format("does not contain {0}", var2)); } var aut = BasicAutomata.MkMax2(pos1 + nrOfLabelBits, pos2 + nrOfLabelBits, alg); return(aut); }
internal override Automaton <IMonadicPredicate <BDD, T> > getAutomaton(SimpleList <Variable> variables, ICartesianAlgebraBDD <T> ca) { var pos1 = variables.IndexOf(var1); var pos2 = variables.IndexOf(var2); if (pos1 < 0 || pos2 < 0) { throw new AutomataException(AutomataExceptionKind.InvalidWS1Sformula_UnknownVariable); } if (var1.IsFirstOrder) { return(BasicAutomata.MkEqualPositions(pos1, pos2, ca)); } else { return(BasicAutomata.MkEqualSets(pos1, pos2, ca)); } }
internal override Automaton <BDD> GetAutomatonBDD(SimpleList <Variable> variables, IBDDAlgebra alg, int nrOfLabelBits) { var pos1 = variables.IndexOf(var1); var pos2 = variables.IndexOf(var2); if (pos1 < 0) { throw new ArgumentException("variables", string.Format("does not contain {0}", var1)); } if (pos2 < 0) { throw new ArgumentException("variables", string.Format("does not contain {0}", var2)); } pos1 = pos1 + nrOfLabelBits; pos2 = pos2 + nrOfLabelBits; return(BasicAutomata.MkSuccN2(pos1, pos2, n, alg)); }
internal override Automaton <BDD> GetAutomatonBDD(SimpleList <Variable> variables, IBDDAlgebra alg, int nrOfLabelBits) { var pos1 = variables.IndexOf(var1); var pos2 = variables.IndexOf(var2); if (pos1 < 0) { throw new InvalidOperationException(string.Format("unkown variable {0}", var1)); } if (pos2 < 0) { throw new InvalidOperationException(string.Format("unkown variable {0}", var2)); } pos1 = pos1 + nrOfLabelBits; pos2 = pos2 + nrOfLabelBits; return(BasicAutomata.MkLt2(pos1, pos2, alg)); }
Automaton <IMonadicPredicate <BDD, T> > GetAutomatonX1(Variable[] variables, ICartesianAlgebraBDD <T> alg, bool singletonSetSemantics) { var res = GetAutomatonX(SimpleList <Variable> .Empty.Append(variables), alg, singletonSetSemantics); for (int i = 0; i < variables.Length; i++) { if (variables[i].IsFirstOrder) { if (singletonSetSemantics) { res = res.Intersect(BasicAutomata.MkSingleton <T>(i, alg)).Determinize().Minimize(); } else { res = res.Intersect(BasicAutomata.MkIsNonempty <T>(i, alg)).Determinize().Minimize(); } } } return(res); }
internal override Automaton <IMonadicPredicate <BDD, T> > GetAutomatonX(SimpleList <Variable> variables, ICartesianAlgebraBDD <T> alg, bool singletonSetSemantics) { var k = GetVarIndex(var, variables); if (var.IsFirstOrder) { if (singletonSetSemantics) { return(BasicAutomata.MkLabelOfPosition1 <T>(k, pred, alg)); } else { return(BasicAutomata.MkLabelOfPosition2 <T>(k, pred, alg)); } } else { return(BasicAutomata.MkLabelOfSet <T>(k, pred, alg)); } }
internal override Automaton <BDD> getAutomatonBDD(SimpleList <Variable> variables, IBDDAlgebra alg, int nrOfLabelBits) { var k = variables.IndexOf(var); if (k < 0) { throw new AutomataException(AutomataExceptionKind.InvalidWS1Sformula_UnknownVariable); } k = k + nrOfLabelBits; if (var.IsFirstOrder) { return(BasicAutomata.MkLabelOfPosition1(k, pred as BDD, alg)); } else { return(BasicAutomata.MkLabelOfSet(k, pred as BDD, alg)); } }
Automaton <BDD> GetAutomatonBDD1(Variable[] variables, IBDDAlgebra alg, int nrOfFreeBits, bool singletonSetSemantics) { var res = GetAutomatonBDD(SimpleList <Variable> .Empty.Append(variables), alg, nrOfFreeBits, singletonSetSemantics); for (int i = 0; i < variables.Length; i++) { if (variables[i].IsFirstOrder) { if (singletonSetSemantics) { res = res.Intersect(BasicAutomata.MkSingleton(i, alg)).Determinize().Minimize(); } else { res = res.Intersect(BasicAutomata.MkIsNonempty(i, alg)).Determinize().Minimize(); } } } return(res); }
internal override Automaton <BDD> GetAutomatonBDD(SimpleList <Variable> variables, IBDDAlgebra alg, int nrOfLabelBits) { var k = variables.IndexOf(var); if (k < 0) { throw new ArgumentOutOfRangeException("variables", string.Format("does not contain variable: {0}", var)); } k = k + nrOfLabelBits; if (var.IsFirstOrder) { return(BasicAutomata.MkLabelOfPosition2(k, pred as BDD, alg)); } else { return(BasicAutomata.MkLabelOfSet(k, pred as BDD, alg)); } }
//TBD: enable singleton-set-semantics internal override Automaton <IMonadicPredicate <BDD, T> > GetAutomatonX(SimpleList <Variable> variables, ICartesianAlgebraBDD <T> alg, bool singletonSetSemantics) { //the existential variable will shadow any previous occurrence with the same name //because when looking up the index of var it will be the last occurrence var varIndex = variables.Count; var variablesExt = variables.Append(var); var autPhi = phi.GetAutomatonX(variablesExt, alg, singletonSetSemantics); Automaton <IMonadicPredicate <BDD, T> > autEx; if (this.IsFirstOrder) { if (singletonSetSemantics) { autEx = autPhi.Intersect(BasicAutomata.MkSingleton <T>(varIndex, alg)).Minimize(); } else { autEx = autPhi.Intersect(BasicAutomata.MkIsNonempty <T>(varIndex, alg)).Minimize(); } } else { autEx = autPhi; } //Project away the the existential variable var newMoves = new List <Move <IMonadicPredicate <BDD, T> > >(); foreach (var move in autEx.GetMoves()) { newMoves.Add(new Move <IMonadicPredicate <BDD, T> >(move.SourceState, move.TargetState, alg.Omit(varIndex, move.Label))); } var aut = Automaton <IMonadicPredicate <BDD, T> > .Create(alg, autEx.InitialState, autEx.GetFinalStates(), newMoves); var res = aut.Determinize(); res = res.Minimize(); return(res); }
internal override Automaton <BDD> GetAutomatonBDD(SimpleList <Variable> variables, IBDDAlgebra alg, int nrOfLabelBits, bool singletonSetSemantics) { var pos1 = GetVarIndex(var1, variables) + nrOfLabelBits; var pos2 = GetVarIndex(var2, variables) + nrOfLabelBits; if (var1.IsFirstOrder) { if (singletonSetSemantics) { return(BasicAutomata.MkEqualPositions1(pos1, pos2, alg)); } else { return(BasicAutomata.MkEqualPositions2(pos1, pos2, alg)); } } else { return(BasicAutomata.MkEqualSets(pos1, pos2, alg)); } }
internal override Automaton <BDD> getAutomatonBDD(SimpleList <Variable> variables, IBDDAlgebra alg, int nrOfLabelBits) { var pos1 = variables.IndexOf(var1); var pos2 = variables.IndexOf(var2); if (pos1 < 0 || pos2 < 0) { throw new AutomataException(AutomataExceptionKind.InvalidWS1Sformula_UnknownVariable); } pos1 = pos1 + nrOfLabelBits; pos2 = pos2 + nrOfLabelBits; if (var1.IsFirstOrder) { return(BasicAutomata.MkEqualPositions1(pos1, pos2, alg)); } else { return(BasicAutomata.MkEqualSets(pos1, pos2, alg)); } }
internal override Automaton <BDD> GetAutomatonBDD(SimpleList <Variable> variables, IBDDAlgebra alg, int nrOfLabelBits, bool singletonSetSemantics) { var k = GetVarIndex(var, variables); k = k + nrOfLabelBits; if (var.IsFirstOrder) { if (singletonSetSemantics) { return(BasicAutomata.MkLabelOfPosition1(k, pred as BDD, alg)); } else { return(BasicAutomata.MkLabelOfPosition2(k, pred as BDD, alg)); } } else { return(BasicAutomata.MkLabelOfSet(k, pred as BDD, alg)); } }
internal override Automaton <BDD> getAutomatonBDD(SimpleList <WS1SVariable <T> > variables, IBDDAlgebra alg, int nrOfLabelBits) { return(BasicAutomata.MkTrue(alg)); }
internal override Automaton <BDD> GetAutomatonBDD(SimpleList <Variable> variables, IBDDAlgebra alg, int nrOfLabelBits, bool singletonSetSemantics) { return(BasicAutomata.MkTrue(alg)); }
internal override Automaton <IMonadicPredicate <BDD, T> > getAutomaton(SimpleList <Variable> variables, ICartesianAlgebraBDD <T> ca) { return(BasicAutomata.MkTrue(ca)); }
internal override Automaton <IMonadicPredicate <BDD, T> > GetAutomatonX(SimpleList <Variable> variables, ICartesianAlgebraBDD <T> alg, bool singletonSetSemantics) { return(BasicAutomata.MkFalse <T>(alg)); }
internal override Automaton <BDD> GetAutomatonBDD(SimpleList <Variable> variables, IBDDAlgebra alg, int nrOfLabelBits, bool singletonSetSemantics) { var pos = GetVarIndex(var, variables) + nrOfLabelBits; return(BasicAutomata.MkSingleton(pos, alg)); }
internal override Automaton <BDD> GetAutomatonBDD(SimpleList <Variable> variables, IBDDAlgebra alg, int nrOfLabelBits) { return(BasicAutomata.MkFalse(alg)); }
internal override Automaton <BDD> GetAutomatonBDD(SimpleList <Variable> variables, IBDDAlgebra alg, int nrOfLabelBits) { var pos = GetVarIndex(var, variables) + nrOfLabelBits; return(BasicAutomata.MkIsEmpty(pos, alg)); }
internal override Automaton <IMonadicPredicate <BDD, T> > GetAutomatonX(SimpleList <Variable> variables, ICartesianAlgebraBDD <T> alg, bool singletonSetSemantics) { var pos = GetVarIndex(var, variables); return(BasicAutomata.MkSingleton <T>(pos, alg)); }