Created
October 5, 2019 21:20
-
-
Save eric-corumdigital/42c142add3b0c37e08d8118c6e2b577f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// simple.k | |
module SIMPLE-SYNTAX | |
endmodule | |
module SIMPLE | |
imports BOOL | |
imports INT | |
syntax Bitfield ::= Bitfield Bit | |
| Bit | |
syntax Bit ::= "l" | "h" | |
syntax Int ::= bToI(Bit) [function] | |
| bfToI(Bitfield) [function] | |
rule bToI(l:Bit) => 0 | |
rule bToI(h:Bit) => 1 | |
rule bfToI(XS:Bitfield X:Bit) => (bfToI(XS) *Int 2) +Int bToI(X) | |
rule bfToI(X:Bit) => bToI(X) | |
endmodule | |
// simple-spec.k | |
module SIMPLE-SPEC | |
imports SIMPLE | |
rule <k> bfToI(XS) => 5</k> | |
endmodule | |
// kprove simple-spec.k | |
#Not ( { | |
5 | |
#Equals | |
bfToI ( XS ) | |
} ) | |
#And | |
<k> | |
bfToI ( XS ) | |
</k> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment