NetworkVerification / nv

A Framework for Modeling and Analyzing Network Configurations
MIT License
31 stars 2 forks source link

Implement Kirigami network partitioning in NV #65

Closed alberdingk-thijm closed 3 years ago

alberdingk-thijm commented 3 years ago

This PR is to merge the implementation of Kirigami, an algorithm for partitioning an SRP and verifying properties modularly in each cut to approximate the full network behaviour.

High-level idea

Given user-provided partition and interface functions, Kirigami partitions the network following NV's transformation passes and before encoding. Each partition is then encoded as a separate SMT query and checked separately (currently queries are checked sequentially, but there is nothing stopping them from being run in parallel too). This transforms very large SMT queries over large networks into smaller SMT queries over subnetworks. Its central concept involves cutting edges across subnetworks and annotating them with sufficient information that the network can still be proven to satisfy the given properties.

The user-provided partition has type tnode -> int 32. It designates which partition each node belongs to. The user-provided interface has type tedge -> attribute -> bool. Given an edge between two nodes u and v such that partition u != partition v (the interface is only ever called on this subset of the graph's edges), the interface returns true if the given predicate applies to the solution sent from u to v.

Changes

Limitations

nickgian commented 3 years ago

Tim I am assuming this does not break anything, such as the existing SMT or simulation backends, i.e., you can ignore Kirigami if you don't use the features it offers? If so, I'll just go ahead and merge this.

alberdingk-thijm commented 3 years ago

Yes, the Kirigami features are ignored if the user doesn't use the -kirigami or -ranked flags, which are only used for SMT: simulation is basically untouched.

There are of course some small changes in the existing non-Kirigami code to support the Kirigami features, namely:

I can run the test suites for master and kirigami-2 side-by-side and compare the output if we want to double check that nothing else will break.

nickgian commented 3 years ago

That is ok, I am merging this.

alberdingk-thijm commented 3 years ago

Great! I just caught a small bug in the topological sorter for Input.ml. :sweat_smile: But it's pretty easy to correct, so I think I can do that now and then everything should work as before.