{"title":"作为分配效应的类型宇宙","authors":"Paulette Koronkevich, William J. Bowman","doi":"arxiv-2407.06473","DOIUrl":null,"url":null,"abstract":"In this paper, we explore a connection between type universes and memory\nallocation. Type universe hierarchies are used in dependent type theories to\nensure consistency, by forbidding a type from quantifying over all types.\nInstead, the types of types (universes) form a hierarchy, and a type can only\nquantify over types in other universes (with some exceptions), restricting\ncyclic reasoning in proofs. We present a perspective where universes also\ndescribe \\emph{where} values are allocated in the heap, and the choice of\nuniverse algebra imposes a structure on the heap overall. The resulting type\nsystem provides a simple declarative system for reasoning about and restricting\nmemory allocation, without reasoning about reads or writes. We present a\ntheoretical framework for equipping a type system with higher-order references\nrestricted by a universe hierarchy, and conjecture that many existing universe\nalgebras give rise to interesting systems for reasoning about allocation. We\npresent 3 instantiations of this approach to enable reasoning about allocation\nin the simply typed $\\lambda$-calculus: (1) the standard ramified universe\nhierarchy, which we prove guarantees termination of the language extended with\nhigher-order references by restricting cycles in the heap; (2) an extension\nwith an \\emph{impredicative} base universe, which we conjecture enables\nfull-ground references (with terminating computation but cyclic ground data\nstructures); (3) an extension with \\emph{universe polymorphism}, which divides\nthe heap into fine-grained regions.","PeriodicalId":501197,"journal":{"name":"arXiv - CS - Programming Languages","volume":null,"pages":null},"PeriodicalIF":0.0000,"publicationDate":"2024-07-09","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":"{\"title\":\"Type Universes as Allocation Effects\",\"authors\":\"Paulette Koronkevich, William J. Bowman\",\"doi\":\"arxiv-2407.06473\",\"DOIUrl\":null,\"url\":null,\"abstract\":\"In this paper, we explore a connection between type universes and memory\\nallocation. Type universe hierarchies are used in dependent type theories to\\nensure consistency, by forbidding a type from quantifying over all types.\\nInstead, the types of types (universes) form a hierarchy, and a type can only\\nquantify over types in other universes (with some exceptions), restricting\\ncyclic reasoning in proofs. We present a perspective where universes also\\ndescribe \\\\emph{where} values are allocated in the heap, and the choice of\\nuniverse algebra imposes a structure on the heap overall. The resulting type\\nsystem provides a simple declarative system for reasoning about and restricting\\nmemory allocation, without reasoning about reads or writes. We present a\\ntheoretical framework for equipping a type system with higher-order references\\nrestricted by a universe hierarchy, and conjecture that many existing universe\\nalgebras give rise to interesting systems for reasoning about allocation. We\\npresent 3 instantiations of this approach to enable reasoning about allocation\\nin the simply typed $\\\\lambda$-calculus: (1) the standard ramified universe\\nhierarchy, which we prove guarantees termination of the language extended with\\nhigher-order references by restricting cycles in the heap; (2) an extension\\nwith an \\\\emph{impredicative} base universe, which we conjecture enables\\nfull-ground references (with terminating computation but cyclic ground data\\nstructures); (3) an extension with \\\\emph{universe polymorphism}, which divides\\nthe heap into fine-grained regions.\",\"PeriodicalId\":501197,\"journal\":{\"name\":\"arXiv - CS - Programming Languages\",\"volume\":null,\"pages\":null},\"PeriodicalIF\":0.0000,\"publicationDate\":\"2024-07-09\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"0\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"arXiv - CS - Programming Languages\",\"FirstCategoryId\":\"1085\",\"ListUrlMain\":\"https://doi.org/arxiv-2407.06473\",\"RegionNum\":0,\"RegionCategory\":null,\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"\",\"JCRName\":\"\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"arXiv - CS - Programming Languages","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/arxiv-2407.06473","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
In this paper, we explore a connection between type universes and memory
allocation. Type universe hierarchies are used in dependent type theories to
ensure consistency, by forbidding a type from quantifying over all types.
Instead, the types of types (universes) form a hierarchy, and a type can only
quantify over types in other universes (with some exceptions), restricting
cyclic reasoning in proofs. We present a perspective where universes also
describe \emph{where} values are allocated in the heap, and the choice of
universe algebra imposes a structure on the heap overall. The resulting type
system provides a simple declarative system for reasoning about and restricting
memory allocation, without reasoning about reads or writes. We present a
theoretical framework for equipping a type system with higher-order references
restricted by a universe hierarchy, and conjecture that many existing universe
algebras give rise to interesting systems for reasoning about allocation. We
present 3 instantiations of this approach to enable reasoning about allocation
in the simply typed $\lambda$-calculus: (1) the standard ramified universe
hierarchy, which we prove guarantees termination of the language extended with
higher-order references by restricting cycles in the heap; (2) an extension
with an \emph{impredicative} base universe, which we conjecture enables
full-ground references (with terminating computation but cyclic ground data
structures); (3) an extension with \emph{universe polymorphism}, which divides
the heap into fine-grained regions.