## Flowchart: Formal Proof Process with Lean 4 and Verification
### Overview
The image depicts a multi-stage workflow for formalizing and verifying mathematical theorems using Lean 4, a theorem prover. The process involves translating informal natural language statements into formal proofs, compiling them, handling errors, and verifying correctness through a process-supervised system. Key components include an **Informalizer**, **Autoformalizer**, **Lean 4 Compiler**, and **Process-Supervised Verifier**, with annotations and feedback loops.
---
### Components/Axes
#### Key Elements:
1. **Informal / Natural Language**
- **Question**: "The theorem states that when converting the minimum of two non-negative real numbers (notated as `R≥0`) to a real number (notated as `R`), it is the same as taking the minimum of those two numbers after each has been individually converted to a real number."
- **Answer**: "The proof uses a property of the function `NNReal.coe_mono`, specifically its ability to `map_min`, which ensures that the operation of finding the minimum between two numbers is preserved under the function that converts non-negative real numbers to real numbers."
2. **Lean 4**
- **Theorem Env**:
```lean
lemma coe_mono : Monotone ((→) R≥0 → R) :=
fun __ => NNReal.coe_le.coe_2
```
- **Statement**:
```lean
theorem coe_min :
((min (a : R≥0) b : R) : R) = min (a : R) (b : R)
```
- **Proof**: `NNReal.coe_mono.map_min`
3. **Mathlib4 Pool**
- **Statement**:
```lean
theorem coe_min (x y : R≥0) :
((min x y : R≥0) : R) = min (x : R) (y : R)
```
- **Proof**: `NNReal.coe_mono.map_min`
4. **Compiled Feedback**
- **Error Details**:
- `severity`: 'error'
- `pos`: { 'line': 613, 'column': 3 }
- `endPos`: { 'line': 613, 'column': 26 }
- `data`: Type mismatch between `Monotone.map_min coe_mono` and `min ?m.78355 ?m.78356` vs. expected `min (→a) b : Prop`.
5. **Compiler-Guided Process Annotation**
- **Question**: "The theorem states that when converting the minimum of two ..."
- **Answer**: "The proof uses a property of the function `NNReal.coe_mono`, specifically ..."
- **Statement**:
```lean
theorem coe_min :
((min (a : R≥0) b : R) : R) = min (a : R) (b : R)
```
- **Proof**: `NNReal.coe_mono.map_min`
6. **Verified Lean 4**
- **Theorem Env**:
```lean
lemma coe_mono : Monotone ((→) R≥0 → R) :=
fun __ => NNReal.coe_le.coe_2
```
- **Statement**:
```lean
theorem coe_min (x y : R≥0) :
((min x y : R≥0) : R) = min (x : R) (y : R)
```
- **Proof**: `NNReal.coe_mono.map_min`
7. **Process-Supervised Verifier**
- Combines elements from the Lean 4 Compiler and Verifier, with a feedback loop.
---
### Detailed Analysis
#### Textual Content:
- **Informal / Natural Language**:
- Focuses on the equivalence of converting minima between `R≥0` and `R`.
- Highlights the role of `NNReal.coe_mono` in preserving minima under conversion.
- **Lean 4**:
- Defines a monotonicity lemma (`coe_mono`) and a theorem (`coe_min`) about minima.
- Proof relies on `map_min` from `NNReal.coe_mono`.
- **Mathlib4 Pool**:
- Repeats the `coe_min` theorem with a similar proof structure.
- **Compiled Feedback**:
- Identifies a type mismatch in the Lean 4 code, specifically in the `map_min` function.
- Error details include line/column positions and expected vs. actual types.
- **Compiler-Guided Process Annotation**:
- Mirrors the Lean 4 theorem and proof but adds annotations for verification.
- **Verified Lean 4**:
- Replicates the Lean 4 theorem and proof, emphasizing verification.
- **Process-Supervised Verifier**:
- Integrates compiler and verifier outputs, with a feedback mechanism.
---
### Key Observations
1. **Repetition of Proofs**:
- The `coe_min` theorem and its proof (`NNReal.coe_mono.map_min`) appear in both Lean 4 and Mathlib4 Pool, suggesting cross-library consistency.
2. **Error Handling**:
- The `Compiled Feedback` section explicitly details a type mismatch, indicating a critical step in debugging the Lean 4 code.
3. **Flow of Information**:
- The diagram shows a linear progression from informal statements to formal proofs, with feedback loops for error correction.
4. **Verification Integration**:
- The `Process-Supervised Verifier` acts as a bridge between compilation and formal verification, ensuring correctness.
---
### Interpretation
This flowchart illustrates a systematic approach to formalizing mathematical theorems in Lean 4. The process begins with translating natural language into formal statements, followed by compilation and error detection. The `Process-Supervised Verifier` ensures that proofs are both syntactically and semantically correct, leveraging properties like `map_min` to preserve logical operations. The error details in the `Compiled Feedback` highlight the importance of type checking in Lean 4, while the repeated use of `NNReal.coe_mono.map_min` underscores its role in maintaining mathematical consistency. The diagram emphasizes the interplay between human-readable statements and machine-checked proofs, a cornerstone of formal verification systems.