[Documentation] Create comprehensive proof debugging handbook#94
Merged
[Documentation] Create comprehensive proof debugging handbook#94
Conversation
Closes #70 ### Summary Created detailed proof debugging handbook at docs-site/content/guides/debugging-proofs.mdx to help developers overcome common proof failures and errors. ### What's Included **10 major sections** covering practical debugging: 1. **Quick Reference** - Fast lookup table for common issues 2. **Diagnostic Tools** - #check, #print, trace, #eval 3. **Common Tactic Failures** - simp, omega, synthesize instance, motive errors 4. **Type Errors** - Type mismatch debugging and fixes 5. **Arithmetic & Overflow Proofs** - SafeAdd/SafeSub patterns 6. **Storage State Reasoning** - Function extensionality, runState composition 7. **Proof Pattern Library** - Authorization, induction, case analysis, options 8. **Tactic Ordering** - unfold → simp → omega best practices 9. **Common Error Messages** - Table of errors with causes and fixes 10. **Proof Performance** - Caching, splitting, optimization **Plus**: - Debugging workflows for unknown errors, stuck goals, type mismatches - Real examples from DumbContracts codebase - Getting help guidelines with minimal example template - Advanced debugging techniques (tracing, logging) - Quick decision tree for common issues ### Key Features **Practical Focus**: - ✅ Real code examples from DumbContracts - ✅ Before/after comparisons (❌ bad vs ✅ good) - ✅ Copy-paste ready solutions - ✅ Diagnostic commands explained **Comprehensive Coverage**: - ✅ 15+ common error patterns - ✅ 20+ proof patterns - ✅ 30+ code examples - ✅ Import, type, and proof error tables **Developer-Friendly**: - ✅ Quick reference at top for fast lookup - ✅ Decision tree for systematic debugging - ✅ Links to related resources - ✅ Encouraging tone ("You've got this!") ### Structure ``` debugging-proofs.mdx (800+ lines) ├── Quick Reference (lookup table) ├── Diagnostic Tools │ ├── Type inspection (#check, #print) │ ├── Goal inspection (trace) │ └── Evaluation (#eval, #reduce) ├── Common Tactic Failures │ ├── "simp made no progress" │ ├── "omega failed" │ ├── "failed to synthesize instance" │ └── "motive is not type correct" ├── Type Errors │ ├── Type mismatch debugging │ ├── Expected vs actual │ └── Rewriting to match types ├── Arithmetic & Overflow Proofs │ ├── SafeAdd/SafeSub patterns │ ├── Proving no overflow │ └── Bounded arithmetic ├── Storage State Reasoning │ ├── Function extensionality │ ├── Storage unchanged except │ └── runState composition ├── Proof Pattern Library │ ├── Authorization checks │ ├── Nat induction │ ├── List induction │ ├── Case analysis │ └── Option handling ├── Tactic Ordering (unfold → simp → omega) ├── Common Error Messages (3 tables) ├── Proof Performance │ ├── Caching intermediate results │ ├── Splitting into smaller lemmas │ └── Using rfl instead of simp ├── Debugging Workflows (3 workflows) ├── Real Examples (3 from codebase) ├── Getting Help (when and how) ├── Advanced Debugging │ ├── Proof term inspection │ ├── Tactic tracing │ └── Goal state logging └── Summary (quick decision tree) ``` ### Example Content Quality **Common Tactic Failure: "simp made no progress"** ```lean -- ❌ DOESN'T WORK theorem getValue_correct : ... := by simp [getStorage] -- Error: simp made no progress -- ✅ WORKS theorem getValue_correct : ... := by unfold getValue -- First unfold the definition simp [getStorage] -- Now simp can make progress ``` **Real Example: Counter increment** ```lean theorem increment_correct (state : ContractState) : let finalState := increment.runState state finalState.storage countSlot = add (state.storage countSlot) 1 := by unfold increment Contract.runState simp [getStorage, setStorage, countSlot, add] ``` ### Impact **Before this PR**: - ❌ No guide for common proof failures - ❌ Developers get stuck with cryptic errors - ❌ Slows contribution velocity - ❌ Pattern knowledge is tribal (not documented) - ❌ Frustration leads to abandonment **After this PR**: - ✅ Comprehensive debugging guide (800+ lines) - ✅ 15+ common errors with solutions - ✅ Quick lookup table for fast help - ✅ Real examples from codebase - ✅ Reduces abandonment rate - ✅ Enables self-service problem solving **For Developers**: - Fast solutions to common problems - Learn by example with before/after - Systematic debugging workflows - Know when to ask for help **For Project**: - Reduced "help needed" issues - Faster contribution velocity - Lower barrier to entry - Better developer experience ### Success Metrics (from issue #70) - ✅ Covers 15+ common error patterns (20+ included) - ✅ Comprehensive diagnostic tools section - ✅ Real examples from DumbContracts codebase - ✅ Clear workflows and decision trees - ✅ Getting help guidelines ### Files Changed - `docs-site/content/guides/debugging-proofs.mdx`: New 800+ line guide - `docs-site/content/guides/_meta.js`: Added navigation entry ### Related Work Complements recent documentation improvements: - #90: First contract tutorial (onboarding) - #89: Trust assumptions (architecture) - #91: Code comment conventions (style) - #66: First contract tutorial (prerequisite) Together, these provide comprehensive documentation for DumbContracts development. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Resolves #70
Created comprehensive proof debugging handbook to help developers overcome common proof failures, errors, and roadblocks.
What's New
New file:
docs-site/content/guides/debugging-proofs.mdx(800+ lines)A complete debugging reference covering:
Structure
1. Quick Reference
Fast lookup table for immediate solutions:
2. Diagnostic Tools
3. Common Tactic Failures
"simp made no progress":
"omega failed":
4. Type Errors
Type mismatch debugging with #check:
5. Arithmetic & Overflow Proofs
SafeAdd pattern library:
6. Storage State Reasoning
Function extensionality pattern:
7. Proof Pattern Library
Each with copy-paste ready examples.
8. Tactic Ordering
General rule: unfold → simp → omega
9. Common Error Messages
Three comprehensive tables:
10. Proof Performance
Optimization patterns:
Real Examples from Codebase
Example 1: SimpleStorage getValue
Example 2: Counter increment
Example 3: Ledger sum preservation
Debugging Workflows
Workflow 1: Unknown Error
Workflow 2: Stuck on Goal
Workflow 3: Type Mismatch
Getting Help
Try first:
Then ask:
Includes minimal example template for help requests.
Advanced Debugging
Decision Tree
Quick systematic debugging:
Impact
Before:
After:
For Developers:
Success Metrics (from issue #70):
Related Work
Complements documentation improvements:
Together: Complete DumbContracts documentation suite.
Test Plan
Related Issues
🤖 Generated with Claude Code
Note
Low Risk
Documentation-only changes that don’t affect runtime behavior or build logic; main risk is broken links/rendering in the docs site.
Overview
Adds a new documentation guide,
debugging-proofs.mdx, providing a copy-paste oriented handbook for diagnosing and fixing common Lean/DumbContracts proof failures (tactic issues, type/instance errors, arithmetic/overflow proofs, storage reasoning, performance tips, and debugging workflows).Updates the guides navigation metadata (
_meta.js) to include the new Proof Debugging Handbook entry.Written by Cursor Bugbot for commit 8fc1ad6. This will update automatically on new commits. Configure here.