This repository was archived by the owner on May 4, 2024. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
thanks #1089
base: Clay-Mysten-patch-1
Are you sure you want to change the base?
Uh oh!
There was an error while loading. Please reload this page.
thanks #1089
Changes from 1 commit
820258145706c648ff05f245c2bf3f862abbc57bf24a5ccd2a7791420b984f5a940c21d0825b383fdb43164bf33bdf2998dbccd8cd1d585c8b41ec16371f35c540a0e2b09e8186aedb34bdf8d341d7e14e1e647bf982b26f57c130f3cba16e0dafc5ab7e548d7956515743520d187ce3e1d5b8051d4aa10d8dff126704b71bfb1e75d71e0615bd307be9543596d7dd60fe2e6c566ace597c41c3f02feb222f016d73d547a54d27fcd544088db9b8cb949fd89e35c5fb15ba01440c029bc20427f1b258a09888cfa3cef7fa536aa5c0248b37dc8c25005678c0743c82aae78e568bddbe690151e510e921d27e51717c8552e92d1d29c4c85ac9b85f4e26dbd608e5aa4ad0b65a8ae770c0c6ce97ee9b0aedc9b5765f25b57d683dad6a94c21c1d9e6a61e585f7dfc3440faa534288a37973ef3f1f280c89d77fd7491ffd0a3181e96fb2ca65ba0e8ea31795871a22d4da6a9f1f73277f8936ac170be52c7195916b1bf10d9071a04a0922cecb31743388cc98cb9eedce5e2e1a411eba4657d38d127225a818553d6eadd615bd3037b6a51572872bd71e3ac0cd7d05cfdd5597044b21f565b06525ad21c656041592ec79b1f4760937339f7784c055a380800fc7d4b5fa27b227793ca36f3c3b79f9fc97f00eaeeb79672224260281e9f77ea38d80b5be488868d95e21b8926c4a15bb2ac5e8b27c529e64a514f9419bc236bd1e7601ce01d88a22ce661c40f9954922506a204d67226d7a361416fdace4af5c42a482f04e0024dc0d2e2195c733d475b73694792702fef14d6f7b981d19fc2ef24ba59c5c487921f5d68cc30a82193ae8117efe451bff811df349e41ac9efd2c570796ddf2a6d4626a3aff9d06f190e265e879fcb75d84fd4510f20e04d70c811f781c84478a9e2ba8e95cba23798292404f35c26ce8fc6589a9c7fe06430691d990db0b4c622fda7c334583db9ea7742d4de7e42d98656a590736cbc469a6beb4406fd3b20af52663ff285504a6a04b8901b018357e060fd867b0bc8004e485518d315101dd220a9e0261b3aa7843f383f97650349014100c9cb3ab9f3e7e47fca2d18f3b078ddfb7c3b7543be4fa6bc94c681efbf339ca783f72640781bcd1234e98c6b49834a19c3528240171bc4974a7436fc1871bbbd5caf134b74547bb6360151500dfef14a57136838f5303abe821c5ee120009cf5a04460f2a97188f31ea70797da1fc170ea33f1File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
This is the first commit on improving the type reflection modeling in Move Prover (we expect another commit to complete the overhaul). In this commit, the type info for a type parameter is modeled as a Boogie Datatype: ``` var #0_info: $TypeParamInfo; // where $TypeParamInfo is defined as: type {:datatype} $TypeParamInfo; function {:constructor} $TypeParamBool(): $TypeParamInfo; function {:constructor} $TypeParamU8(): $TypeParamInfo; function {:constructor} $TypeParamU16(): $TypeParamInfo; function {:constructor} $TypeParamU32(): $TypeParamInfo; function {:constructor} $TypeParamU64(): $TypeParamInfo; function {:constructor} $TypeParamU128(): $TypeParamInfo; function {:constructor} $TypeParamU256(): $TypeParamInfo; function {:constructor} $TypeParamAddress(): $TypeParamInfo; function {:constructor} $TypeParamSigner(): $TypeParamInfo; function {:constructor} $TypeParamVector(e: $TypeParamInfo): $TypeParamInfo; function {:constructor} $TypeParamStruct(a: int, m: Vec int, s: Vec int): $TypeParamInfo; ``` This is a more elegant and more expressive encoding than the previous approach where the type info is modeled by a series of variables: ``` var #0_name: Vec int; var #0_is_struct: bool; var #0_account_address: int; var #0_module_name: Vec int; var #0_struct_name: Vec int; ``` The second improvement of this commit is the axiomitization of the relation between a type and its name. This is achieved by defining type name as an uninterpreted function and using `axiom` to define its semantics: ``` function $TypeName(t: $TypeParamInfo): Vec int; axiom is#$TypeParamBool(t) <==> $TypeName(t) == "bool"; axiom is#$TypeParamU8(t) <==> $TypeName(t) == "u8"; axiom is#$TypeParamU16(t) <==> $TypeName(t) == "u16"; axiom is#$TypeParamU32(t) <==> $TypeName(t) == "u32"; axiom is#$TypeParamU64(t) <==> $TypeName(t) == "u64"; axiom is#$TypeParamU128(t) <==> $TypeName(t) == "u128"; axiom is#$TypeParamU256(t) <==> $TypeName(t) == "u256"; axiom is#$TypeParamAddress(t) <==> $TypeName(t) == "address"; axiom is#$TypeParamSigner(t) <==> $TypeName(t) == "signer"; // NOTE: for vector, the axiomization does not parse the vector element name axiom is#$TypeParamVector(t) ==> $TypeName(t) == "vector<" ++ $TypeName(e#t) ++ ">"; axiom $TypeName(t).starts_with("vector<") && $TypeName(t).ends_with(">") ==> is#$TypeParamVector(t); // NOTE: for struct, the axiomization does not parse the module and struct name axiom is#$TypeParamStruct(t) ==> $TypeName(t) == "0x" ++ a#t ++ "::" ++ m#t ++ "::" ++ s#t; axiom $TypeName(t).starts_with("0x") ==> is#$TypeParamStruct(t); ``` This allows for partial specification of aborts conditions where `type_info<T>` call is involved (it aborts when `T` is not a struct). But this is only partial. The full specification is the work of the next PR, which is to introduced a `spec fun spec_is_struct<T>(): bool` primitive to capture this semantics.Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing