Skip to content

Commit

Permalink
Reorder Token fields in Isabelle semantics
Browse files Browse the repository at this point in the history
  • Loading branch information
palas committed Oct 25, 2021
1 parent e3f00e0 commit 2e56b6c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions isabelle/SemanticsSerialisation.thy
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ lemma byteStringToParty_inverseRoundtrip : "byteStringToParty x = Some (a, b) \<
done

fun tokenToByteString :: "Token \<Rightarrow> ByteString" where
"tokenToByteString (Token tn cs) = (packByteString tn) @ (packByteString cs)"
"tokenToByteString (Token cs tn) = (packByteString cs) @ (packByteString tn)"

fun byteStringToToken :: "ByteString \<Rightarrow> (Token \<times> ByteString) option" where
"byteStringToToken x =
(case getByteString x of
None \<Rightarrow> None
| Some (tn, t1) \<Rightarrow> (case getByteString t1 of
| Some (cs, t1) \<Rightarrow> (case getByteString t1 of
None \<Rightarrow> None
| Some (cs, t2) \<Rightarrow> Some (Token tn cs, t2)))"
| Some (tn, t2) \<Rightarrow> Some (Token cs tn, t2)))"

lemma tokenToByteStringToToken : "byteStringToToken ((tokenToByteString x) @ y) = Some (x, y)"
apply (cases x)
Expand Down Expand Up @@ -120,4 +120,4 @@ lemma byteStringToValueId_inverseRoundtrip : "byteStringToValueId x = Some (a, b
apply (auto simp only:valueIdToByteString.simps byteStringToValueId.simps split:option.splits prod.splits)
using addAndGetByteString_inverseRoundtrip by blast

end
end

0 comments on commit 2e56b6c

Please sign in to comment.