Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NetKAT Decision Procedure Based on Symbolic Automata (FDDs) #558

Open
wants to merge 31 commits into
base: master
Choose a base branch
from

Conversation

smolkaj
Copy link
Member

@smolkaj smolkaj commented Apr 7, 2017

Must:

  • need more examples
  • add documentation
  • unit tests

Bugs:

  • must not ignore inequality constraints

May:

  • generate (minimal?) counterexamples
  • verify automata manipulations?

@smolkaj
Copy link
Member Author

smolkaj commented Apr 7, 2017

Could it be that I implemented a correct decision procedure on first attempt?
I suppose we need more tests cases...

@smolkaj smolkaj closed this Apr 7, 2017
@smolkaj smolkaj reopened this Apr 7, 2017
@smolkaj smolkaj changed the title Decision Procedure for NetKAT NetKAT Decision Procedure Based on Symbolic Automata (FDDs) Apr 7, 2017
@smolkaj
Copy link
Member Author

smolkaj commented Apr 7, 2017

@jnfoster: Do we have examples from previous implementations?

@jnfoster
Copy link
Member

jnfoster commented Apr 7, 2017

Yes, we have the POPL '15 benchmarks.

@m4lvin
Copy link

m4lvin commented Mar 20, 2018

Does this replace #522? If I want a usable decision procedure, which branch should I use, verification_and_felix, equivalence or master?

@jnfoster
Copy link
Member

I would use Verification and Felix for the time being. Sorry for the confusion. We are working on getting the changes upstreamed to master with a new group of students.

@m4lvin
Copy link

m4lvin commented Mar 29, 2018

Thanks! We got the verification_and_felix branch running and the decide command works for small examples of what we are trying to do 😃

Unfortunately, the shell or the parser seem to be limited to 4096 characters. I guess we should properly use your library instead of the shell? What is the best way to run the decide command on longer inputs? Can we somehow import text files and then use them in decide?

@jnfoster
Copy link
Member

jnfoster commented Mar 30, 2018 via email

@m4lvin
Copy link

m4lvin commented Mar 30, 2018

Here is a full example, please tell me if you need further details.

$ git branch
  master
