بنقرة واحدة
axiomatic-semantics
Define program meaning through logical assertions and proof rules (Hoare logic).
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Define program meaning through logical assertions and proof rules (Hoare logic).
التثبيت باستخدام 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.
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.
Builds denotational semantic models. Use when: (1) Formalizing language semantics, (2) Proving program properties, (3) Semantic analysis.
| name | axiomatic-semantics |
| description | Define program meaning through logical assertions and proof rules (Hoare logic). |
| version | 1.0.0 |
| tags | ["semantics","verification","popl","theory"] |
| difficulty | intermediate |
| languages | ["coq","why3","python"] |
| dependencies | ["hoare-logic-verifier","separation-logician"] |
Axiomatic semantics defines program meaning through logical assertions about program states. Hoare logic, the primary framework, uses triples {P} C {Q} meaning "if P holds before C, then Q holds after C terminates."
| Concept | Description |
|---|---|
| Hoare Triple | {P} C {Q} - precondition, command, postcondition |
| Weakest Precondition | Largest set of states guaranteeing Q after C |
| Loop Invariant | Property holding before, during, and after loop |
| Partial Correctness | If terminates, postcondition holds |
| Total Correctness | Terminates and postcondition holds |
hoare-logic-verifier - Verification toolseparation-logician - Memory reasoningsmt-solver-interface - Automated provingoperational-semantics-definer - Operational view| Reference | Why It Matters |
|---|---|
| Hoare, "An Axiomatic Basis for Computer Programming" (CACM 1969) | Original Hoare logic (Turing Award) |
| Dijkstra, "A Discipline of Programming" (1976) | Weakest preconditions |
| Winskel, "The Formal Semantics of Programming Languages" (1993) | Comprehensive treatment |
| Approach | Pros | Cons |
|---|---|---|
| Hoare Logic | Compositional, intuitive | Need loop invariants |
| Weakest Precondition | Automatic derivation | Complex expressions |
| Strongest Postcondition | Forward reasoning | Less compositional |
A high-quality implementation should have:
| Criterion | What to Look For |
|---|---|
| Soundness | Proven triples are actually valid |
| Completeness | Valid triples can be proven |
| Automation | Uses SMT solver for implications |
| Expressiveness | Handles loops, procedures |
✅ Good: Sound proof rules, handles loops, SMT integration ⚠️ Warning: Manual invariant annotation required ❌ Bad: Unsound rules, no loop support
Real-world axiomatic semantics tools to study:
| Tool | Why It Matters |
|---|---|
| Verifast | Verified C programs with separation logic |
| Frama-C (WP) | Industrial-strength C verification |
| Why3 | Platform for deductive verification |
| OpenJML | Java bytecode verification with JML |
| Viper | Verification framework with permission reasoning |
| ACSL (Frama-C) | ANSI/ISO C Specification Language |
Current active research in axiomatic semantics:
| Direction | Key Papers | Challenge |
|---|---|---|
| Automation | "From Hoare Logic to Separation Logic" (2018) | Auto-generating loop invariants |
| Fractional permissions | "Fractional Permissions" (2010) | Concurrent read/write sharing |
| Concurrent separation logic | O'Hearn, Brookes "Resources, Concurrency and Local Reasoning" (2004/2007) | Verifying lock-free algorithms |
| Iris | "Higher-Order Ghost State" (2015) | Complex concurrency patterns |
| Relational verification | Benton "Simple Relational Correctness Proofs" (2004) | Proving equivalence of programs |
Common bugs in verification tools:
| Pitfall | Real Example | Prevention |
|---|---|---|
| Missing frame rule | Frama-C early versions | Explicit frame conditions |
| Unsound loop invariant | ESC/Java missing measures | Check variant/measure |
| Weak memory | Verifiers assuming sequential | Model weak memory explicitly |
| Arithmetic overflow | ACL2 unsoundness case | Bounded arithmetic support |
| Aliasing bugs | Missing permission checks | Always track permissions |
| Incomplete theories | Missing bitvector support | Cover all language features |
Early separation logic verifiers forgot the frame rule:
// @requires P
// @ensures P * Q
void foo() {
// Could lose Q if not framed!
}
Solution: Every rule now includes explicit frame conditions.
The core tension: more automation → less expressiveness: