Statement
This explanation was written alongside the formalization to describe the statement and its reasoning.
Lemma · Left-loop budget transition
Lean statement
Trellis authored these statements and proofs. Lean checks the formal proofs; the assumptions used by each proof are listed below.
import Tablet.Preamble
set_option autoImplicit false
namespace dec2flt_model
-- [TABLET NODE: P857_T1_LeftLoopBudgetTransition]
theorem P857_T1_LeftLoopBudgetTransition (j : Nat) (p q : Int) (z z' : Nat)
(hpLo : -324 ≤ p) (hpHi : p ≤ 0)
(hb1 : p ≤ -19 → 18 * (j : Int) - p ≤ 324)
(hb2 : -18 ≤ p → p ≤ -2 → j ≤ 17)
(hb3 : p = -1 → z < 7 → j ≤ 18)
(hb4 : p = -1 → 7 ≤ z → j ≤ 19)
(hb5 : p = 0 → z ≤ 2 → j ≤ 19)
(hb6 : p = 0 → 3 ≤ z → z < 5 → j ≤ 20)
(hb7 : p = 0 → 5 ≤ z → j ≤ 21)
(hlarge : p ≤ -19 → q = p + 18 ∨ q = p + 19)
(hsmall : -18 ≤ p → p < 0 → q = -1 ∨ q = 0)
(hminus : p = -1 → q = -1 → 7 ≤ z')
(hminusLarge : p = -1 → 7 ≤ z → q = 0 ∧ 5 ≤ z')
(hzero : p = 0 → z < 5 ∧ q = 0 ∧
(z ≤ 2 → 3 ≤ z') ∧ (3 ≤ z → 5 ≤ z')) :
((p ≤ -19 ∧ j ≤ 16) ∨
(-18 ≤ p ∧ p ≤ -2 ∧ j ≤ 17) ∨
(p = -1 ∧ z < 7 ∧ j ≤ 18) ∨
(p = -1 ∧ 7 ≤ z ∧ j ≤ 19) ∨
(p = 0 ∧ z ≤ 2 ∧ j ≤ 19) ∨
(p = 0 ∧ 3 ≤ z ∧ z < 5 ∧ j ≤ 20) ∨
(p = 0 ∧ 5 ≤ z ∧ j ≤ 21)) ∧
((q ≤ -19 → 18 * ((j + 1 : Nat) : Int) - q ≤ 324) ∧
(-18 ≤ q → q ≤ -2 → j + 1 ≤ 17) ∧
(q = -1 → z' < 7 → j + 1 ≤ 18) ∧
(q = -1 → 7 ≤ z' → j + 1 ≤ 19) ∧
(q = 0 → z' ≤ 2 → j + 1 ≤ 19) ∧
(q = 0 → 3 ≤ z' → z' < 5 → j + 1 ≤ 20) ∧
(q = 0 → 5 ≤ z' → j + 1 ≤ 21)) := by
Proof
Natural-language proof
The status above describes the Lean proof. Its explanatory prose may remain a sketch after that proof closes.
Explanatory prose status
Prose retained as authored. The explanatory prose is preserved as it stood when captured.
Proof
Lean proof
have hsource :
(p ≤ -19 ∧ j ≤ 16) ∨
(-18 ≤ p ∧ p ≤ -2 ∧ j ≤ 17) ∨
(p = -1 ∧ z < 7 ∧ j ≤ 18) ∨
(p = -1 ∧ 7 ≤ z ∧ j ≤ 19) ∨
(p = 0 ∧ z ≤ 2 ∧ j ≤ 19) ∨
(p = 0 ∧ 3 ≤ z ∧ z < 5 ∧ j ≤ 20) ∨
(p = 0 ∧ 5 ≤ z ∧ j ≤ 21) := by
by_cases hp : p ≤ -19
· have h := hb1 hp
exact Or.inl ⟨hp, by omega⟩
· by_cases hpm : p ≤ -2
· exact Or.inr (Or.inl ⟨by omega, hpm, hb2 (by omega) hpm⟩)
· by_cases hm : p = -1
· by_cases hz : z < 7
· exact Or.inr (Or.inr (Or.inl ⟨hm, hz, hb3 hm hz⟩))
· exact Or.inr (Or.inr (Or.inr (Or.inl
⟨hm, by omega, hb4 hm (by omega)⟩)))
· have hp0 : p = 0 := by omega
by_cases hz2 : z ≤ 2
· exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inl
⟨hp0, hz2, hb5 hp0 hz2⟩))))
· by_cases hz5 : 5 ≤ z
· right; right; right; right; right; right
exact ⟨hp0, hz5, hb7 hp0 hz5⟩
· exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inl
⟨hp0, by omega, by omega, hb6 hp0 (by omega) (by omega)⟩)))))
refine ⟨hsource, ?_⟩
rcases hsource with ⟨hp, hj⟩ | ⟨hplo, hphi, hj⟩ |
⟨hp, hz, hj⟩ | ⟨hp, hz, hj⟩ | ⟨hp, hz, hj⟩ |
⟨hp, hzlo, hzhi, hj⟩ | ⟨hp, hz, hj⟩
· have hnext := hlarge hp
have hbudget := hb1 hp
refine ⟨?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ <;> intros <;> omega
· have hnext := hsmall hplo (by omega)
refine ⟨?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ <;> intros <;> omega
· have hnext := hsmall (by omega) (by omega)
have hhead := hminus hp
refine ⟨?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ <;> intros <;> omega
· obtain ⟨hq, hz'⟩ := hminusLarge hp hz
refine ⟨?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ <;> intros <;> omega
· obtain ⟨_, hq, hsmallHead, _⟩ := hzero hp
have hz' := hsmallHead hz
refine ⟨?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ <;> intros <;> omega
· obtain ⟨_, hq, _, hlargeHead⟩ := hzero hp
have hz' := hlargeHead hzlo
refine ⟨?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ <;> intros <;> omega
· have hnext := hzero hp
omega
end dec2flt_model
Download Lean source · Download TeX source
Complete Lean module
import Tablet.Preamble
set_option autoImplicit false
namespace dec2flt_model
-- [TABLET NODE: P857_T1_LeftLoopBudgetTransition]
theorem P857_T1_LeftLoopBudgetTransition (j : Nat) (p q : Int) (z z' : Nat)
(hpLo : -324 ≤ p) (hpHi : p ≤ 0)
(hb1 : p ≤ -19 → 18 * (j : Int) - p ≤ 324)
(hb2 : -18 ≤ p → p ≤ -2 → j ≤ 17)
(hb3 : p = -1 → z < 7 → j ≤ 18)
(hb4 : p = -1 → 7 ≤ z → j ≤ 19)
(hb5 : p = 0 → z ≤ 2 → j ≤ 19)
(hb6 : p = 0 → 3 ≤ z → z < 5 → j ≤ 20)
(hb7 : p = 0 → 5 ≤ z → j ≤ 21)
(hlarge : p ≤ -19 → q = p + 18 ∨ q = p + 19)
(hsmall : -18 ≤ p → p < 0 → q = -1 ∨ q = 0)
(hminus : p = -1 → q = -1 → 7 ≤ z')
(hminusLarge : p = -1 → 7 ≤ z → q = 0 ∧ 5 ≤ z')
(hzero : p = 0 → z < 5 ∧ q = 0 ∧
(z ≤ 2 → 3 ≤ z') ∧ (3 ≤ z → 5 ≤ z')) :
((p ≤ -19 ∧ j ≤ 16) ∨
(-18 ≤ p ∧ p ≤ -2 ∧ j ≤ 17) ∨
(p = -1 ∧ z < 7 ∧ j ≤ 18) ∨
(p = -1 ∧ 7 ≤ z ∧ j ≤ 19) ∨
(p = 0 ∧ z ≤ 2 ∧ j ≤ 19) ∨
(p = 0 ∧ 3 ≤ z ∧ z < 5 ∧ j ≤ 20) ∨
(p = 0 ∧ 5 ≤ z ∧ j ≤ 21)) ∧
((q ≤ -19 → 18 * ((j + 1 : Nat) : Int) - q ≤ 324) ∧
(-18 ≤ q → q ≤ -2 → j + 1 ≤ 17) ∧
(q = -1 → z' < 7 → j + 1 ≤ 18) ∧
(q = -1 → 7 ≤ z' → j + 1 ≤ 19) ∧
(q = 0 → z' ≤ 2 → j + 1 ≤ 19) ∧
(q = 0 → 3 ≤ z' → z' < 5 → j + 1 ≤ 20) ∧
(q = 0 → 5 ≤ z' → j + 1 ≤ 21)) := by
-- BODY
have hsource :
(p ≤ -19 ∧ j ≤ 16) ∨
(-18 ≤ p ∧ p ≤ -2 ∧ j ≤ 17) ∨
(p = -1 ∧ z < 7 ∧ j ≤ 18) ∨
(p = -1 ∧ 7 ≤ z ∧ j ≤ 19) ∨
(p = 0 ∧ z ≤ 2 ∧ j ≤ 19) ∨
(p = 0 ∧ 3 ≤ z ∧ z < 5 ∧ j ≤ 20) ∨
(p = 0 ∧ 5 ≤ z ∧ j ≤ 21) := by
by_cases hp : p ≤ -19
· have h := hb1 hp
exact Or.inl ⟨hp, by omega⟩
· by_cases hpm : p ≤ -2
· exact Or.inr (Or.inl ⟨by omega, hpm, hb2 (by omega) hpm⟩)
· by_cases hm : p = -1
· by_cases hz : z < 7
· exact Or.inr (Or.inr (Or.inl ⟨hm, hz, hb3 hm hz⟩))
· exact Or.inr (Or.inr (Or.inr (Or.inl
⟨hm, by omega, hb4 hm (by omega)⟩)))
· have hp0 : p = 0 := by omega
by_cases hz2 : z ≤ 2
· exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inl
⟨hp0, hz2, hb5 hp0 hz2⟩))))
· by_cases hz5 : 5 ≤ z
· right; right; right; right; right; right
exact ⟨hp0, hz5, hb7 hp0 hz5⟩
· exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inr (Or.inl
⟨hp0, by omega, by omega, hb6 hp0 (by omega) (by omega)⟩)))))
refine ⟨hsource, ?_⟩
rcases hsource with ⟨hp, hj⟩ | ⟨hplo, hphi, hj⟩ |
⟨hp, hz, hj⟩ | ⟨hp, hz, hj⟩ | ⟨hp, hz, hj⟩ |
⟨hp, hzlo, hzhi, hj⟩ | ⟨hp, hz, hj⟩
· have hnext := hlarge hp
have hbudget := hb1 hp
refine ⟨?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ <;> intros <;> omega
· have hnext := hsmall hplo (by omega)
refine ⟨?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ <;> intros <;> omega
· have hnext := hsmall (by omega) (by omega)
have hhead := hminus hp
refine ⟨?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ <;> intros <;> omega
· obtain ⟨hq, hz'⟩ := hminusLarge hp hz
refine ⟨?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ <;> intros <;> omega
· obtain ⟨_, hq, hsmallHead, _⟩ := hzero hp
have hz' := hsmallHead hz
refine ⟨?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ <;> intros <;> omega
· obtain ⟨_, hq, _, hlargeHead⟩ := hzero hp
have hz' := hlargeHead hzlo
refine ⟨?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ <;> intros <;> omega
· have hnext := hzero hp
omega
end dec2flt_model
Proof structure
Follow the declared dependencies to read the supporting statements and proofs.
Uses
Inspect related source (44)
- from_u64 · dec2flt/mod.rs:263 Program Rust
- FloatErrorKind · num/mod.rs:18 Program Rust
- ParseFloatError · num/mod.rs:13 Program Rust
More program dependencies (11)
- Dec2FltAssemblyTrace · dec2flt/mod.rs:329 Program Rust
- Dec2FltTrace · dec2flt/mod.rs:295 Program Rust
- Lemire · dec2flt/mod.rs:115 Program Rust
- BiasedFp · dec2flt/common.rs:56 Program Rust
- ByteSlice · dec2flt/common.rs:4 Program Rust
- Decimal · dec2flt/decimal.rs:32 Program Rust
- DecimalSeq · dec2flt/decimal_seq.rs:22 Program Rust
- CastInto · traits.rs:18 Program Rust
- Float · traits.rs:74 Program Rust
- FloatExt · traits.rs:170 Program Rust
- Int · traits.rs:27 Program Rust
Standard-library dependencies (30)
- clone · core/src/clone.rs:698 Rust library
- div · core/src/ops/arith.rs:515 Rust library
- mul · core/src/ops/arith.rs:350 Rust library
- neg · core/src/ops/arith.rs:719 Rust library
- bitand · core/src/ops/bit.rs:178 Rust library
- bitor · core/src/ops/bit.rs:282 Rust library
- shl · core/src/ops/bit.rs:489 Rust library
- shr · core/src/ops/bit.rs:612 Rust library
- EXPONENT_MASK · core/src/num/f64.rs:615 Rust library
- INFINITY · core/src/num/f64.rs:512 Rust library
- MANTISSA_DIGITS · core/src/num/f64.rs:412 Rust library
- MANTISSA_MASK · core/src/num/f64.rs:637 Rust library
- NAN · core/src/num/f64.rs:509 Rust library
- NEG_INFINITY · core/src/num/f64.rs:515 Rust library
- classify · core/src/num/f64.rs:782 Rust library
- from_bits · core/src/num/f64.rs:1269 Rust library
- to_bits · core/src/num/f64.rs:1223 Rust library
- is_ascii_digit · core/src/num/mod.rs:958 Rust library
- from_residual · core/src/option.rs:2793 Rust library
- branch · core/src/option.rs:2779 Rust library
- first · core/src/slice/mod.rs:155 Rust library
- split_first · core/src/slice/mod.rs:198 Rust library
- as_bytes · core/src/str/mod.rs:498 Rust library
- FpCategory · core/src/num/mod.rs:1522 Rust library
- Div · core/src/ops/arith.rs:460 Rust library
- Mul · core/src/ops/arith.rs:322 Rust library
- Neg · core/src/ops/arith.rs:690 Rust library
- BitOr · core/src/ops/bit.rs:254 Rust library
- Shl · core/src/ops/bit.rs:461 Rust library
- Shr · core/src/ops/bit.rs:584 Rust library
Related source and models come from the extraction records and declared dependencies.
Proof assumptions and review
Lean checks the formal proof. Trellis also reviews how the statement corresponds to the intended requirement.
Transitive assumptions
- Classical.choice
- Quot.sound
- propext
This list combines the assumptions recorded for this declaration and its dependencies. It may include assumptions used by auxiliary declarations in those modules.
Helper theorems included
Technical checking records
Local closure summary
{
"node": "P857_T1_LeftLoopBudgetTransition",
"closure_version": "patch_c_v1",
"active_decl_hash": "fc1a426c218af024dce7b7a1b7374bb99d14f8d10f03c518b16491a6ad7bf8cd",
"active_statement_hash": "0290e40e805b232ab23d06d78620a8fe3866640c7900afd3f666ae4d965103fd",
"kernel_axioms": [
"Classical.choice",
"Quot.sound",
"propext"
],
"toolchain_hash": "ce4c4e3d87434b9663f46de25ce34b48a0cf0d392e0a320a0787b4674a2d7b61",
"lean_executable_hash": "3e0d0d3d801675359f2d4cf9815bfdb417b20b92fdd9d48b3b14c95bbae28bbf",
"checker_script_hash": "c8e4a03273e23b9a8f2e141020652a4e0b7b0a8ab0883366ea9d031ca3f37aa1",
"approved_axioms_hash": "576e6bf9480cfd32f53c309c7ac8fb115c1ba6e413f299ed5ff9fa7c647e6769",
"axcheck_status": "Agreed",
"accepted_at_snapshot_id": "worker-result-local-closure-issuance-cycle-198",
"boundary_theorems": {},
"strict_theorem_deps": {},
"strict_definition_deps": {}
}Prose assessment
{
"label": "Lean proof closed; predictive prose review no longer required",
"assessment_status": null,
"fingerprint_relation": "unknown",
"assessment_fingerprint": null,
"current_fingerprint": "sound-v2:c12a1e40480365a84a006c3b3867ca95b347883a129f4c8066e38a49fd66f502",
"superseded_for_theorem_closure": false
}Review verdicts
{
"corr_status": "Pass"
}