一键导入
contextual-equivalence
A skill for proving contextual equivalence between programs using operational semantics, bisimulation, and related techniques.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
A skill for proving contextual equivalence between programs using operational semantics, bisimulation, and related techniques.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Implement abstract machines for defining and executing operational semantics of programming languages.
Implements alias and points-to analysis for pointer programs. Use for: (1) Optimizing compilers, (2) Verifying memory safety, (3) Program understanding, (4) Parallelization.
Define program meaning through logical assertions and proof rules (Hoare logic).
Transforms closures to explicit environments. Use when: (1) Implementing functional languages, (2) Building compilers, (3) Understanding closures.
Implements common subexpression elimination (CSE). Use when: (1) Building compilers, (2) Optimizing code, (3) Program analysis.
Implements general dataflow analysis framework. Use when: (1) Building compilers, (2) Static analysis tools, (3) Program verification.
| name | contextual-equivalence |
| description | A skill for proving contextual equivalence between programs using operational semantics, bisimulation, and related techniques. |
| version | 1.0.0 |
| tags | ["verification","equivalence","bisimulation","operational-semantics"] |
| difficulty | advanced |
| languages | ["ocaml","coq"] |
| dependencies | ["operational-semantics-definer","bisimulation-checker"] |
Domain: Program Verification / Programming Languages
A skill for proving contextual equivalence between programs using operational semantics, bisimulation, and related techniques.
| Reference | Why It Matters |
|---|---|
| Morris, "Lambda Calculus Types and Models" (1968) | Original contextual equivalence formulation |
| Milner, "Operational and Algebraic Semantics" (1997) | Comprehensive overview of contextual equivalence |
| Gunter, "Semantic Foundations for Programming Languages" | Formal treatment of program equivalence |
| Reynolds, "Theories of Programming Languages" | Contextual equivalence in type theory |
See also: ../simply-typed-lambda-calculus, ../bisimulation-checker, ../operational-semantics-definer
Real-world contextual equivalence verification:
| Tool | Why It Matters |
|---|---|
| Coq | Interactive proof of contextual equivalence |
| Twelf | Logical framework for LF |
| Agda | Dependent types for equivalence proofs |
| Nuprl | Constructive verification system |
| HOL | Higher-order logic proofs |
Current contextual equivalence research:
| Direction | Key Papers | Challenge |
|---|---|---|
| Untyped equivalence | "Equivalence in untyped λ-calculus" | Full abstraction |
| Relational | "Relational Reasoning" (2008) | Semantic relations |
| Step-indexed | "Step-indexed Bisimulation" (2005) | Recursive types |
| Logical relations | "Logical Relations" (1998) | Semantics |
| Game semantics | "Game Semantics" (1997) | Full abstraction |
Common equivalence proof bugs:
| Pitfall | Real Example | Prevention |
|---|---|---|
| Incomplete contexts | Missing context forms | Prove completeness |
| Bisimulation too strong | Fails for equivalent programs | Use weak bisimulation |
| Recursive types | Fixed-point handling | Use step-indexing |
| Non-termination | Divergence not handled | Use contextual equivalence |
| State | State in language | Relational reasoning |