Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

paperproof-validator

БесплатноБез исполняемых скриптовНе проверен

Formal Proof Visualization and Verification for Lean 4

plurigridот plurigrid★ 73 звезды на GitHub

Об этом скилле

paperproof-validator

Formal Proof Visualization and Verification for Lean 4

Version: 1.0.0 Trit: -1 (Validator - verifies proof correctness) Bundle: verification Status: ✅ New (Lean 4 theorem proof visualization) Repository: Paper-Proof/paperproof


Overview

Paperproof Validator transforms formal Lean 4 proofs into intuitive, paper-like visualizations. It bridges the gap between abstract formal proofs and human understanding by displaying how hypotheses and goals evolve throughout a proof.

Key Innovation: Makes formal proofs accessible by visualizing proof structure in a way that mirrors mathematical notation on paper.

What Paperproof Does

Instead of abstract Lean code:

theorem example : P → Q := by
  intro h
  apply some_lemma
  exact h.right

Paperproof shows:

┌─────────────────────────────────────┐
│ Hypotheses (green nodes):           │
│  - h : P                            │
├─────────────────────────────────────┤
│ Goal (red node):                    │
│  - Q                                │
├─────────────────────────────────────┤
│ Tactics (transparent):              │
│  - apply some_lemma                 │
│  - exact h.right                    │
└─────────────────────────────────────┘

Architecture

Three Core Components

1. Lean 4 Library Integration

import Paperproof

theorem my_theorem : P ∧ Q → R := by
  -- Paperproof automatically extracts proof state
  intro ⟨hp, hq⟩
  -- Visualization tracks hypotheses and goals
  exact some_proof_term

Capabilities:

  • Integrates with Lean 4 InfoTree
  • Extracts proof state at each tactic
  • Provides proof metadata to VS Code extension

2. VS Code Extension

Responsibilities:

  • Tracks cursor position (detects which theorem is being visualized)
  • Communicates with Lean server for proof data
  • Hosts webview panel for visualization
  • Provides commands and settings
  • Bridges Lean InfoTree to React frontend

Commands:

Paperproof: Open Paperproof Panel
Paperproof: Show Current Theorem
Paperproof: Export Proof as Image
Paperproof: Settings

Architecture Flow:

User Cursor on Theorem
           ↓
Selection Changed Event
           ↓
Request Proof Data from Lean Server
           ↓
Lean Server Returns InfoTree
           ↓
BetterParser (extract structure)
           ↓
Converter Service (optimize for visualization)
           ↓
Send to React Frontend
           ↓
Render Visual Proof Tree

3. React Frontend Visualization

Component Hierarchy:

ProofTree (root)
├── GlobalContext Provider
├── Header (title, controls)
└── BoxEl (variable scope container)
    ├── Hypotheses Section
    │   └── HypothesisNode (green)
    │       └── Transparency = "in scope"
    ├── Tactics Section
    │   └── TacticNode (transparent, dashed border)
    │       └── Arrows to related nodes
    └── Goals Section
        └── GoalNode (red)

Visual Cues:

  • Hypotheses: Green nodes at the top
  • Goals: Red nodes at the bottom
  • Tactics: Transparent nodes with dashed borders
  • Scope: Nested boxes with darkening backgrounds
  • Availability: Node opacity indicates scope accessibility

Capabilities

1. visualize-proof-structure

Display proof as hierarchical tree with visual nodes:

from paperproof_validator import PaperproofVisualizer

visualizer = PaperproofVisualizer(
    lean_file="example.lean",
    theorem_name="my_theorem"
)

# Extract and render proof
proof_visual = visualizer.visualize(
    show_hypotheses=True,
    show_goals=True,
    show_tactics=True,
    show_scopes=True
)

# Output: Interactive HTML/React visualization

2. extract-proof-metadata

Pull structured proof information from Lean InfoTree:

-- Lean 4 code
theorem and_comm (p q : Prop) : p ∧ q → q ∧ p := by
  intro ⟨hp, hq⟩      -- Step 1: intro creates hypotheses
  exact ⟨hq, hp⟩      -- Step 2: exact provides proof term

Extracted Structure:

{
  "theorem": "and_comm",
  "steps": [
    {
      "tactic": "intro",
      "hypotheses": [
        {"name": "hp", "type": "p"},
        {"name": "hq", "type": "q"}
      ],
      "goals": [{"type": "q ∧ p"}]
    },
    {
      "tactic": "exact",
      "hypotheses": [
        {"name": "hp", "type": "p"},
        {"name": "hq", "type": "q"}
      ],
      "goals": []
    }
  ]
}

3. validate-proof-correctness

Verify that proof reaches expected conclusion:

validation = visualizer.validate_proof(
    expected_conclusion="Q"
)

if validation.passes:
    print("✓ Proof correctly establishes Q")
else:
    print(f"✗ Proof does not establish Q")
    print(f"  Final goal: {validation.final_goal}")

4. analyze-tactic-effects

Show how each tactic transforms proof state:

analysis = visualizer.analyze_tactics()

for step in analysis.steps:
    print(f"\nTactic: {step.na
Полный SKILL.md на GitHub

Установить paperproof-validator в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл paperproof-validator?

Formal Proof Visualization and Verification for Lean 4

Как установить скилл paperproof-validator?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл paperproof-validator запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить paperproof-validator с