* verification_and_felix
$ ./frenetic.native version
RWO
5.0
$ ./frenetic.native shell
Frenetic Shell v 4.0
Type `help` for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))))))*;((Saa=1;Sab=1);(Sba=1;Sbb=1)))                                                             
true
frenetic> decide ((ag=0;pt=1;Saa=1;Sab=0;Naa=1;Nab=0;Sba=0;Sbb=1;Nba=0;Nbb=1);(((ag:=0;pt:=1)+(ag:=1;pt:=3));((ag=0;pt=1;Sab=0;Nab=1;((((Saa=1;Sba:=1)+Saa=0);((Sba=1;Saa:=1)+Sba=0);((Naa=1;Nba:=1)+Naa=0);((Nba=1;Naa:=1)+Nba=0));(((Sab=1;Sbb:=1)+Sab=0);((Sbb=1;Sab:=1)+Sbb=0);((Nab=1;Nbb:=1)+Nab=0);((Nbb=1;Nab:=1)+Nbb=0))))+(ag=1;pt=3;Sba=0;Nba=1;((((Sba=1;Saa:=1)+Sba=0);((Saa=1;Sba:=1)+Saa=0);((Nba=1;Naa:=1)+Nba=0);((Naa=1;Nba:=1)+Naa=0));(((Sbb=1;Sab:=1)+Sbb=0);((Sab=1;Sbb:=1)+Sab=0);((Nbb=1;Nab:=1)+Nbb=0);((Nab=1;Nbb:=1)+Nab=0))))))*;((Nab=0+Sab=1);(Nba=0+Sba=1))) == ((ag=0;pt=1;Saa=1;Sab=0;Naa=1;Nab=0;Sba=0;Sbb=1;Nba=0;Nbb=1);(((ag:=0;pt:=1)+(ag:=1;pt:=3));((ag=0;pt=1;Sab=0;Nab=1;((((Saa=1;Sba:=1)+Saa=0);((Sba=1;Saa:=1)+Sba=0);((Naa=1;Nba:=1)+Naa=0);((Nba=1;Naa:=1)+Nba=0));(((Sab=1;Sbb:=1)+Sab=0);((Sbb=1;Sab:=1)+Sbb=0);((Nab=1;Nbb:=1)+Nab=0);((Nbb=1;Nab:=1)+Nbb=0))))+(ag=1;pt=3;Sba=0;Nba=1;((((Sba=1;Saa:=1)+Sba=0);((Saa=1;Sba:=1)+Saa=0);((Nba=1;Naa:=1)+Nba=0);((Naa=1;Nba:=1)+Naa=0));(((Sbb=1;Sab:=1)+Sbb=0);((Sab=1;Sbb:=1)+Sab=0);((Nbb=1;Nab:=1)+Nbb=0);((Nab=1;Nbb:=1)+Nab=0))))))*;((Saa=1;Sab=1);(Sba=1;Sbb=1)))                                                             
false
frenetic> decide ((ag=0;pt=1;Saa=1;Sab=0;Sac=0;Naa=1;Nab=1;Nac=0;Sba=0;Sbb=1;Sbc=0;Nba=0;Nbb=1;Nbc=1;Sca=0;Scb=0;Scc=1;Nca=0;Ncb=0;Ncc=1);(((ag:=0;pt:=1)+(ag:=1;pt:=4)+(ag:=2;pt:=7));(((ag=0;pt=1;Sab=0;Nab=1;((((Saa=1;Sba:=1)+Saa=0);((Sba=1;Saa:=1)+Sba=0);((Naa=1;Nba:=1)+Naa=0);((Nba=1;Naa:=1)+Nba=0));(((Sab=1;Sbb:=1)+Sab=0);((Sbb=1;Sab:=1)+Sbb=0);((Nab=1;Nbb:=1)+Nab=0);((Nbb=1;Nab:=1)+Nbb=0));(((Sac=1;Sbc:=1)+Sac=0);((Sbc=1;Sac:=1)+Sbc=0);((Nac=1;Nbc:=1)+Nac=0);((Nbc=1;Nac:=1)+Nbc=0))))+(ag=0;pt=1;Sac=0;Nac=1;((((Saa=1;Sca:=1)+Saa=0);((Sca=1;Saa:=1)+Sca=0);((Naa=1;Nca:=1)+Naa=0);((Nca=1;Naa:=1)+Nca=0));(((Sab=1;Scb:=1)+Sab=0);((Scb=1;Sab:=1)+Scb=0);((Nab=1;Ncb:=1)+Nab=0);((Ncb=1;Nab:=1)+Ncb=0));(((Sac=1;Scc:=1)+Sac=0);((Scc=1;Sac:=1)+Scc=0);((Nac=1;Ncc:=1)+Nac=0);((Ncc=1;Nac:=1)+Ncc=0)))))+(((ag=1;pt=4;Sba=0;Nba=1;((((Sba=1;Saa:=1)+Sba=0);((Saa=1;Sba:=1)+Saa=0);((Nba=1;Naa:=1)+Nba=0);((Naa=1;Nba:=1)+Naa=0));(((Sbb=1;Sab:=1)+Sbb=0);((Sab=1;Sbb:=1)+Sab=0);((Nbb=1;Nab:=1)+Nbb=0);((Nab=1;Nbb:=1)+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that in the error :14088 should actually be 1:4088 meaning line 1, column 4088. And 4088 is roughly 4096 minus the length of "decide ", so this made us think that the parser or maybe the shell library has a limit at 2^12.
(How) can I load a NetKAT policy from a text file into the frenetic shell and then run decide on it?

(cc @janawagemaker)

@smolkaj
Copy link
Member Author

smolkaj commented Apr 6, 2018

@m4lvin: I just pushed a commit (be47c92) that adds a frenetic decide command:

$pwd
/home/steffen/src/frenetic-lang/frenetic/examples/decision-procedure

$ frenetic decide \#558-1.kat 
true

$ frenetic decide \#558-2.kat 
false

$ frenetic decide \#558-3.kat 
^C

This should fix the problem, also it looks like this implementation of the decision procedure doesn't scale well....

@smolkaj
Copy link
Member Author

smolkaj commented Apr 6, 2018

@m4lvin: Also note that I had to make some changes to make things compile (587fe1a). You should be able to build the branch with ocaml 4.03.0 by running the following:

# switch to the right version of ocaml
opam switch 4.03.0
eval `opam config env`

# install necessary dependencies
opam pin add frenetic . -n
opam install --deps-only frenetic

# build
make

@m4lvin
Copy link

m4lvin commented Apr 9, 2018

Thank you @smolkaj! It compiles and runs 👍 The "decide" command was exactly what we needed.

Our third example still runs forever, though. Is the new procedure based on FDDs faster? Please let me know once it is usable and we'll switch to this branch here.

@smolkaj
Copy link
Member Author

smolkaj commented Apr 9, 2018 via email

@m4lvin
Copy link

m4lvin commented Apr 9, 2018

Correct, we do not use histories at all.

@smolkaj
Copy link
Member Author

smolkaj commented Apr 9, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants