diff --git a/new/code/github_com/goose_lang/goose/testdata/examples/append_log.v b/new/code/github_com/goose_lang/goose/testdata/examples/append_log.v index 0cd8fc76f..efa123f59 100644 --- a/new/code/github_com/goose_lang/goose/testdata/examples/append_log.v +++ b/new/code/github_com/goose_lang/goose/testdata/examples/append_log.v @@ -12,7 +12,7 @@ Definition Log : go_type := structT [ "diskSz" :: uint64T ]. -Definition Log__mset : list (string * val) := [ +Definition Log__mset : list (go_string * val) := [ ]. (* go: append_log.go:22:17 *) @@ -131,15 +131,15 @@ Definition Log__Reset : val := do: ((Log__reset (![ptrT] "log")) #());;; do: ((sync.Mutex__Unlock (![ptrT] (struct.field_ref Log "m" (![ptrT] "log")))) #())). -Definition Log__mset_ptr : list (string * val) := [ - ("Append", Log__Append%V); - ("Get", Log__Get%V); - ("Reset", Log__Reset%V); - ("append", Log__append%V); - ("get", Log__get%V); - ("mkHdr", Log__mkHdr%V); - ("reset", Log__reset%V); - ("writeHdr", Log__writeHdr%V) +Definition Log__mset_ptr : list (go_string * val) := [ + ("Append"%go, Log__Append%V); + ("Get"%go, Log__Get%V); + ("Reset"%go, Log__Reset%V); + ("append"%go, Log__append%V); + ("get"%go, Log__get%V); + ("mkHdr"%go, Log__mkHdr%V); + ("reset"%go, Log__reset%V); + ("writeHdr"%go, Log__writeHdr%V) ]. (* go: append_log.go:33:6 *) @@ -196,7 +196,7 @@ Definition Open : val := "diskSz" ::= "$diskSz" }]))). -Definition pkg_name' : string := "github.com/goose-lang/goose/testdata/examples/append_log". +Definition pkg_name' : go_string := "github.com/goose-lang/goose/testdata/examples/append_log". Definition define' : val := rec: "define'" <> := diff --git a/new/code/github_com/goose_lang/goose/testdata/examples/semantics.v b/new/code/github_com/goose_lang/goose/testdata/examples/semantics.v index ec10f3971..b7c0cb971 100644 --- a/new/code/github_com/goose_lang/goose/testdata/examples/semantics.v +++ b/new/code/github_com/goose_lang/goose/testdata/examples/semantics.v @@ -9,10 +9,10 @@ From New Require Import disk_prelude. Definition unit : go_type := structT [ ]. -Definition unit__mset : list (string * val) := [ +Definition unit__mset : list (go_string * val) := [ ]. -Definition unit__mset_ptr : list (string * val) := [ +Definition unit__mset_ptr : list (go_string * val) := [ ]. (* go: allocator.go:7:6 *) @@ -337,7 +337,7 @@ Definition testByteSliceToString : val := let: "$r0" := #(W8 67) in do: ((slice.elem_ref byteT (![sliceT] "x") #(W64 2)) <-[byteT] "$r0");;; return: ((let: "$a0" := (![sliceT] "x") in - byteSliceToString "$a0") = #"ABC")). + byteSliceToString "$a0") = #"ABC"%go)). (* go: copy.go:3:6 *) Definition testCopySimple : val := @@ -445,7 +445,7 @@ Definition Enc : go_type := structT [ "p" :: sliceT ]. -Definition Enc__mset : list (string * val) := [ +Definition Enc__mset : list (go_string * val) := [ ]. (* go: encoding.go:10:15 *) @@ -462,15 +462,15 @@ Definition Enc__consume : val := do: ((struct.field_ref Enc "p" (![ptrT] "e")) <-[sliceT] "$r0");;; return: (![sliceT] "b")). -Definition Enc__mset_ptr : list (string * val) := [ - ("consume", Enc__consume%V) +Definition Enc__mset_ptr : list (go_string * val) := [ + ("consume"%go, Enc__consume%V) ]. Definition Dec : go_type := structT [ "p" :: sliceT ]. -Definition Dec__mset : list (string * val) := [ +Definition Dec__mset : list (go_string * val) := [ ]. (* go: encoding.go:20:15 *) @@ -487,8 +487,8 @@ Definition Dec__consume : val := do: ((struct.field_ref Dec "p" (![ptrT] "d")) <-[sliceT] "$r0");;; return: (![sliceT] "b")). -Definition Dec__mset_ptr : list (string * val) := [ - ("consume", Dec__consume%V) +Definition Dec__mset_ptr : list (go_string * val) := [ + ("consume"%go, Dec__consume%V) ]. (* go: encoding.go:26:6 *) @@ -665,7 +665,7 @@ Definition Editor : go_type := structT [ "next_val" :: uint64T ]. -Definition Editor__mset : list (string * val) := [ +Definition Editor__mset : list (go_string * val) := [ ]. (* advances the array editor, and returns the value it wrote, storing @@ -688,8 +688,8 @@ Definition Editor__AdvanceReturn : val := do: ((struct.field_ref Editor "s" (![ptrT] "e")) <-[sliceT] "$r0");;; return: (![uint64T] "tmp")). -Definition Editor__mset_ptr : list (string * val) := [ - ("AdvanceReturn", Editor__AdvanceReturn%V) +Definition Editor__mset_ptr : list (go_string * val) := [ + ("AdvanceReturn"%go, Editor__AdvanceReturn%V) ]. (* we call this function with side-effectful function calls as arguments, @@ -709,10 +709,10 @@ Definition Pair : go_type := structT [ "y" :: uint64T ]. -Definition Pair__mset : list (string * val) := [ +Definition Pair__mset : list (go_string * val) := [ ]. -Definition Pair__mset_ptr : list (string * val) := [ +Definition Pair__mset_ptr : list (go_string * val) := [ ]. (* tests @@ -835,38 +835,38 @@ Definition genericStruct (A: go_type) (B: go_type) : go_type := structT [ "y" :: B ]. -Definition genericStruct__mset : list (string * val) := [ +Definition genericStruct__mset : list (go_string * val) := [ ]. -Definition genericStruct__mset_ptr : list (string * val) := [ +Definition genericStruct__mset_ptr : list (go_string * val) := [ ]. Definition genericStruct2 (T: go_type) : go_type := structT [ "g" :: T ]. -Definition genericStruct2__mset : list (string * val) := [ +Definition genericStruct2__mset : list (go_string * val) := [ ]. -Definition genericStruct2__mset_ptr : list (string * val) := [ +Definition genericStruct2__mset_ptr : list (go_string * val) := [ ]. Definition nonGenericStruct : go_type := structT [ "p" :: uint64T ]. -Definition nonGenericStruct__mset : list (string * val) := [ +Definition nonGenericStruct__mset : list (go_string * val) := [ ]. -Definition nonGenericStruct__mset_ptr : list (string * val) := [ +Definition nonGenericStruct__mset_ptr : list (go_string * val) := [ ]. Definition IntMap (T: go_type) : go_type := mapT uint64T T. -Definition IntMap__mset : list (string * val) := [ +Definition IntMap__mset : list (go_string * val) := [ ]. -Definition IntMap__mset_ptr : list (string * val) := [ +Definition IntMap__mset_ptr : list (go_string * val) := [ ]. (* go: generics.go:18:6 *) @@ -897,7 +897,7 @@ Definition testGenericStructs : val := }]) in do: ("c" <-[genericStruct2 uint64T] "$r0");;; let: "u" := (ref_ty (genericStruct stringT uint64T) (zero_val (genericStruct stringT uint64T))) in - let: "$r0" := (let: "$x" := #"test" in + let: "$r0" := (let: "$x" := #"test"%go in let: "$y" := #(W64 7) in struct.make (genericStruct stringT uint64T) [{ "x" ::= "$x"; @@ -909,7 +909,7 @@ Definition testGenericStructs : val := (identity2 uint64T) "$a0") in do: ("d" <-[uint64T] "$r0");;; let: "d2" := (ref_ty uint64T (zero_val uint64T)) in - let: ("$ret0", "$ret1") := (let: "$a0" := #"test" in + let: ("$ret0", "$ret1") := (let: "$a0" := #"test"%go in let: "$a1" := #(W64 5) in (identity stringT uint64T) "$a0" "$a1") in let: "$r0" := "$ret0" in @@ -920,7 +920,7 @@ Definition testGenericStructs : val := let: "$r0" := (identity stringT uint64T) in do: ("g" <-[funcT] "$r0");;; let: "b" := (ref_ty uint64T (zero_val uint64T)) in - let: ("$ret0", "$ret1") := (let: "$a0" := #"test" in + let: ("$ret0", "$ret1") := (let: "$a0" := #"test"%go in let: "$a1" := #(W64 3) in (![funcT] "g") "$a0" "$a1") in let: "$r0" := "$ret0" in @@ -964,10 +964,10 @@ Definition testU32Len : val := Definition Uint32 : go_type := uint32T. -Definition Uint32__mset : list (string * val) := [ +Definition Uint32__mset : list (go_string * val) := [ ]. -Definition Uint32__mset_ptr : list (string * val) := [ +Definition Uint32__mset_ptr : list (go_string * val) := [ ]. (* https://github.com/goose-lang/goose/issues/14 @@ -1019,16 +1019,16 @@ Definition SquareStruct__Volume : val := exception_do (let: "t" := (ref_ty SquareStruct "t") in return: (((![uint64T] (struct.field_ref SquareStruct "Side" "t")) * (![uint64T] (struct.field_ref SquareStruct "Side" "t"))) * (![uint64T] (struct.field_ref SquareStruct "Side" "t")))). -Definition SquareStruct__mset : list (string * val) := [ - ("Square", SquareStruct__Square%V); - ("Volume", SquareStruct__Volume%V) +Definition SquareStruct__mset : list (go_string * val) := [ + ("Square"%go, SquareStruct__Square%V); + ("Volume"%go, SquareStruct__Volume%V) ]. -Definition SquareStruct__mset_ptr : list (string * val) := [ - ("Square", (λ: "$recvAddr", +Definition SquareStruct__mset_ptr : list (go_string * val) := [ + ("Square"%go, (λ: "$recvAddr", SquareStruct__Square (![SquareStruct] "$recvAddr") )%V); - ("Volume", (λ: "$recvAddr", + ("Volume"%go, (λ: "$recvAddr", SquareStruct__Volume (![SquareStruct] "$recvAddr") )%V) ]. @@ -1182,12 +1182,12 @@ Definition LoopStruct__forLoopWait : val := do: ((![ptrT] (struct.field_ref LoopStruct "loopNext" "ls")) <-[uint64T] "$r0");;; continue: #())). -Definition LoopStruct__mset : list (string * val) := [ - ("forLoopWait", LoopStruct__forLoopWait%V) +Definition LoopStruct__mset : list (go_string * val) := [ + ("forLoopWait"%go, LoopStruct__forLoopWait%V) ]. -Definition LoopStruct__mset_ptr : list (string * val) := [ - ("forLoopWait", (λ: "$recvAddr", +Definition LoopStruct__mset_ptr : list (go_string * val) := [ + ("forLoopWait"%go, (λ: "$recvAddr", LoopStruct__forLoopWait (![LoopStruct] "$recvAddr") )%V) ]. @@ -1925,10 +1925,10 @@ Definition BoolTest : go_type := structT [ "fc" :: uint64T ]. -Definition BoolTest__mset : list (string * val) := [ +Definition BoolTest__mset : list (go_string * val) := [ ]. -Definition BoolTest__mset_ptr : list (string * val) := [ +Definition BoolTest__mset_ptr : list (go_string * val) := [ ]. (* go: shortcircuiting.go:11:6 *) @@ -2040,7 +2040,7 @@ Definition ArrayEditor : go_type := structT [ "next_val" :: uint64T ]. -Definition ArrayEditor__mset : list (string * val) := [ +Definition ArrayEditor__mset : list (go_string * val) := [ ]. (* go: slices.go:9:24 *) @@ -2058,8 +2058,8 @@ Definition ArrayEditor__Advance : val := slice.slice uint64T "$s" #(W64 1) (slice.len "$s")) in do: ((struct.field_ref ArrayEditor "s" (![ptrT] "ae")) <-[sliceT] "$r0")). -Definition ArrayEditor__mset_ptr : list (string * val) := [ - ("Advance", ArrayEditor__Advance%V) +Definition ArrayEditor__mset_ptr : list (go_string * val) := [ + ("Advance"%go, ArrayEditor__Advance%V) ]. (* tests @@ -2232,7 +2232,7 @@ Definition Bar : go_type := structT [ "b" :: uint64T ]. -Definition Bar__mset : list (string * val) := [ +Definition Bar__mset : list (go_string * val) := [ ]. (* go: struct_pointers.go:14:17 *) @@ -2244,15 +2244,15 @@ Definition Bar__mutate : val := let: "$r0" := #(W64 3) in do: ((struct.field_ref Bar "b" (![ptrT] "bar")) <-[uint64T] "$r0")). -Definition Bar__mset_ptr : list (string * val) := [ - ("mutate", Bar__mutate%V) +Definition Bar__mset_ptr : list (go_string * val) := [ + ("mutate"%go, Bar__mutate%V) ]. Definition Foo : go_type := structT [ "bar" :: Bar ]. -Definition Foo__mset : list (string * val) := [ +Definition Foo__mset : list (go_string * val) := [ ]. (* go: struct_pointers.go:19:17 *) @@ -2261,8 +2261,8 @@ Definition Foo__mutateBar : val := exception_do (let: "foo" := (ref_ty ptrT "foo") in do: ((Bar__mutate (struct.field_ref Foo "bar" (![ptrT] "foo"))) #())). -Definition Foo__mset_ptr : list (string * val) := [ - ("mutateBar", Foo__mutateBar%V) +Definition Foo__mset_ptr : list (go_string * val) := [ + ("mutateBar"%go, Foo__mutateBar%V) ]. (* go: struct_pointers.go:23:6 *) @@ -2287,10 +2287,10 @@ Definition TwoInts : go_type := structT [ "y" :: uint64T ]. -Definition TwoInts__mset : list (string * val) := [ +Definition TwoInts__mset : list (go_string * val) := [ ]. -Definition TwoInts__mset_ptr : list (string * val) := [ +Definition TwoInts__mset_ptr : list (go_string * val) := [ ]. Definition S : go_type := structT [ @@ -2305,8 +2305,8 @@ Definition S__readBVal : val := exception_do (let: "s" := (ref_ty S "s") in return: (![TwoInts] (struct.field_ref S "b" "s"))). -Definition S__mset : list (string * val) := [ - ("readBVal", S__readBVal%V) +Definition S__mset : list (go_string * val) := [ + ("readBVal"%go, S__readBVal%V) ]. (* go: structs.go:38:13 *) @@ -2336,14 +2336,14 @@ Definition S__updateBValX : val := let: "$r0" := (![uint64T] "i") in do: ((struct.field_ref TwoInts "x" (struct.field_ref S "b" (![ptrT] "s"))) <-[uint64T] "$r0")). -Definition S__mset_ptr : list (string * val) := [ - ("negateC", S__negateC%V); - ("readA", S__readA%V); - ("readB", S__readB%V); - ("readBVal", (λ: "$recvAddr", +Definition S__mset_ptr : list (go_string * val) := [ + ("negateC"%go, S__negateC%V); + ("readA"%go, S__readA%V); + ("readB"%go, S__readB%V); + ("readBVal"%go, (λ: "$recvAddr", S__readBVal (![S] "$recvAddr") )%V); - ("updateBValX", S__updateBValX%V) + ("updateBValX"%go, S__updateBValX%V) ]. (* go: structs.go:14:6 *) @@ -2511,10 +2511,10 @@ Definition StructWrap : go_type := structT [ "i" :: uint64T ]. -Definition StructWrap__mset : list (string * val) := [ +Definition StructWrap__mset : list (go_string * val) := [ ]. -Definition StructWrap__mset_ptr : list (string * val) := [ +Definition StructWrap__mset_ptr : list (go_string * val) := [ ]. (* go: structs.go:126:6 *) @@ -2573,10 +2573,10 @@ Definition StructWithFunc : go_type := structT [ "fn" :: funcT ]. -Definition StructWithFunc__mset : list (string * val) := [ +Definition StructWithFunc__mset : list (go_string * val) := [ ]. -Definition StructWithFunc__mset_ptr : list (string * val) := [ +Definition StructWithFunc__mset_ptr : list (go_string * val) := [ ]. (* go: structs.go:155:6 *) @@ -2639,7 +2639,7 @@ Definition testSwitchDefaultTrue : val := Definition switchConcrete : go_type := structT [ ]. -Definition switchConcrete__mset : list (string * val) := [ +Definition switchConcrete__mset : list (go_string * val) := [ ]. (* go: switch.go:45:26 *) @@ -2648,8 +2648,8 @@ Definition switchConcrete__marker : val := exception_do (let: "c" := (ref_ty ptrT "c") in do: #()). -Definition switchConcrete__mset_ptr : list (string * val) := [ - ("marker", switchConcrete__marker%V) +Definition switchConcrete__mset_ptr : list (go_string * val) := [ + ("marker"%go, switchConcrete__marker%V) ]. Definition switchInterface : go_type := interfaceT. @@ -2925,7 +2925,7 @@ Definition Log__Write : val := do: ("length" <-[uint64T] "$r0");;; (if: (![uint64T] "length") ≥ MaxTxnWrites then - do: (let: "$a0" := (interface.make string__mset #"transaction is at capacity") in + do: (let: "$a0" := (interface.make string__mset #"transaction is at capacity"%go) in Panic "$a0") else do: #());;; let: "aBlock" := (ref_ty sliceT (zero_val sliceT)) in @@ -2947,40 +2947,40 @@ Definition Log__Write : val := do: ((![ptrT] (struct.field_ref Log "length" "l")) <-[uint64T] "$r0");;; do: ((Log__unlock (![Log] "l")) #())). -Definition Log__mset : list (string * val) := [ - ("Apply", Log__Apply%V); - ("BeginTxn", Log__BeginTxn%V); - ("Commit", Log__Commit%V); - ("Read", Log__Read%V); - ("Size", Log__Size%V); - ("Write", Log__Write%V); - ("lock", Log__lock%V); - ("unlock", Log__unlock%V) +Definition Log__mset : list (go_string * val) := [ + ("Apply"%go, Log__Apply%V); + ("BeginTxn"%go, Log__BeginTxn%V); + ("Commit"%go, Log__Commit%V); + ("Read"%go, Log__Read%V); + ("Size"%go, Log__Size%V); + ("Write"%go, Log__Write%V); + ("lock"%go, Log__lock%V); + ("unlock"%go, Log__unlock%V) ]. -Definition Log__mset_ptr : list (string * val) := [ - ("Apply", (λ: "$recvAddr", +Definition Log__mset_ptr : list (go_string * val) := [ + ("Apply"%go, (λ: "$recvAddr", Log__Apply (![Log] "$recvAddr") )%V); - ("BeginTxn", (λ: "$recvAddr", + ("BeginTxn"%go, (λ: "$recvAddr", Log__BeginTxn (![Log] "$recvAddr") )%V); - ("Commit", (λ: "$recvAddr", + ("Commit"%go, (λ: "$recvAddr", Log__Commit (![Log] "$recvAddr") )%V); - ("Read", (λ: "$recvAddr", + ("Read"%go, (λ: "$recvAddr", Log__Read (![Log] "$recvAddr") )%V); - ("Size", (λ: "$recvAddr", + ("Size"%go, (λ: "$recvAddr", Log__Size (![Log] "$recvAddr") )%V); - ("Write", (λ: "$recvAddr", + ("Write"%go, (λ: "$recvAddr", Log__Write (![Log] "$recvAddr") )%V); - ("lock", (λ: "$recvAddr", + ("lock"%go, (λ: "$recvAddr", Log__lock (![Log] "$recvAddr") )%V); - ("unlock", (λ: "$recvAddr", + ("unlock"%go, (λ: "$recvAddr", Log__unlock (![Log] "$recvAddr") )%V) ]. @@ -2998,7 +2998,7 @@ Definition New : val := do: ("diskSize" <-[uint64T] "$r0");;; (if: (![uint64T] "diskSize") ≤ logLength then - do: (let: "$a0" := (interface.make string__mset #"disk is too small to host log") in + do: (let: "$a0" := (interface.make string__mset #"disk is too small to host log"%go) in Panic "$a0") else do: #());;; let: "cache" := (ref_ty (mapT uint64T sliceT) (zero_val (mapT uint64T sliceT))) in @@ -3109,7 +3109,7 @@ Definition disabled_testWal : val := do: ("ok" <-[boolT] "$r0");;; return: (![boolT] "ok")). -Definition pkg_name' : string := "github.com/goose-lang/goose/testdata/examples/semantics". +Definition pkg_name' : go_string := "github.com/goose-lang/goose/testdata/examples/semantics". Definition define' : val := rec: "define'" <> := diff --git a/new/code/github_com/goose_lang/goose/testdata/examples/unittest.v b/new/code/github_com/goose_lang/goose/testdata/examples/unittest.v index 9be96835b..6b54c8f05 100644 --- a/new/code/github_com/goose_lang/goose/testdata/examples/unittest.v +++ b/new/code/github_com/goose_lang/goose/testdata/examples/unittest.v @@ -11,10 +11,10 @@ From New Require Import disk_prelude. Definition Foo : go_type := arrayT 10 uint64T. -Definition Foo__mset : list (string * val) := [ +Definition Foo__mset : list (go_string * val) := [ ]. -Definition Foo__mset_ptr : list (string * val) := [ +Definition Foo__mset_ptr : list (go_string * val) := [ ]. (* go: array.go:5:6 *) @@ -27,17 +27,17 @@ Definition takesArray : val := Definition takesPtr : val := rec: "takesPtr" "x" := exception_do (let: "x" := (ref_ty ptrT "x") in - do: ((![ptrT] "x") <-[stringT] ((![stringT] (![ptrT] "x")) + #"bar"))). + do: ((![ptrT] "x") <-[stringT] ((![stringT] (![ptrT] "x")) + #"bar"%go))). (* go: array.go:13:6 *) Definition usesArrayElemRef : val := rec: "usesArrayElemRef" <> := exception_do (let: "x" := (ref_ty (arrayT 2 stringT) (zero_val (arrayT 2 stringT))) in - let: "$r0" := ((let: "$ar0" := #"a" in - let: "$ar1" := #"b" in + let: "$r0" := ((let: "$ar0" := #"a"%go in + let: "$ar1" := #"b"%go in array.literal ["$ar0"; "$ar1"])) in do: ("x" <-[arrayT 2 stringT] "$r0");;; - let: "$r0" := #"c" in + let: "$r0" := #"c"%go in do: ((array.elem_ref stringT (![arrayT 2 stringT] "x") #(W64 1)) <-[stringT] "$r0");;; do: (let: "$a0" := (array.elem_ref stringT (![arrayT 2 stringT] "x") #(W64 1)) in takesPtr "$a0")). @@ -61,8 +61,8 @@ Definition sum : val := Definition arrayToSlice : val := rec: "arrayToSlice" <> := exception_do (let: "x" := (ref_ty (arrayT 2 stringT) (zero_val (arrayT 2 stringT))) in - let: "$r0" := ((let: "$ar0" := #"a" in - let: "$ar1" := #"b" in + let: "$r0" := ((let: "$ar0" := #"a"%go in + let: "$ar1" := #"b"%go in array.literal ["$ar0"; "$ar1"])) in do: ("x" <-[arrayT 2 stringT] "$r0");;; return: (let: "$a" := "x" in @@ -76,8 +76,8 @@ Definition arrayB : Z := 10. Definition arrayLiteralKeyed : val := rec: "arrayLiteralKeyed" <> := exception_do (let: "x" := (ref_ty (arrayT 13 stringT) (zero_val (arrayT 13 stringT))) in - let: "$r0" := ((let: "$ar0" := #"A" in - let: "$ar1" := #"3" in + let: "$r0" := ((let: "$ar0" := #"A"%go in + let: "$ar1" := #"3"%go in let: "$ar2" := (zero_val stringT) in let: "$ar3" := (zero_val stringT) in let: "$ar4" := (zero_val stringT) in @@ -86,9 +86,9 @@ Definition arrayLiteralKeyed : val := let: "$ar7" := (zero_val stringT) in let: "$ar8" := (zero_val stringT) in let: "$ar9" := (zero_val stringT) in - let: "$ar10" := #"B" in - let: "$ar11" := #"1" in - let: "$ar12" := #"2" in + let: "$ar10" := #"B"%go in + let: "$ar11" := #"1"%go in + let: "$ar12" := #"2"%go in array.literal ["$ar0"; "$ar1"; "$ar2"; "$ar3"; "$ar4"; "$ar5"; "$ar6"; "$ar7"; "$ar8"; "$ar9"; "$ar10"; "$ar11"; "$ar12"])) in do: ("x" <-[arrayT 13 stringT] "$r0");;; return: (![stringT] (array.elem_ref stringT (![arrayT 13 stringT] "x") #(W64 0)))). @@ -101,10 +101,10 @@ Definition chanBasic : val := do: ("x" <-[chanT stringT] "$r0");;; let: "$go" := (λ: <>, exception_do (do: (let: "$chan" := (![chanT stringT] "x") in - let: "$v" := #"Foo" in + let: "$v" := #"Foo"%go in chan.send "$chan" "$v");;; do: (let: "$chan" := (![chanT stringT] "x") in - let: "$v" := #"Foo" in + let: "$v" := #"Foo"%go in chan.send "$chan" "$v")) ) in do: (Fork ("$go" #()));;; @@ -119,7 +119,7 @@ Definition chanBasic : val := do: ("y" <-[stringT] "$r0");;; (if: ![boolT] "ok" then - let: "$r0" := ((![stringT] "y") + #" ") in + let: "$r0" := ((![stringT] "y") + #" "%go) in do: ("y" <-[stringT] "$r0") else do: #())). @@ -142,10 +142,10 @@ Definition chanSelect : val := let: "i2" := (ref_ty intT (zero_val intT)) in let: "i1" := (ref_ty intT (zero_val intT)) in do: (chan.select [("$sendVal0", "$sendChan0", (λ: <>, - do: (let: "$a0" := ((let: "$sl0" := (interface.make string__mset #"sent ") in + do: (let: "$a0" := ((let: "$sl0" := (interface.make string__mset #"sent "%go) in let: "$sl1" := (interface.make int__mset (![intT] "i2")) in let: "$sl2" := (interface.make string__mset #" to c2 - ") in + "%go) in slice.literal interfaceT ["$sl0"; "$sl1"; "$sl2"])) in fmt.Print "$a0") ))] [("$recvChan0", (λ: "$recvVal", @@ -153,10 +153,10 @@ Definition chanSelect : val := )); ("$recvChan1", (λ: "$recvVal", let: "$r0" := (Fst "$recvVal") in do: ("i1" <-[intT] "$r0");;; - do: (let: "$a0" := ((let: "$sl0" := (interface.make string__mset #"received ") in + do: (let: "$a0" := ((let: "$sl0" := (interface.make string__mset #"received "%go) in let: "$sl1" := (interface.make int__mset (![intT] "i1")) in let: "$sl2" := (interface.make string__mset #" from c1 - ") in + "%go) in slice.literal interfaceT ["$sl0"; "$sl1"; "$sl2"])) in fmt.Print "$a0") )); ("$recvChan2", (λ: "$recvVal", @@ -169,15 +169,15 @@ Definition chanSelect : val := do: ("ok" <-[boolT] "$r1");;; (if: ![boolT] "ok" then - do: (let: "$a0" := ((let: "$sl0" := (interface.make string__mset #"received ") in + do: (let: "$a0" := ((let: "$sl0" := (interface.make string__mset #"received "%go) in let: "$sl1" := (interface.make int__mset (![intT] "i3")) in let: "$sl2" := (interface.make string__mset #" from c3 - ") in + "%go) in slice.literal interfaceT ["$sl0"; "$sl1"; "$sl2"])) in fmt.Print "$a0") else do: (let: "$a0" := ((let: "$sl0" := (interface.make string__mset #"c3 is closed - ") in + "%go) in slice.literal interfaceT ["$sl0"])) in fmt.Print "$a0")) )); ("$recvChan3", (λ: "$recvVal", @@ -186,7 +186,7 @@ Definition chanSelect : val := do: #() ))] (InjR (λ: <>, do: (let: "$a0" := ((let: "$sl0" := (interface.make string__mset #"no communication - ") in + "%go) in slice.literal interfaceT ["$sl0"])) in fmt.Print "$a0") )));;; @@ -205,16 +205,16 @@ Definition chanDirectional : val := let: "y" := (ref_ty (chanT stringT) (zero_val (chanT stringT))) in do: (Fst (chan.receive (![chanT uint64T] "x")));;; do: (let: "$chan" := (![chanT stringT] "y") in - let: "$v" := #"" in + let: "$v" := #""%go in chan.send "$chan" "$v")). Definition importantStruct : go_type := structT [ ]. -Definition importantStruct__mset : list (string * val) := [ +Definition importantStruct__mset : list (go_string * val) := [ ]. -Definition importantStruct__mset_ptr : list (string * val) := [ +Definition importantStruct__mset_ptr : list (go_string * val) := [ ]. (* doSubtleThings does a number of subtle things: @@ -254,10 +254,10 @@ Definition condvarWrapping : val := do: ("mu" <-[ptrT] "$r0");;; do: ((sync.Cond__Wait (![ptrT] "cond1")) #())). -Definition GlobalConstant : expr := #"foo". +Definition GlobalConstant : expr := #"foo"%go. (* an untyped string *) -Definition UntypedStringConstant : string := "bar". +Definition UntypedStringConstant : go_string := "bar"%go. Definition UntypedInt : Z := 13. @@ -405,10 +405,10 @@ Definition ifStmtInitialization : val := Definition stringWrapper : go_type := stringT. -Definition stringWrapper__mset : list (string * val) := [ +Definition stringWrapper__mset : list (go_string * val) := [ ]. -Definition stringWrapper__mset_ptr : list (string * val) := [ +Definition stringWrapper__mset_ptr : list (go_string * val) := [ ]. (* go: conversions.go:5:6 *) @@ -516,8 +516,8 @@ Definition useSlice : val := let: "$a1" := (![sliceT] "s") in (slice.append sliceT) "$a0" "$a1") in do: ("s1" <-[sliceT] "$r0");;; - do: (let: "$a0" := #"dir" in - let: "$a1" := #"file" in + do: (let: "$a0" := #"dir"%go in + let: "$a1" := #"file"%go in let: "$a2" := (![sliceT] "s1") in atomicCreateStub "$a0" "$a1" "$a2")). @@ -628,10 +628,10 @@ Definition diskWrapper : go_type := structT [ "d" :: disk.Disk ]. -Definition diskWrapper__mset : list (string * val) := [ +Definition diskWrapper__mset : list (go_string * val) := [ ]. -Definition diskWrapper__mset_ptr : list (string * val) := [ +Definition diskWrapper__mset_ptr : list (go_string * val) := [ ]. (* go: disk.go:9:6 *) @@ -656,8 +656,8 @@ Definition embedA__Foo : val := exception_do (let: "a" := (ref_ty embedA "a") in return: (#(W64 0))). -Definition embedA__mset : list (string * val) := [ - ("Foo", embedA__Foo%V) +Definition embedA__mset : list (go_string * val) := [ + ("Foo"%go, embedA__Foo%V) ]. (* go: embedded.go:27:18 *) @@ -666,9 +666,9 @@ Definition embedA__Bar : val := exception_do (let: "a" := (ref_ty ptrT "a") in return: (#(W64 13))). -Definition embedA__mset_ptr : list (string * val) := [ - ("Bar", embedA__Bar%V); - ("Foo", (λ: "$recvAddr", +Definition embedA__mset_ptr : list (go_string * val) := [ + ("Bar"%go, embedA__Bar%V); + ("Foo"%go, (λ: "$recvAddr", embedA__Foo (![embedA] "$recvAddr") )%V) ]. @@ -683,8 +683,8 @@ Definition embedB__Foo : val := exception_do (let: "a" := (ref_ty embedB "a") in return: (#(W64 10))). -Definition embedB__mset : list (string * val) := [ - ("Foo", embedB__Foo%V) +Definition embedB__mset : list (go_string * val) := [ + ("Foo"%go, embedB__Foo%V) ]. (* go: embedded.go:31:18 *) @@ -693,12 +693,12 @@ Definition embedB__Car : val := exception_do (let: "a" := (ref_ty ptrT "a") in return: (#(W64 14))). -Definition embedB__mset_ptr : list (string * val) := [ - ("Bar", (λ: "$recvAddr", +Definition embedB__mset_ptr : list (go_string * val) := [ + ("Bar"%go, (λ: "$recvAddr", embedA__Bar (struct.field_ref embedB "embedA" "$recvAddr") )%V); - ("Car", embedB__Car%V); - ("Foo", (λ: "$recvAddr", + ("Car"%go, embedB__Car%V); + ("Foo"%go, (λ: "$recvAddr", embedB__Foo (![embedB] "$recvAddr") )%V) ]. @@ -707,26 +707,26 @@ Definition embedC : go_type := structT [ "embedB" :: ptrT ]. -Definition embedC__mset : list (string * val) := [ - ("Bar", (λ: "$recv", +Definition embedC__mset : list (go_string * val) := [ + ("Bar"%go, (λ: "$recv", embedA__Bar (struct.field_ref embedB "embedA" (struct.field_get embedC "embedB" "$recv")) )%V); - ("Car", (λ: "$recv", + ("Car"%go, (λ: "$recv", embedB__Car (struct.field_get embedC "embedB" "$recv") )%V); - ("Foo", (λ: "$recv", + ("Foo"%go, (λ: "$recv", embedB__Foo (![embedB] (struct.field_get embedC "embedB" "$recv")) )%V) ]. -Definition embedC__mset_ptr : list (string * val) := [ - ("Bar", (λ: "$recvAddr", +Definition embedC__mset_ptr : list (go_string * val) := [ + ("Bar"%go, (λ: "$recvAddr", embedA__Bar (struct.field_ref embedB "embedA" (![ptrT] (struct.field_ref embedC "embedB" "$recvAddr"))) )%V); - ("Car", (λ: "$recvAddr", + ("Car"%go, (λ: "$recvAddr", embedB__Car (![ptrT] (struct.field_ref embedC "embedB" "$recvAddr")) )%V); - ("Foo", (λ: "$recvAddr", + ("Foo"%go, (λ: "$recvAddr", embedB__Foo (![embedB] (![ptrT] (struct.field_ref embedC "embedB" "$recvAddr"))) )%V) ]. @@ -735,26 +735,26 @@ Definition embedD : go_type := structT [ "embedC" :: embedC ]. -Definition embedD__mset : list (string * val) := [ - ("Bar", (λ: "$recv", +Definition embedD__mset : list (go_string * val) := [ + ("Bar"%go, (λ: "$recv", embedA__Bar (struct.field_ref embedB "embedA" (struct.field_get embedC "embedB" (struct.field_get embedD "embedC" "$recv"))) )%V); - ("Car", (λ: "$recv", + ("Car"%go, (λ: "$recv", embedB__Car (struct.field_get embedC "embedB" (struct.field_get embedD "embedC" "$recv")) )%V); - ("Foo", (λ: "$recv", + ("Foo"%go, (λ: "$recv", embedB__Foo (![embedB] (struct.field_get embedC "embedB" (struct.field_get embedD "embedC" "$recv"))) )%V) ]. -Definition embedD__mset_ptr : list (string * val) := [ - ("Bar", (λ: "$recvAddr", +Definition embedD__mset_ptr : list (go_string * val) := [ + ("Bar"%go, (λ: "$recvAddr", embedA__Bar (struct.field_ref embedB "embedA" (![ptrT] (struct.field_ref embedC "embedB" (struct.field_ref embedD "embedC" "$recvAddr")))) )%V); - ("Car", (λ: "$recvAddr", + ("Car"%go, (λ: "$recvAddr", embedB__Car (![ptrT] (struct.field_ref embedC "embedB" (struct.field_ref embedD "embedC" "$recvAddr"))) )%V); - ("Foo", (λ: "$recvAddr", + ("Foo"%go, (λ: "$recvAddr", embedB__Foo (![embedB] (![ptrT] (struct.field_ref embedC "embedB" (struct.field_ref embedD "embedC" "$recvAddr")))) )%V) ]. @@ -830,7 +830,7 @@ Definition Enc : go_type := structT [ "p" :: sliceT ]. -Definition Enc__mset : list (string * val) := [ +Definition Enc__mset : list (go_string * val) := [ ]. (* go: encoding.go:9:15 *) @@ -867,17 +867,17 @@ Definition Enc__UInt64 : val := let: "$a1" := (![uint64T] "x") in primitive.UInt64Put "$a0" "$a1")). -Definition Enc__mset_ptr : list (string * val) := [ - ("UInt32", Enc__UInt32%V); - ("UInt64", Enc__UInt64%V); - ("consume", Enc__consume%V) +Definition Enc__mset_ptr : list (go_string * val) := [ + ("UInt32"%go, Enc__UInt32%V); + ("UInt64"%go, Enc__UInt64%V); + ("consume"%go, Enc__consume%V) ]. Definition Dec : go_type := structT [ "p" :: sliceT ]. -Definition Dec__mset : list (string * val) := [ +Definition Dec__mset : list (go_string * val) := [ ]. (* go: encoding.go:27:15 *) @@ -910,10 +910,10 @@ Definition Dec__UInt64 : val := (Dec__consume (![ptrT] "d")) "$a0") in primitive.UInt64Get "$a0")). -Definition Dec__mset_ptr : list (string * val) := [ - ("UInt32", Dec__UInt32%V); - ("UInt64", Dec__UInt64%V); - ("consume", Dec__consume%V) +Definition Dec__mset_ptr : list (go_string * val) := [ + ("UInt32"%go, Dec__UInt32%V); + ("UInt64"%go, Dec__UInt64%V); + ("consume"%go, Dec__consume%V) ]. (* go: globals.go:3:6 *) @@ -921,29 +921,29 @@ Definition foo : val := rec: "foo" <> := exception_do (return: (#(W64 10))). -Definition pkg_name' : string := "github.com/goose-lang/goose/testdata/examples/unittest". +Definition pkg_name' : go_string := "github.com/goose-lang/goose/testdata/examples/unittest". -Definition GlobalX : (string * string) := (pkg_name', "GlobalX"). +Definition GlobalX : (go_string * go_string) := (pkg_name', "GlobalX"%go). -Definition globalY : (string * string) := (pkg_name', "globalY"). +Definition globalY : (go_string * go_string) := (pkg_name', "globalY"%go). -Definition globalA : (string * string) := (pkg_name', "globalA"). +Definition globalA : (go_string * go_string) := (pkg_name', "globalA"%go). -Definition globalB : (string * string) := (pkg_name', "globalB"). +Definition globalB : (go_string * go_string) := (pkg_name', "globalB"%go). (* go: globals.go:14:6 *) Definition other : val := rec: "other" <> := - exception_do (let: "$r0" := #"ok" in + exception_do (let: "$r0" := #"ok"%go in do: ((globals.get globalY #()) <-[stringT] "$r0")). (* go: globals.go:18:6 *) Definition bar : val := rec: "bar" <> := exception_do (do: (other #());;; - (if: ((![uint64T] (globals.get GlobalX #())) ≠ #(W64 10)) || ((![stringT] (globals.get globalY #())) ≠ #"ok") + (if: ((![uint64T] (globals.get GlobalX #())) ≠ #(W64 10)) || ((![stringT] (globals.get globalY #())) ≠ #"ok"%go) then - do: (let: "$a0" := (interface.make string__mset #"bad") in + do: (let: "$a0" := (interface.make string__mset #"bad"%go) in Panic "$a0") else do: #())). @@ -959,7 +959,7 @@ Definition concreteFooer : go_type := structT [ "a" :: uint64T ]. -Definition concreteFooer__mset : list (string * val) := [ +Definition concreteFooer__mset : list (go_string * val) := [ ]. (* go: interfaces.go:15:25 *) @@ -968,18 +968,18 @@ Definition concreteFooer__Foo : val := exception_do (let: "f" := (ref_ty ptrT "f") in do: #()). -Definition concreteFooer__mset_ptr : list (string * val) := [ - ("Foo", concreteFooer__Foo%V) +Definition concreteFooer__mset_ptr : list (go_string * val) := [ + ("Foo"%go, concreteFooer__Foo%V) ]. Definition FooerUser : go_type := structT [ "f" :: Fooer ]. -Definition FooerUser__mset : list (string * val) := [ +Definition FooerUser__mset : list (go_string * val) := [ ]. -Definition FooerUser__mset_ptr : list (string * val) := [ +Definition FooerUser__mset_ptr : list (go_string * val) := [ ]. (* go: interfaces.go:18:6 *) @@ -1155,8 +1155,8 @@ Definition concrete1__Foo : val := exception_do (let: "c" := (ref_ty concrete1 "c") in do: #()). -Definition concrete1__mset : list (string * val) := [ - ("Foo", concrete1__Foo%V) +Definition concrete1__mset : list (go_string * val) := [ + ("Foo"%go, concrete1__Foo%V) ]. (* go: interfaces.go:109:21 *) @@ -1165,9 +1165,9 @@ Definition concrete1__B : val := exception_do (let: "c" := (ref_ty ptrT "c") in do: #()). -Definition concrete1__mset_ptr : list (string * val) := [ - ("B", concrete1__B%V); - ("Foo", (λ: "$recvAddr", +Definition concrete1__mset_ptr : list (go_string * val) := [ + ("B"%go, concrete1__B%V); + ("Foo"%go, (λ: "$recvAddr", concrete1__Foo (![concrete1] "$recvAddr") )%V) ]. @@ -1205,18 +1205,18 @@ Definition useInts : val := Definition my_u32 : go_type := uint32T. -Definition my_u32__mset : list (string * val) := [ +Definition my_u32__mset : list (go_string * val) := [ ]. -Definition my_u32__mset_ptr : list (string * val) := [ +Definition my_u32__mset_ptr : list (go_string * val) := [ ]. Definition also_u32 : go_type := my_u32. -Definition also_u32__mset : list (string * val) := [ +Definition also_u32__mset : list (go_string * val) := [ ]. -Definition also_u32__mset_ptr : list (string * val) := [ +Definition also_u32__mset_ptr : list (go_string * val) := [ ]. Definition ConstWithAbbrevType : expr := #(W32 3). @@ -1227,17 +1227,17 @@ Definition allTheLiterals : go_type := structT [ "b" :: boolT ]. -Definition allTheLiterals__mset : list (string * val) := [ +Definition allTheLiterals__mset : list (go_string * val) := [ ]. -Definition allTheLiterals__mset_ptr : list (string * val) := [ +Definition allTheLiterals__mset_ptr : list (go_string * val) := [ ]. (* go: literals.go:9:6 *) Definition normalLiterals : val := rec: "normalLiterals" <> := exception_do (return: (let: "$int" := #(W64 0) in - let: "$s" := #"foo" in + let: "$s" := #"foo"%go in let: "$b" := #true in struct.make allTheLiterals [{ "int" ::= "$int"; @@ -1249,7 +1249,7 @@ Definition normalLiterals : val := Definition outOfOrderLiteral : val := rec: "outOfOrderLiteral" <> := exception_do (return: (let: "$b" := #true in - let: "$s" := #"foo" in + let: "$s" := #"foo"%go in let: "$int" := #(W64 0) in struct.make allTheLiterals [{ "int" ::= "$int"; @@ -1261,7 +1261,7 @@ Definition outOfOrderLiteral : val := Definition specialLiterals : val := rec: "specialLiterals" <> := exception_do (return: (let: "$int" := #(W64 4096) in - let: "$s" := #"" in + let: "$s" := #""%go in let: "$b" := #false in struct.make allTheLiterals [{ "int" ::= "$int"; @@ -1273,7 +1273,7 @@ Definition specialLiterals : val := Definition oddLiterals : val := rec: "oddLiterals" <> := exception_do (return: (let: "$int" := #(W64 5) in - let: "$s" := #"backquote string" in + let: "$s" := #"backquote string"%go in let: "$b" := #false in struct.make allTheLiterals [{ "int" ::= "$int"; @@ -1286,7 +1286,7 @@ Definition unKeyedLiteral : val := rec: "unKeyedLiteral" <> := exception_do (return: (struct.make allTheLiterals [{ "int" ::= #(W64 0); - "s" ::= #"a"; + "s" ::= #"a"%go; "b" ::= #false }])). @@ -1318,24 +1318,24 @@ Definition hasCondVar : go_type := structT [ "cond" :: ptrT ]. -Definition hasCondVar__mset : list (string * val) := [ +Definition hasCondVar__mset : list (go_string * val) := [ ]. -Definition hasCondVar__mset_ptr : list (string * val) := [ +Definition hasCondVar__mset_ptr : list (go_string * val) := [ ]. (* go: log_debugging.go:5:6 *) Definition ToBeDebugged : val := rec: "ToBeDebugged" "x" := exception_do (let: "x" := (ref_ty uint64T "x") in - do: (let: "$a0" := ((let: "$sl0" := (interface.make string__mset #"starting function") in + do: (let: "$a0" := ((let: "$sl0" := (interface.make string__mset #"starting function"%go) in slice.literal interfaceT ["$sl0"])) in log.Println "$a0");;; - do: (let: "$a0" := #"called with %d" in + do: (let: "$a0" := #"called with %d"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] "x")) in slice.literal interfaceT ["$sl0"])) in log.Printf "$a0" "$a1");;; - do: (let: "$a0" := ((let: "$sl0" := (interface.make string__mset #"ending function") in + do: (let: "$a0" := ((let: "$sl0" := (interface.make string__mset #"ending function"%go) in slice.literal interfaceT ["$sl0"])) in log.Println "$a0");;; return: (![uint64T] "x")). @@ -1343,7 +1343,7 @@ Definition ToBeDebugged : val := (* go: log_debugging.go:12:6 *) Definition DoNothing : val := rec: "DoNothing" <> := - exception_do (do: (let: "$a0" := ((let: "$sl0" := (interface.make string__mset #"doing nothing") in + exception_do (do: (let: "$a0" := ((let: "$sl0" := (interface.make string__mset #"doing nothing"%go) in slice.literal interfaceT ["$sl0"])) in log.Println "$a0")). @@ -1396,7 +1396,7 @@ Definition conditionalInLoop : val := (for: (λ: <>, #true); (λ: <>, Skip) := λ: <>, (if: (![uint64T] "i") < #(W64 3) then - do: (let: "$a0" := #"i is small" in + do: (let: "$a0" := #"i is small"%go in DoSomething "$a0") else do: #());;; (if: (![uint64T] "i") > #(W64 5) @@ -1557,18 +1557,18 @@ Definition MapSize : val := Definition IntWrapper : go_type := uint64T. -Definition IntWrapper__mset : list (string * val) := [ +Definition IntWrapper__mset : list (go_string * val) := [ ]. -Definition IntWrapper__mset_ptr : list (string * val) := [ +Definition IntWrapper__mset_ptr : list (go_string * val) := [ ]. Definition MapWrapper : go_type := mapT uint64T boolT. -Definition MapWrapper__mset : list (string * val) := [ +Definition MapWrapper__mset : list (go_string * val) := [ ]. -Definition MapWrapper__mset_ptr : list (string * val) := [ +Definition MapWrapper__mset_ptr : list (go_string * val) := [ ]. (* go: maps.go:24:6 *) @@ -1583,17 +1583,17 @@ Definition MapTypeAliases : val := Definition StringMap : val := rec: "StringMap" "m" := exception_do (let: "m" := (ref_ty (mapT stringT uint64T) "m") in - return: (Fst (map.get (![mapT stringT uint64T] "m") #"foo"))). + return: (Fst (map.get (![mapT stringT uint64T] "m") #"foo"%go))). Definition mapElem : go_type := structT [ "a" :: uint64T; "b" :: uint64T ]. -Definition mapElem__mset : list (string * val) := [ +Definition mapElem__mset : list (go_string * val) := [ ]. -Definition mapElem__mset_ptr : list (string * val) := [ +Definition mapElem__mset_ptr : list (go_string * val) := [ ]. (* go: maps.go:37:6 *) @@ -1753,12 +1753,12 @@ Definition wrapExternalStruct__moveUint64 : val := do: (let: "$a0" := ((marshal.Dec__GetInt (![marshal.Dec] (struct.field_ref wrapExternalStruct "d" "w"))) #()) in (marshal.Enc__PutInt (![marshal.Enc] (struct.field_ref wrapExternalStruct "e" "w"))) "$a0")). -Definition wrapExternalStruct__mset : list (string * val) := [ - ("moveUint64", wrapExternalStruct__moveUint64%V) +Definition wrapExternalStruct__mset : list (go_string * val) := [ + ("moveUint64"%go, wrapExternalStruct__moveUint64%V) ]. -Definition wrapExternalStruct__mset_ptr : list (string * val) := [ - ("moveUint64", (λ: "$recvAddr", +Definition wrapExternalStruct__mset_ptr : list (go_string * val) := [ + ("moveUint64"%go, (λ: "$recvAddr", wrapExternalStruct__moveUint64 (![wrapExternalStruct] "$recvAddr") )%V) ]. @@ -1766,7 +1766,7 @@ Definition wrapExternalStruct__mset_ptr : list (string * val) := [ (* go: panic.go:3:6 *) Definition PanicAtTheDisco : val := rec: "PanicAtTheDisco" <> := - exception_do (do: (let: "$a0" := (interface.make string__mset #"disco") in + exception_do (do: (let: "$a0" := (interface.make string__mset #"disco"%go) in Panic "$a0")). (* go: proph.go:5:6 *) @@ -1782,10 +1782,10 @@ Definition typing : go_type := structT [ "proph" :: ptrT ]. -Definition typing__mset : list (string * val) := [ +Definition typing__mset : list (go_string * val) := [ ]. -Definition typing__mset_ptr : list (string * val) := [ +Definition typing__mset_ptr : list (go_string * val) := [ ]. Definition composite : go_type := structT [ @@ -1793,10 +1793,10 @@ Definition composite : go_type := structT [ "b" :: uint64T ]. -Definition composite__mset : list (string * val) := [ +Definition composite__mset : list (go_string * val) := [ ]. -Definition composite__mset_ptr : list (string * val) := [ +Definition composite__mset_ptr : list (go_string * val) := [ ]. (* go: reassign.go:8:6 *) @@ -1834,7 +1834,7 @@ Definition recur : val := Definition R : go_type := structT [ ]. -Definition R__mset : list (string * val) := [ +Definition R__mset : list (go_string * val) := [ ]. (* go: recursive.go:10:13 *) @@ -1843,25 +1843,25 @@ Definition R__recurMethod : val := exception_do (let: "r" := (ref_ty ptrT "r") in do: (("R__recurMethod" (![ptrT] "r")) #())). -Definition R__mset_ptr : list (string * val) := [ - ("recurMethod", R__recurMethod%V) +Definition R__mset_ptr : list (go_string * val) := [ + ("recurMethod"%go, R__recurMethod%V) ]. Definition Other : go_type := structT [ "RecursiveEmbedded" :: ptrT ]. -Definition Other__mset : list (string * val) := [ +Definition Other__mset : list (go_string * val) := [ ]. -Definition Other__mset_ptr : list (string * val) := [ +Definition Other__mset_ptr : list (go_string * val) := [ ]. Definition RecursiveEmbedded : go_type := structT [ "Other" :: Other ]. -Definition RecursiveEmbedded__mset : list (string * val) := [ +Definition RecursiveEmbedded__mset : list (go_string * val) := [ ]. (* go: recursive.go:22:29 *) @@ -1870,18 +1870,18 @@ Definition RecursiveEmbedded__recurEmbeddedMethod : val := exception_do (let: "r" := (ref_ty ptrT "r") in do: (("RecursiveEmbedded__recurEmbeddedMethod" (![ptrT] (struct.field_ref Other "RecursiveEmbedded" (struct.field_ref RecursiveEmbedded "Other" (![ptrT] "r"))))) #())). -Definition RecursiveEmbedded__mset_ptr : list (string * val) := [ - ("recurEmbeddedMethod", RecursiveEmbedded__recurEmbeddedMethod%V) +Definition RecursiveEmbedded__mset_ptr : list (go_string * val) := [ + ("recurEmbeddedMethod"%go, RecursiveEmbedded__recurEmbeddedMethod%V) ]. Definition Block : go_type := structT [ "Value" :: uint64T ]. -Definition Block__mset : list (string * val) := [ +Definition Block__mset : list (go_string * val) := [ ]. -Definition Block__mset_ptr : list (string * val) := [ +Definition Block__mset_ptr : list (go_string * val) := [ ]. Definition Disk1 : expr := #(W64 0). @@ -2013,10 +2013,10 @@ Definition ReplicatedDiskRecover : val := Definition SliceAlias : go_type := sliceT. -Definition SliceAlias__mset : list (string * val) := [ +Definition SliceAlias__mset : list (go_string * val) := [ ]. -Definition SliceAlias__mset_ptr : list (string * val) := [ +Definition SliceAlias__mset_ptr : list (go_string * val) := [ ]. (* go: slices.go:5:6 *) @@ -2054,10 +2054,10 @@ Definition thing : go_type := structT [ "x" :: uint64T ]. -Definition thing__mset : list (string * val) := [ +Definition thing__mset : list (go_string * val) := [ ]. -Definition thing__mset_ptr : list (string * val) := [ +Definition thing__mset_ptr : list (go_string * val) := [ ]. Definition sliceOfThings : go_type := structT [ @@ -2071,12 +2071,12 @@ Definition sliceOfThings__getThingRef : val := let: "i" := (ref_ty uint64T "i") in return: (slice.elem_ref thing (![sliceT] (struct.field_ref sliceOfThings "things" "ts")) (![uint64T] "i"))). -Definition sliceOfThings__mset : list (string * val) := [ - ("getThingRef", sliceOfThings__getThingRef%V) +Definition sliceOfThings__mset : list (go_string * val) := [ + ("getThingRef"%go, sliceOfThings__getThingRef%V) ]. -Definition sliceOfThings__mset_ptr : list (string * val) := [ - ("getThingRef", (λ: "$recvAddr", +Definition sliceOfThings__mset_ptr : list (go_string * val) := [ + ("getThingRef"%go, (λ: "$recvAddr", sliceOfThings__getThingRef (![sliceOfThings] "$recvAddr") )%V) ]. @@ -2151,7 +2151,7 @@ Definition loopSpawn : val := Definition stringAppend : val := rec: "stringAppend" "s" := exception_do (let: "s" := (ref_ty stringT "s") in - return: ((#"prefix " + (![stringT] "s")) + #" ")). + return: ((#"prefix "%go + (![stringT] "s")) + #" "%go)). (* go: strings.go:7:6 *) Definition stringLength : val := @@ -2160,6 +2160,12 @@ Definition stringLength : val := return: (let: "$a0" := (![stringT] "s") in StringLength "$a0")). +(* go: strings.go:11:6 *) +Definition x : val := + rec: "x" <> := + exception_do (do: (let: "$a0" := #("a"%go ++ "b"%go) in + stringAppend "$a0")). + Definition Point : go_type := structT [ "x" :: uint64T; "y" :: uint64T @@ -2184,16 +2190,16 @@ Definition Point__GetField : val := do: ("y" <-[uint64T] "$r0");;; return: ((![uint64T] "x") + (![uint64T] "y"))). -Definition Point__mset : list (string * val) := [ - ("Add", Point__Add%V); - ("GetField", Point__GetField%V) +Definition Point__mset : list (go_string * val) := [ + ("Add"%go, Point__Add%V); + ("GetField"%go, Point__GetField%V) ]. -Definition Point__mset_ptr : list (string * val) := [ - ("Add", (λ: "$recvAddr", +Definition Point__mset_ptr : list (go_string * val) := [ + ("Add"%go, (λ: "$recvAddr", Point__Add (![Point] "$recvAddr") )%V); - ("GetField", (λ: "$recvAddr", + ("GetField"%go, (λ: "$recvAddr", Point__GetField (![Point] "$recvAddr") )%V) ]. @@ -2234,10 +2240,10 @@ Definition TwoInts : go_type := structT [ "y" :: uint64T ]. -Definition TwoInts__mset : list (string * val) := [ +Definition TwoInts__mset : list (go_string * val) := [ ]. -Definition TwoInts__mset_ptr : list (string * val) := [ +Definition TwoInts__mset_ptr : list (go_string * val) := [ ]. Definition S : go_type := structT [ @@ -2252,8 +2258,8 @@ Definition S__readBVal : val := exception_do (let: "s" := (ref_ty S "s") in return: (![TwoInts] (struct.field_ref S "b" "s"))). -Definition S__mset : list (string * val) := [ - ("readBVal", S__readBVal%V) +Definition S__mset : list (go_string * val) := [ + ("readBVal"%go, S__readBVal%V) ]. (* go: struct_pointers.go:38:13 *) @@ -2289,15 +2295,15 @@ Definition S__writeB : val := let: "$r0" := (![TwoInts] "two") in do: ((struct.field_ref S "b" (![ptrT] "s")) <-[TwoInts] "$r0")). -Definition S__mset_ptr : list (string * val) := [ - ("negateC", S__negateC%V); - ("readA", S__readA%V); - ("readB", S__readB%V); - ("readBVal", (λ: "$recvAddr", +Definition S__mset_ptr : list (go_string * val) := [ + ("negateC"%go, S__negateC%V); + ("readA"%go, S__readA%V); + ("readB"%go, S__readB%V); + ("readBVal"%go, (λ: "$recvAddr", S__readBVal (![S] "$recvAddr") )%V); - ("refC", S__refC%V); - ("writeB", S__writeB%V) + ("refC"%go, S__refC%V); + ("writeB"%go, S__writeB%V) ]. (* go: struct_pointers.go:14:6 *) @@ -2364,16 +2370,16 @@ Definition B : go_type := structT [ "a" :: sliceT ]. -Definition B__mset : list (string * val) := [ +Definition B__mset : list (go_string * val) := [ ]. -Definition B__mset_ptr : list (string * val) := [ +Definition B__mset_ptr : list (go_string * val) := [ ]. -Definition A__mset : list (string * val) := [ +Definition A__mset : list (go_string * val) := [ ]. -Definition A__mset_ptr : list (string * val) := [ +Definition A__mset_ptr : list (go_string * val) := [ ]. (* go: trailing_call.go:3:6 *) @@ -2390,26 +2396,26 @@ Definition my_u64 : go_type := uint64T. Definition Timestamp : go_type := uint64T. -Definition Timestamp__mset : list (string * val) := [ +Definition Timestamp__mset : list (go_string * val) := [ ]. -Definition Timestamp__mset_ptr : list (string * val) := [ +Definition Timestamp__mset_ptr : list (go_string * val) := [ ]. Definition UseTypeAbbrev : go_type := uint64T. -Definition UseTypeAbbrev__mset : list (string * val) := [ +Definition UseTypeAbbrev__mset : list (go_string * val) := [ ]. -Definition UseTypeAbbrev__mset_ptr : list (string * val) := [ +Definition UseTypeAbbrev__mset_ptr : list (go_string * val) := [ ]. Definition UseNamedType : go_type := Timestamp. -Definition UseNamedType__mset : list (string * val) := [ +Definition UseNamedType__mset : list (go_string * val) := [ ]. -Definition UseNamedType__mset_ptr : list (string * val) := [ +Definition UseNamedType__mset_ptr : list (go_string * val) := [ ]. (* go: type_alias.go:11:6 *) @@ -2432,7 +2438,7 @@ Definition variadicFunc : val := Definition testVariadicCall : val := rec: "testVariadicCall" <> := exception_do (do: (let: "$a0" := #(W64 10) in - let: "$a1" := #"abc" in + let: "$a1" := #"abc"%go in let: "$a2" := ((let: "$sl0" := #(W8 0) in let: "$sl1" := #(W8 1) in let: "$sl2" := #(W8 2) in @@ -2440,19 +2446,19 @@ Definition testVariadicCall : val := slice.literal byteT ["$sl0"; "$sl1"; "$sl2"; "$sl3"])) in variadicFunc "$a0" "$a1" "$a2");;; do: (let: "$a0" := #(W64 10) in - let: "$a1" := #"abc" in + let: "$a1" := #"abc"%go in let: "$a2" := #slice.nil in variadicFunc "$a0" "$a1" "$a2");;; let: "c" := (ref_ty sliceT (zero_val sliceT)) in do: (let: "$a0" := #(W64 10) in - let: "$a1" := #"abc" in + let: "$a1" := #"abc"%go in let: "$a2" := (![sliceT] "c") in variadicFunc "$a0" "$a1" "$a2")). (* go: varargs.go:13:6 *) Definition returnMultiple : val := rec: "returnMultiple" <> := - exception_do (return: (#(W64 0), #"xyz", #(W8 0), #(W8 0))). + exception_do (return: (#(W64 0), #"xyz"%go, #(W8 0), #(W8 0))). (* go: varargs.go:17:6 *) Definition testVariadicPassThrough : val := @@ -2484,9 +2490,9 @@ Definition initialize' : val := do: (define' #());;; let: "$r0" := (foo #()) in do: ((globals.get GlobalX #()) <-[uint64T] "$r0");;; - let: "$r0" := #"a" in + let: "$r0" := #"a"%go in do: ((globals.get globalA #()) <-[stringT] "$r0");;; - let: "$r0" := #"b" in + let: "$r0" := #"b"%go in do: ((globals.get globalB #()) <-[stringT] "$r0");;; let: "$r0" := (foo #()) in do: ((λ: <>, @@ -2494,7 +2500,7 @@ Definition initialize' : val := do: ((globals.get GlobalX #()) <-[uint64T] "$r0")) ) #());;; do: ((λ: <>, - exception_do (let: "$r0" := #"" in + exception_do (let: "$r0" := #""%go in do: ((globals.get globalY #()) <-[stringT] "$r0")) ) #())) ). diff --git a/new/code/github_com/goose_lang/std.v b/new/code/github_com/goose_lang/std.v index 4e93c2a57..f475d0abc 100644 --- a/new/code/github_com/goose_lang/std.v +++ b/new/code/github_com/goose_lang/std.v @@ -100,7 +100,7 @@ Definition JoinHandle : go_type := structT [ "cond" :: ptrT ]. -Definition JoinHandle__mset : list (string * val) := [ +Definition JoinHandle__mset : list (go_string * val) := [ ]. (* go: goose_std.go:106:22 *) @@ -128,9 +128,9 @@ Definition JoinHandle__finish : val := do: ((sync.Cond__Signal (![ptrT] (struct.field_ref JoinHandle "cond" (![ptrT] "h")))) #());;; do: ((sync.Mutex__Unlock (![ptrT] (struct.field_ref JoinHandle "mu" (![ptrT] "h")))) #())). -Definition JoinHandle__mset_ptr : list (string * val) := [ - ("Join", JoinHandle__Join%V); - ("finish", JoinHandle__finish%V) +Definition JoinHandle__mset_ptr : list (go_string * val) := [ + ("Join"%go, JoinHandle__Join%V); + ("finish"%go, JoinHandle__finish%V) ]. (* go: goose_std.go:73:6 *) @@ -229,7 +229,7 @@ Definition Skip : val := rec: "Skip" <> := exception_do (do: #()). -Definition pkg_name' : string := "github.com/goose-lang/std". +Definition pkg_name' : go_string := "github.com/goose-lang/std". Definition define' : val := rec: "define'" <> := diff --git a/new/code/github_com/mit_pdos/gokv/asyncfile.v b/new/code/github_com/mit_pdos/gokv/asyncfile.v index 133f2a681..7ef1e9a24 100644 --- a/new/code/github_com/mit_pdos/gokv/asyncfile.v +++ b/new/code/github_com/mit_pdos/gokv/asyncfile.v @@ -19,7 +19,7 @@ Definition AsyncFile : go_type := structT [ "closedCond" :: ptrT ]. -Definition AsyncFile__mset : list (string * val) := [ +Definition AsyncFile__mset : list (go_string * val) := [ ]. (* go: storage.go:73:21 *) @@ -121,11 +121,11 @@ Definition AsyncFile__flushThread : val := do: ((struct.field_ref AsyncFile "durableIndex" (![ptrT] "s")) <-[uint64T] "$r0");;; do: ((sync.Cond__Broadcast (![ptrT] (struct.field_ref AsyncFile "durableIndexCond" (![ptrT] "s")))) #()))). -Definition AsyncFile__mset_ptr : list (string * val) := [ - ("Close", AsyncFile__Close%V); - ("Write", AsyncFile__Write%V); - ("flushThread", AsyncFile__flushThread%V); - ("wait", AsyncFile__wait%V) +Definition AsyncFile__mset_ptr : list (go_string * val) := [ + ("Close"%go, AsyncFile__Close%V); + ("Write"%go, AsyncFile__Write%V); + ("flushThread"%go, AsyncFile__flushThread%V); + ("wait"%go, AsyncFile__wait%V) ]. (* returns the state, then the File object @@ -170,7 +170,7 @@ Definition MakeAsyncFile : val := do: (Fork ("$go" #()));;; return: (![sliceT] "data", ![ptrT] "s")). -Definition pkg_name' : string := "github.com/mit-pdos/gokv/asyncfile". +Definition pkg_name' : go_string := "github.com/mit-pdos/gokv/asyncfile". Definition define' : val := rec: "define'" <> := diff --git a/new/code/github_com/mit_pdos/gokv/bank.v b/new/code/github_com/mit_pdos/gokv/bank.v index 2719c6b0a..51ca3ec48 100644 --- a/new/code/github_com/mit_pdos/gokv/bank.v +++ b/new/code/github_com/mit_pdos/gokv/bank.v @@ -16,7 +16,7 @@ Definition BankClerk : go_type := structT [ "accts" :: sliceT ]. -Definition BankClerk__mset : list (string * val) := [ +Definition BankClerk__mset : list (go_string * val) := [ ]. (* go: bank.go:47:6 *) @@ -60,7 +60,7 @@ Definition BankClerk__SimpleAudit : val := (for: (λ: <>, #true); (λ: <>, Skip) := λ: <>, (if: ((BankClerk__get_total (![ptrT] "bck")) #()) ≠ BAL_TOTAL then - do: (let: "$a0" := (interface.make string__mset #"Balance total invariant violated") in + do: (let: "$a0" := (interface.make string__mset #"Balance total invariant violated"%go) in Panic "$a0") else do: #()))). @@ -157,11 +157,11 @@ Definition BankClerk__SimpleTransfer : val := (BankClerk__transfer_internal (![ptrT] "bck")) "$a0" "$a1" "$a2") else do: #()))). -Definition BankClerk__mset_ptr : list (string * val) := [ - ("SimpleAudit", BankClerk__SimpleAudit%V); - ("SimpleTransfer", BankClerk__SimpleTransfer%V); - ("get_total", BankClerk__get_total%V); - ("transfer_internal", BankClerk__transfer_internal%V) +Definition BankClerk__mset_ptr : list (go_string * val) := [ + ("SimpleAudit"%go, BankClerk__SimpleAudit%V); + ("SimpleTransfer"%go, BankClerk__SimpleTransfer%V); + ("get_total"%go, BankClerk__get_total%V); + ("transfer_internal"%go, BankClerk__transfer_internal%V) ]. (* go: bank.go:19:6 *) @@ -202,7 +202,7 @@ Definition MakeBankClerkSlice : val := do: (let: "$a0" := (![stringT] "init_flag") in (lockservice.LockClerk__Lock (![ptrT] (struct.field_ref BankClerk "lck" (![ptrT] "bck")))) "$a0");;; (if: (let: "$a0" := (![stringT] "init_flag") in - (interface.get "Get" (![kv.Kv] (struct.field_ref BankClerk "kvck" (![ptrT] "bck")))) "$a0") = #"" + (interface.get "Get" (![kv.Kv] (struct.field_ref BankClerk "kvck" (![ptrT] "bck")))) "$a0") = #""%go then do: (let: "$a0" := (![stringT] (slice.elem_ref stringT (![sliceT] (struct.field_ref BankClerk "accts" (![ptrT] "bck"))) #(W64 0))) in let: "$a1" := (let: "$a0" := BAL_TOTAL in @@ -217,7 +217,7 @@ Definition MakeBankClerkSlice : val := encodeInt "$a0") in (interface.get "Put" (![kv.Kv] (struct.field_ref BankClerk "kvck" (![ptrT] "bck")))) "$a0" "$a1")));;; do: (let: "$a0" := (![stringT] "init_flag") in - let: "$a1" := #"1" in + let: "$a1" := #"1"%go in (interface.get "Put" (![kv.Kv] (struct.field_ref BankClerk "kvck" (![ptrT] "bck")))) "$a0" "$a1") else do: #());;; do: (let: "$a0" := (![stringT] "init_flag") in @@ -249,7 +249,7 @@ Definition MakeBankClerk : val := let: "$a3" := (![sliceT] "accts") in MakeBankClerkSlice "$a0" "$a1" "$a2" "$a3")). -Definition pkg_name' : string := "github.com/mit-pdos/gokv/bank". +Definition pkg_name' : go_string := "github.com/mit-pdos/gokv/bank". Definition define' : val := rec: "define'" <> := diff --git a/new/code/github_com/mit_pdos/gokv/cachekv.v b/new/code/github_com/mit_pdos/gokv/cachekv.v index ee2ed1cdf..1ffeb1801 100644 --- a/new/code/github_com/mit_pdos/gokv/cachekv.v +++ b/new/code/github_com/mit_pdos/gokv/cachekv.v @@ -12,10 +12,10 @@ Definition cacheValue : go_type := structT [ "l" :: uint64T ]. -Definition cacheValue__mset : list (string * val) := [ +Definition cacheValue__mset : list (go_string * val) := [ ]. -Definition cacheValue__mset_ptr : list (string * val) := [ +Definition cacheValue__mset_ptr : list (go_string * val) := [ ]. Definition CacheKv : go_type := structT [ @@ -24,7 +24,7 @@ Definition CacheKv : go_type := structT [ "cache" :: mapT stringT cacheValue ]. -Definition CacheKv__mset : list (string * val) := [ +Definition CacheKv__mset : list (go_string * val) := [ ]. (* go: clerk.go:24:6 *) @@ -146,7 +146,7 @@ Definition CacheKv__GetAndCache : val := EncodeValue "$a0") in (interface.get "ConditionalPut" (![kv.KvCput] (struct.field_ref CacheKv "kv" (![ptrT] "k")))) "$a0" "$a1" "$a2") in do: ("resp" <-[stringT] "$r0");;; - (if: (![stringT] "resp") = #"ok" + (if: (![stringT] "resp") = #"ok"%go then do: ((sync.Mutex__Lock (![ptrT] (struct.field_ref CacheKv "mu" (![ptrT] "k")))) #());;; let: "$r0" := (let: "$v" := (![stringT] (struct.field_ref cacheValue "v" "old")) in @@ -200,14 +200,14 @@ Definition CacheKv__Put : val := EncodeValue "$a0") in (interface.get "ConditionalPut" (![kv.KvCput] (struct.field_ref CacheKv "kv" (![ptrT] "k")))) "$a0" "$a1" "$a2") in do: ("resp" <-[stringT] "$r0");;; - (if: (![stringT] "resp") = #"ok" + (if: (![stringT] "resp") = #"ok"%go then break: #() else do: #()))). -Definition CacheKv__mset_ptr : list (string * val) := [ - ("Get", CacheKv__Get%V); - ("GetAndCache", CacheKv__GetAndCache%V); - ("Put", CacheKv__Put%V) +Definition CacheKv__mset_ptr : list (go_string * val) := [ + ("Get"%go, CacheKv__Get%V); + ("GetAndCache"%go, CacheKv__GetAndCache%V); + ("Put"%go, CacheKv__Put%V) ]. (* go: clerk.go:47:6 *) @@ -223,7 +223,7 @@ Definition Make : val := "cache" ::= "$cache" }]))). -Definition pkg_name' : string := "github.com/mit-pdos/gokv/cachekv". +Definition pkg_name' : go_string := "github.com/mit-pdos/gokv/cachekv". Definition define' : val := rec: "define'" <> := diff --git a/new/code/github_com/mit_pdos/gokv/globals_test.v b/new/code/github_com/mit_pdos/gokv/globals_test.v index 631e8a57f..a69605ee3 100644 --- a/new/code/github_com/mit_pdos/gokv/globals_test.v +++ b/new/code/github_com/mit_pdos/gokv/globals_test.v @@ -9,29 +9,29 @@ Definition foo : val := rec: "foo" <> := exception_do (return: (#(W64 10))). -Definition pkg_name' : string := "github.com/mit-pdos/gokv/globals_test". +Definition pkg_name' : go_string := "github.com/mit-pdos/gokv/globals_test". -Definition GlobalX : (string * string) := (pkg_name', "GlobalX"). +Definition GlobalX : (go_string * go_string) := (pkg_name', "GlobalX"%go). -Definition globalY : (string * string) := (pkg_name', "globalY"). +Definition globalY : (go_string * go_string) := (pkg_name', "globalY"%go). -Definition globalA : (string * string) := (pkg_name', "globalA"). +Definition globalA : (go_string * go_string) := (pkg_name', "globalA"%go). -Definition globalB : (string * string) := (pkg_name', "globalB"). +Definition globalB : (go_string * go_string) := (pkg_name', "globalB"%go). (* go: globals.go:12:6 *) Definition other : val := rec: "other" <> := - exception_do (let: "$r0" := #"ok" in + exception_do (let: "$r0" := #"ok"%go in do: ((globals.get globalY #()) <-[stringT] "$r0")). (* go: globals.go:16:6 *) Definition bar : val := rec: "bar" <> := exception_do (do: (other #());;; - (if: ((![uint64T] (globals.get GlobalX #())) ≠ #(W64 10)) || ((![stringT] (globals.get globalY #())) ≠ #"ok") + (if: ((![uint64T] (globals.get GlobalX #())) ≠ #(W64 10)) || ((![stringT] (globals.get globalY #())) ≠ #"ok"%go) then - do: (let: "$a0" := (interface.make string__mset #"bad") in + do: (let: "$a0" := (interface.make string__mset #"bad"%go) in Panic "$a0") else do: #())). @@ -53,16 +53,16 @@ Definition initialize' : val := exception_do (do: (define' #());;; let: "$r0" := (foo #()) in do: ((globals.get GlobalX #()) <-[uint64T] "$r0");;; - let: "$r0" := #"a" in + let: "$r0" := #"a"%go in do: ((globals.get globalA #()) <-[stringT] "$r0");;; - let: "$r0" := #"b" in + let: "$r0" := #"b"%go in do: ((globals.get globalB #()) <-[stringT] "$r0");;; do: ((λ: <>, - exception_do (let: "$r0" := (![uint64T] (globals.get GlobalX #())) in + exception_do (let: "$r0" := ((![uint64T] (globals.get GlobalX #())) + #(W64 0)) in do: ((globals.get GlobalX #()) <-[uint64T] "$r0")) ) #());;; do: ((λ: <>, - exception_do (let: "$r0" := #"" in + exception_do (let: "$r0" := #""%go in do: ((globals.get globalY #()) <-[stringT] "$r0")) ) #())) ). diff --git a/new/code/github_com/mit_pdos/gokv/kv.v b/new/code/github_com/mit_pdos/gokv/kv.v index 24e5fc067..16e399daa 100644 --- a/new/code/github_com/mit_pdos/gokv/kv.v +++ b/new/code/github_com/mit_pdos/gokv/kv.v @@ -8,7 +8,7 @@ Definition Kv : go_type := interfaceT. Definition KvCput : go_type := interfaceT. -Definition pkg_name' : string := "github.com/mit-pdos/gokv/kv". +Definition pkg_name' : go_string := "github.com/mit-pdos/gokv/kv". Definition define' : val := rec: "define'" <> := diff --git a/new/code/github_com/mit_pdos/gokv/lockservice.v b/new/code/github_com/mit_pdos/gokv/lockservice.v index a66a6bffa..8006b2110 100644 --- a/new/code/github_com/mit_pdos/gokv/lockservice.v +++ b/new/code/github_com/mit_pdos/gokv/lockservice.v @@ -9,7 +9,7 @@ Definition LockClerk : go_type := structT [ "kv" :: kv.KvCput ]. -Definition LockClerk__mset : list (string * val) := [ +Definition LockClerk__mset : list (go_string * val) := [ ]. (* go: lock_clerk.go:11:22 *) @@ -18,9 +18,9 @@ Definition LockClerk__Lock : val := exception_do (let: "ck" := (ref_ty ptrT "ck") in let: "key" := (ref_ty stringT "key") in (for: (λ: <>, (let: "$a0" := (![stringT] "key") in - let: "$a1" := #"" in - let: "$a2" := #"1" in - (interface.get "ConditionalPut" (![kv.KvCput] (struct.field_ref LockClerk "kv" (![ptrT] "ck")))) "$a0" "$a1" "$a2") ≠ #"ok"); (λ: <>, Skip) := λ: <>, + let: "$a1" := #""%go in + let: "$a2" := #"1"%go in + (interface.get "ConditionalPut" (![kv.KvCput] (struct.field_ref LockClerk "kv" (![ptrT] "ck")))) "$a0" "$a1" "$a2") ≠ #"ok"%go); (λ: <>, Skip) := λ: <>, do: #())). (* go: lock_clerk.go:16:22 *) @@ -29,12 +29,12 @@ Definition LockClerk__Unlock : val := exception_do (let: "ck" := (ref_ty ptrT "ck") in let: "key" := (ref_ty stringT "key") in do: (let: "$a0" := (![stringT] "key") in - let: "$a1" := #"" in + let: "$a1" := #""%go in (interface.get "Put" (![kv.KvCput] (struct.field_ref LockClerk "kv" (![ptrT] "ck")))) "$a0" "$a1")). -Definition LockClerk__mset_ptr : list (string * val) := [ - ("Lock", LockClerk__Lock%V); - ("Unlock", LockClerk__Unlock%V) +Definition LockClerk__mset_ptr : list (go_string * val) := [ + ("Lock"%go, LockClerk__Lock%V); + ("Unlock"%go, LockClerk__Unlock%V) ]. (* go: lock_clerk.go:20:6 *) @@ -46,7 +46,7 @@ Definition MakeLockClerk : val := "kv" ::= "$kv" }]))). -Definition pkg_name' : string := "github.com/mit-pdos/gokv/lockservice". +Definition pkg_name' : go_string := "github.com/mit-pdos/gokv/lockservice". Definition define' : val := rec: "define'" <> := diff --git a/new/code/github_com/mit_pdos/gokv/reconnectclient.v b/new/code/github_com/mit_pdos/gokv/reconnectclient.v index b886b5e74..7761d26b2 100644 --- a/new/code/github_com/mit_pdos/gokv/reconnectclient.v +++ b/new/code/github_com/mit_pdos/gokv/reconnectclient.v @@ -14,7 +14,7 @@ Definition ReconnectingClient : go_type := structT [ "addr" :: uint64T ]. -Definition ReconnectingClient__mset : list (string * val) := [ +Definition ReconnectingClient__mset : list (go_string * val) := [ ]. (* go: client.go:30:31 *) @@ -89,9 +89,9 @@ Definition ReconnectingClient__Call : val := else do: #());;; return: (![uint64T] "err")). -Definition ReconnectingClient__mset_ptr : list (string * val) := [ - ("Call", ReconnectingClient__Call%V); - ("getClient", ReconnectingClient__getClient%V) +Definition ReconnectingClient__mset_ptr : list (go_string * val) := [ + ("Call"%go, ReconnectingClient__Call%V); + ("getClient"%go, ReconnectingClient__getClient%V) ]. (* go: client.go:20:6 *) @@ -109,7 +109,7 @@ Definition MakeReconnectingClient : val := do: ((struct.field_ref ReconnectingClient "addr" (![ptrT] "r")) <-[uint64T] "$r0");;; return: (![ptrT] "r")). -Definition pkg_name' : string := "github.com/mit-pdos/gokv/reconnectclient". +Definition pkg_name' : go_string := "github.com/mit-pdos/gokv/reconnectclient". Definition define' : val := rec: "define'" <> := diff --git a/new/code/github_com/mit_pdos/gokv/urpc.v b/new/code/github_com/mit_pdos/gokv/urpc.v index 3a9d18fe9..885ad458d 100644 --- a/new/code/github_com/mit_pdos/gokv/urpc.v +++ b/new/code/github_com/mit_pdos/gokv/urpc.v @@ -13,7 +13,7 @@ Definition Server : go_type := structT [ "handlers" :: mapT uint64T funcT ]. -Definition Server__mset : list (string * val) := [ +Definition Server__mset : list (go_string * val) := [ ]. (* go: urpc.go:19:20 *) @@ -117,10 +117,10 @@ Definition Server__Serve : val := ) in do: (Fork ("$go" #()))). -Definition Server__mset_ptr : list (string * val) := [ - ("Serve", Server__Serve%V); - ("readThread", Server__readThread%V); - ("rpcHandle", Server__rpcHandle%V) +Definition Server__mset_ptr : list (go_string * val) := [ + ("Serve"%go, Server__Serve%V); + ("readThread"%go, Server__readThread%V); + ("rpcHandle"%go, Server__rpcHandle%V) ]. (* go: urpc.go:32:6 *) @@ -144,10 +144,10 @@ Definition Callback : go_type := structT [ "cond" :: ptrT ]. -Definition Callback__mset : list (string * val) := [ +Definition Callback__mset : list (go_string * val) := [ ]. -Definition Callback__mset_ptr : list (string * val) := [ +Definition Callback__mset_ptr : list (go_string * val) := [ ]. Definition Client : go_type := structT [ @@ -157,7 +157,7 @@ Definition Client : go_type := structT [ "pending" :: mapT uint64T ptrT ]. -Definition Client__mset : list (string * val) := [ +Definition Client__mset : list (go_string * val) := [ ]. Definition ErrTimeout : expr := #(W64 1). @@ -338,11 +338,11 @@ Definition Client__replyThread : val := do: ((sync.Mutex__Unlock (![ptrT] (struct.field_ref Client "mu" (![ptrT] "cl")))) #());;; continue: #())). -Definition Client__mset_ptr : list (string * val) := [ - ("Call", Client__Call%V); - ("CallComplete", Client__CallComplete%V); - ("CallStart", Client__CallStart%V); - ("replyThread", Client__replyThread%V) +Definition Client__mset_ptr : list (go_string * val) := [ + ("Call"%go, Client__Call%V); + ("CallComplete"%go, Client__CallComplete%V); + ("CallStart"%go, Client__CallStart%V); + ("replyThread"%go, Client__replyThread%V) ]. (* go: urpc.go:120:6 *) @@ -392,7 +392,7 @@ Definition MakeClient : val := do: ("cl" <-[ptrT] "$r1");;; (if: (![uint64T] "err") ≠ #(W64 0) then - do: (let: "$a0" := #"Unable to connect to %s" in + do: (let: "$a0" := #"Unable to connect to %s"%go in let: "$a1" := ((let: "$sl0" := (interface.make string__mset (let: "$a0" := (![uint64T] "host_name") in grove_ffi.AddressToStr "$a0")) in slice.literal interfaceT ["$sl0"])) in @@ -404,7 +404,7 @@ Definition MakeClient : val := Definition Error : go_type := uint64T. -Definition pkg_name' : string := "github.com/mit-pdos/gokv/urpc". +Definition pkg_name' : go_string := "github.com/mit-pdos/gokv/urpc". Definition define' : val := rec: "define'" <> := diff --git a/new/code/github_com/mit_pdos/gokv/vrsm/paxos.v b/new/code/github_com/mit_pdos/gokv/vrsm/paxos.v index 2f2dbe0c7..137ca9590 100644 --- a/new/code/github_com/mit_pdos/gokv/vrsm/paxos.v +++ b/new/code/github_com/mit_pdos/gokv/vrsm/paxos.v @@ -21,7 +21,7 @@ Definition singleClerk : go_type := structT [ "cl" :: ptrT ]. -Definition singleClerk__mset : list (string * val) := [ +Definition singleClerk__mset : list (go_string * val) := [ ]. (* go: internalclerk.go:51:23 *) @@ -215,10 +215,10 @@ Definition singleClerk__enterNewEpoch : val := "state" ::= zero_val sliceT }])))). -Definition singleClerk__mset_ptr : list (string * val) := [ - ("TryBecomeLeader", singleClerk__TryBecomeLeader%V); - ("applyAsFollower", singleClerk__applyAsFollower%V); - ("enterNewEpoch", singleClerk__enterNewEpoch%V) +Definition singleClerk__mset_ptr : list (go_string * val) := [ + ("TryBecomeLeader"%go, singleClerk__TryBecomeLeader%V); + ("applyAsFollower"%go, singleClerk__applyAsFollower%V); + ("enterNewEpoch"%go, singleClerk__enterNewEpoch%V) ]. (* go: internalclerk.go:19:6 *) @@ -234,10 +234,10 @@ Definition MakeSingleClerk : val := do: ("ck" <-[ptrT] "$r0");;; return: (![ptrT] "ck")). -Definition Error__mset : list (string * val) := [ +Definition Error__mset : list (go_string * val) := [ ]. -Definition Error__mset_ptr : list (string * val) := [ +Definition Error__mset_ptr : list (go_string * val) := [ ]. Definition ENone : expr := #(W64 0). @@ -248,10 +248,10 @@ Definition EOutOfOrder : expr := #(W64 2). Definition ENotLeader : expr := #(W64 4). -Definition applyAsFollowerArgs__mset : list (string * val) := [ +Definition applyAsFollowerArgs__mset : list (go_string * val) := [ ]. -Definition applyAsFollowerArgs__mset_ptr : list (string * val) := [ +Definition applyAsFollowerArgs__mset_ptr : list (go_string * val) := [ ]. (* go: marshal.go:29:6 *) @@ -277,10 +277,10 @@ Definition decodeApplyAsFollowerArgs : val := do: ((struct.field_ref applyAsFollowerArgs "state" (![ptrT] "o")) <-[sliceT] "$r0");;; return: (![ptrT] "o")). -Definition applyAsFollowerReply__mset : list (string * val) := [ +Definition applyAsFollowerReply__mset : list (go_string * val) := [ ]. -Definition applyAsFollowerReply__mset_ptr : list (string * val) := [ +Definition applyAsFollowerReply__mset_ptr : list (go_string * val) := [ ]. (* go: marshal.go:48:6 *) @@ -296,10 +296,10 @@ Definition encodeApplyAsFollowerReply : val := do: ("enc" <-[sliceT] "$r0");;; return: (![sliceT] "enc")). -Definition enterNewEpochArgs__mset : list (string * val) := [ +Definition enterNewEpochArgs__mset : list (go_string * val) := [ ]. -Definition enterNewEpochArgs__mset_ptr : list (string * val) := [ +Definition enterNewEpochArgs__mset_ptr : list (go_string * val) := [ ]. (* go: marshal.go:64:6 *) @@ -317,10 +317,10 @@ Definition decodeEnterNewEpochArgs : val := do: "$r1";;; return: (![ptrT] "o")). -Definition enterNewEpochReply__mset : list (string * val) := [ +Definition enterNewEpochReply__mset : list (go_string * val) := [ ]. -Definition enterNewEpochReply__mset_ptr : list (string * val) := [ +Definition enterNewEpochReply__mset_ptr : list (go_string * val) := [ ]. (* go: marshal.go:89:6 *) @@ -354,10 +354,10 @@ Definition applyReply : go_type := structT [ "ret" :: sliceT ]. -Definition applyReply__mset : list (string * val) := [ +Definition applyReply__mset : list (go_string * val) := [ ]. -Definition applyReply__mset_ptr : list (string * val) := [ +Definition applyReply__mset_ptr : list (go_string * val) := [ ]. (* go: marshal.go:103:6 *) @@ -486,10 +486,10 @@ Definition decodePaxosState : val := do: ((struct.field_ref paxosState "isLeader" (![ptrT] "ps")) <-[boolT] "$r0");;; return: (![ptrT] "ps")). -Definition paxosState__mset : list (string * val) := [ +Definition paxosState__mset : list (go_string * val) := [ ]. -Definition paxosState__mset_ptr : list (string * val) := [ +Definition paxosState__mset_ptr : list (go_string * val) := [ ]. Definition Server : go_type := structT [ @@ -499,7 +499,7 @@ Definition Server : go_type := structT [ "clerks" :: sliceT ]. -Definition Server__mset : list (string * val) := [ +Definition Server__mset : list (go_string * val) := [ ]. (* go: server.go:165:18 *) @@ -630,13 +630,13 @@ Definition Server__withLock : val := Definition Server__TryBecomeLeader : val := rec: "Server__TryBecomeLeader" "s" <> := exception_do (let: "s" := (ref_ty ptrT "s") in - do: (let: "$a0" := ((let: "$sl0" := (interface.make string__mset #"started trybecomeleader") in + do: (let: "$a0" := ((let: "$sl0" := (interface.make string__mset #"started trybecomeleader"%go) in slice.literal interfaceT ["$sl0"])) in log.Println "$a0");;; do: ((sync.Mutex__Lock (![ptrT] (struct.field_ref Server "mu" (![ptrT] "s")))) #());;; (if: ![boolT] (struct.field_ref paxosState "isLeader" (![ptrT] (struct.field_ref Server "ps" (![ptrT] "s")))) then - do: (let: "$a0" := ((let: "$sl0" := (interface.make string__mset #"already leader") in + do: (let: "$a0" := ((let: "$sl0" := (interface.make string__mset #"already leader"%go) in slice.literal interfaceT ["$sl0"])) in log.Println "$a0");;; do: ((sync.Mutex__Unlock (![ptrT] (struct.field_ref Server "mu" (![ptrT] "s")))) #());;; @@ -728,7 +728,7 @@ Definition Server__TryBecomeLeader : val := (if: (![uint64T] (struct.field_ref paxosState "epoch" (![ptrT] "ps"))) ≤ (![uint64T] (struct.field_ref enterNewEpochArgs "epoch" (![ptrT] "args"))) then do: (let: "$a0" := #"succeeded becomeleader in epoch %d - " in + "%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref enterNewEpochArgs "epoch" (![ptrT] "args")))) in slice.literal interfaceT ["$sl0"])) in log.Printf "$a0" "$a1");;; @@ -748,7 +748,7 @@ Definition Server__TryBecomeLeader : val := do: ((sync.Mutex__Unlock (![ptrT] "mu")) #()) else do: ((sync.Mutex__Unlock (![ptrT] "mu")) #());;; - do: (let: "$a0" := ((let: "$sl0" := (interface.make string__mset #"failed becomeleader") in + do: (let: "$a0" := ((let: "$sl0" := (interface.make string__mset #"failed becomeleader"%go) in slice.literal interfaceT ["$sl0"])) in log.Println "$a0"))). @@ -840,13 +840,13 @@ Definition Server__enterNewEpoch : val := ) in (Server__withLock (![ptrT] "s")) "$a0")). -Definition Server__mset_ptr : list (string * val) := [ - ("TryAcquire", Server__TryAcquire%V); - ("TryBecomeLeader", Server__TryBecomeLeader%V); - ("WeakRead", Server__WeakRead%V); - ("applyAsFollower", Server__applyAsFollower%V); - ("enterNewEpoch", Server__enterNewEpoch%V); - ("withLock", Server__withLock%V) +Definition Server__mset_ptr : list (go_string * val) := [ + ("TryAcquire"%go, Server__TryAcquire%V); + ("TryBecomeLeader"%go, Server__TryBecomeLeader%V); + ("WeakRead"%go, Server__WeakRead%V); + ("applyAsFollower"%go, Server__applyAsFollower%V); + ("enterNewEpoch"%go, Server__enterNewEpoch%V); + ("withLock"%go, Server__withLock%V) ]. (* go: server.go:242:6 *) @@ -957,7 +957,7 @@ Definition StartServer : val := (urpc.Server__Serve (![ptrT] "r")) "$a0");;; return: (![ptrT] "s")). -Definition pkg_name' : string := "github.com/mit-pdos/gokv/vrsm/paxos". +Definition pkg_name' : go_string := "github.com/mit-pdos/gokv/vrsm/paxos". Definition define' : val := rec: "define'" <> := diff --git a/new/code/github_com/tchajed/marshal.v b/new/code/github_com/tchajed/marshal.v index 706a8a501..3ed21dd72 100644 --- a/new/code/github_com/tchajed/marshal.v +++ b/new/code/github_com/tchajed/marshal.v @@ -93,32 +93,32 @@ Definition Enc__PutInts : val := do: (let: "$a0" := (![uint64T] "x") in (Enc__PutInt (![Enc] "enc")) "$a0")))). -Definition Enc__mset : list (string * val) := [ - ("Finish", Enc__Finish%V); - ("PutBool", Enc__PutBool%V); - ("PutBytes", Enc__PutBytes%V); - ("PutInt", Enc__PutInt%V); - ("PutInt32", Enc__PutInt32%V); - ("PutInts", Enc__PutInts%V) +Definition Enc__mset : list (go_string * val) := [ + ("Finish"%go, Enc__Finish%V); + ("PutBool"%go, Enc__PutBool%V); + ("PutBytes"%go, Enc__PutBytes%V); + ("PutInt"%go, Enc__PutInt%V); + ("PutInt32"%go, Enc__PutInt32%V); + ("PutInts"%go, Enc__PutInts%V) ]. -Definition Enc__mset_ptr : list (string * val) := [ - ("Finish", (λ: "$recvAddr", +Definition Enc__mset_ptr : list (go_string * val) := [ + ("Finish"%go, (λ: "$recvAddr", Enc__Finish (![Enc] "$recvAddr") )%V); - ("PutBool", (λ: "$recvAddr", + ("PutBool"%go, (λ: "$recvAddr", Enc__PutBool (![Enc] "$recvAddr") )%V); - ("PutBytes", (λ: "$recvAddr", + ("PutBytes"%go, (λ: "$recvAddr", Enc__PutBytes (![Enc] "$recvAddr") )%V); - ("PutInt", (λ: "$recvAddr", + ("PutInt"%go, (λ: "$recvAddr", Enc__PutInt (![Enc] "$recvAddr") )%V); - ("PutInt32", (λ: "$recvAddr", + ("PutInt32"%go, (λ: "$recvAddr", Enc__PutInt32 (![Enc] "$recvAddr") )%V); - ("PutInts", (λ: "$recvAddr", + ("PutInts"%go, (λ: "$recvAddr", Enc__PutInts (![Enc] "$recvAddr") )%V) ]. @@ -217,28 +217,28 @@ Definition Dec__GetInts : val := do: ("xs" <-[sliceT] "$r0")));;; return: (![sliceT] "xs")). -Definition Dec__mset : list (string * val) := [ - ("GetBool", Dec__GetBool%V); - ("GetBytes", Dec__GetBytes%V); - ("GetInt", Dec__GetInt%V); - ("GetInt32", Dec__GetInt32%V); - ("GetInts", Dec__GetInts%V) +Definition Dec__mset : list (go_string * val) := [ + ("GetBool"%go, Dec__GetBool%V); + ("GetBytes"%go, Dec__GetBytes%V); + ("GetInt"%go, Dec__GetInt%V); + ("GetInt32"%go, Dec__GetInt32%V); + ("GetInts"%go, Dec__GetInts%V) ]. -Definition Dec__mset_ptr : list (string * val) := [ - ("GetBool", (λ: "$recvAddr", +Definition Dec__mset_ptr : list (go_string * val) := [ + ("GetBool"%go, (λ: "$recvAddr", Dec__GetBool (![Dec] "$recvAddr") )%V); - ("GetBytes", (λ: "$recvAddr", + ("GetBytes"%go, (λ: "$recvAddr", Dec__GetBytes (![Dec] "$recvAddr") )%V); - ("GetInt", (λ: "$recvAddr", + ("GetInt"%go, (λ: "$recvAddr", Dec__GetInt (![Dec] "$recvAddr") )%V); - ("GetInt32", (λ: "$recvAddr", + ("GetInt32"%go, (λ: "$recvAddr", Dec__GetInt32 (![Dec] "$recvAddr") )%V); - ("GetInts", (λ: "$recvAddr", + ("GetInts"%go, (λ: "$recvAddr", Dec__GetInts (![Dec] "$recvAddr") )%V) ]. @@ -573,7 +573,7 @@ Definition WriteSliceLenPrefix (T: go_type) : val := do: ("b3" <-[sliceT] "$r0");;; return: (![sliceT] "b3")). -Definition pkg_name' : string := "github.com/tchajed/marshal". +Definition pkg_name' : go_string := "github.com/tchajed/marshal". Definition define' : val := rec: "define'" <> := diff --git a/new/code/go_etcd_io/raft/v3.v b/new/code/go_etcd_io/raft/v3.v index 1b77d21fc..e2dd11110 100644 --- a/new/code/go_etcd_io/raft/v3.v +++ b/new/code/go_etcd_io/raft/v3.v @@ -167,7 +167,7 @@ Definition raft__send : val := then (if: (![uint64T] (struct.field_ref raftpb.Message "Term" "m")) = #(W64 0) then - do: (let: "$a0" := #"term should be set when sending %s" in + do: (let: "$a0" := #"term should be set when sending %s"%go in let: "$a1" := ((let: "$sl0" := (interface.make raftpb.MessageType__mset (![raftpb.MessageType] (struct.field_ref raftpb.Message "Type" "m"))) in slice.literal interfaceT ["$sl0"])) in (interface.get "Panicf" (![Logger] (struct.field_ref raft "logger" (![ptrT] "r")))) "$a0" "$a1") @@ -175,7 +175,7 @@ Definition raft__send : val := else (if: (![uint64T] (struct.field_ref raftpb.Message "Term" "m")) ≠ #(W64 0) then - do: (let: "$a0" := #"term should not be set when sending %s (was %d)" in + do: (let: "$a0" := #"term should not be set when sending %s (was %d)"%go in let: "$a1" := ((let: "$sl0" := (interface.make raftpb.MessageType__mset (![raftpb.MessageType] (struct.field_ref raftpb.Message "Type" "m"))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref raftpb.Message "Term" "m"))) in slice.literal interfaceT ["$sl0"; "$sl1"])) in @@ -199,7 +199,7 @@ Definition raft__send : val := else (if: (![uint64T] (struct.field_ref raftpb.Message "To" "m")) = (![uint64T] (struct.field_ref raft "id" (![ptrT] "r"))) then - do: (let: "$a0" := #"message should not be self-addressed when sending %s" in + do: (let: "$a0" := #"message should not be self-addressed when sending %s"%go in let: "$a1" := ((let: "$sl0" := (interface.make raftpb.MessageType__mset (![raftpb.MessageType] (struct.field_ref raftpb.Message "Type" "m"))) in slice.literal interfaceT ["$sl0"])) in (interface.get "Panicf" (![Logger] (struct.field_ref raft "logger" (![ptrT] "r")))) "$a0" "$a1") @@ -261,9 +261,9 @@ Definition IsEmptySnap : val := exception_do (let: "sp" := (ref_ty raftpb.Snapshot "sp") in return: ((![uint64T] (struct.field_ref raftpb.SnapshotMetadata "Index" (struct.field_ref raftpb.Snapshot "Metadata" "sp"))) = #(W64 0))). -Definition pkg_name' : string := "go.etcd.io/raft/v3". +Definition pkg_name' : go_string := "go.etcd.io/raft/v3". -Definition ErrSnapshotTemporarilyUnavailable : (string * string) := (pkg_name', "ErrSnapshotTemporarilyUnavailable"). +Definition ErrSnapshotTemporarilyUnavailable : (go_string * go_string) := (pkg_name', "ErrSnapshotTemporarilyUnavailable"%go). (* go: log.go:293:19 *) Definition raftLog__snapshot : val := @@ -286,7 +286,7 @@ Definition raft__maybeSendSnapshot : val := let: "to" := (ref_ty uint64T "to") in (if: (~ (![boolT] (struct.field_ref tracker.Progress "RecentActive" (![ptrT] "pr")))) then - do: (let: "$a0" := #"ignore sending snapshot to %x since it is not recently active" in + do: (let: "$a0" := #"ignore sending snapshot to %x since it is not recently active"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] "to")) in slice.literal interfaceT ["$sl0"])) in (interface.get "Debugf" (![Logger] (struct.field_ref raft "logger" (![ptrT] "r")))) "$a0" "$a1");;; @@ -303,7 +303,7 @@ Definition raft__maybeSendSnapshot : val := then (if: (![error] "err") = (![error] (globals.get ErrSnapshotTemporarilyUnavailable #())) then - do: (let: "$a0" := #"%x failed to send snapshot to %x because snapshot is temporarily unavailable" in + do: (let: "$a0" := #"%x failed to send snapshot to %x because snapshot is temporarily unavailable"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] "to")) in slice.literal interfaceT ["$sl0"; "$sl1"])) in @@ -316,7 +316,7 @@ Definition raft__maybeSendSnapshot : val := (if: let: "$a0" := (![raftpb.Snapshot] "snapshot") in IsEmptySnap "$a0" then - do: (let: "$a0" := (interface.make string__mset #"need non-empty snapshot") in + do: (let: "$a0" := (interface.make string__mset #"need non-empty snapshot"%go) in Panic "$a0") else do: #());;; let: "sterm" := (ref_ty uint64T (zero_val uint64T)) in @@ -325,7 +325,7 @@ Definition raft__maybeSendSnapshot : val := let: "$r1" := (![uint64T] (struct.field_ref raftpb.SnapshotMetadata "Term" (struct.field_ref raftpb.Snapshot "Metadata" "snapshot"))) in do: ("sindex" <-[uint64T] "$r0");;; do: ("sterm" <-[uint64T] "$r1");;; - do: (let: "$a0" := #"%x [firstindex: %d, commit: %d] sent snapshot[index: %d, term: %d] to %x [%s]" in + do: (let: "$a0" := #"%x [firstindex: %d, commit: %d] sent snapshot[index: %d, term: %d] to %x [%s]"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make uint64__mset ((raftLog__firstIndex (![ptrT] (struct.field_ref raft "raftLog" (![ptrT] "r")))) #())) in let: "$sl2" := (interface.make uint64__mset (![uint64T] (struct.field_ref raftLog "committed" (![ptrT] (struct.field_ref raft "raftLog" (![ptrT] "r")))))) in @@ -337,7 +337,7 @@ Definition raft__maybeSendSnapshot : val := (interface.get "Debugf" (![Logger] (struct.field_ref raft "logger" (![ptrT] "r")))) "$a0" "$a1");;; do: (let: "$a0" := (![uint64T] "sindex") in (tracker.Progress__BecomeSnapshot (![ptrT] "pr")) "$a0");;; - do: (let: "$a0" := #"%x paused sending replication messages to %x [%s]" in + do: (let: "$a0" := #"%x paused sending replication messages to %x [%s]"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] "to")) in let: "$sl2" := (interface.make tracker.Progress__mset_ptr (![ptrT] "pr")) in @@ -453,7 +453,7 @@ Definition unstable__mustCheckOutOfBounds : val := let: "lo" := (ref_ty uint64T "lo") in (if: (![uint64T] "lo") > (![uint64T] "hi") then - do: (let: "$a0" := #"invalid unstable.slice %d > %d" in + do: (let: "$a0" := #"invalid unstable.slice %d > %d"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] "lo")) in let: "$sl1" := (interface.make uint64__mset (![uint64T] "hi")) in slice.literal interfaceT ["$sl0"; "$sl1"])) in @@ -465,7 +465,7 @@ Definition unstable__mustCheckOutOfBounds : val := do: ("upper" <-[uint64T] "$r0");;; (if: ((![uint64T] "lo") < (![uint64T] (struct.field_ref unstable "offset" (![ptrT] "u")))) || ((![uint64T] "hi") > (![uint64T] "upper")) then - do: (let: "$a0" := #"unstable.slice[%d,%d) out of bound [%d,%d]" in + do: (let: "$a0" := #"unstable.slice[%d,%d) out of bound [%d,%d]"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] "lo")) in let: "$sl1" := (interface.make uint64__mset (![uint64T] "hi")) in let: "$sl2" := (interface.make uint64__mset (![uint64T] (struct.field_ref unstable "offset" (![ptrT] "u")))) in @@ -495,9 +495,9 @@ Definition unstable__slice : val := return: (let: "$s" := (![sliceT] (struct.field_ref unstable "entries" (![ptrT] "u"))) in slice.full_slice raftpb.Entry "$s" ((![uint64T] "lo") - (![uint64T] (struct.field_ref unstable "offset" (![ptrT] "u")))) ((![uint64T] "hi") - (![uint64T] (struct.field_ref unstable "offset" (![ptrT] "u")))) ((![uint64T] "hi") - (![uint64T] (struct.field_ref unstable "offset" (![ptrT] "u")))))). -Definition ErrUnavailable : (string * string) := (pkg_name', "ErrUnavailable"). +Definition ErrUnavailable : (go_string * go_string) := (pkg_name', "ErrUnavailable"%go). -Definition ErrCompacted : (string * string) := (pkg_name', "ErrCompacted"). +Definition ErrCompacted : (go_string * go_string) := (pkg_name', "ErrCompacted"%go). (* maybeLastIndex returns the last index if it has at least one unstable entry or snapshot. @@ -556,7 +556,7 @@ Definition raftLog__mustCheckOutOfBounds : val := let: "lo" := (ref_ty uint64T "lo") in (if: (![uint64T] "lo") > (![uint64T] "hi") then - do: (let: "$a0" := #"invalid slice %d > %d" in + do: (let: "$a0" := #"invalid slice %d > %d"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] "lo")) in let: "$sl1" := (interface.make uint64__mset (![uint64T] "hi")) in slice.literal interfaceT ["$sl0"; "$sl1"])) in @@ -573,7 +573,7 @@ Definition raftLog__mustCheckOutOfBounds : val := do: ("length" <-[uint64T] "$r0");;; (if: (![uint64T] "hi") > ((![uint64T] "fi") + (![uint64T] "length")) then - do: (let: "$a0" := #"slice[%d,%d) out of bound [%d,%d]" in + do: (let: "$a0" := #"slice[%d,%d) out of bound [%d,%d]"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] "lo")) in let: "$sl1" := (interface.make uint64__mset (![uint64T] "hi")) in let: "$sl2" := (interface.make uint64__mset (![uint64T] "fi")) in @@ -637,7 +637,7 @@ Definition raftLog__slice : val := else (if: (![error] "err") = (![error] (globals.get ErrUnavailable #())) then - do: (let: "$a0" := #"entries[%d:%d) is unavailable from storage" in + do: (let: "$a0" := #"entries[%d:%d) is unavailable from storage"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] "lo")) in let: "$sl1" := (interface.make uint64__mset (![uint64T] "cut")) in slice.literal interfaceT ["$sl0"; "$sl1"])) in @@ -886,7 +886,7 @@ Definition raftLog__commitTo : val := then (if: ((raftLog__lastIndex (![ptrT] "l")) #()) < (![uint64T] "tocommit") then - do: (let: "$a0" := #"tocommit(%d) is out of range [lastIndex(%d)]. Was the raft log corrupted, truncated, or lost?" in + do: (let: "$a0" := #"tocommit(%d) is out of range [lastIndex(%d)]. Was the raft log corrupted, truncated, or lost?"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] "tocommit")) in let: "$sl1" := (interface.make uint64__mset ((raftLog__lastIndex (![ptrT] "l")) #())) in slice.literal interfaceT ["$sl0"; "$sl1"])) in @@ -1001,7 +1001,7 @@ Definition newReadOnly : val := "readIndexQueue" ::= zero_val sliceT }]))). -Definition globalRand : (string * string) := (pkg_name', "globalRand"). +Definition globalRand : (go_string * go_string) := (pkg_name', "globalRand"%go). Definition lockedRand : go_type := structT [ "mu" :: sync.Mutex @@ -1090,7 +1090,7 @@ Definition raft__reset : val := newReadOnly "$a0") in do: ((struct.field_ref raft "readOnly" (![ptrT] "r")) <-[ptrT] "$r0")). -Definition stepFollowerGlobal : (string * string) := (pkg_name', "stepFollowerGlobal"). +Definition stepFollowerGlobal : (go_string * go_string) := (pkg_name', "stepFollowerGlobal"%go). (* go: raft.go:909:16 *) Definition raft__becomeFollower : val := @@ -1108,7 +1108,7 @@ Definition raft__becomeFollower : val := do: ((struct.field_ref raft "lead" (![ptrT] "r")) <-[uint64T] "$r0");;; let: "$r0" := StateFollower in do: ((struct.field_ref raft "state" (![ptrT] "r")) <-[StateType] "$r0");;; - do: (let: "$a0" := #"%x became follower at term %d" in + do: (let: "$a0" := #"%x became follower at term %d"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "Term" (![ptrT] "r")))) in slice.literal interfaceT ["$sl0"; "$sl1"])) in @@ -1143,7 +1143,7 @@ Definition raft__switchToConfig : val := do: ((struct.field_ref tracker.ProgressTracker "Config" (struct.field_ref raft "trk" (![ptrT] "r"))) <-[tracker.Config] "$r0");;; let: "$r0" := (![tracker.ProgressMap] "trk") in do: ((struct.field_ref tracker.ProgressTracker "Progress" (struct.field_ref raft "trk" (![ptrT] "r"))) <-[tracker.ProgressMap] "$r0");;; - do: (let: "$a0" := #"%x switched to configuration %s" in + do: (let: "$a0" := #"%x switched to configuration %s"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make tracker.Config__mset (![tracker.Config] (struct.field_ref tracker.ProgressTracker "Config" (struct.field_ref raft "trk" (![ptrT] "r"))))) in slice.literal interfaceT ["$sl0"; "$sl1"])) in @@ -1273,7 +1273,7 @@ Definition unstable__truncateAndAppend : val := else (if: "$sw" = ((![uint64T] "fromIndex") ≤ (![uint64T] (struct.field_ref unstable "offset" (![ptrT] "u")))) then - do: (let: "$a0" := #"replace the unstable entries from index %d" in + do: (let: "$a0" := #"replace the unstable entries from index %d"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] "fromIndex")) in slice.literal interfaceT ["$sl0"])) in (interface.get "Infof" (![Logger] (struct.field_ref unstable "logger" (![ptrT] "u")))) "$a0" "$a1");;; @@ -1284,7 +1284,7 @@ Definition unstable__truncateAndAppend : val := let: "$r0" := (![uint64T] (struct.field_ref unstable "offset" (![ptrT] "u"))) in do: ((struct.field_ref unstable "offsetInProgress" (![ptrT] "u")) <-[uint64T] "$r0") else - do: (let: "$a0" := #"truncate the unstable entries before index %d" in + do: (let: "$a0" := #"truncate the unstable entries before index %d"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] "fromIndex")) in slice.literal interfaceT ["$sl0"])) in (interface.get "Infof" (![Logger] (struct.field_ref unstable "logger" (![ptrT] "u")))) "$a0" "$a1");;; @@ -1316,7 +1316,7 @@ Definition raftLog__append : val := do: ("after" <-[uint64T] "$r0");;; (if: (![uint64T] "after") < (![uint64T] (struct.field_ref raftLog "committed" (![ptrT] "l"))) then - do: (let: "$a0" := #"after(%d) is out of range [committed(%d)]" in + do: (let: "$a0" := #"after(%d) is out of range [committed(%d)]"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] "after")) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref raftLog "committed" (![ptrT] "l")))) in slice.literal interfaceT ["$sl0"; "$sl1"])) in @@ -1326,7 +1326,7 @@ Definition raftLog__append : val := (unstable__truncateAndAppend (struct.field_ref raftLog "unstable" (![ptrT] "l"))) "$a0");;; return: ((raftLog__lastIndex (![ptrT] "l")) #())). -Definition emptyState : (string * string) := (pkg_name', "emptyState"). +Definition emptyState : (go_string * go_string) := (pkg_name', "emptyState"%go). (* Bootstrap initializes the RawNode for first use by appending configuration changes for the supplied peers. This method returns an error if the Storage @@ -1344,7 +1344,7 @@ Definition RawNode__Bootstrap : val := (if: (let: "$a0" := (![sliceT] "peers") in slice.len "$a0") = #(W64 0) then - return: (let: "$a0" := #"must provide at least one peer to Bootstrap" in + return: (let: "$a0" := #"must provide at least one peer to Bootstrap"%go in errors.New "$a0") else do: #());;; let: "err" := (ref_ty error (zero_val error)) in @@ -1359,7 +1359,7 @@ Definition RawNode__Bootstrap : val := else do: #());;; (if: (![uint64T] "lastIndex") ≠ #(W64 0) then - return: (let: "$a0" := #"can't bootstrap a nonempty Storage" in + return: (let: "$a0" := #"can't bootstrap a nonempty Storage"%go in errors.New "$a0") else do: #());;; let: "$r0" := (![raftpb.HardState] (globals.get emptyState #())) in @@ -1426,14 +1426,14 @@ Definition RawNode__Bootstrap : val := (raft__applyConfChange (![ptrT] (struct.field_ref RawNode "raft" (![ptrT] "rn")))) "$a0")));;; return: (#interface.nil)). -Definition raftLog__mset : list (string * val) := [ +Definition raftLog__mset : list (go_string * val) := [ ]. (* go: log.go:100:19 *) Definition raftLog__String : val := rec: "raftLog__String" "l" <> := exception_do (let: "l" := (ref_ty ptrT "l") in - return: (let: "$a0" := #"committed=%d, applied=%d, applying=%d, unstable.offset=%d, unstable.offsetInProgress=%d, len(unstable.Entries)=%d" in + return: (let: "$a0" := #"committed=%d, applied=%d, applying=%d, unstable.offset=%d, unstable.offsetInProgress=%d, len(unstable.Entries)=%d"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raftLog "committed" (![ptrT] "l")))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref raftLog "applied" (![ptrT] "l")))) in let: "$sl2" := (interface.make uint64__mset (![uint64T] (struct.field_ref raftLog "applying" (![ptrT] "l")))) in @@ -1475,7 +1475,7 @@ Definition raftLog__acceptApplying : val := let: "i" := (ref_ty uint64T "i") in (if: (![uint64T] (struct.field_ref raftLog "committed" (![ptrT] "l"))) < (![uint64T] "i") then - do: (let: "$a0" := #"applying(%d) is out of range [prevApplying(%d), committed(%d)]" in + do: (let: "$a0" := #"applying(%d) is out of range [prevApplying(%d), committed(%d)]"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] "i")) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref raftLog "applying" (![ptrT] "l")))) in let: "$sl2" := (interface.make uint64__mset (![uint64T] (struct.field_ref raftLog "committed" (![ptrT] "l")))) in @@ -1557,7 +1557,7 @@ Definition raftLog__appliedTo : val := let: "i" := (ref_ty uint64T "i") in (if: ((![uint64T] (struct.field_ref raftLog "committed" (![ptrT] "l"))) < (![uint64T] "i")) || ((![uint64T] "i") < (![uint64T] (struct.field_ref raftLog "applied" (![ptrT] "l")))) then - do: (let: "$a0" := #"applied(%d) is out of range [prevApplied(%d), committed(%d)]" in + do: (let: "$a0" := #"applied(%d) is out of range [prevApplied(%d), committed(%d)]"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] "i")) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref raftLog "applied" (![ptrT] "l")))) in let: "$sl2" := (interface.make uint64__mset (![uint64T] (struct.field_ref raftLog "committed" (![ptrT] "l")))) in @@ -1590,7 +1590,7 @@ Definition raftLog__zeroTermOnOutOfBounds : val := (if: ((![error] "err") = (![error] (globals.get ErrCompacted #()))) || ((![error] "err") = (![error] (globals.get ErrUnavailable #()))) then return: (#(W64 0)) else do: #());;; - do: (let: "$a0" := #"unexpected error (%v)" in + do: (let: "$a0" := #"unexpected error (%v)"%go in let: "$a1" := ((let: "$sl0" := (![error] "err") in slice.literal interfaceT ["$sl0"])) in (interface.get "Panicf" (![Logger] (struct.field_ref raftLog "logger" (![ptrT] "l")))) "$a0" "$a1");;; @@ -1637,7 +1637,7 @@ Definition raftLog__findConflict : val := then (if: (![uint64T] (struct.field_ref entryID "index" "id")) ≤ ((raftLog__lastIndex (![ptrT] "l")) #()) then - do: (let: "$a0" := #"found conflict at index %d [existing term: %d, conflicting term: %d]" in + do: (let: "$a0" := #"found conflict at index %d [existing term: %d, conflicting term: %d]"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref entryID "index" "id"))) in let: "$sl1" := (interface.make uint64__mset (let: ("$ret0", "$ret1") := ((let: "$a0" := (![uint64T] (struct.field_ref entryID "index" "id")) in (raftLog__term (![ptrT] "l")) "$a0")) in @@ -1808,7 +1808,7 @@ Definition raftLog__lastEntryID : val := do: ("err" <-[error] "$r1");;; (if: (![error] "err") ≠ #interface.nil then - do: (let: "$a0" := #"unexpected error when getting the last term at %d: %v" in + do: (let: "$a0" := #"unexpected error when getting the last term at %d: %v"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] "index")) in let: "$sl1" := (![error] "err") in slice.literal interfaceT ["$sl0"; "$sl1"])) in @@ -1872,7 +1872,7 @@ Definition raftLog__maybeAppend : val := else (if: "$sw" = ((![uint64T] "ci") ≤ (![uint64T] (struct.field_ref raftLog "committed" (![ptrT] "l")))) then - do: (let: "$a0" := #"entry %d conflict with committed entry [committed(%d)]" in + do: (let: "$a0" := #"entry %d conflict with committed entry [committed(%d)]"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] "ci")) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref raftLog "committed" (![ptrT] "l")))) in slice.literal interfaceT ["$sl0"; "$sl1"])) in @@ -1884,7 +1884,7 @@ Definition raftLog__maybeAppend : val := (if: ((![uint64T] "ci") - (![uint64T] "offset")) > (let: "$a0" := (![sliceT] (struct.field_ref logSlice "entries" "a")) in slice.len "$a0") then - do: (let: "$a0" := #"index, %d, is out of range [%d]" in + do: (let: "$a0" := #"index, %d, is out of range [%d]"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset ((![uint64T] "ci") - (![uint64T] "offset"))) in let: "$sl1" := (interface.make int__mset (let: "$a0" := (![sliceT] (struct.field_ref logSlice "entries" "a")) in slice.len "$a0")) in @@ -1900,7 +1900,7 @@ Definition raftLog__maybeAppend : val := (raftLog__commitTo (![ptrT] "l")) "$a0");;; return: (![uint64T] "lastnewi", #true)). -Definition entryEncodingSize__mset : list (string * val) := [ +Definition entryEncodingSize__mset : list (go_string * val) := [ ]. (* nextCommittedEnts returns all the available entries for execution. @@ -1936,7 +1936,7 @@ Definition raftLog__nextCommittedEnts : val := do: ("maxSize" <-[entryEncodingSize] "$r0");;; (if: (![entryEncodingSize] "maxSize") ≤ #(W64 0) then - do: (let: "$a0" := #"applying entry size (%d-%d)=%d not positive" in + do: (let: "$a0" := #"applying entry size (%d-%d)=%d not positive"%go in let: "$a1" := ((let: "$sl0" := (interface.make entryEncodingSize__mset (![entryEncodingSize] (struct.field_ref raftLog "maxApplyingEntsSize" (![ptrT] "l")))) in let: "$sl1" := (interface.make entryEncodingSize__mset (![entryEncodingSize] (struct.field_ref raftLog "applyingEntsSize" (![ptrT] "l")))) in let: "$sl2" := (interface.make entryEncodingSize__mset (![entryEncodingSize] "maxSize")) in @@ -1954,7 +1954,7 @@ Definition raftLog__nextCommittedEnts : val := do: ("err" <-[error] "$r1");;; (if: (![error] "err") ≠ #interface.nil then - do: (let: "$a0" := #"unexpected error when getting unapplied entries (%v)" in + do: (let: "$a0" := #"unexpected error when getting unapplied entries (%v)"%go in let: "$a1" := ((let: "$sl0" := (![error] "err") in slice.literal interfaceT ["$sl0"])) in (interface.get "Panicf" (![Logger] (struct.field_ref raftLog "logger" (![ptrT] "l")))) "$a0" "$a1") @@ -2032,7 +2032,7 @@ Definition raftLog__scan : val := (if: (let: "$a0" := (![sliceT] "ents") in slice.len "$a0") = #(W64 0) then - return: (let: "$a0" := #"got 0 entries in [%d, %d)" in + return: (let: "$a0" := #"got 0 entries in [%d, %d)"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] "lo")) in let: "$sl1" := (interface.make uint64__mset (![uint64T] "hi")) in slice.literal interfaceT ["$sl0"; "$sl1"])) in @@ -2119,7 +2119,7 @@ Definition unstable__stableTo : val := do: ("ok" <-[boolT] "$r1");;; (if: (~ (![boolT] "ok")) then - do: (let: "$a0" := #"entry at index %d missing from unstable log; ignoring" in + do: (let: "$a0" := #"entry at index %d missing from unstable log; ignoring"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref entryID "index" "id"))) in slice.literal interfaceT ["$sl0"])) in (interface.get "Infof" (![Logger] (struct.field_ref unstable "logger" (![ptrT] "u")))) "$a0" "$a1");;; @@ -2127,7 +2127,7 @@ Definition unstable__stableTo : val := else do: #());;; (if: (![uint64T] (struct.field_ref entryID "index" "id")) < (![uint64T] (struct.field_ref unstable "offset" (![ptrT] "u"))) then - do: (let: "$a0" := #"entry at index %d matched unstable snapshot; ignoring" in + do: (let: "$a0" := #"entry at index %d matched unstable snapshot; ignoring"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref entryID "index" "id"))) in slice.literal interfaceT ["$sl0"])) in (interface.get "Infof" (![Logger] (struct.field_ref unstable "logger" (![ptrT] "u")))) "$a0" "$a1");;; @@ -2135,7 +2135,7 @@ Definition unstable__stableTo : val := else do: #());;; (if: (![uint64T] "gt") ≠ (![uint64T] (struct.field_ref entryID "term" "id")) then - do: (let: "$a0" := ("entry at (index,term)=(%d,%d) mismatched with " + "entry at (%d,%d) in unstable log; ignoring") in + do: (let: "$a0" := #("entry at (index,term)=(%d,%d) mismatched with "%go ++ "entry at (%d,%d) in unstable log; ignoring"%go) in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref entryID "index" "id"))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref entryID "term" "id"))) in let: "$sl2" := (interface.make uint64__mset (![uint64T] (struct.field_ref entryID "index" "id"))) in @@ -2166,42 +2166,42 @@ Definition raftLog__stableTo : val := do: (let: "$a0" := (![entryID] "id") in (unstable__stableTo (struct.field_ref raftLog "unstable" (![ptrT] "l"))) "$a0")). -Definition raftLog__mset_ptr : list (string * val) := [ - ("String", raftLog__String%V); - ("acceptApplying", raftLog__acceptApplying%V); - ("acceptUnstable", raftLog__acceptUnstable%V); - ("allEntries", raftLog__allEntries%V); - ("append", raftLog__append%V); - ("appliedTo", raftLog__appliedTo%V); - ("commitTo", raftLog__commitTo%V); - ("entries", raftLog__entries%V); - ("findConflict", raftLog__findConflict%V); - ("findConflictByTerm", raftLog__findConflictByTerm%V); - ("firstIndex", raftLog__firstIndex%V); - ("hasNextCommittedEnts", raftLog__hasNextCommittedEnts%V); - ("hasNextOrInProgressSnapshot", raftLog__hasNextOrInProgressSnapshot%V); - ("hasNextOrInProgressUnstableEnts", raftLog__hasNextOrInProgressUnstableEnts%V); - ("hasNextUnstableEnts", raftLog__hasNextUnstableEnts%V); - ("hasNextUnstableSnapshot", raftLog__hasNextUnstableSnapshot%V); - ("isUpToDate", raftLog__isUpToDate%V); - ("lastEntryID", raftLog__lastEntryID%V); - ("lastIndex", raftLog__lastIndex%V); - ("matchTerm", raftLog__matchTerm%V); - ("maxAppliableIndex", raftLog__maxAppliableIndex%V); - ("maybeAppend", raftLog__maybeAppend%V); - ("maybeCommit", raftLog__maybeCommit%V); - ("mustCheckOutOfBounds", raftLog__mustCheckOutOfBounds%V); - ("nextCommittedEnts", raftLog__nextCommittedEnts%V); - ("nextUnstableEnts", raftLog__nextUnstableEnts%V); - ("nextUnstableSnapshot", raftLog__nextUnstableSnapshot%V); - ("restore", raftLog__restore%V); - ("scan", raftLog__scan%V); - ("slice", raftLog__slice%V); - ("snapshot", raftLog__snapshot%V); - ("stableSnapTo", raftLog__stableSnapTo%V); - ("stableTo", raftLog__stableTo%V); - ("term", raftLog__term%V); - ("zeroTermOnOutOfBounds", raftLog__zeroTermOnOutOfBounds%V) +Definition raftLog__mset_ptr : list (go_string * val) := [ + ("String"%go, raftLog__String%V); + ("acceptApplying"%go, raftLog__acceptApplying%V); + ("acceptUnstable"%go, raftLog__acceptUnstable%V); + ("allEntries"%go, raftLog__allEntries%V); + ("append"%go, raftLog__append%V); + ("appliedTo"%go, raftLog__appliedTo%V); + ("commitTo"%go, raftLog__commitTo%V); + ("entries"%go, raftLog__entries%V); + ("findConflict"%go, raftLog__findConflict%V); + ("findConflictByTerm"%go, raftLog__findConflictByTerm%V); + ("firstIndex"%go, raftLog__firstIndex%V); + ("hasNextCommittedEnts"%go, raftLog__hasNextCommittedEnts%V); + ("hasNextOrInProgressSnapshot"%go, raftLog__hasNextOrInProgressSnapshot%V); + ("hasNextOrInProgressUnstableEnts"%go, raftLog__hasNextOrInProgressUnstableEnts%V); + ("hasNextUnstableEnts"%go, raftLog__hasNextUnstableEnts%V); + ("hasNextUnstableSnapshot"%go, raftLog__hasNextUnstableSnapshot%V); + ("isUpToDate"%go, raftLog__isUpToDate%V); + ("lastEntryID"%go, raftLog__lastEntryID%V); + ("lastIndex"%go, raftLog__lastIndex%V); + ("matchTerm"%go, raftLog__matchTerm%V); + ("maxAppliableIndex"%go, raftLog__maxAppliableIndex%V); + ("maybeAppend"%go, raftLog__maybeAppend%V); + ("maybeCommit"%go, raftLog__maybeCommit%V); + ("mustCheckOutOfBounds"%go, raftLog__mustCheckOutOfBounds%V); + ("nextCommittedEnts"%go, raftLog__nextCommittedEnts%V); + ("nextUnstableEnts"%go, raftLog__nextUnstableEnts%V); + ("nextUnstableSnapshot"%go, raftLog__nextUnstableSnapshot%V); + ("restore"%go, raftLog__restore%V); + ("scan"%go, raftLog__scan%V); + ("slice"%go, raftLog__slice%V); + ("snapshot"%go, raftLog__snapshot%V); + ("stableSnapTo"%go, raftLog__stableSnapTo%V); + ("stableTo"%go, raftLog__stableTo%V); + ("term"%go, raftLog__term%V); + ("zeroTermOnOutOfBounds"%go, raftLog__zeroTermOnOutOfBounds%V) ]. (* newLogWithSize returns a log using the given storage and max @@ -2279,28 +2279,28 @@ Definition newLog : val := let: "$a2" := #(W64 noLimit) in newLogWithSize "$a0" "$a1" "$a2")). -Definition unstable__mset : list (string * val) := [ +Definition unstable__mset : list (go_string * val) := [ ]. -Definition unstable__mset_ptr : list (string * val) := [ - ("acceptInProgress", unstable__acceptInProgress%V); - ("maybeFirstIndex", unstable__maybeFirstIndex%V); - ("maybeLastIndex", unstable__maybeLastIndex%V); - ("maybeTerm", unstable__maybeTerm%V); - ("mustCheckOutOfBounds", unstable__mustCheckOutOfBounds%V); - ("nextEntries", unstable__nextEntries%V); - ("nextSnapshot", unstable__nextSnapshot%V); - ("restore", unstable__restore%V); - ("shrinkEntriesArray", unstable__shrinkEntriesArray%V); - ("slice", unstable__slice%V); - ("stableSnapTo", unstable__stableSnapTo%V); - ("stableTo", unstable__stableTo%V); - ("truncateAndAppend", unstable__truncateAndAppend%V) +Definition unstable__mset_ptr : list (go_string * val) := [ + ("acceptInProgress"%go, unstable__acceptInProgress%V); + ("maybeFirstIndex"%go, unstable__maybeFirstIndex%V); + ("maybeLastIndex"%go, unstable__maybeLastIndex%V); + ("maybeTerm"%go, unstable__maybeTerm%V); + ("mustCheckOutOfBounds"%go, unstable__mustCheckOutOfBounds%V); + ("nextEntries"%go, unstable__nextEntries%V); + ("nextSnapshot"%go, unstable__nextSnapshot%V); + ("restore"%go, unstable__restore%V); + ("shrinkEntriesArray"%go, unstable__shrinkEntriesArray%V); + ("slice"%go, unstable__slice%V); + ("stableSnapTo"%go, unstable__stableSnapTo%V); + ("stableTo"%go, unstable__stableTo%V); + ("truncateAndAppend"%go, unstable__truncateAndAppend%V) ]. -Definition raftLoggerMu : (string * string) := (pkg_name', "raftLoggerMu"). +Definition raftLoggerMu : (go_string * go_string) := (pkg_name', "raftLoggerMu"%go). -Definition raftLogger : (string * string) := (pkg_name', "raftLogger"). +Definition raftLogger : (go_string * go_string) := (pkg_name', "raftLogger"%go). (* go: logger.go:45:6 *) Definition SetLogger : val := @@ -2311,7 +2311,7 @@ Definition SetLogger : val := do: ((globals.get raftLogger #()) <-[Logger] "$r0");;; do: ((sync.Mutex__Unlock (globals.get raftLoggerMu #())) #())). -Definition defaultLogger : (string * string) := (pkg_name', "defaultLogger"). +Definition defaultLogger : (go_string * go_string) := (pkg_name', "defaultLogger"%go). Definition DefaultLogger : go_type := structT [ "Logger" :: ptrT; @@ -2325,7 +2325,7 @@ Definition header : val := rec: "header" "lvl" "msg" := exception_do (let: "msg" := (ref_ty stringT "msg") in let: "lvl" := (ref_ty stringT "lvl") in - return: (let: "$a0" := #"%s: %s" in + return: (let: "$a0" := #"%s: %s"%go in let: "$a1" := ((let: "$sl0" := (interface.make string__mset (![stringT] "lvl")) in let: "$sl1" := (interface.make string__mset (![stringT] "msg")) in slice.literal interfaceT ["$sl0"; "$sl1"])) in @@ -2339,7 +2339,7 @@ Definition DefaultLogger__Debug : val := (if: ![boolT] (struct.field_ref DefaultLogger "debug" (![ptrT] "l")) then do: (let: "$a0" := #(W64 calldepth) in - let: "$a1" := (let: "$a0" := #"DEBUG" in + let: "$a1" := (let: "$a0" := #"DEBUG"%go in let: "$a1" := (let: "$a0" := (![sliceT] "v") in fmt.Sprint "$a0") in header "$a0" "$a1") in @@ -2355,7 +2355,7 @@ Definition DefaultLogger__Debugf : val := (if: ![boolT] (struct.field_ref DefaultLogger "debug" (![ptrT] "l")) then do: (let: "$a0" := #(W64 calldepth) in - let: "$a1" := (let: "$a0" := #"DEBUG" in + let: "$a1" := (let: "$a0" := #"DEBUG"%go in let: "$a1" := (let: "$a0" := (![stringT] "format") in let: "$a1" := (![sliceT] "v") in fmt.Sprintf "$a0" "$a1") in @@ -2383,7 +2383,7 @@ Definition DefaultLogger__Error : val := exception_do (let: "l" := (ref_ty ptrT "l") in let: "v" := (ref_ty sliceT "v") in do: (let: "$a0" := #(W64 calldepth) in - let: "$a1" := (let: "$a0" := #"ERROR" in + let: "$a1" := (let: "$a0" := #"ERROR"%go in let: "$a1" := (let: "$a0" := (![sliceT] "v") in fmt.Sprint "$a0") in header "$a0" "$a1") in @@ -2396,7 +2396,7 @@ Definition DefaultLogger__Errorf : val := let: "v" := (ref_ty sliceT "v") in let: "format" := (ref_ty stringT "format") in do: (let: "$a0" := #(W64 calldepth) in - let: "$a1" := (let: "$a0" := #"ERROR" in + let: "$a1" := (let: "$a0" := #"ERROR"%go in let: "$a1" := (let: "$a0" := (![stringT] "format") in let: "$a1" := (![sliceT] "v") in fmt.Sprintf "$a0" "$a1") in @@ -2409,7 +2409,7 @@ Definition DefaultLogger__Fatal : val := exception_do (let: "l" := (ref_ty ptrT "l") in let: "v" := (ref_ty sliceT "v") in do: (let: "$a0" := #(W64 calldepth) in - let: "$a1" := (let: "$a0" := #"FATAL" in + let: "$a1" := (let: "$a0" := #"FATAL"%go in let: "$a1" := (let: "$a0" := (![sliceT] "v") in fmt.Sprint "$a0") in header "$a0" "$a1") in @@ -2424,7 +2424,7 @@ Definition DefaultLogger__Fatalf : val := let: "v" := (ref_ty sliceT "v") in let: "format" := (ref_ty stringT "format") in do: (let: "$a0" := #(W64 calldepth) in - let: "$a1" := (let: "$a0" := #"FATAL" in + let: "$a1" := (let: "$a0" := #"FATAL"%go in let: "$a1" := (let: "$a0" := (![stringT] "format") in let: "$a1" := (![sliceT] "v") in fmt.Sprintf "$a0" "$a1") in @@ -2439,7 +2439,7 @@ Definition DefaultLogger__Info : val := exception_do (let: "l" := (ref_ty ptrT "l") in let: "v" := (ref_ty sliceT "v") in do: (let: "$a0" := #(W64 calldepth) in - let: "$a1" := (let: "$a0" := #"INFO" in + let: "$a1" := (let: "$a0" := #"INFO"%go in let: "$a1" := (let: "$a0" := (![sliceT] "v") in fmt.Sprint "$a0") in header "$a0" "$a1") in @@ -2452,7 +2452,7 @@ Definition DefaultLogger__Infof : val := let: "v" := (ref_ty sliceT "v") in let: "format" := (ref_ty stringT "format") in do: (let: "$a0" := #(W64 calldepth) in - let: "$a1" := (let: "$a0" := #"INFO" in + let: "$a1" := (let: "$a0" := #"INFO"%go in let: "$a1" := (let: "$a0" := (![stringT] "format") in let: "$a1" := (![sliceT] "v") in fmt.Sprintf "$a0" "$a1") in @@ -2483,7 +2483,7 @@ Definition DefaultLogger__Warning : val := exception_do (let: "l" := (ref_ty ptrT "l") in let: "v" := (ref_ty sliceT "v") in do: (let: "$a0" := #(W64 calldepth) in - let: "$a1" := (let: "$a0" := #"WARN" in + let: "$a1" := (let: "$a0" := #"WARN"%go in let: "$a1" := (let: "$a0" := (![sliceT] "v") in fmt.Sprint "$a0") in header "$a0" "$a1") in @@ -2496,62 +2496,62 @@ Definition DefaultLogger__Warningf : val := let: "v" := (ref_ty sliceT "v") in let: "format" := (ref_ty stringT "format") in do: (let: "$a0" := #(W64 calldepth) in - let: "$a1" := (let: "$a0" := #"WARN" in + let: "$a1" := (let: "$a0" := #"WARN"%go in let: "$a1" := (let: "$a0" := (![stringT] "format") in let: "$a1" := (![sliceT] "v") in fmt.Sprintf "$a0" "$a1") in header "$a0" "$a1") in (log.Logger__Output (![ptrT] (struct.field_ref DefaultLogger "Logger" (![ptrT] "l")))) "$a0" "$a1")). -Definition DefaultLogger__mset_ptr : list (string * val) := [ - ("Debug", DefaultLogger__Debug%V); - ("Debugf", DefaultLogger__Debugf%V); - ("EnableDebug", DefaultLogger__EnableDebug%V); - ("EnableTimestamps", DefaultLogger__EnableTimestamps%V); - ("Error", DefaultLogger__Error%V); - ("Errorf", DefaultLogger__Errorf%V); - ("Fatal", DefaultLogger__Fatal%V); - ("Fatalf", DefaultLogger__Fatalf%V); - ("Fatalln", (λ: "$recvAddr", +Definition DefaultLogger__mset_ptr : list (go_string * val) := [ + ("Debug"%go, DefaultLogger__Debug%V); + ("Debugf"%go, DefaultLogger__Debugf%V); + ("EnableDebug"%go, DefaultLogger__EnableDebug%V); + ("EnableTimestamps"%go, DefaultLogger__EnableTimestamps%V); + ("Error"%go, DefaultLogger__Error%V); + ("Errorf"%go, DefaultLogger__Errorf%V); + ("Fatal"%go, DefaultLogger__Fatal%V); + ("Fatalf"%go, DefaultLogger__Fatalf%V); + ("Fatalln"%go, (λ: "$recvAddr", log.Logger__Fatalln (![ptrT] (struct.field_ref DefaultLogger "Logger" "$recvAddr")) )%V); - ("Flags", (λ: "$recvAddr", + ("Flags"%go, (λ: "$recvAddr", log.Logger__Flags (![ptrT] (struct.field_ref DefaultLogger "Logger" "$recvAddr")) )%V); - ("Info", DefaultLogger__Info%V); - ("Infof", DefaultLogger__Infof%V); - ("Output", (λ: "$recvAddr", + ("Info"%go, DefaultLogger__Info%V); + ("Infof"%go, DefaultLogger__Infof%V); + ("Output"%go, (λ: "$recvAddr", log.Logger__Output (![ptrT] (struct.field_ref DefaultLogger "Logger" "$recvAddr")) )%V); - ("Panic", DefaultLogger__Panic%V); - ("Panicf", DefaultLogger__Panicf%V); - ("Panicln", (λ: "$recvAddr", + ("Panic"%go, DefaultLogger__Panic%V); + ("Panicf"%go, DefaultLogger__Panicf%V); + ("Panicln"%go, (λ: "$recvAddr", log.Logger__Panicln (![ptrT] (struct.field_ref DefaultLogger "Logger" "$recvAddr")) )%V); - ("Prefix", (λ: "$recvAddr", + ("Prefix"%go, (λ: "$recvAddr", log.Logger__Prefix (![ptrT] (struct.field_ref DefaultLogger "Logger" "$recvAddr")) )%V); - ("Print", (λ: "$recvAddr", + ("Print"%go, (λ: "$recvAddr", log.Logger__Print (![ptrT] (struct.field_ref DefaultLogger "Logger" "$recvAddr")) )%V); - ("Printf", (λ: "$recvAddr", + ("Printf"%go, (λ: "$recvAddr", log.Logger__Printf (![ptrT] (struct.field_ref DefaultLogger "Logger" "$recvAddr")) )%V); - ("Println", (λ: "$recvAddr", + ("Println"%go, (λ: "$recvAddr", log.Logger__Println (![ptrT] (struct.field_ref DefaultLogger "Logger" "$recvAddr")) )%V); - ("SetFlags", (λ: "$recvAddr", + ("SetFlags"%go, (λ: "$recvAddr", log.Logger__SetFlags (![ptrT] (struct.field_ref DefaultLogger "Logger" "$recvAddr")) )%V); - ("SetOutput", (λ: "$recvAddr", + ("SetOutput"%go, (λ: "$recvAddr", log.Logger__SetOutput (![ptrT] (struct.field_ref DefaultLogger "Logger" "$recvAddr")) )%V); - ("SetPrefix", (λ: "$recvAddr", + ("SetPrefix"%go, (λ: "$recvAddr", log.Logger__SetPrefix (![ptrT] (struct.field_ref DefaultLogger "Logger" "$recvAddr")) )%V); - ("Warning", DefaultLogger__Warning%V); - ("Warningf", DefaultLogger__Warningf%V); - ("Writer", (λ: "$recvAddr", + ("Warning"%go, DefaultLogger__Warning%V); + ("Warningf"%go, DefaultLogger__Warningf%V); + ("Writer"%go, (λ: "$recvAddr", log.Logger__Writer (![ptrT] (struct.field_ref DefaultLogger "Logger" "$recvAddr")) )%V) ]. @@ -2574,67 +2574,67 @@ Definition getLogger : val := )));;; return: (![Logger] (globals.get raftLogger #()))). -Definition discardLogger : (string * string) := (pkg_name', "discardLogger"). +Definition discardLogger : (go_string * go_string) := (pkg_name', "discardLogger"%go). -Definition DefaultLogger__mset : list (string * val) := [ - ("Fatalln", (λ: "$recv", +Definition DefaultLogger__mset : list (go_string * val) := [ + ("Fatalln"%go, (λ: "$recv", log.Logger__Fatalln (struct.field_get DefaultLogger "Logger" "$recv") )%V); - ("Flags", (λ: "$recv", + ("Flags"%go, (λ: "$recv", log.Logger__Flags (struct.field_get DefaultLogger "Logger" "$recv") )%V); - ("Output", (λ: "$recv", + ("Output"%go, (λ: "$recv", log.Logger__Output (struct.field_get DefaultLogger "Logger" "$recv") )%V); - ("Panicln", (λ: "$recv", + ("Panicln"%go, (λ: "$recv", log.Logger__Panicln (struct.field_get DefaultLogger "Logger" "$recv") )%V); - ("Prefix", (λ: "$recv", + ("Prefix"%go, (λ: "$recv", log.Logger__Prefix (struct.field_get DefaultLogger "Logger" "$recv") )%V); - ("Print", (λ: "$recv", + ("Print"%go, (λ: "$recv", log.Logger__Print (struct.field_get DefaultLogger "Logger" "$recv") )%V); - ("Printf", (λ: "$recv", + ("Printf"%go, (λ: "$recv", log.Logger__Printf (struct.field_get DefaultLogger "Logger" "$recv") )%V); - ("Println", (λ: "$recv", + ("Println"%go, (λ: "$recv", log.Logger__Println (struct.field_get DefaultLogger "Logger" "$recv") )%V); - ("SetFlags", (λ: "$recv", + ("SetFlags"%go, (λ: "$recv", log.Logger__SetFlags (struct.field_get DefaultLogger "Logger" "$recv") )%V); - ("SetOutput", (λ: "$recv", + ("SetOutput"%go, (λ: "$recv", log.Logger__SetOutput (struct.field_get DefaultLogger "Logger" "$recv") )%V); - ("SetPrefix", (λ: "$recv", + ("SetPrefix"%go, (λ: "$recv", log.Logger__SetPrefix (struct.field_get DefaultLogger "Logger" "$recv") )%V); - ("Writer", (λ: "$recv", + ("Writer"%go, (λ: "$recv", log.Logger__Writer (struct.field_get DefaultLogger "Logger" "$recv") )%V) ]. Definition SnapshotStatus : go_type := intT. -Definition SnapshotStatus__mset : list (string * val) := [ +Definition SnapshotStatus__mset : list (go_string * val) := [ ]. -Definition SnapshotStatus__mset_ptr : list (string * val) := [ +Definition SnapshotStatus__mset_ptr : list (go_string * val) := [ ]. Definition SnapshotFinish : expr := #(W64 1). Definition SnapshotFailure : expr := #(W64 2). -Definition ErrStopped : (string * string) := (pkg_name', "ErrStopped"). +Definition ErrStopped : (go_string * go_string) := (pkg_name', "ErrStopped"%go). Definition SoftState : go_type := structT [ "Lead" :: uint64T; "RaftState" :: StateType ]. -Definition SoftState__mset : list (string * val) := [ +Definition SoftState__mset : list (go_string * val) := [ ]. (* go: node.go:45:21 *) @@ -2644,8 +2644,8 @@ Definition SoftState__equal : val := let: "b" := (ref_ty ptrT "b") in return: (((![uint64T] (struct.field_ref SoftState "Lead" (![ptrT] "a"))) = (![uint64T] (struct.field_ref SoftState "Lead" (![ptrT] "b")))) && ((![StateType] (struct.field_ref SoftState "RaftState" (![ptrT] "a"))) = (![StateType] (struct.field_ref SoftState "RaftState" (![ptrT] "b")))))). -Definition SoftState__mset_ptr : list (string * val) := [ - ("equal", SoftState__equal%V) +Definition SoftState__mset_ptr : list (go_string * val) := [ + ("equal"%go, SoftState__equal%V) ]. Definition Ready : go_type := structT [ @@ -2659,50 +2659,50 @@ Definition Ready : go_type := structT [ "MustSync" :: boolT ]. -Definition Ready__mset : list (string * val) := [ +Definition Ready__mset : list (go_string * val) := [ ]. -Definition Ready__mset_ptr : list (string * val) := [ - ("Descriptor", (λ: "$recvAddr", +Definition Ready__mset_ptr : list (go_string * val) := [ + ("Descriptor"%go, (λ: "$recvAddr", raftpb.HardState__Descriptor (struct.field_ref Ready "HardState" "$recvAddr") )%V); - ("Marshal", (λ: "$recvAddr", + ("Marshal"%go, (λ: "$recvAddr", raftpb.HardState__Marshal (struct.field_ref Ready "HardState" "$recvAddr") )%V); - ("MarshalTo", (λ: "$recvAddr", + ("MarshalTo"%go, (λ: "$recvAddr", raftpb.HardState__MarshalTo (struct.field_ref Ready "HardState" "$recvAddr") )%V); - ("MarshalToSizedBuffer", (λ: "$recvAddr", + ("MarshalToSizedBuffer"%go, (λ: "$recvAddr", raftpb.HardState__MarshalToSizedBuffer (struct.field_ref Ready "HardState" "$recvAddr") )%V); - ("ProtoMessage", (λ: "$recvAddr", + ("ProtoMessage"%go, (λ: "$recvAddr", raftpb.HardState__ProtoMessage (struct.field_ref Ready "HardState" "$recvAddr") )%V); - ("Reset", (λ: "$recvAddr", + ("Reset"%go, (λ: "$recvAddr", raftpb.HardState__Reset (struct.field_ref Ready "HardState" "$recvAddr") )%V); - ("Size", (λ: "$recvAddr", + ("Size"%go, (λ: "$recvAddr", raftpb.HardState__Size (struct.field_ref Ready "HardState" "$recvAddr") )%V); - ("String", (λ: "$recvAddr", + ("String"%go, (λ: "$recvAddr", raftpb.HardState__String (struct.field_ref Ready "HardState" "$recvAddr") )%V); - ("Unmarshal", (λ: "$recvAddr", + ("Unmarshal"%go, (λ: "$recvAddr", raftpb.HardState__Unmarshal (struct.field_ref Ready "HardState" "$recvAddr") )%V); - ("XXX_DiscardUnknown", (λ: "$recvAddr", + ("XXX_DiscardUnknown"%go, (λ: "$recvAddr", raftpb.HardState__XXX_DiscardUnknown (struct.field_ref Ready "HardState" "$recvAddr") )%V); - ("XXX_Marshal", (λ: "$recvAddr", + ("XXX_Marshal"%go, (λ: "$recvAddr", raftpb.HardState__XXX_Marshal (struct.field_ref Ready "HardState" "$recvAddr") )%V); - ("XXX_Merge", (λ: "$recvAddr", + ("XXX_Merge"%go, (λ: "$recvAddr", raftpb.HardState__XXX_Merge (struct.field_ref Ready "HardState" "$recvAddr") )%V); - ("XXX_Size", (λ: "$recvAddr", + ("XXX_Size"%go, (λ: "$recvAddr", raftpb.HardState__XXX_Size (struct.field_ref Ready "HardState" "$recvAddr") )%V); - ("XXX_Unmarshal", (λ: "$recvAddr", + ("XXX_Unmarshal"%go, (λ: "$recvAddr", raftpb.HardState__XXX_Unmarshal (struct.field_ref Ready "HardState" "$recvAddr") )%V) ]. @@ -2726,10 +2726,10 @@ Definition IsEmptyHardState : val := Definition Node : go_type := interfaceT. -Definition Peer__mset : list (string * val) := [ +Definition Peer__mset : list (go_string * val) := [ ]. -Definition Peer__mset_ptr : list (string * val) := [ +Definition Peer__mset_ptr : list (go_string * val) := [ ]. Definition msgWithResult : go_type := structT [ @@ -2855,7 +2855,7 @@ Definition raft__loadState : val := let: "state" := (ref_ty raftpb.HardState "state") in (if: ((![uint64T] (struct.field_ref raftpb.HardState "Commit" "state")) < (![uint64T] (struct.field_ref raftLog "committed" (![ptrT] (struct.field_ref raft "raftLog" (![ptrT] "r")))))) || ((![uint64T] (struct.field_ref raftpb.HardState "Commit" "state")) > ((raftLog__lastIndex (![ptrT] (struct.field_ref raft "raftLog" (![ptrT] "r")))) #())) then - do: (let: "$a0" := #"%x state.commit %d is out of range [%d, %d]" in + do: (let: "$a0" := #"%x state.commit %d is out of range [%d, %d]"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref raftpb.HardState "Commit" "state"))) in let: "$sl2" := (interface.make uint64__mset (![uint64T] (struct.field_ref raftLog "committed" (![ptrT] (struct.field_ref raft "raftLog" (![ptrT] "r")))))) in @@ -2906,7 +2906,7 @@ Definition voteRespMsgType : val := (if: "$sw" = raftpb.MsgPreVote then return: (raftpb.MsgPreVoteResp) else - do: (let: "$a0" := (interface.make string__mset (let: "$a0" := #"not a vote message: %s" in + do: (let: "$a0" := (interface.make string__mset (let: "$a0" := #"not a vote message: %s"%go in let: "$a1" := ((let: "$sl0" := (interface.make raftpb.MessageType__mset (![raftpb.MessageType] "msgt")) in slice.literal interfaceT ["$sl0"])) in fmt.Sprintf "$a0" "$a1")) in @@ -3025,13 +3025,13 @@ Definition raft__appliedTo : val := do: ("err" <-[error] "$r0");;; (if: (![error] "err") ≠ #interface.nil then - do: (let: "$a0" := #"not initiating automatic transition out of joint configuration %s: %v" in + do: (let: "$a0" := #"not initiating automatic transition out of joint configuration %s: %v"%go in let: "$a1" := ((let: "$sl0" := (interface.make tracker.Config__mset (![tracker.Config] (struct.field_ref tracker.ProgressTracker "Config" (struct.field_ref raft "trk" (![ptrT] "r"))))) in let: "$sl1" := (![error] "err") in slice.literal interfaceT ["$sl0"; "$sl1"])) in (interface.get "Debugf" (![Logger] (struct.field_ref raft "logger" (![ptrT] "r")))) "$a0" "$a1") else - do: (let: "$a0" := #"initiating automatic transition out of joint configuration %s" in + do: (let: "$a0" := #"initiating automatic transition out of joint configuration %s"%go in let: "$a1" := ((let: "$sl0" := (interface.make tracker.Config__mset (![tracker.Config] (struct.field_ref tracker.ProgressTracker "Config" (struct.field_ref raft "trk" (![ptrT] "r"))))) in slice.literal interfaceT ["$sl0"])) in (interface.get "Infof" (![Logger] (struct.field_ref raft "logger" (![ptrT] "r")))) "$a0" "$a1"))) @@ -3053,7 +3053,7 @@ Definition raft__appliedSnap : val := Definition CampaignType : go_type := stringT. -Definition campaignTransfer : expr := #"CampaignTransfer". +Definition campaignTransfer : expr := #"CampaignTransfer"%go. (* go: state_trace_nop.go:40:6 *) Definition traceBecomeCandidate : val := @@ -3063,7 +3063,7 @@ Definition traceBecomeCandidate : val := Definition StateCandidate : expr := #(W64 1). -Definition stepCandidateGlobal : (string * string) := (pkg_name', "stepCandidateGlobal"). +Definition stepCandidateGlobal : (go_string * go_string) := (pkg_name', "stepCandidateGlobal"%go). (* go: raft.go:920:16 *) Definition raft__becomeCandidate : val := @@ -3071,7 +3071,7 @@ Definition raft__becomeCandidate : val := exception_do (let: "r" := (ref_ty ptrT "r") in (if: (![StateType] (struct.field_ref raft "state" (![ptrT] "r"))) = StateLeader then - do: (let: "$a0" := (interface.make string__mset #"invalid transition [leader -> candidate]") in + do: (let: "$a0" := (interface.make string__mset #"invalid transition [leader -> candidate]"%go) in Panic "$a0") else do: #());;; let: "$r0" := (![funcT] (globals.get stepCandidateGlobal #())) in @@ -3084,7 +3084,7 @@ Definition raft__becomeCandidate : val := do: ((struct.field_ref raft "Vote" (![ptrT] "r")) <-[uint64T] "$r0");;; let: "$r0" := StateCandidate in do: ((struct.field_ref raft "state" (![ptrT] "r")) <-[StateType] "$r0");;; - do: (let: "$a0" := #"%x became candidate at term %d" in + do: (let: "$a0" := #"%x became candidate at term %d"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "Term" (![ptrT] "r")))) in slice.literal interfaceT ["$sl0"; "$sl1"])) in @@ -3092,7 +3092,7 @@ Definition raft__becomeCandidate : val := do: (let: "$a0" := (![ptrT] "r") in traceBecomeCandidate "$a0")). -Definition campaignPreElection : expr := #"CampaignPreElection". +Definition campaignPreElection : expr := #"CampaignPreElection"%go. Definition StatePreCandidate : expr := #(W64 3). @@ -3102,7 +3102,7 @@ Definition raft__becomePreCandidate : val := exception_do (let: "r" := (ref_ty ptrT "r") in (if: (![StateType] (struct.field_ref raft "state" (![ptrT] "r"))) = StateLeader then - do: (let: "$a0" := (interface.make string__mset #"invalid transition [leader -> pre-candidate]") in + do: (let: "$a0" := (interface.make string__mset #"invalid transition [leader -> pre-candidate]"%go) in Panic "$a0") else do: #());;; let: "$r0" := (![funcT] (globals.get stepCandidateGlobal #())) in @@ -3114,7 +3114,7 @@ Definition raft__becomePreCandidate : val := do: ((struct.field_ref raft "lead" (![ptrT] "r")) <-[uint64T] "$r0");;; let: "$r0" := StatePreCandidate in do: ((struct.field_ref raft "state" (![ptrT] "r")) <-[StateType] "$r0");;; - do: (let: "$a0" := #"%x became pre-candidate at term %d" in + do: (let: "$a0" := #"%x became pre-candidate at term %d"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "Term" (![ptrT] "r")))) in slice.literal interfaceT ["$sl0"; "$sl1"])) in @@ -3142,7 +3142,7 @@ Definition raft__campaign : val := let: "t" := (ref_ty CampaignType "t") in (if: (~ ((raft__promotable (![ptrT] "r")) #())) then - do: (let: "$a0" := #"%x is unpromotable; campaign() should have been called" in + do: (let: "$a0" := #"%x is unpromotable; campaign() should have been called"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in slice.literal interfaceT ["$sl0"])) in (interface.get "Warningf" (![Logger] (struct.field_ref raft "logger" (![ptrT] "r")))) "$a0" "$a1") @@ -3218,7 +3218,7 @@ Definition raft__campaign : val := let: "last" := (ref_ty entryID (zero_val entryID)) in let: "$r0" := ((raftLog__lastEntryID (![ptrT] (struct.field_ref raft "raftLog" (![ptrT] "r")))) #()) in do: ("last" <-[entryID] "$r0");;; - do: (let: "$a0" := #"%x [logterm: %d, index: %d] sent %s request to %x at term %d" in + do: (let: "$a0" := #"%x [logterm: %d, index: %d] sent %s request to %x at term %d"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref entryID "term" "last"))) in let: "$sl2" := (interface.make uint64__mset (![uint64T] (struct.field_ref entryID "index" "last"))) in @@ -3257,7 +3257,7 @@ Definition raft__campaign : val := }]) in (raft__send (![ptrT] "r")) "$a0")))). -Definition errBreak : (string * string) := (pkg_name', "errBreak"). +Definition errBreak : (go_string * go_string) := (pkg_name', "errBreak"%go). (* go: raft.go:1013:16 *) Definition raft__hasUnappliedConfChanges : val := @@ -3299,7 +3299,7 @@ Definition raft__hasUnappliedConfChanges : val := do: ("err" <-[error] "$r0");;; (if: ((![error] "err") ≠ #interface.nil) && ((![error] "err") ≠ (![error] (globals.get errBreak #()))) then - do: (let: "$a0" := #"error scanning unapplied entries [%d, %d): %v" in + do: (let: "$a0" := #"error scanning unapplied entries [%d, %d): %v"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] "lo")) in let: "$sl1" := (interface.make uint64__mset (![uint64T] "hi")) in let: "$sl2" := (![error] "err") in @@ -3315,7 +3315,7 @@ Definition raft__hup : val := let: "t" := (ref_ty CampaignType "t") in (if: (![StateType] (struct.field_ref raft "state" (![ptrT] "r"))) = StateLeader then - do: (let: "$a0" := #"%x ignoring MsgHup because already leader" in + do: (let: "$a0" := #"%x ignoring MsgHup because already leader"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in slice.literal interfaceT ["$sl0"])) in (interface.get "Debugf" (![Logger] (struct.field_ref raft "logger" (![ptrT] "r")))) "$a0" "$a1");;; @@ -3323,7 +3323,7 @@ Definition raft__hup : val := else do: #());;; (if: (~ ((raft__promotable (![ptrT] "r")) #())) then - do: (let: "$a0" := #"%x is unpromotable and can not campaign" in + do: (let: "$a0" := #"%x is unpromotable and can not campaign"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in slice.literal interfaceT ["$sl0"])) in (interface.get "Warningf" (![Logger] (struct.field_ref raft "logger" (![ptrT] "r")))) "$a0" "$a1");;; @@ -3331,14 +3331,14 @@ Definition raft__hup : val := else do: #());;; (if: (raft__hasUnappliedConfChanges (![ptrT] "r")) #() then - do: (let: "$a0" := #"%x cannot campaign at term %d since there are still pending configuration changes to apply" in + do: (let: "$a0" := #"%x cannot campaign at term %d since there are still pending configuration changes to apply"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "Term" (![ptrT] "r")))) in slice.literal interfaceT ["$sl0"; "$sl1"])) in (interface.get "Warningf" (![Logger] (struct.field_ref raft "logger" (![ptrT] "r")))) "$a0" "$a1");;; return: (#()) else do: #());;; - do: (let: "$a0" := #"%x is starting a new election at term %d" in + do: (let: "$a0" := #"%x is starting a new election at term %d"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "Term" (![ptrT] "r")))) in slice.literal interfaceT ["$sl0"; "$sl1"])) in @@ -3346,7 +3346,7 @@ Definition raft__hup : val := do: (let: "$a0" := (![CampaignType] "t") in (raft__campaign (![ptrT] "r")) "$a0")). -Definition campaignElection : expr := #"CampaignElection". +Definition campaignElection : expr := #"CampaignElection"%go. (* go: state_trace_nop.go:50:6 *) Definition traceReceiveMessage : val := @@ -3384,7 +3384,7 @@ Definition raft__Step : val := let: "last" := (ref_ty entryID (zero_val entryID)) in let: "$r0" := ((raftLog__lastEntryID (![ptrT] (struct.field_ref raft "raftLog" (![ptrT] "r")))) #()) in do: ("last" <-[entryID] "$r0");;; - do: (let: "$a0" := #"%x [logterm: %d, index: %d, vote: %x] ignored %s from %x [logterm: %d, index: %d] at term %d: lease is not expired (remaining ticks: %d)" in + do: (let: "$a0" := #"%x [logterm: %d, index: %d, vote: %x] ignored %s from %x [logterm: %d, index: %d] at term %d: lease is not expired (remaining ticks: %d)"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref entryID "term" "last"))) in let: "$sl2" := (interface.make uint64__mset (![uint64T] (struct.field_ref entryID "index" "last"))) in @@ -3407,7 +3407,7 @@ Definition raft__Step : val := (if: "$sw" = (((![raftpb.MessageType] (struct.field_ref raftpb.Message "Type" "m")) = raftpb.MsgPreVoteResp) && (~ (![boolT] (struct.field_ref raftpb.Message "Reject" "m")))) then do: #() else - do: (let: "$a0" := #"%x [term: %d] received a %s message with higher term from %x [term: %d]" in + do: (let: "$a0" := #"%x [term: %d] received a %s message with higher term from %x [term: %d]"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "Term" (![ptrT] "r")))) in let: "$sl2" := (interface.make raftpb.MessageType__mset (![raftpb.MessageType] (struct.field_ref raftpb.Message "Type" "m"))) in @@ -3454,7 +3454,7 @@ Definition raft__Step : val := let: "last" := (ref_ty entryID (zero_val entryID)) in let: "$r0" := ((raftLog__lastEntryID (![ptrT] (struct.field_ref raft "raftLog" (![ptrT] "r")))) #()) in do: ("last" <-[entryID] "$r0");;; - do: (let: "$a0" := #"%x [logterm: %d, index: %d, vote: %x] rejected %s from %x [logterm: %d, index: %d] at term %d" in + do: (let: "$a0" := #"%x [logterm: %d, index: %d, vote: %x] rejected %s from %x [logterm: %d, index: %d] at term %d"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref entryID "term" "last"))) in let: "$sl2" := (interface.make uint64__mset (![uint64T] (struct.field_ref entryID "index" "last"))) in @@ -3492,7 +3492,7 @@ Definition raft__Step : val := then (if: (![uint64T] (struct.field_ref raftpb.Message "Index" "m")) ≠ #(W64 0) then - do: (let: "$a0" := #"%x [term: %d] ignored entry appends from a %s message with lower term [term: %d]" in + do: (let: "$a0" := #"%x [term: %d] ignored entry appends from a %s message with lower term [term: %d]"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "Term" (![ptrT] "r")))) in let: "$sl2" := (interface.make raftpb.MessageType__mset (![raftpb.MessageType] (struct.field_ref raftpb.Message "Type" "m"))) in @@ -3506,7 +3506,7 @@ Definition raft__Step : val := (raft__appliedSnap (![ptrT] "r")) "$a0") else do: #()) else - do: (let: "$a0" := #"%x [term: %d] ignored a %s message with lower term from %x [term: %d]" in + do: (let: "$a0" := #"%x [term: %d] ignored a %s message with lower term from %x [term: %d]"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "Term" (![ptrT] "r")))) in let: "$sl2" := (interface.make raftpb.MessageType__mset (![raftpb.MessageType] (struct.field_ref raftpb.Message "Type" "m"))) in @@ -3582,7 +3582,7 @@ Definition raft__Step : val := (if: (![boolT] "canVote") && (let: "$a0" := (![entryID] "candLastID") in (raftLog__isUpToDate (![ptrT] (struct.field_ref raft "raftLog" (![ptrT] "r")))) "$a0") then - do: (let: "$a0" := #"%x [logterm: %d, index: %d, vote: %x] cast %s for %x [logterm: %d, index: %d] at term %d" in + do: (let: "$a0" := #"%x [logterm: %d, index: %d, vote: %x] cast %s for %x [logterm: %d, index: %d] at term %d"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref entryID "term" "lastID"))) in let: "$sl2" := (interface.make uint64__mset (![uint64T] (struct.field_ref entryID "index" "lastID"))) in @@ -3623,7 +3623,7 @@ Definition raft__Step : val := do: ((struct.field_ref raft "Vote" (![ptrT] "r")) <-[uint64T] "$r0") else do: #()) else - do: (let: "$a0" := #"%x [logterm: %d, index: %d, vote: %x] rejected %s from %x [logterm: %d, index: %d] at term %d" in + do: (let: "$a0" := #"%x [logterm: %d, index: %d, vote: %x] rejected %s from %x [logterm: %d, index: %d] at term %d"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref entryID "term" "lastID"))) in let: "$sl2" := (interface.make uint64__mset (![uint64T] (struct.field_ref entryID "index" "lastID"))) in @@ -3686,28 +3686,28 @@ Definition Config__validate : val := exception_do (let: "c" := (ref_ty ptrT "c") in (if: (![uint64T] (struct.field_ref Config "ID" (![ptrT] "c"))) = None then - return: (let: "$a0" := #"cannot use none as id" in + return: (let: "$a0" := #"cannot use none as id"%go in errors.New "$a0") else do: #());;; (if: let: "$a0" := (![uint64T] (struct.field_ref Config "ID" (![ptrT] "c"))) in IsLocalMsgTarget "$a0" then - return: (let: "$a0" := #"cannot use local target as id" in + return: (let: "$a0" := #"cannot use local target as id"%go in errors.New "$a0") else do: #());;; (if: int_leq (![intT] (struct.field_ref Config "HeartbeatTick" (![ptrT] "c"))) #(W64 0) then - return: (let: "$a0" := #"heartbeat tick must be greater than 0" in + return: (let: "$a0" := #"heartbeat tick must be greater than 0"%go in errors.New "$a0") else do: #());;; (if: int_leq (![intT] (struct.field_ref Config "ElectionTick" (![ptrT] "c"))) (![intT] (struct.field_ref Config "HeartbeatTick" (![ptrT] "c"))) then - return: (let: "$a0" := #"election tick must be greater than heartbeat tick" in + return: (let: "$a0" := #"election tick must be greater than heartbeat tick"%go in errors.New "$a0") else do: #());;; (if: (![Storage] (struct.field_ref Config "Storage" (![ptrT] "c"))) = #interface.nil then - return: (let: "$a0" := #"storage cannot be nil" in + return: (let: "$a0" := #"storage cannot be nil"%go in errors.New "$a0") else do: #());;; (if: (![uint64T] (struct.field_ref Config "MaxUncommittedEntriesSize" (![ptrT] "c"))) = #(W64 0) @@ -3722,7 +3722,7 @@ Definition Config__validate : val := else do: #());;; (if: int_leq (![intT] (struct.field_ref Config "MaxInflightMsgs" (![ptrT] "c"))) #(W64 0) then - return: (let: "$a0" := #"max inflight messages must be greater than 0" in + return: (let: "$a0" := #"max inflight messages must be greater than 0"%go in errors.New "$a0") else do: #());;; (if: (![uint64T] (struct.field_ref Config "MaxInflightBytes" (![ptrT] "c"))) = #(W64 0) @@ -3732,7 +3732,7 @@ Definition Config__validate : val := else (if: (![uint64T] (struct.field_ref Config "MaxInflightBytes" (![ptrT] "c"))) < (![uint64T] (struct.field_ref Config "MaxSizePerMsg" (![ptrT] "c"))) then - return: (let: "$a0" := #"max inflight bytes must be >= max message size" in + return: (let: "$a0" := #"max inflight bytes must be >= max message size"%go in errors.New "$a0") else do: #()));;; (if: (![Logger] (struct.field_ref Config "Logger" (![ptrT] "c"))) = #interface.nil @@ -3742,7 +3742,7 @@ Definition Config__validate : val := else do: #());;; (if: ((![ReadOnlyOption] (struct.field_ref Config "ReadOnlyOption" (![ptrT] "c"))) = ReadOnlyLeaseBased) && (~ (![boolT] (struct.field_ref Config "CheckQuorum" (![ptrT] "c")))) then - return: (let: "$a0" := #"CheckQuorum must be enabled when ReadOnlyOption is ReadOnlyLeaseBased" in + return: (let: "$a0" := #"CheckQuorum must be enabled when ReadOnlyOption is ReadOnlyLeaseBased"%go in errors.New "$a0") else do: #());;; return: (#interface.nil)). @@ -3891,17 +3891,17 @@ Definition newRaft : val := slice.for_range uint64T "$range" (λ: <> "n", let: "n" := ref_ty uint64T "n" in let: "$r0" := (let: "$a0" := (![sliceT] "nodesStrs") in - let: "$a1" := ((let: "$sl0" := (let: "$a0" := #"%x" in + let: "$a1" := ((let: "$sl0" := (let: "$a0" := #"%x"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] "n")) in slice.literal interfaceT ["$sl0"])) in fmt.Sprintf "$a0" "$a1") in slice.literal stringT ["$sl0"])) in (slice.append sliceT) "$a0" "$a1") in do: ("nodesStrs" <-[sliceT] "$r0")));;; - do: (let: "$a0" := #"newRaft %x [peers: [%s], term: %d, commit: %d, applied: %d, lastindex: %d, lastterm: %d]" in + do: (let: "$a0" := #"newRaft %x [peers: [%s], term: %d, commit: %d, applied: %d, lastindex: %d, lastterm: %d]"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make string__mset (let: "$a0" := (![sliceT] "nodesStrs") in - let: "$a1" := #"," in + let: "$a1" := #","%go in strings.Join "$a0" "$a1")) in let: "$sl2" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "Term" (![ptrT] "r")))) in let: "$sl3" := (interface.make uint64__mset (![uint64T] (struct.field_ref raftLog "committed" (![ptrT] (struct.field_ref raft "raftLog" (![ptrT] "r")))))) in @@ -3957,7 +3957,7 @@ Definition setupNode : val := (if: (let: "$a0" := (![sliceT] "peers") in slice.len "$a0") = #(W64 0) then - do: (let: "$a0" := (interface.make string__mset #"no peers given; use RestartNode instead") in + do: (let: "$a0" := (interface.make string__mset #"no peers given; use RestartNode instead"%go) in Panic "$a0") else do: #());;; let: "err" := (ref_ty error (zero_val error)) in @@ -3978,7 +3978,7 @@ Definition setupNode : val := do: ("err" <-[error] "$r0");;; (if: (![error] "err") ≠ #interface.nil then - do: (let: "$a0" := #"error occurred during starting a new node: %v" in + do: (let: "$a0" := #"error occurred during starting a new node: %v"%go in let: "$a1" := ((let: "$sl0" := (![error] "err") in slice.literal interfaceT ["$sl0"])) in (interface.get "Warningf" (![Logger] (struct.field_ref Config "Logger" (![ptrT] "c")))) "$a0" "$a1") @@ -4194,7 +4194,7 @@ Definition isMsgInArray : val := return: ((int_lt (![intT] "i") (let: "$a0" := (![sliceT] "arr") in slice.len "$a0")) && (![boolT] (slice.elem_ref boolT (![sliceT] "arr") (![intT] "i"))))). -Definition isLocalMsg : (string * string) := (pkg_name', "isLocalMsg"). +Definition isLocalMsg : (go_string * go_string) := (pkg_name', "isLocalMsg"%go). (* go: util.go:57:6 *) Definition IsLocalMsg : val := @@ -4348,7 +4348,7 @@ Definition node__Tick : val := ))] [("$recvChan0", (λ: "$recvVal", do: #() ))] (InjR (λ: <>, - do: (let: "$a0" := #"%x A tick missed to fire. Node blocks too long!" in + do: (let: "$a0" := #"%x A tick missed to fire. Node blocks too long!"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] (struct.field_ref RawNode "raft" (![ptrT] (struct.field_ref node "rn" (![ptrT] "n")))))))) in slice.literal interfaceT ["$sl0"])) in (interface.get "Warningf" (![Logger] (struct.field_ref raft "logger" (![ptrT] (struct.field_ref RawNode "raft" (![ptrT] (struct.field_ref node "rn" (![ptrT] "n")))))))) "$a0" "$a1") @@ -4369,7 +4369,7 @@ Definition node__TransferLeadership : val := do: #() ))] (InjLV #()))). -Definition isResponseMsg : (string * string) := (pkg_name', "isResponseMsg"). +Definition isResponseMsg : (go_string * go_string) := (pkg_name', "isResponseMsg"%go). (* go: util.go:61:6 *) Definition IsResponseMsg : val := @@ -4419,7 +4419,7 @@ Definition raft__tickHeartbeat : val := do: ("err" <-[error] "$r0");;; (if: (![error] "err") ≠ #interface.nil then - do: (let: "$a0" := #"error occurred during checking sending heartbeat: %v" in + do: (let: "$a0" := #"error occurred during checking sending heartbeat: %v"%go in let: "$a1" := ((let: "$sl0" := (![error] "err") in slice.literal interfaceT ["$sl0"])) in (interface.get "Debugf" (![Logger] (struct.field_ref raft "logger" (![ptrT] "r")))) "$a0" "$a1") @@ -4459,7 +4459,7 @@ Definition raft__tickHeartbeat : val := do: ("err" <-[error] "$r0");;; (if: (![error] "err") ≠ #interface.nil then - do: (let: "$a0" := #"error occurred during checking sending heartbeat: %v" in + do: (let: "$a0" := #"error occurred during checking sending heartbeat: %v"%go in let: "$a1" := ((let: "$sl0" := (![error] "err") in slice.literal interfaceT ["$sl0"])) in (interface.get "Debugf" (![Logger] (struct.field_ref raft "logger" (![ptrT] "r")))) "$a0" "$a1") @@ -4510,7 +4510,7 @@ Definition raft__tickElection : val := do: ("err" <-[error] "$r0");;; (if: (![error] "err") ≠ #interface.nil then - do: (let: "$a0" := #"error occurred during election: %v" in + do: (let: "$a0" := #"error occurred during election: %v"%go in let: "$a1" := ((let: "$sl0" := (![error] "err") in slice.literal interfaceT ["$sl0"])) in (interface.get "Debugf" (![Logger] (struct.field_ref raft "logger" (![ptrT] "r")))) "$a0" "$a1") @@ -4690,7 +4690,7 @@ Definition RawNode__acceptReady : val := (if: (let: "$a0" := (![sliceT] (struct.field_ref RawNode "stepsOnAdvance" (![ptrT] "rn"))) in slice.len "$a0") ≠ #(W64 0) then - do: (let: "$a0" := #"two accepted Ready structs without call to Advance" in + do: (let: "$a0" := #"two accepted Ready structs without call to Advance"%go in let: "$a1" := #slice.nil in (interface.get "Panicf" (![Logger] (struct.field_ref raft "logger" (![ptrT] (struct.field_ref RawNode "raft" (![ptrT] "rn")))))) "$a0" "$a1") else do: #());;; @@ -4772,7 +4772,7 @@ Definition RawNode__Advance : val := let: <> := (ref_ty Ready "_") in (if: ![boolT] (struct.field_ref RawNode "asyncStorageWrites" (![ptrT] "rn")) then - do: (let: "$a0" := #"Advance must not be called when using AsyncStorageWrites" in + do: (let: "$a0" := #"Advance must not be called when using AsyncStorageWrites"%go in let: "$a1" := #slice.nil in (interface.get "Panicf" (![Logger] (struct.field_ref raft "logger" (![ptrT] (struct.field_ref RawNode "raft" (![ptrT] "rn")))))) "$a0" "$a1") else do: #());;; @@ -5189,14 +5189,14 @@ Definition node__run : val := then (if: (![uint64T] "lead") = None then - do: (let: "$a0" := #"raft.node: %x elected leader %x at term %d" in + do: (let: "$a0" := #"raft.node: %x elected leader %x at term %d"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "lead" (![ptrT] "r")))) in let: "$sl2" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "Term" (![ptrT] "r")))) in slice.literal interfaceT ["$sl0"; "$sl1"; "$sl2"])) in (interface.get "Infof" (![Logger] (struct.field_ref raft "logger" (![ptrT] "r")))) "$a0" "$a1") else - do: (let: "$a0" := #"raft.node: %x changed leader from %x to %x at term %d" in + do: (let: "$a0" := #"raft.node: %x changed leader from %x to %x at term %d"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] "lead")) in let: "$sl2" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "lead" (![ptrT] "r")))) in @@ -5206,7 +5206,7 @@ Definition node__run : val := let: "$r0" := (![chanT msgWithResult] (struct.field_ref node "propc" (![ptrT] "n"))) in do: ("propc" <-[chanT msgWithResult] "$r0") else - do: (let: "$a0" := #"raft.node: %x lost leader %x at term %d" in + do: (let: "$a0" := #"raft.node: %x lost leader %x at term %d"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] "lead")) in let: "$sl2" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "Term" (![ptrT] "r")))) in @@ -5357,26 +5357,26 @@ Definition node__run : val := return: (#()) ))] (InjLV #())))). -Definition node__mset_ptr : list (string * val) := [ - ("Advance", node__Advance%V); - ("ApplyConfChange", node__ApplyConfChange%V); - ("Campaign", node__Campaign%V); - ("ForgetLeader", node__ForgetLeader%V); - ("Propose", node__Propose%V); - ("ProposeConfChange", node__ProposeConfChange%V); - ("ReadIndex", node__ReadIndex%V); - ("Ready", node__Ready%V); - ("ReportSnapshot", node__ReportSnapshot%V); - ("ReportUnreachable", node__ReportUnreachable%V); - ("Status", node__Status%V); - ("Step", node__Step%V); - ("Stop", node__Stop%V); - ("Tick", node__Tick%V); - ("TransferLeadership", node__TransferLeadership%V); - ("run", node__run%V); - ("step", node__step%V); - ("stepWait", node__stepWait%V); - ("stepWithWaitOption", node__stepWithWaitOption%V) +Definition node__mset_ptr : list (go_string * val) := [ + ("Advance"%go, node__Advance%V); + ("ApplyConfChange"%go, node__ApplyConfChange%V); + ("Campaign"%go, node__Campaign%V); + ("ForgetLeader"%go, node__ForgetLeader%V); + ("Propose"%go, node__Propose%V); + ("ProposeConfChange"%go, node__ProposeConfChange%V); + ("ReadIndex"%go, node__ReadIndex%V); + ("Ready"%go, node__Ready%V); + ("ReportSnapshot"%go, node__ReportSnapshot%V); + ("ReportUnreachable"%go, node__ReportUnreachable%V); + ("Status"%go, node__Status%V); + ("Step"%go, node__Step%V); + ("Stop"%go, node__Stop%V); + ("Tick"%go, node__Tick%V); + ("TransferLeadership"%go, node__TransferLeadership%V); + ("run"%go, node__run%V); + ("step"%go, node__step%V); + ("stepWait"%go, node__stepWait%V); + ("stepWithWaitOption"%go, node__stepWithWaitOption%V) ]. (* StartNode returns a new Node given configuration and a list of raft peers. @@ -5428,41 +5428,41 @@ Definition RestartNode : val := do: (Fork ("$go" #()));;; return: (interface.make node__mset_ptr "n")). -Definition msgWithResult__mset : list (string * val) := [ +Definition msgWithResult__mset : list (go_string * val) := [ ]. -Definition msgWithResult__mset_ptr : list (string * val) := [ +Definition msgWithResult__mset_ptr : list (go_string * val) := [ ]. -Definition node__mset : list (string * val) := [ +Definition node__mset : list (go_string * val) := [ ]. Definition numStates : expr := #(W64 4). -Definition ReadOnlyOption__mset : list (string * val) := [ +Definition ReadOnlyOption__mset : list (go_string * val) := [ ]. -Definition ReadOnlyOption__mset_ptr : list (string * val) := [ +Definition ReadOnlyOption__mset_ptr : list (go_string * val) := [ ]. Definition ReadOnlySafe : expr := #(W64 0). -Definition ErrProposalDropped : (string * string) := (pkg_name', "ErrProposalDropped"). +Definition ErrProposalDropped : (go_string * go_string) := (pkg_name', "ErrProposalDropped"%go). -Definition lockedRand__mset : list (string * val) := [ +Definition lockedRand__mset : list (go_string * val) := [ ]. -Definition lockedRand__mset_ptr : list (string * val) := [ - ("Intn", lockedRand__Intn%V) +Definition lockedRand__mset_ptr : list (go_string * val) := [ + ("Intn"%go, lockedRand__Intn%V) ]. -Definition CampaignType__mset : list (string * val) := [ +Definition CampaignType__mset : list (go_string * val) := [ ]. -Definition CampaignType__mset_ptr : list (string * val) := [ +Definition CampaignType__mset_ptr : list (go_string * val) := [ ]. -Definition stmap : (string * string) := (pkg_name', "stmap"). +Definition stmap : (go_string * go_string) := (pkg_name', "stmap"%go). (* go: raft.go:119:21 *) Definition StateType__String : val := @@ -5474,33 +5474,33 @@ Definition StateType__String : val := Definition StateType__MarshalJSON : val := rec: "StateType__MarshalJSON" "st" <> := exception_do (let: "st" := (ref_ty StateType "st") in - return: (string.to_bytes (let: "$a0" := #"%q" in + return: (string.to_bytes (let: "$a0" := #"%q"%go in let: "$a1" := ((let: "$sl0" := (interface.make string__mset ((StateType__String (![StateType] "st")) #())) in slice.literal interfaceT ["$sl0"])) in fmt.Sprintf "$a0" "$a1"), #interface.nil)). -Definition StateType__mset : list (string * val) := [ - ("MarshalJSON", StateType__MarshalJSON%V); - ("String", StateType__String%V) +Definition StateType__mset : list (go_string * val) := [ + ("MarshalJSON"%go, StateType__MarshalJSON%V); + ("String"%go, StateType__String%V) ]. -Definition StateType__mset_ptr : list (string * val) := [ - ("MarshalJSON", (λ: "$recvAddr", +Definition StateType__mset_ptr : list (go_string * val) := [ + ("MarshalJSON"%go, (λ: "$recvAddr", StateType__MarshalJSON (![StateType] "$recvAddr") )%V); - ("String", (λ: "$recvAddr", + ("String"%go, (λ: "$recvAddr", StateType__String (![StateType] "$recvAddr") )%V) ]. -Definition Config__mset : list (string * val) := [ +Definition Config__mset : list (go_string * val) := [ ]. -Definition Config__mset_ptr : list (string * val) := [ - ("validate", Config__validate%V) +Definition Config__mset_ptr : list (go_string * val) := [ + ("validate"%go, Config__validate%V) ]. -Definition raft__mset : list (string * val) := [ +Definition raft__mset : list (go_string * val) := [ ]. (* go: raft2.go:107:16 *) @@ -5605,7 +5605,7 @@ Definition raft__appendEntry : val := (if: (~ (let: "$a0" := (![sliceT] "es") in (raft__increaseUncommittedSize (![ptrT] "r")) "$a0")) then - do: (let: "$a0" := #"%x appending new entries to log would exceed uncommitted entry size limit; dropping proposal" in + do: (let: "$a0" := #"%x appending new entries to log would exceed uncommitted entry size limit; dropping proposal"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in slice.literal interfaceT ["$sl0"])) in (interface.get "Warningf" (![Logger] (struct.field_ref raft "logger" (![ptrT] "r")))) "$a0" "$a1");;; @@ -5705,7 +5705,7 @@ Definition readOnly__lastPendingRequestCtx : val := exception_do (let: "ro" := (ref_ty ptrT "ro") in (if: (let: "$a0" := (![sliceT] (struct.field_ref readOnly "readIndexQueue" (![ptrT] "ro"))) in slice.len "$a0") = #(W64 0) - then return: (#"") + then return: (#""%go) else do: #());;; return: (![stringT] (slice.elem_ref stringT (![sliceT] (struct.field_ref readOnly "readIndexQueue" (![ptrT] "ro"))) ((let: "$a0" := (![sliceT] (struct.field_ref readOnly "readIndexQueue" (![ptrT] "ro"))) in slice.len "$a0") - #(W64 1))))). @@ -5734,7 +5734,7 @@ Definition traceBecomeLeader : val := exception_do (let: "" := (ref_ty ptrT "") in do: #()). -Definition stepLeaderGlobal : (string * string) := (pkg_name', "stepLeaderGlobal"). +Definition stepLeaderGlobal : (go_string * go_string) := (pkg_name', "stepLeaderGlobal"%go). (* go: raft.go:951:16 *) Definition raft__becomeLeader : val := @@ -5742,7 +5742,7 @@ Definition raft__becomeLeader : val := exception_do (let: "r" := (ref_ty ptrT "r") in (if: (![StateType] (struct.field_ref raft "state" (![ptrT] "r"))) = StateFollower then - do: (let: "$a0" := (interface.make string__mset #"invalid transition [follower -> leader]") in + do: (let: "$a0" := (interface.make string__mset #"invalid transition [follower -> leader]"%go) in Panic "$a0") else do: #());;; let: "$r0" := (![funcT] (globals.get stepLeaderGlobal #())) in @@ -5778,11 +5778,11 @@ Definition raft__becomeLeader : val := slice.literal raftpb.Entry ["$sl0"])) in (raft__appendEntry (![ptrT] "r")) "$a0")) then - do: (let: "$a0" := ((let: "$sl0" := (interface.make string__mset #"empty entry was dropped") in + do: (let: "$a0" := ((let: "$sl0" := (interface.make string__mset #"empty entry was dropped"%go) in slice.literal interfaceT ["$sl0"])) in (interface.get "Panic" (![Logger] (struct.field_ref raft "logger" (![ptrT] "r")))) "$a0") else do: #());;; - do: (let: "$a0" := #"%x became leader at term %d" in + do: (let: "$a0" := #"%x became leader at term %d"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "Term" (![ptrT] "r")))) in slice.literal interfaceT ["$sl0"; "$sl1"])) in @@ -5886,7 +5886,7 @@ Definition raft__handleAppendEntries : val := (raft__send (![ptrT] "r")) "$a0");;; return: (#()) else do: #()));;; - do: (let: "$a0" := #"%x [logterm: %d, index: %d] rejected MsgApp [logterm: %d, index: %d] from %x" in + do: (let: "$a0" := #"%x [logterm: %d, index: %d] rejected MsgApp [logterm: %d, index: %d] from %x"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make uint64__mset (let: ("$ret0", "$ret1") := ((let: "$a0" := (![uint64T] (struct.field_ref raftpb.Message "Index" "m")) in (raftLog__term (![ptrT] (struct.field_ref raft "raftLog" (![ptrT] "r")))) "$a0")) in @@ -5978,7 +5978,7 @@ Definition raft__restore : val := else do: #());;; (if: (![StateType] (struct.field_ref raft "state" (![ptrT] "r"))) ≠ StateFollower then - do: (let: "$a0" := #"%x attempted to restore snapshot as leader; should never happen" in + do: (let: "$a0" := #"%x attempted to restore snapshot as leader; should never happen"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in slice.literal interfaceT ["$sl0"])) in (interface.get "Warningf" (![Logger] (struct.field_ref raft "logger" (![ptrT] "r")))) "$a0" "$a1");;; @@ -6013,7 +6013,7 @@ Definition raft__restore : val := else do: #())));;; (if: (~ (![boolT] "found")) then - do: (let: "$a0" := #"%x attempted to restore snapshot but it is not in the ConfState %v; should never happen" in + do: (let: "$a0" := #"%x attempted to restore snapshot but it is not in the ConfState %v; should never happen"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make raftpb.ConfState__mset (![raftpb.ConfState] "cs")) in slice.literal interfaceT ["$sl0"; "$sl1"])) in @@ -6034,7 +6034,7 @@ Definition raft__restore : val := let: "last" := (ref_ty entryID (zero_val entryID)) in let: "$r0" := ((raftLog__lastEntryID (![ptrT] (struct.field_ref raft "raftLog" (![ptrT] "r")))) #()) in do: ("last" <-[entryID] "$r0");;; - do: (let: "$a0" := #"%x [commit: %d, lastindex: %d, lastterm: %d] fast-forwarded commit to snapshot [index: %d, term: %d]" in + do: (let: "$a0" := #"%x [commit: %d, lastindex: %d, lastterm: %d] fast-forwarded commit to snapshot [index: %d, term: %d]"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref raftLog "committed" (![ptrT] (struct.field_ref raft "raftLog" (![ptrT] "r")))))) in let: "$sl2" := (interface.make uint64__mset (![uint64T] (struct.field_ref entryID "index" "last"))) in @@ -6072,7 +6072,7 @@ Definition raft__restore : val := do: ("err" <-[error] "$r2");;; (if: (![error] "err") ≠ #interface.nil then - do: (let: "$a0" := (interface.make string__mset (let: "$a0" := #"unable to restore config %+v: %s" in + do: (let: "$a0" := (interface.make string__mset (let: "$a0" := #"unable to restore config %+v: %s"%go in let: "$a1" := ((let: "$sl0" := (interface.make raftpb.ConfState__mset (![raftpb.ConfState] "cs")) in let: "$sl1" := (![error] "err") in slice.literal interfaceT ["$sl0"; "$sl1"])) in @@ -6088,7 +6088,7 @@ Definition raft__restore : val := let: "last" := (ref_ty entryID (zero_val entryID)) in let: "$r0" := ((raftLog__lastEntryID (![ptrT] (struct.field_ref raft "raftLog" (![ptrT] "r")))) #()) in do: ("last" <-[entryID] "$r0");;; - do: (let: "$a0" := #"%x [commit: %d, lastindex: %d, lastterm: %d] restored snapshot [index: %d, term: %d]" in + do: (let: "$a0" := #"%x [commit: %d, lastindex: %d, lastterm: %d] restored snapshot [index: %d, term: %d]"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref raftLog "committed" (![ptrT] (struct.field_ref raft "raftLog" (![ptrT] "r")))))) in let: "$sl2" := (interface.make uint64__mset (![uint64T] (struct.field_ref entryID "index" "last"))) in @@ -6119,7 +6119,7 @@ Definition raft__handleSnapshot : val := (if: let: "$a0" := (![raftpb.Snapshot] "s") in (raft__restore (![ptrT] "r")) "$a0" then - do: (let: "$a0" := #"%x [commit: %d] restored snapshot [index: %d, term: %d]" in + do: (let: "$a0" := #"%x [commit: %d] restored snapshot [index: %d, term: %d]"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref raftLog "committed" (![ptrT] (struct.field_ref raft "raftLog" (![ptrT] "r")))))) in let: "$sl2" := (interface.make uint64__mset (![uint64T] "sindex")) in @@ -6147,7 +6147,7 @@ Definition raft__handleSnapshot : val := }]) in (raft__send (![ptrT] "r")) "$a0") else - do: (let: "$a0" := #"%x [commit: %d] ignored snapshot [index: %d, term: %d]" in + do: (let: "$a0" := #"%x [commit: %d] ignored snapshot [index: %d, term: %d]"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref raftLog "committed" (![ptrT] (struct.field_ref raft "raftLog" (![ptrT] "r")))))) in let: "$sl2" := (interface.make uint64__mset (![uint64T] "sindex")) in @@ -6186,7 +6186,7 @@ Definition raft__poll : val := let: "id" := (ref_ty uint64T "id") in (if: ![boolT] "v" then - do: (let: "$a0" := #"%x received %s from %x at term %d" in + do: (let: "$a0" := #"%x received %s from %x at term %d"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make raftpb.MessageType__mset (![raftpb.MessageType] "t")) in let: "$sl2" := (interface.make uint64__mset (![uint64T] "id")) in @@ -6194,7 +6194,7 @@ Definition raft__poll : val := slice.literal interfaceT ["$sl0"; "$sl1"; "$sl2"; "$sl3"])) in (interface.get "Infof" (![Logger] (struct.field_ref raft "logger" (![ptrT] "r")))) "$a0" "$a1") else - do: (let: "$a0" := #"%x received %s rejection from %x at term %d" in + do: (let: "$a0" := #"%x received %s rejection from %x at term %d"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make raftpb.MessageType__mset (![raftpb.MessageType] "t")) in let: "$sl2" := (interface.make uint64__mset (![uint64T] "id")) in @@ -6303,63 +6303,63 @@ Definition raft__sendTimeoutNow : val := }]) in (raft__send (![ptrT] "r")) "$a0")). -Definition raft__mset_ptr : list (string * val) := [ - ("Step", raft__Step%V); - ("abortLeaderTransfer", raft__abortLeaderTransfer%V); - ("advanceMessagesAfterAppend", raft__advanceMessagesAfterAppend%V); - ("appendEntry", raft__appendEntry%V); - ("appliedSnap", raft__appliedSnap%V); - ("appliedTo", raft__appliedTo%V); - ("applyConfChange", raft__applyConfChange%V); - ("bcastAppend", raft__bcastAppend%V); - ("bcastHeartbeat", raft__bcastHeartbeat%V); - ("bcastHeartbeatWithCtx", raft__bcastHeartbeatWithCtx%V); - ("becomeCandidate", raft__becomeCandidate%V); - ("becomeFollower", raft__becomeFollower%V); - ("becomeLeader", raft__becomeLeader%V); - ("becomePreCandidate", raft__becomePreCandidate%V); - ("campaign", raft__campaign%V); - ("committedEntryInCurrentTerm", raft__committedEntryInCurrentTerm%V); - ("handleAppendEntries", raft__handleAppendEntries%V); - ("handleHeartbeat", raft__handleHeartbeat%V); - ("handleSnapshot", raft__handleSnapshot%V); - ("hardState", raft__hardState%V); - ("hasLeader", raft__hasLeader%V); - ("hasUnappliedConfChanges", raft__hasUnappliedConfChanges%V); - ("hup", raft__hup%V); - ("increaseUncommittedSize", raft__increaseUncommittedSize%V); - ("loadState", raft__loadState%V); - ("maybeCommit", raft__maybeCommit%V); - ("maybeSendAppend", raft__maybeSendAppend%V); - ("maybeSendSnapshot", raft__maybeSendSnapshot%V); - ("pastElectionTimeout", raft__pastElectionTimeout%V); - ("poll", raft__poll%V); - ("promotable", raft__promotable%V); - ("readMessages", raft__readMessages%V); - ("reduceUncommittedSize", raft__reduceUncommittedSize%V); - ("reset", raft__reset%V); - ("resetRandomizedElectionTimeout", raft__resetRandomizedElectionTimeout%V); - ("responseToReadIndexReq", raft__responseToReadIndexReq%V); - ("restore", raft__restore%V); - ("send", raft__send%V); - ("sendAppend", raft__sendAppend%V); - ("sendHeartbeat", raft__sendHeartbeat%V); - ("sendTimeoutNow", raft__sendTimeoutNow%V); - ("softState", raft__softState%V); - ("stepOrSend", raft__stepOrSend%V); - ("switchToConfig", raft__switchToConfig%V); - ("takeMessagesAfterAppend", raft__takeMessagesAfterAppend%V); - ("tick", raft__tick%V); - ("tickElection", raft__tickElection%V); - ("tickHeartbeat", raft__tickHeartbeat%V) +Definition raft__mset_ptr : list (go_string * val) := [ + ("Step"%go, raft__Step%V); + ("abortLeaderTransfer"%go, raft__abortLeaderTransfer%V); + ("advanceMessagesAfterAppend"%go, raft__advanceMessagesAfterAppend%V); + ("appendEntry"%go, raft__appendEntry%V); + ("appliedSnap"%go, raft__appliedSnap%V); + ("appliedTo"%go, raft__appliedTo%V); + ("applyConfChange"%go, raft__applyConfChange%V); + ("bcastAppend"%go, raft__bcastAppend%V); + ("bcastHeartbeat"%go, raft__bcastHeartbeat%V); + ("bcastHeartbeatWithCtx"%go, raft__bcastHeartbeatWithCtx%V); + ("becomeCandidate"%go, raft__becomeCandidate%V); + ("becomeFollower"%go, raft__becomeFollower%V); + ("becomeLeader"%go, raft__becomeLeader%V); + ("becomePreCandidate"%go, raft__becomePreCandidate%V); + ("campaign"%go, raft__campaign%V); + ("committedEntryInCurrentTerm"%go, raft__committedEntryInCurrentTerm%V); + ("handleAppendEntries"%go, raft__handleAppendEntries%V); + ("handleHeartbeat"%go, raft__handleHeartbeat%V); + ("handleSnapshot"%go, raft__handleSnapshot%V); + ("hardState"%go, raft__hardState%V); + ("hasLeader"%go, raft__hasLeader%V); + ("hasUnappliedConfChanges"%go, raft__hasUnappliedConfChanges%V); + ("hup"%go, raft__hup%V); + ("increaseUncommittedSize"%go, raft__increaseUncommittedSize%V); + ("loadState"%go, raft__loadState%V); + ("maybeCommit"%go, raft__maybeCommit%V); + ("maybeSendAppend"%go, raft__maybeSendAppend%V); + ("maybeSendSnapshot"%go, raft__maybeSendSnapshot%V); + ("pastElectionTimeout"%go, raft__pastElectionTimeout%V); + ("poll"%go, raft__poll%V); + ("promotable"%go, raft__promotable%V); + ("readMessages"%go, raft__readMessages%V); + ("reduceUncommittedSize"%go, raft__reduceUncommittedSize%V); + ("reset"%go, raft__reset%V); + ("resetRandomizedElectionTimeout"%go, raft__resetRandomizedElectionTimeout%V); + ("responseToReadIndexReq"%go, raft__responseToReadIndexReq%V); + ("restore"%go, raft__restore%V); + ("send"%go, raft__send%V); + ("sendAppend"%go, raft__sendAppend%V); + ("sendHeartbeat"%go, raft__sendHeartbeat%V); + ("sendTimeoutNow"%go, raft__sendTimeoutNow%V); + ("softState"%go, raft__softState%V); + ("stepOrSend"%go, raft__stepOrSend%V); + ("switchToConfig"%go, raft__switchToConfig%V); + ("takeMessagesAfterAppend"%go, raft__takeMessagesAfterAppend%V); + ("tick"%go, raft__tick%V); + ("tickElection"%go, raft__tickElection%V); + ("tickHeartbeat"%go, raft__tickHeartbeat%V) ]. Definition stepFunc : go_type := funcT. -Definition stepFunc__mset : list (string * val) := [ +Definition stepFunc__mset : list (go_string * val) := [ ]. -Definition stepFunc__mset_ptr : list (string * val) := [ +Definition stepFunc__mset_ptr : list (go_string * val) := [ ]. Definition readIndexStatus : go_type := structT [ @@ -6396,7 +6396,7 @@ Definition readOnly__advance : val := do: ("ok" <-[boolT] "$r1");;; (if: (~ (![boolT] "ok")) then - do: (let: "$a0" := (interface.make string__mset #"cannot find corresponding read state from pending map") in + do: (let: "$a0" := (interface.make string__mset #"cannot find corresponding read state from pending map"%go) in Panic "$a0") else do: #());;; let: "$r0" := (let: "$a0" := (![sliceT] "rss") in @@ -6528,7 +6528,7 @@ Definition releasePendingReadIndexMessages : val := else do: #());;; (if: (~ ((raft__committedEntryInCurrentTerm (![ptrT] "r")) #())) then - do: (let: "$a0" := ((let: "$sl0" := (interface.make string__mset #"pending MsgReadIndex should be released only after first commit in current term") in + do: (let: "$a0" := ((let: "$sl0" := (interface.make string__mset #"pending MsgReadIndex should be released only after first commit in current term"%go) in slice.literal interfaceT ["$sl0"])) in (interface.get "Error" (![Logger] (struct.field_ref raft "logger" (![ptrT] "r")))) "$a0");;; return: (#()) @@ -6567,7 +6567,7 @@ Definition stepLeader : val := then (if: (~ ((tracker.ProgressTracker__QuorumActive (struct.field_ref raft "trk" (![ptrT] "r"))) #())) then - do: (let: "$a0" := #"%x stepped down to follower since quorum is not active" in + do: (let: "$a0" := #"%x stepped down to follower since quorum is not active"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in slice.literal interfaceT ["$sl0"])) in (interface.get "Warningf" (![Logger] (struct.field_ref raft "logger" (![ptrT] "r")))) "$a0" "$a1");;; @@ -6592,7 +6592,7 @@ Definition stepLeader : val := (if: (let: "$a0" := (![sliceT] (struct.field_ref raftpb.Message "Entries" "m")) in slice.len "$a0") = #(W64 0) then - do: (let: "$a0" := #"%x stepped empty MsgProp" in + do: (let: "$a0" := #"%x stepped empty MsgProp"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in slice.literal interfaceT ["$sl0"])) in (interface.get "Panicf" (![Logger] (struct.field_ref raft "logger" (![ptrT] "r")))) "$a0" "$a1") @@ -6602,7 +6602,7 @@ Definition stepLeader : val := else do: #());;; (if: (![uint64T] (struct.field_ref raft "leadTransferee" (![ptrT] "r"))) ≠ None then - do: (let: "$a0" := #"%x [term %d] transfer leadership to %x is in progress; dropping proposal" in + do: (let: "$a0" := #"%x [term %d] transfer leadership to %x is in progress; dropping proposal"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "Term" (![ptrT] "r")))) in let: "$sl2" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "leadTransferee" (![ptrT] "r")))) in @@ -6663,7 +6663,7 @@ Definition stepLeader : val := let: "failedCheck" := (ref_ty stringT (zero_val stringT)) in (if: ![boolT] "alreadyPending" then - let: "$r0" := (let: "$a0" := #"possible unapplied conf change at index %d (applied to %d)" in + let: "$r0" := (let: "$a0" := #"possible unapplied conf change at index %d (applied to %d)"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "pendingConfIndex" (![ptrT] "r")))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref raftLog "applied" (![ptrT] (struct.field_ref raft "raftLog" (![ptrT] "r")))))) in slice.literal interfaceT ["$sl0"; "$sl1"])) in @@ -6672,17 +6672,17 @@ Definition stepLeader : val := else (if: (![boolT] "alreadyJoint") && (~ (![boolT] "wantsLeaveJoint")) then - let: "$r0" := #"must transition out of joint config first" in + let: "$r0" := #"must transition out of joint config first"%go in do: ("failedCheck" <-[stringT] "$r0") else (if: (~ (![boolT] "alreadyJoint")) && (![boolT] "wantsLeaveJoint") then - let: "$r0" := #"not in joint state; refusing empty conf change" in + let: "$r0" := #"not in joint state; refusing empty conf change"%go in do: ("failedCheck" <-[stringT] "$r0") else do: #())));;; - (if: ((![stringT] "failedCheck") ≠ #"") && (~ (![boolT] (struct.field_ref raft "disableConfChangeValidation" (![ptrT] "r")))) + (if: ((![stringT] "failedCheck") ≠ #""%go) && (~ (![boolT] (struct.field_ref raft "disableConfChangeValidation" (![ptrT] "r")))) then - do: (let: "$a0" := #"%x ignoring conf change %v at config %s: %s" in + do: (let: "$a0" := #"%x ignoring conf change %v at config %s: %s"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (![raftpb.ConfChangeI] "cc") in let: "$sl2" := (interface.make tracker.Config__mset (![tracker.Config] (struct.field_ref tracker.ProgressTracker "Config" (struct.field_ref raft "trk" (![ptrT] "r"))))) in @@ -6749,7 +6749,7 @@ Definition stepLeader : val := do: ("pr" <-[ptrT] "$r0");;; (if: (![ptrT] "pr") = #null then - do: (let: "$a0" := #"%x no progress available for %x" in + do: (let: "$a0" := #"%x no progress available for %x"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref raftpb.Message "From" "m"))) in slice.literal interfaceT ["$sl0"; "$sl1"])) in @@ -6763,7 +6763,7 @@ Definition stepLeader : val := do: ((struct.field_ref tracker.Progress "RecentActive" (![ptrT] "pr")) <-[boolT] "$r0");;; (if: ![boolT] (struct.field_ref raftpb.Message "Reject" "m") then - do: (let: "$a0" := #"%x received MsgAppResp(rejected, hint: (index %d, term %d)) from %x for index %d" in + do: (let: "$a0" := #"%x received MsgAppResp(rejected, hint: (index %d, term %d)) from %x for index %d"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref raftpb.Message "RejectHint" "m"))) in let: "$sl2" := (interface.make uint64__mset (![uint64T] (struct.field_ref raftpb.Message "LogTerm" "m"))) in @@ -6788,7 +6788,7 @@ Definition stepLeader : val := let: "$a1" := (![uint64T] "nextProbeIdx") in (tracker.Progress__MaybeDecrTo (![ptrT] "pr")) "$a0" "$a1" then - do: (let: "$a0" := #"%x decreased progress of %x to [%s]" in + do: (let: "$a0" := #"%x decreased progress of %x to [%s]"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref raftpb.Message "From" "m"))) in let: "$sl2" := (interface.make tracker.Progress__mset_ptr (![ptrT] "pr")) in @@ -6810,7 +6810,7 @@ Definition stepLeader : val := else (if: "$sw" = (((![tracker.StateType] (struct.field_ref tracker.Progress "State" (![ptrT] "pr"))) = tracker.StateSnapshot) && (((![uint64T] (struct.field_ref tracker.Progress "Match" (![ptrT] "pr"))) + #(W64 1)) ≥ ((raftLog__firstIndex (![ptrT] (struct.field_ref raft "raftLog" (![ptrT] "r")))) #()))) then - do: (let: "$a0" := #"%x recovered from needing snapshot, resumed sending replication messages to %x [%s]" in + do: (let: "$a0" := #"%x recovered from needing snapshot, resumed sending replication messages to %x [%s]"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref raftpb.Message "From" "m"))) in let: "$sl2" := (interface.make tracker.Progress__mset_ptr (![ptrT] "pr")) in @@ -6845,7 +6845,7 @@ Definition stepLeader : val := else do: #());;; (if: ((![uint64T] (struct.field_ref raftpb.Message "From" "m")) = (![uint64T] (struct.field_ref raft "leadTransferee" (![ptrT] "r")))) && ((![uint64T] (struct.field_ref tracker.Progress "Match" (![ptrT] "pr"))) = ((raftLog__lastIndex (![ptrT] (struct.field_ref raft "raftLog" (![ptrT] "r")))) #())) then - do: (let: "$a0" := #"%x sent MsgTimeoutNow to %x after received MsgAppResp" in + do: (let: "$a0" := #"%x sent MsgTimeoutNow to %x after received MsgAppResp"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref raftpb.Message "From" "m"))) in slice.literal interfaceT ["$sl0"; "$sl1"])) in @@ -6902,7 +6902,7 @@ Definition stepLeader : val := (if: (~ (![boolT] (struct.field_ref raftpb.Message "Reject" "m"))) then do: ((tracker.Progress__BecomeProbe (![ptrT] "pr")) #());;; - do: (let: "$a0" := #"%x snapshot succeeded, resumed sending replication messages to %x [%s]" in + do: (let: "$a0" := #"%x snapshot succeeded, resumed sending replication messages to %x [%s]"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref raftpb.Message "From" "m"))) in let: "$sl2" := (interface.make tracker.Progress__mset_ptr (![ptrT] "pr")) in @@ -6912,7 +6912,7 @@ Definition stepLeader : val := let: "$r0" := #(W64 0) in do: ((struct.field_ref tracker.Progress "PendingSnapshot" (![ptrT] "pr")) <-[uint64T] "$r0");;; do: ((tracker.Progress__BecomeProbe (![ptrT] "pr")) #());;; - do: (let: "$a0" := #"%x snapshot failed, resumed sending replication messages to %x [%s]" in + do: (let: "$a0" := #"%x snapshot failed, resumed sending replication messages to %x [%s]"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref raftpb.Message "From" "m"))) in let: "$sl2" := (interface.make tracker.Progress__mset_ptr (![ptrT] "pr")) in @@ -6926,7 +6926,7 @@ Definition stepLeader : val := (if: (![tracker.StateType] (struct.field_ref tracker.Progress "State" (![ptrT] "pr"))) = tracker.StateReplicate then do: ((tracker.Progress__BecomeProbe (![ptrT] "pr")) #()) else do: #());;; - do: (let: "$a0" := #"%x failed to send message to %x because it is unreachable [%s]" in + do: (let: "$a0" := #"%x failed to send message to %x because it is unreachable [%s]"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref raftpb.Message "From" "m"))) in let: "$sl2" := (interface.make tracker.Progress__mset_ptr (![ptrT] "pr")) in @@ -6937,7 +6937,7 @@ Definition stepLeader : val := then (if: ![boolT] (struct.field_ref tracker.Progress "IsLearner" (![ptrT] "pr")) then - do: (let: "$a0" := #"%x is learner. Ignored transferring leadership" in + do: (let: "$a0" := #"%x is learner. Ignored transferring leadership"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in slice.literal interfaceT ["$sl0"])) in (interface.get "Debugf" (![Logger] (struct.field_ref raft "logger" (![ptrT] "r")))) "$a0" "$a1");;; @@ -6953,7 +6953,7 @@ Definition stepLeader : val := then (if: (![uint64T] "lastLeadTransferee") = (![uint64T] "leadTransferee") then - do: (let: "$a0" := #"%x [term %d] transfer leadership to %x is in progress, ignores request to same node %x" in + do: (let: "$a0" := #"%x [term %d] transfer leadership to %x is in progress, ignores request to same node %x"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "Term" (![ptrT] "r")))) in let: "$sl2" := (interface.make uint64__mset (![uint64T] "leadTransferee")) in @@ -6963,7 +6963,7 @@ Definition stepLeader : val := return: (#interface.nil) else do: #());;; do: ((raft__abortLeaderTransfer (![ptrT] "r")) #());;; - do: (let: "$a0" := #"%x [term %d] abort previous transferring leadership to %x" in + do: (let: "$a0" := #"%x [term %d] abort previous transferring leadership to %x"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "Term" (![ptrT] "r")))) in let: "$sl2" := (interface.make uint64__mset (![uint64T] "lastLeadTransferee")) in @@ -6972,13 +6972,13 @@ Definition stepLeader : val := else do: #());;; (if: (![uint64T] "leadTransferee") = (![uint64T] (struct.field_ref raft "id" (![ptrT] "r"))) then - do: (let: "$a0" := #"%x is already leader. Ignored transferring leadership to self" in + do: (let: "$a0" := #"%x is already leader. Ignored transferring leadership to self"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in slice.literal interfaceT ["$sl0"])) in (interface.get "Debugf" (![Logger] (struct.field_ref raft "logger" (![ptrT] "r")))) "$a0" "$a1");;; return: (#interface.nil) else do: #());;; - do: (let: "$a0" := #"%x [term %d] starts to transfer leadership to %x" in + do: (let: "$a0" := #"%x [term %d] starts to transfer leadership to %x"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "Term" (![ptrT] "r")))) in let: "$sl2" := (interface.make uint64__mset (![uint64T] "leadTransferee")) in @@ -6992,7 +6992,7 @@ Definition stepLeader : val := then do: (let: "$a0" := (![uint64T] "leadTransferee") in (raft__sendTimeoutNow (![ptrT] "r")) "$a0");;; - do: (let: "$a0" := #"%x sends MsgTimeoutNow to %x immediately as %x already has up-to-date log" in + do: (let: "$a0" := #"%x sends MsgTimeoutNow to %x immediately as %x already has up-to-date log"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] "leadTransferee")) in let: "$sl2" := (interface.make uint64__mset (![uint64T] "leadTransferee")) in @@ -7023,7 +7023,7 @@ Definition stepCandidate : val := let: "$sw" := (![raftpb.MessageType] (struct.field_ref raftpb.Message "Type" "m")) in (if: "$sw" = raftpb.MsgProp then - do: (let: "$a0" := #"%x no leader at term %d; dropping proposal" in + do: (let: "$a0" := #"%x no leader at term %d; dropping proposal"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "Term" (![ptrT] "r")))) in slice.literal interfaceT ["$sl0"; "$sl1"])) in @@ -7069,7 +7069,7 @@ Definition stepCandidate : val := do: ("gr" <-[intT] "$r0");;; do: ("rj" <-[intT] "$r1");;; do: ("res" <-[quorum.VoteResult] "$r2");;; - do: (let: "$a0" := #"%x has received %d %s votes and %d vote rejections" in + do: (let: "$a0" := #"%x has received %d %s votes and %d vote rejections"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make int__mset (![intT] "gr")) in let: "$sl2" := (interface.make raftpb.MessageType__mset (![raftpb.MessageType] (struct.field_ref raftpb.Message "Type" "m"))) in @@ -7096,7 +7096,7 @@ Definition stepCandidate : val := else (if: "$sw" = raftpb.MsgTimeoutNow then - do: (let: "$a0" := #"%x [term %d state %v] ignored MsgTimeoutNow from %x" in + do: (let: "$a0" := #"%x [term %d state %v] ignored MsgTimeoutNow from %x"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "Term" (![ptrT] "r")))) in let: "$sl2" := (interface.make StateType__mset (![StateType] (struct.field_ref raft "state" (![ptrT] "r")))) in @@ -7116,7 +7116,7 @@ Definition stepFollower : val := then (if: (![uint64T] (struct.field_ref raft "lead" (![ptrT] "r"))) = None then - do: (let: "$a0" := #"%x no leader at term %d; dropping proposal" in + do: (let: "$a0" := #"%x no leader at term %d; dropping proposal"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "Term" (![ptrT] "r")))) in slice.literal interfaceT ["$sl0"; "$sl1"])) in @@ -7125,7 +7125,7 @@ Definition stepFollower : val := else (if: ![boolT] (struct.field_ref raft "disableProposalForwarding" (![ptrT] "r")) then - do: (let: "$a0" := #"%x not forwarding to leader %x at term %d; dropping proposal" in + do: (let: "$a0" := #"%x not forwarding to leader %x at term %d; dropping proposal"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "lead" (![ptrT] "r")))) in let: "$sl2" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "Term" (![ptrT] "r")))) in @@ -7169,7 +7169,7 @@ Definition stepFollower : val := then (if: (![uint64T] (struct.field_ref raft "lead" (![ptrT] "r"))) = None then - do: (let: "$a0" := #"%x no leader at term %d; dropping leader transfer msg" in + do: (let: "$a0" := #"%x no leader at term %d; dropping leader transfer msg"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "Term" (![ptrT] "r")))) in slice.literal interfaceT ["$sl0"; "$sl1"])) in @@ -7185,14 +7185,14 @@ Definition stepFollower : val := then (if: (![ReadOnlyOption] (struct.field_ref readOnly "option" (![ptrT] (struct.field_ref raft "readOnly" (![ptrT] "r"))))) = ReadOnlyLeaseBased then - do: (let: "$a0" := ((let: "$sl0" := (interface.make string__mset #"ignoring MsgForgetLeader due to ReadOnlyLeaseBased") in + do: (let: "$a0" := ((let: "$sl0" := (interface.make string__mset #"ignoring MsgForgetLeader due to ReadOnlyLeaseBased"%go) in slice.literal interfaceT ["$sl0"])) in (interface.get "Error" (![Logger] (struct.field_ref raft "logger" (![ptrT] "r")))) "$a0");;; return: (#interface.nil) else do: #());;; (if: (![uint64T] (struct.field_ref raft "lead" (![ptrT] "r"))) ≠ None then - do: (let: "$a0" := #"%x forgetting leader %x at term %d" in + do: (let: "$a0" := #"%x forgetting leader %x at term %d"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "lead" (![ptrT] "r")))) in let: "$sl2" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "Term" (![ptrT] "r")))) in @@ -7204,7 +7204,7 @@ Definition stepFollower : val := else (if: "$sw" = raftpb.MsgTimeoutNow then - do: (let: "$a0" := #"%x [term %d] received MsgTimeoutNow from %x and starts an election to get leadership." in + do: (let: "$a0" := #"%x [term %d] received MsgTimeoutNow from %x and starts an election to get leadership."%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "Term" (![ptrT] "r")))) in let: "$sl2" := (interface.make uint64__mset (![uint64T] (struct.field_ref raftpb.Message "From" "m"))) in @@ -7217,7 +7217,7 @@ Definition stepFollower : val := then (if: (![uint64T] (struct.field_ref raft "lead" (![ptrT] "r"))) = None then - do: (let: "$a0" := #"%x no leader at term %d; dropping index reading msg" in + do: (let: "$a0" := #"%x no leader at term %d; dropping index reading msg"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "Term" (![ptrT] "r")))) in slice.literal interfaceT ["$sl0"; "$sl1"])) in @@ -7234,7 +7234,7 @@ Definition stepFollower : val := (if: (let: "$a0" := (![sliceT] (struct.field_ref raftpb.Message "Entries" "m")) in slice.len "$a0") ≠ #(W64 1) then - do: (let: "$a0" := #"%x invalid format of MsgReadIndexResp from %x, entries count: %d" in + do: (let: "$a0" := #"%x invalid format of MsgReadIndexResp from %x, entries count: %d"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "id" (![ptrT] "r")))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref raftpb.Message "From" "m"))) in let: "$sl2" := (interface.make int__mset (let: "$a0" := (![sliceT] (struct.field_ref raftpb.Message "Entries" "m")) in @@ -7378,14 +7378,14 @@ Definition MemoryStorage__Append : val := (slice.append sliceT) "$a0" "$a1") in do: ((struct.field_ref MemoryStorage "ents" (![ptrT] "ms")) <-[sliceT] "$r0") else - do: (let: "$a0" := #"missing log entry [last: %d, append at: %d]" in + do: (let: "$a0" := #"missing log entry [last: %d, append at: %d]"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset ((MemoryStorage__lastIndex (![ptrT] "ms")) #())) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref raftpb.Entry "Index" (slice.elem_ref raftpb.Entry (![sliceT] "entries") #(W64 0))))) in slice.literal interfaceT ["$sl0"; "$sl1"])) in (interface.get "Panicf" (getLogger #())) "$a0" "$a1")));;; return: (#interface.nil)). -Definition ErrSnapOutOfDate : (string * string) := (pkg_name', "ErrSnapOutOfDate"). +Definition ErrSnapOutOfDate : (go_string * go_string) := (pkg_name', "ErrSnapOutOfDate"%go). (* ApplySnapshot overwrites the contents of this Storage object with those of the given snapshot. @@ -7449,7 +7449,7 @@ Definition MemoryStorage__Compact : val := else do: #());;; (if: (![uint64T] "compactIndex") > ((MemoryStorage__lastIndex (![ptrT] "ms")) #()) then - do: (let: "$a0" := #"compact %d is out of bound lastindex(%d)" in + do: (let: "$a0" := #"compact %d is out of bound lastindex(%d)"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] "compactIndex")) in let: "$sl1" := (interface.make uint64__mset ((MemoryStorage__lastIndex (![ptrT] "ms")) #())) in slice.literal interfaceT ["$sl0"; "$sl1"])) in @@ -7506,7 +7506,7 @@ Definition MemoryStorage__CreateSnapshot : val := do: ("offset" <-[uint64T] "$r0");;; (if: (![uint64T] "i") > ((MemoryStorage__lastIndex (![ptrT] "ms")) #()) then - do: (let: "$a0" := #"snapshot %d is out of bound lastindex(%d)" in + do: (let: "$a0" := #"snapshot %d is out of bound lastindex(%d)"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] "i")) in let: "$sl1" := (interface.make uint64__mset ((MemoryStorage__lastIndex (![ptrT] "ms")) #())) in slice.literal interfaceT ["$sl0"; "$sl1"])) in @@ -7550,7 +7550,7 @@ Definition MemoryStorage__Entries : val := else do: #());;; (if: (![uint64T] "hi") > (((MemoryStorage__lastIndex (![ptrT] "ms")) #()) + #(W64 1)) then - do: (let: "$a0" := #"entries' hi(%d) is out of bound lastindex(%d)" in + do: (let: "$a0" := #"entries' hi(%d) is out of bound lastindex(%d)"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] "hi")) in let: "$sl1" := (interface.make uint64__mset ((MemoryStorage__lastIndex (![ptrT] "ms")) #())) in slice.literal interfaceT ["$sl0"; "$sl1"])) in @@ -7673,29 +7673,29 @@ Definition MemoryStorage__Term : val := else do: #());;; return: (![uint64T] (struct.field_ref raftpb.Entry "Term" (slice.elem_ref raftpb.Entry (![sliceT] (struct.field_ref MemoryStorage "ents" (![ptrT] "ms"))) ((![uint64T] "i") - (![uint64T] "offset")))), #interface.nil)). -Definition MemoryStorage__mset_ptr : list (string * val) := [ - ("Append", MemoryStorage__Append%V); - ("ApplySnapshot", MemoryStorage__ApplySnapshot%V); - ("Compact", MemoryStorage__Compact%V); - ("CreateSnapshot", MemoryStorage__CreateSnapshot%V); - ("Entries", MemoryStorage__Entries%V); - ("FirstIndex", MemoryStorage__FirstIndex%V); - ("InitialState", MemoryStorage__InitialState%V); - ("LastIndex", MemoryStorage__LastIndex%V); - ("Lock", (λ: "$recvAddr", +Definition MemoryStorage__mset_ptr : list (go_string * val) := [ + ("Append"%go, MemoryStorage__Append%V); + ("ApplySnapshot"%go, MemoryStorage__ApplySnapshot%V); + ("Compact"%go, MemoryStorage__Compact%V); + ("CreateSnapshot"%go, MemoryStorage__CreateSnapshot%V); + ("Entries"%go, MemoryStorage__Entries%V); + ("FirstIndex"%go, MemoryStorage__FirstIndex%V); + ("InitialState"%go, MemoryStorage__InitialState%V); + ("LastIndex"%go, MemoryStorage__LastIndex%V); + ("Lock"%go, (λ: "$recvAddr", sync.Mutex__Lock (struct.field_ref MemoryStorage "Mutex" "$recvAddr") )%V); - ("SetHardState", MemoryStorage__SetHardState%V); - ("Snapshot", MemoryStorage__Snapshot%V); - ("Term", MemoryStorage__Term%V); - ("TryLock", (λ: "$recvAddr", + ("SetHardState"%go, MemoryStorage__SetHardState%V); + ("Snapshot"%go, MemoryStorage__Snapshot%V); + ("Term"%go, MemoryStorage__Term%V); + ("TryLock"%go, (λ: "$recvAddr", sync.Mutex__TryLock (struct.field_ref MemoryStorage "Mutex" "$recvAddr") )%V); - ("Unlock", (λ: "$recvAddr", + ("Unlock"%go, (λ: "$recvAddr", sync.Mutex__Unlock (struct.field_ref MemoryStorage "Mutex" "$recvAddr") )%V); - ("firstIndex", MemoryStorage__firstIndex%V); - ("lastIndex", MemoryStorage__lastIndex%V) + ("firstIndex"%go, MemoryStorage__firstIndex%V); + ("lastIndex"%go, MemoryStorage__lastIndex%V) ]. (* NewMemoryStorage creates an empty MemoryStorage. @@ -7777,25 +7777,25 @@ Definition blackHole__readMessages : val := exception_do (let: <> := (ref_ty blackHole "_") in return: (#slice.nil)). -Definition blackHole__mset : list (string * val) := [ - ("Step", blackHole__Step%V); - ("advanceMessagesAfterAppend", blackHole__advanceMessagesAfterAppend%V); - ("readMessages", blackHole__readMessages%V) +Definition blackHole__mset : list (go_string * val) := [ + ("Step"%go, blackHole__Step%V); + ("advanceMessagesAfterAppend"%go, blackHole__advanceMessagesAfterAppend%V); + ("readMessages"%go, blackHole__readMessages%V) ]. -Definition blackHole__mset_ptr : list (string * val) := [ - ("Step", (λ: "$recvAddr", +Definition blackHole__mset_ptr : list (go_string * val) := [ + ("Step"%go, (λ: "$recvAddr", blackHole__Step (![blackHole] "$recvAddr") )%V); - ("advanceMessagesAfterAppend", (λ: "$recvAddr", + ("advanceMessagesAfterAppend"%go, (λ: "$recvAddr", blackHole__advanceMessagesAfterAppend (![blackHole] "$recvAddr") )%V); - ("readMessages", (λ: "$recvAddr", + ("readMessages"%go, (λ: "$recvAddr", blackHole__readMessages (![blackHole] "$recvAddr") )%V) ]. -Definition nopStepper : (string * string) := (pkg_name', "nopStepper"). +Definition nopStepper : (go_string * go_string) := (pkg_name', "nopStepper"%go). (* go: raft2.go:43:6 *) Definition preVoteConfig : val := @@ -7811,10 +7811,10 @@ Definition connem : go_type := structT [ "to" :: uint64T ]. -Definition connem__mset : list (string * val) := [ +Definition connem__mset : list (go_string * val) := [ ]. -Definition connem__mset_ptr : list (string * val) := [ +Definition connem__mset_ptr : list (go_string * val) := [ ]. Definition network : go_type := structT [ @@ -7826,7 +7826,7 @@ Definition network : go_type := structT [ "msgHook" :: funcT ]. -Definition network__mset : list (string * val) := [ +Definition network__mset : list (go_string * val) := [ ]. (* go: raft2.go:159:20 *) @@ -7844,7 +7844,7 @@ Definition network__filter : val := let: "$sw" := (![raftpb.MessageType] (struct.field_ref raftpb.Message "Type" "m")) in (if: "$sw" = raftpb.MsgHup then - do: (let: "$a0" := (interface.make string__mset #"unexpected msgHup") in + do: (let: "$a0" := (interface.make string__mset #"unexpected msgHup"%go) in Panic "$a0") else let: "perc64" := (ref_ty uint64T (zero_val uint64T)) in @@ -7879,7 +7879,7 @@ Definition EntryFormatter : go_type := funcT. Definition DescribeConfState : val := rec: "DescribeConfState" "state" := exception_do (let: "state" := (ref_ty raftpb.ConfState "state") in - return: (let: "$a0" := #"Voters:%v VotersOutgoing:%v Learners:%v LearnersNext:%v AutoLeave:%v" in + return: (let: "$a0" := #"Voters:%v VotersOutgoing:%v Learners:%v LearnersNext:%v AutoLeave:%v"%go in let: "$a1" := ((let: "$sl0" := (interface.make slice__mset (![sliceT] (struct.field_ref raftpb.ConfState "Voters" "state"))) in let: "$sl1" := (interface.make slice__mset (![sliceT] (struct.field_ref raftpb.ConfState "VotersOutgoing" "state"))) in let: "$sl2" := (interface.make slice__mset (![sliceT] (struct.field_ref raftpb.ConfState "Learners" "state"))) in @@ -7895,7 +7895,7 @@ Definition DescribeSnapshot : val := let: "m" := (ref_ty raftpb.SnapshotMetadata (zero_val raftpb.SnapshotMetadata)) in let: "$r0" := (![raftpb.SnapshotMetadata] (struct.field_ref raftpb.Snapshot "Metadata" "snap")) in do: ("m" <-[raftpb.SnapshotMetadata] "$r0");;; - return: (let: "$a0" := #"Index:%d Term:%d ConfState:%s" in + return: (let: "$a0" := #"Index:%d Term:%d ConfState:%s"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raftpb.SnapshotMetadata "Index" "m"))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref raftpb.SnapshotMetadata "Term" "m"))) in let: "$sl2" := (interface.make string__mset (let: "$a0" := (![raftpb.ConfState] (struct.field_ref raftpb.SnapshotMetadata "ConfState" "m")) in @@ -7915,7 +7915,7 @@ Definition DescribeEntry : val := then let: "$r0" := (λ: "data", exception_do (let: "data" := (ref_ty sliceT "data") in - return: (let: "$a0" := #"%q" in + return: (let: "$a0" := #"%q"%go in let: "$a1" := ((let: "$sl0" := (interface.make slice__mset (![sliceT] "data")) in slice.literal interfaceT ["$sl0"])) in fmt.Sprintf "$a0" "$a1")) @@ -7969,12 +7969,12 @@ Definition DescribeEntry : val := (![funcT] "formatConfChange") "$a0") in do: ("formatted" <-[stringT] "$r0"))) else #())));;; - (if: (![stringT] "formatted") ≠ #"" + (if: (![stringT] "formatted") ≠ #""%go then - let: "$r0" := (#" " + (![stringT] "formatted")) in + let: "$r0" := (#" "%go + (![stringT] "formatted")) in do: ("formatted" <-[stringT] "$r0") else do: #());;; - return: (let: "$a0" := #"%d/%d %s%s" in + return: (let: "$a0" := #"%d/%d %s%s"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raftpb.Entry "Term" "e"))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref raftpb.Entry "Index" "e"))) in let: "$sl2" := (interface.make raftpb.EntryType__mset (![raftpb.EntryType] (struct.field_ref raftpb.Entry "Type" "e"))) in @@ -7988,15 +7988,15 @@ Definition describeTarget : val := exception_do (let: "id" := (ref_ty uint64T "id") in let: "$sw" := (![uint64T] "id") in (if: "$sw" = None - then return: (#"None") + then return: (#"None"%go) else (if: "$sw" = LocalAppendThread - then return: (#"AppendThread") + then return: (#"AppendThread"%go) else (if: "$sw" = LocalApplyThread - then return: (#"ApplyThread") + then return: (#"ApplyThread"%go) else - return: (let: "$a0" := #"%x" in + return: (let: "$a0" := #"%x"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] "id")) in slice.literal interfaceT ["$sl0"])) in fmt.Sprintf "$a0" "$a1"))))). @@ -8009,7 +8009,7 @@ Definition describeMessageWithIndent : val := let: "indent" := (ref_ty stringT "indent") in let: "buf" := (ref_ty bytes.Buffer (zero_val bytes.Buffer)) in do: (let: "$a0" := (interface.make bytes.Buffer__mset_ptr "buf") in - let: "$a1" := #"%s%s->%s %v Term:%d Log:%d/%d" in + let: "$a1" := #"%s%s->%s %v Term:%d Log:%d/%d"%go in let: "$a2" := ((let: "$sl0" := (interface.make string__mset (![stringT] "indent")) in let: "$sl1" := (interface.make string__mset (let: "$a0" := (![uint64T] (struct.field_ref raftpb.Message "From" "m")) in describeTarget "$a0")) in @@ -8024,7 +8024,7 @@ Definition describeMessageWithIndent : val := (if: ![boolT] (struct.field_ref raftpb.Message "Reject" "m") then do: (let: "$a0" := (interface.make bytes.Buffer__mset_ptr "buf") in - let: "$a1" := #" Rejected (Hint: %d)" in + let: "$a1" := #" Rejected (Hint: %d)"%go in let: "$a2" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raftpb.Message "RejectHint" "m"))) in slice.literal interfaceT ["$sl0"])) in fmt.Fprintf "$a0" "$a1" "$a2") @@ -8032,7 +8032,7 @@ Definition describeMessageWithIndent : val := (if: (![uint64T] (struct.field_ref raftpb.Message "Commit" "m")) ≠ #(W64 0) then do: (let: "$a0" := (interface.make bytes.Buffer__mset_ptr "buf") in - let: "$a1" := #" Commit:%d" in + let: "$a1" := #" Commit:%d"%go in let: "$a2" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raftpb.Message "Commit" "m"))) in slice.literal interfaceT ["$sl0"])) in fmt.Fprintf "$a0" "$a1" "$a2") @@ -8040,7 +8040,7 @@ Definition describeMessageWithIndent : val := (if: (![uint64T] (struct.field_ref raftpb.Message "Vote" "m")) ≠ #(W64 0) then do: (let: "$a0" := (interface.make bytes.Buffer__mset_ptr "buf") in - let: "$a1" := #" Vote:%d" in + let: "$a1" := #" Vote:%d"%go in let: "$a2" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raftpb.Message "Vote" "m"))) in slice.literal interfaceT ["$sl0"])) in fmt.Fprintf "$a0" "$a1" "$a2") @@ -8052,7 +8052,7 @@ Definition describeMessageWithIndent : val := (if: (![intT] "ln") = #(W64 1) then do: (let: "$a0" := (interface.make bytes.Buffer__mset_ptr "buf") in - let: "$a1" := #" Entries:[%s]" in + let: "$a1" := #" Entries:[%s]"%go in let: "$a2" := ((let: "$sl0" := (interface.make string__mset (let: "$a0" := (![raftpb.Entry] (slice.elem_ref raftpb.Entry (![sliceT] (struct.field_ref raftpb.Message "Entries" "m")) #(W64 0))) in let: "$a1" := (![EntryFormatter] "f") in DescribeEntry "$a0" "$a1")) in @@ -8062,7 +8062,7 @@ Definition describeMessageWithIndent : val := (if: int_gt (![intT] "ln") #(W64 1) then do: (let: "$a0" := (interface.make bytes.Buffer__mset_ptr "buf") in - let: "$a1" := ((let: "$sl0" := (interface.make string__mset #" Entries:[") in + let: "$a1" := ((let: "$sl0" := (interface.make string__mset #" Entries:["%go) in slice.literal interfaceT ["$sl0"])) in fmt.Fprint "$a0" "$a1");;; do: (let: "$range" := (![sliceT] (struct.field_ref raftpb.Message "Entries" "m")) in @@ -8070,7 +8070,7 @@ Definition describeMessageWithIndent : val := let: "e" := ref_ty raftpb.Entry "e" in do: (let: "$a0" := (interface.make bytes.Buffer__mset_ptr "buf") in let: "$a1" := #" - %s " in + %s "%go in let: "$a2" := ((let: "$sl0" := (interface.make string__mset (![stringT] "indent")) in slice.literal interfaceT ["$sl0"])) in fmt.Fprintf "$a0" "$a1" "$a2");;; @@ -8080,7 +8080,7 @@ Definition describeMessageWithIndent : val := (bytes.Buffer__WriteString "buf") "$a0")));;; do: (let: "$a0" := (interface.make bytes.Buffer__mset_ptr "buf") in let: "$a1" := #" - %s]" in + %s]"%go in let: "$a2" := ((let: "$sl0" := (interface.make string__mset (![stringT] "indent")) in slice.literal interfaceT ["$sl0"])) in fmt.Fprintf "$a0" "$a1" "$a2") @@ -8093,7 +8093,7 @@ Definition describeMessageWithIndent : val := then do: (let: "$a0" := (interface.make bytes.Buffer__mset_ptr "buf") in let: "$a1" := #" - %s Snapshot: %s" in + %s Snapshot: %s"%go in let: "$a2" := ((let: "$sl0" := (interface.make string__mset (![stringT] "indent")) in let: "$sl1" := (interface.make string__mset (let: "$a0" := (![raftpb.Snapshot] (![ptrT] "s")) in DescribeSnapshot "$a0")) in @@ -8104,23 +8104,23 @@ Definition describeMessageWithIndent : val := slice.len "$a0") #(W64 0) then do: (let: "$a0" := (interface.make bytes.Buffer__mset_ptr "buf") in - let: "$a1" := #" Responses:[" in + let: "$a1" := #" Responses:["%go in let: "$a2" := #slice.nil in fmt.Fprintf "$a0" "$a1" "$a2");;; do: (let: "$range" := (![sliceT] (struct.field_ref raftpb.Message "Responses" "m")) in slice.for_range raftpb.Message "$range" (λ: <> "m", let: "m" := ref_ty raftpb.Message "m" in do: (let: "$a0" := #" - " in + "%go in (bytes.Buffer__WriteString "buf") "$a0");;; - do: (let: "$a0" := (let: "$a0" := ((![stringT] "indent") + #" ") in + do: (let: "$a0" := (let: "$a0" := ((![stringT] "indent") + #" "%go) in let: "$a1" := (![raftpb.Message] "m") in let: "$a2" := (![EntryFormatter] "f") in "describeMessageWithIndent" "$a0" "$a1" "$a2") in (bytes.Buffer__WriteString "buf") "$a0")));;; do: (let: "$a0" := (interface.make bytes.Buffer__mset_ptr "buf") in let: "$a1" := #" - %s]" in + %s]"%go in let: "$a2" := ((let: "$sl0" := (interface.make string__mset (![stringT] "indent")) in slice.literal interfaceT ["$sl0"])) in fmt.Fprintf "$a0" "$a1" "$a2") @@ -8135,7 +8135,7 @@ Definition DescribeMessage : val := rec: "DescribeMessage" "m" "f" := exception_do (let: "f" := (ref_ty EntryFormatter "f") in let: "m" := (ref_ty raftpb.Message "m") in - return: (let: "$a0" := #"" in + return: (let: "$a0" := #""%go in let: "$a1" := (![raftpb.Message] "m") in let: "$a2" := (![EntryFormatter] "f") in describeMessageWithIndent "$a0" "$a1" "$a2")). @@ -8172,9 +8172,9 @@ Definition network__send : val := (slice.append sliceT) "$a0" "$a1") in do: ("msgs" <-[sliceT] "$r0"))). -Definition network__mset_ptr : list (string * val) := [ - ("filter", network__filter%V); - ("send", network__send%V) +Definition network__mset_ptr : list (go_string * val) := [ + ("filter"%go, network__filter%V); + ("send"%go, network__send%V) ]. (* go: raft2.go:70:6 *) @@ -8204,10 +8204,10 @@ Definition withPeers : val := do: ((struct.field_ref raftpb.ConfState "Voters" (struct.field_ref raftpb.SnapshotMetadata "ConfState" (struct.field_ref raftpb.Snapshot "Metadata" (struct.field_ref MemoryStorage "snapshot" (![ptrT] "ms"))))) <-[sliceT] "$r0")) ))). -Definition testMemoryStorageOptions__mset : list (string * val) := [ +Definition testMemoryStorageOptions__mset : list (go_string * val) := [ ]. -Definition testMemoryStorageOptions__mset_ptr : list (string * val) := [ +Definition testMemoryStorageOptions__mset_ptr : list (go_string * val) := [ ]. (* go: raft2.go:86:6 *) @@ -8297,10 +8297,10 @@ Definition testLeaderElectionStruct : go_type := structT [ "expTerm" :: uint64T ]. -Definition testLeaderElectionStruct__mset : list (string * val) := [ +Definition testLeaderElectionStruct__mset : list (go_string * val) := [ ]. -Definition testLeaderElectionStruct__mset_ptr : list (string * val) := [ +Definition testLeaderElectionStruct__mset_ptr : list (go_string * val) := [ ]. (* go: raft2.go:204:6 *) @@ -8437,23 +8437,23 @@ Definition testLeaderElection2 : val := do: (let: "$a0" := (interface.make testing.T__mset_ptr (![ptrT] "t")) in let: "$a1" := (interface.make StateType__mset (![StateType] (struct.field_ref testLeaderElectionStruct "state" "tt"))) in let: "$a2" := (interface.make StateType__mset (![StateType] (struct.field_ref raft "state" (![ptrT] "sm")))) in - let: "$a3" := ((let: "$sl0" := (interface.make string__mset #"#%d") in + let: "$a3" := ((let: "$sl0" := (interface.make string__mset #"#%d"%go) in let: "$sl1" := (interface.make int__mset (![intT] "i")) in slice.literal interfaceT ["$sl0"; "$sl1"])) in assert.Equal "$a0" "$a1" "$a2" "$a3");;; do: (let: "$a0" := (interface.make testing.T__mset_ptr (![ptrT] "t")) in let: "$a1" := (interface.make uint64__mset (![uint64T] (struct.field_ref testLeaderElectionStruct "expTerm" "tt"))) in let: "$a2" := (interface.make uint64__mset (![uint64T] (struct.field_ref raft "Term" (![ptrT] "sm")))) in - let: "$a3" := ((let: "$sl0" := (interface.make string__mset #"#%d") in + let: "$a3" := ((let: "$sl0" := (interface.make string__mset #"#%d"%go) in let: "$sl1" := (interface.make int__mset (![intT] "i")) in slice.literal interfaceT ["$sl0"; "$sl1"])) in assert.Equal "$a0" "$a1" "$a2" "$a3")))). -Definition ErrStepLocalMsg : (string * string) := (pkg_name', "ErrStepLocalMsg"). +Definition ErrStepLocalMsg : (go_string * go_string) := (pkg_name', "ErrStepLocalMsg"%go). -Definition ErrStepPeerNotFound : (string * string) := (pkg_name', "ErrStepPeerNotFound"). +Definition ErrStepPeerNotFound : (go_string * go_string) := (pkg_name', "ErrStepPeerNotFound"%go). -Definition RawNode__mset : list (string * val) := [ +Definition RawNode__mset : list (go_string * val) := [ ]. (* ApplyConfChange applies a config change to the local node. The app must call @@ -8819,57 +8819,57 @@ Definition RawNode__WithProgress : val := ) in (tracker.ProgressTracker__Visit (struct.field_ref raft "trk" (![ptrT] (struct.field_ref RawNode "raft" (![ptrT] "rn"))))) "$a0")). -Definition RawNode__mset_ptr : list (string * val) := [ - ("Advance", RawNode__Advance%V); - ("ApplyConfChange", RawNode__ApplyConfChange%V); - ("BasicStatus", RawNode__BasicStatus%V); - ("Bootstrap", RawNode__Bootstrap%V); - ("Campaign", RawNode__Campaign%V); - ("ForgetLeader", RawNode__ForgetLeader%V); - ("HasReady", RawNode__HasReady%V); - ("Propose", RawNode__Propose%V); - ("ProposeConfChange", RawNode__ProposeConfChange%V); - ("ReadIndex", RawNode__ReadIndex%V); - ("Ready", RawNode__Ready%V); - ("ReportSnapshot", RawNode__ReportSnapshot%V); - ("ReportUnreachable", RawNode__ReportUnreachable%V); - ("Status", RawNode__Status%V); - ("Step", RawNode__Step%V); - ("Tick", RawNode__Tick%V); - ("TickQuiesced", RawNode__TickQuiesced%V); - ("TransferLeader", RawNode__TransferLeader%V); - ("WithProgress", RawNode__WithProgress%V); - ("acceptReady", RawNode__acceptReady%V); - ("applyUnstableEntries", RawNode__applyUnstableEntries%V); - ("readyWithoutAccept", RawNode__readyWithoutAccept%V) +Definition RawNode__mset_ptr : list (go_string * val) := [ + ("Advance"%go, RawNode__Advance%V); + ("ApplyConfChange"%go, RawNode__ApplyConfChange%V); + ("BasicStatus"%go, RawNode__BasicStatus%V); + ("Bootstrap"%go, RawNode__Bootstrap%V); + ("Campaign"%go, RawNode__Campaign%V); + ("ForgetLeader"%go, RawNode__ForgetLeader%V); + ("HasReady"%go, RawNode__HasReady%V); + ("Propose"%go, RawNode__Propose%V); + ("ProposeConfChange"%go, RawNode__ProposeConfChange%V); + ("ReadIndex"%go, RawNode__ReadIndex%V); + ("Ready"%go, RawNode__Ready%V); + ("ReportSnapshot"%go, RawNode__ReportSnapshot%V); + ("ReportUnreachable"%go, RawNode__ReportUnreachable%V); + ("Status"%go, RawNode__Status%V); + ("Step"%go, RawNode__Step%V); + ("Tick"%go, RawNode__Tick%V); + ("TickQuiesced"%go, RawNode__TickQuiesced%V); + ("TransferLeader"%go, RawNode__TransferLeader%V); + ("WithProgress"%go, RawNode__WithProgress%V); + ("acceptReady"%go, RawNode__acceptReady%V); + ("applyUnstableEntries"%go, RawNode__applyUnstableEntries%V); + ("readyWithoutAccept"%go, RawNode__readyWithoutAccept%V) ]. -Definition ProgressType__mset : list (string * val) := [ +Definition ProgressType__mset : list (go_string * val) := [ ]. -Definition ProgressType__mset_ptr : list (string * val) := [ +Definition ProgressType__mset_ptr : list (go_string * val) := [ ]. -Definition ReadState__mset : list (string * val) := [ +Definition ReadState__mset : list (go_string * val) := [ ]. -Definition ReadState__mset_ptr : list (string * val) := [ +Definition ReadState__mset_ptr : list (go_string * val) := [ ]. -Definition readIndexStatus__mset : list (string * val) := [ +Definition readIndexStatus__mset : list (go_string * val) := [ ]. -Definition readIndexStatus__mset_ptr : list (string * val) := [ +Definition readIndexStatus__mset_ptr : list (go_string * val) := [ ]. -Definition readOnly__mset : list (string * val) := [ +Definition readOnly__mset : list (go_string * val) := [ ]. -Definition readOnly__mset_ptr : list (string * val) := [ - ("addRequest", readOnly__addRequest%V); - ("advance", readOnly__advance%V); - ("lastPendingRequestCtx", readOnly__lastPendingRequestCtx%V); - ("recvAck", readOnly__recvAck%V) +Definition readOnly__mset_ptr : list (go_string * val) := [ + ("addRequest"%go, readOnly__addRequest%V); + ("advance"%go, readOnly__advance%V); + ("lastPendingRequestCtx"%go, readOnly__lastPendingRequestCtx%V); + ("recvAck"%go, readOnly__recvAck%V) ]. Definition StateTraceDeployed : expr := #false. @@ -8877,10 +8877,10 @@ Definition StateTraceDeployed : expr := #false. Definition TracingEvent : go_type := structT [ ]. -Definition TracingEvent__mset : list (string * val) := [ +Definition TracingEvent__mset : list (go_string * val) := [ ]. -Definition TracingEvent__mset_ptr : list (string * val) := [ +Definition TracingEvent__mset_ptr : list (go_string * val) := [ ]. (* MarshalJSON translates the raft status into JSON. @@ -8891,7 +8891,7 @@ Definition Status__MarshalJSON : val := rec: "Status__MarshalJSON" "s" <> := exception_do (let: "s" := (ref_ty Status "s") in let: "j" := (ref_ty stringT (zero_val stringT)) in - let: "$r0" := (let: "$a0" := #"{""id"":""%x"",""term"":%d,""vote"":""%x"",""commit"":%d,""lead"":""%x"",""raftState"":%q,""applied"":%d,""progress"":{" in + let: "$r0" := (let: "$a0" := #"{""id"":""%x"",""term"":%d,""vote"":""%x"",""commit"":%d,""lead"":""%x"",""raftState"":%q,""applied"":%d,""progress"":{"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref BasicStatus "ID" (struct.field_ref Status "BasicStatus" "s")))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref raftpb.HardState "Term" (struct.field_ref BasicStatus "HardState" (struct.field_ref Status "BasicStatus" "s"))))) in let: "$sl2" := (interface.make uint64__mset (![uint64T] (struct.field_ref raftpb.HardState "Vote" (struct.field_ref BasicStatus "HardState" (struct.field_ref Status "BasicStatus" "s"))))) in @@ -8904,11 +8904,11 @@ Definition Status__MarshalJSON : val := do: ("j" <-[stringT] "$r0");;; (if: (let: "$a0" := (![mapT uint64T tracker.Progress] (struct.field_ref Status "Progress" "s")) in map.len "$a0") = #(W64 0) - then do: ("j" <-[stringT] ((![stringT] "j") + #"},")) + then do: ("j" <-[stringT] ((![stringT] "j") + #"},"%go)) else do: (map.for_range (![mapT uint64T tracker.Progress] (struct.field_ref Status "Progress" "s")) (λ: "k" "v", let: "subj" := (ref_ty stringT (zero_val stringT)) in - let: "$r0" := (let: "$a0" := #"""%x"":{""match"":%d,""next"":%d,""state"":%q}," in + let: "$r0" := (let: "$a0" := #"""%x"":{""match"":%d,""next"":%d,""state"":%q},"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] "k")) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref tracker.Progress "Match" "v"))) in let: "$sl2" := (interface.make uint64__mset (![uint64T] (struct.field_ref tracker.Progress "Next" "v"))) in @@ -8919,9 +8919,9 @@ Definition Status__MarshalJSON : val := do: ("j" <-[stringT] ((![stringT] "j") + (![stringT] "subj")))));;; let: "$r0" := ((string.from_bytes (let: "$s" := (string.to_bytes (![stringT] "j")) in slice.slice byteT "$s" #(W64 0) ((let: "$a0" := (![stringT] "j") in - StringLength "$a0") - #(W64 1)))) + #"},") in + StringLength "$a0") - #(W64 1)))) + #"},"%go) in do: ("j" <-[stringT] "$r0"));;; - do: ("j" <-[stringT] ((![stringT] "j") + (let: "$a0" := #"""leadtransferee"":""%x""}" in + do: ("j" <-[stringT] ((![stringT] "j") + (let: "$a0" := #"""leadtransferee"":""%x""}"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref BasicStatus "LeadTransferee" (struct.field_ref Status "BasicStatus" "s")))) in slice.literal interfaceT ["$sl0"])) in fmt.Sprintf "$a0" "$a1")));;; @@ -8940,127 +8940,127 @@ Definition Status__String : val := do: ("err" <-[error] "$r1");;; (if: (![error] "err") ≠ #interface.nil then - do: (let: "$a0" := #"unexpected error: %v" in + do: (let: "$a0" := #"unexpected error: %v"%go in let: "$a1" := ((let: "$sl0" := (![error] "err") in slice.literal interfaceT ["$sl0"])) in (interface.get "Panicf" (getLogger #())) "$a0" "$a1") else do: #());;; return: (string.from_bytes (![sliceT] "b"))). -Definition Status__mset : list (string * val) := [ - ("MarshalJSON", Status__MarshalJSON%V); - ("String", Status__String%V) +Definition Status__mset : list (go_string * val) := [ + ("MarshalJSON"%go, Status__MarshalJSON%V); + ("String"%go, Status__String%V) ]. -Definition Status__mset_ptr : list (string * val) := [ - ("Descriptor", (λ: "$recvAddr", +Definition Status__mset_ptr : list (go_string * val) := [ + ("Descriptor"%go, (λ: "$recvAddr", raftpb.HardState__Descriptor (struct.field_ref BasicStatus "HardState" (struct.field_ref Status "BasicStatus" "$recvAddr")) )%V); - ("Marshal", (λ: "$recvAddr", + ("Marshal"%go, (λ: "$recvAddr", raftpb.HardState__Marshal (struct.field_ref BasicStatus "HardState" (struct.field_ref Status "BasicStatus" "$recvAddr")) )%V); - ("MarshalJSON", (λ: "$recvAddr", + ("MarshalJSON"%go, (λ: "$recvAddr", Status__MarshalJSON (![Status] "$recvAddr") )%V); - ("MarshalTo", (λ: "$recvAddr", + ("MarshalTo"%go, (λ: "$recvAddr", raftpb.HardState__MarshalTo (struct.field_ref BasicStatus "HardState" (struct.field_ref Status "BasicStatus" "$recvAddr")) )%V); - ("MarshalToSizedBuffer", (λ: "$recvAddr", + ("MarshalToSizedBuffer"%go, (λ: "$recvAddr", raftpb.HardState__MarshalToSizedBuffer (struct.field_ref BasicStatus "HardState" (struct.field_ref Status "BasicStatus" "$recvAddr")) )%V); - ("ProtoMessage", (λ: "$recvAddr", + ("ProtoMessage"%go, (λ: "$recvAddr", raftpb.HardState__ProtoMessage (struct.field_ref BasicStatus "HardState" (struct.field_ref Status "BasicStatus" "$recvAddr")) )%V); - ("Reset", (λ: "$recvAddr", + ("Reset"%go, (λ: "$recvAddr", raftpb.HardState__Reset (struct.field_ref BasicStatus "HardState" (struct.field_ref Status "BasicStatus" "$recvAddr")) )%V); - ("Size", (λ: "$recvAddr", + ("Size"%go, (λ: "$recvAddr", raftpb.HardState__Size (struct.field_ref BasicStatus "HardState" (struct.field_ref Status "BasicStatus" "$recvAddr")) )%V); - ("String", (λ: "$recvAddr", + ("String"%go, (λ: "$recvAddr", Status__String (![Status] "$recvAddr") )%V); - ("Unmarshal", (λ: "$recvAddr", + ("Unmarshal"%go, (λ: "$recvAddr", raftpb.HardState__Unmarshal (struct.field_ref BasicStatus "HardState" (struct.field_ref Status "BasicStatus" "$recvAddr")) )%V); - ("XXX_DiscardUnknown", (λ: "$recvAddr", + ("XXX_DiscardUnknown"%go, (λ: "$recvAddr", raftpb.HardState__XXX_DiscardUnknown (struct.field_ref BasicStatus "HardState" (struct.field_ref Status "BasicStatus" "$recvAddr")) )%V); - ("XXX_Marshal", (λ: "$recvAddr", + ("XXX_Marshal"%go, (λ: "$recvAddr", raftpb.HardState__XXX_Marshal (struct.field_ref BasicStatus "HardState" (struct.field_ref Status "BasicStatus" "$recvAddr")) )%V); - ("XXX_Merge", (λ: "$recvAddr", + ("XXX_Merge"%go, (λ: "$recvAddr", raftpb.HardState__XXX_Merge (struct.field_ref BasicStatus "HardState" (struct.field_ref Status "BasicStatus" "$recvAddr")) )%V); - ("XXX_Size", (λ: "$recvAddr", + ("XXX_Size"%go, (λ: "$recvAddr", raftpb.HardState__XXX_Size (struct.field_ref BasicStatus "HardState" (struct.field_ref Status "BasicStatus" "$recvAddr")) )%V); - ("XXX_Unmarshal", (λ: "$recvAddr", + ("XXX_Unmarshal"%go, (λ: "$recvAddr", raftpb.HardState__XXX_Unmarshal (struct.field_ref BasicStatus "HardState" (struct.field_ref Status "BasicStatus" "$recvAddr")) )%V) ]. -Definition BasicStatus__mset : list (string * val) := [ +Definition BasicStatus__mset : list (go_string * val) := [ ]. -Definition BasicStatus__mset_ptr : list (string * val) := [ - ("Descriptor", (λ: "$recvAddr", +Definition BasicStatus__mset_ptr : list (go_string * val) := [ + ("Descriptor"%go, (λ: "$recvAddr", raftpb.HardState__Descriptor (struct.field_ref BasicStatus "HardState" "$recvAddr") )%V); - ("Marshal", (λ: "$recvAddr", + ("Marshal"%go, (λ: "$recvAddr", raftpb.HardState__Marshal (struct.field_ref BasicStatus "HardState" "$recvAddr") )%V); - ("MarshalTo", (λ: "$recvAddr", + ("MarshalTo"%go, (λ: "$recvAddr", raftpb.HardState__MarshalTo (struct.field_ref BasicStatus "HardState" "$recvAddr") )%V); - ("MarshalToSizedBuffer", (λ: "$recvAddr", + ("MarshalToSizedBuffer"%go, (λ: "$recvAddr", raftpb.HardState__MarshalToSizedBuffer (struct.field_ref BasicStatus "HardState" "$recvAddr") )%V); - ("ProtoMessage", (λ: "$recvAddr", + ("ProtoMessage"%go, (λ: "$recvAddr", raftpb.HardState__ProtoMessage (struct.field_ref BasicStatus "HardState" "$recvAddr") )%V); - ("Reset", (λ: "$recvAddr", + ("Reset"%go, (λ: "$recvAddr", raftpb.HardState__Reset (struct.field_ref BasicStatus "HardState" "$recvAddr") )%V); - ("Size", (λ: "$recvAddr", + ("Size"%go, (λ: "$recvAddr", raftpb.HardState__Size (struct.field_ref BasicStatus "HardState" "$recvAddr") )%V); - ("String", (λ: "$recvAddr", + ("String"%go, (λ: "$recvAddr", raftpb.HardState__String (struct.field_ref BasicStatus "HardState" "$recvAddr") )%V); - ("Unmarshal", (λ: "$recvAddr", + ("Unmarshal"%go, (λ: "$recvAddr", raftpb.HardState__Unmarshal (struct.field_ref BasicStatus "HardState" "$recvAddr") )%V); - ("XXX_DiscardUnknown", (λ: "$recvAddr", + ("XXX_DiscardUnknown"%go, (λ: "$recvAddr", raftpb.HardState__XXX_DiscardUnknown (struct.field_ref BasicStatus "HardState" "$recvAddr") )%V); - ("XXX_Marshal", (λ: "$recvAddr", + ("XXX_Marshal"%go, (λ: "$recvAddr", raftpb.HardState__XXX_Marshal (struct.field_ref BasicStatus "HardState" "$recvAddr") )%V); - ("XXX_Merge", (λ: "$recvAddr", + ("XXX_Merge"%go, (λ: "$recvAddr", raftpb.HardState__XXX_Merge (struct.field_ref BasicStatus "HardState" "$recvAddr") )%V); - ("XXX_Size", (λ: "$recvAddr", + ("XXX_Size"%go, (λ: "$recvAddr", raftpb.HardState__XXX_Size (struct.field_ref BasicStatus "HardState" "$recvAddr") )%V); - ("XXX_Unmarshal", (λ: "$recvAddr", + ("XXX_Unmarshal"%go, (λ: "$recvAddr", raftpb.HardState__XXX_Unmarshal (struct.field_ref BasicStatus "HardState" "$recvAddr") )%V) ]. -Definition inMemStorageCallStats__mset : list (string * val) := [ +Definition inMemStorageCallStats__mset : list (go_string * val) := [ ]. -Definition inMemStorageCallStats__mset_ptr : list (string * val) := [ +Definition inMemStorageCallStats__mset_ptr : list (go_string * val) := [ ]. -Definition MemoryStorage__mset : list (string * val) := [ +Definition MemoryStorage__mset : list (go_string * val) := [ ]. -Definition entryID__mset : list (string * val) := [ +Definition entryID__mset : list (go_string * val) := [ ]. -Definition entryID__mset_ptr : list (string * val) := [ +Definition entryID__mset_ptr : list (go_string * val) := [ ]. (* lastEntryID returns the ID of the last entry in this log slice, or prev if @@ -9110,7 +9110,7 @@ Definition logSlice__valid : val := do: ("id" <-[entryID] "$r0");;; (if: ((![uint64T] (struct.field_ref entryID "term" "id")) < (![uint64T] (struct.field_ref entryID "term" "prev"))) || ((![uint64T] (struct.field_ref entryID "index" "id")) ≠ ((![uint64T] (struct.field_ref entryID "index" "prev")) + #(W64 1))) then - return: (let: "$a0" := #"leader term %d: entries %+v and %+v not consistent" in + return: (let: "$a0" := #"leader term %d: entries %+v and %+v not consistent"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref logSlice "term" "s"))) in let: "$sl1" := (interface.make entryID__mset (![entryID] "prev")) in let: "$sl2" := (interface.make entryID__mset (![entryID] "id")) in @@ -9121,7 +9121,7 @@ Definition logSlice__valid : val := do: ("prev" <-[entryID] "$r0")));;; (if: (![uint64T] (struct.field_ref logSlice "term" "s")) < (![uint64T] (struct.field_ref entryID "term" "prev")) then - return: (let: "$a0" := #"leader term %d: entry %+v has a newer term" in + return: (let: "$a0" := #"leader term %d: entry %+v has a newer term"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref logSlice "term" "s"))) in let: "$sl1" := (interface.make entryID__mset (![entryID] "prev")) in slice.literal interfaceT ["$sl0"; "$sl1"])) in @@ -9129,20 +9129,20 @@ Definition logSlice__valid : val := else do: #());;; return: (#interface.nil)). -Definition logSlice__mset : list (string * val) := [ - ("lastEntryID", logSlice__lastEntryID%V); - ("lastIndex", logSlice__lastIndex%V); - ("valid", logSlice__valid%V) +Definition logSlice__mset : list (go_string * val) := [ + ("lastEntryID"%go, logSlice__lastEntryID%V); + ("lastIndex"%go, logSlice__lastIndex%V); + ("valid"%go, logSlice__valid%V) ]. -Definition logSlice__mset_ptr : list (string * val) := [ - ("lastEntryID", (λ: "$recvAddr", +Definition logSlice__mset_ptr : list (go_string * val) := [ + ("lastEntryID"%go, (λ: "$recvAddr", logSlice__lastEntryID (![logSlice] "$recvAddr") )%V); - ("lastIndex", (λ: "$recvAddr", + ("lastIndex"%go, (λ: "$recvAddr", logSlice__lastIndex (![logSlice] "$recvAddr") )%V); - ("valid", (λ: "$recvAddr", + ("valid"%go, (λ: "$recvAddr", logSlice__valid (![logSlice] "$recvAddr") )%V) ]. @@ -9153,20 +9153,20 @@ Definition DescribeHardState : val := exception_do (let: "hs" := (ref_ty raftpb.HardState "hs") in let: "buf" := (ref_ty strings.Builder (zero_val strings.Builder)) in do: (let: "$a0" := (interface.make strings.Builder__mset_ptr "buf") in - let: "$a1" := #"Term:%d" in + let: "$a1" := #"Term:%d"%go in let: "$a2" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raftpb.HardState "Term" "hs"))) in slice.literal interfaceT ["$sl0"])) in fmt.Fprintf "$a0" "$a1" "$a2");;; (if: (![uint64T] (struct.field_ref raftpb.HardState "Vote" "hs")) ≠ #(W64 0) then do: (let: "$a0" := (interface.make strings.Builder__mset_ptr "buf") in - let: "$a1" := #" Vote:%d" in + let: "$a1" := #" Vote:%d"%go in let: "$a2" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raftpb.HardState "Vote" "hs"))) in slice.literal interfaceT ["$sl0"])) in fmt.Fprintf "$a0" "$a1" "$a2") else do: #());;; do: (let: "$a0" := (interface.make strings.Builder__mset_ptr "buf") in - let: "$a1" := #" Commit:%d" in + let: "$a1" := #" Commit:%d"%go in let: "$a2" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref raftpb.HardState "Commit" "hs"))) in slice.literal interfaceT ["$sl0"])) in fmt.Fprintf "$a0" "$a1" "$a2");;; @@ -9176,7 +9176,7 @@ Definition DescribeHardState : val := Definition DescribeSoftState : val := rec: "DescribeSoftState" "ss" := exception_do (let: "ss" := (ref_ty SoftState "ss") in - return: (let: "$a0" := #"Lead:%d State:%s" in + return: (let: "$a0" := #"Lead:%d State:%s"%go in let: "$a1" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref SoftState "Lead" "ss"))) in let: "$sl1" := (interface.make StateType__mset (![StateType] (struct.field_ref SoftState "RaftState" "ss"))) in slice.literal interfaceT ["$sl0"; "$sl1"])) in @@ -9197,7 +9197,7 @@ Definition DescribeEntries : val := let: ("$ret0", "$ret1") := (let: "$a0" := ((let: "$a0" := (![raftpb.Entry] "e") in let: "$a1" := (![EntryFormatter] "f") in DescribeEntry "$a0" "$a1") + #" - ") in + "%go) in (bytes.Buffer__WriteString "buf") "$a0") in let: "$r0" := "$ret0" in let: "$r1" := "$ret1" in @@ -9225,7 +9225,7 @@ Definition DescribeReady : val := IsEmptyHardState "$a0")) then do: (let: "$a0" := (interface.make strings.Builder__mset_ptr "buf") in - let: "$a1" := #"HardState %s" in + let: "$a1" := #"HardState %s"%go in let: "$a2" := ((let: "$sl0" := (interface.make string__mset (let: "$a0" := (![raftpb.HardState] (struct.field_ref Ready "HardState" "rd")) in DescribeHardState "$a0")) in slice.literal interfaceT ["$sl0"])) in @@ -9238,7 +9238,7 @@ Definition DescribeReady : val := then do: (let: "$a0" := (interface.make strings.Builder__mset_ptr "buf") in let: "$a1" := #"ReadStates %v - " in + "%go in let: "$a2" := ((let: "$sl0" := (interface.make slice__mset (![sliceT] (struct.field_ref Ready "ReadStates" "rd"))) in slice.literal interfaceT ["$sl0"])) in fmt.Fprintf "$a0" "$a1" "$a2") @@ -9247,7 +9247,7 @@ Definition DescribeReady : val := slice.len "$a0") #(W64 0) then do: (let: "$a0" := #"Entries: - " in + "%go in (strings.Builder__WriteString "buf") "$a0");;; do: (let: "$a0" := (interface.make strings.Builder__mset_ptr "buf") in let: "$a1" := ((let: "$sl0" := (interface.make string__mset (let: "$a0" := (![sliceT] (struct.field_ref Ready "Entries" "rd")) in @@ -9261,7 +9261,7 @@ Definition DescribeReady : val := then do: (let: "$a0" := (interface.make strings.Builder__mset_ptr "buf") in let: "$a1" := #"Snapshot %s - " in + "%go in let: "$a2" := ((let: "$sl0" := (interface.make string__mset (let: "$a0" := (![raftpb.Snapshot] (struct.field_ref Ready "Snapshot" "rd")) in DescribeSnapshot "$a0")) in slice.literal interfaceT ["$sl0"])) in @@ -9271,7 +9271,7 @@ Definition DescribeReady : val := slice.len "$a0") #(W64 0) then do: (let: "$a0" := #"CommittedEntries: - " in + "%go in (strings.Builder__WriteString "buf") "$a0");;; do: (let: "$a0" := (interface.make strings.Builder__mset_ptr "buf") in let: "$a1" := ((let: "$sl0" := (interface.make string__mset (let: "$a0" := (![sliceT] (struct.field_ref Ready "CommittedEntries" "rd")) in @@ -9284,7 +9284,7 @@ Definition DescribeReady : val := slice.len "$a0") #(W64 0) then do: (let: "$a0" := #"Messages: - " in + "%go in (strings.Builder__WriteString "buf") "$a0");;; do: (let: "$range" := (![sliceT] (struct.field_ref Ready "Messages" "rd")) in slice.for_range raftpb.Message "$range" (λ: <> "msg", @@ -9301,27 +9301,27 @@ Definition DescribeReady : val := (if: int_gt ((strings.Builder__Len "buf") #()) #(W64 0) then return: (let: "$a0" := #"Ready MustSync=%t: - %s" in + %s"%go in let: "$a1" := ((let: "$sl0" := (interface.make bool__mset (![boolT] (struct.field_ref Ready "MustSync" "rd"))) in let: "$sl1" := (interface.make string__mset ((strings.Builder__String "buf") #())) in slice.literal interfaceT ["$sl0"; "$sl1"])) in fmt.Sprintf "$a0" "$a1") else do: #());;; - return: (#"")). + return: (#""%go)). -Definition EntryFormatter__mset : list (string * val) := [ +Definition EntryFormatter__mset : list (go_string * val) := [ ]. -Definition EntryFormatter__mset_ptr : list (string * val) := [ +Definition EntryFormatter__mset_ptr : list (go_string * val) := [ ]. -Definition entryEncodingSize__mset_ptr : list (string * val) := [ +Definition entryEncodingSize__mset_ptr : list (go_string * val) := [ ]. -Definition entryPayloadSize__mset : list (string * val) := [ +Definition entryPayloadSize__mset : list (go_string * val) := [ ]. -Definition entryPayloadSize__mset_ptr : list (string * val) := [ +Definition entryPayloadSize__mset_ptr : list (go_string * val) := [ ]. Definition define' : val := @@ -9373,7 +9373,7 @@ Definition initialize' : val := do: errors.initialize';;; do: (define' #());;; let: "$r0" := (ref_ty DefaultLogger (let: "$Logger" := (let: "$a0" := (interface.make os.File__mset_ptr (![ptrT] (globals.get os.Stderr #()))) in - let: "$a1" := #"raft" in + let: "$a1" := #"raft"%go in let: "$a2" := #(W64 log.LstdFlags) in log.New "$a0" "$a1" "$a2") in struct.make DefaultLogger [{ @@ -9382,7 +9382,7 @@ Definition initialize' : val := }])) in do: ((globals.get defaultLogger #()) <-[ptrT] "$r0");;; let: "$r0" := (ref_ty DefaultLogger (let: "$Logger" := (let: "$a0" := (![io.Writer] (globals.get io.Discard #())) in - let: "$a1" := #"" in + let: "$a1" := #""%go in let: "$a2" := #(W64 0) in log.New "$a0" "$a1" "$a2") in struct.make DefaultLogger [{ @@ -9398,44 +9398,44 @@ Definition initialize' : val := "Commit" ::= zero_val uint64T }]) in do: ((globals.get emptyState #()) <-[raftpb.HardState] "$r0");;; - let: "$r0" := (let: "$a0" := #"raft: stopped" in + let: "$r0" := (let: "$a0" := #"raft: stopped"%go in errors.New "$a0") in do: ((globals.get ErrStopped #()) <-[error] "$r0");;; - let: "$r0" := (let: "$a0" := #"raft proposal dropped" in + let: "$r0" := (let: "$a0" := #"raft proposal dropped"%go in errors.New "$a0") in do: ((globals.get ErrProposalDropped #()) <-[error] "$r0");;; let: "$r0" := (ref_ty lockedRand (struct.make lockedRand [{ "mu" ::= zero_val sync.Mutex }])) in do: ((globals.get globalRand #()) <-[ptrT] "$r0");;; - let: "$r0" := ((let: "$ar0" := #"StateFollower" in - let: "$ar1" := #"StateCandidate" in - let: "$ar2" := #"StateLeader" in - let: "$ar3" := #"StatePreCandidate" in + let: "$r0" := ((let: "$ar0" := #"StateFollower"%go in + let: "$ar1" := #"StateCandidate"%go in + let: "$ar2" := #"StateLeader"%go in + let: "$ar3" := #"StatePreCandidate"%go in array.literal ["$ar0"; "$ar1"; "$ar2"; "$ar3"])) in do: ((globals.get stmap #()) <-[arrayT 4 stringT] "$r0");;; - let: "$r0" := (let: "$a0" := #"break" in + let: "$r0" := (let: "$a0" := #"break"%go in errors.New "$a0") in do: ((globals.get errBreak #()) <-[error] "$r0");;; let: "$r0" := (ref_ty blackHole (struct.make blackHole [{ }])) in do: ((globals.get nopStepper #()) <-[ptrT] "$r0");;; - let: "$r0" := (let: "$a0" := #"raft: cannot step raft local message" in + let: "$r0" := (let: "$a0" := #"raft: cannot step raft local message"%go in errors.New "$a0") in do: ((globals.get ErrStepLocalMsg #()) <-[error] "$r0");;; - let: "$r0" := (let: "$a0" := #"raft: cannot step as peer not found" in + let: "$r0" := (let: "$a0" := #"raft: cannot step as peer not found"%go in errors.New "$a0") in do: ((globals.get ErrStepPeerNotFound #()) <-[error] "$r0");;; - let: "$r0" := (let: "$a0" := #"requested index is unavailable due to compaction" in + let: "$r0" := (let: "$a0" := #"requested index is unavailable due to compaction"%go in errors.New "$a0") in do: ((globals.get ErrCompacted #()) <-[error] "$r0");;; - let: "$r0" := (let: "$a0" := #"requested index is older than the existing snapshot" in + let: "$r0" := (let: "$a0" := #"requested index is older than the existing snapshot"%go in errors.New "$a0") in do: ((globals.get ErrSnapOutOfDate #()) <-[error] "$r0");;; - let: "$r0" := (let: "$a0" := #"requested entry at index is unavailable" in + let: "$r0" := (let: "$a0" := #"requested entry at index is unavailable"%go in errors.New "$a0") in do: ((globals.get ErrUnavailable #()) <-[error] "$r0");;; - let: "$r0" := (let: "$a0" := #"snapshot is temporarily unavailable" in + let: "$r0" := (let: "$a0" := #"snapshot is temporarily unavailable"%go in errors.New "$a0") in do: ((globals.get ErrSnapshotTemporarilyUnavailable #()) <-[error] "$r0");;; let: "$r0" := ((let: "$ar0" := #true in diff --git a/new/code/go_etcd_io/raft/v3/quorum.v b/new/code/go_etcd_io/raft/v3/quorum.v index 8abc5484d..3baeb2701 100644 --- a/new/code/go_etcd_io/raft/v3/quorum.v +++ b/new/code/go_etcd_io/raft/v3/quorum.v @@ -132,14 +132,14 @@ Definition Index__String : val := rec: "Index__String" "i" <> := exception_do (let: "i" := (ref_ty Index "i") in (if: (![Index] "i") = #(W64 math.MaxUint64) - then return: (#"∞") + then return: (#"∞"%go) else do: #());;; return: (let: "$a0" := (![Index] "i") in let: "$a1" := #(W64 10) in strconv.FormatUint "$a0" "$a1")). -Definition Index__mset : list (string * val) := [ - ("String", Index__String%V) +Definition Index__mset : list (go_string * val) := [ + ("String"%go, Index__String%V) ]. (* Describe returns a (multi-line) representation of the commit indexes for the @@ -152,7 +152,7 @@ Definition MajorityConfig__Describe : val := let: "l" := (ref_ty AckedIndexer "l") in (if: (let: "$a0" := (![MajorityConfig] "c") in map.len "$a0") = #(W64 0) - then return: (#"") + then return: (#""%go) else do: #());;; let: "n" := (ref_ty intT (zero_val intT)) in let: "$r0" := (let: "$a0" := (![MajorityConfig] "c") in @@ -210,10 +210,10 @@ Definition MajorityConfig__Describe : val := sort.Slice "$a0" "$a1");;; let: "buf" := (ref_ty strings.Builder (zero_val strings.Builder)) in do: (let: "$a0" := (interface.make strings.Builder__mset_ptr "buf") in - let: "$a1" := ((let: "$sl0" := (interface.make string__mset ((let: "$a0" := #" " in + let: "$a1" := ((let: "$sl0" := (interface.make string__mset ((let: "$a0" := #" "%go in let: "$a1" := (![intT] "n") in strings.Repeat "$a0" "$a1") + #" idx - ")) in + "%go)) in slice.literal interfaceT ["$sl0"])) in fmt.Fprint "$a0" "$a1");;; do: (let: "$range" := (![sliceT] "info") in @@ -225,23 +225,23 @@ Definition MajorityConfig__Describe : val := (if: (~ (![boolT] (struct.field_ref tup "ok" (slice.elem_ref tup (![sliceT] "info") (![intT] "i"))))) then do: (let: "$a0" := (interface.make strings.Builder__mset_ptr "buf") in - let: "$a1" := ((let: "$sl0" := (interface.make string__mset (#"?" + (let: "$a0" := #" " in + let: "$a1" := ((let: "$sl0" := (interface.make string__mset (#"?"%go + (let: "$a0" := #" "%go in let: "$a1" := (![intT] "n") in strings.Repeat "$a0" "$a1"))) in slice.literal interfaceT ["$sl0"])) in fmt.Fprint "$a0" "$a1") else do: (let: "$a0" := (interface.make strings.Builder__mset_ptr "buf") in - let: "$a1" := ((let: "$sl0" := (interface.make string__mset (((let: "$a0" := #"x" in + let: "$a1" := ((let: "$sl0" := (interface.make string__mset (((let: "$a0" := #"x"%go in let: "$a1" := (![intT] "bar") in - strings.Repeat "$a0" "$a1") + #">") + (let: "$a0" := #" " in + strings.Repeat "$a0" "$a1") + #">"%go) + (let: "$a0" := #" "%go in let: "$a1" := ((![intT] "n") - (![intT] "bar")) in strings.Repeat "$a0" "$a1"))) in slice.literal interfaceT ["$sl0"])) in fmt.Fprint "$a0" "$a1"));;; do: (let: "$a0" := (interface.make strings.Builder__mset_ptr "buf") in let: "$a1" := #" %5d (id=%d) - " in + "%go in let: "$a2" := ((let: "$sl0" := (interface.make Index__mset (![Index] (struct.field_ref tup "idx" (slice.elem_ref tup (![sliceT] "info") (![intT] "i"))))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref tup "id" (slice.elem_ref tup (![sliceT] "info") (![intT] "i"))))) in slice.literal interfaceT ["$sl0"; "$sl1"])) in @@ -305,7 +305,7 @@ Definition JointConfig__String : val := exception_do (let: "c" := (ref_ty JointConfig "c") in (if: int_gt (let: "$a0" := (![MajorityConfig] (array.elem_ref MajorityConfig (![JointConfig] "c") #(W64 1))) in map.len "$a0") #(W64 0) - then return: ((((MajorityConfig__String (![MajorityConfig] (array.elem_ref MajorityConfig (![JointConfig] "c") #(W64 0)))) #()) + #"&&") + ((MajorityConfig__String (![MajorityConfig] (array.elem_ref MajorityConfig (![JointConfig] "c") #(W64 1)))) #())) + then return: ((((MajorityConfig__String (![MajorityConfig] (array.elem_ref MajorityConfig (![JointConfig] "c") #(W64 0)))) #()) + #"&&"%go) + ((MajorityConfig__String (![MajorityConfig] (array.elem_ref MajorityConfig (![JointConfig] "c") #(W64 1)))) #())) else do: #());;; return: ((MajorityConfig__String (![MajorityConfig] (array.elem_ref MajorityConfig (![JointConfig] "c") #(W64 0)))) #())). @@ -386,28 +386,28 @@ Definition JointConfig__VoteResult : val := else do: #());;; return: (VotePending)). -Definition JointConfig__mset : list (string * val) := [ - ("CommittedIndex", JointConfig__CommittedIndex%V); - ("Describe", JointConfig__Describe%V); - ("IDs", JointConfig__IDs%V); - ("String", JointConfig__String%V); - ("VoteResult", JointConfig__VoteResult%V) +Definition JointConfig__mset : list (go_string * val) := [ + ("CommittedIndex"%go, JointConfig__CommittedIndex%V); + ("Describe"%go, JointConfig__Describe%V); + ("IDs"%go, JointConfig__IDs%V); + ("String"%go, JointConfig__String%V); + ("VoteResult"%go, JointConfig__VoteResult%V) ]. -Definition JointConfig__mset_ptr : list (string * val) := [ - ("CommittedIndex", (λ: "$recvAddr", +Definition JointConfig__mset_ptr : list (go_string * val) := [ + ("CommittedIndex"%go, (λ: "$recvAddr", JointConfig__CommittedIndex (![JointConfig] "$recvAddr") )%V); - ("Describe", (λ: "$recvAddr", + ("Describe"%go, (λ: "$recvAddr", JointConfig__Describe (![JointConfig] "$recvAddr") )%V); - ("IDs", (λ: "$recvAddr", + ("IDs"%go, (λ: "$recvAddr", JointConfig__IDs (![JointConfig] "$recvAddr") )%V); - ("String", (λ: "$recvAddr", + ("String"%go, (λ: "$recvAddr", JointConfig__String (![JointConfig] "$recvAddr") )%V); - ("VoteResult", (λ: "$recvAddr", + ("VoteResult"%go, (λ: "$recvAddr", JointConfig__VoteResult (![JointConfig] "$recvAddr") )%V) ]. @@ -437,40 +437,40 @@ Definition MajorityConfig__Slice : val := sort.Slice "$a0" "$a1");;; return: (![sliceT] "sl")). -Definition MajorityConfig__mset : list (string * val) := [ - ("CommittedIndex", MajorityConfig__CommittedIndex%V); - ("Describe", MajorityConfig__Describe%V); - ("Slice", MajorityConfig__Slice%V); - ("String", MajorityConfig__String%V); - ("VoteResult", MajorityConfig__VoteResult%V) +Definition MajorityConfig__mset : list (go_string * val) := [ + ("CommittedIndex"%go, MajorityConfig__CommittedIndex%V); + ("Describe"%go, MajorityConfig__Describe%V); + ("Slice"%go, MajorityConfig__Slice%V); + ("String"%go, MajorityConfig__String%V); + ("VoteResult"%go, MajorityConfig__VoteResult%V) ]. -Definition MajorityConfig__mset_ptr : list (string * val) := [ - ("CommittedIndex", (λ: "$recvAddr", +Definition MajorityConfig__mset_ptr : list (go_string * val) := [ + ("CommittedIndex"%go, (λ: "$recvAddr", MajorityConfig__CommittedIndex (![MajorityConfig] "$recvAddr") )%V); - ("Describe", (λ: "$recvAddr", + ("Describe"%go, (λ: "$recvAddr", MajorityConfig__Describe (![MajorityConfig] "$recvAddr") )%V); - ("Slice", (λ: "$recvAddr", + ("Slice"%go, (λ: "$recvAddr", MajorityConfig__Slice (![MajorityConfig] "$recvAddr") )%V); - ("String", (λ: "$recvAddr", + ("String"%go, (λ: "$recvAddr", MajorityConfig__String (![MajorityConfig] "$recvAddr") )%V); - ("VoteResult", (λ: "$recvAddr", + ("VoteResult"%go, (λ: "$recvAddr", MajorityConfig__VoteResult (![MajorityConfig] "$recvAddr") )%V) ]. -Definition tup__mset : list (string * val) := [ +Definition tup__mset : list (go_string * val) := [ ]. -Definition tup__mset_ptr : list (string * val) := [ +Definition tup__mset_ptr : list (go_string * val) := [ ]. -Definition Index__mset_ptr : list (string * val) := [ - ("String", (λ: "$recvAddr", +Definition Index__mset_ptr : list (go_string * val) := [ + ("String"%go, (λ: "$recvAddr", Index__String (![Index] "$recvAddr") )%V) ]. @@ -491,20 +491,20 @@ Definition mapAckIndexer__AckedIndex : val := do: ("ok" <-[boolT] "$r1");;; return: (![Index] "idx", ![boolT] "ok")). -Definition mapAckIndexer__mset : list (string * val) := [ - ("AckedIndex", mapAckIndexer__AckedIndex%V) +Definition mapAckIndexer__mset : list (go_string * val) := [ + ("AckedIndex"%go, mapAckIndexer__AckedIndex%V) ]. -Definition mapAckIndexer__mset_ptr : list (string * val) := [ - ("AckedIndex", (λ: "$recvAddr", +Definition mapAckIndexer__mset_ptr : list (go_string * val) := [ + ("AckedIndex"%go, (λ: "$recvAddr", mapAckIndexer__AckedIndex (![mapAckIndexer] "$recvAddr") )%V) ]. -Definition VoteResult__mset : list (string * val) := [ +Definition VoteResult__mset : list (go_string * val) := [ ]. -Definition VoteResult__mset_ptr : list (string * val) := [ +Definition VoteResult__mset_ptr : list (go_string * val) := [ ]. (* go: voteresult_string.go:7:6 *) @@ -529,11 +529,11 @@ Definition _unused : val := ])] "x") (VoteWon - #(W8 3)))) in do: "$r0"). -Definition _VoteResult_name : string := "VotePendingVoteLostVoteWon". +Definition _VoteResult_name : go_string := "VotePendingVoteLostVoteWon"%go. -Definition pkg_name' : string := "go.etcd.io/raft/v3/quorum". +Definition pkg_name' : go_string := "go.etcd.io/raft/v3/quorum". -Definition _VoteResult_index : (string * string) := (pkg_name', "_VoteResult_index"). +Definition _VoteResult_index : (go_string * go_string) := (pkg_name', "_VoteResult_index"%go). Definition define' : val := rec: "define'" <> := diff --git a/new/code/go_etcd_io/raft/v3/tracker.v b/new/code/go_etcd_io/raft/v3/tracker.v index d58281b38..4125e6d6f 100644 --- a/new/code/go_etcd_io/raft/v3/tracker.v +++ b/new/code/go_etcd_io/raft/v3/tracker.v @@ -15,10 +15,10 @@ Definition inflight : go_type := structT [ "bytes" :: uint64T ]. -Definition inflight__mset : list (string * val) := [ +Definition inflight__mset : list (go_string * val) := [ ]. -Definition inflight__mset_ptr : list (string * val) := [ +Definition inflight__mset_ptr : list (go_string * val) := [ ]. Definition Inflights : go_type := structT [ @@ -30,7 +30,7 @@ Definition Inflights : go_type := structT [ "buffer" :: sliceT ]. -Definition Inflights__mset : list (string * val) := [ +Definition Inflights__mset : list (go_string * val) := [ ]. (* grow the inflight buffer by doubling up to inflights.size. We grow on demand @@ -85,7 +85,7 @@ Definition Inflights__Add : val := let: "index" := (ref_ty uint64T "index") in (if: (Inflights__Full (![ptrT] "in")) #() then - do: (let: "$a0" := (interface.make string__mset #"cannot add into a Full inflights") in + do: (let: "$a0" := (interface.make string__mset #"cannot add into a Full inflights"%go) in Panic "$a0") else do: #());;; let: "next" := (ref_ty intT (zero_val intT)) in @@ -187,14 +187,14 @@ Definition Inflights__reset : val := let: "$r0" := #(W64 0) in do: ((struct.field_ref Inflights "bytes" (![ptrT] "in")) <-[uint64T] "$r0")). -Definition Inflights__mset_ptr : list (string * val) := [ - ("Add", Inflights__Add%V); - ("Clone", Inflights__Clone%V); - ("Count", Inflights__Count%V); - ("FreeLE", Inflights__FreeLE%V); - ("Full", Inflights__Full%V); - ("grow", Inflights__grow%V); - ("reset", Inflights__reset%V) +Definition Inflights__mset_ptr : list (go_string * val) := [ + ("Add"%go, Inflights__Add%V); + ("Clone"%go, Inflights__Clone%V); + ("Count"%go, Inflights__Count%V); + ("FreeLE"%go, Inflights__FreeLE%V); + ("Full"%go, Inflights__Full%V); + ("grow"%go, Inflights__grow%V); + ("reset"%go, Inflights__reset%V) ]. (* NewInflights sets up an Inflights that allows up to size inflight messages, @@ -232,7 +232,7 @@ Definition Progress : go_type := structT [ "IsLearner" :: boolT ]. -Definition Progress__mset : list (string * val) := [ +Definition Progress__mset : list (go_string * val) := [ ]. (* ResetState moves the Progress into the specified State, resetting MsgAppFlowPaused, @@ -344,7 +344,7 @@ Definition Progress__IsPaused : val := (if: "$sw" = StateSnapshot then return: (#true) else - do: (let: "$a0" := (interface.make string__mset #"unexpected state") in + do: (let: "$a0" := (interface.make string__mset #"unexpected state"%go) in Panic "$a0"))))). (* MaybeDecrTo adjusts the Progress to the receipt of a MsgApp rejection. The @@ -427,9 +427,9 @@ Definition Progress__SentCommit : val := let: "$r0" := (![uint64T] "commit") in do: ((struct.field_ref Progress "sentCommit" (![ptrT] "pr")) <-[uint64T] "$r0")). -Definition pkg_name' : string := "go.etcd.io/raft/v3/tracker". +Definition pkg_name' : go_string := "go.etcd.io/raft/v3/tracker". -Definition prstmap : (string * string) := (pkg_name', "prstmap"). +Definition prstmap : (go_string * go_string) := (pkg_name', "prstmap"%go). (* go: state.go:42:21 *) Definition StateType__String : val := @@ -437,8 +437,8 @@ Definition StateType__String : val := exception_do (let: "st" := (ref_ty StateType "st") in return: (![stringT] (array.elem_ref stringT (![arrayT 3 stringT] (globals.get prstmap #())) (![StateType] "st")))). -Definition StateType__mset : list (string * val) := [ - ("String", StateType__String%V) +Definition StateType__mset : list (go_string * val) := [ + ("String"%go, StateType__String%V) ]. (* SentEntries updates the progress on the given number of consecutive entries @@ -474,7 +474,7 @@ Definition Progress__SentEntries : val := do: ((struct.field_ref Progress "MsgAppFlowPaused" (![ptrT] "pr")) <-[boolT] "$r0") else do: #()) else - do: (let: "$a0" := (interface.make string__mset (let: "$a0" := #"sending append in unhandled state %s" in + do: (let: "$a0" := (interface.make string__mset (let: "$a0" := #"sending append in unhandled state %s"%go in let: "$a1" := ((let: "$sl0" := (interface.make StateType__mset (![StateType] (struct.field_ref Progress "State" (![ptrT] "pr")))) in slice.literal interfaceT ["$sl0"])) in fmt.Sprintf "$a0" "$a1")) in @@ -486,7 +486,7 @@ Definition Progress__String : val := exception_do (let: "pr" := (ref_ty ptrT "pr") in let: "buf" := (ref_ty strings.Builder (zero_val strings.Builder)) in do: (let: "$a0" := (interface.make strings.Builder__mset_ptr "buf") in - let: "$a1" := #"%s match=%d next=%d" in + let: "$a1" := #"%s match=%d next=%d"%go in let: "$a2" := ((let: "$sl0" := (interface.make StateType__mset (![StateType] (struct.field_ref Progress "State" (![ptrT] "pr")))) in let: "$sl1" := (interface.make uint64__mset (![uint64T] (struct.field_ref Progress "Match" (![ptrT] "pr")))) in let: "$sl2" := (interface.make uint64__mset (![uint64T] (struct.field_ref Progress "Next" (![ptrT] "pr")))) in @@ -495,21 +495,21 @@ Definition Progress__String : val := (if: ![boolT] (struct.field_ref Progress "IsLearner" (![ptrT] "pr")) then do: (let: "$a0" := (interface.make strings.Builder__mset_ptr "buf") in - let: "$a1" := ((let: "$sl0" := (interface.make string__mset #" learner") in + let: "$a1" := ((let: "$sl0" := (interface.make string__mset #" learner"%go) in slice.literal interfaceT ["$sl0"])) in fmt.Fprint "$a0" "$a1") else do: #());;; (if: (Progress__IsPaused (![ptrT] "pr")) #() then do: (let: "$a0" := (interface.make strings.Builder__mset_ptr "buf") in - let: "$a1" := ((let: "$sl0" := (interface.make string__mset #" paused") in + let: "$a1" := ((let: "$sl0" := (interface.make string__mset #" paused"%go) in slice.literal interfaceT ["$sl0"])) in fmt.Fprint "$a0" "$a1") else do: #());;; (if: (![uint64T] (struct.field_ref Progress "PendingSnapshot" (![ptrT] "pr"))) > #(W64 0) then do: (let: "$a0" := (interface.make strings.Builder__mset_ptr "buf") in - let: "$a1" := #" pendingSnap=%d" in + let: "$a1" := #" pendingSnap=%d"%go in let: "$a2" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] (struct.field_ref Progress "PendingSnapshot" (![ptrT] "pr")))) in slice.literal interfaceT ["$sl0"])) in fmt.Fprintf "$a0" "$a1" "$a2") @@ -517,7 +517,7 @@ Definition Progress__String : val := (if: (~ (![boolT] (struct.field_ref Progress "RecentActive" (![ptrT] "pr")))) then do: (let: "$a0" := (interface.make strings.Builder__mset_ptr "buf") in - let: "$a1" := ((let: "$sl0" := (interface.make string__mset #" inactive") in + let: "$a1" := ((let: "$sl0" := (interface.make string__mset #" inactive"%go) in slice.literal interfaceT ["$sl0"])) in fmt.Fprint "$a0" "$a1") else do: #());;; @@ -527,32 +527,32 @@ Definition Progress__String : val := (if: int_gt (![intT] "n") #(W64 0) then do: (let: "$a0" := (interface.make strings.Builder__mset_ptr "buf") in - let: "$a1" := #" inflight=%d" in + let: "$a1" := #" inflight=%d"%go in let: "$a2" := ((let: "$sl0" := (interface.make int__mset (![intT] "n")) in slice.literal interfaceT ["$sl0"])) in fmt.Fprintf "$a0" "$a1" "$a2");;; (if: (Inflights__Full (![ptrT] (struct.field_ref Progress "Inflights" (![ptrT] "pr")))) #() then do: (let: "$a0" := (interface.make strings.Builder__mset_ptr "buf") in - let: "$a1" := ((let: "$sl0" := (interface.make string__mset #"[full]") in + let: "$a1" := ((let: "$sl0" := (interface.make string__mset #"[full]"%go) in slice.literal interfaceT ["$sl0"])) in fmt.Fprint "$a0" "$a1") else do: #()) else do: #()));;; return: ((strings.Builder__String "buf") #())). -Definition Progress__mset_ptr : list (string * val) := [ - ("BecomeProbe", Progress__BecomeProbe%V); - ("BecomeReplicate", Progress__BecomeReplicate%V); - ("BecomeSnapshot", Progress__BecomeSnapshot%V); - ("CanBumpCommit", Progress__CanBumpCommit%V); - ("IsPaused", Progress__IsPaused%V); - ("MaybeDecrTo", Progress__MaybeDecrTo%V); - ("MaybeUpdate", Progress__MaybeUpdate%V); - ("ResetState", Progress__ResetState%V); - ("SentCommit", Progress__SentCommit%V); - ("SentEntries", Progress__SentEntries%V); - ("String", Progress__String%V) +Definition Progress__mset_ptr : list (go_string * val) := [ + ("BecomeProbe"%go, Progress__BecomeProbe%V); + ("BecomeReplicate"%go, Progress__BecomeReplicate%V); + ("BecomeSnapshot"%go, Progress__BecomeSnapshot%V); + ("CanBumpCommit"%go, Progress__CanBumpCommit%V); + ("IsPaused"%go, Progress__IsPaused%V); + ("MaybeDecrTo"%go, Progress__MaybeDecrTo%V); + ("MaybeUpdate"%go, Progress__MaybeUpdate%V); + ("ResetState"%go, Progress__ResetState%V); + ("SentCommit"%go, Progress__SentCommit%V); + ("SentEntries"%go, Progress__SentEntries%V); + ("String"%go, Progress__String%V) ]. Definition ProgressMap : go_type := mapT uint64T ptrT. @@ -586,25 +586,25 @@ Definition ProgressMap__String : val := let: "id" := ref_ty uint64T "id" in do: (let: "$a0" := (interface.make strings.Builder__mset_ptr "buf") in let: "$a1" := #"%d: %s - " in + "%go in let: "$a2" := ((let: "$sl0" := (interface.make uint64__mset (![uint64T] "id")) in let: "$sl1" := (interface.make Progress__mset_ptr (Fst (map.get (![ProgressMap] "m") (![uint64T] "id")))) in slice.literal interfaceT ["$sl0"; "$sl1"])) in fmt.Fprintf "$a0" "$a1" "$a2")));;; return: ((strings.Builder__String "buf") #())). -Definition ProgressMap__mset : list (string * val) := [ - ("String", ProgressMap__String%V) +Definition ProgressMap__mset : list (go_string * val) := [ + ("String"%go, ProgressMap__String%V) ]. -Definition ProgressMap__mset_ptr : list (string * val) := [ - ("String", (λ: "$recvAddr", +Definition ProgressMap__mset_ptr : list (go_string * val) := [ + ("String"%go, (λ: "$recvAddr", ProgressMap__String (![ProgressMap] "$recvAddr") )%V) ]. -Definition StateType__mset_ptr : list (string * val) := [ - ("String", (λ: "$recvAddr", +Definition StateType__mset_ptr : list (go_string * val) := [ + ("String"%go, (λ: "$recvAddr", StateType__String (![StateType] "$recvAddr") )%V) ]. @@ -624,7 +624,7 @@ Definition Config__String : val := exception_do (let: "c" := (ref_ty Config "c") in let: "buf" := (ref_ty strings.Builder (zero_val strings.Builder)) in do: (let: "$a0" := (interface.make strings.Builder__mset_ptr "buf") in - let: "$a1" := #"voters=%s" in + let: "$a1" := #"voters=%s"%go in let: "$a2" := ((let: "$sl0" := (interface.make quorum.JointConfig__mset (![quorum.JointConfig] (struct.field_ref Config "Voters" "c"))) in slice.literal interfaceT ["$sl0"])) in fmt.Fprintf "$a0" "$a1" "$a2");;; @@ -632,7 +632,7 @@ Definition Config__String : val := ])] (struct.field_ref Config "Learners" "c")) ≠ #null then do: (let: "$a0" := (interface.make strings.Builder__mset_ptr "buf") in - let: "$a1" := #" learners=%s" in + let: "$a1" := #" learners=%s"%go in let: "$a2" := ((let: "$sl0" := (interface.make string__mset ((quorum.MajorityConfig__String (![mapT uint64T (structT [ ])] (struct.field_ref Config "Learners" "c"))) #())) in slice.literal interfaceT ["$sl0"])) in @@ -642,7 +642,7 @@ Definition Config__String : val := ])] (struct.field_ref Config "LearnersNext" "c")) ≠ #null then do: (let: "$a0" := (interface.make strings.Builder__mset_ptr "buf") in - let: "$a1" := #" learners_next=%s" in + let: "$a1" := #" learners_next=%s"%go in let: "$a2" := ((let: "$sl0" := (interface.make string__mset ((quorum.MajorityConfig__String (![mapT uint64T (structT [ ])] (struct.field_ref Config "LearnersNext" "c"))) #())) in slice.literal interfaceT ["$sl0"])) in @@ -651,14 +651,14 @@ Definition Config__String : val := (if: ![boolT] (struct.field_ref Config "AutoLeave" "c") then do: (let: "$a0" := (interface.make strings.Builder__mset_ptr "buf") in - let: "$a1" := ((let: "$sl0" := (interface.make string__mset #" autoleave") in + let: "$a1" := ((let: "$sl0" := (interface.make string__mset #" autoleave"%go) in slice.literal interfaceT ["$sl0"])) in fmt.Fprint "$a0" "$a1") else do: #());;; return: ((strings.Builder__String "buf") #())). -Definition Config__mset : list (string * val) := [ - ("String", Config__String%V) +Definition Config__mset : list (go_string * val) := [ + ("String"%go, Config__String%V) ]. (* Clone returns a copy of the Config that shares no memory with the original. @@ -711,9 +711,9 @@ Definition Config__Clone : val := "LearnersNext" ::= "$LearnersNext" }])). -Definition Config__mset_ptr : list (string * val) := [ - ("Clone", Config__Clone%V); - ("String", (λ: "$recvAddr", +Definition Config__mset_ptr : list (go_string * val) := [ + ("Clone"%go, Config__Clone%V); + ("String"%go, (λ: "$recvAddr", Config__String (![Config] "$recvAddr") )%V) ]. @@ -726,8 +726,8 @@ Definition ProgressTracker : go_type := structT [ "MaxInflightBytes" :: uint64T ]. -Definition ProgressTracker__mset : list (string * val) := [ - ("String", (λ: "$recv", +Definition ProgressTracker__mset : list (go_string * val) := [ + ("String"%go, (λ: "$recv", Config__String (struct.field_get ProgressTracker "Config" "$recv") )%V) ]. @@ -753,8 +753,8 @@ Definition matchAckIndexer__AckedIndex : val := else do: #());;; return: (![uint64T] (struct.field_ref Progress "Match" (![ptrT] "pr")), #true)). -Definition matchAckIndexer__mset : list (string * val) := [ - ("AckedIndex", matchAckIndexer__AckedIndex%V) +Definition matchAckIndexer__mset : list (go_string * val) := [ + ("AckedIndex"%go, matchAckIndexer__AckedIndex%V) ]. (* Committed returns the largest log index known to be committed based on what @@ -983,23 +983,23 @@ Definition ProgressTracker__VoterNodes : val := sort.Slice "$a0" "$a1");;; return: (![sliceT] "nodes")). -Definition ProgressTracker__mset_ptr : list (string * val) := [ - ("Clone", (λ: "$recvAddr", +Definition ProgressTracker__mset_ptr : list (go_string * val) := [ + ("Clone"%go, (λ: "$recvAddr", Config__Clone (struct.field_ref ProgressTracker "Config" "$recvAddr") )%V); - ("Committed", ProgressTracker__Committed%V); - ("ConfState", ProgressTracker__ConfState%V); - ("IsSingleton", ProgressTracker__IsSingleton%V); - ("LearnerNodes", ProgressTracker__LearnerNodes%V); - ("QuorumActive", ProgressTracker__QuorumActive%V); - ("RecordVote", ProgressTracker__RecordVote%V); - ("ResetVotes", ProgressTracker__ResetVotes%V); - ("String", (λ: "$recvAddr", + ("Committed"%go, ProgressTracker__Committed%V); + ("ConfState"%go, ProgressTracker__ConfState%V); + ("IsSingleton"%go, ProgressTracker__IsSingleton%V); + ("LearnerNodes"%go, ProgressTracker__LearnerNodes%V); + ("QuorumActive"%go, ProgressTracker__QuorumActive%V); + ("RecordVote"%go, ProgressTracker__RecordVote%V); + ("ResetVotes"%go, ProgressTracker__ResetVotes%V); + ("String"%go, (λ: "$recvAddr", Config__String (![Config] (struct.field_ref ProgressTracker "Config" "$recvAddr")) )%V); - ("TallyVotes", ProgressTracker__TallyVotes%V); - ("Visit", ProgressTracker__Visit%V); - ("VoterNodes", ProgressTracker__VoterNodes%V) + ("TallyVotes"%go, ProgressTracker__TallyVotes%V); + ("Visit"%go, ProgressTracker__Visit%V); + ("VoterNodes"%go, ProgressTracker__VoterNodes%V) ]. (* MakeProgressTracker initializes a ProgressTracker. @@ -1036,8 +1036,8 @@ Definition MakeProgressTracker : val := do: ("p" <-[ProgressTracker] "$r0");;; return: (![ProgressTracker] "p")). -Definition matchAckIndexer__mset_ptr : list (string * val) := [ - ("AckedIndex", (λ: "$recvAddr", +Definition matchAckIndexer__mset_ptr : list (go_string * val) := [ + ("AckedIndex"%go, (λ: "$recvAddr", matchAckIndexer__AckedIndex (![matchAckIndexer] "$recvAddr") )%V) ]. @@ -1056,9 +1056,9 @@ Definition initialize' : val := do: sort.initialize';;; do: fmt.initialize';;; do: (define' #());;; - let: "$r0" := ((let: "$ar0" := #"StateProbe" in - let: "$ar1" := #"StateReplicate" in - let: "$ar2" := #"StateSnapshot" in + let: "$r0" := ((let: "$ar0" := #"StateProbe"%go in + let: "$ar1" := #"StateReplicate"%go in + let: "$ar2" := #"StateSnapshot"%go in array.literal ["$ar0"; "$ar1"; "$ar2"])) in do: ((globals.get prstmap #()) <-[arrayT 3 stringT] "$r0");;; let: "$r0" := (interface.make matchAckIndexer__mset #null) in diff --git a/new/golang/defn/globals.v b/new/golang/defn/globals.v index 29d706d99..f66b307e0 100644 --- a/new/golang/defn/globals.v +++ b/new/golang/defn/globals.v @@ -4,19 +4,19 @@ Module globals. Section defns. Context `{ffi_syntax}. -Local Definition encode_var_name (pkg_name var_name : string) : string := - pkg_name +:+ " " +:+ var_name. +Local Definition encode_var_name (pkg_name var_name : go_string) : go_string := + pkg_name ++ " "%go ++ var_name. -Definition get (x : string * string) : val := +Definition get (x : go_string * go_string) : val := λ: <>, match: GlobalGet #(encode_var_name x.1 x.2) with SOME "x" => "x" | NONE => #() #() end. -Definition put (x : string * string) : val := +Definition put (x : go_string * go_string) : val := λ: "y", GlobalPut #(encode_var_name x.1 x.2) "y". -Definition package_init (pkg_name : string) : val := +Definition package_init (pkg_name : go_string) : val := λ: "init", match: GlobalGet #pkg_name with SOME <> => #() diff --git a/new/golang/defn/interface.v b/new/golang/defn/interface.v index 66ee7417d..c39613642 100644 --- a/new/golang/defn/interface.v +++ b/new/golang/defn/interface.v @@ -5,7 +5,7 @@ Module interface. Section goose_lang. Context `{ffi_syntax}. -Definition get (f : string) : val := +Definition get (f : go_string) : val := λ: "v", let: "v" := (match: "v" with InjL "v" => "v" | InjR <> => #() end) in let: (("typeid", "val"), "mset") := "v" in @@ -15,7 +15,7 @@ Definition get (f : string) : val := end) "val" . -Local Definition make_def (mset : list (string*val)) : val := +Local Definition make_def (mset : list (go_string*val)) : val := λ: "v", InjL (#"NO TYPE IDS YET", "v", (struct.fields_val mset)). Program Definition make := unseal (_:seal (@make_def)). Obligation 1. by eexists. Qed. Definition make_unseal : make = _ := seal_eq _. @@ -33,10 +33,10 @@ End interface. (* method sets for primitive types are empty *) Section mset. Context `{ffi_syntax}. -Definition uint64__mset : list (string * val) := []. -Definition int__mset : list (string * val) := []. -Definition bool__mset : list (string * val) := []. -Definition string__mset : list (string * val) := []. -Definition slice__mset : list (string * val) := []. -Definition slice__mset_ptr : list (string * val) := []. +Definition uint64__mset : list (go_string * val) := []. +Definition int__mset : list (go_string * val) := []. +Definition bool__mset : list (go_string * val) := []. +Definition string__mset : list (go_string * val) := []. +Definition slice__mset : list (go_string * val) := []. +Definition slice__mset_ptr : list (go_string * val) := []. End mset. diff --git a/new/golang/defn/struct.v b/new/golang/defn/struct.v index 7c25750ae..993a87f33 100644 --- a/new/golang/defn/struct.v +++ b/new/golang/defn/struct.v @@ -2,15 +2,15 @@ From New.golang.defn Require Import mem list. (* FIXME: these notations don't work properly. *) Declare Scope struct_scope. -Notation "f :: t" := (@pair string go_type f%string t) : struct_scope. -Notation "f ::= v" := (PairV #(f%string) v%V) (at level 60) : val_scope. -Notation "f ::= v" := (Pair #(f%string) v%E) (at level 60) : expr_scope. +Notation "f :: t" := (@pair go_string go_type f%go t) : struct_scope. +Notation "f ::= v" := (PairV #(f%go) v%V) (at level 60) : val_scope. +Notation "f ::= v" := (Pair #(f%go) v%E) (at level 60) : expr_scope. Delimit Scope struct_scope with struct. Global Arguments structT _%_list%_struct. Module struct. Section goose_lang. -Infix "=?" := (String.eqb). +Infix "=?" := (ByteString.eqb). Context `{ffi_syntax}. diff --git a/new/golang/defn/typing.v b/new/golang/defn/typing.v index 31b03b933..91d32b593 100644 --- a/new/golang/defn/typing.v +++ b/new/golang/defn/typing.v @@ -1,5 +1,7 @@ From Perennial.goose_lang Require Export lang notation. +Definition go_string := byte_string. + Inductive go_type := (* Boolean *) | boolT @@ -19,7 +21,7 @@ Inductive go_type := | arrayT (n : nat) (elem : go_type) | sliceT | interfaceT -| structT (decls : list (string * go_type)) (* What if this were a gmap? *) +| structT (decls : list (go_string * go_type)) (* What if this were a gmap? *) | ptrT (* Untyped pointer; convenient to support recursion in structs *) | funcT . @@ -45,7 +47,9 @@ Program Definition to_val := unseal (_:seal (@to_val_def)). Obligation 1. by eex Definition to_val_unseal : to_val = _ := seal_eq _. Arguments to_val {_ _ _} v. (* Disable Notation "# l". *) -Global Notation "# x" := (to_val x). +Delimit Scope byte_string_scope with go. +Bind Scope byte_string_scope with go_string. +Global Notation "# x" := (to_val x%go). Global Notation "#" := to_val. (* One of [V] or [ty] should not be an evar before doing typeclass search *) @@ -84,7 +88,7 @@ Global Instance into_val_unit : IntoVal () := Global Instance into_val_bool : IntoVal bool := {| to_val_def := λ b, (LitV $ LitBool b) |}. -Global Instance into_val_string : IntoVal string := +Global Instance into_val_go_string : IntoVal go_string := {| to_val_def := λ s, (LitV $ LitString s) |}. Global Instance into_val_func : IntoVal func.t := @@ -99,7 +103,7 @@ End slice. Module interface. Section goose_lang. Context `{ffi_syntax}. - Record t := mk { v: val; mset: list (string * val) }. + Record t := mk { v: val; mset: list (go_string * val) }. (* FIXME: use the typeid to distinguish nil interface value from nil pointer used as a non-nil interface value. *) @@ -107,18 +111,18 @@ Section goose_lang. End goose_lang. End interface. -Fixpoint assocl_lookup {A} (f : string) (field_vals: list (string * A)) : option A := +Fixpoint assocl_lookup {A} (f : go_string) (field_vals: list (go_string * A)) : option A := match field_vals with | [] => None - | (f', v)::fs => if String.eqb f' f then Some v else assocl_lookup f fs + | (f', v)::fs => if ByteString.eqb f' f then Some v else assocl_lookup f fs end. Module struct. -Definition descriptor := list (string * go_type). +Definition descriptor := list (go_string * go_type). Section goose_lang. Context `{ffi_syntax}. - Fixpoint fields_val_def (m : list (string * val)) : val := + Fixpoint fields_val_def (m : list (go_string * val)) : val := match m with | [] => InjLV #() | (f, v) :: tl => InjRV ((#f, v), fields_val_def tl) @@ -146,7 +150,7 @@ Proof. solve_decision. Qed. Global Instance into_val_interface `{ffi_syntax} : IntoVal interface.t := {| to_val_def (i: interface.t) := - InjLV (#"NO TYPE IDS YET", i.(interface.v), (struct.fields_val i.(interface.mset))) + InjLV (#"NO TYPE IDS YET", i.(interface.v), (struct.fields_val i.(interface.mset)))%V |}. End instances. @@ -177,7 +181,7 @@ Section val_types. | uint32T => #(W32 0) | uint64T => #(W64 0) - | stringT => #"" + | stringT => #""%V | arrayT n elem => Vector.fold_right PairV (vreplicate n (zero_val_def elem)) #() | sliceT => #slice.nil | structT decls => fold_right PairV #() (fmap (zero_val_def ∘ snd) decls) diff --git a/new/golang/theory/defer.v b/new/golang/theory/defer.v index e75cd8624..d8da04c3d 100644 --- a/new/golang/theory/defer.v +++ b/new/golang/theory/defer.v @@ -9,7 +9,7 @@ Section proof. defer ↦ (func.mk <> <> #())%V -∗ WP (let: "$func_ret" := exception_do (subst "$defer" #defer e) in ![funcT] #defer #();; "$func_ret") {{ Φ }}) -∗ - WP (wrap_defer #(func.mk <> "$defer" e)) {{ Φ }}. + WP (wrap_defer #(func.mk <> ("$defer" : string) e)) {{ Φ }}. Proof. iIntros "Hwp". wp_call. diff --git a/new/golang/theory/globals.v b/new/golang/theory/globals.v index 6f6315364..36ba4fea9 100644 --- a/new/golang/theory/globals.v +++ b/new/golang/theory/globals.v @@ -5,9 +5,9 @@ From Coq Require Import Ascii. Class goGlobals_preG `{ffi_syntax} (Σ: gFunctors) : Set := { - #[global] go_globals_inG :: ghost_mapG Σ (string * string) loc ; - #[global] go_package_initialized_inG :: ghost_mapG Σ string () ; - #[global] go_access_prev_inG :: ghost_varG Σ (option (gmap string val)) ; + #[global] go_globals_inG :: ghost_mapG Σ (go_string * go_string) loc ; + #[global] go_package_initialized_inG :: ghost_mapG Σ go_string () ; + #[global] go_access_prev_inG :: ghost_varG Σ (option (gmap go_string val)) ; }. Class goGlobalsGS `{ffi_syntax} Σ : Set := @@ -19,7 +19,7 @@ Class goGlobalsGS `{ffi_syntax} Σ : Set := }. Definition goGlobalsΣ `{ffi_syntax} : gFunctors := - #[ghost_mapΣ (string * string) loc ; ghost_mapΣ string (); ghost_varΣ (option (gmap string val))]. + #[ghost_mapΣ (go_string * go_string) loc ; ghost_mapΣ go_string (); ghost_varΣ (option (gmap go_string val))]. Global Instance subG_goGlobalsG `{ffi_syntax} {Σ} : subG goGlobalsΣ Σ → goGlobals_preG Σ. Proof. solve_inG. Qed. @@ -28,10 +28,12 @@ Section definitions_and_lemmas. Context `{ffi_sem: ffi_semantics} `{!ffi_interp ffi} `{!heapGS Σ}. Context `{!goGlobalsGS Σ}. -Fixpoint is_valid_package_name (pkg_name : string) : bool := +Fixpoint is_valid_package_name (pkg_name : go_string) : bool := match pkg_name with - | EmptyString => true - | String a s => negb (Ascii.eqb a " "%char) && is_valid_package_name s + | [] => true + | {| Naive.unsigned := 32; Naive._unsigned_in_range := eq_refl |} :: _ => false + (* Check " "%go. *) + | _ :: pkg_name => is_valid_package_name pkg_name end. Local Notation encode_var_name := (globals.globals.encode_var_name). @@ -39,7 +41,7 @@ Local Notation encode_var_name := (globals.globals.encode_var_name). (* The only concurrent access to globals is to read the address of global variables, so that's the only thing this invariant is concerned with. *) Local Definition own_globals_inv : iProp Σ := - ∃ g (addrs : gmap (string * string) loc), + ∃ g (addrs : gmap (go_string * go_string) loc), "Hglobals_i" ∷ own_globals (DfracOwn (1/2)) g ∗ "Haddrs" ∷ ghost_map_auth go_globals_name 1%Qp addrs ∗ "%Hvars" ∷ (⌜ ∀ pkg_name var_name, @@ -50,9 +52,9 @@ Local Definition is_globals_inv : iProp Σ := inv nroot own_globals_inv. (* This must be owned by the `init` thread. *) -Definition own_globals_tok_def (pending_packages : gset string) - (pkg_postconds : gmap string (iProp Σ)): iProp Σ := - ∃ g (pkg_initialized : gmap string ()), +Definition own_globals_tok_def (pending_packages : gset go_string) + (pkg_postconds : gmap go_string (iProp Σ)): iProp Σ := + ∃ g (pkg_initialized : gmap go_string ()), "Hglobals" ∷ own_globals (DfracOwn (1/2)) g ∗ "Hacc" ∷ ghost_var go_access_prev_state_name 1%Qp None ∗ "%Hpkg" ∷ (⌜ ∀ pkg_name, @@ -73,27 +75,27 @@ Definition own_globals_tok_def (pending_packages : gset string) Program Definition own_globals_tok := unseal (_:seal (@own_globals_tok_def)). Obligation 1. by eexists. Qed. Definition own_globals_tok_unseal : own_globals_tok = _ := seal_eq _. -Definition own_package_post_toks_def (used_pkgs : gset string) : iProp Σ := +Definition own_package_post_toks_def (used_pkgs : gset go_string) : iProp Σ := ghost_map_auth go_package_postcond_tok_name 1%Qp (gset_to_gmap () used_pkgs). Program Definition own_package_post_toks := unseal (_:seal (@own_package_post_toks_def)). Obligation 1. by eexists. Qed. Definition own_package_post_toks_unseal : own_package_post_toks = _ := seal_eq _. -Definition own_package_post_tok_def (pkg_name : string) : iProp Σ := +Definition own_package_post_tok_def (pkg_name : go_string) : iProp Σ := pkg_name ↪[go_package_postcond_tok_name] (). Program Definition own_package_post_tok := unseal (_:seal (@own_package_post_tok_def)). Obligation 1. by eexists. Qed. Definition own_package_post_tok_unseal : own_package_post_tok = _ := seal_eq _. -Definition is_initialized_def (pkg_name : string) (P : iProp Σ) : iProp Σ := +Definition is_initialized_def (pkg_name : go_string) (P : iProp Σ) : iProp Σ := inv nroot (pkg_name ↪[go_package_postcond_tok_name] () ∨ P). Program Definition is_initialized := unseal (_:seal (@is_initialized_def)). Obligation 1. by eexists. Qed. Definition is_initialized_unseal : is_initialized = _ := seal_eq _. -Definition is_global_addr_def (var_id : string * string) (addr : loc) : iProp Σ := +Definition is_global_addr_def (var_id : go_string * go_string) (addr : loc) : iProp Σ := is_globals_inv ∗ var_id ↪[go_globals_name]□ addr ∗ ⌜ is_valid_package_name var_id.1 ⌝. Program Definition is_global_addr := unseal (_:seal (@is_global_addr_def)). Obligation 1. by eexists. Qed. Definition is_global_addr_unseal : is_global_addr = _ := seal_eq _. -Definition own_unused_vars_def (pkg_name : string) (used_var_names : gset string) : iProp Σ := +Definition own_unused_vars_def (pkg_name : go_string) (used_var_names : gset go_string) : iProp Σ := ∃ g_old var_addrs, "Hglobals" ∷ own_globals (DfracOwn (1/2)) ((kmap (encode_var_name pkg_name) var_addrs) ∪ g_old) ∗ "Hacc" ∷ ghost_var go_access_prev_state_name (1/2)%Qp (Some g_old) ∗ @@ -120,7 +122,7 @@ Global Instance is_initialized_persistent a b: Persistent (is_initialized a b). Proof. unseal. apply _. Qed. -Lemma own_package_post_toks_get (pkg_name : string) (used_pkgs : gset string) : +Lemma own_package_post_toks_get (pkg_name : go_string) (used_pkgs : gset go_string) : pkg_name ∉ used_pkgs → own_package_post_toks used_pkgs ==∗ own_package_post_tok pkg_name ∗ @@ -248,7 +250,7 @@ Proof. iModIntro. wp_pures. by iApply "HΦ". Qed. -Lemma wp_package_init pending postconds (pkg_name : string) (init_func : val) P Φ : +Lemma wp_package_init pending postconds (pkg_name : go_string) (init_func : val) P Φ : is_valid_package_name pkg_name → postconds !! pkg_name = Some P → pkg_name ∉ pending → @@ -272,7 +274,7 @@ Proof. rewrite [in GlobalGet _]to_val_unseal. iApply (wp_GlobalGet with "[$]"). iNext. iIntros "Hglobals". - destruct (g !! pkg_name) eqn:Hlookup. + destruct (lookup pkg_name g) eqn:Hlookup; rewrite Hlookup. { (* don't bother running init *) wp_pures. pose proof (Hpkg pkg_name ltac:(done)) as Hpkg'. @@ -283,6 +285,7 @@ Proof. iDestruct (big_sepM_lookup with "Hinited") as "H". { done. } rewrite Hpost /=. + wp_pures. iApply "HΦ". { iFrame "#". } iFrame "∗#%". @@ -401,15 +404,15 @@ End definitions_and_lemmas. Section init. Context `{ffi_sem: ffi_semantics} `{!ffi_interp ffi} `{!heapGS Σ}. -Lemma go_global_init (posts : ∀ {H : goGlobalsGS Σ}, gmap string (iProp Σ)) +Lemma go_global_init (posts : ∀ {H : goGlobalsGS Σ}, gmap go_string (iProp Σ)) {hT: goGlobals_preG Σ} : ⊢ own_globals (DfracOwn 1) ∅ ={⊤}=∗ ∃ (H : goGlobalsGS Σ), own_package_post_toks ∅ ∗ own_globals_tok ∅ posts. Proof. - iMod (ghost_map_alloc (∅ : gmap (string * string) loc)) as (new_globals_name) "[Haddrs _]". - iMod (ghost_map_alloc (∅ : gmap string ())) as (new_package_postcond_name) "[Hpost _]". + iMod (ghost_map_alloc (∅ : gmap (go_string * go_string) loc)) as (new_globals_name) "[Haddrs _]". + iMod (ghost_map_alloc (∅ : gmap go_string ())) as (new_package_postcond_name) "[Hpost _]". iMod (ghost_var_alloc None) as (new_access_prev_state_name) "Hacc". iIntros "[Hg Hg2]". iExists (GoGlobalsGS _ _ _ _ _ _). diff --git a/new/golang/theory/interface.v b/new/golang/theory/interface.v index 8100a7ae5..d1c30515a 100644 --- a/new/golang/theory/interface.v +++ b/new/golang/theory/interface.v @@ -5,7 +5,7 @@ From New.golang.defn Require Import interface. Section wps. Context `{sem: ffi_semantics} `{!ffi_interp ffi} `{!heapGS Σ}. -Global Instance wp__interface_get (i : interface.t) (method : string) : +Global Instance wp__interface_get (i : interface.t) (method : go_string) : PureWp (True) (interface.get method #i) (match (assocl_lookup method i.(interface.mset)) with | None => (App #() i.(interface.v)) @@ -18,7 +18,7 @@ Proof. destruct assocl_lookup; wp_pures; rewrite ?to_val_unseal /=; by iApply "Hwp". Qed. -Global Instance wp_interface_make (v : val) (mset : list (string * val)) : +Global Instance wp_interface_make (v : val) (mset : list (go_string * val)) : PureWp (True) (interface.make mset v) #(interface.mk v mset). Proof. iIntros (?????) "Hwp". diff --git a/new/golang/theory/mem.v b/new/golang/theory/mem.v index 47a099a9a..13cfad91a 100644 --- a/new/golang/theory/mem.v +++ b/new/golang/theory/mem.v @@ -200,7 +200,7 @@ Section goose_lang. + iFrame. - (* struct *) rewrite go_type_size_unseal /= in Hlen. - iInduction d as [|[]] "IH2"; simpl in *. + iInduction d as [|[a]] "IH2"; simpl in *. { exfalso. lia. } rewrite struct.val_aux_unseal /=. destruct (decide (go_type_size_def g = O)). diff --git a/new/golang/theory/proofmode.v b/new/golang/theory/proofmode.v index 7fb7ecb57..a923a65ac 100644 --- a/new/golang/theory/proofmode.v +++ b/new/golang/theory/proofmode.v @@ -174,7 +174,7 @@ Proof. rewrite to_val_unseal. apply (pure_exec_pure_wp O). solve_pure_exec. Qed. Global Instance wp_w8_s_to_w8 (v : w8) : PureWp True (s_to_w8 #v) #(W8 $ sint.Z v). Proof. rewrite to_val_unseal. apply (pure_exec_pure_wp O). solve_pure_exec. Qed. -Global Instance wp_w8_to_string (v : w8) : PureWp True (to_string #v) #(u8_to_string v). +Global Instance wp_w8_to_string (v : w8) : PureWp True (to_string #v) #([v]). Proof. rewrite to_val_unseal. apply (pure_exec_pure_wp O). solve_pure_exec. Qed. (* bool unop *) @@ -182,11 +182,11 @@ Global Instance wp_bool_neg (b : bool) : PureWp True (~ #b) #(negb b). Proof. rewrite to_val_unseal. apply (pure_exec_pure_wp O). solve_pure_exec. Qed. (* string unop *) -Global Instance wp_StringLength (s : string) : PureWp True (StringLength #s) #(W64 $ String.length s). +Global Instance wp_StringLength (s : go_string) : PureWp True (StringLength #s) #(W64 $ length s). Proof. rewrite to_val_unseal. apply (pure_exec_pure_wp O). solve_pure_exec. Qed. -Global Instance wp_IsNoStringOverflow (s : string) : PureWp True (IsNoStringOverflow #s) - #(bool_decide ((String.length s) < 2^64)). +Global Instance wp_IsNoStringOverflow (s : go_string) : PureWp True (IsNoStringOverflow #s) + #(bool_decide ((length s) < 2^64)). Proof. rewrite to_val_unseal. apply (pure_exec_pure_wp O). solve_pure_exec. Qed. (** Binops *) @@ -284,7 +284,7 @@ Proof. - rewrite /bin_op_eval decide_False // b /= in H0. by Transitions.monad_inv. Qed. -Global Instance wp_string_binop op (v1 v2 v : string) : +Global Instance wp_string_binop op (v1 v2 v : go_string) : PureWp (op ≠ EqOp ∧ bin_op_eval_string op v1 v2 = Some v) (BinOp op #v1 #v2) #v | 1. Proof. rewrite to_val_unseal. apply (pure_exec_pure_wp O). @@ -299,24 +299,24 @@ Proof. rewrite to_val_unseal. apply (pure_exec_pure_wp O). solve_pure_exec. Qed. (* string lookup ops *) -Global Instance wp_StringGet_w64 (s : string) (i : w64) (v : w8) : - PureWp (string_to_bytes s !! uint.nat i = Some v) (StringGet #s #i) #v. +Global Instance wp_StringGet_w64 (s : go_string) (i : w64) (v : w8) : + PureWp (s !! uint.nat i = Some v) (StringGet #s #i) #v. Proof. rewrite to_val_unseal. apply (pure_exec_pure_wp O). solve_pure_exec. - rewrite /bin_op_eval /= H /=. Transitions.monad_simpl. - rewrite /bin_op_eval /= H /= in H1. Transitions.monad_inv. done. Qed. -Global Instance wp_StringGet_w32 (s : string) (i : w32) (v : w8) : - PureWp (string_to_bytes s !! uint.nat i = Some v) (StringGet #s #i) #v. +Global Instance wp_StringGet_w32 (s : go_string) (i : w32) (v : w8) : + PureWp (s !! uint.nat i = Some v) (StringGet #s #i) #v. Proof. rewrite to_val_unseal. apply (pure_exec_pure_wp O). solve_pure_exec. - rewrite /bin_op_eval /= H /=. Transitions.monad_simpl. - rewrite /bin_op_eval /= H /= in H1. Transitions.monad_inv. done. Qed. -Global Instance wp_StringGet_w8 (s : string) (i : w8) (v : w8) : - PureWp (string_to_bytes s !! uint.nat i = Some v) (StringGet #s #i) #v. +Global Instance wp_StringGet_w8 (s : go_string) (i : w8) (v : w8) : + PureWp (s !! uint.nat i = Some v) (StringGet #s #i) #v. Proof. rewrite to_val_unseal. apply (pure_exec_pure_wp O). solve_pure_exec. - rewrite /bin_op_eval /= H /=. Transitions.monad_simpl. diff --git a/new/golang/theory/struct.v b/new/golang/theory/struct.v index 3de8b7478..b1c5875e4 100644 --- a/new/golang/theory/struct.v +++ b/new/golang/theory/struct.v @@ -9,7 +9,7 @@ Section goose_lang. Context `{ffi_syntax}. Implicit Types (d : struct.descriptor). -Infix "=?" := (String.eqb). +Infix "=?" := (ByteString.eqb). (* FIXME: what does _f mean? Want better name. *) Definition field_get_f t f0: val -> val := @@ -84,7 +84,7 @@ Global Hint Extern 3 (struct.Wf (structT ?d)) => exact (proj_descriptor_wf d) : Section lemmas. Context `{heapGS Σ}. -Class IntoValStructField (f : string) (t : go_type) {V Vf : Type} {tf} +Class IntoValStructField (f : go_string) (t : go_type) {V Vf : Type} {tf} (field_proj : V → Vf) `{!IntoVal V} `{!IntoVal Vf} `{!IntoValTyped Vf tf} @@ -96,7 +96,9 @@ Class IntoValStructField (f : string) (t : go_type) {V Vf : Type} {tf} Definition struct_fields `{!IntoVal V} `{!IntoValTyped V t} l dq (fs : struct.descriptor) (v : V) : iProp Σ := [∗ list] '(f, _) ∈ fs, - ∀ `(H:IntoValStructField f t V Vf tf field_proj), ("H" +:+ f) ∷ l ↦s[t :: f]{dq} (field_proj v). + ∀ `(H:IntoValStructField f t V Vf tf field_proj), ("H" +:+ + (String.string_of_list_byte $ + ByteString.print_string f)) ∷ l ↦s[t :: f]{dq} (field_proj v). Lemma struct_val_inj d fvs1 fvs2 : struct.val_aux (structT d) fvs1 = struct.val_aux (structT d) fvs2 → @@ -182,7 +184,7 @@ Definition is_structT (t : go_type) : Prop := | _ => False end. -Global Instance wp_struct_fields_cons_nil (k : string) (l : list (string * val)) (v : val) : +Global Instance wp_struct_fields_cons_nil (k : go_string) (l : list (go_string * val)) (v : val) : PureWp True (list.Cons (PairV #k v) (struct.fields_val l)) (struct.fields_val ((pair k v) :: l)) @@ -193,7 +195,7 @@ Proof. wp_call_lc "?". by iApply "HΦ". Qed. -Global Instance wp_struct_fields_cons (k : string) (l : list (string * val)) (v : val) : +Global Instance wp_struct_fields_cons (k : go_string) (l : list (go_string * val)) (v : val) : PureWp True (list.Cons (PairV #k v) (struct.fields_val l)) (struct.fields_val ((pair k v) :: l)) @@ -204,7 +206,7 @@ Proof. wp_call_lc "?". by iApply "HΦ". Qed. -Global Instance wp_struct_assocl_lookup (k : string) (l : list (string * val)) : +Global Instance wp_struct_assocl_lookup (k : go_string) (l : list (go_string * val)) : PureWp True (struct.assocl_lookup #k (struct.fields_val l)) (match (assocl_lookup k l) with | None => InjLV #() | Some v => InjRV v end) @@ -226,21 +228,22 @@ Proof. rewrite bool_decide_eq_true in Heqb. subst. wp_pures. - rewrite (String.eqb_refl). + rewrite /ByteString.eqb bool_decide_true //. by iApply "HΦ". } { rewrite bool_decide_eq_false in Heqb. wp_pures. iApply "IH". - destruct (s =? _)%string eqn:Hx. - { exfalso. apply Heqb. repeat f_equal. symmetry. by apply String.eqb_eq. } + destruct (ByteString.eqb g _)%go eqn:Hx. + { exfalso. apply Heqb. repeat f_equal. symmetry. + rewrite /ByteString.eqb bool_decide_eq_true // in Hx. } by iApply "HΦ". } } Qed. -Definition wp_struct_make (t : go_type) (l : list (string*val)) : +Definition wp_struct_make (t : go_type) (l : list (go_string*val)) : PureWp (is_structT t) (struct.make t (struct.fields_val l)) (struct.val_aux t l). diff --git a/new/golang/theory/typing.v b/new/golang/theory/typing.v index 1c638abd2..208c92718 100644 --- a/new/golang/theory/typing.v +++ b/new/golang/theory/typing.v @@ -12,11 +12,9 @@ Module struct. Section goose_lang. Context `{ffi_syntax}. - Infix "=?" := (String.eqb). - - Definition val_aux_def (t : go_type) (field_vals: list (string*val)): val := + Definition val_aux_def (t : go_type) (field_vals: list (go_string*val)): val := match t with - | structT d => (fix val_struct (fs : list (string*go_type)) := + | structT d => (fix val_struct (fs : list (go_string*go_type)) := match fs with | [] => (#()) | (f,ft)::fs => (default (zero_val ft) (assocl_lookup f field_vals), val_struct fs)%V @@ -29,9 +27,9 @@ End goose_lang. End struct. Declare Scope struct_scope. -Notation "f :: t" := (@pair string go_type f%string t) : struct_scope. -Notation "f ::= v" := (@pair string val f%string v%V) (at level 60) : val_scope. -Notation "f ::= v" := (@pair string expr f%string v%E) (at level 60) : expr_scope. +Notation "f :: t" := (@pair go_string go_type f%go t) : struct_scope. +Notation "f ::= v" := (@pair go_string val f%go v%V) (at level 60) : val_scope. +Notation "f ::= v" := (@pair go_string expr f%go v%E) (at level 60) : expr_scope. Delimit Scope struct_scope with struct. (** * Pure Coq reasoning principles *) @@ -42,7 +40,7 @@ Program Definition go_type_ind := λ (P : go_type → Prop) (f : P boolT) (f0 : P uint8T) (f1 : P uint16T) (f2 : P uint32T) (f3 : P uint64T) (f4 : P stringT) (f5 : ∀ (n : nat) (elem : go_type), P elem → P (arrayT n elem)) (f6 : P sliceT) (f7 : P interfaceT) - (f8 : ∀ (decls : list (string * go_type)) (Hfields : ∀ t, In t decls.*2 → P t), P (structT decls)) + (f8 : ∀ (decls : list (go_string * go_type)) (Hfields : ∀ t, In t decls.*2 → P t), P (structT decls)) (f9 : P ptrT) (f10 : P funcT), fix F (g : go_type) : P g := match g as g0 return (P g0) with @@ -81,7 +79,7 @@ destruct a. apply Forall_cons. split. | has_go_type_uint16 : has_go_type #null uint16T | has_go_type_uint8 (x : w8) : has_go_type #x uint8T - | has_go_type_string (s : string) : has_go_type #s stringT + | has_go_type_string (s : go_string) : has_go_type #s stringT | has_go_type_slice (s : slice.t) : has_go_type (#s) sliceT | has_go_type_interface (i : interface.t) : has_go_type (#i) interfaceT @@ -310,7 +308,7 @@ Ltac2 solve_has_go_type_step () := Std.indcl_as := None; Std.indcl_in := None } ] None - | [ h : (@eq (string * go_type) (_, _) _) |- _ ] => + | [ h : (@eq (go_string * go_type) (_, _) _) |- _ ] => Std.inversion Std.FullInversionClear (Std.ElimOnIdent h) None None; cbn end. Ltac solve_has_go_type := repeat ltac2:(solve_has_go_type_step ()). @@ -348,11 +346,12 @@ Next Obligation. solve_has_go_type. Qed. Next Obligation. rewrite zero_val_eq //. Qed. Next Obligation. rewrite to_val_unseal => ?? [=] //. Qed. -Program Global Instance into_val_typed_string : IntoValTyped string stringT := -{| default_val := "" |}. +Program Global Instance into_val_typed_string : IntoValTyped go_string stringT := +{| default_val := ""%go |}. Next Obligation. solve_has_go_type. Qed. Next Obligation. rewrite zero_val_eq //. Qed. Next Obligation. rewrite to_val_unseal => ?? [=] //. Qed. +Eval simpl in (default_val go_string). Program Global Instance into_val_typed_slice : IntoValTyped slice.t sliceT := {| default_val := slice.nil |}. diff --git a/new/proof/structs/github_com/mit_pdos/gokv/asyncfile.v b/new/proof/structs/github_com/mit_pdos/gokv/asyncfile.v index e930ac150..227f0643e 100644 --- a/new/proof/structs/github_com/mit_pdos/gokv/asyncfile.v +++ b/new/proof/structs/github_com/mit_pdos/gokv/asyncfile.v @@ -10,7 +10,7 @@ Context `{ffi_syntax}. Record t := mk { mu : loc; data : slice.t; - filename : string; + filename : go_string; index : w64; indexCond : loc; durableIndex : w64; diff --git a/new_code_axioms/bytes.v b/new_code_axioms/bytes.v index c79b70922..44ea58748 100644 --- a/new_code_axioms/bytes.v +++ b/new_code_axioms/bytes.v @@ -5,9 +5,9 @@ Section axioms. Context `{ffi_syntax}. Axiom Buffer : go_type. -Axiom Buffer__mset : list (string * val). -Axiom Buffer__mset_ptr : list (string * val). -Axiom ErrTooLarge : (string * string). +Axiom Buffer__mset : list (go_string * val). +Axiom Buffer__mset_ptr : list (go_string * val). +Axiom ErrTooLarge : (go_string * go_string). Axiom Buffer__Bytes : val. Axiom Buffer__AvailableBuffer : val. Axiom Buffer__String : val. @@ -87,8 +87,8 @@ Axiom Clone : val. Axiom CutPrefix : val. Axiom CutSuffix : val. Axiom Reader : go_type. -Axiom Reader__mset : list (string * val). -Axiom Reader__mset_ptr : list (string * val). +Axiom Reader__mset : list (go_string * val). +Axiom Reader__mset_ptr : list (go_string * val). Axiom Reader__Len : val. Axiom Reader__Size : val. Axiom Reader__Read : val. diff --git a/new_code_axioms/context.v b/new_code_axioms/context.v index d5c1d78ba..21dc795db 100644 --- a/new_code_axioms/context.v +++ b/new_code_axioms/context.v @@ -5,10 +5,10 @@ Section axioms. Context `{ffi_syntax}. Axiom Context : go_type. -Axiom Context__mset : list (string * val). -Axiom Context__mset_ptr : list (string * val). -Axiom Canceled : (string * string). -Axiom DeadlineExceeded : (string * string). +Axiom Context__mset : list (go_string * val). +Axiom Context__mset_ptr : list (go_string * val). +Axiom Canceled : (go_string * go_string). +Axiom DeadlineExceeded : (go_string * go_string). Axiom deadlineExceededError__Error : val. Axiom deadlineExceededError__Timeout : val. Axiom deadlineExceededError__Temporary : val. @@ -21,12 +21,12 @@ Axiom todoCtx__String : val. Axiom Background : val. Axiom TODO : val. Axiom CancelFunc : go_type. -Axiom CancelFunc__mset : list (string * val). -Axiom CancelFunc__mset_ptr : list (string * val). +Axiom CancelFunc__mset : list (go_string * val). +Axiom CancelFunc__mset_ptr : list (go_string * val). Axiom WithCancel : val. Axiom CancelCauseFunc : go_type. -Axiom CancelCauseFunc__mset : list (string * val). -Axiom CancelCauseFunc__mset_ptr : list (string * val). +Axiom CancelCauseFunc__mset : list (go_string * val). +Axiom CancelCauseFunc__mset_ptr : list (go_string * val). Axiom WithCancelCause : val. Axiom Cause : val. Axiom AfterFunc : val. diff --git a/new_code_axioms/crypto/rand.v b/new_code_axioms/crypto/rand.v index c6c07f111..4e2e5e7d8 100644 --- a/new_code_axioms/crypto/rand.v +++ b/new_code_axioms/crypto/rand.v @@ -4,7 +4,7 @@ From New.golang Require Import defn. Section axioms. Context `{ffi_syntax}. -Axiom Reader : (string * string). +Axiom Reader : (go_string * go_string). Axiom Read : val. Axiom reader__Read : val. Axiom hideAgainReader__Read : val. diff --git a/new_code_axioms/errors.v b/new_code_axioms/errors.v index 86ad26007..06c5838a2 100644 --- a/new_code_axioms/errors.v +++ b/new_code_axioms/errors.v @@ -6,7 +6,7 @@ Context `{ffi_syntax}. Axiom New : val. Axiom errorString__Error : val. -Axiom ErrUnsupported : (string * string). +Axiom ErrUnsupported : (go_string * go_string). Axiom Join : val. Axiom joinError__Error : val. Axiom joinError__Unwrap : val. diff --git a/new_code_axioms/github_com/stretchr/testify/assert.v b/new_code_axioms/github_com/stretchr/testify/assert.v index f5b4e5f8f..2239a9e96 100644 --- a/new_code_axioms/github_com/stretchr/testify/assert.v +++ b/new_code_axioms/github_com/stretchr/testify/assert.v @@ -5,8 +5,8 @@ Section axioms. Context `{ffi_syntax}. Axiom CompareType : go_type. -Axiom CompareType__mset : list (string * val). -Axiom CompareType__mset_ptr : list (string * val). +Axiom CompareType__mset : list (go_string * val). +Axiom CompareType__mset_ptr : list (go_string * val). Axiom Greater : val. Axiom GreaterOrEqual : val. Axiom Less : val. @@ -237,23 +237,23 @@ Axiom IsNonIncreasing : val. Axiom IsDecreasing : val. Axiom IsNonDecreasing : val. Axiom TestingT : go_type. -Axiom TestingT__mset : list (string * val). -Axiom TestingT__mset_ptr : list (string * val). +Axiom TestingT__mset : list (go_string * val). +Axiom TestingT__mset_ptr : list (go_string * val). Axiom ComparisonAssertionFunc : go_type. -Axiom ComparisonAssertionFunc__mset : list (string * val). -Axiom ComparisonAssertionFunc__mset_ptr : list (string * val). +Axiom ComparisonAssertionFunc__mset : list (go_string * val). +Axiom ComparisonAssertionFunc__mset_ptr : list (go_string * val). Axiom ValueAssertionFunc : go_type. -Axiom ValueAssertionFunc__mset : list (string * val). -Axiom ValueAssertionFunc__mset_ptr : list (string * val). +Axiom ValueAssertionFunc__mset : list (go_string * val). +Axiom ValueAssertionFunc__mset_ptr : list (go_string * val). Axiom BoolAssertionFunc : go_type. -Axiom BoolAssertionFunc__mset : list (string * val). -Axiom BoolAssertionFunc__mset_ptr : list (string * val). +Axiom BoolAssertionFunc__mset : list (go_string * val). +Axiom BoolAssertionFunc__mset_ptr : list (go_string * val). Axiom ErrorAssertionFunc : go_type. -Axiom ErrorAssertionFunc__mset : list (string * val). -Axiom ErrorAssertionFunc__mset_ptr : list (string * val). +Axiom ErrorAssertionFunc__mset : list (go_string * val). +Axiom ErrorAssertionFunc__mset_ptr : list (go_string * val). Axiom Comparison : go_type. -Axiom Comparison__mset : list (string * val). -Axiom Comparison__mset_ptr : list (string * val). +Axiom Comparison__mset : list (go_string * val). +Axiom Comparison__mset_ptr : list (go_string * val). Axiom ObjectsAreEqual : val. Axiom ObjectsExportedFieldsAreEqual : val. Axiom ObjectsAreEqualValues : val. @@ -285,8 +285,8 @@ Axiom NotSubset : val. Axiom ElementsMatch : val. Axiom Condition : val. Axiom PanicTestFunc : go_type. -Axiom PanicTestFunc__mset : list (string * val). -Axiom PanicTestFunc__mset_ptr : list (string * val). +Axiom PanicTestFunc__mset : list (go_string * val). +Axiom PanicTestFunc__mset_ptr : list (go_string * val). Axiom Panics : val. Axiom PanicsWithValue : val. Axiom PanicsWithError : val. @@ -314,8 +314,8 @@ Axiom JSONEq : val. Axiom YAMLEq : val. Axiom Eventually : val. Axiom CollectT : go_type. -Axiom CollectT__mset : list (string * val). -Axiom CollectT__mset_ptr : list (string * val). +Axiom CollectT__mset : list (go_string * val). +Axiom CollectT__mset_ptr : list (go_string * val). Axiom CollectT__Errorf : val. Axiom CollectT__FailNow : val. Axiom CollectT__Reset : val. @@ -325,10 +325,10 @@ Axiom Never : val. Axiom ErrorIs : val. Axiom NotErrorIs : val. Axiom ErrorAs : val. -Axiom AnError : (string * string). +Axiom AnError : (go_string * go_string). Axiom Assertions : go_type. -Axiom Assertions__mset : list (string * val). -Axiom Assertions__mset_ptr : list (string * val). +Axiom Assertions__mset : list (go_string * val). +Axiom Assertions__mset_ptr : list (go_string * val). Axiom New : val. Axiom HTTPSuccess : val. Axiom HTTPRedirect : val. diff --git a/new_code_axioms/go_etcd_io/raft/v3/confchange.v b/new_code_axioms/go_etcd_io/raft/v3/confchange.v index 2119312ef..5514741f0 100644 --- a/new_code_axioms/go_etcd_io/raft/v3/confchange.v +++ b/new_code_axioms/go_etcd_io/raft/v3/confchange.v @@ -5,8 +5,8 @@ Section axioms. Context `{ffi_syntax}. Axiom Changer : go_type. -Axiom Changer__mset : list (string * val). -Axiom Changer__mset_ptr : list (string * val). +Axiom Changer__mset : list (go_string * val). +Axiom Changer__mset_ptr : list (go_string * val). Axiom Changer__EnterJoint : val. Axiom Changer__LeaveJoint : val. Axiom Changer__Simple : val. diff --git a/new_code_axioms/io.v b/new_code_axioms/io.v index ba10e03ca..f68c2a09c 100644 --- a/new_code_axioms/io.v +++ b/new_code_axioms/io.v @@ -7,77 +7,77 @@ Context `{ffi_syntax}. Axiom SeekStart : Z. Axiom SeekCurrent : Z. Axiom SeekEnd : Z. -Axiom ErrShortWrite : (string * string). -Axiom ErrShortBuffer : (string * string). -Axiom EOF : (string * string). -Axiom ErrUnexpectedEOF : (string * string). -Axiom ErrNoProgress : (string * string). +Axiom ErrShortWrite : (go_string * go_string). +Axiom ErrShortBuffer : (go_string * go_string). +Axiom EOF : (go_string * go_string). +Axiom ErrUnexpectedEOF : (go_string * go_string). +Axiom ErrNoProgress : (go_string * go_string). Axiom Reader : go_type. -Axiom Reader__mset : list (string * val). -Axiom Reader__mset_ptr : list (string * val). +Axiom Reader__mset : list (go_string * val). +Axiom Reader__mset_ptr : list (go_string * val). Axiom Writer : go_type. -Axiom Writer__mset : list (string * val). -Axiom Writer__mset_ptr : list (string * val). +Axiom Writer__mset : list (go_string * val). +Axiom Writer__mset_ptr : list (go_string * val). Axiom Closer : go_type. -Axiom Closer__mset : list (string * val). -Axiom Closer__mset_ptr : list (string * val). +Axiom Closer__mset : list (go_string * val). +Axiom Closer__mset_ptr : list (go_string * val). Axiom Seeker : go_type. -Axiom Seeker__mset : list (string * val). -Axiom Seeker__mset_ptr : list (string * val). +Axiom Seeker__mset : list (go_string * val). +Axiom Seeker__mset_ptr : list (go_string * val). Axiom ReadWriter : go_type. -Axiom ReadWriter__mset : list (string * val). -Axiom ReadWriter__mset_ptr : list (string * val). +Axiom ReadWriter__mset : list (go_string * val). +Axiom ReadWriter__mset_ptr : list (go_string * val). Axiom ReadCloser : go_type. -Axiom ReadCloser__mset : list (string * val). -Axiom ReadCloser__mset_ptr : list (string * val). +Axiom ReadCloser__mset : list (go_string * val). +Axiom ReadCloser__mset_ptr : list (go_string * val). Axiom WriteCloser : go_type. -Axiom WriteCloser__mset : list (string * val). -Axiom WriteCloser__mset_ptr : list (string * val). +Axiom WriteCloser__mset : list (go_string * val). +Axiom WriteCloser__mset_ptr : list (go_string * val). Axiom ReadWriteCloser : go_type. -Axiom ReadWriteCloser__mset : list (string * val). -Axiom ReadWriteCloser__mset_ptr : list (string * val). +Axiom ReadWriteCloser__mset : list (go_string * val). +Axiom ReadWriteCloser__mset_ptr : list (go_string * val). Axiom ReadSeeker : go_type. -Axiom ReadSeeker__mset : list (string * val). -Axiom ReadSeeker__mset_ptr : list (string * val). +Axiom ReadSeeker__mset : list (go_string * val). +Axiom ReadSeeker__mset_ptr : list (go_string * val). Axiom ReadSeekCloser : go_type. -Axiom ReadSeekCloser__mset : list (string * val). -Axiom ReadSeekCloser__mset_ptr : list (string * val). +Axiom ReadSeekCloser__mset : list (go_string * val). +Axiom ReadSeekCloser__mset_ptr : list (go_string * val). Axiom WriteSeeker : go_type. -Axiom WriteSeeker__mset : list (string * val). -Axiom WriteSeeker__mset_ptr : list (string * val). +Axiom WriteSeeker__mset : list (go_string * val). +Axiom WriteSeeker__mset_ptr : list (go_string * val). Axiom ReadWriteSeeker : go_type. -Axiom ReadWriteSeeker__mset : list (string * val). -Axiom ReadWriteSeeker__mset_ptr : list (string * val). +Axiom ReadWriteSeeker__mset : list (go_string * val). +Axiom ReadWriteSeeker__mset_ptr : list (go_string * val). Axiom ReaderFrom : go_type. -Axiom ReaderFrom__mset : list (string * val). -Axiom ReaderFrom__mset_ptr : list (string * val). +Axiom ReaderFrom__mset : list (go_string * val). +Axiom ReaderFrom__mset_ptr : list (go_string * val). Axiom WriterTo : go_type. -Axiom WriterTo__mset : list (string * val). -Axiom WriterTo__mset_ptr : list (string * val). +Axiom WriterTo__mset : list (go_string * val). +Axiom WriterTo__mset_ptr : list (go_string * val). Axiom ReaderAt : go_type. -Axiom ReaderAt__mset : list (string * val). -Axiom ReaderAt__mset_ptr : list (string * val). +Axiom ReaderAt__mset : list (go_string * val). +Axiom ReaderAt__mset_ptr : list (go_string * val). Axiom WriterAt : go_type. -Axiom WriterAt__mset : list (string * val). -Axiom WriterAt__mset_ptr : list (string * val). +Axiom WriterAt__mset : list (go_string * val). +Axiom WriterAt__mset_ptr : list (go_string * val). Axiom ByteReader : go_type. -Axiom ByteReader__mset : list (string * val). -Axiom ByteReader__mset_ptr : list (string * val). +Axiom ByteReader__mset : list (go_string * val). +Axiom ByteReader__mset_ptr : list (go_string * val). Axiom ByteScanner : go_type. -Axiom ByteScanner__mset : list (string * val). -Axiom ByteScanner__mset_ptr : list (string * val). +Axiom ByteScanner__mset : list (go_string * val). +Axiom ByteScanner__mset_ptr : list (go_string * val). Axiom ByteWriter : go_type. -Axiom ByteWriter__mset : list (string * val). -Axiom ByteWriter__mset_ptr : list (string * val). +Axiom ByteWriter__mset : list (go_string * val). +Axiom ByteWriter__mset_ptr : list (go_string * val). Axiom RuneReader : go_type. -Axiom RuneReader__mset : list (string * val). -Axiom RuneReader__mset_ptr : list (string * val). +Axiom RuneReader__mset : list (go_string * val). +Axiom RuneReader__mset_ptr : list (go_string * val). Axiom RuneScanner : go_type. -Axiom RuneScanner__mset : list (string * val). -Axiom RuneScanner__mset_ptr : list (string * val). +Axiom RuneScanner__mset : list (go_string * val). +Axiom RuneScanner__mset_ptr : list (go_string * val). Axiom StringWriter : go_type. -Axiom StringWriter__mset : list (string * val). -Axiom StringWriter__mset_ptr : list (string * val). +Axiom StringWriter__mset : list (go_string * val). +Axiom StringWriter__mset_ptr : list (go_string * val). Axiom WriteString : val. Axiom ReadAtLeast : val. Axiom ReadFull : val. @@ -86,28 +86,28 @@ Axiom Copy : val. Axiom CopyBuffer : val. Axiom LimitReader : val. Axiom LimitedReader : go_type. -Axiom LimitedReader__mset : list (string * val). -Axiom LimitedReader__mset_ptr : list (string * val). +Axiom LimitedReader__mset : list (go_string * val). +Axiom LimitedReader__mset_ptr : list (go_string * val). Axiom LimitedReader__Read : val. Axiom NewSectionReader : val. Axiom SectionReader : go_type. -Axiom SectionReader__mset : list (string * val). -Axiom SectionReader__mset_ptr : list (string * val). +Axiom SectionReader__mset : list (go_string * val). +Axiom SectionReader__mset_ptr : list (go_string * val). Axiom SectionReader__Read : val. Axiom SectionReader__Seek : val. Axiom SectionReader__ReadAt : val. Axiom SectionReader__Size : val. Axiom SectionReader__Outer : val. Axiom OffsetWriter : go_type. -Axiom OffsetWriter__mset : list (string * val). -Axiom OffsetWriter__mset_ptr : list (string * val). +Axiom OffsetWriter__mset : list (go_string * val). +Axiom OffsetWriter__mset_ptr : list (go_string * val). Axiom NewOffsetWriter : val. Axiom OffsetWriter__Write : val. Axiom OffsetWriter__WriteAt : val. Axiom OffsetWriter__Seek : val. Axiom TeeReader : val. Axiom teeReader__Read : val. -Axiom Discard : (string * string). +Axiom Discard : (go_string * go_string). Axiom discard__Write : val. Axiom discard__WriteString : val. Axiom discard__ReadFrom : val. @@ -125,16 +125,16 @@ Axiom multiWriter__WriteString : val. Axiom MultiWriter : val. Axiom onceError__Store : val. Axiom onceError__Load : val. -Axiom ErrClosedPipe : (string * string). +Axiom ErrClosedPipe : (go_string * go_string). Axiom PipeReader : go_type. -Axiom PipeReader__mset : list (string * val). -Axiom PipeReader__mset_ptr : list (string * val). +Axiom PipeReader__mset : list (go_string * val). +Axiom PipeReader__mset_ptr : list (go_string * val). Axiom PipeReader__Read : val. Axiom PipeReader__Close : val. Axiom PipeReader__CloseWithError : val. Axiom PipeWriter : go_type. -Axiom PipeWriter__mset : list (string * val). -Axiom PipeWriter__mset_ptr : list (string * val). +Axiom PipeWriter__mset : list (go_string * val). +Axiom PipeWriter__mset_ptr : list (go_string * val). Axiom PipeWriter__Write : val. Axiom PipeWriter__Close : val. Axiom PipeWriter__CloseWithError : val. diff --git a/new_code_axioms/math/big.v b/new_code_axioms/math/big.v index 26cd7d9e0..9d970bcb5 100644 --- a/new_code_axioms/math/big.v +++ b/new_code_axioms/math/big.v @@ -6,23 +6,23 @@ Context `{ffi_syntax}. Axiom Accuracy__String : val. Axiom Word : go_type. -Axiom Word__mset : list (string * val). -Axiom Word__mset_ptr : list (string * val). +Axiom Word__mset : list (go_string * val). +Axiom Word__mset_ptr : list (go_string * val). Axiom decimal__String : val. Axiom Float : go_type. -Axiom Float__mset : list (string * val). -Axiom Float__mset_ptr : list (string * val). +Axiom Float__mset : list (go_string * val). +Axiom Float__mset_ptr : list (go_string * val). Axiom ErrNaN : go_type. -Axiom ErrNaN__mset : list (string * val). -Axiom ErrNaN__mset_ptr : list (string * val). +Axiom ErrNaN__mset : list (go_string * val). +Axiom ErrNaN__mset_ptr : list (go_string * val). Axiom ErrNaN__Error : val. Axiom NewFloat : val. Axiom MaxExp : Z. Axiom MinExp : Z. Axiom MaxPrec : Z. Axiom RoundingMode : go_type. -Axiom RoundingMode__mset : list (string * val). -Axiom RoundingMode__mset_ptr : list (string * val). +Axiom RoundingMode__mset : list (go_string * val). +Axiom RoundingMode__mset_ptr : list (go_string * val). Axiom ToNearestEven : expr. Axiom ToNearestAway : expr. Axiom ToZero : expr. @@ -30,8 +30,8 @@ Axiom AwayFromZero : expr. Axiom ToNegativeInf : expr. Axiom ToPositiveInf : expr. Axiom Accuracy : go_type. -Axiom Accuracy__mset : list (string * val). -Axiom Accuracy__mset_ptr : list (string * val). +Axiom Accuracy__mset : list (go_string * val). +Axiom Accuracy__mset_ptr : list (go_string * val). Axiom Below : expr. Axiom Exact : expr. Axiom Above : expr. @@ -81,8 +81,8 @@ Axiom Float__String : val. Axiom Float__Append : val. Axiom Float__Format : val. Axiom Int : go_type. -Axiom Int__mset : list (string * val). -Axiom Int__mset_ptr : list (string * val). +Axiom Int__mset : list (go_string * val). +Axiom Int__mset_ptr : list (go_string * val). Axiom Int__Sign : val. Axiom Int__SetInt64 : val. Axiom Int__SetUint64 : val. @@ -149,8 +149,8 @@ Axiom nat__String : val. Axiom MaxBase : expr. Axiom Int__ProbablyPrime : val. Axiom Rat : go_type. -Axiom Rat__mset : list (string * val). -Axiom Rat__mset_ptr : list (string * val). +Axiom Rat__mset : list (go_string * val). +Axiom Rat__mset_ptr : list (go_string * val). Axiom NewRat : val. Axiom Rat__SetFloat64 : val. Axiom Rat__Float32 : val. diff --git a/new_code_axioms/math/rand.v b/new_code_axioms/math/rand.v index b9605e11e..a8c6c631e 100644 --- a/new_code_axioms/math/rand.v +++ b/new_code_axioms/math/rand.v @@ -7,15 +7,15 @@ Context `{ffi_syntax}. Axiom Rand__ExpFloat64 : val. Axiom Rand__NormFloat64 : val. Axiom Source : go_type. -Axiom Source__mset : list (string * val). -Axiom Source__mset_ptr : list (string * val). +Axiom Source__mset : list (go_string * val). +Axiom Source__mset_ptr : list (go_string * val). Axiom Source64 : go_type. -Axiom Source64__mset : list (string * val). -Axiom Source64__mset_ptr : list (string * val). +Axiom Source64__mset : list (go_string * val). +Axiom Source64__mset_ptr : list (go_string * val). Axiom NewSource : val. Axiom Rand : go_type. -Axiom Rand__mset : list (string * val). -Axiom Rand__mset_ptr : list (string * val). +Axiom Rand__mset : list (go_string * val). +Axiom Rand__mset_ptr : list (go_string * val). Axiom New : val. Axiom Rand__Seed : val. Axiom Rand__Int63 : val. @@ -57,8 +57,8 @@ Axiom rngSource__Seed : val. Axiom rngSource__Int63 : val. Axiom rngSource__Uint64 : val. Axiom Zipf : go_type. -Axiom Zipf__mset : list (string * val). -Axiom Zipf__mset_ptr : list (string * val). +Axiom Zipf__mset : list (go_string * val). +Axiom Zipf__mset_ptr : list (go_string * val). Axiom NewZipf : val. Axiom Zipf__Uint64 : val. Axiom initialize' : val. diff --git a/new_code_axioms/os.v b/new_code_axioms/os.v index b75e4d14a..eddaf0c84 100644 --- a/new_code_axioms/os.v +++ b/new_code_axioms/os.v @@ -7,8 +7,8 @@ Context `{ffi_syntax}. Axiom File__Readdir : val. Axiom File__Readdirnames : val. Axiom DirEntry : go_type. -Axiom DirEntry__mset : list (string * val). -Axiom DirEntry__mset_ptr : list (string * val). +Axiom DirEntry__mset : list (go_string * val). +Axiom DirEntry__mset_ptr : list (go_string * val). Axiom File__ReadDir : val. Axiom ReadDir : val. Axiom CopyFS : val. @@ -20,19 +20,19 @@ Axiom Setenv : val. Axiom Unsetenv : val. Axiom Clearenv : val. Axiom Environ : val. -Axiom ErrInvalid : (string * string). -Axiom ErrPermission : (string * string). -Axiom ErrExist : (string * string). -Axiom ErrNotExist : (string * string). -Axiom ErrClosed : (string * string). -Axiom ErrNoDeadline : (string * string). -Axiom ErrDeadlineExceeded : (string * string). +Axiom ErrInvalid : (go_string * go_string). +Axiom ErrPermission : (go_string * go_string). +Axiom ErrExist : (go_string * go_string). +Axiom ErrNotExist : (go_string * go_string). +Axiom ErrClosed : (go_string * go_string). +Axiom ErrNoDeadline : (go_string * go_string). +Axiom ErrDeadlineExceeded : (go_string * go_string). Axiom PathError : go_type. -Axiom PathError__mset : list (string * val). -Axiom PathError__mset_ptr : list (string * val). +Axiom PathError__mset : list (go_string * val). +Axiom PathError__mset_ptr : list (go_string * val). Axiom SyscallError : go_type. -Axiom SyscallError__mset : list (string * val). -Axiom SyscallError__mset_ptr : list (string * val). +Axiom SyscallError__mset : list (go_string * val). +Axiom SyscallError__mset_ptr : list (go_string * val). Axiom SyscallError__Error : val. Axiom SyscallError__Unwrap : val. Axiom SyscallError__Timeout : val. @@ -41,16 +41,16 @@ Axiom IsExist : val. Axiom IsNotExist : val. Axiom IsPermission : val. Axiom IsTimeout : val. -Axiom ErrProcessDone : (string * string). +Axiom ErrProcessDone : (go_string * go_string). Axiom Process : go_type. -Axiom Process__mset : list (string * val). -Axiom Process__mset_ptr : list (string * val). +Axiom Process__mset : list (go_string * val). +Axiom Process__mset_ptr : list (go_string * val). Axiom ProcAttr : go_type. -Axiom ProcAttr__mset : list (string * val). -Axiom ProcAttr__mset_ptr : list (string * val). +Axiom ProcAttr__mset : list (go_string * val). +Axiom ProcAttr__mset_ptr : list (go_string * val). Axiom Signal : go_type. -Axiom Signal__mset : list (string * val). -Axiom Signal__mset_ptr : list (string * val). +Axiom Signal__mset : list (go_string * val). +Axiom Signal__mset_ptr : list (go_string * val). Axiom Getpid : val. Axiom Getppid : val. Axiom FindProcess : val. @@ -65,19 +65,19 @@ Axiom ProcessState__Exited : val. Axiom ProcessState__Success : val. Axiom ProcessState__Sys : val. Axiom ProcessState__SysUsage : val. -Axiom Interrupt : (string * string). -Axiom Kill : (string * string). +Axiom Interrupt : (go_string * go_string). +Axiom Kill : (go_string * go_string). Axiom ProcessState : go_type. -Axiom ProcessState__mset : list (string * val). -Axiom ProcessState__mset_ptr : list (string * val). +Axiom ProcessState__mset : list (go_string * val). +Axiom ProcessState__mset_ptr : list (go_string * val). Axiom ProcessState__Pid : val. Axiom ProcessState__String : val. Axiom ProcessState__ExitCode : val. Axiom Executable : val. Axiom File__Name : val. -Axiom Stdin : (string * string). -Axiom Stdout : (string * string). -Axiom Stderr : (string * string). +Axiom Stdin : (go_string * go_string). +Axiom Stdout : (go_string * go_string). +Axiom Stderr : (go_string * go_string). Axiom O_RDONLY : expr. Axiom O_WRONLY : expr. Axiom O_RDWR : expr. @@ -90,8 +90,8 @@ Axiom SEEK_SET : expr. Axiom SEEK_CUR : expr. Axiom SEEK_END : expr. Axiom LinkError : go_type. -Axiom LinkError__mset : list (string * val). -Axiom LinkError__mset_ptr : list (string * val). +Axiom LinkError__mset : list (go_string * val). +Axiom LinkError__mset_ptr : list (go_string * val). Axiom LinkError__Error : val. Axiom LinkError__Unwrap : val. Axiom File__Read : val. @@ -155,7 +155,7 @@ Axiom PathSeparator : expr. Axiom PathListSeparator : expr. Axiom IsPathSeparator : val. Axiom Pipe : val. -Axiom Args : (string * string). +Axiom Args : (go_string * go_string). Axiom Getuid : val. Axiom Geteuid : val. Axiom Getgid : val. @@ -173,14 +173,14 @@ Axiom CreateTemp : val. Axiom MkdirTemp : val. Axiom Getpagesize : val. Axiom File : go_type. -Axiom File__mset : list (string * val). -Axiom File__mset_ptr : list (string * val). +Axiom File__mset : list (go_string * val). +Axiom File__mset_ptr : list (go_string * val). Axiom FileInfo : go_type. -Axiom FileInfo__mset : list (string * val). -Axiom FileInfo__mset_ptr : list (string * val). +Axiom FileInfo__mset : list (go_string * val). +Axiom FileInfo__mset_ptr : list (go_string * val). Axiom FileMode : go_type. -Axiom FileMode__mset : list (string * val). -Axiom FileMode__mset_ptr : list (string * val). +Axiom FileMode__mset : list (go_string * val). +Axiom FileMode__mset_ptr : list (go_string * val). Axiom ModeDir : expr. Axiom ModeAppend : expr. Axiom ModeExclusive : expr. diff --git a/new_code_axioms/sort.v b/new_code_axioms/sort.v index 0fc16a33c..e18456fb8 100644 --- a/new_code_axioms/sort.v +++ b/new_code_axioms/sort.v @@ -16,30 +16,30 @@ Axiom Slice : val. Axiom SliceStable : val. Axiom SliceIsSorted : val. Axiom Interface : go_type. -Axiom Interface__mset : list (string * val). -Axiom Interface__mset_ptr : list (string * val). +Axiom Interface__mset : list (go_string * val). +Axiom Interface__mset_ptr : list (go_string * val). Axiom Sort : val. Axiom xorshift__Next : val. Axiom reverse__Less : val. Axiom Reverse : val. Axiom IsSorted : val. Axiom IntSlice : go_type. -Axiom IntSlice__mset : list (string * val). -Axiom IntSlice__mset_ptr : list (string * val). +Axiom IntSlice__mset : list (go_string * val). +Axiom IntSlice__mset_ptr : list (go_string * val). Axiom IntSlice__Len : val. Axiom IntSlice__Less : val. Axiom IntSlice__Swap : val. Axiom IntSlice__Sort : val. Axiom Float64Slice : go_type. -Axiom Float64Slice__mset : list (string * val). -Axiom Float64Slice__mset_ptr : list (string * val). +Axiom Float64Slice__mset : list (go_string * val). +Axiom Float64Slice__mset_ptr : list (go_string * val). Axiom Float64Slice__Len : val. Axiom Float64Slice__Less : val. Axiom Float64Slice__Swap : val. Axiom Float64Slice__Sort : val. Axiom StringSlice : go_type. -Axiom StringSlice__mset : list (string * val). -Axiom StringSlice__mset_ptr : list (string * val). +Axiom StringSlice__mset : list (go_string * val). +Axiom StringSlice__mset_ptr : list (go_string * val). Axiom StringSlice__Len : val. Axiom StringSlice__Less : val. Axiom StringSlice__Swap : val. diff --git a/new_code_axioms/strconv.v b/new_code_axioms/strconv.v index 0b238bdd9..fc2adcfc2 100644 --- a/new_code_axioms/strconv.v +++ b/new_code_axioms/strconv.v @@ -9,11 +9,11 @@ Axiom FormatBool : val. Axiom AppendBool : val. Axiom ParseComplex : val. Axiom ParseFloat : val. -Axiom ErrRange : (string * string). -Axiom ErrSyntax : (string * string). +Axiom ErrRange : (go_string * go_string). +Axiom ErrSyntax : (go_string * go_string). Axiom NumError : go_type. -Axiom NumError__mset : list (string * val). -Axiom NumError__mset_ptr : list (string * val). +Axiom NumError__mset : list (go_string * val). +Axiom NumError__mset_ptr : list (go_string * val). Axiom NumError__Error : val. Axiom NumError__Unwrap : val. Axiom IntSize : Z. diff --git a/new_code_axioms/strings.v b/new_code_axioms/strings.v index ee2c495b9..e1caf2f1f 100644 --- a/new_code_axioms/strings.v +++ b/new_code_axioms/strings.v @@ -5,8 +5,8 @@ Section axioms. Context `{ffi_syntax}. Axiom Builder : go_type. -Axiom Builder__mset : list (string * val). -Axiom Builder__mset_ptr : list (string * val). +Axiom Builder__mset : list (go_string * val). +Axiom Builder__mset_ptr : list (go_string * val). Axiom Builder__String : val. Axiom Builder__Len : val. Axiom Builder__Cap : val. @@ -19,8 +19,8 @@ Axiom Builder__WriteString : val. Axiom Clone : val. Axiom Compare : val. Axiom Reader : go_type. -Axiom Reader__mset : list (string * val). -Axiom Reader__mset_ptr : list (string * val). +Axiom Reader__mset : list (go_string * val). +Axiom Reader__mset_ptr : list (go_string * val). Axiom Reader__Len : val. Axiom Reader__Size : val. Axiom Reader__Read : val. @@ -34,8 +34,8 @@ Axiom Reader__WriteTo : val. Axiom Reader__Reset : val. Axiom NewReader : val. Axiom Replacer : go_type. -Axiom Replacer__mset : list (string * val). -Axiom Replacer__mset_ptr : list (string * val). +Axiom Replacer__mset : list (go_string * val). +Axiom Replacer__mset_ptr : list (go_string * val). Axiom NewReplacer : val. Axiom Replacer__Replace : val. Axiom Replacer__WriteString : val. diff --git a/new_code_axioms/testing.v b/new_code_axioms/testing.v index da68009ba..49c59a457 100644 --- a/new_code_axioms/testing.v +++ b/new_code_axioms/testing.v @@ -8,11 +8,11 @@ Axiom AllocsPerRun : val. Axiom durationOrCountFlag__String : val. Axiom durationOrCountFlag__Set : val. Axiom InternalBenchmark : go_type. -Axiom InternalBenchmark__mset : list (string * val). -Axiom InternalBenchmark__mset_ptr : list (string * val). +Axiom InternalBenchmark__mset : list (go_string * val). +Axiom InternalBenchmark__mset_ptr : list (go_string * val). Axiom B : go_type. -Axiom B__mset : list (string * val). -Axiom B__mset_ptr : list (string * val). +Axiom B__mset : list (go_string * val). +Axiom B__mset_ptr : list (go_string * val). Axiom B__StartTimer : val. Axiom B__StopTimer : val. Axiom B__ResetTimer : val. @@ -21,8 +21,8 @@ Axiom B__ReportAllocs : val. Axiom B__Elapsed : val. Axiom B__ReportMetric : val. Axiom BenchmarkResult : go_type. -Axiom BenchmarkResult__mset : list (string * val). -Axiom BenchmarkResult__mset_ptr : list (string * val). +Axiom BenchmarkResult__mset : list (go_string * val). +Axiom BenchmarkResult__mset_ptr : list (go_string * val). Axiom BenchmarkResult__NsPerOp : val. Axiom BenchmarkResult__AllocsPerOp : val. Axiom BenchmarkResult__AllocedBytesPerOp : val. @@ -31,31 +31,31 @@ Axiom BenchmarkResult__MemString : val. Axiom RunBenchmarks : val. Axiom B__Run : val. Axiom PB : go_type. -Axiom PB__mset : list (string * val). -Axiom PB__mset_ptr : list (string * val). +Axiom PB__mset : list (go_string * val). +Axiom PB__mset_ptr : list (go_string * val). Axiom PB__Next : val. Axiom B__RunParallel : val. Axiom B__SetParallelism : val. Axiom Benchmark : val. Axiom discard__Write : val. Axiom CoverBlock : go_type. -Axiom CoverBlock__mset : list (string * val). -Axiom CoverBlock__mset_ptr : list (string * val). +Axiom CoverBlock__mset : list (go_string * val). +Axiom CoverBlock__mset_ptr : list (go_string * val). Axiom Cover : go_type. -Axiom Cover__mset : list (string * val). -Axiom Cover__mset_ptr : list (string * val). +Axiom Cover__mset : list (go_string * val). +Axiom Cover__mset_ptr : list (go_string * val). Axiom Coverage : val. Axiom RegisterCover : val. Axiom InternalExample : go_type. -Axiom InternalExample__mset : list (string * val). -Axiom InternalExample__mset_ptr : list (string * val). +Axiom InternalExample__mset : list (go_string * val). +Axiom InternalExample__mset_ptr : list (go_string * val). Axiom RunExamples : val. Axiom InternalFuzzTarget : go_type. -Axiom InternalFuzzTarget__mset : list (string * val). -Axiom InternalFuzzTarget__mset_ptr : list (string * val). +Axiom InternalFuzzTarget__mset : list (go_string * val). +Axiom InternalFuzzTarget__mset_ptr : list (go_string * val). Axiom F : go_type. -Axiom F__mset : list (string * val). -Axiom F__mset_ptr : list (string * val). +Axiom F__mset : list (go_string * val). +Axiom F__mset_ptr : list (go_string * val). Axiom F__Helper : val. Axiom F__Fail : val. Axiom F__Skipped : val. @@ -75,11 +75,11 @@ Axiom CoverMode : val. Axiom Verbose : val. Axiom indenter__Write : val. Axiom TB : go_type. -Axiom TB__mset : list (string * val). -Axiom TB__mset_ptr : list (string * val). +Axiom TB__mset : list (go_string * val). +Axiom TB__mset_ptr : list (go_string * val). Axiom T : go_type. -Axiom T__mset : list (string * val). -Axiom T__mset_ptr : list (string * val). +Axiom T__mset : list (go_string * val). +Axiom T__mset_ptr : list (go_string * val). Axiom common__Name : val. Axiom common__Fail : val. Axiom common__Failed : val. @@ -101,8 +101,8 @@ Axiom common__Setenv : val. Axiom T__Parallel : val. Axiom T__Setenv : val. Axiom InternalTest : go_type. -Axiom InternalTest__mset : list (string * val). -Axiom InternalTest__mset_ptr : list (string * val). +Axiom InternalTest__mset : list (go_string * val). +Axiom InternalTest__mset_ptr : list (go_string * val). Axiom T__Run : val. Axiom T__Deadline : val. Axiom matchStringOnly__MatchString : val. @@ -122,8 +122,8 @@ Axiom matchStringOnly__SnapshotCoverage : val. Axiom matchStringOnly__InitRuntimeCoverage : val. Axiom Main : val. Axiom M : go_type. -Axiom M__mset : list (string * val). -Axiom M__mset_ptr : list (string * val). +Axiom M__mset : list (go_string * val). +Axiom M__mset_ptr : list (go_string * val). Axiom MainStart : val. Axiom M__Run : val. Axiom RunTests : val. diff --git a/new_partial_axioms/fmt.v b/new_partial_axioms/fmt.v index b3c375f45..d833615e8 100644 --- a/new_partial_axioms/fmt.v +++ b/new_partial_axioms/fmt.v @@ -10,17 +10,17 @@ Axiom wrapError__Unwrap : val. Axiom wrapErrors__Error : val. Axiom wrapErrors__Unwrap : val. Axiom State : go_type. -Axiom State__mset : list (string * val). -Axiom State__mset_ptr : list (string * val). +Axiom State__mset : list (go_string * val). +Axiom State__mset_ptr : list (go_string * val). Axiom Formatter : go_type. -Axiom Formatter__mset : list (string * val). -Axiom Formatter__mset_ptr : list (string * val). +Axiom Formatter__mset : list (go_string * val). +Axiom Formatter__mset_ptr : list (go_string * val). Axiom Stringer : go_type. -Axiom Stringer__mset : list (string * val). -Axiom Stringer__mset_ptr : list (string * val). +Axiom Stringer__mset : list (go_string * val). +Axiom Stringer__mset_ptr : list (go_string * val). Axiom GoStringer : go_type. -Axiom GoStringer__mset : list (string * val). -Axiom GoStringer__mset_ptr : list (string * val). +Axiom GoStringer__mset : list (go_string * val). +Axiom GoStringer__mset_ptr : list (go_string * val). Axiom FormatString : val. Axiom pp__Width : val. Axiom pp__Precision : val. @@ -40,11 +40,11 @@ Axiom Println : val. Axiom Sprintln : val. Axiom Appendln : val. Axiom ScanState : go_type. -Axiom ScanState__mset : list (string * val). -Axiom ScanState__mset_ptr : list (string * val). +Axiom ScanState__mset : list (go_string * val). +Axiom ScanState__mset_ptr : list (go_string * val). Axiom Scanner : go_type. -Axiom Scanner__mset : list (string * val). -Axiom Scanner__mset_ptr : list (string * val). +Axiom Scanner__mset : list (go_string * val). +Axiom Scanner__mset_ptr : list (go_string * val). Axiom Scan : val. Axiom Scanln : val. Axiom Scanf : val. diff --git a/new_partial_axioms/go_etcd_io/raft/v3/raftpb.v b/new_partial_axioms/go_etcd_io/raft/v3/raftpb.v index f2cad0872..91ee0ca55 100644 --- a/new_partial_axioms/go_etcd_io/raft/v3/raftpb.v +++ b/new_partial_axioms/go_etcd_io/raft/v3/raftpb.v @@ -5,8 +5,8 @@ Section axioms. Context `{ffi_syntax}. Axiom ConfChangeI : go_type. -Axiom ConfChangeI__mset : list (string * val). -Axiom ConfChangeI__mset_ptr : list (string * val). +Axiom ConfChangeI__mset : list (go_string * val). +Axiom ConfChangeI__mset_ptr : list (go_string * val). Axiom MarshalConfChange : val. Axiom ConfChange__AsV2 : val. Axiom ConfChange__AsV1 : val. @@ -18,20 +18,20 @@ Axiom ConfChangesFromString : val. Axiom ConfChangesToString : val. Axiom ConfState__Equivalent : val. Axiom EntryType : go_type. -Axiom EntryType__mset : list (string * val). -Axiom EntryType__mset_ptr : list (string * val). +Axiom EntryType__mset : list (go_string * val). +Axiom EntryType__mset_ptr : list (go_string * val). Axiom EntryNormal : expr. Axiom EntryConfChange : expr. Axiom EntryConfChangeV2 : expr. -Axiom EntryType_name : (string * string). -Axiom EntryType_value : (string * string). +Axiom EntryType_name : (go_string * go_string). +Axiom EntryType_value : (go_string * go_string). Axiom EntryType__Enum : val. Axiom EntryType__String : val. Axiom EntryType__UnmarshalJSON : val. Axiom EntryType__EnumDescriptor : val. Axiom MessageType : go_type. -Axiom MessageType__mset : list (string * val). -Axiom MessageType__mset_ptr : list (string * val). +Axiom MessageType__mset : list (go_string * val). +Axiom MessageType__mset_ptr : list (go_string * val). Axiom MsgHup : expr. Axiom MsgBeat : expr. Axiom MsgProp : expr. @@ -56,40 +56,40 @@ Axiom MsgStorageAppendResp : expr. Axiom MsgStorageApply : expr. Axiom MsgStorageApplyResp : expr. Axiom MsgForgetLeader : expr. -Axiom MessageType_name : (string * string). -Axiom MessageType_value : (string * string). +Axiom MessageType_name : (go_string * go_string). +Axiom MessageType_value : (go_string * go_string). Axiom MessageType__Enum : val. Axiom MessageType__String : val. Axiom MessageType__UnmarshalJSON : val. Axiom MessageType__EnumDescriptor : val. Axiom ConfChangeTransition : go_type. -Axiom ConfChangeTransition__mset : list (string * val). -Axiom ConfChangeTransition__mset_ptr : list (string * val). +Axiom ConfChangeTransition__mset : list (go_string * val). +Axiom ConfChangeTransition__mset_ptr : list (go_string * val). Axiom ConfChangeTransitionAuto : expr. Axiom ConfChangeTransitionJointImplicit : expr. Axiom ConfChangeTransitionJointExplicit : expr. -Axiom ConfChangeTransition_name : (string * string). -Axiom ConfChangeTransition_value : (string * string). +Axiom ConfChangeTransition_name : (go_string * go_string). +Axiom ConfChangeTransition_value : (go_string * go_string). Axiom ConfChangeTransition__Enum : val. Axiom ConfChangeTransition__String : val. Axiom ConfChangeTransition__UnmarshalJSON : val. Axiom ConfChangeTransition__EnumDescriptor : val. Axiom ConfChangeType : go_type. -Axiom ConfChangeType__mset : list (string * val). -Axiom ConfChangeType__mset_ptr : list (string * val). +Axiom ConfChangeType__mset : list (go_string * val). +Axiom ConfChangeType__mset_ptr : list (go_string * val). Axiom ConfChangeAddNode : expr. Axiom ConfChangeRemoveNode : expr. Axiom ConfChangeUpdateNode : expr. Axiom ConfChangeAddLearnerNode : expr. -Axiom ConfChangeType_name : (string * string). -Axiom ConfChangeType_value : (string * string). +Axiom ConfChangeType_name : (go_string * go_string). +Axiom ConfChangeType_value : (go_string * go_string). Axiom ConfChangeType__Enum : val. Axiom ConfChangeType__String : val. Axiom ConfChangeType__UnmarshalJSON : val. Axiom ConfChangeType__EnumDescriptor : val. Axiom Entry : go_type. -Axiom Entry__mset : list (string * val). -Axiom Entry__mset_ptr : list (string * val). +Axiom Entry__mset : list (go_string * val). +Axiom Entry__mset_ptr : list (go_string * val). Axiom Entry__Reset : val. Axiom Entry__String : val. Axiom Entry__ProtoMessage : val. @@ -100,8 +100,8 @@ Axiom Entry__XXX_Merge : val. Axiom Entry__XXX_Size : val. Axiom Entry__XXX_DiscardUnknown : val. Axiom SnapshotMetadata : go_type. -Axiom SnapshotMetadata__mset : list (string * val). -Axiom SnapshotMetadata__mset_ptr : list (string * val). +Axiom SnapshotMetadata__mset : list (go_string * val). +Axiom SnapshotMetadata__mset_ptr : list (go_string * val). Axiom SnapshotMetadata__Reset : val. Axiom SnapshotMetadata__String : val. Axiom SnapshotMetadata__ProtoMessage : val. @@ -112,8 +112,8 @@ Axiom SnapshotMetadata__XXX_Merge : val. Axiom SnapshotMetadata__XXX_Size : val. Axiom SnapshotMetadata__XXX_DiscardUnknown : val. Axiom Snapshot : go_type. -Axiom Snapshot__mset : list (string * val). -Axiom Snapshot__mset_ptr : list (string * val). +Axiom Snapshot__mset : list (go_string * val). +Axiom Snapshot__mset_ptr : list (go_string * val). Axiom Snapshot__Reset : val. Axiom Snapshot__String : val. Axiom Snapshot__ProtoMessage : val. @@ -124,8 +124,8 @@ Axiom Snapshot__XXX_Merge : val. Axiom Snapshot__XXX_Size : val. Axiom Snapshot__XXX_DiscardUnknown : val. Axiom Message : go_type. -Axiom Message__mset : list (string * val). -Axiom Message__mset_ptr : list (string * val). +Axiom Message__mset : list (go_string * val). +Axiom Message__mset_ptr : list (go_string * val). Axiom Message__Reset : val. Axiom Message__String : val. Axiom Message__ProtoMessage : val. @@ -136,8 +136,8 @@ Axiom Message__XXX_Merge : val. Axiom Message__XXX_Size : val. Axiom Message__XXX_DiscardUnknown : val. Axiom HardState : go_type. -Axiom HardState__mset : list (string * val). -Axiom HardState__mset_ptr : list (string * val). +Axiom HardState__mset : list (go_string * val). +Axiom HardState__mset_ptr : list (go_string * val). Axiom HardState__Reset : val. Axiom HardState__String : val. Axiom HardState__ProtoMessage : val. @@ -148,8 +148,8 @@ Axiom HardState__XXX_Merge : val. Axiom HardState__XXX_Size : val. Axiom HardState__XXX_DiscardUnknown : val. Axiom ConfState : go_type. -Axiom ConfState__mset : list (string * val). -Axiom ConfState__mset_ptr : list (string * val). +Axiom ConfState__mset : list (go_string * val). +Axiom ConfState__mset_ptr : list (go_string * val). Axiom ConfState__Reset : val. Axiom ConfState__String : val. Axiom ConfState__ProtoMessage : val. @@ -160,8 +160,8 @@ Axiom ConfState__XXX_Merge : val. Axiom ConfState__XXX_Size : val. Axiom ConfState__XXX_DiscardUnknown : val. Axiom ConfChange : go_type. -Axiom ConfChange__mset : list (string * val). -Axiom ConfChange__mset_ptr : list (string * val). +Axiom ConfChange__mset : list (go_string * val). +Axiom ConfChange__mset_ptr : list (go_string * val). Axiom ConfChange__Reset : val. Axiom ConfChange__String : val. Axiom ConfChange__ProtoMessage : val. @@ -172,8 +172,8 @@ Axiom ConfChange__XXX_Merge : val. Axiom ConfChange__XXX_Size : val. Axiom ConfChange__XXX_DiscardUnknown : val. Axiom ConfChangeSingle : go_type. -Axiom ConfChangeSingle__mset : list (string * val). -Axiom ConfChangeSingle__mset_ptr : list (string * val). +Axiom ConfChangeSingle__mset : list (go_string * val). +Axiom ConfChangeSingle__mset_ptr : list (go_string * val). Axiom ConfChangeSingle__Reset : val. Axiom ConfChangeSingle__String : val. Axiom ConfChangeSingle__ProtoMessage : val. @@ -184,8 +184,8 @@ Axiom ConfChangeSingle__XXX_Merge : val. Axiom ConfChangeSingle__XXX_Size : val. Axiom ConfChangeSingle__XXX_DiscardUnknown : val. Axiom ConfChangeV2 : go_type. -Axiom ConfChangeV2__mset : list (string * val). -Axiom ConfChangeV2__mset_ptr : list (string * val). +Axiom ConfChangeV2__mset : list (go_string * val). +Axiom ConfChangeV2__mset_ptr : list (go_string * val). Axiom ConfChangeV2__Reset : val. Axiom ConfChangeV2__String : val. Axiom ConfChangeV2__ProtoMessage : val. @@ -240,8 +240,8 @@ Axiom ConfState__Unmarshal : val. Axiom ConfChange__Unmarshal : val. Axiom ConfChangeSingle__Unmarshal : val. Axiom ConfChangeV2__Unmarshal : val. -Axiom ErrInvalidLengthRaft : (string * string). -Axiom ErrIntOverflowRaft : (string * string). -Axiom ErrUnexpectedEndOfGroupRaft : (string * string). +Axiom ErrInvalidLengthRaft : (go_string * go_string). +Axiom ErrIntOverflowRaft : (go_string * go_string). +Axiom ErrUnexpectedEndOfGroupRaft : (go_string * go_string). Axiom initialize' : val. End axioms. diff --git a/new_partial_axioms/log.v b/new_partial_axioms/log.v index 06ae16257..2b85d22c2 100644 --- a/new_partial_axioms/log.v +++ b/new_partial_axioms/log.v @@ -13,8 +13,8 @@ Axiom LUTC : Z. Axiom Lmsgprefix : Z. Axiom LstdFlags : Z. Axiom Logger : go_type. -Axiom Logger__mset : list (string * val). -Axiom Logger__mset_ptr : list (string * val). +Axiom Logger__mset : list (go_string * val). +Axiom Logger__mset_ptr : list (go_string * val). Axiom New : val. Axiom Logger__SetOutput : val. Axiom Default : val. diff --git a/new_trusted_code/github_com/mit_pdos/gokv/grove_ffi.v b/new_trusted_code/github_com/mit_pdos/gokv/grove_ffi.v index 4670611ec..f10759603 100644 --- a/new_trusted_code/github_com/mit_pdos/gokv/grove_ffi.v +++ b/new_trusted_code/github_com/mit_pdos/gokv/grove_ffi.v @@ -94,7 +94,7 @@ Section grove. Definition GetTimeRange : val := λ: <>, ExternalOp GetTimeRangeOp #(). - Definition pkg_name' : string := "github.com/mit-pdos/gokv/grove_ffi". + Definition pkg_name' : go_string := "github.com/mit-pdos/gokv/grove_ffi". Definition initialize' : val := rec: "initialize'" <> := diff --git a/new_trusted_code/sync.v b/new_trusted_code/sync.v index 9a60a83e6..16f308a89 100644 --- a/new_trusted_code/sync.v +++ b/new_trusted_code/sync.v @@ -23,18 +23,18 @@ Definition Mutex__Unlock : val := λ: "m" <>, exception_do (do: CmpXchg (struct.field_ref Mutex "state" "m") #true #false ;;; return: #()) . -Definition Mutex__mset : list (string * val) := []. +Definition Mutex__mset : list (go_string * val) := []. -Definition Mutex__mset_ptr : list (string * val) := [ - ("TryLock", Mutex__TryLock) ; - ("Lock", Mutex__Lock) ; - ("Unlock", Mutex__Unlock) +Definition Mutex__mset_ptr : list (go_string * val) := [ + ("TryLock"%go, Mutex__TryLock) ; + ("Lock"%go, Mutex__Lock) ; + ("Unlock"%go, Mutex__Unlock) ]. Definition NewCond : val := λ: "m", ref_ty interfaceT "m". Definition Cond__Wait : val := λ: "c" <>, exception_do ( - do: interface.get "Unlock" (![interfaceT] "c") #() ;;; - do: interface.get "Lock" (![interfaceT] "c") #() + do: interface.get "Unlock"%go (![interfaceT] "c") #() ;;; + do: interface.get "Lock"%go (![interfaceT] "c") #() ). Definition Cond__Broadcast : val := λ: "c" <>, #(). Definition Cond__Signal: val := λ: "c" <>, #(). diff --git a/src/Helpers/ByteString.v b/src/Helpers/ByteString.v index d84c7a917..67c4f6e95 100644 --- a/src/Helpers/ByteString.v +++ b/src/Helpers/ByteString.v @@ -1,4 +1,4 @@ -From stdpp Require Import base. +From stdpp Require Import base decidable. From Perennial.Helpers Require Import Integers bytes. From Coq Require Import ZArith Strings.Byte. @@ -25,25 +25,34 @@ Definition w8_to_byte (w: w8) : byte := Notation byte_string := (@list w8) (only parsing). -Definition parse_string (s: list Byte.byte) : byte_string := +#[local] Definition parse_string (s: list Byte.byte) : byte_string := byte_to_w8 <$> s. -Definition print_string (b: byte_string) : list Byte.byte := +#[local] Definition print_string (b: byte_string) : list Byte.byte := w8_to_byte <$> b. -String Notation byte_string parse_string print_string : string_scope. +Declare Scope byte_string_scope. +Bind Scope byte_string_scope with byte_string. +String Notation byte_string parse_string print_string : byte_string_scope. + +Notation byte_string' := (@list (@Naive.rep 8)) (only parsing). +String Notation byte_string' parse_string print_string : byte_string_scope. + +(* TODO: replace with more computationally efficient version *) +#[local] Definition eqb (s1 s2: byte_string) : bool := + bool_decide (s1 = s2). (* These theorems are not actually required, but they are a sanity check that the code above is implemented correctly. *) -Lemma byte_to_w8_to_byte b : +#[local] Lemma byte_to_w8_to_byte b : w8_to_byte (byte_to_w8 b) = b. Proof. destruct b; auto. Qed. -Lemma w8_to_byte_to_w8 w : +#[local] Lemma w8_to_byte_to_w8 w : byte_to_w8 (w8_to_byte w) = w. Proof. byte_cases w; reflexivity. Qed. -Lemma parse_print_inverse s : +#[local] Lemma parse_print_inverse s : print_string (parse_string s) = s. Proof. rewrite /print_string /parse_string. diff --git a/src/Helpers/CountableTactics.v b/src/Helpers/CountableTactics.v index 4ed10bf08..c2b0db131 100644 --- a/src/Helpers/CountableTactics.v +++ b/src/Helpers/CountableTactics.v @@ -1,4 +1,7 @@ -From stdpp Require Import countable. +From stdpp Require Import countable finite. + +(* FIXME: https://gitlab.mpi-sws.org/iris/stdpp/-/merge_requests/424 *) +Global Remove Hints finite_countable : typeclass_instances. Local Ltac count t_rec := let rec go num f := diff --git a/src/Helpers/Integers.v b/src/Helpers/Integers.v index f3ef50888..ca7e90f20 100644 --- a/src/Helpers/Integers.v +++ b/src/Helpers/Integers.v @@ -131,10 +131,6 @@ Proof. apply word.signed_inj in H; auto. Qed. -#[global] -Instance byte_eq_dec : EqDecision byte. -Proof. solve_decision. Defined. - #[global] Instance word_countable `(word: Interface.word width) {word_ok: word.ok word} : Countable word. Proof. diff --git a/src/goose_lang/ffi/atomic_refinement.v b/src/goose_lang/ffi/atomic_refinement.v index fef34715b..44ad75c8e 100644 --- a/src/goose_lang/ffi/atomic_refinement.v +++ b/src/goose_lang/ffi/atomic_refinement.v @@ -519,7 +519,7 @@ Section go_refinement. destruct iv1 => //=; inversion 1; eauto; subst; destruct iv2; inversion 1; subst; destruct l => //=; destruct l0 => //=; - destruct (string_to_bytes s !! (uint.nat n)) => //=; eauto. + destruct (s !! (uint.nat n)) => //=; eauto. } rewrite /bin_op_eval /bin_op_eval_eq /=. diff --git a/src/goose_lang/ffi/grove_ffi/adequacy.v b/src/goose_lang/ffi/grove_ffi/adequacy.v index 3802a17ff..3dcecd1b7 100644 --- a/src/goose_lang/ffi/grove_ffi/adequacy.v +++ b/src/goose_lang/ffi/grove_ffi/adequacy.v @@ -11,7 +11,7 @@ Set Default Proof Using "Type". Existing Instances grove_op grove_model. Existing Instances grove_semantics grove_interp. Existing Instances goose_groveGS goose_groveNodeGS. -Theorem grove_ffi_dist_adequacy Σ `{hPre: !gooseGpreS Σ} ebσs g φinv : +Theorem grove_ffi_dist_adequacy Σ `{hPre: !gooseGpreS Σ} ebσs g (φinv : _ → Prop) : chan_msg_bounds g.(global_world).(grove_net) → Forall (λ ρ, file_content_bounds ρ.(init_local_state).(world).(grove_node_files)) ebσs → (∀ HG : gooseGlobalGS Σ, @@ -40,7 +40,8 @@ Proof. { eauto. } Qed. -Theorem grove_ffi_dist_adequacy_failstop Σ `{hPre: !gooseGpreS Σ} (ebσs : list (goose_lang.expr * goose_lang.state)) g φinv : +Theorem grove_ffi_dist_adequacy_failstop Σ `{hPre: !gooseGpreS Σ} + (ebσs : list (goose_lang.expr * goose_lang.state)) g (φinv : _ → Prop) : chan_msg_bounds g.(global_world).(grove_net) → Forall (λ σ, file_content_bounds σ.(world).(grove_node_files)) ebσs.*2 → (∀ HG : gooseGlobalGS Σ, @@ -51,7 +52,8 @@ Theorem grove_ffi_dist_adequacy_failstop Σ `{hPre: !gooseGpreS Σ} (ebσs : lis ∀ HL : gooseLocalGS Σ, ([∗ map] f ↦ c ∈ σ.(world).(grove_node_files), f f↦ c) -∗ own_globals (DfracOwn 1) σ.(globals) - ={⊤}=∗ ∃ Φ, wp NotStuck ⊤ e Φ) ∗ + ={⊤}=∗ ∃ Φ, wp NotStuck ⊤ e Φ + ) ∗ (∀ g', ffi_global_ctx goose_ffiGlobalGS g'.(global_world) ={⊤,∅}=∗ ⌜ φinv g' ⌝) )) → dist_adequate_failstop (ffi_sem:=grove_semantics) ebσs g (λ g, φinv g). Proof. diff --git a/src/goose_lang/ffi/grove_ffi/grove_ffi.v b/src/goose_lang/ffi/grove_ffi/grove_ffi.v index 2fbbbd604..b3e5d296c 100644 --- a/src/goose_lang/ffi/grove_ffi/grove_ffi.v +++ b/src/goose_lang/ffi/grove_ffi/grove_ffi.v @@ -26,17 +26,17 @@ Class groveGS Σ : Set := GroveGS { Class groveGpreS Σ : Set := { #[global] grove_preG_net_heapG :: gen_heap.gen_heapGpreS chan (gset message) Σ; - #[global] grove_preG_files_heapG :: gen_heap.gen_heapGpreS string (list byte) Σ; + #[global] grove_preG_files_heapG :: gen_heap.gen_heapGpreS byte_string (list byte) Σ; #[global] grove_preG_tscG :: mono_natG Σ; }. Class groveNodeGS Σ : Set := GroveNodeGS { #[global] groveG_preS :: groveGpreS Σ; grove_tsc_name : gname; - #[global] groveG_files_heapG :: gen_heap.gen_heapGS string (list byte) Σ; + #[global] groveG_files_heapG :: gen_heap.gen_heapGS byte_string (list byte) Σ; }. Definition groveΣ : gFunctors := - #[gen_heapΣ chan (gset message); gen_heapΣ string (list byte); mono_natΣ]. + #[gen_heapΣ chan (gset message); gen_heapΣ byte_string (list byte); mono_natΣ]. #[global] Instance subG_groveGpreS Σ : subG groveΣ Σ → groveGpreS Σ. @@ -53,7 +53,7 @@ Section grove. Definition chan_msg_bounds (g : gmap chan (gset message)) : Prop := ∀ c ms m, g !! c = Some ms → m ∈ ms → length m.(msg_data) < 2^64. - Definition file_content_bounds (g : gmap string (list byte)) : Prop := + Definition file_content_bounds (g : gmap byte_string (list byte)) : Prop := ∀ f c, g !! f = Some c → length c < 2^64. Local Program Instance grove_interp: ffi_interp grove_model := @@ -67,7 +67,7 @@ Section grove. mono_nat_auth_own grove_time_name 1 (uint.nat g.(grove_global_time)) )%I; ffi_local_start _ _ σ := - ([∗ map] f↦c ∈ σ.(grove_node_files), (pointsto (L:=string) (V:=list byte) f (DfracOwn 1) c))%I; + ([∗ map] f↦c ∈ σ.(grove_node_files), (pointsto (L:=byte_string) (V:=list byte) f (DfracOwn 1) c))%I; ffi_global_start _ _ g := ([∗ map] e↦ms ∈ g.(grove_net), (pointsto (L:=chan) (V:=gset message) e (DfracOwn 1) ms))%I; ffi_restart _ _ _ := True%I; @@ -80,7 +80,7 @@ End grove. Notation "c c↦ ms" := (pointsto (L:=chan) (V:=gset message) c (DfracOwn 1) ms) (at level 20, format "c c↦ ms") : bi_scope. -Notation "s f↦{ q } c" := (pointsto (L:=string) (V:=list byte) s q c) +Notation "s f↦{ q } c" := (pointsto (L:=byte_string) (V:=list byte) s q c) (at level 20, q at level 50, format "s f↦{ q } c") : bi_scope. Notation "s f↦ c" := (s f↦{DfracOwn 1} c)%I @@ -393,7 +393,7 @@ lemmas. *) destruct Hfresh as (Hfresh & _). eapply Hfresh. Qed. - Lemma wp_FileReadOp (f : string) q c E : + Lemma wp_FileReadOp (f : byte_string) q c E : {{{ f f↦{q} c }}} ExternalOp FileReadOp #(str f) @ E {{{ (err : bool) (l : loc) (len : u64), RET (#err, (#l, #len)); @@ -455,7 +455,7 @@ lemmas. *) destruct Hfresh as (Hfresh & _). eapply Hfresh. Qed. - Lemma wp_FileWriteOp (f : string) old new l q (len : u64) E : + Lemma wp_FileWriteOp f old new l q (len : u64) E : length new = uint.nat len → {{{ f f↦ old ∗ pointsto_vals l q (data_vals new) }}} ExternalOp FileWriteOp (#(str f), (#l, #len))%V @ E @@ -509,7 +509,7 @@ lemmas. *) by iFrame. Qed. - Lemma wp_FileAppendOp (f : string) old new l q (len : u64) E : + Lemma wp_FileAppendOp f old new l q (len : u64) E : length new = uint.nat len → {{{ f f↦ old ∗ pointsto_vals l q (data_vals new) }}} ExternalOp FileAppendOp (#(str f), (#l, #len))%V @ E diff --git a/src/goose_lang/ffi/grove_ffi/impl.v b/src/goose_lang/ffi/grove_ffi/impl.v index 20aa4a9a1..581fec788 100644 --- a/src/goose_lang/ffi/grove_ffi/impl.v +++ b/src/goose_lang/ffi/grove_ffi/impl.v @@ -3,7 +3,7 @@ From stdpp Require Import gmap vector fin_maps. From RecordUpdate Require Import RecordSet. -From Perennial.Helpers Require Import CountableTactics Transitions Integers. +From Perennial.Helpers Require Import CountableTactics Transitions Integers ByteString. From Perennial.goose_lang Require Import lang notation lib.control.impl. Set Default Proof Using "Type". @@ -95,7 +95,7 @@ Global Instance grove_global_state_inhabited : Inhabited grove_global_state := (** The per-node state *) Record grove_node_state : Type := { grove_node_tsc : u64; - grove_node_files: gmap string (list byte); + grove_node_files: gmap byte_string (list byte); }. Global Instance grove_node_state_settable : Settable _ := diff --git a/src/goose_lang/interpreter/pretty_types.v b/src/goose_lang/interpreter/pretty_types.v index f84ce9a3b..814ddcba9 100644 --- a/src/goose_lang/interpreter/pretty_types.v +++ b/src/goose_lang/interpreter/pretty_types.v @@ -1,7 +1,7 @@ From stdpp Require Import strings. From stdpp Require Export pretty. From Perennial.program_logic Require Import language ectx_language ectxi_language. -From Perennial.Helpers Require Import Integers Transitions. +From Perennial.Helpers Require Import Integers Transitions ByteString. From Perennial.goose_lang Require Import locations lang. Set Default Proof Using "Type". @@ -18,7 +18,8 @@ Instance pretty_u32 : Pretty Integers.u32 := Instance pretty_loc : Pretty loc := fun x => pretty x.(loc_car). -Definition quoted (s:string) : string := ("""" ++ s ++ """")%string. +Definition quoted (s:byte_string) : string := + ("""" ++ String.string_of_list_byte (ByteString.print_string s) ++ """")%string. #[global] Instance pretty_lit : Pretty base_lit := diff --git a/src/goose_lang/lang.v b/src/goose_lang/lang.v index 50dba930c..abe32b83a 100644 --- a/src/goose_lang/lang.v +++ b/src/goose_lang/lang.v @@ -1,14 +1,16 @@ From Coq.Program Require Import Equality. From RecordUpdate Require Import RecordSet. -From stdpp Require Export binders strings. +From stdpp Require Export binders. From stdpp Require Import gmap. From iris.algebra Require Export ofe. From Perennial.program_logic Require Export language ectx_language ectxi_language. From Perennial.Helpers Require Import CountableTactics. From Perennial.Helpers Require Import Transitions. +From Perennial.Helpers Require Import ByteString. From Perennial.program_logic Require Export crash_lang. From Perennial.goose_lang Require Export locations. From Perennial Require Export Helpers.Integers. + Set Default Proof Using "Type". Open Scope Z_scope. @@ -64,10 +66,9 @@ behavior. So we erase to the poison value instead, making sure that no legal comparisons could be affected. *) Inductive base_lit : Type := | LitInt (n : u64) | LitInt32 (n : u32) | LitBool (b : bool) | LitByte (n : u8) - | LitString (s : string) | LitUnit | LitPoison + | LitString (s : byte_string) | LitUnit | LitPoison | LitLoc (l : loc) | LitProphecy (p: proph_id). Inductive un_op : Set := - (* TODO: operation to take length of string *) | NegOp | MinusUnOp | UToW64Op | UToW32Op | UToW8Op | SToW64Op | SToW32Op | SToW8Op @@ -82,7 +83,7 @@ Inductive bin_op : Set := | StringGetOp . -Inductive prim_op0 : Set := +Inductive prim_op0 : Type := (* a stuck expression, to represent undefined behavior *) | PanicOp (s: string) (* non-deterministically pick an integer *) @@ -111,7 +112,7 @@ Inductive prim_op2 : Set := . Inductive arity : Set := args0 | args1 | args2. -Definition prim_op (ar:arity) : Set := +Definition prim_op (ar:arity) : Type := match ar with | args0 => prim_op0 | args1 => prim_op1 @@ -229,7 +230,7 @@ Instance Oracle_Inhabited: Inhabited Oracle := populate (fun _ _ => word.of_Z 0) (** The state: heaps of vals. *) Record state : Type := { heap: gmap loc (nonAtomic val); - globals : gmap string val; + globals : gmap byte_string val; world: ffi_state; trace: Trace; oracle: Oracle; @@ -547,7 +548,7 @@ Proof. solve_countable prim_op1_rec 7%nat. Qed. Instance prim_op2_countable : Countable prim_op2. Proof. solve_countable prim_op2_rec 5%nat. Qed. -Definition prim_op' : Set := prim_op0 + prim_op1 + prim_op2. +Definition prim_op' : Type := prim_op0 + prim_op1 + prim_op2. Definition a_prim_op {ar} (op: prim_op ar) : prim_op'. rewrite /prim_op'. @@ -782,7 +783,7 @@ Definition fill_item (Ki : ectx_item) (e : expr) : expr := end. (** Substitution *) -Fixpoint subst (x : string) (v : val) (e : expr) : expr := +Fixpoint subst (x : String.string) (v : val) (e : expr) : expr := match e with | Val _ => e | Var y => if decide (x = y) then Val v else Var y @@ -839,9 +840,9 @@ Definition un_op_eval (op : un_op) (v : val) : option val := | SToW8Op, LitV (LitInt v) => Some $ LitV $ LitByte (W8 (sint.Z v)) | SToW8Op, LitV (LitInt32 v) => Some $ LitV $ LitByte (W8 (sint.Z v)) | SToW8Op, LitV (LitByte v) => Some $ LitV $ LitByte (W8 (sint.Z v)) - | ToStringOp, LitV (LitByte v) => Some $ LitV $ LitString (u8_to_string v) - | StringLenOp, LitV (LitString v) => Some $ LitV $ LitInt (W64 (String.length v)) - | IsNoStringOverflowOp, LitV (LitString v) => Some $ LitV $ LitBool (bool_decide ((String.length v) < 2^64)) + | ToStringOp, LitV (LitByte v) => Some $ LitV $ LitString [v] + | StringLenOp, LitV (LitString v) => Some $ LitV $ LitInt (W64 (Z.of_nat (length v))) + | IsNoStringOverflowOp, LitV (LitString v) => Some $ LitV $ LitBool (bool_decide (Z.of_nat (length v) < 2^64)) | _, _ => None end. @@ -886,18 +887,15 @@ Definition bin_op_eval_bool (op : bin_op) (b1 b2 : bool) : option bool := | _ => None end. -Definition bin_op_eval_string (op : bin_op) (s1 s2 : string) : option string := +Definition bin_op_eval_string (op : bin_op) (s1 s2 : byte_string) : option byte_string := match op with - | PlusOp => Some $ (s1 +:+ s2) + | PlusOp => Some $ (s1 ++ s2) | _ => None end. -Definition string_to_bytes (s:string): list u8 := - (λ x, W8 $ Ascii.nat_of_ascii x) <$> String.list_ascii_of_string s. - -Definition bin_op_eval_string_word (op : bin_op) (s1 : string) {width} {word: Interface.word width} (w2 : word): option w8 := +Definition bin_op_eval_string_word (op : bin_op) (s1 : byte_string) {width} {word: Interface.word width} (w2 : word): option w8 := match op with - | StringGetOp => ((string_to_bytes s1) !! (uint.nat w2)) + | StringGetOp => (s1 !! (uint.nat w2)) | _ => None end. diff --git a/src/goose_lang/lib/into_val.v b/src/goose_lang/lib/into_val.v index f993a88ee..05a131f2d 100644 --- a/src/goose_lang/lib/into_val.v +++ b/src/goose_lang/lib/into_val.v @@ -228,15 +228,15 @@ Section instances. by injection H. Qed. - Global Instance string_IntoVal : IntoVal string. + Global Instance byte_string_IntoVal : IntoVal byte_string. Proof. - refine {| into_val.to_val := λ (x: string), #(str x); + refine {| into_val.to_val := λ (x: byte_string), #(str x); from_val := λ v, match v with #(LitString x) => Some x | _ => None end; - IntoVal_def := ""; |}; done. + IntoVal_def := []; |}; done. Defined. - Global Instance string_IntoVal_boolT : IntoValForType string stringT. + Global Instance byte_string_IntoVal_boolT : IntoValForType byte_string stringT. Proof. constructor; auto. Qed. - Global Instance string_IntoValComparable : IntoValComparable string. + Global Instance byte_string_IntoValComparable : IntoValComparable byte_string. Proof. constructor; try done. intros. simpl in *. diff --git a/src/goose_lang/lib/string/string.v b/src/goose_lang/lib/string/string.v index 37bfca2fd..59833e5c2 100644 --- a/src/goose_lang/lib/string/string.v +++ b/src/goose_lang/lib/string/string.v @@ -3,126 +3,21 @@ From Perennial.goose_lang.lib Require Import string.impl. From Perennial.goose_lang.lib Require Import control. Import uPred. +Global Delimit Scope byte_string_scope with go. Set Default Proof Using "Type". Section heap. Context `{ffi_sem: ffi_semantics} `{!ffi_interp ffi} `{!heapGS Σ}. Context {ext_ty: ext_types ext}. -Definition bytes_to_string (l:list u8) : string := - String.string_of_list_ascii (u8_to_ascii <$> l). - -Lemma bytes_to_string_to_bytes l : - string_to_bytes $ bytes_to_string l = l. -Proof. - rewrite /string_to_bytes /bytes_to_string /=. - rewrite -{2}(list_fmap_id l). - rewrite String.list_ascii_of_string_of_list_ascii. - rewrite -list_fmap_compose. - apply list_fmap_ext. - intros. - simpl. - rewrite /string_to_bytes /bytes_to_string /= /u8_to_ascii. - pose proof (word.unsigned_range x). - assert (uint.nat x < 256)%nat. - { word. } (* FIXME: word_cleanup doesn't have good support for u8 *) - rewrite Ascii.nat_ascii_embedding. - { - apply word.unsigned_inj. - rewrite (Z2Nat.id _); last lia. - rewrite word.unsigned_of_Z. - by rewrite (@wrap_small _ _ _ _). - } - done. -Qed. - -Global Instance bytes_to_string_inj : Inj (=) (=) bytes_to_string. -Proof. - intros b1 b2 Heq. - apply (f_equal string_to_bytes) in Heq. - rewrite !bytes_to_string_to_bytes in Heq. - done. -Qed. - -Lemma String_append s1 s2 a : - String a s1 +:+ s2 = String a (s1 +:+ s2). -Proof. - reflexivity. -Qed. - -Lemma string_to_bytes_app s1 s2 : - string_to_bytes (s1 ++ s2) = string_to_bytes s1 ++ string_to_bytes s2. -Proof. - rewrite /string_to_bytes. - induction s1; first done. - cbn. rewrite String_append -IHs1. - done. -Qed. - -Lemma bytes_to_string_app l1 l2 : - bytes_to_string (l1 ++ l2) = bytes_to_string l1 +:+ bytes_to_string l2. -Proof. - rewrite /bytes_to_string. - induction l1; first done. - cbn. rewrite String_append -IHl1. - done. -Qed. - -Lemma string_to_bytes_to_string s : - bytes_to_string $ string_to_bytes s = s. -Proof. - rewrite /string_to_bytes /bytes_to_string /=. - induction s as [|]. - { done. } - { - simpl. - rewrite IHs. - f_equal. - rewrite /u8_to_string /u8_to_ascii. - f_equal. - replace (uint.nat (_)) with (Ascii.nat_of_ascii a). - 2:{ pose proof (Ascii.nat_ascii_bounded a) as H. - revert H. generalize (Ascii.nat_of_ascii a). - intros. - rewrite word.unsigned_of_Z. - word. - } - by rewrite Ascii.ascii_nat_embedding. - } -Qed. - -Global Instance string_to_bytes_inj : Inj (=) (=) string_to_bytes. -Proof. - intros s1 s2 Heq. - apply (f_equal bytes_to_string) in Heq. - rewrite !string_to_bytes_to_string in Heq. - done. -Qed. - -Lemma string_bytes_length s : - String.length s = length $ string_to_bytes s. -Proof. - rewrite /string_to_bytes length_fmap. - induction s as [|? ? IHs]. - { done. } - { cbn. apply f_equal. done. } -Qed. - -Lemma length_bytes_to_string bs : - String.length (bytes_to_string bs) = length bs. -Proof. - rewrite string_bytes_length. - rewrite bytes_to_string_to_bytes //. -Qed. - -Lemma wp_stringToBytes (i:u64) (s:string) : +Lemma wp_stringToBytes (i:u64) (s:byte_string) : {{{ - ⌜uint.nat i <= String.length s⌝ + ⌜uint.nat i <= length s⌝ }}} stringToBytes #i #(str s) {{{ (sl:Slice.t), RET (slice_val sl); own_slice sl byteT (DfracOwn 1) - (take (uint.nat i) (string_to_bytes s)) + (take (uint.nat i) s) }}} . Proof. @@ -140,11 +35,10 @@ Proof. wp_pures. destruct (decide (i = 0)). { subst. by exfalso. } - assert (uint.nat (word.sub i 1%Z) < String.length s)%nat as Hlookup. + assert (uint.nat (word.sub i 1%Z) < length s)%nat as Hlookup. { enough (uint.nat i ≠ 0%nat) by word. intros ?. apply n. word. } pose proof Hlookup as Hineq2. - rewrite string_bytes_length in Hlookup. apply List.list_lookup_lt in Hlookup as [? Hlookup]. wp_pure. { by rewrite /bin_op_eval /= Hlookup. } @@ -165,13 +59,13 @@ Proof. iFrame. Qed. -Lemma wp_StringToBytes (s:string) : +Lemma wp_StringToBytes (s:byte_string) : {{{ True }}} StringToBytes #(str s) {{{ - (sl:Slice.t), RET (slice_val sl); own_slice sl byteT (DfracOwn 1) (string_to_bytes s) + (sl:Slice.t), RET (slice_val sl); own_slice sl byteT (DfracOwn 1) s }}} . Proof. @@ -185,7 +79,6 @@ Proof. iDestruct (own_slice_sz with "[$]") as %Hsz. rewrite take_ge. { iFrame. } - rewrite -string_bytes_length. word. Qed. @@ -195,7 +88,7 @@ Lemma wp_StringFromBytes sl q (l:list u8) : }}} StringFromBytes (slice_val sl) {{{ - RET #(str bytes_to_string l); own_slice_small sl byteT q l + RET #(str l); own_slice_small sl byteT q l }}} . Proof. @@ -239,5 +132,3 @@ Proof. Qed. End heap. - -Hint Rewrite length_bytes_to_string : len. diff --git a/src/goose_lang/lifting.v b/src/goose_lang/lifting.v index 5b0671376..b84b64880 100644 --- a/src/goose_lang/lifting.v +++ b/src/goose_lang/lifting.v @@ -116,16 +116,16 @@ Section globals_definitions. Context `{ext:ffi_syntax}. Class globalsGS Σ : Set := GlobalsGS { - #[global] globals_inG :: inG Σ (authUR (optionUR (exclR (leibnizO (gmap string val))))) ; + #[global] globals_inG :: inG Σ (authUR (optionUR (exclR (leibnizO (gmap byte_string val))))) ; globals_name : gname ; }. Class globals_preG (Σ: gFunctors) : Set := { - #[global] globals_preG_inG :: inG Σ (authUR (optionUR (exclR (leibnizO (gmap string val))))) ; + #[global] globals_preG_inG :: inG Σ (authUR (optionUR (exclR (leibnizO (gmap byte_string val))))) ; }. Definition globalsΣ : gFunctors := - #[GFunctor (authR (optionUR (exclR (leibnizO (gmap string val)))))]. + #[GFunctor (authR (optionUR (exclR (leibnizO (gmap byte_string val)))))]. Global Instance subG_globalsG {Σ} : subG globalsΣ Σ → globals_preG Σ. Proof. solve_inG. Qed. @@ -137,10 +137,10 @@ Definition globalsGS_update (Σ: gFunctors) (hT: globalsGS Σ) (new_globals_name {| globals_inG := globals_inG; globals_name := new_globals_name |}. (* XXX: this is using the frag b/c we want the dfrac in the user-owned part. *) -Definition own_globals_ctx `{hG : globalsGS Σ} (g : gmap string val) := +Definition own_globals_ctx `{hG : globalsGS Σ} (g : gmap byte_string val) := own globals_name (◯ (Some (Excl (g : leibnizO _)))). -Definition own_globals_def `{hG : globalsGS Σ} (dq : dfrac) (g : gmap string val) := +Definition own_globals_def `{hG : globalsGS Σ} (dq : dfrac) (g : gmap byte_string val) := own globals_name (●{dq}Some (Excl (g : leibnizO _))). Program Definition own_globals := unseal (_:seal (@own_globals_def)). Obligation 1. by eexists. Qed. Definition own_globals_unseal : own_globals = _ := seal_eq _. @@ -200,7 +200,7 @@ Proof. by apply auth_update, option_local_update, exclusive_local_update. Qed. -Lemma globals_name_init `(hT: globals_preG Σ) (g : gmap string val) : +Lemma globals_name_init `(hT: globals_preG Σ) (g : gmap byte_string val) : ⊢ |==> ∃ new_globals_name : gname, let _ := globalsGS_update_pre Σ hT new_globals_name in own_globals_ctx g ∗ own_globals (DfracOwn 1) g. Proof. @@ -209,7 +209,7 @@ Proof. iModIntro. rewrite own_globals_unseal. iFrame. Qed. -Lemma globals_reinit `(hT: globalsGS Σ) (g : gmap string val) : +Lemma globals_reinit `(hT: globalsGS Σ) (g : gmap byte_string val) : ⊢ |==> ∃ new_globals_name : gname, let _ := globalsGS_update Σ hT new_globals_name in own_globals_ctx g ∗ own_globals (DfracOwn 1) g. Proof. @@ -881,7 +881,7 @@ Proof. iModIntro. iFrame; iSplitL; last done. iApply ("HΦ" with "[$]"). Qed. -Lemma wp_GlobalGet s E g dq (k : string) : +Lemma wp_GlobalGet s E g dq k : {{{ own_globals dq g }}} GlobalGet #(str k) @ s ; E {{{ RET (match g !! k with @@ -907,7 +907,7 @@ Proof. iModIntro. iFrame; iSplitL; last done. iApply ("HΦ" with "[$]"). Qed. -Lemma wp_GlobalPut s E g (k : string) (v : val) : +Lemma wp_GlobalPut s E g k (v : val) : {{{ own_globals (DfracOwn 1) g }}} GlobalPut #(str k) v @ s ; E {{{ RET #(); own_globals (DfracOwn 1) (<[k := v]> g) }}}. diff --git a/src/goose_lang/logical_reln_fund.v b/src/goose_lang/logical_reln_fund.v index fba001aa7..26fadc0ef 100644 --- a/src/goose_lang/logical_reln_fund.v +++ b/src/goose_lang/logical_reln_fund.v @@ -1179,7 +1179,7 @@ Proof using spec_trans. iSpecialize ("H" $! j _ Hctx' with "Hj"); clear Hctx'. iApply (wpc_mono' with "[] [] H"); last by auto. iIntros (v1) "H". iDestruct "H" as (vs1) "(Hj&Hv1)". - iAssert (∃ (vres: string), ⌜ un_op_eval ToStringOp v1 = Some #(LitString vres) ∧ + iAssert (∃ (vres: byte_string), ⌜ un_op_eval ToStringOp v1 = Some #(LitString vres) ∧ un_op_eval ToStringOp vs1 = Some #(LitString vres) ⌝)%I with "[Hv1]" as %Hres. { destruct t; try inversion e; diff --git a/src/goose_lang/notation.v b/src/goose_lang/notation.v index c3453a694..5dd98e6aa 100644 --- a/src/goose_lang/notation.v +++ b/src/goose_lang/notation.v @@ -1,5 +1,6 @@ From Perennial.program_logic Require Import language. From Perennial.goose_lang Require Export lang. +From Perennial.Helpers Require Export ByteString. Set Default Proof Using "Type". Delimit Scope expr_scope with E. @@ -24,7 +25,7 @@ Coercion LitInt : u64 >-> base_lit. Coercion LitInt32 : u32 >-> base_lit. Coercion LitByte : u8 >-> base_lit. Coercion LitProphecy : proph_id >-> base_lit. -Notation "'str' s" := (LitString s) (at level 30, format "'str' s") : val_scope. +Notation "'str' s" := (LitString (s : byte_string)) (at level 30, format "'str' s") : val_scope. Definition b2val {ext: ffi_syntax}: u8 -> val := λ (b:u8), LitV (LitByte b). Global Instance b2val_inj {ext: ffi_syntax} : Inj eq eq b2val. diff --git a/src/program_proof/aof/proof.v b/src/program_proof/aof/proof.v index f182ee1d6..1405d7e06 100644 --- a/src/program_proof/aof/proof.v +++ b/src/program_proof/aof/proof.v @@ -320,7 +320,7 @@ Proof. done. Qed. -Lemma wp_CreateAppendOnlyFile (fname:string) data P Pcrash : +Lemma wp_CreateAppendOnlyFile fname data P Pcrash : □(∀ data, ▷ P data ={⊤}=∗ ▷ Pcrash data) -∗ {{{ crash_borrow (fname f↦ data ∗ P data) diff --git a/src/program_proof/append_log_refinement.v b/src/program_proof/append_log_refinement.v index 2aa4c34d6..364c9d43f 100644 --- a/src/program_proof/append_log_refinement.v +++ b/src/program_proof/append_log_refinement.v @@ -137,7 +137,7 @@ Definition append_op_trans (op: log_spec_ext.(@spec_ffi_op_field).(@external)) : end. Inductive append_trans : @val log_op -> @val disk_op -> Prop := -| AppendTrans (x: string) op: +| AppendTrans (x: byte_string) op: append_trans (λ: x, ExternalOp op (Var x)) (append_op_trans op). diff --git a/src/program_proof/bank/bank_proof.v b/src/program_proof/bank/bank_proof.v index b68350eb4..3874d398a 100644 --- a/src/program_proof/bank/bank_proof.v +++ b/src/program_proof/bank/bank_proof.v @@ -4,11 +4,11 @@ From Perennial.program_proof.lock Require Import lock_proof. From Goose.github_com.mit_pdos.gokv Require Import lockservice bank. Class bankG Σ := { - #[global] bank_mapG :: mapG Σ string u64 ; + #[global] bank_mapG :: mapG Σ byte_string u64 ; }. Definition bankΣ := - #[mapΣ string u64]. + #[mapΣ byte_string u64]. Global Instance subG_pbΣ {Σ} : subG (bankΣ) Σ → (bankG Σ). Proof. solve_inG. Qed. @@ -18,23 +18,23 @@ Context `{!invGS Σ, !bankG Σ}. Record bank_names := BankNames { bank_ls_names: (lock_names (Σ:=Σ)) ; (* Logical balances of accounts; must match the physical balance by the time you give up the lock *) - bank_kvptsto : string → string → iProp Σ ; (* Logical balances of accounts; must match the physical balance by the time you give up the lock *) + bank_kvptsto : byte_string → byte_string → iProp Σ ; (* Logical balances of accounts; must match the physical balance by the time you give up the lock *) bank_logBalGN : gname ; (* Logical balances of accounts; must match the physical balance by the time you give up the lock *) }. Definition log_gn γ := γ.(bank_logBalGN). Definition lock_gn γ := γ.(bank_ls_names). -Definition bankPs γ := λ k, (∃ v, bank_kvptsto γ k (bytes_to_string $ u64_le v) ∗ k [[log_gn γ]]↦v)%I. +Definition bankPs γ := λ k, (∃ v, bank_kvptsto γ k (u64_le v) ∗ k [[log_gn γ]]↦v)%I. Definition bankN := nroot .@ "grove_bank_of_boston". Definition lockN : namespace := nroot.@"grove_bank_of_boston_vault". Definition bal_total : u64 := 1000. -Context (init_flag: string). (* Account names for bank *) +Context (init_flag: byte_string). (* Account names for bank *) -Definition map_total (m : gmap string u64) : u64 := +Definition map_total (m : gmap byte_string u64) : u64 := map_fold (λ k v tot, word.add tot v) 0 m. Lemma map_total_insert m k v : @@ -72,7 +72,7 @@ Proof. Qed. Lemma map_total_zero m : - map_Forall (λ (_:string) (x : u64), x = 0) m -> + map_Forall (λ (_:byte_string) (x : u64), x = 0) m -> map_total m = 0. Proof. induction m using map_ind. @@ -108,22 +108,22 @@ Proof. done. Qed. -Definition bank_inv γ (accts : gset string) : iProp Σ := - ∃ (m:gmap string u64), +Definition bank_inv γ (accts : gset byte_string) : iProp Σ := + ∃ (m:gmap byte_string u64), "HlogBalCtx" ∷ map_ctx (log_gn γ) 1 m ∗ "%" ∷ ⌜map_total m = bal_total⌝ ∗ "%" ∷ ⌜dom m = accts⌝ . -Definition init_lock_inv γlk kvptsto (accts:gset string) : iProp Σ := +Definition init_lock_inv γlk kvptsto (accts:gset byte_string) : iProp Σ := (* Uninit case *) - (kvptsto init_flag "" ∗ - [∗ set] acc ∈ accts, kvptsto acc "" ∗ kvptsto_lock γlk acc "" + (kvptsto init_flag ""%go ∗ + [∗ set] acc ∈ accts, kvptsto acc ""%go ∗ kvptsto_lock γlk acc ""%go ) ∨ (* Already init case *) (∃ γlog, let γ := (BankNames γlk kvptsto γlog) in - bank_kvptsto γ init_flag "1" ∗ inv bankN (bank_inv γ accts) ∗ + bank_kvptsto γ init_flag "1"%go ∗ inv bankN (bank_inv γ accts) ∗ [∗ set] acc ∈ accts, is_lock lockN (lock_gn γ) acc (bankPs γ acc)). Definition is_bank γlk kvptsto accs : iProp Σ := @@ -135,10 +135,10 @@ End bank_defs. Section bank_proof. Context `{!heapGS Σ (ext:=grove_op) (ffi:=grove_model), !bankG Σ}. -Context (init_flag: string). (* Account names for bank *) +Context (init_flag: byte_string). (* Account names for bank *) -Definition own_bank_clerk (bank_ck:loc) (accts : gset string) : iProp Σ := - ∃ (lck kck : loc) (accts_s : Slice.t) (accts_l : list string) γ E, +Definition own_bank_clerk (bank_ck:loc) (accts : gset byte_string) : iProp Σ := + ∃ (lck kck : loc) (accts_s : Slice.t) (accts_l : list byte_string) γ E, "%" ∷ ⌜Permutation (elements accts) (accts_l)⌝ ∗ "#Hlck_is" ∷ is_LockClerk lockN lck (lock_gn γ) ∗ "#Hkck_is" ∷ is_Kv kck (bank_kvptsto γ) E ∗ @@ -153,7 +153,7 @@ Definition own_bank_clerk (bank_ck:loc) (accts : gset string) : iProp Σ := "#Haccts_is_lock" ∷ [∗ list] acc ∈ accts_l, is_lock lockN (lock_gn γ) acc (bankPs γ acc) . -Lemma acquire_two_spec (lck :loc) (ln1 ln2:string) γ: +Lemma acquire_two_spec (lck :loc) (ln1 ln2:byte_string) γ: {{{ is_LockClerk lockN lck γ.(bank_ls_names) ∗ is_lock lockN γ.(bank_ls_names) ln1 (bankPs γ ln1) ∗ @@ -178,7 +178,7 @@ Proof. iApply "Hpost". by iFrame. Qed. -Lemma release_two_spec (lck :loc) (ln1 ln2:string) γ: +Lemma release_two_spec (lck :loc) (ln1 ln2:byte_string) γ: {{{ is_LockClerk lockN lck γ.(bank_ls_names) ∗ is_lock lockN γ.(bank_ls_names) ln1 (bankPs γ ln1) ∗ @@ -205,7 +205,7 @@ Lemma wp_decodeInt (x:u64) : {{{ True }}} - decodeInt #(str bytes_to_string (u64_le x)) + decodeInt #(str (u64_le x)) {{{ RET #x; True }}} @@ -217,7 +217,6 @@ Proof. wp_apply wp_StringToBytes. iIntros (?) "Hsl". iDestruct (own_slice_to_small with "Hsl") as "Hsl". - rewrite bytes_to_string_to_bytes. wp_apply (wp_ReadInt with "[$]"). iIntros. wp_pures. iModIntro. by iApply "HΦ". Qed. @@ -228,7 +227,7 @@ Lemma wp_encodeInt (x:u64) : }}} encodeInt #x {{{ - RET #(str bytes_to_string (u64_le x)); True + RET #(str (u64_le x)); True }}} . Proof. @@ -245,7 +244,7 @@ Proof. simpl. by iApply "HΦ". Qed. -Lemma Bank__transfer_internal_spec (bck:loc) (src dst:string) (amount:u64) accts : +Lemma Bank__transfer_internal_spec (bck:loc) (src dst:byte_string) (amount:u64) accts : {{{ own_bank_clerk bck accts ∗ ⌜ src ∈ accts ⌝ ∗ @@ -461,7 +460,7 @@ Proof. "%Hlocked_dom" ∷ ⌜Permutation (elements (dom locked)) done⌝ ∗ "Hml" ∷ [∗ map] acc ↦ bal ∈ locked, is_lock lockN γ.(bank_ls_names) acc (bankPs γ acc) ∗ - (bank_kvptsto γ acc (bytes_to_string $ u64_le $ bal) ∗ acc [[log_gn γ]]↦ bal))%I + (bank_kvptsto γ acc (u64_le $ bal) ∗ acc [[log_gn γ]]↦ bal))%I with "[] [$Haccts_slice Hsum $Hlck $Hkck]"). 2: { iExists ∅. rewrite map_total_empty. iFrame. @@ -540,7 +539,7 @@ Proof. iNamed "HbankInv". iDestruct (big_sepM_sep with "Hml") as "[#Hml_islock Hmlkv]". - iDestruct (big_sepM_mono_wand _ (λ k v, ⌜m !! k = Some v⌝ ∗ bank_kvptsto γ k (bytes_to_string $ u64_le v) ∗ k [[log_gn γ]]↦ v)%I _ (map_ctx (log_gn γ) 1 m)%I with "[] [$HlogBalCtx $Hmlkv]") as "[HlogBalCtx Hmlkv]". + iDestruct (big_sepM_mono_wand _ (λ k v, ⌜m !! k = Some v⌝ ∗ bank_kvptsto γ k (u64_le v) ∗ k [[log_gn γ]]↦ v)%I _ (map_ctx (log_gn γ) 1 m)%I with "[] [$HlogBalCtx $Hmlkv]") as "[HlogBalCtx Hmlkv]". { iModIntro. iIntros (??) "%Hsome [HlogBalCtx HbankPs]". @@ -578,7 +577,7 @@ Proof. "Hlck" ∷ bck ↦[BankClerk :: "lck"] #lck ∗ "%Hdom" ∷ ⌜Permutation (elements (dom mtodo)) todo⌝ ∗ "Hml" ∷ [∗ map] k↦x ∈ mtodo, is_lock lockN γ.(bank_ls_names) k (bankPs γ k) ∗ - (bank_kvptsto γ k (bytes_to_string $ u64_le x) ∗ k [[log_gn γ]]↦ x))%I + (bank_kvptsto γ k (u64_le x) ∗ k [[log_gn γ]]↦ x))%I with "[] [$Haccts_slice $Hlck Hml]"). { iIntros (?? ??) "%Hx". @@ -638,7 +637,7 @@ Proof. iModIntro. iLeft. iFrame. eauto. Qed. -Lemma wp_MakeBankClerkSlice (lck kck : loc) γlk kvptsto E accts (accts_s : Slice.t) acc0 (accts_l : list string) : +Lemma wp_MakeBankClerkSlice (lck kck : loc) γlk kvptsto E accts (accts_s : Slice.t) acc0 (accts_l : list byte_string) : {{{ is_LockClerk lockN lck γlk ∗ is_Kv kck kvptsto E ∗ @@ -706,15 +705,15 @@ Proof. rewrite skipn_cons. replace (drop 0 accts_l) with (accts_l) by reflexivity. wp_apply (wp_forSlicePrefix - (λ done todo, ∃ (sdone: gset string), + (λ done todo, ∃ (sdone: gset byte_string), "kvck" ∷ l ↦[BankClerk :: "kvck"] #kck ∗ "Htodo" ∷ ([∗ list] acc ∈ todo, - "Hkv2" ∷ kvptsto_lock γlk acc "" ∗ - "Hkv1" ∷ kvptsto acc "") ∗ + "Hkv2" ∷ kvptsto_lock γlk acc ""%go ∗ + "Hkv1" ∷ kvptsto acc ""%go) ∗ "%Hdone_dom" ∷ ⌜Permutation (elements sdone) done⌝ ∗ "Hdone" ∷ [∗ map] acc ↦ bal ∈ (gset_to_gmap (W64 0) sdone), - kvptsto_lock γlk acc "" ∗ - kvptsto acc (bytes_to_string $ u64_le bal) + kvptsto_lock γlk acc ""%go ∗ + kvptsto acc (u64_le bal) )%I with "[] [$Haccts_slice $kvck Haccs]"). { iIntros (????) "%Hx". @@ -868,7 +867,7 @@ Proof. iDestruct (big_sepS_elements with "H") as "He". rewrite Hperm. iFrame "He". Qed. -Lemma wp_MakeBankClerk (lck kck : loc) γlk kvptsto (acc0 acc1 : string ) E : +Lemma wp_MakeBankClerk (lck kck : loc) γlk kvptsto (acc0 acc1 : byte_string ) E : {{{ is_LockClerk lockN lck γlk ∗ is_Kv kck kvptsto E ∗ diff --git a/src/program_proof/cachekv/proof.v b/src/program_proof/cachekv/proof.v index c698e9a6c..bfc2956df 100644 --- a/src/program_proof/cachekv/proof.v +++ b/src/program_proof/cachekv/proof.v @@ -7,7 +7,7 @@ From iris.base_logic.lib Require Import ghost_map. Module cacheValueC. Record t := mk { - v : string ; + v : byte_string ; l : u64 ; }. @@ -31,11 +31,11 @@ End cacheValueC. Section proof. Context `{!heapGS Σ}. -Context `{!ghost_mapG Σ string string}. +Context `{!ghost_mapG Σ byte_string byte_string}. Context `{!renewable_leaseG Σ}. -Definition encode_cacheValue (v:string) (lease:u64) : string := - (bytes_to_string $ u64_le lease) ++ v. +Definition encode_cacheValue (v:byte_string) (lease:u64) : byte_string := + (u64_le lease) ++ v. Lemma encode_cacheValue_inj v l v' l' : encode_cacheValue v l = encode_cacheValue v' l' → @@ -44,15 +44,11 @@ Lemma encode_cacheValue_inj v l v' l' : Proof. intros H. rewrite /encode_cacheValue in H. - apply (f_equal string_to_bytes) in H. - repeat rewrite string_to_bytes_app bytes_to_string_to_bytes in H. apply app_inj_1 in H. 2:{ done. } destruct H as [H1 H2]. split. - { - apply (f_equal bytes_to_string) in H2. repeat rewrite string_to_bytes_to_string in H2. done. - } + { done. } apply (f_equal le_to_u64) in H1. repeat rewrite u64_le_to_word in H1. done. @@ -72,7 +68,7 @@ Definition kvptsto γ key value : iProp Σ := . (* KV points-to for the internal kv service *) -Implicit Types kvptsto_int: string → string → iProp Σ. +Implicit Types kvptsto_int: byte_string → byte_string → iProp Σ. Definition is_cachekv_inv kvptsto_int γ : iProp Σ := inv invN (∃ kvs, @@ -88,7 +84,7 @@ Definition is_cachekv_inv kvptsto_int γ : iProp Σ := . Definition own_CacheKv (k:loc) γ : iProp Σ := - ∃ (cache_ptr:loc) (cache:gmap string cacheValueC.t), + ∃ (cache_ptr:loc) (cache:gmap byte_string cacheValueC.t), "Hcache_ptr" ∷ k ↦[CacheKv :: "cache"] #cache_ptr ∗ "Hcache" ∷ own_map cache_ptr (DfracOwn 1) cache ∗ "#Hleases" ∷ ([∗ map] k ↦ cv ∈ cache, @@ -124,18 +120,18 @@ Proof. iIntros (?) "Hptr". wp_pures. wp_load. - rewrite /encode_cacheValue string_to_bytes_app bytes_to_string_to_bytes. + rewrite /encode_cacheValue. iDestruct (own_slice_to_small with "Hsl") as "Hsl". wp_apply (wp_ReadInt with "[$Hsl]"). iIntros (?) "Hsl". wp_pures. wp_apply (wp_StringFromBytes with "[$]"). - iIntros "_". rewrite string_to_bytes_to_string. + iIntros "_". wp_pures. iModIntro. by iApply "HΦ". Qed. -Lemma wp_EncodeValue (v:string) (l:u64) : +Lemma wp_EncodeValue (v:byte_string) (l:u64) : {{{ True }}} EncodeValue (to_val (cacheValueC.mk v l)) {{{ RET #(str encode_cacheValue v l); True }}}. @@ -166,7 +162,6 @@ Proof. iIntros "_". Opaque u64_le. simpl. rewrite replicate_0 /=. - rewrite bytes_to_string_app string_to_bytes_to_string. by iApply "HΦ". Qed. diff --git a/src/program_proof/ctrexample/server.v b/src/program_proof/ctrexample/server.v index a67360c2d..d0d974afb 100644 --- a/src/program_proof/ctrexample/server.v +++ b/src/program_proof/ctrexample/server.v @@ -15,7 +15,7 @@ Context `{!heapGS Σ}. Context `{!inG Σ mono_natUR}. Context `{stagedG Σ}. -Definition ctrname := "ctr". +Definition ctrname := "ctr"%go. Definition own_CtrServer_durable (c:u64) : iProp Σ := ∃ l, ctrname f↦ l ∗ diff --git a/src/program_proof/kv/interface.v b/src/program_proof/kv/interface.v index 4fee09968..3b530fc6b 100644 --- a/src/program_proof/kv/interface.v +++ b/src/program_proof/kv/interface.v @@ -1,10 +1,12 @@ From Perennial.program_proof Require Import grove_prelude. From Goose.github_com.mit_pdos.gokv Require Import kv. +Delimit Scope byte_string_scope with go. + Section definitions. Context `{!heapGS Σ}. (* KV points-to for the internal kv service *) -Implicit Types (kvptsto: string → string → iProp Σ). +Implicit Types (kvptsto: byte_string → byte_string → iProp Σ). Implicit Types (E:coPset). (* Specification of Kv interface. *) @@ -30,7 +32,7 @@ Definition is_Kv_ConditionalPut kvptsto E (CondPut_fn:val) : iProp Σ := <<< ∀∀ old_value, kvptsto key old_value >>> CondPut_fn #(LitString key) #(LitString expect) #(LitString value) @ E <<< kvptsto key (if bool_decide (expect = old_value) then value else old_value) >>> - {{{ RET #(LitString (if bool_decide (expect = old_value) then "ok" else "")); True }}}. + {{{ RET #(LitString (if bool_decide (expect = old_value) then "ok"%go else ""%go)); True }}}. Definition is_Kv (k:loc) kvptsto E : iProp Σ := ∃ Put_fn Get_fn CondPut_fn, @@ -50,7 +52,7 @@ Section hocap_definitions. Context `{!heapGS Σ}. (* HoCAP predicate *) -Implicit Types (P: gmap string string → iProp Σ). +Implicit Types (P: gmap byte_string byte_string → iProp Σ). Implicit Types (E:coPset). (* Specification of Kv interface. *) @@ -66,14 +68,14 @@ Definition is_Kv_Put_hocap P E (Put_fn:val) : iProp Σ := Definition is_Kv_Get_hocap P E (Get_fn:val) : iProp Σ := ∀ key Q, - {{{ ∀ σ, P σ ={E}=∗ P σ ∗ Q (default "" (σ !! key)) }}} + {{{ ∀ σ, P σ ={E}=∗ P σ ∗ Q (default ""%go (σ !! key)) }}} Get_fn #(LitString key) @ E {{{ value, RET #(LitString value); Q value }}}. (* equivalent to the above, but maybe a bit cleaner by writing it with WP directly *) Definition is_Kv_Get_hocap2 P E (Get_fn:val) : iProp Σ := ∀ key Φ, - (∀ σ, P σ ={E}=∗ P σ ∗ Φ #(LitString (default "" (σ !! key)))) -∗ + (∀ σ, P σ ={E}=∗ P σ ∗ Φ #(LitString (default ""%go (σ !! key)))) -∗ WP Get_fn #(LitString key) @ E {{ Φ }} . diff --git a/src/program_proof/lock/lock_proof.v b/src/program_proof/lock/lock_proof.v index d27177647..7932c206f 100644 --- a/src/program_proof/lock/lock_proof.v +++ b/src/program_proof/lock/lock_proof.v @@ -9,12 +9,12 @@ Context `{!gooseGlobalGS Σ}. Record lock_names := { - kvptsto_lock : string → string → iProp Σ + kvptsto_lock : byte_string → byte_string → iProp Σ } . Definition lock_inv γ key R : iProp Σ := - ∃ b : bool, kvptsto_lock γ key (if b then "1" else "") ∗ if b then True else R. + ∃ b : bool, kvptsto_lock γ key (if b then "1"%go else ""%go) ∗ if b then True else R. Definition is_lock N `{invGS Σ} γ key R := inv N (lock_inv γ key R). diff --git a/src/program_proof/lockservice/aof_proof.v b/src/program_proof/lockservice/aof_proof.v index 54cd061fc..7d1ab8ed4 100644 --- a/src/program_proof/lockservice/aof_proof.v +++ b/src/program_proof/lockservice/aof_proof.v @@ -72,7 +72,7 @@ Definition is_aof aof_ptr γ (aof_ctx : (list u8) → iProp Σ) : iProp Σ := . (* TODO: upgrade to WPC *) -Lemma wp_CreateAppendOnlyFile (fname:string) data aof_ctx : +Lemma wp_CreateAppendOnlyFile (fname:byte_string) data aof_ctx : {{{ fname f↦{1} data ∗ aof_ctx data diff --git a/src/program_proof/lockservice/grove_ffi.v b/src/program_proof/lockservice/grove_ffi.v index 2b5625684..b70f8e978 100644 --- a/src/program_proof/lockservice/grove_ffi.v +++ b/src/program_proof/lockservice/grove_ffi.v @@ -26,10 +26,10 @@ Context `{!heapGS Σ}. Class filesysG Σ := FileSysG { filesys_gname : gname ; (* Name of str -> []byte authmap used for filesys ffi *) - #[global] filesys_inG :: mapG Σ string (list byte) + #[global] filesys_inG :: mapG Σ byte_string (list byte) }. -Definition file_pointsto {fG:filesysG Σ} (s:string) (c:list byte) (q:Qp): iProp Σ := +Definition file_pointsto {fG:filesysG Σ} (s:byte_string) (c:list byte) (q:Qp): iProp Σ := s [[filesys_gname]]↦{q} c. Context `{!filesysG Σ}. @@ -83,7 +83,7 @@ Axiom wpc_AtomicAppend : ∀ filename content_old content (content_sl:Slice.t) q filename f↦ (content_old ++ content) }}}. -Definition u64_to_string : u64 -> string := λ u, NilZero.string_of_int (Z.to_int (uint.Z u)). +Definition u64_to_string : u64 -> byte_string := λ u, NilZero.string_of_int (Z.to_int (uint.Z u)). (* Spec for W64ToString will be annoying *) Axiom wp_U64ToString : ∀ (u:u64), @@ -97,7 +97,7 @@ Axiom wp_U64ToString : ∀ (u:u64), Class rpcregG Σ := RpcRegG { rpcreg_gname : gname ; - #[global] rpcreg_inG :: ghost_mapG Σ (string*u64) ((list u8 → laterO (iPropO Σ)) * (list u8 → list u8 → laterO (iPropO Σ))) + #[global] rpcreg_inG :: ghost_mapG Σ (byte_string*u64) ((list u8 → laterO (iPropO Σ)) * (list u8 → list u8 → laterO (iPropO Σ))) }. (* XXX: these laters probably aren't a problem, because the eventual implementation of RPC will possibly have to use invariants to move the Pre to diff --git a/src/program_proof/lockservice/kv_proof.v b/src/program_proof/lockservice/kv_proof.v index 841444bba..e8004ae91 100644 --- a/src/program_proof/lockservice/kv_proof.v +++ b/src/program_proof/lockservice/kv_proof.v @@ -31,7 +31,7 @@ Definition Put_Pre γ : RPCValsC -> iProp Σ := (λ args, args.(W64_1) [[γ.(ks_ Definition Put_Post γ : RPCValsC -> u64 -> iProp Σ := (λ args _, args.(W64_1) [[γ.(ks_kvMapGN)]]↦ args.(W64_2))%I. (* FIXME: this is currently just a placeholder *) -Definition KVClerk_own γ ck_ptr (host : string) : iProp Σ := +Definition KVClerk_own γ ck_ptr (host : byte_string) : iProp Σ := ∃ (cl_ptr:loc), "Hcl_ptr" ∷ ck_ptr ↦[KVClerk :: "client"] #cl_ptr ∗ "Hprimary" ∷ ck_ptr ↦[KVClerk :: "primary"] #(str host) ∗ @@ -250,14 +250,14 @@ Qed. (* TODO: see if any more repetition can be removed *) -Definition is_kvserver_host γ (host:string) : iProp Σ := +Definition is_kvserver_host γ (host:byte_string) : iProp Σ := "#Hputspec" ∷ ( handler_is2 host (W64 1) γ.(ks_rpcGN) (Put_Pre γ) (Put_Post γ)) ∗ "#Hgetspec" ∷ (∀ va, handler_is2 host (W64 2) γ.(ks_rpcGN) (Get_Pre γ va) (Get_Post γ va)) ∗ "#Hrpcserver" ∷ is_RPCServer γ.(ks_rpcGN). -Lemma KVClerk__Get_spec (kck:loc) (srv:string) (key va:u64) γ : +Lemma KVClerk__Get_spec (kck:loc) (srv:byte_string) (key va:u64) γ : is_kvserver_host γ srv -∗ {{{ KVClerk_own γ kck srv ∗ (key [[γ.(ks_kvMapGN)]]↦ va) @@ -289,7 +289,7 @@ Proof. iExists _; iFrame. Qed. -Lemma KVClerk__Put_spec (kck:loc) (srv:string) (key va:u64) γ : +Lemma KVClerk__Put_spec (kck:loc) (srv:byte_string) (key va:u64) γ : is_kvserver_host γ srv -∗ {{{ KVClerk_own γ kck srv ∗ (key [[γ.(ks_kvMapGN)]]↦ _ ) diff --git a/src/program_proof/lockservice/rpc_proof.v b/src/program_proof/lockservice/rpc_proof.v index 9ed14f1c4..cb650e87b 100644 --- a/src/program_proof/lockservice/rpc_proof.v +++ b/src/program_proof/lockservice/rpc_proof.v @@ -58,7 +58,7 @@ Definition RPCServer_own_vol (sv:loc) (γrpc:rpc_names) (lastSeqM lastReplyM:gma Definition Reply64 := @RPCReply (u64). -Definition RPCClient_own_vol (cl_ptr:loc) (cid seqno:u64) (host:string) : iProp Σ := +Definition RPCClient_own_vol (cl_ptr:loc) (cid seqno:u64) (host:byte_string) : iProp Σ := ∃ (rawCl:loc), "%" ∷ ⌜uint.nat seqno > 0⌝ ∗ "Hcid" ∷ cl_ptr ↦[RPCClient :: "cid"] #cid ∗ @@ -67,7 +67,7 @@ Definition RPCClient_own_vol (cl_ptr:loc) (cid seqno:u64) (host:string) : iProp "HrawClOwn" ∷ grove_ffi.RPCClient_own rawCl host . -Definition RPCClient_own (cl_ptr:loc) (host:string) γrpc : iProp Σ := +Definition RPCClient_own (cl_ptr:loc) (host:byte_string) γrpc : iProp Σ := ∃ cid seqno, RPCClient_own_vol cl_ptr cid seqno host ∗ RPCClient_own_ghost γrpc cid seqno @@ -453,7 +453,7 @@ Definition EncodedPost2 {X:Type} Post : (X → list u8 → list u8 → iProp Σ) (* This says an rpc handler has the given PreCond and PostCond; it does NOT say that the handler sits behind a reply table with the given Pre/Post. *) -Definition handler_is2 (X:Type) (host:string) (rpcid:u64) PreCond PostCond : iProp Σ := +Definition handler_is2 (X:Type) (host:byte_string) (rpcid:u64) PreCond PostCond : iProp Σ := handler_is X host rpcid (EncodedPre2 PreCond) (EncodedPost2 PostCond) . @@ -461,7 +461,7 @@ Definition is_rpcHandler2 {X:Type} f Pre Post : iProp Σ := is_rpcHandler (X:=X) f (EncodedPre2 Pre) (EncodedPost2 Post) . -Lemma wp_RemoteProcedureCall2 (cl_ptr req_ptr reply_ptr:loc) (host:string) (rpcid:u64) (req:RPCRequestID) args (reply:Reply64) X PreCond PostCond x: +Lemma wp_RemoteProcedureCall2 (cl_ptr req_ptr reply_ptr:loc) (host:byte_string) (rpcid:u64) (req:RPCRequestID) args (reply:Reply64) X PreCond PostCond x: handler_is2 X host rpcid PreCond PostCond -∗ {{{ "#HargsPre" ∷ □ PreCond x req args ∗ @@ -549,7 +549,7 @@ Proof. done. Admitted. -Lemma RPCClient__MakeRequest_spec {X:Type} (host:string) (rpcid:u64) cl_ptr args γrpc X PreCond PostCond (x:X): +Lemma RPCClient__MakeRequest_spec {X:Type} (host:byte_string) (rpcid:u64) cl_ptr args γrpc X PreCond PostCond (x:X): ∀ RawPreCond, handler_is2 X host rpcid RawPreCond (λ y req args reply, RPCRequestStale γrpc req ∨ RPCReplyReceipt γrpc req reply.(Rep_Ret)) -∗ □(∀ y req γreq, is_RPCRequest γrpc γreq (PreCond x args) (PostCond x args) req -∗ RawPreCond y req args) -∗ {{{ @@ -648,7 +648,7 @@ Proof using Type*. iPureIntro. lia. Qed. -Lemma MakeRPCClient_spec γrpc (host : string) (cid : u64) : +Lemma MakeRPCClient_spec γrpc (host : byte_string) (cid : u64) : {{{ RPCClient_own_ghost γrpc cid 1 }}} MakeRPCClient #(str host) #cid {{{ cl, RET #cl; RPCClient_own cl host γrpc }}}. diff --git a/src/program_proof/map_string_marshal_proof.v b/src/program_proof/map_string_marshal_proof.v index 2f97dec28..7ca9a01db 100644 --- a/src/program_proof/map_string_marshal_proof.v +++ b/src/program_proof/map_string_marshal_proof.v @@ -6,28 +6,28 @@ Section map_string_marshal_proof. Context `{!heapGS Σ}. -Local Definition encode_maplist (l:list (string * string)) : list u8 := +Local Definition encode_maplist (l:list (byte_string * byte_string)) : list u8 := flat_map (λ u, - (u64_le (String.length u.1)) ++ - (string_to_bytes u.1) ++ - (u64_le (String.length u.2)) ++ - (string_to_bytes u.2)) l. + (u64_le (length u.1)) ++ + (u.1) ++ + (u64_le (length u.2)) ++ + (u.2)) l. Local Lemma encode_maplist_cons k data l : encode_maplist ((k, data)::l) = - ((u64_le $ String.length k) ++ - (string_to_bytes k) ++ - (u64_le $ String.length $ data) ++ - (string_to_bytes data)) ++ encode_maplist l. + ((u64_le $ length k) ++ + k ++ + (u64_le $ length $ data) ++ + data) ++ encode_maplist l. Proof. done. Qed. -Local Definition has_partial_map_encoding (enc:list u8) (fullsize: u64) (m:gmap string string) : Prop := +Local Definition has_partial_map_encoding (enc:list u8) (fullsize: u64) (m:gmap byte_string byte_string) : Prop := ∃ l, NoDup l.*1 ∧ (list_to_map l) = m ∧ enc = (u64_le fullsize) ++ encode_maplist l. -Definition has_string_map_encoding (enc:list u8) (m:gmap string string) : Prop := +Definition has_string_map_encoding (enc:list u8) (m:gmap byte_string byte_string) : Prop := uint.Z (size m) = size m ∧ has_partial_map_encoding enc (size m) m. Lemma wp_EncodeStringMap mptr m : @@ -173,7 +173,7 @@ Proof. wp_load. wp_load. iDestruct (own_slice_small_sz with "Hs") as %Hsl_sz. wp_apply (wp_ReadBytes with "[$]"). - { rewrite string_bytes_length. rewrite length_app in Hsl_sz. word. } + { rewrite length_app in Hsl_sz. word. } iIntros "* [Hksl Hs]". wp_pures. wp_store. wp_store. wp_load. wp_apply (wp_ReadInt with "Hs"). iIntros (?) "Hs". @@ -181,7 +181,7 @@ Proof. wp_load. wp_load. clear Hsl_sz. iDestruct (own_slice_small_sz with "Hs") as %Hsl_sz. wp_apply (wp_ReadBytes with "[$]"). - { rewrite string_bytes_length. rewrite length_app in Hsl_sz. word. } + { rewrite length_app in Hsl_sz. word. } iIntros "* [Hvsl Hs]". wp_pures. wp_store. wp_store. wp_load. wp_apply (wp_StringFromBytes with "[$Hvsl]"). @@ -189,7 +189,6 @@ Proof. wp_load. wp_apply (wp_StringFromBytes with "[$Hksl]"). iIntros "_". - repeat rewrite string_to_bytes_to_string. wp_apply (wp_MapInsert with "[$]"). { done. } iIntros "Hm". wp_pures. iApply "HΦ". iModIntro. diff --git a/src/program_proof/mvcc/mvcc_prelude.v b/src/program_proof/mvcc/mvcc_prelude.v index ab665b8ee..3c916361c 100644 --- a/src/program_proof/mvcc/mvcc_prelude.v +++ b/src/program_proof/mvcc/mvcc_prelude.v @@ -3,12 +3,12 @@ From Perennial.program_logic Require Export atomic. (* prefer the ncfupd atomics (* Prefer untyped slices. *) Export Perennial.goose_lang.lib.slice.slice. -Definition dbval := option string. +Definition dbval := option byte_string. Canonical Structure dbvalO := leibnizO dbval. Notation Nil := (None : dbval). Notation Value x := (Some x : dbval). -Definition to_dbval (b : bool) (v : string) := +Definition to_dbval (b : bool) (v : byte_string) := if b then Value v else Nil. Definition dbmap := gmap u64 dbval. diff --git a/src/program_proof/mvcc/strnum.v b/src/program_proof/mvcc/strnum.v index 2f1d33bed..efbe97153 100644 --- a/src/program_proof/mvcc/strnum.v +++ b/src/program_proof/mvcc/strnum.v @@ -12,7 +12,7 @@ Lemma u64_to_string_inj n1 n2 : n1 = n2. Admitted. -Theorem wp_StringToU64 (s : string) (n : u64) : +Theorem wp_StringToU64 (s : byte_string) (n : u64) : {{{ ⌜u64_to_string n = s⌝ }}} StringToU64 #(LitString s) {{{ (n : u64), RET #n; ⌜u64_to_string n = s⌝ }}}. @@ -21,7 +21,7 @@ Admitted. Theorem wp_U64ToString (n : u64) : {{{ True }}} U64ToString #n - {{{ (s : string), RET #(LitString s); ⌜u64_to_string n = s⌝ }}}. + {{{ (s : byte_string), RET #(LitString s); ⌜u64_to_string n = s⌝ }}}. Admitted. End program. diff --git a/src/program_proof/mvcc/tuple_append_version.v b/src/program_proof/mvcc/tuple_append_version.v index bfb6faa3a..013dd4eb2 100644 --- a/src/program_proof/mvcc/tuple_append_version.v +++ b/src/program_proof/mvcc/tuple_append_version.v @@ -6,7 +6,7 @@ Context `{!heapGS Σ, !mvcc_ghostG Σ}. (*****************************************************************) (* func (tuple *Tuple) appendVersion(tid uint64, val string) *) (*****************************************************************) -Theorem wp_tuple__appendVersion tuple (tid : u64) (val : string) owned tidlast vers : +Theorem wp_tuple__appendVersion tuple (tid : u64) (val : byte_string) owned tidlast vers : {{{ own_tuple_phys tuple owned tidlast vers }}} Tuple__appendVersion #tuple #tid #(LitString val) {{{ RET #(); own_tuple_phys tuple false (W64 (uint.Z tid + 1)) (vers ++ [(tid, false, val)]) }}}. @@ -49,7 +49,7 @@ Qed. (* func (tuple *Tuple) AppendVersion(tid uint64, val string) *) (*****************************************************************) Theorem wp_tuple__AppendVersion - tuple (tid : u64) (val : string) (key : u64) (sid : u64) + tuple (tid : u64) (val : byte_string) (key : u64) (sid : u64) (phys : list dbval) γ : {{{ active_tid γ tid sid ∗ own_tuple_locked tuple key (uint.nat tid) phys (extend (S (uint.nat tid)) phys ++ [Value val]) γ diff --git a/src/program_proof/mvcc/tuple_kill_version.v b/src/program_proof/mvcc/tuple_kill_version.v index 3b8002057..34c46cc76 100644 --- a/src/program_proof/mvcc/tuple_kill_version.v +++ b/src/program_proof/mvcc/tuple_kill_version.v @@ -9,7 +9,7 @@ Context `{!heapGS Σ, !mvcc_ghostG Σ}. Theorem wp_tuple__killVersion tuple (tid : u64) owned tidlast vers : {{{ own_tuple_phys tuple owned tidlast vers }}} Tuple__killVersion #tuple #tid - {{{ (ok : bool), RET #ok; own_tuple_phys tuple false (uint.Z tid + 1) (vers ++ [(tid, true, "")]) }}}. + {{{ (ok : bool), RET #ok; own_tuple_phys tuple false (uint.Z tid + 1) (vers ++ [(tid, true, ""%go)]) }}}. Proof. iIntros (Φ) "HtuplePhys HΦ". iNamed "HtuplePhys". diff --git a/src/program_proof/mvcc/tuple_mk.v b/src/program_proof/mvcc/tuple_mk.v index 195f541b7..ab45cef1c 100644 --- a/src/program_proof/mvcc/tuple_mk.v +++ b/src/program_proof/mvcc/tuple_mk.v @@ -92,7 +92,7 @@ Proof. { iNext. unfold P. unfold own_tuple. - iExists false, (W64 1), (W64 0), [(W64 0, true, "")], [Nil; Nil]. + iExists false, (W64 1), (W64 0), [(W64 0, true, ""%go)], [Nil; Nil]. iFrame. iSplit. { (* Prove [HtupleAbs]. *) diff --git a/src/program_proof/mvcc/tuple_prelude.v b/src/program_proof/mvcc/tuple_prelude.v index 6e339bb38..bd05d2531 100644 --- a/src/program_proof/mvcc/tuple_prelude.v +++ b/src/program_proof/mvcc/tuple_prelude.v @@ -1,7 +1,7 @@ From Perennial.program_proof.mvcc Require Export mvcc_prelude mvcc_misc mvcc_ghost mvcc_inv. From Goose.github_com.mit_pdos.vmvcc Require Export tuple. -Definition pver := (u64 * bool * string)%type. +Definition pver := (u64 * bool * byte_string)%type. (* TODO: rename to [pver_to_val]. *) Definition ver_to_val (x : pver) := @@ -25,9 +25,9 @@ Definition spec_lookup (vers : list pver) (tid : u64) : dbval := | None => Nil end. -Lemma val_to_ver_with_lookup (x : val) (l : list (u64 * bool * string)) (i : nat) : +Lemma val_to_ver_with_lookup (x : val) (l : list (u64 * bool * byte_string)) (i : nat) : (ver_to_val <$> l) !! i = Some x -> - (∃ (b : u64) (d : bool) (v : string), x = ver_to_val (b, d, v) ∧ l !! i = Some (b, d, v)). + (∃ (b : u64) (d : bool) (v : byte_string), x = ver_to_val (b, d, v) ∧ l !! i = Some (b, d, v)). Proof. intros H. apply list_lookup_fmap_inv in H as [[[y1 y2] y3] [Heq Hsome]]. diff --git a/src/program_proof/mvcc/tuple_read_version.v b/src/program_proof/mvcc/tuple_read_version.v index b1e14b5ac..d7bfbfea9 100644 --- a/src/program_proof/mvcc/tuple_read_version.v +++ b/src/program_proof/mvcc/tuple_read_version.v @@ -7,7 +7,7 @@ Context `{!heapGS Σ, !mvcc_ghostG Σ}. (* func findVersion(tid uint64, vers []Version) Version *) (*******************************************************************) Local Theorem wp_findVersion (tid : u64) (versS : Slice.t) - (vers : list (u64 * bool * string)) : + (vers : list (u64 * bool * byte_string)) : {{{ ⌜∃ (ver : pver), (ver ∈ vers) ∧ (uint.Z ver.1.1 < uint.Z tid)⌝ ∗ slice.own_slice versS (structTy Version) (DfracOwn 1) (ver_to_val <$> vers) }}} @@ -49,7 +49,7 @@ Proof. (* idx++ *) (* } *) (***********************************************************) - set P := λ (b : bool), (∃ (ver : u64 * bool * string) (idx : u64), + set P := λ (b : bool), (∃ (ver : u64 * bool * byte_string) (idx : u64), "HverR" ∷ (verR ↦[struct.t Version] ver_to_val ver) ∗ "HidxR" ∷ (idxR ↦[uint64T] #idx) ∗ "HversS" ∷ own_slice_small versS (struct.t Version) (DfracOwn 1) (ver_to_val <$> vers) ∗ @@ -144,7 +144,7 @@ Proof. } { (* Loop entry. *) unfold P. - iExists (W64 0, false, ""). + iExists (W64 0, false, ""%go). iExists _. iFrame. iPureIntro. @@ -307,7 +307,7 @@ Theorem wp_tuple__ReadVersion ⌜owned = false ∨ (uint.nat tid < length vchain)%nat⌝ }}} Tuple__ReadVersion #tuple #tid - {{{ (val : string) (found : bool), RET (#(LitString val), #found); + {{{ (val : byte_string) (found : bool), RET (#(LitString val), #found); active_tid γ tid sid ∗ ptuple_ptsto γ key (to_dbval found val) (uint.nat tid) }}}. Proof. diff --git a/src/program_proof/mvcc/tuple_remove_versions.v b/src/program_proof/mvcc/tuple_remove_versions.v index deb868054..5b11b2d3b 100644 --- a/src/program_proof/mvcc/tuple_remove_versions.v +++ b/src/program_proof/mvcc/tuple_remove_versions.v @@ -5,7 +5,7 @@ Context `{!heapGS Σ, !mvcc_ghostG Σ}. Lemma val_to_ver_with_val_ty (x : val) : val_ty x (uint64T * (boolT * (stringT * unitT))%ht) -> - (∃ (b : u64) (e : bool) (v : string), x = ver_to_val (b, e, v)). + (∃ (b : u64) (e : bool) (v : byte_string), x = ver_to_val (b, e, v)). Proof. intros H. inversion_clear H. diff --git a/src/program_proof/mvcc/txn_read.v b/src/program_proof/mvcc/txn_read.v index eed906c45..907ec6f65 100644 --- a/src/program_proof/mvcc/txn_read.v +++ b/src/program_proof/mvcc/txn_read.v @@ -34,7 +34,7 @@ Context `{!heapGS Σ, !mvcc_ghostG Σ}. Theorem wp_txn__Read txn tid view (k : u64) dbv γ τ : {{{ own_txn txn tid view γ τ ∗ txnmap_ptsto τ k dbv }}} Txn__Read #txn #k - {{{ (v : string) (found : bool), RET (#(LitString v), #found); + {{{ (v : byte_string) (found : bool), RET (#(LitString v), #found); own_txn txn tid view γ τ ∗ txnmap_ptsto τ k dbv ∗ ⌜dbv = to_dbval found v⌝ }}}. Proof. @@ -223,7 +223,7 @@ Proof. by iFrame "Hptsto". Qed. -Theorem wp_txn__Read_found txn tid view (k : u64) (v : string) γ τ : +Theorem wp_txn__Read_found txn tid view (k : u64) (v : byte_string) γ τ : {{{ own_txn txn tid view γ τ ∗ txnmap_ptsto τ k (Some v) }}} Txn__Read #txn #k {{{ RET (#(LitString v), #true); diff --git a/src/program_proof/mvcc/wrbuf_prelude.v b/src/program_proof/mvcc/wrbuf_prelude.v index 901cb27fc..f063fe144 100644 --- a/src/program_proof/mvcc/wrbuf_prelude.v +++ b/src/program_proof/mvcc/wrbuf_prelude.v @@ -1,12 +1,12 @@ From Perennial.program_proof.mvcc Require Export mvcc_prelude mvcc_misc mvcc_ghost. From Goose.github_com.mit_pdos.vmvcc Require Export wrbuf. -Definition wrent := (u64 * string * bool * loc)%type. +Definition wrent := (u64 * byte_string * bool * loc)%type. Definition wrent_to_val (x : wrent) := (#x.1.1.1, (#(LitString x.1.1.2), (#x.1.2, (#x.2, #()))))%V. -Lemma wrent_to_val_unfold (k : u64) (v : string) (w : bool) (t : loc) : +Lemma wrent_to_val_unfold (k : u64) (v : byte_string) (w : bool) (t : loc) : (#k, (#(LitString v), (#w, (#t, #()))))%V = wrent_to_val (k, v, w, t). Proof. reflexivity. Qed. @@ -18,7 +18,7 @@ Definition wrent_to_key_tpl (x : wrent) : (u64 * loc) := Lemma val_to_wrent_with_val_ty (x : val) : val_ty x (uint64T * (stringT * (boolT * (ptrT * unitT))))%ht -> - (∃ (k : u64) (v : string) (w : bool) (t : loc), x = wrent_to_val (k, v, w, t)). + (∃ (k : u64) (v : byte_string) (w : bool) (t : loc), x = wrent_to_val (k, v, w, t)). Proof. intros H. inversion_clear H. @@ -46,7 +46,7 @@ Qed. Lemma wrent_to_val_with_lookup (x : val) (l : list wrent) (i : nat) : (wrent_to_val <$> l) !! i = Some x -> - (∃ (k : u64) (v : string) (w : bool) (t : loc), x = wrent_to_val (k, v, w, t) ∧ l !! i = Some (k, v, w, t)). + (∃ (k : u64) (v : byte_string) (w : bool) (t : loc), x = wrent_to_val (k, v, w, t) ∧ l !! i = Some (k, v, w, t)). Proof. intros H. apply list_lookup_fmap_inv in H as [[[[k v] w] t] [Heq Hsome]]. diff --git a/src/program_proof/mvcc/wrbuf_proof.v b/src/program_proof/mvcc/wrbuf_proof.v index 38fd16cc2..9f24bcea4 100644 --- a/src/program_proof/mvcc/wrbuf_proof.v +++ b/src/program_proof/mvcc/wrbuf_proof.v @@ -197,7 +197,7 @@ Proof. Qed. (* TODO: Return values first or others first? Make it consistent. *) -Definition spec_wrbuf__Lookup (v : string) (b ok : bool) (key : u64) (m : gmap u64 dbval) := +Definition spec_wrbuf__Lookup (v : byte_string) (b ok : bool) (key : u64) (m : gmap u64 dbval) := if ok then m !! key = Some (to_dbval b v) else m !! key = None. (*****************************************************************) @@ -206,7 +206,7 @@ Definition spec_wrbuf__Lookup (v : string) (b ok : bool) (key : u64) (m : gmap u Theorem wp_wrbuf__Lookup wrbuf (key : u64) m : {{{ own_wrbuf_xtpls wrbuf m }}} WrBuf__Lookup #wrbuf #key - {{{ (v : string) (b ok : bool), RET (#(LitString v), #b, #ok); + {{{ (v : byte_string) (b ok : bool), RET (#(LitString v), #b, #ok); own_wrbuf_xtpls wrbuf m ∗ ⌜spec_wrbuf__Lookup v b ok key m⌝ }}}. Proof. @@ -271,7 +271,7 @@ Qed. (*****************************************************************) (* func (wrbuf *WrBuf) Put(key, val uint64) *) (*****************************************************************) -Theorem wp_wrbuf__Put wrbuf (key : u64) (val : string) m : +Theorem wp_wrbuf__Put wrbuf (key : u64) (val : byte_string) m : {{{ own_wrbuf_xtpls wrbuf m }}} WrBuf__Put #wrbuf #key #(LitString val) {{{ RET #(); own_wrbuf_xtpls wrbuf (<[ key := Value val ]> m) }}}. @@ -547,7 +547,7 @@ Proof. iApply "HΦ". unfold spec_search in Hsearch. (* [(W64 0), ""] is the zero-value of [u64, string]. *) - set ents' := (ents ++ [(key, "", false, null)]). + set ents' := (ents ++ [(key, ""%go, false, null)]). unfold own_wrbuf_xtpls. iExists _, ents'. diff --git a/src/program_proof/pav/serde.v b/src/program_proof/pav/serde.v index a9c0e00fc..7c965e9cb 100644 --- a/src/program_proof/pav/serde.v +++ b/src/program_proof/pav/serde.v @@ -146,13 +146,13 @@ End MapLabelPre. Module UpdateProof. Record t : Type := mk { - Updates : gmap string (list w8); + Updates : gmap byte_string (list w8); Sig: list w8 }. Section defs. Context `{!heapGS Σ}. Definition own (ptr : loc) (obj : t) : iProp Σ := - ∃ (updates_mref : loc) (updatesM : gmap string (Slice.t)) sig_sl, + ∃ (updates_mref : loc) (updatesM : gmap byte_string (Slice.t)) sig_sl, "HUpdates" ∷ ptr ↦[UpdateProof :: "Updates"] #updates_mref ∗ "HSig" ∷ ptr ↦[UpdateProof :: "Sig"] (slice_val sig_sl) ∗ "#HUpdatesM" ∷ own_map updates_mref DfracDiscarded updatesM ∗ diff --git a/src/program_proof/rsm/distx/base.v b/src/program_proof/rsm/distx/base.v index eabf2a7f6..3da3f90e7 100644 --- a/src/program_proof/rsm/distx/base.v +++ b/src/program_proof/rsm/distx/base.v @@ -1,7 +1,7 @@ From Perennial.program_proof Require Import grove_prelude. -Definition dbkey := string. -Definition dbval := option string. +Definition dbkey := byte_string. +Definition dbval := option byte_string. Definition dbhist := list dbval. Definition dbtpl := (dbhist * nat)%type. Definition dbmod := (dbkey * dbval)%type. @@ -59,13 +59,13 @@ Proof. refine {| to_val := dbmod_to_val; from_val := dbmod_from_val; - IntoVal_def := ("", None); + IntoVal_def := (""%go, None); |}. intros [k v]. by destruct v. Defined. -Definition fstring := {k : string | (String.length k < 2 ^ 64)%nat}. +Definition fstring := {k : byte_string | (length k < 2 ^ 64)%nat}. #[local] Instance fstring_finite : @@ -73,7 +73,7 @@ Instance fstring_finite : Admitted. (* Definition keys_all : gset string := fin_to_set fstring. *) -Definition keys_all : gset string. +Definition keys_all : gset byte_string. Admitted. (** Transaction status on group/replica. *) diff --git a/src/program_proof/rsm/distx/program/index.v b/src/program_proof/rsm/distx/program/index.v index 5744ab365..adec01396 100644 --- a/src/program_proof/rsm/distx/program/index.v +++ b/src/program_proof/rsm/distx/program/index.v @@ -13,7 +13,7 @@ Section program. Persistent (is_index idx α). Admitted. - Theorem wp_Index__GetTuple (idx : loc) (key : string) α : + Theorem wp_Index__GetTuple (idx : loc) (key : byte_string) α : key ∈ keys_all -> is_index idx α -∗ {{{ True }}} diff --git a/src/program_proof/rsm/distx/program/replica.v b/src/program_proof/rsm/distx/program/replica.v index d0765b37a..f35d5ba53 100644 --- a/src/program_proof/rsm/distx/program/replica.v +++ b/src/program_proof/rsm/distx/program/replica.v @@ -868,7 +868,7 @@ Section program. by iApply "HΦ". Qed. - Theorem wp_Replica__Read (rp : loc) (ts : u64) (key : string) (gid : groupid) γ p α : + Theorem wp_Replica__Read (rp : loc) (ts : u64) (key : byte_string) (gid : groupid) γ p α : safe_read gid (uint.nat ts) key -> know_distx_inv γ p -∗ is_replica rp gid γ α -∗ @@ -982,7 +982,7 @@ Section program. ([∗ map] key ↦ tpl ∈ tpls_group gid tpls, hist_repl_lb γ key tpl.1). Theorem wp_Replica__applyRead - (rp : loc) (ts : u64) (key : string) (tpls tpls' : gmap dbkey dbtpl) + (rp : loc) (ts : u64) (key : byte_string) (tpls tpls' : gmap dbkey dbtpl) (stm stm' : gmap nat txnst) gid γ α : dom tpls = keys_all -> valid_key key -> diff --git a/src/program_proof/rsm/distx/program/replica_group.v b/src/program_proof/rsm/distx/program/replica_group.v index ff8a6083d..e5ff0604a 100644 --- a/src/program_proof/rsm/distx/program/replica_group.v +++ b/src/program_proof/rsm/distx/program/replica_group.v @@ -63,7 +63,7 @@ Section program. (*@ } @*) Admitted. - Theorem wp_ReplicaGroup__Read (rg : loc) (ts : u64) (key : string) gid γ : + Theorem wp_ReplicaGroup__Read (rg : loc) (ts : u64) (key : byte_string) gid γ : safe_read gid (uint.nat ts) key -> is_rg rg gid γ -∗ {{{ True }}} diff --git a/src/program_proof/rsm/distx/program/tuple.v b/src/program_proof/rsm/distx/program/tuple.v index dacf7b050..5ccd175c6 100644 --- a/src/program_proof/rsm/distx/program/tuple.v +++ b/src/program_proof/rsm/distx/program/tuple.v @@ -12,13 +12,13 @@ Section resource. the replica invariant, essentially forcing GC to not change the abstract view. *) - Definition hist_phys_quarter α (key : string) (hist : dbhist) : iProp Σ. + Definition hist_phys_quarter α (key : byte_string) (hist : dbhist) : iProp Σ. Admitted. - Definition hist_phys_half α (key : string) (hist : dbhist) : iProp Σ. + Definition hist_phys_half α (key : byte_string) (hist : dbhist) : iProp Σ. Admitted. - Definition hist_phys_lb α (key : string) (hist : dbhist) : iProp Σ. + Definition hist_phys_lb α (key : byte_string) (hist : dbhist) : iProp Σ. Admitted. #[global] @@ -43,13 +43,13 @@ Section resource. ⌜prefix histp hist⌝. Admitted. - Definition hist_phys_at α (key : string) (ts : nat) (v : dbval) : iProp Σ := + Definition hist_phys_at α (key : byte_string) (ts : nat) (v : dbval) : iProp Σ := ∃ hist, ⌜hist !! ts = Some v⌝ ∗ hist_phys_lb α key hist. - Definition ts_phys_half α (key : string) (tsprep : nat) : iProp Σ. + Definition ts_phys_half α (key : byte_string) (tsprep : nat) : iProp Σ. Admitted. - Definition tuple_phys_half α (key : string) (hist : dbhist) (tsprep : nat) : iProp Σ := + Definition tuple_phys_half α (key : byte_string) (hist : dbhist) (tsprep : nat) : iProp Σ := hist_phys_half α key hist ∗ ts_phys_half α key tsprep. End resource. @@ -57,7 +57,7 @@ End resource. Section program. Context `{!heapGS Σ, !distx_ghostG Σ}. - Definition is_tuple (tuple : loc) (key : string) (α : replica_names) : iProp Σ. + Definition is_tuple (tuple : loc) (key : byte_string) (α : replica_names) : iProp Σ. Admitted. #[global] @@ -71,7 +71,7 @@ Section program. timestamp different from the prepared timestamp. A more fundamental reason to this difference is that while Paxos allows deducing commit safety at the *replica* level, PCR can only deduce such at the *replica group* level. *) - Theorem wp_Tuple__AppendVersion (tuple : loc) (tid : u64) (val : string) key α : + Theorem wp_Tuple__AppendVersion (tuple : loc) (tid : u64) (val : byte_string) key α : is_tuple tuple key α -∗ {{{ True }}} <<< ∀∀ hist, hist_phys_half α key hist ∗ ⌜(length hist ≤ uint.nat tid)%nat⌝ >>> diff --git a/src/program_proof/rsm/distx/program/txn.v b/src/program_proof/rsm/distx/program/txn.v index 00405fca8..075afe49b 100644 --- a/src/program_proof/rsm/distx/program/txn.v +++ b/src/program_proof/rsm/distx/program/txn.v @@ -145,7 +145,7 @@ Section program. (* diff from [own_txn_stable] *) "%Hptgs" ∷ ⌜list_to_set ptgs = ptgroups (dom wrs)⌝. - Lemma wp_ResolveRead γ p (tid : u64) (key : string) (ts : nat) : + Lemma wp_ResolveRead γ p (tid : u64) (key : byte_string) (ts : nat) : ⊢ {{{ ⌜uint.nat tid = ts⌝ }}} <<< ∀∀ acs, txn_proph γ p acs >>> ResolveRead #p #tid #(LitString key) @ ∅ @@ -170,7 +170,7 @@ Section program. {{{ RET #(); own_wrs wrsP wrs }}}. Admitted. - Theorem wp_KeyToGroup (key : string) : + Theorem wp_KeyToGroup (key : byte_string) : {{{ True }}} KeyToGroup #(LitString key) {{{ (gid : u64), RET #gid; ⌜key_to_group key = gid⌝ }}}. @@ -181,7 +181,7 @@ Section program. (*@ } @*) Admitted. - Theorem wp_Txn__getwrs (txn : loc) (key : string) wrs : + Theorem wp_Txn__getwrs (txn : loc) (key : byte_string) wrs : {{{ own_txn_wrs txn wrs }}} Txn__getwrs #txn #(LitString key) {{{ (v : dbval) (ok : bool), RET (dbval_to_val v, #ok); @@ -235,7 +235,7 @@ Section program. by destruct Hv. Qed. - Theorem wp_Txn__setwrs (txn : loc) (key : string) (value : dbval) wrs : + Theorem wp_Txn__setwrs (txn : loc) (key : byte_string) (value : dbval) wrs : {{{ own_txn_wrs txn wrs }}} Txn__setwrs #txn #(LitString key) (dbval_to_val value) {{{ RET #(); own_txn_wrs txn (<[key := value]> wrs) }}}. diff --git a/src/program_proof/rsm/distx/program/txnlog.v b/src/program_proof/rsm/distx/program/txnlog.v index 8f87de407..a3ed86745 100644 --- a/src/program_proof/rsm/distx/program/txnlog.v +++ b/src/program_proof/rsm/distx/program/txnlog.v @@ -101,7 +101,7 @@ Section program. Admitted. Theorem wp_TxnLog__SubmitRead - (log : loc) (ts : u64) (key : string) (gid : groupid) γ : + (log : loc) (ts : u64) (key : byte_string) (gid : groupid) γ : is_txnlog log gid γ -∗ {{{ True }}} <<< ∀∀ vs, cpool_half γ gid vs >>> diff --git a/src/program_proof/rsm/fpaxos_inv.v b/src/program_proof/rsm/fpaxos_inv.v index 931c9c6a7..25cf52a36 100644 --- a/src/program_proof/rsm/fpaxos_inv.v +++ b/src/program_proof/rsm/fpaxos_inv.v @@ -147,7 +147,7 @@ Section pure. let ps := fmap (latest_before n) bsq in map_fold latest_before_quorum_step O ps. - Definition is_fast (l : ballot) (n : nat) (v : string) := + Definition is_fast (l : ballot) (n : nat) (v : byte_string) := l !! n = Some (FAccept v). #[local] @@ -155,10 +155,10 @@ Section pure. Decision (is_fast l n v). Proof. unfold is_fast. apply _. Qed. - Definition nfast (bsq : gmap A ballot) (n : nat) (v : string) := + Definition nfast (bsq : gmap A ballot) (n : nat) (v : byte_string) := size (filter (λ x : A * ballot, is_fast x.2 n v) bsq). - Definition nfastneg (bsq : gmap A ballot) (n : nat) (v : string) := + Definition nfastneg (bsq : gmap A ballot) (n : nat) (v : byte_string) := size (filter (λ x : A * ballot, not (is_fast x.2 n v)) bsq). Definition equal_max_occurrence (bsq : gmap A ballot) n v := diff --git a/src/program_proof/rsm/fpaxos_top.v b/src/program_proof/rsm/fpaxos_top.v index 6cc701069..2aeb0a52b 100644 --- a/src/program_proof/rsm/fpaxos_top.v +++ b/src/program_proof/rsm/fpaxos_top.v @@ -3,15 +3,15 @@ *) From Perennial.program_proof Require Export grove_prelude. -Inductive proposal : Set := +Inductive proposal : Type := | Any -| Proposed (v : string). +| Proposed (v : byte_string). Definition proposals := gmap nat proposal. -Inductive vote : Set := +Inductive vote : Type := | Reject | CAccept -| FAccept (v : string). +| FAccept (v : byte_string). Definition ballot := list vote. #[global] @@ -19,8 +19,8 @@ Instance vote_eq_decision : EqDecision vote. Proof. solve_decision. Qed. -Inductive consensus : Set := -| Chosen (v : string) +Inductive consensus : Type := +| Chosen (v : byte_string) | Free. Definition prefixes `{Countable A} {B : Type} (lbs ls : gmap A (list B)) := diff --git a/src/program_proof/rsm/mpaxos_proof.v b/src/program_proof/rsm/mpaxos_proof.v index f9d3e0ae7..fa366fbf6 100644 --- a/src/program_proof/rsm/mpaxos_proof.v +++ b/src/program_proof/rsm/mpaxos_proof.v @@ -13,19 +13,19 @@ Section consensus. Implicit Type (γ : mpaxos_names). (* Definitions. *) - Definition own_consensus γ (l : list string) : iProp Σ. + Definition own_consensus γ (l : list byte_string) : iProp Σ. Admitted. - Definition own_consensus_half γ (l : list string) : iProp Σ. + Definition own_consensus_half γ (l : list byte_string) : iProp Σ. Admitted. - Definition is_consensus_lb γ (l : list string) : iProp Σ. + Definition is_consensus_lb γ (l : list byte_string) : iProp Σ. Admitted. - Definition own_candidates γ (vs : gset string) : iProp Σ. + Definition own_candidates γ (vs : gset byte_string) : iProp Σ. Admitted. - Definition own_candidates_half γ (vs : gset string) : iProp Σ. + Definition own_candidates_half γ (vs : gset byte_string) : iProp Σ. Admitted. (* Type class instances. *) @@ -111,7 +111,7 @@ Section prog. Persistent (is_paxos px nid sc γ). Admitted. - Theorem wp_Paxos__Propose (px : loc) (v : string) nid sc γ : + Theorem wp_Paxos__Propose (px : loc) (v : byte_string) nid sc γ : is_paxos px nid sc γ -∗ {{{ True }}} <<< ∀∀ vs, own_candidates_half γ vs >>> @@ -126,7 +126,7 @@ Section prog. <<< ∀∀ l, own_consensus_half γ l >>> Paxos__Lookup #px #i @ ↑mpaxosN <<< ∃∃ l', own_consensus_half γ l' >>> - {{{ (v : string) (ok : bool), RET (#(LitString v), #ok); + {{{ (v : byte_string) (ok : bool), RET (#(LitString v), #ok); ⌜if ok then l' !! (uint.nat i) = Some v else True⌝ }}}. Admitted. @@ -154,12 +154,12 @@ End prog. (* TODO: move to mpaxos_examples.v once stable *) (* example1 *) -Definition of_length_five s := String.length s = 5%nat. +Definition of_length_five (s : byte_string) := length s = 5%nat. Definition length_of_consensus l := Forall of_length_five l. -Definition length_of_candidates (vs : gset string) := +Definition length_of_candidates (vs : gset byte_string) := set_Forall of_length_five vs. Lemma prefix_lookup_same_index {A : Type} {l1 l2 : list A} {i v1 v2} : @@ -339,18 +339,18 @@ Section prog. End prog. (* example2 *) -Fixpoint hello_then_world (l : list string) := +Fixpoint hello_then_world (l : list byte_string) := match l with | [] => True - | hd :: tl => if decide (hd = "hello") + | hd :: tl => if decide (hd = "hello"%go) then True - else if decide (hd = "world") + else if decide (hd = "world"%go) then False else hello_then_world tl end. Lemma htw_no_world l : - "world" ∉ l -> + "world"%go ∉ l -> hello_then_world l. Proof. intros Hnotin. @@ -362,7 +362,7 @@ Proof. Qed. Theorem htw_inv_app_no_world l1 l2 : - "world" ∉ l2 -> + "world"%go ∉ l2 -> hello_then_world l1 -> hello_then_world (l1 ++ l2). Proof. @@ -377,7 +377,7 @@ Proof. Qed. Theorem htw_inv_snoc l1 l2 : - "hello" ∈ l1 -> + "hello"%go ∈ l1 -> hello_then_world l1 -> hello_then_world (l1 ++ l2). Proof. @@ -390,8 +390,8 @@ Proof. apply IHtl; [set_solver | done]. Qed. -Definition contain_hello (l : list string) (vs : gset string) := - "world" ∈ vs -> "hello" ∈ l. +Definition contain_hello (l : list byte_string) (vs : gset byte_string) := + "world"%go ∈ vs -> "hello"%go ∈ l. Section prog. Context `{!heapGS Σ, !mpaxos_ghostG Σ}. @@ -474,7 +474,7 @@ Section prog. by apply (elem_of_prefix l). } destruct Hprefix as [k Hprefix]. subst l'. - destruct (decide ("world" ∈ k)) as [Hk | Hk]. + destruct (decide ("world"%go ∈ k)) as [Hk | Hk]. { apply htw_inv_snoc; last done. apply Hch. rewrite Forall_forall in Hin. @@ -491,7 +491,7 @@ Section prog. (*@ px.Propose("world") @*) (*@ } @*) (*@ } @*) - wp_apply (wp_and_pure (ok = true) (v = "hello")). + wp_apply (wp_and_pure (ok = true) (v = "hello"%go)). { wp_pures. iPureIntro. case_bool_decide as H; first by rewrite H. rewrite not_true_iff_false in H. by rewrite H. diff --git a/src/program_proof/rsm/spaxos_examples.v b/src/program_proof/rsm/spaxos_examples.v index ae25abc36..bae24c882 100644 --- a/src/program_proof/rsm/spaxos_examples.v +++ b/src/program_proof/rsm/spaxos_examples.v @@ -3,7 +3,7 @@ From Perennial.program_proof.rsm Require Import spaxos_prelude spaxos_propose. Section prog. Context `{!heapGS Σ, !spaxos_ghostG Σ}. - Definition of_length_five s := String.length s = 5%nat. + Definition of_length_five (s : byte_string) := length s = 5%nat. Definition length_of_consensus v := match v with @@ -11,7 +11,7 @@ Section prog. | _ => True end. - Definition length_of_candidates (vs : gset string) := + Definition length_of_candidates (vs : gset byte_string) := set_Forall of_length_five vs. Definition inv_example1 γ : iProp Σ := diff --git a/src/program_proof/rsm/spaxos_ghost.v b/src/program_proof/rsm/spaxos_ghost.v index 0f13c5c01..837b10c3f 100644 --- a/src/program_proof/rsm/spaxos_ghost.v +++ b/src/program_proof/rsm/spaxos_ghost.v @@ -24,10 +24,10 @@ Section consensus. Definition is_chosen_consensus γ v : iProp Σ := own_consensus_half γ (Chosen v). - Definition own_candidates γ (vs : gset string) : iProp Σ. + Definition own_candidates γ (vs : gset byte_string) : iProp Σ. Admitted. - Definition own_candidates_half γ (vs : gset string) : iProp Σ. + Definition own_candidates_half γ (vs : gset byte_string) : iProp Σ. Admitted. (* Type class instances. *) @@ -138,10 +138,10 @@ Section proposal. Implicit Type (γ : spaxos_names). (* Definitions. *) - Definition is_proposal γ (n : nat) (v : string) : iProp Σ. + Definition is_proposal γ (n : nat) (v : byte_string) : iProp Σ. Admitted. - Definition own_proposals γ (ps : gmap nat string) : iProp Σ. + Definition own_proposals γ (ps : gmap nat byte_string) : iProp Σ. Admitted. (* Type class instances. *) diff --git a/src/program_proof/rsm/spaxos_inv.v b/src/program_proof/rsm/spaxos_inv.v index 43d70a6c5..5b5b334b3 100644 --- a/src/program_proof/rsm/spaxos_inv.v +++ b/src/program_proof/rsm/spaxos_inv.v @@ -519,7 +519,7 @@ Section pure. Definition spaxos_prepare (bs : gmap A ballot) (x : A) (n : nat) := alter (λ l, extend false n l) x bs. - Definition spaxos_propose (ps : proposals) (n : nat) (v : string) := + Definition spaxos_propose (ps : proposals) (n : nat) (v : byte_string) := <[n := v]> ps. Definition spaxos_advance (ts : gmap A nat) (x : A) (n : nat) := diff --git a/src/program_proof/rsm/spaxos_propose.v b/src/program_proof/rsm/spaxos_propose.v index d9cc68fe7..f5bc70db4 100644 --- a/src/program_proof/rsm/spaxos_propose.v +++ b/src/program_proof/rsm/spaxos_propose.v @@ -28,7 +28,7 @@ Qed. Definition consented_impl_committed (v c : consensus) := if v then c = v else True. -Definition proposals_incl_candidates (vs : gset string) (ps : gmap nat string) := +Definition proposals_incl_candidates (vs : gset byte_string) (ps : gmap nat byte_string) := map_img ps ⊆ vs. Definition spaxos_inv sc γ : iProp Σ := @@ -67,7 +67,7 @@ Instance is_proposal_nz_persistent γ n v : Persistent (is_proposal_nz γ n v). Proof. unfold is_proposal_nz. case_decide; apply _. Qed. -Definition is_chosen_commitment_learned γ (l : bool) (v : string) : iProp Σ := +Definition is_chosen_commitment_learned γ (l : bool) (v : byte_string) : iProp Σ := (if l then is_chosen_commitment γ v else True)%I. #[global] @@ -106,7 +106,7 @@ Context `{!heapGS Σ, !spaxos_ghostG Σ}. (*@ peers map[uint64]*Paxos @*) (*@ } @*) Definition own_paxos (paxos : loc) (nid : u64) γ : iProp Σ := - ∃ (termc termp : u64) (decreep : string) (learned : bool) (blt : ballot), + ∃ (termc termp : u64) (decreep : byte_string) (learned : bool) (blt : ballot), "Htermc" ∷ paxos ↦[Paxos :: "termc"] #termc ∗ "%Hnz" ∷ ⌜uint.nat termc ≠ O⌝ ∗ "Htermp" ∷ paxos ↦[Paxos :: "termp"] #termp ∗ @@ -244,7 +244,7 @@ Theorem wp_Paxos__outcome (px : loc) nid sc γ : {{{ True }}} <<< ∀∀ c, own_consensus_half γ c >>> Paxos__outcome #px @ ↑spaxosN - <<< ∃∃ (v : string) (ok : bool), own_consensus_half γ (if ok then Chosen v else c) >>> + <<< ∃∃ (v : byte_string) (ok : bool), own_consensus_half γ (if ok then Chosen v else c) >>> {{{ RET (#(LitString v), #ok); True }}}. Proof. iIntros "#Hnode" (Φ) "!> _ HAU". @@ -294,7 +294,7 @@ Proof. iDestruct (proposal_lookup with "Hproposed Hps") as %Hin. iMod (consensus_update decreep with "Hv Hvs") as "[Hv Hvs]". { unfold proposals_incl_candidates in Hpic. - apply (elem_of_map_img_2 (SA:=gset string)) in Hin. + apply (elem_of_map_img_2 (SA:=gset byte_string)) in Hin. set_solver. } iDestruct (consensus_split with "Hv") as "[Hv Hv']". @@ -308,7 +308,7 @@ Theorem wp_Paxos__Outcome (px : loc) nid sc γ : {{{ True }}} <<< ∀∀ c, own_consensus_half γ c >>> Paxos__Outcome #px @ ↑spaxosN - <<< ∃∃ (v : string) (ok : bool), own_consensus_half γ (if ok then Chosen v else c) >>> + <<< ∃∃ (v : byte_string) (ok : bool), own_consensus_half γ (if ok then Chosen v else c) >>> {{{ RET (#(LitString v), #ok); True }}}. Proof. iIntros "#Hpaxos" (Φ) "!> _ HAU". @@ -329,7 +329,7 @@ Proof. by iApply "HΦ". Qed. -Definition node_prepared (term termp : u64) (decree : string) nid γ : iProp Σ := +Definition node_prepared (term termp : u64) (decree : byte_string) nid γ : iProp Σ := ∃ (l : ballot), "#Hlb" ∷ is_ballot_lb γ nid l ∗ "#Hdecree" ∷ is_proposal_nz γ (uint.nat termp) decree ∗ @@ -340,7 +340,7 @@ Theorem wp_Paxos__prepare (px : loc) (term : u64) nid sc γ : is_paxos_node px nid sc γ -∗ {{{ True }}} Paxos__prepare #px #term - {{{ (termp : u64) (decree : string) (ok : bool), RET (#termp, #(LitString decree), #ok); + {{{ (termp : u64) (decree : byte_string) (ok : bool), RET (#termp, #(LitString decree), #ok); if ok then node_prepared term termp decree nid γ else True }}}. Proof. @@ -435,7 +435,7 @@ Theorem wp_Paxos__advance (px : loc) nid sc γ : is_paxos_node px nid sc γ -∗ {{{ True }}} Paxos__advance #px - {{{ (term : u64) (termp : u64) (decree : string), RET (#term, #termp, #(LitString decree)); + {{{ (term : u64) (termp : u64) (decree : byte_string), RET (#term, #termp, #(LitString decree)); node_prepared term termp decree nid γ ∗ ⌜is_term_of_node nid (uint.nat term) ∧ uint.nat term ≠ O⌝ }}}. Proof. @@ -520,12 +520,12 @@ Proof. apply latest_term_extend_false. Qed. -Definition node_accepted (term : u64) (decree : string) nid γ : iProp Σ := +Definition node_accepted (term : u64) (decree : byte_string) nid γ : iProp Σ := ∃ (l : ballot), "#Hlb" ∷ is_ballot_lb γ nid l ∗ "%Haccin" ∷ ⌜accepted_in l (uint.nat term)⌝. -Theorem wp_Paxos__accept (px : loc) (term : u64) (decree : string) nid sc γ : +Theorem wp_Paxos__accept (px : loc) (term : u64) (decree : byte_string) nid sc γ : is_proposal γ (uint.nat term) decree -∗ is_paxos_node px nid sc γ -∗ {{{ True }}} @@ -647,7 +647,7 @@ Qed. Definition reached_quorum (sc n : nat) := sc / 2 < n. Definition quorum_prepared - (term : u64) (terml : u64) (decreel : string) (sc : nat) (γ : spaxos_names) : iProp Σ := + (term : u64) (terml : u64) (decreel : byte_string) (sc : nat) (γ : spaxos_names) : iProp Σ := ∃ (bsqlb : gmap u64 ballot), "#Hlbs" ∷ ([∗ map] x ↦ l ∈ bsqlb, is_ballot_lb γ x l) ∗ "#Hproposal" ∷ is_proposal_nz γ (uint.nat terml) decreel ∗ @@ -661,8 +661,8 @@ Instance quorum_prepared_persistent term terml decree sc γ : Proof. apply _. Qed. Theorem wp_Paxos__accept__proposer - {px : loc} {term : u64} {decree : string} - (v : string) (terml : u64) decreel nid sc γ : + {px : loc} {term : u64} {decree : byte_string} + (v : byte_string) (terml : u64) decreel nid sc γ : is_term_of_node nid (uint.nat term) -> decree = (if decide (uint.nat terml = O) then v else decreel) -> (* (if decide (uint.nat terml = O) then True else decree = decreel) -> *) @@ -851,11 +851,11 @@ Proof. - (* Case: Adding [v] to [ps]. *) etransitivity; [apply map_img_insert_subseteq | set_solver]. - (* Case: Adding [decreel] to [ps]. *) - transitivity (map_img (SA:=gset string) ps); last by set_solver. + transitivity (map_img (SA:=gset byte_string) ps); last by set_solver. specialize (Hterml H). clear -Hterml. etransitivity; first apply map_img_insert_subseteq. - apply (elem_of_map_img_2 (SA:=gset string)) in Hterml. + apply (elem_of_map_img_2 (SA:=gset byte_string)) in Hterml. set_solver. } iMod ("HinvC" with "[Hv Hvs Hc Hbs Hps Hts]") as "_"; first by eauto 10 with iFrame. @@ -941,12 +941,12 @@ Lemma ite_apply (A B : Type) (b : bool) (f : A -> B) x y : (if b then f x else f y) = f (if b then x else y). Proof. destruct b; done. Qed. -Theorem wp_Paxos__prepareAll (px : loc) (term terma : u64) (decreea : string) nid sc γ : +Theorem wp_Paxos__prepareAll (px : loc) (term terma : u64) (decreea : byte_string) nid sc γ : node_prepared term terma decreea nid γ -∗ is_paxos_comm px nid sc γ -∗ {{{ True }}} Paxos__prepareAll #px #term #terma #(LitString decreea) - {{{ (termp : u64) (decree : string) (ok : bool), RET (#termp, #(LitString decree), #ok); + {{{ (termp : u64) (decree : byte_string) (ok : bool), RET (#termp, #(LitString decree), #ok); if ok then quorum_prepared term termp decree sc γ else True }}}. Proof. @@ -983,7 +983,7 @@ Proof. wp_loadField. iMod (readonly_load with "HpeersMR") as (q) "HpeersM". set P := (λ (m : gmap u64 loc), - ∃ (terml : u64) (decreel : string) (n : u64) (bsqlb : gmap u64 ballot), + ∃ (terml : u64) (decreel : byte_string) (n : u64) (bsqlb : gmap u64 ballot), "HtermlRef" ∷ termlRef ↦[uint64T] #terml ∗ "HdecreelRef" ∷ decreelRef ↦[stringT] #(str decreel) ∗ "HnRef" ∷ nRef ↦[uint64T] #n ∗ @@ -1121,7 +1121,7 @@ Instance quorum_accepted_persistent term sc γ : Persistent (quorum_accepted γ term sc). Proof. apply _. Qed. -Theorem wp_Paxos__acceptAll (px : loc) (term : u64) (decree : string) nid sc γ : +Theorem wp_Paxos__acceptAll (px : loc) (term : u64) (decree : byte_string) nid sc γ : node_accepted term decree nid γ -∗ is_proposal γ (uint.nat term) decree -∗ is_paxos_comm px nid sc γ -∗ @@ -1232,7 +1232,7 @@ Proof. by iFrame "∗ # %". Qed. -Theorem wp_Paxos__learn (px : loc) (term : u64) (decree : string) nid sc γ : +Theorem wp_Paxos__learn (px : loc) (term : u64) (decree : byte_string) nid sc γ : is_proposal γ (uint.nat term) decree -∗ is_chosen_commitment γ decree -∗ is_paxos_node px nid sc γ -∗ @@ -1330,7 +1330,7 @@ Proof. by iApply "HΦ". Qed. -Theorem wp_Paxos__learnAll (px : loc) (term : u64) (decree : string) nid sc γ : +Theorem wp_Paxos__learnAll (px : loc) (term : u64) (decree : byte_string) nid sc γ : is_proposal γ (uint.nat term) decree -∗ is_chosen_commitment γ decree -∗ is_paxos_comm px nid sc γ -∗ @@ -1367,7 +1367,7 @@ End temp. Section prog. Context `{!heapGS Σ, !spaxos_ghostG Σ}. -Theorem wp_Paxos__Propose (px : loc) (v : string) nid sc γ : +Theorem wp_Paxos__Propose (px : loc) (v : byte_string) nid sc γ : is_paxos px nid sc γ -∗ {{{ True }}} <<< ∀∀ vs, own_candidates_half γ vs >>> diff --git a/src/program_proof/rsm/spaxos_top.v b/src/program_proof/rsm/spaxos_top.v index 1ca0b5db0..1603b427d 100644 --- a/src/program_proof/rsm/spaxos_top.v +++ b/src/program_proof/rsm/spaxos_top.v @@ -4,10 +4,10 @@ From Perennial.program_proof Require Export grove_prelude. From Perennial.program_logic Require Export atomic. (* prefer the ncfupd atomics *) -Definition proposals := gmap nat string. +Definition proposals := gmap nat byte_string. Definition ballot := list bool. -Inductive consensus : Set := -| Chosen (v : string) +Inductive consensus : Type := +| Chosen (v : byte_string) | Free. Definition prefixes `{Countable A} {B : Type} (lbs ls : gmap A (list B)) := diff --git a/src/program_proof/tulip/base.v b/src/program_proof/tulip/base.v index 56539bfdd..415e1ad61 100644 --- a/src/program_proof/tulip/base.v +++ b/src/program_proof/tulip/base.v @@ -6,8 +6,8 @@ From Perennial.Helpers Require finite. Local Ltac Zify.zify_post_hook ::= Z.div_mod_to_equations. -Definition dbkey := string. -Definition dbval := option string. +Definition dbkey := byte_string. +Definition dbval := option byte_string. Definition dbhist := list dbval. Definition dbtpl := (dbhist * nat)%type. Definition dbmod := (dbkey * dbval)%type. @@ -22,14 +22,25 @@ Inductive txnres := | ResCommitted (wrs : dbmap) | ResAborted. -Definition fstring := {k : string | String.length k < 2 ^ 64}. +Definition fstring := {k : byte_string | length k < 2 ^ 64 }. #[local] Instance fstring_finite : finite.Finite fstring. -Proof. apply Helpers.finite.string_finite_Zlt_length. Qed. +Proof. + unfold fstring. + set(x:=2 ^ 64). + generalize x. clear x. intros y. + unshelve refine (finite.surjective_finite (λ x : {k : byte_string | (length k < Z.to_nat y)%nat }, + (proj1_sig x) ↾ _ )). + { abstract (destruct x; simpl; lia). } + { apply Helpers.finite.list_finite_lt_length. } + intros []. + unshelve eexists (exist _ _ _); last rewrite sig_eq_pi /= //. + simpl. lia. +Qed. -Definition keys_all : gset string := +Definition keys_all : gset byte_string := list_to_set (map proj1_sig (finite.enum fstring)). (** Transaction status on group/replica. *) @@ -163,7 +174,7 @@ Definition dblog := list ccommand. (** Converting keys to group IDs. *) Definition key_to_group (key : dbkey) : u64 := - String.length key `mod` size gids_all. + length key `mod` size gids_all. (** Participant groups. *) Definition ptgroups (keys : gset dbkey) : gset u64 := @@ -295,7 +306,7 @@ Definition valid_key (key : dbkey) := key ∈ keys_all. Lemma valid_key_length key : valid_key key -> - String.length key < 2 ^ 64. + length key < 2 ^ 64. Proof. intros Hvk. rewrite /valid_key /keys_all in Hvk. diff --git a/src/program_proof/tulip/encode.v b/src/program_proof/tulip/encode.v index 358760405..eacdb221d 100644 --- a/src/program_proof/tulip/encode.v +++ b/src/program_proof/tulip/encode.v @@ -1,21 +1,16 @@ From Perennial.program_proof Require Import grove_prelude. From Perennial.program_proof.tulip Require Import base. -(* TODO: this really should be made general. *) +Definition encode_string (x : byte_string) : list u8 := + u64_le (U64 (length x)) ++ x. -Definition encode_string (x : string) : list u8 := - let bs := string_to_bytes x in - u64_le (U64 (length bs)) ++ bs. - -Opaque encode_string. - -Definition encode_strings_step (bs : list u8) (x : string) : list u8 := +Definition encode_strings_step (bs : list u8) (x : byte_string) : list u8 := bs ++ encode_string x. -Definition encode_strings_xlen (xs : list string) : list u8 := +Definition encode_strings_xlen (xs : list byte_string) : list u8 := foldl encode_strings_step [] xs. -Definition encode_strings (xs : list string) : list u8 := +Definition encode_strings (xs : list byte_string) : list u8 := u64_le (U64 (length xs)) ++ encode_strings_xlen xs. Lemma encode_strings_xlen_snoc xs x : @@ -24,7 +19,7 @@ Proof. by rewrite /encode_strings_xlen foldl_snoc /encode_strings_step. Qed. -Lemma foldl_encode_strings_step_app (bs : list u8) (xs : list string) : +Lemma foldl_encode_strings_step_app (bs : list u8) (xs : list byte_string) : foldl encode_strings_step bs xs = bs ++ foldl encode_strings_step [] xs. Proof. generalize dependent bs. @@ -117,7 +112,7 @@ Proof. induction xs as [| x xs IH]; intros n; first done. rewrite encode_dbmods_xlen_cons length_app /=. assert (length (encode_dbmod x) ≠ O). - { by destruct (nil_or_length_pos (encode_dbmod x)). } + { by destruct x as [[] []]. } intros Hlen. assert (Hlenxs : (length xs ≤ pred n)%nat). { apply IH. lia. } diff --git a/src/program_proof/tulip/inv.v b/src/program_proof/tulip/inv.v index 2744cf667..e0899972a 100644 --- a/src/program_proof/tulip/inv.v +++ b/src/program_proof/tulip/inv.v @@ -193,7 +193,7 @@ Section inv_network. Proof. destruct req; apply _. Defined. Definition safe_read_resp - γ (ts rid : u64) (key : string) (ver : dbpver) (slow : bool) : iProp Σ := + γ (ts rid : u64) (key : byte_string) (ver : dbpver) (slow : bool) : iProp Σ := "#Hsafe" ∷ fast_or_slow_read γ rid key (uint.nat ver.1) (uint.nat ts) ver.2 slow ∗ "%Hrid" ∷ ⌜rid ∈ rids_all⌝. diff --git a/src/program_proof/tulip/inv_txnlog.v b/src/program_proof/tulip/inv_txnlog.v index 5bdf2173d..2f6e374dc 100644 --- a/src/program_proof/tulip/inv_txnlog.v +++ b/src/program_proof/tulip/inv_txnlog.v @@ -14,10 +14,10 @@ Definition encode_commit_cmd (ts : nat) (m : dbmap) (data : list u8) := Definition encode_abort_cmd (ts : nat) (data : list u8) := data = u64_le (U64 0) ++ u64_le (W64 ts). -Definition encode_ccommand (ccmd : ccommand) (s : string) := +Definition encode_ccommand (ccmd : ccommand) (s : byte_string) := match ccmd with - | CmdCommit ts pwrs => encode_commit_cmd ts pwrs (string_to_bytes s) - | CmdAbort ts => encode_abort_cmd ts (string_to_bytes s) + | CmdCommit ts pwrs => encode_commit_cmd ts pwrs s + | CmdAbort ts => encode_abort_cmd ts s end. Section inv_txnlog. diff --git a/src/program_proof/tulip/msg.v b/src/program_proof/tulip/msg.v index fff469e05..b4e66ca82 100644 --- a/src/program_proof/tulip/msg.v +++ b/src/program_proof/tulip/msg.v @@ -2,7 +2,7 @@ From Perennial.program_proof Require Import grove_prelude. From Perennial.program_proof.tulip Require Import base encode. Inductive txnreq := -| ReadReq (ts : u64) (key : string) +| ReadReq (ts : u64) (key : byte_string) | FastPrepareReq (ts : u64) (pwrs : dbmap) | ValidateReq (ts : u64) (rank : u64) (pwrs : dbmap) | PrepareReq (ts : u64) (rank : u64) @@ -57,10 +57,10 @@ Proof. intros [| | | | | | | |] => //=. Qed. -Definition encode_read_req_xkind (ts : u64) (key : string) := +Definition encode_read_req_xkind (ts : u64) (key : byte_string) := u64_le ts ++ encode_string key. -Definition encode_read_req (ts : u64) (key : string) (data : list u8) := +Definition encode_read_req (ts : u64) (key : byte_string) (data : list u8) := data = u64_le (U64 100) ++ encode_read_req_xkind ts key. Definition encode_fast_prepare_req_xkind (ts : u64) (m : dbmap) (data : list u8) := @@ -162,7 +162,7 @@ Instance rpres_to_u64_inj : Proof. intros x y H. by destruct x, y. Defined. Inductive txnresp := -| ReadResp (ts : u64) (rid : u64) (key : string) (ver : dbpver) (slow : bool) +| ReadResp (ts : u64) (rid : u64) (key : byte_string) (ver : dbpver) (slow : bool) | FastPrepareResp (ts : u64) (rid : u64) (res : rpres) | ValidateResp (ts : u64) (rid : u64) (res : rpres) | PrepareResp (ts : u64) (rank : u64) (rid : u64) (res : rpres) @@ -214,12 +214,12 @@ Proof. Qed. Definition encode_read_resp_xkind - (ts rid : u64) (key : string) (ver : dbpver) (slow : bool) := + (ts rid : u64) (key : byte_string) (ver : dbpver) (slow : bool) := u64_le ts ++ u64_le rid ++ encode_string key ++ encode_dbpver ver ++ [if slow then U8 1 else U8 0]. Definition encode_read_resp - (ts rid : u64) (key : string) (ver : dbpver) (slow : bool) := + (ts rid : u64) (key : byte_string) (ver : dbpver) (slow : bool) := u64_le (U64 100) ++ encode_read_resp_xkind ts rid key ver slow. Definition encode_ts_rid_res (ts rid : u64) (res : rpres) := diff --git a/src/program_proof/tulip/paxos/base.v b/src/program_proof/tulip/paxos/base.v index eb447a9a0..75a2dff82 100644 --- a/src/program_proof/tulip/paxos/base.v +++ b/src/program_proof/tulip/paxos/base.v @@ -4,7 +4,7 @@ From Perennial.base_logic Require Import ghost_map mono_nat saved_prop. From Perennial.program_proof Require Import grove_prelude. From Perennial.program_proof.rsm.pure Require Import quorum. -Definition ledger := list string. +Definition ledger := list byte_string. Definition proposals := gmap nat ledger. @@ -380,8 +380,8 @@ Inductive pxcmd := | CmdPaxosAccept (lsn : nat) (ents : ledger) | CmdPaxosExpand (lsn : nat). -Definition stringO := leibnizO string. -Definition stringmlR := mono_listR stringO. +Definition byte_stringO := listO w8. +Definition byte_stringmlR := mono_listR byte_stringO. Definition lsnmR := gmapR nat (dfrac_agreeR natO). Canonical Structure nodedecO := leibnizO nodedec. Definition declistR := mono_listR nodedecO. @@ -393,11 +393,11 @@ Definition node_natmR := gmapR u64 (dfrac_agreeR natO). Definition node_ledgerR := gmapR u64 (dfrac_agreeR ledgerO). Definition pxcmdlO := leibnizO (list pxcmd). Definition node_pxcmdlR := gmapR u64 (dfrac_agreeR pxcmdlO). -Definition node_stringR := gmapR u64 (agreeR stringO). +Definition node_stringR := gmapR u64 (agreeR byte_stringO). Class paxos_ghostG (Σ : gFunctors) := - { #[global] stringmlG :: inG Σ stringmlR; - #[global] cpoolG :: ghost_mapG Σ string unit; + { #[global] byte_stringmlG :: inG Σ byte_stringmlR; + #[global] cpoolG :: ghost_mapG Σ byte_string unit; #[global] proposalG :: ghost_mapG Σ nat gname; #[global] base_proposalG :: ghost_mapG Σ nat ledger; #[global] prepare_lsnG :: inG Σ lsnmR; @@ -414,9 +414,9 @@ Class paxos_ghostG (Σ : gFunctors) := Definition paxos_ghostΣ := #[ GFunctor lsnmR; - ghost_mapΣ string unit; + ghost_mapΣ byte_string unit; ghost_mapΣ nat gname; - GFunctor stringmlR; + GFunctor byte_stringmlR; ghost_mapΣ nat ledger; GFunctor node_declistR; GFunctor node_proposalmR; diff --git a/src/program_proof/tulip/paxos/inv.v b/src/program_proof/tulip/paxos/inv.v index c2a56b3ff..9a4958834 100644 --- a/src/program_proof/tulip/paxos/inv.v +++ b/src/program_proof/tulip/paxos/inv.v @@ -520,7 +520,7 @@ Section inv_file. Definition paxosfileNS := paxosNS .@ "file". Definition node_file_inv (γ : paxos_names) (nid : u64) : iProp Σ := - ∃ (wal : list pxcmd) (fname : string) (content : list u8), + ∃ (wal : list pxcmd) (fname : byte_string) (content : list u8), "Hwalfile" ∷ own_node_wal_half γ nid wal ∗ "Hfile" ∷ fname f↦ content ∗ "#Hwalfname" ∷ is_node_wal_fname γ nid fname ∗ @@ -548,8 +548,8 @@ Section inv_network. is_prepare_lsn γ (uint.nat term) (uint.nat lsnlc). Definition safe_append_entries_req - γ nids (term lsnlc lsne : u64) (ents : list string) : iProp Σ := - ∃ (logleader logcmt : list string), + γ nids (term lsnlc lsne : u64) (ents : list byte_string) : iProp Σ := + ∃ (logleader logcmt : list byte_string), "#Hpfb" ∷ prefix_base_ledger γ (uint.nat term) logleader ∗ "#Hpfg" ∷ prefix_growing_ledger γ (uint.nat term) logleader ∗ "#Hlogcmt" ∷ safe_ledger_above γ nids (uint.nat term) logcmt ∗ @@ -575,8 +575,8 @@ Section inv_network. Proof. destruct req; apply _. Defined. Definition safe_request_vote_resp - γ (nids : gset u64) (nid term terme : u64) (ents : list string) : iProp Σ := - ∃ (logpeer : list string) (lsne : u64), + γ (nids : gset u64) (nid term terme : u64) (ents : list byte_string) : iProp Σ := + ∃ (logpeer : list byte_string) (lsne : u64), "#Hpromise" ∷ past_nodedecs_latest_before γ nid (uint.nat term) (uint.nat terme) logpeer ∗ "#Hlsne" ∷ is_prepare_lsn γ (uint.nat term) (uint.nat lsne) ∗ "%Hents" ∷ ⌜drop (uint.nat lsne) logpeer = ents⌝ ∗ @@ -584,7 +584,7 @@ Section inv_network. Definition safe_append_entries_resp γ (nids : gset u64) (nid term lsneq : u64) : iProp Σ := - ∃ (logacpt : list string), + ∃ (logacpt : list byte_string), "#Haoc" ∷ (is_accepted_proposal_lb γ nid (uint.nat term) logacpt ∨ safe_ledger_above γ nids (uint.nat term) logacpt) ∗ "%Hlogacpt" ∷ ⌜length logacpt = uint.nat lsneq⌝ ∗ @@ -1195,7 +1195,7 @@ End lemma. Section alloc. Context `{!heapGS Σ, !paxos_ghostG Σ}. - Lemma paxos_inv_alloc addrm (fnames : gmap u64 string) : + Lemma paxos_inv_alloc addrm (fnames : gmap u64 byte_string) : let nids := dom addrm in (1 < size addrm)%nat -> dom fnames = dom addrm -> diff --git a/src/program_proof/tulip/paxos/msg.v b/src/program_proof/tulip/paxos/msg.v index 77630f372..a3187d26e 100644 --- a/src/program_proof/tulip/paxos/msg.v +++ b/src/program_proof/tulip/paxos/msg.v @@ -4,7 +4,7 @@ From Perennial.program_proof.tulip Require Import encode. Inductive pxreq := | RequestVoteReq (term : u64) (lsnlc : u64) -| AppendEntriesReq (term : u64) (lsnlc : u64) (lsne : u64) (ents : list string). +| AppendEntriesReq (term : u64) (lsnlc : u64) (lsne : u64) (ents : list byte_string). #[global] Instance pxreq_eq_decision : @@ -35,11 +35,11 @@ Definition encode_request_vote_req (term lsnlc : u64) := u64_le (U64 0) ++ encode_request_vote_req_xkind term lsnlc. Definition encode_append_entries_req_xkind - (term lsnlc lsne : u64) (ents : list string) := + (term lsnlc lsne : u64) (ents : list byte_string) := u64_le term ++ u64_le lsnlc ++ u64_le lsne ++ encode_strings ents. Definition encode_append_entries_req - (term lsnlc lsne : u64) (ents : list string) := + (term lsnlc lsne : u64) (ents : list byte_string) := u64_le (U64 1) ++ encode_append_entries_req_xkind term lsnlc lsne ents. Definition encode_pxreq (req : pxreq) : list u8 := @@ -51,7 +51,7 @@ Definition encode_pxreq (req : pxreq) : list u8 := end. Inductive pxresp := -| RequestVoteResp (nid term terme : u64) (ents : list string) +| RequestVoteResp (nid term terme : u64) (ents : list byte_string) | AppendEntriesResp (nid term lsneq : u64). #[global] @@ -77,11 +77,11 @@ Proof. Qed. Definition encode_request_vote_resp_xkind - (nid term terme : u64) (ents : list string) := + (nid term terme : u64) (ents : list byte_string) := u64_le nid ++ u64_le term ++ u64_le terme ++ encode_strings ents. Definition encode_request_vote_resp - (nid term terme : u64) (ents : list string) := + (nid term terme : u64) (ents : list byte_string) := u64_le (U64 0) ++ encode_request_vote_resp_xkind nid term terme ents. Definition encode_append_entries_resp_xkind (nid term lsneq : u64) := diff --git a/src/program_proof/tulip/paxos/program/encode_accept_request.v b/src/program_proof/tulip/paxos/program/encode_accept_request.v index 1fcf76c67..0a88db760 100644 --- a/src/program_proof/tulip/paxos/program/encode_accept_request.v +++ b/src/program_proof/tulip/paxos/program/encode_accept_request.v @@ -8,7 +8,7 @@ Section encode_accept_request. Context `{!heapGS Σ, !paxos_ghostG Σ}. Theorem wp_EncodeAcceptRequest - (term lsnc lsne : u64) (entsP : Slice.t) (ents : list string) : + (term lsnc lsne : u64) (entsP : Slice.t) (ents : list byte_string) : {{{ own_slice entsP stringT (DfracOwn 1) ents }}} EncodeAcceptRequest #term #lsnc #lsne (to_val entsP) {{{ (dataP : Slice.t) (data : list u8), RET (to_val dataP); diff --git a/src/program_proof/tulip/paxos/program/encode_prepare_response.v b/src/program_proof/tulip/paxos/program/encode_prepare_response.v index ec266cee6..1bc871f2b 100644 --- a/src/program_proof/tulip/paxos/program/encode_prepare_response.v +++ b/src/program_proof/tulip/paxos/program/encode_prepare_response.v @@ -8,7 +8,7 @@ Section encode_prepare_response. Context `{!heapGS Σ, !paxos_ghostG Σ}. Theorem wp_EncodePrepareResponse - (nid term terma : u64) (entsP : Slice.t) (ents : list string) : + (nid term terma : u64) (entsP : Slice.t) (ents : list byte_string) : {{{ own_slice entsP stringT (DfracOwn 1) ents }}} EncodePrepareResponse #nid #term #terma (to_val entsP) {{{ (dataP : Slice.t) (data : list u8), RET (to_val dataP); diff --git a/src/program_proof/tulip/paxos/program/mk_paxos.v b/src/program_proof/tulip/paxos/program/mk_paxos.v index 7332c8344..9e7a242c9 100644 --- a/src/program_proof/tulip/paxos/program/mk_paxos.v +++ b/src/program_proof/tulip/paxos/program/mk_paxos.v @@ -7,7 +7,7 @@ Section mk_paxos. Theorem wp_mkPaxos (nidme : u64) (termc : u64) (terml : u64) (lsnc : u64) - (logP : Slice.t) (log : list string) (addrmP : loc) (addrm : gmap u64 chan) (fname : string) γ : + (logP : Slice.t) (log : list byte_string) (addrmP : loc) (addrm : gmap u64 chan) (fname : byte_string) γ : (1 < size addrm)%nat -> nidme ∈ dom addrm -> 0 ≤ uint.Z nidme < max_nodes -> diff --git a/src/program_proof/tulip/paxos/program/paxos_accept.v b/src/program_proof/tulip/paxos/program/paxos_accept.v index c0b85806a..f3b77ab43 100644 --- a/src/program_proof/tulip/paxos/program/paxos_accept.v +++ b/src/program_proof/tulip/paxos/program/paxos_accept.v @@ -7,7 +7,7 @@ Section accept. Context `{!heapGS Σ, !paxos_ghostG Σ}. Theorem wp_Paxos__accept - (px : loc) (lsn : u64) (term : u64) (entsP : Slice.t) (ents logleader : list string) + (px : loc) (lsn : u64) (term : u64) (entsP : Slice.t) (ents logleader : list byte_string) (nidme : u64) nids γ : nidme ∈ nids -> (uint.nat lsn ≤ length logleader)%nat -> @@ -21,7 +21,7 @@ Section accept. own_slice entsP stringT (DfracOwn 1) ents }}} Paxos__accept #px #lsn #term (to_val entsP) - {{{ (lsna : u64) (loga : list string), RET #lsna; + {{{ (lsna : u64) (loga : list byte_string), RET #lsna; own_paxos_following_with_termc px nidme term nids γ ∗ (is_accepted_proposal_lb γ nidme (uint.nat term) loga ∨ safe_ledger_above γ nids (uint.nat term) loga) ∗ diff --git a/src/program_proof/tulip/paxos/program/paxos_collect.v b/src/program_proof/tulip/paxos/program/paxos_collect.v index dd3e6521a..808556154 100644 --- a/src/program_proof/tulip/paxos/program/paxos_collect.v +++ b/src/program_proof/tulip/paxos/program/paxos_collect.v @@ -7,8 +7,8 @@ Section collect. Theorem wp_Paxos__collect (px : loc) (nid : u64) (term : u64) - (nidme : u64) (entsP : Slice.t) (ents : list string) - (termc lsnc : u64) (logpeer : list string) nids γ : + (nidme : u64) (entsP : Slice.t) (ents : list byte_string) + (termc lsnc : u64) (logpeer : list byte_string) nids γ : nid ∈ nids -> drop (uint.nat lsnc) logpeer = ents -> past_nodedecs_latest_before γ nid (uint.nat termc) (uint.nat term) logpeer -∗ diff --git a/src/program_proof/tulip/paxos/program/paxos_commit.v b/src/program_proof/tulip/paxos/program/paxos_commit.v index b3081223f..6f9747853 100644 --- a/src/program_proof/tulip/paxos/program/paxos_commit.v +++ b/src/program_proof/tulip/paxos/program/paxos_commit.v @@ -7,7 +7,7 @@ Section commit. Context `{!heapGS Σ, !paxos_ghostG Σ}. Theorem wp_Paxos__commit - (px : loc) (lsn : u64) (nidme term : u64) (logc : list string) nids γ : + (px : loc) (lsn : u64) (nidme term : u64) (logc : list byte_string) nids γ : nidme ∈ nids -> length logc = uint.nat lsn -> safe_ledger_above γ nids (uint.nat term) logc -∗ diff --git a/src/program_proof/tulip/paxos/program/paxos_forward.v b/src/program_proof/tulip/paxos/program/paxos_forward.v index de733219f..78e616b01 100644 --- a/src/program_proof/tulip/paxos/program/paxos_forward.v +++ b/src/program_proof/tulip/paxos/program/paxos_forward.v @@ -6,7 +6,7 @@ Section forward. Context `{!heapGS Σ, !paxos_ghostG Σ}. Theorem wp_Paxos__forward - (px : loc) (nid lsn : u64) (nidme termc : u64) (loga : list string) nids γ : + (px : loc) (nid lsn : u64) (nidme termc : u64) (loga : list byte_string) nids γ : nid ≠ nidme -> nid ∈ nids -> length loga = uint.nat lsn -> diff --git a/src/program_proof/tulip/paxos/program/paxos_getlsnc.v b/src/program_proof/tulip/paxos/program/paxos_getlsnc.v index 0f6c5d0bf..21742c408 100644 --- a/src/program_proof/tulip/paxos/program/paxos_getlsnc.v +++ b/src/program_proof/tulip/paxos/program/paxos_getlsnc.v @@ -8,7 +8,7 @@ Section getlsnc. Theorem wp_Paxos__getlsnc (px : loc) (nidme termc : u64) nids γ : {{{ own_paxos_leading_with_termc px nidme termc nids γ }}} Paxos__getlsnc #px - {{{ (lsnc : u64) (logc : list string), RET #lsnc; + {{{ (lsnc : u64) (logc : list byte_string), RET #lsnc; own_paxos_leading_with_termc px nidme termc nids γ ∗ safe_ledger_above γ nids (uint.nat termc) logc ∗ ⌜length logc = uint.nat lsnc⌝ diff --git a/src/program_proof/tulip/paxos/program/paxos_learn.v b/src/program_proof/tulip/paxos/program/paxos_learn.v index 8e2f2a3b0..f83abe72c 100644 --- a/src/program_proof/tulip/paxos/program/paxos_learn.v +++ b/src/program_proof/tulip/paxos/program/paxos_learn.v @@ -6,7 +6,7 @@ Section learn. Context `{!heapGS Σ, !paxos_ghostG Σ}. Theorem wp_Paxos__learn - (px : loc) (lsn term : u64) (nidme : u64) (logc : list string) nids γ : + (px : loc) (lsn term : u64) (nidme : u64) (logc : list byte_string) nids γ : nidme ∈ nids -> length logc = uint.nat lsn -> safe_ledger_above γ nids (uint.nat term) logc -∗ diff --git a/src/program_proof/tulip/paxos/program/paxos_log.v b/src/program_proof/tulip/paxos/program/paxos_log.v index 741c6b9dd..46d762132 100644 --- a/src/program_proof/tulip/paxos/program/paxos_log.v +++ b/src/program_proof/tulip/paxos/program/paxos_log.v @@ -29,7 +29,7 @@ Section log. Context `{!heapGS Σ, !paxos_ghostG Σ}. Theorem wp_logAdvance - (fname : string) (termW : u64) (lsnW : u64) (entsS : Slice.t) (ents : list string) : + (fname : byte_string) (termW : u64) (lsnW : u64) (entsS : Slice.t) (ents : list byte_string) : let lsn := uint.nat lsnW in let term := uint.nat termW in ⊢ @@ -90,7 +90,7 @@ Section log. Qed. Theorem wp_logAccept - (fname : string) (lsnW : u64) (entsS : Slice.t) (ents : list string) : + (fname : byte_string) (lsnW : u64) (entsS : Slice.t) (ents : list byte_string) : let lsn := uint.nat lsnW in ⊢ {{{ own_slice_small entsS stringT (DfracOwn 1) ents }}} @@ -146,7 +146,7 @@ Section log. by iApply "HΦ". Qed. - Theorem wp_logPrepare (fname : string) (termW : u64) : + Theorem wp_logPrepare (fname : byte_string) (termW : u64) : let term := uint.nat termW in ⊢ {{{ True }}} @@ -199,7 +199,7 @@ Section log. by iApply "HΦ". Qed. - Theorem wp_logAppend (fname : string) (ent : string) : + Theorem wp_logAppend (fname : byte_string) (ent : byte_string) : ⊢ {{{ True }}} <<< ∀∀ bs wal, fname f↦ bs ∗ ⌜encode_paxos_cmds wal bs⌝ >>> @@ -251,7 +251,7 @@ Section log. by iApply "HΦ". Qed. - Theorem wp_logExtend (fname : string) (entsS : Slice.t) (ents : list string) : + Theorem wp_logExtend (fname : byte_string) (entsS : Slice.t) (ents : list byte_string) : ⊢ {{{ own_slice_small entsS stringT (DfracOwn 1) ents }}} <<< ∀∀ bs wal, fname f↦ bs ∗ ⌜encode_paxos_cmds wal bs⌝ >>> @@ -304,7 +304,7 @@ Section log. by iApply "HΦ". Qed. - Theorem wp_logExpand (fname : string) (lsnW : u64) : + Theorem wp_logExpand (fname : byte_string) (lsnW : u64) : let lsn := uint.nat lsnW in ⊢ {{{ True }}} diff --git a/src/program_proof/tulip/paxos/program/paxos_lookup.v b/src/program_proof/tulip/paxos/program/paxos_lookup.v index 0d8cb1338..837d15ebb 100644 --- a/src/program_proof/tulip/paxos/program/paxos_lookup.v +++ b/src/program_proof/tulip/paxos/program/paxos_lookup.v @@ -12,7 +12,7 @@ Section lookup. <<< ∀∀ log cpool, own_consensus_half γ log cpool >>> Paxos__Lookup #px #lsn @ ↑paxosNS <<< ∃∃ log', own_consensus_half γ log' cpool ∗ ⌜cpool_subsume_log log' cpool⌝ >>> - {{{ (v : string) (ok : bool), RET (#(LitString v), #ok); + {{{ (v : byte_string) (ok : bool), RET (#(LitString v), #ok); ⌜if ok then log' !! (uint.nat lsn) = Some v else True⌝ }}}. Proof. diff --git a/src/program_proof/tulip/paxos/program/paxos_obtain.v b/src/program_proof/tulip/paxos/program/paxos_obtain.v index 7a1cc4af7..37e37c188 100644 --- a/src/program_proof/tulip/paxos/program/paxos_obtain.v +++ b/src/program_proof/tulip/paxos/program/paxos_obtain.v @@ -8,7 +8,7 @@ Section obtain. Theorem wp_Paxos__obtain (px : loc) (nid : u64) (nidme termc : u64) nids γ : {{{ own_paxos_leading_with_termc px nidme termc nids γ }}} Paxos__obtain #px #nid - {{{ (lsne : u64) (entsP : Slice.t) (ents loga : list string), RET (#lsne, (to_val entsP)); + {{{ (lsne : u64) (entsP : Slice.t) (ents loga : list byte_string), RET (#lsne, (to_val entsP)); own_paxos_leading_with_termc px nidme termc nids γ ∗ own_slice entsP stringT (DfracOwn 1) ents ∗ prefix_base_ledger γ (uint.nat termc) loga ∗ diff --git a/src/program_proof/tulip/paxos/program/paxos_prepare.v b/src/program_proof/tulip/paxos/program/paxos_prepare.v index efa8899dd..0a6e82e61 100644 --- a/src/program_proof/tulip/paxos/program/paxos_prepare.v +++ b/src/program_proof/tulip/paxos/program/paxos_prepare.v @@ -9,7 +9,7 @@ Section prepare. termc ≠ terml -> {{{ own_paxos_with_termc_terml px nidme termc terml nids γ }}} Paxos__prepare #px #lsn - {{{ (entsP : Slice.t) (ents logpeer : list string), RET (#terml, (to_val entsP)); + {{{ (entsP : Slice.t) (ents logpeer : list byte_string), RET (#terml, (to_val entsP)); own_paxos_with_termc_terml px nidme termc terml nids γ ∗ own_slice entsP stringT (DfracOwn 1) ents ∗ past_nodedecs_latest_before γ nidme (uint.nat termc) (uint.nat terml) logpeer ∗ diff --git a/src/program_proof/tulip/paxos/program/paxos_submit.v b/src/program_proof/tulip/paxos/program/paxos_submit.v index 6ff7f6ab0..39d7e9b60 100644 --- a/src/program_proof/tulip/paxos/program/paxos_submit.v +++ b/src/program_proof/tulip/paxos/program/paxos_submit.v @@ -6,7 +6,7 @@ From Goose.github_com.mit_pdos.tulip Require Import paxos. Section submit. Context `{!heapGS Σ, !paxos_ghostG Σ}. - Theorem wp_Paxos__Submit (px : loc) (c : string) nidme γ : + Theorem wp_Paxos__Submit (px : loc) (c : byte_string) nidme γ : is_paxos px nidme γ -∗ {{{ True }}} <<< ∀∀ cpool, own_cpool_half γ cpool >>> diff --git a/src/program_proof/tulip/paxos/program/repr.v b/src/program_proof/tulip/paxos/program/repr.v index ca171e281..a4ce2604e 100644 --- a/src/program_proof/tulip/paxos/program/repr.v +++ b/src/program_proof/tulip/paxos/program/repr.v @@ -86,9 +86,9 @@ Section repr. "%Haddrpeers" ∷ ⌜map_Forall (λ nid x, addrm !! nid = Some x.2) conns⌝. Definition own_paxos_candidate_only - (nidme termc terml termp : u64) (logc : list string) + (nidme termc terml termp : u64) (logc : list byte_string) (entspP : Slice.t) (resppP : loc) nids γ : iProp Σ := - ∃ (entsp : list string) (respp : gmap u64 bool), + ∃ (entsp : list byte_string) (respp : gmap u64 bool), "Hentsp" ∷ own_slice entspP stringT (DfracOwn 1) entsp ∗ "Hrespp" ∷ own_map resppP (DfracOwn 1) respp ∗ "#Hvotes" ∷ votes_in γ (dom respp) (uint.nat termc) (uint.nat termp) (logc ++ entsp) ∗ @@ -99,7 +99,7 @@ Section repr. "%Hpltc" ∷ ⌜uint.Z termp < uint.Z termc⌝. Definition own_paxos_candidate - (paxos : loc) (nid termc terml : u64) (logc : list string) (iscand : bool) nids γ : iProp Σ := + (paxos : loc) (nid termc terml : u64) (logc : list byte_string) (iscand : bool) nids γ : iProp Σ := ∃ (termp : u64) (entspP : Slice.t) (resppP : loc), "HiscandP" ∷ paxos ↦[Paxos :: "iscand"] #iscand ∗ "HtermpP" ∷ paxos ↦[Paxos :: "termp"] #termp ∗ @@ -137,7 +137,7 @@ Section repr. accepted_or_committed_until γ nids nid a t (uint.nat i)). Definition own_paxos_leader_only - (termc terml : u64) (log : list string) (lsnpeersP : loc) (peers : gset u64) + (termc terml : u64) (log : list byte_string) (lsnpeersP : loc) (peers : gset u64) nids γ : iProp Σ := ∃ (lsnpeers : gmap u64 u64), "Hps" ∷ own_proposal γ (uint.nat termc) log ∗ @@ -148,7 +148,7 @@ Section repr. "%Hinclnids" ∷ ⌜dom lsnpeers ⊆ peers⌝. Definition own_paxos_leader - (paxos : loc) (nidme termc terml : u64) (log : list string) (isleader : bool) + (paxos : loc) (nidme termc terml : u64) (log : list byte_string) (isleader : bool) nids γ : iProp Σ := ∃ (lsnpeersP : loc), "HisleaderP" ∷ paxos ↦[Paxos :: "isleader"] #isleader ∗ @@ -166,7 +166,7 @@ Section repr. "%Hsc" ∷ ⌜size nids = uint.nat sc⌝. Definition own_paxos_common - (paxos : loc) (nidme termc terml lsnc : u64) (log : list string) nids γ : iProp Σ := + (paxos : loc) (nidme termc terml lsnc : u64) (log : list byte_string) nids γ : iProp Σ := ∃ (hb : bool) (logP : Slice.t), "HhbP" ∷ paxos ↦[Paxos :: "hb"] #hb ∗ "HtermcP" ∷ paxos ↦[Paxos :: "termc"] #termc ∗ @@ -197,7 +197,7 @@ Section repr. predicates should be existentially quantified. *) Definition own_paxos_internal (paxos : loc) (nidme termc terml lsnc : u64) (iscand isleader : bool) nids γ : iProp Σ := - ∃ (log : list string), + ∃ (log : list byte_string), let logc := (take (uint.nat lsnc) log) in "Hpx" ∷ own_paxos_common paxos nidme termc terml lsnc log nids γ ∗ "Hcand" ∷ own_paxos_candidate paxos nidme termc terml logc iscand nids γ ∗ @@ -266,7 +266,7 @@ Section repr. Proof. iIntros "Hpx". iFrame. Qed. Definition is_paxos_fname (paxos : loc) (nidme : u64) γ : iProp Σ := - ∃ (fname : string), + ∃ (fname : byte_string), "#HfnameP" ∷ readonly (paxos ↦[Paxos :: "fname"] #(LitString fname)) ∗ "#Hfnameme" ∷ is_node_wal_fname γ nidme fname. diff --git a/src/program_proof/tulip/paxos/program/resume.v b/src/program_proof/tulip/paxos/program/resume.v index 7df8ef26d..125aa2e46 100644 --- a/src/program_proof/tulip/paxos/program/resume.v +++ b/src/program_proof/tulip/paxos/program/resume.v @@ -4,7 +4,7 @@ From Goose.github_com.mit_pdos.tulip Require Import paxos. Section resume. Context `{!heapGS Σ, !paxos_ghostG Σ}. - Theorem wp_resume (fname : string) (nidme termc terml lsnc : u64) (log : list string) γ : + Theorem wp_resume (fname : byte_string) (nidme termc terml lsnc : u64) (log : list byte_string) γ : {{{ own_current_term_half γ nidme (uint.nat termc) ∗ own_ledger_term_half γ nidme (uint.nat terml) ∗ own_committed_lsn_half γ nidme (uint.nat lsnc) ∗ diff --git a/src/program_proof/tulip/paxos/program/start.v b/src/program_proof/tulip/paxos/program/start.v index 2995676d9..ba11d0aee 100644 --- a/src/program_proof/tulip/paxos/program/start.v +++ b/src/program_proof/tulip/paxos/program/start.v @@ -9,8 +9,8 @@ Section start. Context `{!heapGS Σ, !paxos_ghostG Σ}. Theorem wp_Start - (nidme : u64) (termc : u64) (terml : u64) (lsnc : u64) (log : list string) - (addrmP : loc) (addrm : gmap u64 chan) (fname : string) γ : + (nidme : u64) (termc : u64) (terml : u64) (lsnc : u64) (log : list byte_string) + (addrmP : loc) (addrm : gmap u64 chan) (fname : byte_string) γ : termc = (W64 0) -> terml = (W64 0) -> lsnc = (W64 0) -> diff --git a/src/program_proof/tulip/paxos/res.v b/src/program_proof/tulip/paxos/res.v index 6709c48a1..4a026926f 100644 --- a/src/program_proof/tulip/paxos/res.v +++ b/src/program_proof/tulip/paxos/res.v @@ -17,22 +17,22 @@ Section res. (** Elements. *) Definition own_log_half γ (l : ledger) : iProp Σ := - own γ.(consensus_log) (mono_list_auth (A:=stringO) (DfracOwn (1 / 2)) l). + own γ.(consensus_log) (mono_list_auth (A:=byte_stringO) (DfracOwn (1 / 2)) l). Definition is_log_lb γ (l : ledger) : iProp Σ := - own γ.(consensus_log) (mono_list_lb (A:=stringO) l). + own γ.(consensus_log) (mono_list_lb (A:=byte_stringO) l). - Definition is_cmd_receipt γ (c : string) : iProp Σ := + Definition is_cmd_receipt γ (c : byte_string) : iProp Σ := ghost_map_elem γ.(consensus_cpool) c DfracDiscarded tt. - Definition own_cpool_half γ (vs : gset string) : iProp Σ := + Definition own_cpool_half γ (vs : gset byte_string) : iProp Σ := ghost_map_auth γ.(consensus_cpool) (1 / 2) (gset_to_gmap tt vs) ∗ ([∗ set] v ∈ vs, is_cmd_receipt γ v). - Definition own_consensus_half γ (l : ledger) (vs : gset string) : iProp Σ := + Definition own_consensus_half γ (l : ledger) (vs : gset byte_string) : iProp Σ := own_log_half γ l ∗ own_cpool_half γ vs. - Definition cpool_subsume_log (l : ledger) (vs : gset string) := + Definition cpool_subsume_log (l : ledger) (vs : gset byte_string) := Forall (λ v, v ∈ vs) l. (** Type class instances. *) @@ -170,12 +170,12 @@ Section res. Definition own_proposal γ (t : nat) (v : ledger) : iProp Σ := ∃ name, is_proposal_name γ t name ∗ - own name (mono_list_auth (A:=stringO) (DfracOwn (1 / 2)) v). + own name (mono_list_auth (A:=byte_stringO) (DfracOwn (1 / 2)) v). Definition is_proposal_lb γ (t : nat) (v : ledger) : iProp Σ := ∃ name, is_proposal_name γ t name ∗ - own name (mono_list_lb (A:=stringO) v). + own name (mono_list_lb (A:=byte_stringO) v). (** Type class instances. *) @@ -197,7 +197,7 @@ Section res. iDestruct (big_sepM2_dom with "Hpslm") as %Hdom. assert (Hnamest : names !! t = None). { by rewrite -not_elem_of_dom Hdom not_elem_of_dom. } - iMod (own_alloc (mono_list_auth (A:=stringO) (DfracOwn 1) v)) as (name) "Hl". + iMod (own_alloc (mono_list_auth (A:=byte_stringO) (DfracOwn 1) v)) as (name) "Hl". { apply mono_list_auth_valid. } iMod (ghost_map_insert _ name with "Hauth") as "[Hauth Hfrag]". { apply Hnamest. } @@ -478,11 +478,11 @@ Section res. Definition own_accepted_proposal γ (nid : u64) (t : nat) (v : ledger) : iProp Σ := ∃ name, is_accepted_proposal_name γ nid t name ∗ - own name (mono_list_auth (A:=stringO) (DfracOwn (1 / 2)) v). + own name (mono_list_auth (A:=byte_stringO) (DfracOwn (1 / 2)) v). Definition is_accepted_proposal_lb γ (nid : u64) (t : nat) (v : ledger) : iProp Σ := ∃ name, - is_accepted_proposal_name γ nid t name ∗ own name (mono_list_lb (A:=stringO) v). + is_accepted_proposal_name γ nid t name ∗ own name (mono_list_lb (A:=byte_stringO) v). Definition is_accepted_proposal_length_lb γ (nid : u64) (t n : nat) : iProp Σ := ∃ v, is_accepted_proposal_lb γ nid t v ∗ ⌜(n ≤ length v)%nat⌝. @@ -503,7 +503,7 @@ Section res. Proof. iIntros (Hnotin) "Hauth". iDestruct "Hauth" as (gnames) "(Hauth & Hblts)". - iMod (own_alloc (mono_list_auth (A:=stringO) (DfracOwn 1) v)) as (α) "Hblt". + iMod (own_alloc (mono_list_auth (A:=byte_stringO) (DfracOwn 1) v)) as (α) "Hblt". { apply mono_list_auth_valid. } iDestruct (big_sepM2_dom with "Hblts") as %Hdom. assert (Hgnotin : gnames !! t = None). @@ -875,8 +875,8 @@ Section wal. by destruct Hvalid as [_ ?]. Qed. - Definition is_node_wal_fname γ (nid : u64) (fname : string) : iProp Σ := - own γ.(node_wal_fname) {[ nid := (to_agree (A:=stringO) fname) ]}. + Definition is_node_wal_fname γ (nid : u64) (fname : byte_string) : iProp Σ := + own γ.(node_wal_fname) {[ nid := (to_agree (A:=byte_stringO) fname) ]}. #[global] Instance is_node_wal_fname_persistent γ nid fname : @@ -925,7 +925,7 @@ Section alloc. iMod (own_alloc (mono_list_auth (DfracOwn 1) [])) as (γconsensus_log) "(Hconsensus_log1&Hconsensus_log2)". { econstructor; try econstructor; rewrite //=. } - iMod (ghost_map_alloc_empty (K := string) (V := unit)) as + iMod (ghost_map_alloc_empty (K := byte_string) (V := unit)) as (γconsensus_cpool) "(Hconsensus_cpool1&Hconsensus_cpool2)". iMod (ghost_map_alloc_empty (K := nat) (V := gname)) as (γproposal) "Hproposals". @@ -964,7 +964,7 @@ Section alloc. (γnode_wal) "Hnode_wal". { apply gset_to_gmap_valid. rewrite //=. } - iMod (own_alloc ((to_agree <$> fnames) : gmapR u64 (agreeR stringO))) as + iMod (own_alloc ((to_agree <$> fnames) : gmapR u64 (agreeR byte_stringO))) as (γnode_wal_fname) "Hnode_wal_fname". { intros k. rewrite lookup_fmap; destruct (fnames !! k) eqn:Heq; rewrite Heq //=. } diff --git a/src/program_proof/tulip/program/gcoord/encode.v b/src/program_proof/tulip/program/gcoord/encode.v index aa14d551e..1c7d731ad 100644 --- a/src/program_proof/tulip/program/gcoord/encode.v +++ b/src/program_proof/tulip/program/gcoord/encode.v @@ -8,7 +8,7 @@ Opaque u64_le. Section encode. Context `{!heapGS Σ, !paxos_ghostG Σ}. - Theorem wp_EncodeTxnReadRequest (ts : u64) (key : string) : + Theorem wp_EncodeTxnReadRequest (ts : u64) (key : byte_string) : {{{ True }}} EncodeTxnReadRequest #ts #(LitString key) {{{ (dataP : Slice.t) (data : list u8), RET (to_val dataP); @@ -19,7 +19,7 @@ Section encode. iIntros (Φ) "_ HΦ". wp_rec. - (*@ func EncodeTxnReadRequest(ts uint64, key string) []byte { @*) + (*@ func EncodeTxnReadRequest(ts uint64, key byte_string) []byte { @*) (*@ bs := make([]byte, 0, 32) @*) (*@ bs1 := marshal.WriteInt(bs, MSG_TXN_READ) @*) (*@ bs2 := marshal.WriteInt(bs1, ts) @*) diff --git a/src/program_proof/tulip/program/gcoord/gcoord_read.v b/src/program_proof/tulip/program/gcoord/gcoord_read.v index dfadb5a13..6feeb599d 100644 --- a/src/program_proof/tulip/program/gcoord/gcoord_read.v +++ b/src/program_proof/tulip/program/gcoord/gcoord_read.v @@ -7,7 +7,7 @@ Section program. Context `{!heapGS Σ, !tulip_ghostG Σ}. Theorem wp_GroupCoordinator__Read - (gcoord : loc) (tsW : u64) (key : string) gid γ : + (gcoord : loc) (tsW : u64) (key : byte_string) gid γ : let ts := uint.nat tsW in safe_read_req gid ts key -> is_gcoord gcoord gid γ -∗ diff --git a/src/program_proof/tulip/program/gcoord/gcoord_read_session.v b/src/program_proof/tulip/program/gcoord/gcoord_read_session.v index c0156aca7..8497d402e 100644 --- a/src/program_proof/tulip/program/gcoord/gcoord_read_session.v +++ b/src/program_proof/tulip/program/gcoord/gcoord_read_session.v @@ -7,7 +7,7 @@ Section program. Context `{!heapGS Σ, !tulip_ghostG Σ}. Theorem wp_GroupCoordinator__ReadSession - (gcoord : loc) (rid : u64) (tsW : u64) (key : string) gid γ : + (gcoord : loc) (rid : u64) (tsW : u64) (key : byte_string) gid γ : let ts := uint.nat tsW in rid ∈ rids_all -> safe_read_req gid ts key -> diff --git a/src/program_proof/tulip/program/gcoord/gcoord_send.v b/src/program_proof/tulip/program/gcoord/gcoord_send.v index d935d3eda..df7d6837d 100644 --- a/src/program_proof/tulip/program/gcoord/gcoord_send.v +++ b/src/program_proof/tulip/program/gcoord/gcoord_send.v @@ -74,7 +74,7 @@ Section program. Qed. Theorem wp_GroupCoordinator__SendRead - (gcoord : loc) (rid : u64) (ts : u64) (key : string) addrm gid γ : + (gcoord : loc) (rid : u64) (ts : u64) (key : byte_string) addrm gid γ : safe_read_req gid (uint.nat ts) key -> rid ∈ dom addrm -> is_gcoord_with_addrm gcoord gid addrm γ -∗ diff --git a/src/program_proof/tulip/program/gcoord/gcoord_wait_until_value_ready.v b/src/program_proof/tulip/program/gcoord/gcoord_wait_until_value_ready.v index 90eba3149..4c46b6bb1 100644 --- a/src/program_proof/tulip/program/gcoord/gcoord_wait_until_value_ready.v +++ b/src/program_proof/tulip/program/gcoord/gcoord_wait_until_value_ready.v @@ -7,7 +7,7 @@ Section program. Context `{!heapGS Σ, !tulip_ghostG Σ}. Theorem wp_GroupCoordinator__WaitUntilValueReady - (gcoord : loc) (tsW : u64) (key : string) gid γ : + (gcoord : loc) (tsW : u64) (key : byte_string) gid γ : let ts := uint.nat tsW in is_gcoord gcoord gid γ -∗ {{{ True }}} diff --git a/src/program_proof/tulip/program/gcoord/greader_clear_versions.v b/src/program_proof/tulip/program/gcoord/greader_clear_versions.v index b671178b3..c45144c18 100644 --- a/src/program_proof/tulip/program/gcoord/greader_clear_versions.v +++ b/src/program_proof/tulip/program/gcoord/greader_clear_versions.v @@ -4,7 +4,7 @@ From Perennial.program_proof.tulip.program.gcoord Require Import greader_repr. Section program. Context `{!heapGS Σ, !tulip_ghostG Σ}. - Theorem wp_GroupReader__clearVersions (grd : loc) (key : string) qreadm ts γ : + Theorem wp_GroupReader__clearVersions (grd : loc) (key : byte_string) qreadm ts γ : {{{ own_greader_qreadm grd qreadm ts γ }}} GroupReader__clearVersions #grd #(LitString key) {{{ RET #(); own_greader_qreadm grd (delete key qreadm) ts γ }}}. diff --git a/src/program_proof/tulip/program/gcoord/greader_pick_latest_value.v b/src/program_proof/tulip/program/gcoord/greader_pick_latest_value.v index a5035b724..22100e8a3 100644 --- a/src/program_proof/tulip/program/gcoord/greader_pick_latest_value.v +++ b/src/program_proof/tulip/program/gcoord/greader_pick_latest_value.v @@ -8,7 +8,7 @@ Local Ltac Zify.zify_post_hook ::= Z.div_mod_to_equations. Section program. Context `{!heapGS Σ, !tulip_ghostG Σ}. - Theorem wp_GroupReader__pickLatestValue (grd : loc) (key : string) qreadm verm ts γ : + Theorem wp_GroupReader__pickLatestValue (grd : loc) (key : byte_string) qreadm verm ts γ : qreadm !! key = Some verm -> cquorum_size rids_all (dom verm) -> {{{ own_greader_qreadm grd qreadm ts γ }}} diff --git a/src/program_proof/tulip/program/gcoord/greader_process_read_result.v b/src/program_proof/tulip/program/gcoord/greader_process_read_result.v index ec81355fa..7cbc997af 100644 --- a/src/program_proof/tulip/program/gcoord/greader_process_read_result.v +++ b/src/program_proof/tulip/program/gcoord/greader_process_read_result.v @@ -10,7 +10,7 @@ Section program. Context `{!heapGS Σ, !tulip_ghostG Σ}. Theorem wp_GroupReader__processReadResult - grd (rid : u64) (key : string) (ver : dbpver) (slow : bool) ts γ : + grd (rid : u64) (key : byte_string) (ver : dbpver) (slow : bool) ts γ : rid ∈ rids_all -> fast_or_slow_read γ rid key (uint.nat ver.1) ts ver.2 slow -∗ {{{ own_greader grd ts γ }}} diff --git a/src/program_proof/tulip/program/gcoord/greader_read.v b/src/program_proof/tulip/program/gcoord/greader_read.v index 16f5e0ffe..a81980f20 100644 --- a/src/program_proof/tulip/program/gcoord/greader_read.v +++ b/src/program_proof/tulip/program/gcoord/greader_read.v @@ -5,7 +5,7 @@ From Perennial.program_proof.tulip.program.gcoord Require Import greader_repr. Section program. Context `{!heapGS Σ, !tulip_ghostG Σ}. - Theorem wp_GroupReader__read (grd : loc) (key : string) ts γ : + Theorem wp_GroupReader__read (grd : loc) (key : byte_string) ts γ : {{{ own_greader grd ts γ }}} GroupReader__read #grd #(LitString key) {{{ (v : dbval) (ok : bool), RET (dbval_to_val v, #ok); diff --git a/src/program_proof/tulip/program/gcoord/greader_reset.v b/src/program_proof/tulip/program/gcoord/greader_reset.v index 9cfc4455b..74ce26521 100644 --- a/src/program_proof/tulip/program/gcoord/greader_reset.v +++ b/src/program_proof/tulip/program/gcoord/greader_reset.v @@ -17,10 +17,10 @@ Section program. (*@ grd.qreadm = make(map[string]map[uint64]tulip.Version) @*) (*@ } @*) iNamed "Hgrd". - wp_apply (wp_NewMap string dbval). + wp_apply (wp_NewMap byte_string dbval). iIntros (valuemP') "Hvaluem". wp_storeField. - wp_apply (wp_NewMap string loc). + wp_apply (wp_NewMap byte_string loc). iIntros (qreadmP') "Hqreadm". wp_storeField. iApply "HΦ". diff --git a/src/program_proof/tulip/program/gcoord/greader_responded.v b/src/program_proof/tulip/program/gcoord/greader_responded.v index 1a2addc7f..dac9ccede 100644 --- a/src/program_proof/tulip/program/gcoord/greader_responded.v +++ b/src/program_proof/tulip/program/gcoord/greader_responded.v @@ -4,7 +4,7 @@ From Perennial.program_proof.tulip.program.gcoord Require Import greader_repr. Section program. Context `{!heapGS Σ, !tulip_ghostG Σ}. - Theorem wp_GroupReader__responded (grd : loc) (rid : u64) (key : string) ts γ : + Theorem wp_GroupReader__responded (grd : loc) (rid : u64) (key : byte_string) ts γ : {{{ own_greader grd ts γ }}} GroupReader__responded #grd #rid #(LitString key) {{{ (responded : bool), RET #responded; own_greader grd ts γ }}}. diff --git a/src/program_proof/tulip/program/index/index.v b/src/program_proof/tulip/program/index/index.v index 4c78921b8..e48b20855 100644 --- a/src/program_proof/tulip/program/index/index.v +++ b/src/program_proof/tulip/program/index/index.v @@ -22,7 +22,7 @@ Section program. "#HmuP" ∷ readonly (idx ↦[Index :: "mu"] #muP) ∗ "#Hmu" ∷ is_lock tulipNS #muP (own_index idx γ α). - Theorem wp_Index__GetTuple (idx : loc) (key : string) γ α : + Theorem wp_Index__GetTuple (idx : loc) (key : byte_string) γ α : key ∈ keys_all -> is_index idx γ α -∗ {{{ True }}} diff --git a/src/program_proof/tulip/program/prelude.v b/src/program_proof/tulip/program/prelude.v index bc9df88bb..cde056671 100644 --- a/src/program_proof/tulip/program/prelude.v +++ b/src/program_proof/tulip/program/prelude.v @@ -49,7 +49,7 @@ Proof. refine {| to_val := dbmod_to_val; from_val := dbmod_from_val; - IntoVal_def := ("", None); + IntoVal_def := (""%go, None); |}. intros [k v]. by destruct v. diff --git a/src/program_proof/tulip/program/replica/encode.v b/src/program_proof/tulip/program/replica/encode.v index a0079574f..ea1856aba 100644 --- a/src/program_proof/tulip/program/replica/encode.v +++ b/src/program_proof/tulip/program/replica/encode.v @@ -7,7 +7,7 @@ Section encode. Context `{!heapGS Σ, !paxos_ghostG Σ}. Theorem wp_EncodeTxnReadResponse - (rid : u64) (ts : u64) (key : string) (ver : dbpver) (slow : bool) : + (rid : u64) (ts : u64) (key : byte_string) (ver : dbpver) (slow : bool) : {{{ True }}} EncodeTxnReadResponse #ts #rid #(LitString key) (dbpver_to_val ver) #slow {{{ (dataP : Slice.t) (data : list u8), RET (to_val dataP); diff --git a/src/program_proof/tulip/program/replica/replica_log.v b/src/program_proof/tulip/program/replica/replica_log.v index 2ebb1a75d..949952d80 100644 --- a/src/program_proof/tulip/program/replica/replica_log.v +++ b/src/program_proof/tulip/program/replica/replica_log.v @@ -6,7 +6,7 @@ From Perennial.program_proof.tulip.program.util Require Import Section program. Context `{!heapGS Σ, !tulip_ghostG Σ}. - Theorem wp_logRead (fname : string) (ts : u64) (key : string) (bs : list u8) : + Theorem wp_logRead (fname : byte_string) (ts : u64) (key : byte_string) (bs : list u8) : {{{ fname f↦ bs }}} logRead #(LitString fname) #ts #(LitString key) {{{ (bs' : list u8), RET #(); fname f↦ bs' }}}. @@ -52,7 +52,7 @@ Section program. Qed. Theorem wp_logValidate - (fname : string) (ts : u64) (pwrsP : Slice.t) (pwrs : dbmap) (bs : list u8) : + (fname : byte_string) (ts : u64) (pwrsP : Slice.t) (pwrs : dbmap) (bs : list u8) : {{{ fname f↦ bs ∗ own_dbmap_in_slice pwrsP pwrs }}} logValidate #(LitString fname) #ts (to_val pwrsP) slice.nil {{{ (bs' : list u8), RET #(); fname f↦ bs' ∗ own_dbmap_in_slice pwrsP pwrs }}}. @@ -99,7 +99,7 @@ Section program. Qed. Theorem wp_logFastPrepare - (fname : string) (ts : u64) (pwrsP : Slice.t) (pwrs : dbmap) (bs : list u8) : + (fname : byte_string) (ts : u64) (pwrsP : Slice.t) (pwrs : dbmap) (bs : list u8) : {{{ fname f↦ bs ∗ own_dbmap_in_slice pwrsP pwrs }}} logFastPrepare #(LitString fname) #ts (to_val pwrsP) slice.nil {{{ (bs' : list u8), RET #(); fname f↦ bs' ∗ own_dbmap_in_slice pwrsP pwrs }}}. @@ -145,7 +145,7 @@ Section program. by iFrame. Qed. - Theorem wp_logAccept (fname : string) (ts : u64) (rank : u64) (dec : bool) (bs : list u8) : + Theorem wp_logAccept (fname : byte_string) (ts : u64) (rank : u64) (dec : bool) (bs : list u8) : {{{ fname f↦ bs }}} logAccept #(LitString fname) #ts #rank #dec {{{ (bs' : list u8), RET #(); fname f↦ bs' }}}. diff --git a/src/program_proof/tulip/program/replica/replica_read.v b/src/program_proof/tulip/program/replica/replica_read.v index fae667528..38033183e 100644 --- a/src/program_proof/tulip/program/replica/replica_read.v +++ b/src/program_proof/tulip/program/replica/replica_read.v @@ -9,7 +9,7 @@ From Perennial.program_proof.tulip.program.index Require Import index. Section program. Context `{!heapGS Σ, !tulip_ghostG Σ}. - Theorem wp_Replica__Read (rp : loc) (tsW : u64) (key : string) gid rid γ : + Theorem wp_Replica__Read (rp : loc) (tsW : u64) (key : byte_string) gid rid γ : let ts := uint.nat tsW in ts ≠ O -> key ∈ keys_all -> diff --git a/src/program_proof/tulip/program/replica/replica_repr.v b/src/program_proof/tulip/program/replica/replica_repr.v index 071337743..cdb58c3a7 100644 --- a/src/program_proof/tulip/program/replica/replica_repr.v +++ b/src/program_proof/tulip/program/replica/replica_repr.v @@ -126,7 +126,7 @@ Section repr. "%Hexec" ∷ ⌜execute_cmds log = LocalState cm histm cpm ptgsm sptsm ptsm psm rkm⌝. Definition own_replica (rp : loc) (gid rid : u64) γ α : iProp Σ := - ∃ (cloga : dblog) (lsna : u64) (fname : string) (bs : list u8), + ∃ (cloga : dblog) (lsna : u64) (fname : byte_string) (bs : list u8), "Hrp" ∷ own_replica_with_cloga_no_lsna rp cloga gid rid γ α ∗ "Hlsna" ∷ rp ↦[Replica :: "lsna"] #lsna ∗ "HfnameP" ∷ rp ↦[Replica :: "fname"] #(LitString fname) ∗ diff --git a/src/program_proof/tulip/program/replica/start.v b/src/program_proof/tulip/program/replica/start.v index 55e7b30eb..ac7400d00 100644 --- a/src/program_proof/tulip/program/replica/start.v +++ b/src/program_proof/tulip/program/replica/start.v @@ -12,8 +12,8 @@ Section program. Context `{!heapGS Σ, !tulip_ghostG Σ, !paxos_ghostG Σ}. Theorem wp_Start - (rid : u64) (addr : chan) (fname : string) (addrmpxP : loc) (fnamepx : string) - (termc : u64) (terml : u64) (lsnc : u64) (log : list string) (addrmpx : gmap u64 chan) + (rid : u64) (addr : chan) (fname : byte_string) (addrmpxP : loc) (fnamepx : byte_string) + (termc : u64) (terml : u64) (lsnc : u64) (log : list byte_string) (addrmpx : gmap u64 chan) (addrm : gmap u64 chan) gid γ π : termc = (W64 0) -> terml = (W64 0) -> diff --git a/src/program_proof/tulip/program/tuple/res.v b/src/program_proof/tulip/program/tuple/res.v index 3a894250f..d0a64f574 100644 --- a/src/program_proof/tulip/program/tuple/res.v +++ b/src/program_proof/tulip/program/tuple/res.v @@ -4,7 +4,7 @@ From Perennial.program_proof.tulip.program Require Import prelude. Section res. Context `{!tulip_ghostG Σ}. - Definition own_phys_hist_half α (key : string) (hist : dbhist) : iProp Σ := + Definition own_phys_hist_half α (key : byte_string) (hist : dbhist) : iProp Σ := own α {[ key := (to_dfrac_agree (DfracOwn (1 / 2)) hist) ]}. Lemma phys_hist_update {α k h1 h2} h : diff --git a/src/program_proof/tulip/program/tuple/tuple.v b/src/program_proof/tulip/program/tuple/tuple.v index 962f52ae7..a99fc88bc 100644 --- a/src/program_proof/tulip/program/tuple/tuple.v +++ b/src/program_proof/tulip/program/tuple/tuple.v @@ -174,7 +174,7 @@ Section program. "#Hmu" ∷ readonly (tuple ↦[Tuple :: "mu"] #muP) ∗ "#Hlock" ∷ is_lock tulipNS #muP (own_tuple tuple key γ α). - Theorem wp_Tuple__AppendVersion (tuple : loc) (tsW : u64) (value : string) key hist γ α : + Theorem wp_Tuple__AppendVersion (tuple : loc) (tsW : u64) (value : byte_string) key hist γ α : let ts := uint.nat tsW in let hist' := last_extend ts hist ++ [Some value] in (length hist ≤ ts)%nat -> diff --git a/src/program_proof/tulip/program/txn/proph.v b/src/program_proof/tulip/program/txn/proph.v index c9b1769ed..fab41d503 100644 --- a/src/program_proof/tulip/program/txn/proph.v +++ b/src/program_proof/tulip/program/txn/proph.v @@ -4,7 +4,7 @@ From Perennial.goose_lang.trusted.github_com.mit_pdos.tulip Require Import trust Section proph. Context `{!heapGS Σ, !tulip_ghostG Σ}. - Lemma wp_ResolveRead p (tid : u64) (key : string) (ts : nat) : + Lemma wp_ResolveRead p (tid : u64) (key : byte_string) (ts : nat) : ⊢ {{{ ⌜uint.nat tid = ts⌝ }}} <<< ∀∀ acs, own_txn_proph p acs >>> diff --git a/src/program_proof/tulip/program/txn/txn_getwrs.v b/src/program_proof/tulip/program/txn/txn_getwrs.v index 69be52b1f..831e20658 100644 --- a/src/program_proof/tulip/program/txn/txn_getwrs.v +++ b/src/program_proof/tulip/program/txn/txn_getwrs.v @@ -4,7 +4,7 @@ From Perennial.program_proof.tulip.program.txn Require Import txn_repr txn_key_t Section program. Context `{!heapGS Σ, !tulip_ghostG Σ}. - Theorem wp_Txn__getwrs (txn : loc) (key : string) q wrs : + Theorem wp_Txn__getwrs (txn : loc) (key : byte_string) q wrs : valid_key key -> {{{ own_txn_wrs txn q wrs }}} Txn__getwrs #txn #(LitString key) diff --git a/src/program_proof/tulip/program/txn/txn_key_to_group.v b/src/program_proof/tulip/program/txn/txn_key_to_group.v index 2a5b9a121..8f14a1719 100644 --- a/src/program_proof/tulip/program/txn/txn_key_to_group.v +++ b/src/program_proof/tulip/program/txn/txn_key_to_group.v @@ -6,7 +6,7 @@ Local Ltac Zify.zify_post_hook ::= Z.div_mod_to_equations. Section program. Context `{!heapGS Σ, !tulip_ghostG Σ}. - Theorem wp_Txn__keyToGroup (txn : loc) (key : string) q wrs : + Theorem wp_Txn__keyToGroup (txn : loc) (key : byte_string) q wrs : valid_key key -> {{{ own_txn_wrs txn q wrs }}} Txn__keyToGroup #txn #(LitString key) @@ -30,7 +30,7 @@ Section program. rewrite /key_to_group. rewrite -size_dom Hdomwrs. pose proof size_gids_all as Hszall. - set x := String.length key. + set x := length key. set y := size gids_all. apply valid_key_length in Hvk. word. diff --git a/src/program_proof/tulip/program/txn/txn_setwrs.v b/src/program_proof/tulip/program/txn/txn_setwrs.v index 62d8a4489..e0cab4949 100644 --- a/src/program_proof/tulip/program/txn/txn_setwrs.v +++ b/src/program_proof/tulip/program/txn/txn_setwrs.v @@ -4,7 +4,7 @@ From Perennial.program_proof.tulip.program.txn Require Import txn_repr txn_key_t Section program. Context `{!heapGS Σ, !tulip_ghostG Σ}. - Theorem wp_Txn__setwrs (txn : loc) (key : string) (value : dbval) wrs : + Theorem wp_Txn__setwrs (txn : loc) (key : byte_string) (value : dbval) wrs : valid_key key -> {{{ own_txn_wrs txn (DfracOwn 1) wrs }}} Txn__setwrs #txn #(LitString key) (dbval_to_val value) diff --git a/src/program_proof/tulip/program/txnlog/txnlog.v b/src/program_proof/tulip/program/txnlog/txnlog.v index f93815f05..4e9b8fc52 100644 --- a/src/program_proof/tulip/program/txnlog/txnlog.v +++ b/src/program_proof/tulip/program/txnlog/txnlog.v @@ -252,7 +252,6 @@ Section program. exists (CmdAbort (uint.nat ts)). split; first set_solver. simpl. - rewrite bytes_to_string_to_bytes. rewrite /encode_abort_cmd. by rewrite w64_to_nat_id. } @@ -335,7 +334,7 @@ Section program. apply set_Forall_singleton. exists (CmdCommit (uint.nat ts) pwrs). split; first set_solver. - rewrite /= bytes_to_string_to_bytes -app_assoc. + rewrite /= -app_assoc. exists (u64_le ts ++ mdata). split; first done. exists mdata. @@ -369,8 +368,8 @@ Section program. Qed. Theorem wp_Start - (nidme : u64) (termc : u64) (terml : u64) (lsnc : u64) (log : list string) - (addrmP : loc) (addrm : gmap u64 chan) (fname : string) gid γ π : + (nidme : u64) (termc : u64) (terml : u64) (lsnc : u64) (log : list byte_string) + (addrmP : loc) (addrm : gmap u64 chan) (fname : byte_string) gid γ π : termc = (W64 0) -> terml = (W64 0) -> lsnc = (W64 0) -> diff --git a/src/program_proof/tulip/program/util/decode_string.v b/src/program_proof/tulip/program/util/decode_string.v index 02bc99713..37a97a36b 100644 --- a/src/program_proof/tulip/program/util/decode_string.v +++ b/src/program_proof/tulip/program/util/decode_string.v @@ -4,7 +4,7 @@ From Perennial.program_proof Require Import marshal_stateless_proof. Section program. Context `{!heapGS Σ, !paxos_ghostG Σ}. - Theorem wp_DecodeString (bsP : Slice.t) (s : string) (bstail : list u8) : + Theorem wp_DecodeString (bsP : Slice.t) (s : byte_string) (bstail : list u8) : {{{ own_slice_small bsP byteT (DfracOwn 1) (encode_string s ++ bstail) }}} DecodeString (to_val bsP) {{{ (dataP : Slice.t), RET (#(LitString s), (to_val dataP)); @@ -32,7 +32,6 @@ Section program. wp_apply (wp_StringFromBytes with "Hp2"). iIntros "Hp2". wp_pures. - rewrite string_to_bytes_to_string. by iApply "HΦ". Qed. diff --git a/src/program_proof/tulip/program/util/decode_strings.v b/src/program_proof/tulip/program/util/decode_strings.v index c73e79b38..3e0ad2e9a 100644 --- a/src/program_proof/tulip/program/util/decode_strings.v +++ b/src/program_proof/tulip/program/util/decode_strings.v @@ -5,7 +5,7 @@ From Perennial.program_proof Require Import marshal_stateless_proof. Section program. Context `{!heapGS Σ, !paxos_ghostG Σ}. - Theorem wp_DecodeStrings (bsP : Slice.t) (strs : list string) (bstail : list u8) : + Theorem wp_DecodeStrings (bsP : Slice.t) (strs : list byte_string) (bstail : list u8) : {{{ own_slice_small bsP byteT (DfracOwn 1) (encode_strings strs ++ bstail) }}} DecodeStrings (to_val bsP) {{{ (strsP : Slice.t) (dataP : Slice.t), RET (to_val strsP, to_val dataP); diff --git a/src/program_proof/tulip/program/util/encode_string.v b/src/program_proof/tulip/program/util/encode_string.v index b2441d110..82e464120 100644 --- a/src/program_proof/tulip/program/util/encode_string.v +++ b/src/program_proof/tulip/program/util/encode_string.v @@ -4,7 +4,7 @@ From Perennial.program_proof Require Import marshal_stateless_proof. Section program. Context `{!heapGS Σ, !paxos_ghostG Σ}. - Theorem wp_EncodeString (bsP : Slice.t) (s : string) (bs : list u8) : + Theorem wp_EncodeString (bsP : Slice.t) (s : byte_string) (bs : list u8) : {{{ own_slice bsP byteT (DfracOwn 1) bs }}} EncodeString (to_val bsP) #(LitString s) {{{ (dataP : Slice.t), RET (to_val dataP); @@ -29,7 +29,7 @@ Section program. wp_pures. iApply "HΦ". iFrame. - by rewrite -app_assoc /encode_string string_bytes_length. + by rewrite -app_assoc /encode_string. Qed. End program. diff --git a/src/program_proof/tulip/program/util/encode_strings.v b/src/program_proof/tulip/program/util/encode_strings.v index 0719efb95..83d49aba1 100644 --- a/src/program_proof/tulip/program/util/encode_strings.v +++ b/src/program_proof/tulip/program/util/encode_strings.v @@ -6,7 +6,7 @@ Section program. Context `{!heapGS Σ, !paxos_ghostG Σ}. Theorem wp_EncodeStrings - (bsP : Slice.t) (strsP : Slice.t) (bs : list u8) (strs : list string) : + (bsP : Slice.t) (strsP : Slice.t) (bs : list u8) (strs : list byte_string) : {{{ own_slice bsP byteT (DfracOwn 1) bs ∗ own_slice_small strsP stringT (DfracOwn 1) strs }}} diff --git a/src/program_proof/tulip/res_txnsys.v b/src/program_proof/tulip/res_txnsys.v index 920a77d7a..4cf286464 100644 --- a/src/program_proof/tulip/res_txnsys.v +++ b/src/program_proof/tulip/res_txnsys.v @@ -634,10 +634,10 @@ Section res. (** Computes a dbmap from its representation as a GooseLang value. If decoding fails, returns some arbitrary nonsense value. *) - Definition to_dbval (b : bool) (v : string) := + Definition to_dbval (b : bool) (v : byte_string) := if b then Some v else None. - Definition to_dbstring (v : val) : option string := + Definition to_dbstring (v : val) : option byte_string := match v with | (#true, (#(LitString key), _))%V => Some key | (#false, (#(LitString key), _))%V => None @@ -645,7 +645,7 @@ Section res. end. Definition decode_dbmap (v: val) : dbmap := - match @map.map_val _ dbkey (@string_IntoVal grove_op) String.eq_dec String.countable v with + match map.map_val v with | None => ∅ | Some (mv, _) => to_dbstring <$> mv end. diff --git a/src/program_proof/tutorial/kvservice/full_proof.v b/src/program_proof/tutorial/kvservice/full_proof.v index d476d9e52..456e1b57e 100644 --- a/src/program_proof/tutorial/kvservice/full_proof.v +++ b/src/program_proof/tutorial/kvservice/full_proof.v @@ -14,13 +14,13 @@ Module putArgs. Record t := mk { opId: u64 ; - key: string ; - val: string ; + key: byte_string ; + val: byte_string ; }. Definition encodes (x:list u8) (a:t) : Prop := - x = u64_le a.(opId) ++ (u64_le $ length $ string_to_bytes a.(key)) ++ - string_to_bytes a.(key) ++ string_to_bytes a.(val) + x = u64_le a.(opId) ++ (u64_le $ length a.(key)) ++ + a.(key) ++ a.(val) . Section local_defs. @@ -147,7 +147,6 @@ Proof. wp_storeField. iModIntro. iApply "HΦ". - repeat rewrite string_to_bytes_to_string. iFrame. Qed. @@ -158,14 +157,14 @@ Module conditionalPutArgs. Record t := mk { opId: u64 ; - key: string ; - expectedVal: string ; - newVal: string ; + key: byte_string ; + expectedVal: byte_string ; + newVal: byte_string ; }. Definition encodes (x:list u8) (a:t) : Prop := - x = u64_le a.(opId) ++ (u64_le $ length $ string_to_bytes a.(key)) ++ string_to_bytes a.(key) ++ - (u64_le $ length $ string_to_bytes a.(expectedVal)) ++ string_to_bytes a.(expectedVal) ++ string_to_bytes a.(newVal) + x = u64_le a.(opId) ++ (u64_le $ length a.(key)) ++ a.(key) ++ + (u64_le $ length a.(expectedVal)) ++ a.(expectedVal) ++ a.(newVal) . Section local_defs. @@ -324,8 +323,6 @@ Proof. wp_storeField. iModIntro. iApply "HΦ". iFrame. - rewrite ?string_to_bytes_to_string. - iFrame. Qed. End local_defs. @@ -335,11 +332,11 @@ Module getArgs. Record t := mk { opId: u64 ; - key: string ; + key: byte_string ; }. Definition encodes (x:list u8) (a:t) : Prop := - x = u64_le a.(opId) ++ string_to_bytes a.(key) + x = u64_le a.(opId) ++ a.(key) . Section local_defs. @@ -432,8 +429,6 @@ Proof. iModIntro. iApply "HΦ". iFrame. - rewrite string_to_bytes_to_string. - iFrame. Qed. End local_defs. @@ -543,7 +538,7 @@ Record erpc_names := Implicit Types γ:erpc_names. Class erpcG Σ := { - #[global] receiptG :: ghost_mapG Σ u64 string ; + #[global] receiptG :: ghost_mapG Σ u64 byte_string ; #[global] tokenG :: ghost_mapG Σ u64 unit ; #[global] clientTokenG :: inG Σ dfracR ; }. @@ -556,20 +551,20 @@ Definition own_unexecuted_token γ (opId:u64) : iProp Σ := Definition is_executed_witness γ (opId:u64) : iProp Σ := opId ↪[γ.(req_gn)]□ (). -Definition is_request_receipt γ (opId:u64) (r:string) : iProp Σ := +Definition is_request_receipt γ (opId:u64) (r:byte_string) : iProp Σ := opId ↪[γ.(reply_gn)]□ r. Definition own_client_token γcl : iProp Σ := own γcl (DfracOwn 1). -Definition is_request_inv γ γcl (opId:u64) (pre:iProp Σ) (post:string → iProp Σ) : iProp Σ := +Definition is_request_inv γ γcl (opId:u64) (pre:iProp Σ) (post:byte_string → iProp Σ) : iProp Σ := inv reqN (own_unexecuted_token γ opId ∗ pre ∨ is_executed_witness γ opId ∗ (∃ r, is_request_receipt γ opId r ∗ (post r ∨ own_client_token γcl))). -Definition own_erpc_server γ (nextFreshId:u64) (lastReplies:gmap u64 string) : iProp Σ := +Definition own_erpc_server γ (nextFreshId:u64) (lastReplies:gmap u64 byte_string) : iProp Σ := ∃ (usedIds:gset u64), "Htoks" ∷ ghost_map_auth γ.(req_gn) 1 (gset_to_gmap () usedIds) ∗ "Hreplies" ∷ ghost_map_auth γ.(reply_gn) 1 lastReplies ∗ @@ -581,7 +576,7 @@ Lemma alloc_erpc_server : ⊢ |==> ∃ γ, own_erpc_server γ 0 ∅. Proof. iMod (ghost_map_alloc_empty (V:=())) as (γreq) "Htoks". - iMod (ghost_map_alloc_empty (V:=string)) as (γreply) "Hreplies". + iMod (ghost_map_alloc_empty (V:=byte_string)) as (γreply) "Hreplies". iModIntro. iExists {| req_gn := _ ; reply_gn := _ |}. iExists ∅. @@ -642,7 +637,7 @@ Proof. iFrame. Qed. -Lemma server_duplicate_request_step opId r γ (lastReplies:gmap u64 string) nextFreshId: +Lemma server_duplicate_request_step opId r γ (lastReplies:gmap u64 byte_string) nextFreshId: lastReplies !! opId = Some r → own_erpc_server γ nextFreshId lastReplies -∗ is_executed_witness γ opId ∗ @@ -653,7 +648,7 @@ Proof. by iDestruct (big_sepM_lookup_acc with "Hwits") as "[$ HH]". Qed. -Lemma server_execute_step opId γ γcl pre post (lastReplies:gmap u64 string) nextFreshId: +Lemma server_execute_step opId γ γcl pre post (lastReplies:gmap u64 byte_string) nextFreshId: lastReplies !! opId = None → £ 1 -∗ is_request_inv γ γcl opId pre post -∗ @@ -744,7 +739,7 @@ Record kvservice_names := Class kvserviceG Σ := { #[global] erpc_inG :: erpcG Σ ; - #[global] kvs_inG :: ghost_mapG Σ string string ; + #[global] kvs_inG :: ghost_mapG Σ byte_string byte_string ; }. End ghost_proof. @@ -781,7 +776,7 @@ Definition conditionalPut_core_pre (args:conditionalPutArgs.t) : iProp Σ := args.(conditionalPutArgs.newVal) else oldv) ={∅,⊤∖↑reqN}=∗ (Q (bool_decide (oldv = args.(conditionalPutArgs.expectedVal)))))) - (λ r, if decide (r = "ok") then Q true else Q false) + (λ r, if decide (r = "ok"%go) then Q true else Q false) . Definition conditionalPut_core_post (args:conditionalPutArgs.t) r : iProp Σ := @@ -805,15 +800,15 @@ Module server. Record t := mk { nextFreshId : u64 ; - lastReplies : gmap u64 string ; - kvs : gmap string string ; + lastReplies : gmap u64 byte_string ; + kvs : gmap byte_string byte_string ; }. Global Instance etaServer : Settable _ := settable! (mk) . -Definition gauge_eq : relation (gmap string string) := - λ m1 m2, ∀ k, default "" (m1 !! k) = default "" (m2 !! k). +Definition gauge_eq : relation (gmap byte_string byte_string) := + λ m1 m2, ∀ k, default ""%go (m1 !! k) = default ""%go (m2 !! k). Global Instance gauge_eq_Equivalence: Equivalence (gauge_eq). Proof. @@ -831,14 +826,14 @@ Proof. intros ????. destruct (decide (k = k0)). - do 2 (rewrite lookup_insert_ne; last done). done. Qed. -Global Instance gauge_proper_default_lookup (k:string) : - Proper (gauge_eq ==> eq) (λ m, default "" (lookup k m)). +Global Instance gauge_proper_default_lookup (k:byte_string) : + Proper (gauge_eq ==> eq) (λ m, default ""%go (lookup k m)). Proof. intros ???. apply H. Qed. Section local_defns. Context `{!heapGS Σ}. Definition own_mem (s:loc) (st:t) : iProp Σ := - ∃ (lastReplies_loc kvs_loc:loc) (kvs_phys:gmap string string), + ∃ (lastReplies_loc kvs_loc:loc) (kvs_phys:gmap byte_string byte_string), "HnextFreshId" ∷ s ↦[Server :: "nextFreshId"] #st.(nextFreshId) ∗ "HlastReplies" ∷ s ↦[Server :: "lastReplies"] #lastReplies_loc ∗ "Hkvs" ∷ s ↦[Server :: "kvs"] #kvs_loc ∗ @@ -949,7 +944,7 @@ Lemma ghost_put γ st args : put_core_pre γ args -∗ server.own_ghost γ st ={⊤}=∗ server.own_ghost γ - (st <|server.lastReplies := <[args.(putArgs.opId) := ""]> st.(server.lastReplies)|> + (st <|server.lastReplies := <[args.(putArgs.opId) := ""%go]> st.(server.lastReplies)|> <|server.kvs := <[args.(putArgs.key) := args.(putArgs.val)]> st.(server.kvs)|>) ∗ put_core_post γ args. Proof. @@ -1056,19 +1051,19 @@ Qed. Local Definition cond_put_ok st args := (st <|server.lastReplies := - <[args.(conditionalPutArgs.opId) := "ok"]> st.(server.lastReplies)|> + <[args.(conditionalPutArgs.opId) := "ok"%go]> st.(server.lastReplies)|> <|server.kvs := <[args.(conditionalPutArgs.key) := args.(conditionalPutArgs.newVal)]> st.(server.kvs)|>) . Local Definition cond_put_not_ok st args := - (st <|server.lastReplies := <[args.(conditionalPutArgs.opId) := ""]> + (st <|server.lastReplies := <[args.(conditionalPutArgs.opId) := ""%go]> st.(server.lastReplies)|>) . Lemma ghost_conditionalPut_ok γ st args : st.(server.lastReplies) !! args.(conditionalPutArgs.opId) = None → - default "" (st.(server.kvs) !! args.(conditionalPutArgs.key)) = args.(conditionalPutArgs.expectedVal) → + default ""%go (st.(server.kvs) !! args.(conditionalPutArgs.key)) = args.(conditionalPutArgs.expectedVal) → £ 1 -∗ conditionalPut_core_pre γ args -∗ server.own_ghost γ st ={⊤}=∗ @@ -1091,19 +1086,19 @@ Proof. by rewrite H1. } - iMod ("Hclose" $! "ok" with "HQ") as "[Herpc #Hwit]". + iMod ("Hclose" $! "ok"%go with "HQ") as "[Herpc #Hwit]". iModIntro. iFrame "∗#%". iPureIntro. simpl. by f_equiv. Qed. Lemma ghost_conditionalPut_not_ok γ st args : st.(server.lastReplies) !! args.(conditionalPutArgs.opId) = None → - default "" (st.(server.kvs) !! args.(conditionalPutArgs.key)) ≠ args.(conditionalPutArgs.expectedVal) → + default ""%go (st.(server.kvs) !! args.(conditionalPutArgs.key)) ≠ args.(conditionalPutArgs.expectedVal) → £ 1 -∗ conditionalPut_core_pre γ args -∗ server.own_ghost γ st ={⊤}=∗ server.own_ghost γ (cond_put_not_ok st args) ∗ - conditionalPut_core_post γ args "". + conditionalPut_core_post γ args ""%go. Proof. intros. iIntros "Hlc Hspec". iNamed 1. @@ -1119,7 +1114,7 @@ Proof. by rewrite H1. } iMod ("Hau" with "Hptsto") as "HQ". - iMod ("Hclose" $! "" with "HQ") as "[Herpc #Hwit]". + iMod ("Hclose" $! ""%go with "HQ") as "[Herpc #Hwit]". iModIntro. iFrame "∗#%" . Qed. @@ -1275,9 +1270,9 @@ Lemma ghost_get γ st args : server.own_ghost γ st ={⊤}=∗ server.own_ghost γ (st <|server.lastReplies := - <[args.(getArgs.opId) := (default "" (st.(server.kvs) !! args.(getArgs.key)))]> + <[args.(getArgs.opId) := (default ""%go (st.(server.kvs) !! args.(getArgs.key)))]> st.(server.lastReplies)|>) ∗ - get_core_post γ args (default "" (st.(server.kvs) !! args.(getArgs.key))). + get_core_post γ args (default ""%go (st.(server.kvs) !! args.(getArgs.key))). Proof. intros. iIntros "Hlc Hspec". iNamed 1. @@ -1406,7 +1401,7 @@ Proof. wp_apply (wp_new_free_lock). iIntros (mu) "HmuInv". wp_storeField. - wp_apply (wp_NewMap string). + wp_apply (wp_NewMap byte_string). iIntros (kvs_loc) "HkvsM". wp_storeField. wp_apply (wp_NewMap u64). @@ -1451,9 +1446,8 @@ Program Definition conditionalPut_spec γ := spec_ty := conditionalPutArgs.t ; spec_Pre := (λ args enc_args, ⌜ conditionalPutArgs.encodes enc_args args ⌝ ∗ conditionalPut_core_pre γ args)%I; - spec_Post := (λ args enc_args enc_reply, ∃ reply, - ⌜ enc_reply = string_to_bytes reply ⌝ ∗ - conditionalPut_core_post γ args reply)%I; + spec_Post := (λ args enc_args enc_reply, + conditionalPut_core_post γ args enc_reply)%I; |}. Program Definition get_spec γ := @@ -1461,9 +1455,8 @@ Program Definition get_spec γ := spec_ty := getArgs.t ; spec_Pre := (λ args enc_args, ⌜ getArgs.encodes enc_args args ⌝ ∗ get_core_pre γ args)%I; - spec_Post := (λ args enc_args enc_reply, ∃ reply, - ⌜ enc_reply = string_to_bytes reply ⌝ ∗ - get_core_post γ args reply)%I; + spec_Post := (λ args enc_args enc_reply, + get_core_post γ args enc_reply)%I; |}. Definition is_kvserver_host host γ : iProp Σ := @@ -1748,7 +1741,7 @@ Lemma wp_Client__conditionalPutRpc γ cl args args_ptr : }}} Client__conditionalPutRpc #cl #args_ptr {{{ - (s:string) (err:u64), RET (#str s, #err); if decide (err = 0) then + (s:byte_string) (err:u64), RET (#str s, #err); if decide (err = 0) then conditionalPut_core_post γ args s else True }}}. @@ -1776,13 +1769,13 @@ Proof. { destruct err. { destruct c; by exfalso. } - iDestruct "Hpost" as "(? & (% & % & ? & ? & (% & % & ?)))". + iDestruct "Hpost" as "(? & (% & % & ? & ? & ?))". subst. wp_load. wp_apply (wp_StringFromBytes with "[$]"). iIntros "?". wp_pures. iApply "HΦ". - iModIntro. rewrite string_to_bytes_to_string. iFrame. + iModIntro. iFrame. } { wp_pures. iApply "HΦ". rewrite decide_False //. } Qed. @@ -1795,7 +1788,7 @@ Lemma wp_Client__getRpc γ cl args args_ptr : }}} Client__getRpc #cl #args_ptr {{{ - (s:string) (err:u64), RET (#str s, #err); if decide (err = 0) then get_core_post γ args s else True + (s:byte_string) (err:u64), RET (#str s, #err); if decide (err = 0) then get_core_post γ args s else True }}}. Proof. iIntros (Φ) "Hpre HΦ". @@ -1821,13 +1814,13 @@ Proof. { destruct err. { destruct c; by exfalso. } - iDestruct "Hpost" as "(? & (% & % & ? & ? & (% & % & ?)))". + iDestruct "Hpost" as "(? & (% & % & ? & ? & ?))". subst. wp_load. wp_apply (wp_StringFromBytes with "[$]"). iIntros "?". wp_pures. iApply "HΦ". - iModIntro. rewrite string_to_bytes_to_string. iFrame. + iModIntro. iFrame. } { wp_pures. iApply "HΦ". rewrite decide_False //. } Qed. diff --git a/src/program_proof/tutorial/kvservice/proof.v b/src/program_proof/tutorial/kvservice/proof.v index 0bee80249..fe994139f 100644 --- a/src/program_proof/tutorial/kvservice/proof.v +++ b/src/program_proof/tutorial/kvservice/proof.v @@ -14,13 +14,13 @@ Module putArgs. Record t := mk { opId: u64 ; - key: string ; - val: string ; + key: byte_string ; + val: byte_string ; }. Definition encodes (x:list u8) (a:t) : Prop := - x = u64_le a.(opId) ++ (u64_le $ length $ string_to_bytes a.(key)) ++ - string_to_bytes a.(key) ++ string_to_bytes a.(val) + x = u64_le a.(opId) ++ (u64_le $ length a.(key)) ++ + a.(key) ++ a.(val) . Section local_defs. @@ -147,7 +147,6 @@ Proof. wp_storeField. iModIntro. iApply "HΦ". - do 2 rewrite string_to_bytes_to_string. iFrame. Qed. @@ -158,14 +157,14 @@ Module conditionalPutArgs. Record t := mk { opId: u64 ; - key: string ; - expectedVal: string ; - newVal: string ; + key: byte_string ; + expectedVal: byte_string ; + newVal: byte_string ; }. Definition encodes (x:list u8) (a:t) : Prop := - x = u64_le a.(opId) ++ (u64_le $ length $ string_to_bytes a.(key)) ++ string_to_bytes a.(key) ++ - (u64_le $ length $ string_to_bytes a.(expectedVal)) ++ string_to_bytes a.(expectedVal) ++ string_to_bytes a.(newVal) + x = u64_le a.(opId) ++ (u64_le $ length a.(key)) ++ a.(key) ++ + (u64_le $ length a.(expectedVal)) ++ a.(expectedVal) ++ a.(newVal) . Section local_defs. @@ -323,7 +322,6 @@ Proof. iIntros "_". wp_storeField. iModIntro. iApply "HΦ". - repeat rewrite string_to_bytes_to_string. iFrame. Qed. @@ -334,11 +332,11 @@ Module getArgs. Record t := mk { opId: u64 ; - key: string ; + key: byte_string ; }. Definition encodes (x:list u8) (a:t) : Prop := - x = u64_le a.(opId) ++ string_to_bytes a.(key) + x = u64_le a.(opId) ++ a.(key) . Section local_defs. @@ -430,7 +428,6 @@ Proof. wp_storeField. iModIntro. iApply "HΦ". - repeat rewrite string_to_bytes_to_string. iFrame. Qed. @@ -544,14 +541,14 @@ Definition put_core_spec (args:putArgs.t) (Φ:unit → iPropO Σ): iPropO Σ := Global Instance put_core_MonotonicPred args : MonotonicPred (put_core_spec args). Proof. apply _. Qed. -Definition conditionalPut_core_spec (args:conditionalPutArgs.t) (Φ:string → iPropO Σ): iPropO Σ := +Definition conditionalPut_core_spec (args:conditionalPutArgs.t) (Φ:byte_string → iPropO Σ): iPropO Σ := (* TUTORIAL: write a more useful spec *) (∀ status, Φ status)%I. Global Instance conditionalPut_core_MonotonicPred args : MonotonicPred (conditionalPut_core_spec args). Proof. apply _. Qed. -Definition get_core_spec (args:getArgs.t) (Φ:string → iPropO Σ): iPropO Σ := +Definition get_core_spec (args:getArgs.t) (Φ:byte_string → iPropO Σ): iPropO Σ := (* TUTORIAL: write a more useful spec *) (∀ ret, Φ ret)%I. @@ -564,7 +561,7 @@ Section rpc_server_proofs. Context `{!heapGS Σ}. Definition own_Server (s:loc) : iProp Σ := - ∃ (nextFreshId:u64) (lastReplies:gmap u64 string) (kvs:gmap string string) + ∃ (nextFreshId:u64) (lastReplies:gmap u64 byte_string) (kvs:gmap byte_string byte_string) (lastReplies_loc kvs_loc:loc), "HnextFreshId" ∷ s ↦[Server :: "nextFreshId"] #nextFreshId ∗ "HlastReplies" ∷ s ↦[Server :: "lastReplies"] #lastReplies_loc ∗ @@ -772,7 +769,7 @@ Proof. wp_apply (wp_new_free_lock). iIntros (mu) "HmuInv". wp_storeField. - wp_apply (wp_NewMap string). + wp_apply (wp_NewMap byte_string). iIntros (kvs_loc) "HkvsM". wp_storeField. wp_apply (wp_NewMap u64). @@ -818,7 +815,7 @@ Program Definition conditionalPut_spec := λ (enc_args:list u8), λne (Φ : list u8 -d> iPropO Σ) , (∃ args, "%Henc" ∷ ⌜conditionalPutArgs.encodes enc_args args⌝ ∗ - conditionalPut_core_spec args (λ rep, Φ (string_to_bytes rep)) + conditionalPut_core_spec args (λ rep, Φ rep) )%I . Next Obligation. @@ -829,7 +826,7 @@ Program Definition get_spec := λ (enc_args:list u8), λne (Φ : list u8 -d> iPropO Σ) , (∃ args, "%Henc" ∷ ⌜getArgs.encodes enc_args args⌝ ∗ - get_core_spec args (λ rep, Φ (string_to_bytes rep)) + get_core_spec args (λ rep, Φ rep) )%I . Next Obligation. @@ -1148,7 +1145,7 @@ Lemma wp_Client__conditionalPutRpc Post cl args args_ptr : }}} Client__conditionalPutRpc #cl #args_ptr {{{ - (s:string) (err:u64), RET (#str s, #err); if decide (err = 0) then Post s else True + (s:byte_string) (err:u64), RET (#str s, #err); if decide (err = 0) then Post s else True }}} . Proof. @@ -1189,7 +1186,6 @@ Proof. iIntros "_". wp_pures. iModIntro. iApply "HΦ". - repeat rewrite string_to_bytes_to_string. iFrame. } { @@ -1211,7 +1207,7 @@ Lemma wp_Client__getRpc Post cl args args_ptr : }}} Client__getRpc #cl #args_ptr {{{ - (s:string) (err:u64), RET (#str s, #err); if decide (err = 0) then Post s else True + (s:byte_string) (err:u64), RET (#str s, #err); if decide (err = 0) then Post s else True }}} . Proof. @@ -1252,7 +1248,6 @@ Proof. iIntros "_". wp_pures. iModIntro. iApply "HΦ". - repeat rewrite string_to_bytes_to_string. iFrame. } { diff --git a/src/program_proof/txn/twophase_sub_logical_reln_defs.v b/src/program_proof/txn/twophase_sub_logical_reln_defs.v index 765757b07..42d1dca58 100644 --- a/src/program_proof/txn/twophase_sub_logical_reln_defs.v +++ b/src/program_proof/txn/twophase_sub_logical_reln_defs.v @@ -620,7 +620,7 @@ Proof. iSpecialize ("H" $! j _ _ _ Hctx' with "Hj"); clear Hctx'. iApply (wpc_mono' with "[] [] H"); last by auto. iIntros (v1) "H". iDestruct "H" as (vs1) "(Hj&Hv1)". - iAssert (∃ (vres: string), ⌜ un_op_eval ToStringOp v1 = Some #(LitString vres) ∧ + iAssert (∃ (vres: byte_string), ⌜ un_op_eval ToStringOp v1 = Some #(LitString vres) ∧ un_op_eval ToStringOp vs1 = Some #(LitString vres) ⌝)%I with "[Hv1]" as %Hres. { destruct t; try inversion e; diff --git a/src/program_proof/vrsm/apps/closed_proof.v b/src/program_proof/vrsm/apps/closed_proof.v index 66ec2bb64..ebad04cd5 100644 --- a/src/program_proof/vrsm/apps/closed_proof.v +++ b/src/program_proof/vrsm/apps/closed_proof.v @@ -58,7 +58,7 @@ Qed. Local Instance subG_ekvΣ {Σ} : subG kv_pbΣ Σ → ekvG Σ. Proof. intros. solve_inG. Qed. -Definition replica_fname := "kv.data". +Definition replica_fname := "kv.data"%go. (* FIXME: put this in the file that defines ekvΣ? *) Opaque ekvΣ. @@ -147,7 +147,7 @@ Proof. (* Allocate the kv system used for storing data *) iMod (alloc_vkv (ekvParams.mk [dr1Host ; dr2Host ]) [(dconfigHost, dconfigHostPaxos)] - {[ "init"; "a1"; "a2" ]} with "[Hd1 Hd2]") as "[Hdkv Hdconf]"; try (simpl; lia). + {[ "init"; "a1"; "a2" ]}%go with "[Hd1 Hd2]") as "[Hdkv Hdconf]"; try (simpl; lia). { rewrite /own_chans /=. repeat iDestruct (wand_refl (_ ∗ _) with "[$]") as "[? ?]". @@ -158,7 +158,7 @@ Proof. (* Allocate the kv system used as a lockservice *) iMod (alloc_vkv (ekvParams.mk [lr1Host ; lr2Host ]) [(lconfigHost, lconfigHostPaxos)] - {[ "init"; "a1"; "a2" ]} with "[Hl1 Hl2]") as "[Hlkv Hlconf]"; try (simpl; lia). + {[ "init"; "a1"; "a2" ]}%go with "[Hl1 Hl2]") as "[Hlkv Hlconf]"; try (simpl; lia). { rewrite /own_chans /=. repeat iDestruct (wand_refl (_ ∗ _) with "[$]") as "[? ?]". @@ -168,21 +168,21 @@ Proof. iSimpl in "Hlhost". (* set up bank *) - iAssert (|={⊤}=> is_bank "init" _ _ {[ "a1" ; "a2" ]})%I with "[Hlkvs Hkvs]" as ">#Hbank". + iAssert (|={⊤}=> is_bank "init"%go _ _ {[ "a1"%go ; "a2"%go ]})%I with "[Hlkvs Hkvs]" as ">#Hbank". { - iDestruct (big_sepS_delete _ _ "init" with "Hlkvs") as "(Hinit&Hlkvs)". + iDestruct (big_sepS_delete _ _ "init"%go with "Hlkvs") as "(Hinit&Hlkvs)". { set_solver. } instantiate (2:=Build_lock_names (kv_ptsto γl)). rewrite /is_bank. iMod (lock_alloc lockN {| kvptsto_lock := kv_ptsto γl |} _ "init" with "[Hinit] [-]") as "$"; last done. { iFrame. } - iDestruct (big_sepS_delete _ _ "init" with "Hkvs") as "(Hinit&Hkvs)". + iDestruct (big_sepS_delete _ _ "init"%go with "Hkvs") as "(Hinit&Hkvs)". { set_solver. } iLeft. instantiate (1:=kv_ptsto γd). iFrame. iApply (big_sepS_sep). - eassert (_ ∖ _ = {[ "a1"; "a2" ]}) as ->. + eassert (_ ∖ _ = {[ "a1"; "a2" ]}%go) as ->. { set_solver. } iFrame. } diff --git a/src/program_proof/vrsm/apps/closed_wpcs.v b/src/program_proof/vrsm/apps/closed_wpcs.v index ffa63b86a..e53316a12 100644 --- a/src/program_proof/vrsm/apps/closed_wpcs.v +++ b/src/program_proof/vrsm/apps/closed_wpcs.v @@ -321,11 +321,11 @@ Lemma wp_makeBankClerk γlk γkv (kvParams1 kvParams2:ekvParams.t): {{{ "#Hhost1" ∷ is_kv_config_hosts (params:=kvParams1) [dconfigHost] γkv ∗ "#Hhost2" ∷ is_kv_config_hosts (params:=kvParams2) [lconfigHost] γlk ∗ - "#Hbank" ∷ is_bank "init" (Build_lock_names (kv_ptsto γlk)) (kv_ptsto γkv) {[ "a1"; "a2" ]} + "#Hbank" ∷ is_bank "init"%go (Build_lock_names (kv_ptsto γlk)) (kv_ptsto γkv) {[ "a1"%go; "a2"%go ]} }}} makeBankClerk #() {{{ - (b:loc), RET #b; own_bank_clerk b {[ "a1" ; "a2" ]} + (b:loc), RET #b; own_bank_clerk b {[ "a1"%go ; "a2"%go ]} }}} . Proof. @@ -364,7 +364,7 @@ Definition bank_pre : iProp Σ := ∃ γkv γlk (p1 p2:ekvParams.t), "#Hhost1" ∷ is_kv_config_hosts (params:=p1)[dconfigHost] γkv ∗ "#Hhost2" ∷ is_kv_config_hosts (params:=p2) [lconfigHost] γlk ∗ - "#Hbank" ∷ is_bank "init" (Build_lock_names (kv_ptsto γlk)) (kv_ptsto γkv) {[ "a1"; "a2" ]} + "#Hbank" ∷ is_bank "init"%go (Build_lock_names (kv_ptsto γlk)) (kv_ptsto γkv) {[ "a1"%go; "a2"%go ]} . Lemma wp_bank_transferer_main : @@ -703,7 +703,7 @@ Lemma alloc_vkv (params:ekvParams.t) configHostPairs allocated `{!ekvG Σ}: ={⊤}=∗ (∃ γ, (* system-wide: allows clients to connect to the system, and gives them ownership of keys *) - ([∗ set] k ∈ allocated, kv_ptsto γ k "") ∗ + ([∗ set] k ∈ allocated, kv_ptsto γ k ""%go) ∗ is_kv_config_hosts (configHostPairs.*1) γ ∗ (* for each kv replica server: *) @@ -729,7 +729,7 @@ Proof. iMod (alloc_simplepb_system configHostPairs with "[$Hchan] [$HconfChan]") as (?) "H"; try done. iDestruct "H" as "(Hlog & #Hhosts & Hsrvs & HconfSrvs)". iFrame "HconfSrvs". - iMod (ghost_map_alloc (gset_to_gmap "" allocated)) as (γkv_gn) "[Hauth Hkvs]". + iMod (ghost_map_alloc (gset_to_gmap ""%go allocated)) as (γkv_gn) "[Hauth Hkvs]". iExists (Build_kv_names _ _). rewrite big_sepM_gset_to_gmap. iFrame "Hkvs". diff --git a/src/program_proof/vrsm/apps/vkv/kv_proof.v b/src/program_proof/vrsm/apps/vkv/kv_proof.v index 1b6990bb1..ccdfc21ee 100644 --- a/src/program_proof/vrsm/apps/vkv/kv_proof.v +++ b/src/program_proof/vrsm/apps/vkv/kv_proof.v @@ -14,11 +14,11 @@ From iris.algebra Require Import dfrac_agree mono_list. From Perennial.program_proof.vrsm.apps Require Import vsm proof kv_vsm_proof log. Class kvG Σ := KvG { - #[global] kv_ghostMapG :: ghost_mapG Σ string string ; + #[global] kv_ghostMapG :: ghost_mapG Σ byte_string byte_string ; #[global] kv_logG :: inG Σ (mono_listR (leibnizO kvOp)) ; #[global] kv_vsmG :: vsmG (sm_record:=kv_record) Σ ; }. -Definition kvΣ := #[configΣ; ghost_mapΣ string string; +Definition kvΣ := #[configΣ; ghost_mapΣ byte_string byte_string; GFunctor (mono_listR (leibnizO kvOp)); vsmΣ (sm_record:=kv_record) ]. @@ -66,7 +66,7 @@ Context `{!ekvG Σ}. [getOp] doing [default []]. *) Definition own_kvs γ ops : iProp Σ := ∃ allocatedKeys, - ghost_map_auth γ.(kv_gn) 1 (compute_state ops ∪ gset_to_gmap "" allocatedKeys) + ghost_map_auth γ.(kv_gn) 1 (compute_state ops ∪ gset_to_gmap ""%go allocatedKeys) . Definition stateN := nroot .@ "state". @@ -74,7 +74,7 @@ Definition stateN := nroot .@ "state". Definition kv_inv γlog γ : iProp Σ := inv stateN ( ∃ ops, own_log γlog ops ∗ own_kvs γ ops). -Definition kv_ptsto γ (k v : string) : iProp Σ := +Definition kv_ptsto γ (k v : byte_string) : iProp Σ := k ↪[γ.(kv_gn)] v. Context {params:ekvParams.t}. @@ -280,19 +280,18 @@ Proof. iIntros (?) "Hck Hsl". wp_apply (wp_StringFromBytes with "[$]"). iIntros "_". - simpl. rewrite string_to_bytes_to_string /=. rewrite lookup_union in Hlook. + simpl. destruct (compute_state ops !! key) as [x|]; simpl. - simpl in Hlook. rewrite union_Some_l in Hlook. injection Hlook as <-. iApply "HΦ". repeat iExists _. iFrame "∗#". - - - rewrite left_id lookup_gset_to_gmap_Some in Hlook. + - rewrite left_id lookup_gset_to_gmap_Some in Hlook. destruct Hlook as [? ?]; subst. iApply "HΦ". repeat iExists _. iFrame "∗#". Qed. -Local Lemma helper (m:gmap string string) s k v d : +Local Lemma helper (m:gmap byte_string byte_string) s k v d : (m ∪ gset_to_gmap d s) !! k = Some v → default d (m !! k) = v. Proof. @@ -307,7 +306,7 @@ Lemma wp_Clerk__CondPut ck γkv key expect val : <<< ∀∀ old_value, kv_ptsto γkv key old_value >>> Clerk__CondPut #ck #(str key) #(str expect) #(str val) @ (↑pbN ∪ ↑prophReadN ∪ ↑esmN ∪ ↑stateN) <<< kv_ptsto γkv key (if bool_decide (expect = old_value) then val else old_value) >>> - {{{ RET #(str (if bool_decide (expect = old_value) then "ok" else "")); own_Clerk ck γkv }}}. + {{{ RET #(str (if bool_decide (expect = old_value) then "ok"%go else ""%go)); own_Clerk ck γkv }}}. Proof. iIntros "%Φ !# Hck Hupd". wp_rec. diff --git a/src/program_proof/vrsm/apps/vkv/kv_vsm_proof.v b/src/program_proof/vrsm/apps/vkv/kv_vsm_proof.v index c6d7c078d..b93f884da 100644 --- a/src/program_proof/vrsm/apps/vkv/kv_vsm_proof.v +++ b/src/program_proof/vrsm/apps/vkv/kv_vsm_proof.v @@ -13,46 +13,46 @@ From Perennial.algebra Require Import map. Section defns. Inductive kvOp := - | putOp : string → string → kvOp - | getOp : string → kvOp - | condPutOp : string → string → string → kvOp + | putOp (k : byte_string) (v : byte_string) : kvOp + | getOp (k : byte_string) : kvOp + | condPutOp (k : byte_string) (e : byte_string) (v : byte_string) : kvOp . -Definition apply_op (state:gmap string string) (op:kvOp) := +Definition apply_op (state:gmap byte_string byte_string) (op:kvOp) := match op with | getOp _ => state | putOp k v => <[k:=v]> state | condPutOp k e v => - if decide (default "" (state !! k) = e) then + if decide (default ""%go (state !! k) = e) then <[k:=v]> state else state end . -Definition compute_state ops : gmap string string := +Definition compute_state ops : gmap byte_string byte_string := foldl apply_op ∅ ops. Definition compute_reply ops op : list u8 := match op with - | getOp k => string_to_bytes (default "" ((compute_state ops) !! k)) + | getOp k => (default ""%go ((compute_state ops) !! k)) | putOp k v => [] - | condPutOp k e v => if decide (default "" ((compute_state ops) !! k) = e) then - string_to_bytes ("ok") + | condPutOp k e v => if decide (default ""%go ((compute_state ops) !! k) = e) then + ("ok"%go) else [] end . Definition encode_op op : list u8 := match op with - | putOp k v => [W8 0] ++ u64_le (length (string_to_bytes k)) ++ - string_to_bytes k ++ string_to_bytes v - | getOp k => [W8 1] ++ string_to_bytes k - | condPutOp k e v => [W8 2] ++ u64_le (length (string_to_bytes k)) ++ - string_to_bytes k ++ - u64_le (length (string_to_bytes e)) ++ - string_to_bytes e ++ - string_to_bytes v + | putOp k v => [W8 0] ++ u64_le (length k) ++ + k ++ v + | getOp k => [W8 1] ++ k + | condPutOp k e v => [W8 2] ++ u64_le (length k) ++ + k ++ + u64_le (length e) ++ + e ++ + v end . @@ -86,7 +86,7 @@ Existing Instance kv_record. Context `{!heapGS Σ}. -Lemma wp_encodePutArgs (args_ptr:loc) (key val:string) : +Lemma wp_encodePutArgs (args_ptr:loc) (key val:byte_string) : {{{ "Hargs_key" ∷ args_ptr ↦[vkv.PutArgs :: "Key"] #(str key) ∗ "Hargs_val" ∷ args_ptr ↦[vkv.PutArgs :: "Val"] #(str val) @@ -132,11 +132,10 @@ Proof. wp_store. clear sl. wp_load. iApply "HΦ". iModIntro. iFrame. - iPureIntro. - by rewrite string_bytes_length. + done. Qed. -Lemma wp_decodePutArgs enc_sl enc q (key val:string) : +Lemma wp_decodePutArgs enc_sl enc q (key val:byte_string) : {{{ "%Henc" ∷ ⌜has_op_encoding enc (putOp key val)⌝ ∗ "Hsl" ∷ own_slice_small enc_sl byteT q enc @@ -187,13 +186,11 @@ Proof. simpl in Hsl_sz. rewrite length_app in Hkv_sz. wp_apply wp_SliceTake. { word. } - iDestruct (slice_small_split with "Hkv_sl") as "[Hk Hv]". - { shelve. } - replace (uint.nat (length (string_to_bytes key))) with (length (string_to_bytes key)) by word. - Unshelve. - 2:{ rewrite length_app. word. } + iDestruct (slice_small_split _ (length key) with "Hkv_sl") as "[Hk Hv]". + { rewrite length_app. word. } wp_apply (wp_StringFromBytes with "[$Hk]"). iIntros "Hk". + replace (uint.nat (W64 (length key))) with (length key) by word. rewrite take_app_length. wp_storeField. rewrite drop_app_length. @@ -203,13 +200,12 @@ Proof. { word. } wp_apply (wp_StringFromBytes with "[$Hv]"). iIntros "Hv". - do 2 rewrite string_to_bytes_to_string. wp_storeField. iModIntro. iApply "HΦ". iFrame. Qed. -Lemma wp_encodeGetArgs (key:string) : +Lemma wp_encodeGetArgs (key:byte_string) : {{{ True }}} @@ -246,7 +242,7 @@ Proof. done. Qed. -Lemma wp_decodeGetArgs enc_sl enc q (key:string) : +Lemma wp_decodeGetArgs enc_sl enc q (key:byte_string) : {{{ "%Henc" ∷ ⌜has_op_encoding enc (getOp key)⌝ ∗ "Hsl" ∷ own_slice_small enc_sl byteT q enc @@ -268,11 +264,10 @@ Proof. wp_apply (wp_StringFromBytes with "[$]"). iIntros "_". wp_pures. - rewrite string_to_bytes_to_string. by iApply "HΦ". Qed. -Lemma wp_encodeCondPutArgs (args_ptr:loc) (key expect val:string) : +Lemma wp_encodeCondPutArgs (args_ptr:loc) (key expect val:byte_string) : {{{ "Hargs_key" ∷ args_ptr ↦[vkv.CondPutArgs :: "Key"] #(str key) ∗ "Hargs_expect" ∷ args_ptr ↦[vkv.CondPutArgs :: "Expect"] #(str expect) ∗ @@ -336,7 +331,7 @@ Proof. repeat rewrite -app_assoc. done. Qed. -Lemma wp_decodeCondPutArgs enc_sl enc q (key expect val:string) : +Lemma wp_decodeCondPutArgs enc_sl enc q (key expect val:byte_string) : {{{ "%Henc" ∷ ⌜has_op_encoding enc (condPutOp key expect val)⌝ ∗ "Hsl" ∷ own_slice_small enc_sl byteT q enc @@ -385,7 +380,6 @@ Proof. wp_pures. wp_apply (wp_StringFromBytes with "[$Hkey_sl]"). iIntros "_". - rewrite string_to_bytes_to_string. wp_storeField. wp_apply (wp_ReadInt with "[$]"). iIntros (?) "Hsl". @@ -403,7 +397,7 @@ Proof. { word. } iDestruct (slice_small_split with "Hsl") as "[He Hv]". { shelve. } - replace (uint.nat (length (string_to_bytes expect))) with (length (string_to_bytes expect)) by word. + replace (uint.nat (length expect)) with (length expect) by word. Unshelve. 2:{ rewrite length_app. word. } wp_apply (wp_StringFromBytes with "[$He]"). @@ -418,7 +412,6 @@ Proof. wp_apply (wp_StringFromBytes with "[$Hv]"). iIntros "Hv". wp_storeField. - do 2 rewrite string_to_bytes_to_string. iModIntro. iApply "HΦ". iFrame. Qed. @@ -428,18 +421,18 @@ Notation is_state := (is_state (sm_record:=kv_record)). Context `{!vsmG (sm_record:=kv_record) Σ}. Definition own_KVState (s:loc) γst (ops:list OpType) (latestVnum:u64) : iProp Σ := - ∃ (kvs_loc vnums_loc:loc) (vnumsM:gmap string u64) (minVnum:u64), + ∃ (kvs_loc vnums_loc:loc) (vnumsM:gmap byte_string u64) (minVnum:u64), "Hkvs" ∷ s ↦[KVState :: "kvs"] #kvs_loc ∗ "Hvnums" ∷ s ↦[KVState :: "vnums"] #vnums_loc ∗ "HminVnum" ∷ s ↦[KVState :: "minVnum"] #minVnum ∗ "Hkvs_map" ∷ own_map kvs_loc (DfracOwn 1) (compute_state ops) ∗ "Hvnums_map" ∷ own_map vnums_loc (DfracOwn 1) vnumsM ∗ - "#Hst" ∷ □ (∀ (k:string), + "#Hst" ∷ □ (∀ (k:byte_string), (∀ (vnum':u64), ⌜uint.nat vnum' <= uint.nat latestVnum⌝ → ⌜uint.nat (default minVnum (vnumsM !! k)) <= uint.nat vnum'⌝ → ∃ someOps, is_state γst vnum' someOps ∗ ⌜compute_reply someOps (getOp k) = compute_reply ops (getOp k)⌝)) ∗ - "%Hle" ∷ ⌜∀ (k:string), uint.nat (default minVnum (vnumsM !! k)) <= uint.nat latestVnum⌝ + "%Hle" ∷ ⌜∀ (k:byte_string), uint.nat (default minVnum (vnumsM !! k)) <= uint.nat latestVnum⌝ . Implicit Type own_VersionedStateMachine : gname → (list OpType) → u64 → iProp Σ. @@ -511,17 +504,17 @@ Proof. iModIntro. iIntros. rewrite /typed_map.map_insert /= in H0. - destruct (decide (k = s0)). + destruct (decide (k = k0)). { subst. rewrite lookup_insert /= in H0. replace (vnum) with (vnum') by word. iExists _. by iDestruct "Hintermediate" as "[_ $]". } - assert (compute_reply (ops ++ [putOp s0 s1]) (getOp k) = - compute_reply (ops) (getOp k)) as Heq; last setoid_rewrite Heq. + assert (compute_reply (ops ++ [putOp k v]) (getOp k0) = + compute_reply (ops) (getOp k0)) as Heq; last setoid_rewrite Heq. { rewrite /compute_reply /= /compute_state. rewrite foldl_snoc /=. - by rewrite lookup_insert_ne. + rewrite lookup_insert_ne //. } rewrite lookup_insert_ne in H0; last done. destruct (decide (uint.nat vnum' <= uint.nat latestVnum)). @@ -543,7 +536,7 @@ Proof. } { iPureIntro. intros. - destruct (decide (k = s0)). + destruct (decide (k = k0)). { subst. by rewrite /typed_map.map_insert lookup_insert /=. } @@ -597,7 +590,7 @@ Proof. iSplitL. 2: { iPureIntro. intros. - destruct (decide (k = s0)). + destruct (decide (k = k0)). { subst. by rewrite /typed_map.map_insert lookup_insert /=. } { rewrite /typed_map.map_insert lookup_insert_ne /=; last done. @@ -608,13 +601,13 @@ Proof. iModIntro. iIntros. rewrite /typed_map.map_insert /= in H0. - destruct (decide (k = s0)). + destruct (decide (k = k0)). { subst. rewrite lookup_insert /= in H0. replace (vnum) with (vnum') by word. iExists _. by iDestruct "Hintermediate" as "[_ $]". } - eassert (compute_reply (ops ++ [_]) (getOp k) = - compute_reply (ops) (getOp k)) as Heq; last setoid_rewrite Heq. + eassert (compute_reply (ops ++ [_]) (getOp k0) = + compute_reply (ops) (getOp k0)) as Heq; last setoid_rewrite Heq. { rewrite /compute_reply /= /compute_state. rewrite foldl_snoc /=. done. @@ -697,13 +690,13 @@ Proof. iModIntro. iIntros. rewrite /typed_map.map_insert /= in H0. - destruct (decide (k = s0)). + destruct (decide (k = k0)). { subst. rewrite lookup_insert /= in H1. replace (vnum) with (vnum') by word. iExists _. by iDestruct "Hintermediate" as "[_ $]". } - eassert (compute_reply (ops ++ [condPutOp s0 _ s2]) (getOp k) = - compute_reply (ops) (getOp k)) as Heq; last setoid_rewrite Heq. + eassert (compute_reply (ops ++ [condPutOp k _ _]) (getOp k0) = + compute_reply (ops) (getOp k0)) as Heq; last setoid_rewrite Heq. { rewrite /compute_reply /= /compute_state. rewrite foldl_snoc /=. @@ -733,7 +726,7 @@ Proof. } { iPureIntro. intros. - destruct (decide (k = s0)). + destruct (decide (k = k0)). { subst. by rewrite /typed_map.map_insert lookup_insert /=. } @@ -753,8 +746,6 @@ Proof. wp_apply wp_StringToBytes. injection Hlookup as <-. iIntros (?) "Hreply_sl". - assert (default "" (foldl apply_op ∅ ops !! s0) ≠ s1) as Hnot. - { intros x. apply Heqb. repeat f_equal. done. } iApply "HΦ". iSplitL "Hkvs Hkvs_map Hvnums HminVnum Hvnums_map". { @@ -769,7 +760,7 @@ Proof. iModIntro. iIntros. iDestruct "Hintermediate" as "[Hintermediate Hcurst]". - assert (compute_state (ops ++ [condPutOp s0 s1 s2]) + assert (compute_state (ops ++ [condPutOp k e v]) = (compute_state ops)) as Heq. { rewrite /compute_state foldl_snoc /=. rewrite decide_False; done. @@ -794,7 +785,7 @@ Proof. } { iPureIntro. intros. - specialize (Hle k). + specialize (Hle k0). word. } } @@ -857,7 +848,7 @@ Proof. { wp_pures. iApply "HΦ". iModIntro. apply map_get_true in Hlookup. - pose proof (Hle s0) as Hle2. + pose proof (Hle k) as Hle2. rewrite Hlookup /= in Hle2. iSplitR. { word. } injection Hkv_lookup as <- ?. @@ -865,7 +856,7 @@ Proof. rewrite /kv_record /compute_reply /= /compute_state /=. iSplitL. { repeat iExists _; iFrame "∗#%". } - iSpecialize ("Hst" $! s0). + iSpecialize ("Hst" $! k). rewrite Hlookup /=. iModIntro. iIntros. iApply "Hst". @@ -876,7 +867,7 @@ Proof. wp_loadField. wp_pures. iApply "HΦ". iModIntro. apply map_get_false in Hlookup as [Hlookup Hv]. subst. - pose proof (Hle s0) as Hle2. + pose proof (Hle k) as Hle2. rewrite Hlookup /= in Hle2. iSplitR. { word. } injection Hkv_lookup as <- ?. @@ -884,7 +875,7 @@ Proof. rewrite /kv_record /compute_reply /= /compute_state /=. iSplitL. { repeat iExists _; iFrame "∗#%". } - iSpecialize ("Hst" $! s0). + iSpecialize ("Hst" $! k). rewrite Hlookup /=. iModIntro. iIntros. iApply "Hst". @@ -922,7 +913,7 @@ Proof. iNamed "Hown". iMod (readonly_load with "Hsnap_sl") as (?) "Hsnap_sl2". wp_storeField. - wp_apply (wp_NewMap string). + wp_apply (wp_NewMap byte_string). iClear "Hvnums_map". iIntros (?) "Hvnums_map". wp_storeField. @@ -993,10 +984,10 @@ Proof. iDestruct (struct_fields_split with "Hs") as "Hs". iNamed "Hs". wp_pures. - wp_apply (wp_NewMap string). + wp_apply (wp_NewMap byte_string). iIntros (?) "Hmap". wp_storeField. - wp_apply (wp_NewMap string). + wp_apply (wp_NewMap byte_string). iIntros (?) "Hvnums_map". wp_storeField. wp_apply (wp_KVState__apply). diff --git a/src/program_proof/vrsm/paxos/start_proof.v b/src/program_proof/vrsm/paxos/start_proof.v index af542a2e2..6f9a9c148 100644 --- a/src/program_proof/vrsm/paxos/start_proof.v +++ b/src/program_proof/vrsm/paxos/start_proof.v @@ -15,7 +15,7 @@ Context `{!paxosG Σ}. Context `{Hparams:!paxosParams.t Σ}. Import paxosParams. -Lemma wp_makeServer γ γsrv (fname:string) data conf_sl (hosts:list u64) init_sl : +Lemma wp_makeServer γ γsrv fname data conf_sl (hosts:list u64) init_sl : {{{ "Hfile" ∷ crash_borrow (own_file_inv γ γsrv data ∗ fname f↦ data) (∃ d : list u8, own_file_inv γ γsrv d ∗ fname f↦d) ∗ @@ -180,7 +180,7 @@ Proof. } Qed. -Lemma wp_StartServer γ γsrv (me:u64) (fname:string) data init_sl conf_sl (hosts:list u64) : +Lemma wp_StartServer γ γsrv (me:u64) fname data init_sl conf_sl (hosts:list u64) : {{{ "Hfile" ∷ crash_borrow (own_file_inv γ γsrv data ∗ fname f↦ data) (∃ d : list u8, own_file_inv γ γsrv d ∗ fname f↦d) ∗ diff --git a/src/program_proof/vrsm/storage/proof.v b/src/program_proof/vrsm/storage/proof.v index 2bae58d95..3be26c9ac 100644 --- a/src/program_proof/vrsm/storage/proof.v +++ b/src/program_proof/vrsm/storage/proof.v @@ -258,7 +258,7 @@ Definition file_inv γ P epoch (contents:list u8) : iProp Σ := . Definition own_StateMachine (s:loc) (epoch:u64) (ops:list OpType) (sealed:bool) P : iProp Σ := - ∃ (fname:string) (aof_ptr:loc) γ γaof (logsize:u64) (smMem_ptr:loc) data + ∃ (fname:byte_string) (aof_ptr:loc) γ γaof (logsize:u64) (smMem_ptr:loc) data own_InMemoryStateMachine (allstates:list (list OpType * bool)), "Hfname" ∷ s ↦[StateMachine :: "fname"] #(LitString fname) ∗ "HlogFile" ∷ s ↦[StateMachine :: "logFile"] #aof_ptr ∗ diff --git a/src/program_proof/wp_auto/experiments.v b/src/program_proof/wp_auto/experiments.v index 9b07d7198..861edc942 100644 --- a/src/program_proof/wp_auto/experiments.v +++ b/src/program_proof/wp_auto/experiments.v @@ -23,7 +23,7 @@ Lemma rename_iprop m n {P:iProp Σ} : . Proof. reflexivity. Qed. -Instance named_proper {A:Type} : Proper ((λ (_ _:string), True) ==> (@eq A) ==> (eq)) named. +Instance named_proper {A:Type} : Proper ((λ (_ _:byte_string), True) ==> (@eq A) ==> (eq)) named. Proof. solve_proper. Qed. Lemma wp_lookupLocked (t : loc) (m : gmap u64 u64) (k : u64) Htracker :