{"id":22574470,"url":"https://github.com/brucezoom/reentry","last_synced_at":"2025-07-11T16:35:36.780Z","repository":{"id":71881846,"uuid":"196357154","full_name":"BruceZoom/Reentry","owner":"BruceZoom","description":null,"archived":false,"fork":false,"pushed_at":"2020-09-23T02:07:00.000Z","size":186,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-28T15:25:35.101Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Coq","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BruceZoom.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-07-11T08:54:28.000Z","updated_at":"2020-09-23T09:30:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"9ef96813-b464-4b6a-a3e2-94138b22acfb","html_url":"https://github.com/BruceZoom/Reentry","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/BruceZoom/Reentry","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BruceZoom%2FReentry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BruceZoom%2FReentry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BruceZoom%2FReentry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BruceZoom%2FReentry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BruceZoom","download_url":"https://codeload.github.com/BruceZoom/Reentry/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BruceZoom%2FReentry/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264851740,"owners_count":23673293,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-08T03:06:22.527Z","updated_at":"2025-07-11T16:35:36.741Z","avatar_url":"https://github.com/BruceZoom.png","language":"Coq","funding_links":[],"categories":[],"sub_categories":[],"readme":"# __Coq Formalization for \"Reentrancy? Yes. Reentrancy bug? No.\"__\n## __Files__\nWe provide following files organized in directories as our formalizations.\n```\nReentryCode\n│   Makefile\n│   README.md\n│   _CoqProject\n│\n├───WithCall\n│       CoarseGrainedLogic.v\n│       DenotationalSemantics.v\n│       DerivationTheorem.v\n│       FineGrainedSemantics.v\n│\n└───WithoutCall\n        DenotationalSemantics.v\n        DerivationTheorem.v\n        FineGrainedSemantics.v\n```\n\nWe only provide the WithCall version of `CoarseGrainedLogic.v`, because the coarse-grained logic requires properties of regular function invocations to be complete.\n\n## __Makefile__\nWe provide a Makefile to compile two versions of our formalizations: with function call, and without function call.\n- WithCall: Run `make WithCall` (or simply `make`) will compile `.v` files in `WithCall` folder into `.vo` files.\n- WithoutCall: Run `make WithoutCall` will compile `.v` files in `WithCall` folder into `.vo` files.\n\n_Running any of the above command will remove all existing compiled files in the current directory to avoid name conflicts._\nFor the same reason, we do not allow `make all`.\n\n_You may need to set up your own CONFIGURE file to the bin directory of Coq to compile files._\n\n## __Catalogue__\n### __WithCall__\n#### The toy language and its denotational semantics\n- Syntax Tree of the Toy Language\n  - line 14 to line 47 in `WithCall/DenotationalSemantics.v`\n- Program State Model and Function Model\n  - line 51 to line 114 in `WithCall/DenotationalSemantics.v`\n- __Definition of Denotational Semantics__ ( the $\\Downarrow$ in the paper ) ( `ceval` )\n  - line 139 to line 178 in `WithCall/DenotationalSemantics.v`\n\n#### The fine-grained semantics\n- __Definition of Label__\n  - line 18 to line 24 in `WithCall/FineGrainedSemantics.v`\n- Definition of Stacked State for Regular Function Calls\n  - line 164 to line 168 in `WithCall/FineGrainedSemantics.v`\n- __Definition of Fine-Grained Semantics__ ( the $\\downarrow$ in the paper ) ( `ceval'` )\n  - line 170 to line 339 in `WithCall/FineGrainedSemantics.v`\n\n#### The relationship between two semantics\n- __Definition of Reentry Stack__ ( the $\\Sigma$ in the paper ) ( `restk` )\n  - line 689 in `WithCall/FineGrainedSemantics.v`\n- __Definition of Single-Step Reentry Semantics__ ( the $\\downdownarrows_1$ in the paper ) ( `middle_ceval'` )\n  - line 691 to line 717 in `WithCall/FineGrainedSemantics.v`\n- __Definition of Multi-Step Reentry Semantics__  ( the $\\downdownarrows_*$ in the paper ) ( `multi_ceval'` )\n  - line 719 in `WithCall/FineGrainedSemantics.v`\n- Congruence Lemmas for Reentry Semantics\n  - line 790 to line 1690 in `WithCall/FineGrainedSemantics.v`\n  - Congruence Lemma for Seq1 ( the example lemma 5.1 in the paper )\n    - line 1032 to line 1161\n- __Equivalence between Semantics__ ( theorem 5.2 `ceval_multi_ceval'` and theorem 5.3 `arbitrary_eval_multi_ceval'` in the paper )\n  - line 1694 to line 2190 in `WithCall/FineGrainedSemantics.v`\n\n#### The judgment in coarse-grained logic\n- Assertion Language\n  - line 17 to line 73 in `WithCall/DerivationTheorem.v`\n  - Special Assertion for Stacked States\n    - line 60 to line 70\n- Validity of Coarse-Grained Judgment\n  - line 80 to line 84 in `WithCall/DerivationTheorem.v`\n- Validity of Coarse-Grained Specification\n  - line 86 to line 90 in `WithCall/DerivationTheorem.v`\n\n#### The judgment in fine-grained logic\n- __Definition of Index__ ( `index_set` )\n  - line 194 to line 198 in `WithCall/DerivationTheorem.v` \n- __Definition of Parameter Type__ ( the $\\Lambda$ in the paper ) ( `param_type` )\n  - line 200 to line 201 in `WithCall/DerivationTheorem.v`\n- __Validity of Fine-Grained Specification__\n  - line 208 to line 236 in `WithCall/DerivationTheorem.v`\n\n#### The derivation theorem between judgments in two logics\n- __Definition of Contract Invariant Type__ ( the type for $\\mathcal{I}$ and $\\mathcal{R}$ in the paper ) ( `invariants` )\n  - line 203 to line 204 in `WithCall/DerivationTheorem.v`\n- __Definition of Parameter Transition Relation__ ( `index_relation` )\n  - line 206 to line 207 in `WithCall/DerivationTheorem.v`\n- __Definition of Generalized Precondition__ ( the $\\mathcal{P}(\\Sigma, P, Q, \\mathcal{I}, \\mathcal{R})$ in the paper ) ( `stk_loc_R` and `stk_to_pre` )\n  - line 678 to line 729 in `WithCall/DerivationTheorem.v`\n- __Lemma 5.5__ ( `reentry_invariant_precondition` )\n  - line 1320 to line 1582 in `WithCall/DerivationTheorem.v`\n  - Main lemmas used in the proof:\n    - `multi_ceval'_ctop` from line 733 to line 790 in `WithCall/DerivationTheorem.v`\n    - `reentry_bottom_level` from line 794 to line 968 in `WithCall/DerivationTheorem.v`\n    - `reentry_higher_level` from line 971 to line 1316 in `WithCall/DerivationTheorem.v`\n- __The Derivation Theorem__ ( the theorem 5.4 in the paper ) ( `derivation_theorem` )\n  - line 1586 to line 1638 in `WithCall/DerivationTheorem.v`\n\n#### The coarse-grained logic (proof system, soundness and completeness)\n- Function Assumption ( the $\\Delta$ in the paper ) ( `func_assumption` )\n  - line 387 in `WithCall/CoarseGrainedLogic.v`\n- Hoare Triple\n  - line 393 to line 396 in `WithCall/CoarseGrainedLogic.v`\n- The Proof System ( the $\\vdash$ in the paper ) ( `provable` )\n  - line 398 to line 432 in `WithCall/CoarseGrainedLogic.v`\n- Triple Valid ( the $\\vDash$ in the paper ) ( `valid` )\n  - line 434 to line 442 in `WithCall/CoarseGrainedLogic.v`\n- Validity from Assumptions ( the $\\VDash$ in the paper ) ( `weak_valid` )\n  - line 444 to line 453 in `WithCall/CoarseGrainedLogic.v`\n- __Lemma 3.2__ ( `weak_soundness` )\n  - line 626 to line 640 in `WithCall/CoarseGrainedLogic.v`\n  - Proofs for different branches\n    - line 460 to line 624 in `WithCall/CoarseGrainedLogic.v`\n    - The one for the reentry rule\n      - line 460 to 483\n- __Lemma 3.3__ ( `sigma_fp_valid` )\n  - line 667 to line 682 in `WithCall/CoarseGrainedLogic.v`\n- __Soundness__ ( theorem 3.1 in the paper ) ( `hoare_sound` )\n  - line 685 to line 701 in `WithCall/CoarseGrainedLogic.v`\n- __Completeness__ ( theorem 6.1 in the paper ) ( `hoare_complete` )\n  - line 1052 to line 1071 in `WithCall/CoarseGrainedLogic.v`\n  - The `hoare_triple_complete` from line 1033 to line 1050 is used here\n  - Proofs for different branches\n    - line 766 to line 1031 in `WithCall/CoarseGrainedLogic.v`\n    - __The one for the reentry__ ( lemma 6.2 in the paper ) ( `hoare_reentry_complete` )\n      - line 766 to line 835 in `WithCall/CoarseGrainedLogic.v`\n\n### __WithoutCall__\n#### The toy language and its denotational semantics\n- Syntax Tree of the Toy Language\n  - line 12 to line 33 in `WithoutCall/DenotationalSemantics.v`\n- Program State Model and Function Model\n  - line 37 to line 99 in `WithoutCall/DenotationalSemantics.v`\n- __Definition of Denotational Semantics__ ( the $\\Downarrow$ in the paper ) ( `ceval` )\n  - line 103 to line 138 in `WithoutCall/DenotationalSemantics.v`\n\n#### The fine-grained semantics\n- __Definition of Label__\n  - line 18 to line 24 in `WithoutCall/FineGrainedSemantics.v`\n- __Definition of Fine-Grained Semantics__ ( the $\\downarrow$ in the paper ) ( `ceval'` )\n  - line 124 to line 212 in `WithoutCall/FineGrainedSemantics.v`\n\n#### The relationship between two semantics\n- __Definition of Reentry Stack__ ( the $\\Sigma$ in the paper ) ( `restk` )\n  - line 285 in `WithoutCall/FineGrainedSemantics.v`\n- __Definition of Single-Step Reentry Semantics__ ( the $\\downdownarrows_1$ in the paper ) ( `middle_ceval'` )\n  - line 287 to line 305 in `WithoutCall/FineGrainedSemantics.v`\n- __Definition of Multi-Step Reentry Semantics__  ( the $\\downdownarrows_*$ in the paper ) ( `multi_ceval'` )\n  - line 307 in `WithoutCall/FineGrainedSemantics.v`\n- Congruence Lemmas for Reentry Semantics\n  - line 373 to line 1473 in `WithoutCall/FineGrainedSemantics.v`\n  - Congruence Lemma for Seq1 ( the example lemma 5.1 in the paper )\n    - line 698 to line 792\n- __Equivalence between Semantics__ ( theorem 5.2 `ceval_multi_ceval'` and theorem 5.3 `arbitrary_eval_multi_ceval'` in the paper )\n  - line 1477 to line 1696 in `WithoutCall/FineGrainedSemantics.v`\n\n#### The judgment in coarse-grained logic\n- Assertion Language\n  - line 17 to line 55 in `WithoutCall/DerivationTheorem.v`\n- Validity of Coarse-Grained Judgment\n  - line 62 to line 66 in `WithoutCall/DerivationTheorem.v`\n- Validity of Coarse-Grained Specification\n  - line 68 to line 72 in `WithoutCall/DerivationTheorem.v`\n\n#### The judgment in fine-grained logic\n- __Definition of Index__ ( `index_set` )\n  - line 120 to line 124 in `WithoutCall/DerivationTheorem.v` \n- __Definition of Parameter Type__ ( the $\\Lambda$ in the paper ) ( `param_type` )\n  - line 126 to line 127 in `WithoutCall/DerivationTheorem.v`\n- __Validity of Fine-Grained Specification__\n  - line 134 to line 162 in `WithoutCall/DerivationTheorem.v`\n\n#### The derivation theorem between judgments in two logics\n- __Definition of Contract Invariant Type__ ( the type for $\\mathcal{I}$ and $\\mathcal{R}$ in the paper ) ( `invariants` )\n  - line 129 to line 130 in `WithoutCall/DerivationTheorem.v`\n- __Definition of Parameter Transition Relation__ ( `index_relation` )\n  - line 132 `WithoutCall/DerivationTheorem.v`\n- __Definition of Generalized Precondition__ ( the $\\mathcal{P}(\\Sigma, P, Q, \\mathcal{I}, \\mathcal{R})$ in the paper ) ( `stk_loc_R` and `stk_to_pre` )\n  - line 294 to line 343 in `WithoutCall/DerivationTheorem.v`\n- __Lemma 5.5__ ( `reentry_invariant_precondition` )\n  - line 703 to line 838 in `WithoutCall/DerivationTheorem.v`\n  - Main lemmas used in the proof:\n    - `multi_ceval'_ctop` from line 347 to line 404 in `WithoutCall/DerivationTheorem.v`\n    - `reentry_bottom_level` from line 408 to line 506 in `WithoutCall/DerivationTheorem.v`\n    - `reentry_higher_level` from line 510 to line 699 in `WithoutCall/DerivationTheorem.v`\n- __The Derivation Theorem__ ( the theorem 5.4 in the paper ) ( `derivation_theorem` )\n  - line 841 to line 886 in `WithoutCall/DerivationTheorem.v`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrucezoom%2Freentry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrucezoom%2Freentry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrucezoom%2Freentry/lists"}