Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eric-corumdigital/42c142add3b0c37e08d8118c6e2b577f to your computer and use it in GitHub Desktop.
Save eric-corumdigital/42c142add3b0c37e08d8118c6e2b577f to your computer and use it in GitHub Desktop.
// 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