Statement
This explanation was written alongside the formalization to describe the statement and its reasoning.
Lemma · Actual realization at each reached prefix call
Lean statement
Trellis authored these statements and proofs. Lean checks the formal proofs; the assumptions used by each proof are listed below.
import Tablet.DispatchContracts
import Tablet.P9_T1_NormalComponentRefinement
import Tablet.P9_T1_ReachedDispatchCall
import Tablet.P13_T1_NumberHelperRejection
import Tablet.P14_NativeTotality
import Tablet.P661_T1_IntegerExecution
import Tablet.P661_T1_SlowExecution
open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false
namespace dec2flt_model
-- [TABLET NODE: P661_T1_PrefixRealization]
theorem P661_T1_PrefixRealization (C : P9_T1_AbstractComponents)
(hcontracts : DispatchContracts C)
(hrefine : P9_T1_NormalComponentRefinement C)
(s : Str) (hsource : DecimalGoalVocabularyDefault.sourceString s)
(hA : s.val.length <= 3458764513820540928) :
forall call : P9_T1_DispatchCall, P9_T1_ReachedDispatchCall s call ->
match call with
| .number body _ =>
SourceValidByteSlice body /\ body.val ≠ [] /\ body.val.length <= s.val.length /\
P9_T1_ActualDispatchOperations.parseNumber body = ok (C.parseNumber body)
| .special body neg =>
SourceValidByteSlice body /\ body.val ≠ [] /\ body.val.length <= s.val.length /\
P9_T1_ActualDispatchOperations.parseSpecial body neg = ok (C.parseSpecial body neg)
| .native body neg d =>
SourceValidByteSlice body /\ body.val ≠ [] /\ body.val.length <= s.val.length /\
d.negative = false /\ d.mantissa.val < 10 ^ 19 /\
P9_T1_ActualDispatchOperations.native { d with negative := neg } =
ok (C.native { d with negative := neg })
| .first body _ d =>
SourceValidByteSlice body /\ body.val ≠ [] /\ body.val.length <= s.val.length /\
d.mantissa.val < 10 ^ 19 /\
P9_T1_ActualDispatchOperations.integer d.exponent d.mantissa =
ok (C.integer d.exponent d.mantissa)
| .increment _ _ d _ =>
d.mantissa.val < 10 ^ 19 /\ exists next : Std.U64,
d.mantissa + 1#u64 = ok next /\ next.val = d.mantissa.val + 1
| .second _ _ d _ next =>
next.val = d.mantissa.val + 1 /\
P9_T1_ActualDispatchOperations.integer d.exponent next =
ok (C.integer d.exponent next)
| .compare _ _ _ first second =>
num.imp.dec2flt.common.BiasedFp.Insts.CoreCmpPartialEqBiasedFp.eq first second =
ok (decide (first.m = second.m /\ first.p_biased = second.p_biased))
| .post body _ d _ =>
SourceValidByteSlice body /\ body.val ≠ [] /\ body.val.length <= s.val.length /\
d.negative = false /\ d.mantissa.val < 10 ^ 19
| .slow body _ _ _ =>
SourceValidByteSlice body /\ body.val ≠ [] /\ body.val.length <= s.val.length /\
(exists x : DecimalLexeme, x.leadingSign = none /\
DecimalGoalVocabularyDefault.validNumeric x /\
DecimalGoalVocabularyDefault.renderNumeric x = DecimalGoalVocabularyDefault.bytes body) /\
P9_T1_ActualDispatchOperations.slow body = ok (C.slow body)
| .assemble _ _ _ selected =>
P9_T1_ActualDispatchOperations.assemble selected = ok (C.assemble selected)
| .negate _ _ _ magnitude =>
magnitude.val < 2 ^ 63 /\
P9_T1_ActualDispatchOperations.negate magnitude = ok (C.negate magnitude) := 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
intro call hreach
let Goal : P9_T1_DispatchCall → Prop := fun call =>
match call with
| .number body _ =>
SourceValidByteSlice body ∧ body.val ≠ [] ∧ body.val.length ≤ s.val.length ∧
P9_T1_ActualDispatchOperations.parseNumber body = ok (C.parseNumber body)
| .special body neg =>
SourceValidByteSlice body ∧ body.val ≠ [] ∧ body.val.length ≤ s.val.length ∧
P9_T1_ActualDispatchOperations.parseSpecial body neg = ok (C.parseSpecial body neg)
| .native body neg d =>
SourceValidByteSlice body ∧ body.val ≠ [] ∧ body.val.length ≤ s.val.length ∧
d.negative = false ∧ d.mantissa.val < 10 ^ 19 ∧
P9_T1_ActualDispatchOperations.native { d with negative := neg } = ok (C.native { d with negative := neg })
| .first body _ d =>
SourceValidByteSlice body ∧ body.val ≠ [] ∧ body.val.length ≤ s.val.length ∧
d.mantissa.val < 10 ^ 19 ∧
P9_T1_ActualDispatchOperations.integer d.exponent d.mantissa = ok (C.integer d.exponent d.mantissa)
| .increment _ _ d _ =>
d.mantissa.val < 10 ^ 19 ∧ ∃ next : Std.U64,
d.mantissa + 1#u64 = ok next ∧ next.val = d.mantissa.val + 1
| .second _ _ d _ next =>
next.val = d.mantissa.val + 1 ∧
P9_T1_ActualDispatchOperations.integer d.exponent next = ok (C.integer d.exponent next)
| .compare _ _ _ first second =>
num.imp.dec2flt.common.BiasedFp.Insts.CoreCmpPartialEqBiasedFp.eq first second =
ok (decide (first.m = second.m ∧ first.p_biased = second.p_biased))
| .post body _ d _ =>
SourceValidByteSlice body ∧ body.val ≠ [] ∧ body.val.length ≤ s.val.length ∧
d.negative = false ∧ d.mantissa.val < 10 ^ 19
| .slow body _ _ _ =>
SourceValidByteSlice body ∧ body.val ≠ [] ∧ body.val.length ≤ s.val.length ∧
(∃ x : DecimalLexeme, x.leadingSign = none ∧
DecimalGoalVocabularyDefault.validNumeric x ∧
DecimalGoalVocabularyDefault.renderNumeric x = DecimalGoalVocabularyDefault.bytes body) ∧
P9_T1_ActualDispatchOperations.slow body = ok (C.slow body)
| .assemble _ _ _ selected =>
P9_T1_ActualDispatchOperations.assemble selected = ok (C.assemble selected)
| .negate _ _ _ magnitude =>
magnitude.val < 2 ^ 63 ∧
P9_T1_ActualDispatchOperations.negate magnitude = ok (C.negate magnitude)
let B : Slice Std.U8 → Prop := fun b =>
SourceValidByteSlice b ∧ b.val ≠ [] ∧ b.val.length ≤ s.val.length ∧ b.val.length ≤ 3458764513820540928
let Lex : Slice Std.U8 → Prop := fun b =>
∃ x : DecimalLexeme, x.leadingSign = none ∧ DecimalGoalVocabularyDefault.validNumeric x ∧
DecimalGoalVocabularyDefault.renderNumeric x = DecimalGoalVocabularyDefault.bytes b
let D : Slice Std.U8 → num.imp.dec2flt.decimal.Decimal → Prop := fun b d =>
P9_T1_ActualDispatchOperations.parseNumber b = ok (some d) ∧
C.parseNumber b = some d ∧ d.negative = false ∧ d.mantissa.val < 10 ^ 19 ∧ Lex b
let Inv : P9_T1_DispatchCall → Prop := fun call =>
match call with
| .number b _ => B b
| .special b _ => B b
| .native b _ d => B b ∧ D b d
| .first b _ d => B b ∧ D b d
| .increment b _ d fp => B b ∧ D b d ∧
P9_T1_ActualDispatchOperations.integer d.exponent d.mantissa = ok fp ∧
fp = C.integer d.exponent d.mantissa ∧ d.many_digits = true ∧ 0 ≤ fp.p_biased.val
| .second b _ d fp next => B b ∧ D b d ∧
∃ f, P9_T1_ActualDispatchOperations.integer d.exponent d.mantissa = ok f ∧
f = C.integer d.exponent d.mantissa ∧ d.many_digits = true ∧ 0 ≤ f.p_biased.val ∧
d.mantissa + 1#u64 = ok next ∧ next.val = d.mantissa.val + 1 ∧ fp = f
| .compare b _ d fp second => B b ∧ D b d ∧
∃ f next, P9_T1_ActualDispatchOperations.integer d.exponent d.mantissa = ok f ∧
f = C.integer d.exponent d.mantissa ∧ d.many_digits = true ∧ 0 ≤ f.p_biased.val ∧
d.mantissa + 1#u64 = ok next ∧ next.val = d.mantissa.val + 1 ∧
P9_T1_ActualDispatchOperations.integer d.exponent next = ok second ∧
second = C.integer d.exponent next ∧ fp = f
| .post b _ d post => B b ∧ D b d ∧
∃ f, P9_T1_ActualDispatchOperations.integer d.exponent d.mantissa = ok f ∧
f = C.integer d.exponent d.mantissa ∧
(post = f ∨ post.p_biased.val = -1)
| .slow b _ d post => B b ∧ D b d ∧
∃ f, P9_T1_ActualDispatchOperations.integer d.exponent d.mantissa = ok f ∧
f = C.integer d.exponent d.mantissa ∧
(post = f ∨ post.p_biased.val = -1)
| .assemble b _ d selected => B b ∧ D b d ∧
((∃ f, P9_T1_ActualDispatchOperations.integer d.exponent d.mantissa = ok f ∧
f = C.integer d.exponent d.mantissa ∧ selected = f ∧ 0 ≤ f.p_biased.val ∧
(C.assemble f).val < 2 ^ 63) ∨
(∃ x : DecimalLexeme, x.leadingSign = none ∧ DecimalGoalVocabularyDefault.validNumeric x ∧
DecimalGoalVocabularyDefault.renderNumeric x = DecimalGoalVocabularyDefault.bytes b ∧
selected = C.slow b ∧ (C.assemble selected).val < 2 ^ 63))
| .negate b d selected magnitude => B b ∧ D b d ∧
(C.assemble selected).val < 2 ^ 63
have stronger : ∀ call, P9_T1_ReachedDispatchCall s call → Goal call ∧ Inv call := by
intro call hreach
induction hreach with
| number c tail body hs hb hne =>
have hlen : body.val.length ≤ s.val.length := by
rw [hb, hs]
by_cases hc : c = 45#u8 ∨ c = 43#u8 <;> simp [hc]
have hbvalid : SourceValidByteSlice body := by
rw [SourceValidByteSlice]
exact le_trans hlen hsource.1
have hB : B body := ⟨hbvalid, hne, hlen, le_trans hlen hA⟩
change (SourceValidByteSlice body ∧ body.val ≠ [] ∧ body.val.length ≤ s.val.length ∧
P9_T1_ActualDispatchOperations.parseNumber body = ok (C.parseNumber body)) ∧ B body
refine ⟨?_, hB⟩
exact ⟨hbvalid, hne, hlen, hrefine.number_bounded body hbvalid hne (le_trans hlen hA)⟩
| special body neg hprev h ih =>
rcases ih with ⟨_, hB⟩
rcases hB with ⟨hbvalid, hne, hlen, hA'⟩
have hs := hrefine.special_all body neg hbvalid
change (SourceValidByteSlice body ∧ body.val ≠ [] ∧ body.val.length ≤ s.val.length ∧
P9_T1_ActualDispatchOperations.parseSpecial body neg = ok (C.parseSpecial body neg)) ∧ B body
exact ⟨⟨hbvalid, hne, hlen, hs⟩, ⟨hbvalid, hne, hlen, hA'⟩⟩
| native body neg d hprev h ih =>
rcases ih with ⟨_, hB⟩
rcases hB with ⟨hbvalid, hne, hlen, hA'⟩
have hC : C.parseNumber body = some d := by
have hn := hrefine.number_normal body (some d) hbvalid hne h
exact hn.symm
have hbounds := hcontracts.record_bounds body d hbvalid hne hC
have hlex : Lex body := by
by_contra hnot
have hnone := P13_T1_NumberHelperRejection body hbvalid hne hA' hnot
rw [h] at hnone
cases hnone
obtain ⟨r, hr⟩ := P14_NativeTotality { d with negative := neg }
have hnormal := hrefine.native_normal { d with negative := neg } r hr
have hret : P9_T1_ActualDispatchOperations.native { d with negative := neg } =
ok (C.native { d with negative := neg }) := by
rw [hr, hnormal]
change (SourceValidByteSlice body ∧ body.val ≠ [] ∧ body.val.length ≤ s.val.length ∧
d.negative = false ∧ d.mantissa.val < 10 ^ 19 ∧
P9_T1_ActualDispatchOperations.native { d with negative := neg } =
ok (C.native { d with negative := neg })) ∧ (B body ∧ D body d)
exact ⟨⟨hbvalid, hne, hlen, hbounds.1, hbounds.2, hret⟩,
⟨⟨hbvalid, hne, hlen, hA'⟩, h, hC, hbounds.1, hbounds.2, hlex⟩⟩
| first body neg d hprev h ih =>
rcases ih with ⟨_, hInv⟩
rcases hInv with ⟨hB, hD⟩
have hBkeep := hB
have hDkeep := hD
obtain ⟨fp, hfp⟩ := P661_T1_IntegerExecution d.exponent d.mantissa
have hfpC : fp = C.integer d.exponent d.mantissa :=
hrefine.integer_normal d.exponent d.mantissa fp hfp
rcases hD with ⟨_, _, hnegative, hmantissa, hlex⟩
rcases hB with ⟨hbvalid, hne, hlen, hA'⟩
change (SourceValidByteSlice body ∧ body.val ≠ [] ∧ body.val.length ≤ s.val.length ∧
d.mantissa.val < 10 ^ 19 ∧
P9_T1_ActualDispatchOperations.integer d.exponent d.mantissa =
ok (C.integer d.exponent d.mantissa)) ∧ (B body ∧ D body d)
refine ⟨⟨hbvalid, hne, hlen, hmantissa, ?_⟩, ⟨hBkeep, hDkeep⟩⟩
simpa [hfpC] using hfp
| increment body neg d fp hprev h hguard ih =>
rcases ih with ⟨_, hInv⟩
rcases hInv with ⟨hB, hD⟩
have hBkeep := hB
have hDkeep := hD
rcases hD with ⟨_, _, hnegative, hmantissa, hlex⟩
have hfpC : fp = C.integer d.exponent d.mantissa :=
hrefine.integer_normal d.exponent d.mantissa fp h
have hsumBound : d.mantissa.val + 1 ≤ U64.max := by
rw [U64.max_eq]
omega
have hadd := UScalar.add_spec (x := d.mantissa) (y := 1#u64) (by simpa using hsumBound)
obtain ⟨next, hadd, hnext⟩ := Aeneas.Std.WP.spec_imp_exists hadd
change (d.mantissa.val < 10 ^ 19 ∧ ∃ next : Std.U64,
d.mantissa + 1#u64 = ok next ∧ next.val = d.mantissa.val + 1) ∧
(B body ∧ D body d ∧
P9_T1_ActualDispatchOperations.integer d.exponent d.mantissa = ok fp ∧
fp = C.integer d.exponent d.mantissa ∧ d.many_digits = true ∧ 0 ≤ fp.p_biased.val)
exact ⟨⟨hmantissa, ⟨next, hadd, hnext⟩⟩,
⟨hBkeep, hDkeep, h, hfpC, hguard.1, hguard.2⟩⟩
| second body neg d fp next hprev h ih =>
rcases ih with ⟨hGoal, hInv⟩
rcases hInv with ⟨hB, hD, hfirst, hfirstC, hmany, hnonneg⟩
have hmantissa := hGoal.1
obtain ⟨next0, hinc0, hnextval0⟩ := hGoal.2
have hnextval : next.val = d.mantissa.val + 1 := by
have hv := congrArg (fun r : Result Std.U64 =>
match r with | .ok u => u.val | .fail _ => 0 | .div => 0) (hinc0.symm.trans h)
simpa using hv.symm.trans hnextval0
obtain ⟨second, hsecond⟩ := P661_T1_IntegerExecution d.exponent next
have hsecondC : second = C.integer d.exponent next :=
hrefine.integer_normal d.exponent next second hsecond
change (next.val = d.mantissa.val + 1 ∧
P9_T1_ActualDispatchOperations.integer d.exponent next = ok (C.integer d.exponent next)) ∧
(B body ∧ D body d ∧ ∃ f,
P9_T1_ActualDispatchOperations.integer d.exponent d.mantissa = ok f ∧
f = C.integer d.exponent d.mantissa ∧ d.many_digits = true ∧ 0 ≤ f.p_biased.val ∧
d.mantissa + 1#u64 = ok next ∧ next.val = d.mantissa.val + 1 ∧ fp = f)
refine ⟨⟨hnextval, ?_⟩, ⟨hB, hD, fp, hfirst, hfirstC, hmany, hnonneg, h, hnextval, rfl⟩⟩
simpa [hsecondC] using hsecond
| compare body neg d fp second next hprev h ih =>
rcases ih with ⟨_, hInv⟩
rcases hInv with ⟨hB, hD, f, hfirst, hfirstC, hmany, hnonneg, hinc, hnextval, hfpF⟩
have hcmp : num.imp.dec2flt.common.BiasedFp.Insts.CoreCmpPartialEqBiasedFp.eq fp second =
ok (decide (fp.m = second.m ∧ fp.p_biased = second.p_biased)) := by
unfold num.imp.dec2flt.common.BiasedFp.Insts.CoreCmpPartialEqBiasedFp.eq
by_cases hm : fp.m = second.m
· simp [hm]
· simp [hm]
change (num.imp.dec2flt.common.BiasedFp.Insts.CoreCmpPartialEqBiasedFp.eq fp second =
ok (decide (fp.m = second.m ∧ fp.p_biased = second.p_biased))) ∧
(B body ∧ D body d ∧ ∃ f next,
P9_T1_ActualDispatchOperations.integer d.exponent d.mantissa = ok f ∧
f = C.integer d.exponent d.mantissa ∧ d.many_digits = true ∧ 0 ≤ f.p_biased.val ∧
d.mantissa + 1#u64 = ok next ∧ next.val = d.mantissa.val + 1 ∧
P9_T1_ActualDispatchOperations.integer d.exponent next = ok second ∧
second = C.integer d.exponent next ∧ fp = f)
exact ⟨hcmp, ⟨hB, hD, f, next, hfirst, hfirstC, hmany, hnonneg,
hinc, hnextval, h, (by
have hh := hrefine.integer_normal d.exponent next second h
exact hh), hfpF⟩⟩
| post_direct body neg d fp hprev h hguard ih =>
rcases ih with ⟨_, hInv⟩
rcases hInv with ⟨hB, hD⟩
rcases hD with ⟨hparse, hCparse, hnegative, hmantissa, hlex⟩
have hfpC := hrefine.integer_normal d.exponent d.mantissa fp h
change (SourceValidByteSlice body ∧ body.val ≠ [] ∧ body.val.length ≤ s.val.length ∧
d.negative = false ∧ d.mantissa.val < 10 ^ 19) ∧
(B body ∧ D body d ∧ ∃ f,
P9_T1_ActualDispatchOperations.integer d.exponent d.mantissa = ok f ∧
f = C.integer d.exponent d.mantissa ∧ (fp = f ∨ fp.p_biased.val = -1))
exact ⟨⟨hB.1, hB.2.1, hB.2.2.1, hnegative, hmantissa⟩,
⟨hB, ⟨hparse, hCparse, hnegative, hmantissa, hlex⟩, fp, h, hfpC, Or.inl rfl⟩⟩
| post_compared body neg d fp second equal hprev h ih =>
rcases ih with ⟨_, hInv⟩
rcases hInv with ⟨hB, hD, f, next, hfirst, hfirstC, hmany, hnonneg,
hinc, hnextval, hsecond, hsecondC, hfpF⟩
rcases hD with ⟨hparse, hCparse, hnegative, hmantissa, hlex⟩
change (SourceValidByteSlice body ∧ body.val ≠ [] ∧ body.val.length ≤ s.val.length ∧
d.negative = false ∧ d.mantissa.val < 10 ^ 19) ∧
(B body ∧ D body d ∧ ∃ f,
P9_T1_ActualDispatchOperations.integer d.exponent d.mantissa = ok f ∧
f = C.integer d.exponent d.mantissa ∧
((if equal then fp else { fp with p_biased := (-1)#i32 }) = f ∨
(if equal then fp else { fp with p_biased := (-1)#i32 }).p_biased.val = -1))
refine ⟨⟨hB.1, hB.2.1, hB.2.2.1, hnegative, hmantissa⟩,
⟨hB, ⟨hparse, hCparse, hnegative, hmantissa, hlex⟩, f, hfirst, hfirstC, ?_⟩⟩
cases equal <;> simp [hfpF]
| slow body neg d post hprev hguard ih =>
rcases ih with ⟨_, hInv⟩
rcases hInv with ⟨hB, hD, hPost⟩
rcases hPost with ⟨f, hfirst, hfirstC, hpost⟩
rcases hD with ⟨hparse, hCparse, hnegative, hmantissa, hlex⟩
have hlexKeep := hlex
obtain ⟨x, hsign, hvalid, hbytes⟩ := hlex
have ⟨g, hg⟩ := P661_T1_SlowExecution body x hB.1 hsign hvalid hbytes
have hnormal := hrefine.slow_normal body x g hB.1 hsign hvalid hbytes hg
have hslow : P9_T1_ActualDispatchOperations.slow body = ok (C.slow body) := by
rw [hg, hnormal]
change (SourceValidByteSlice body ∧ body.val ≠ [] ∧ body.val.length ≤ s.val.length ∧
Lex body ∧ P9_T1_ActualDispatchOperations.slow body = ok (C.slow body)) ∧
(B body ∧ D body d ∧ ∃ f,
P9_T1_ActualDispatchOperations.integer d.exponent d.mantissa = ok f ∧
f = C.integer d.exponent d.mantissa ∧ (post = f ∨ post.p_biased.val = -1))
exact ⟨⟨hB.1, hB.2.1, hB.2.2.1, hlexKeep, hslow⟩,
⟨hB, ⟨hparse, hCparse, hnegative, hmantissa, hlexKeep⟩, f, hfirst, hfirstC, hpost⟩⟩
| assemble_direct body neg d post hprev hguard ih =>
rcases ih with ⟨_, hInv⟩
rcases hInv with ⟨hB, hD, hPost⟩
rcases hPost with ⟨f, hfirst, hfirstC, hpost⟩
have hpostEq : post = f := by
rcases hpost with heq | hneg
· exact heq
· omega
have hinteger := hcontracts.integer_normal d.exponent d.mantissa
rw [← hfirstC] at hinteger
have hclear : (C.assemble f).val < 2 ^ 63 := by
rcases hinteger with hneg | ⟨_, hclear⟩
· rw [hpostEq] at hguard
omega
· exact hclear
have hguardF : 0 ≤ f.p_biased.val := by
rw [← hpostEq]
exact hguard
have hassemble := hrefine.assembly_all post
rcases hD with ⟨hparse, hCparse, hnegative, hmantissa, hlex⟩
change (P9_T1_ActualDispatchOperations.assemble post = ok (C.assemble post)) ∧
(B body ∧ D body d ∧
((∃ f, P9_T1_ActualDispatchOperations.integer d.exponent d.mantissa = ok f ∧
f = C.integer d.exponent d.mantissa ∧ post = f ∧ 0 ≤ f.p_biased.val ∧
(C.assemble f).val < 2 ^ 63) ∨
(∃ x : DecimalLexeme, x.leadingSign = none ∧ DecimalGoalVocabularyDefault.validNumeric x ∧
DecimalGoalVocabularyDefault.renderNumeric x = DecimalGoalVocabularyDefault.bytes body ∧
post = C.slow body ∧ (C.assemble post).val < 2 ^ 63)))
exact ⟨hassemble, ⟨hB, ⟨hparse, hCparse, hnegative, hmantissa, hlex⟩,
Or.inl ⟨f, hfirst, hfirstC, hpostEq, hguardF, hclear⟩⟩⟩
| assemble_slow body neg d post selected hprev h ih =>
rcases ih with ⟨hGoal, hInv⟩
rcases hInv with ⟨hB, hD, hPost⟩
rcases hPost with ⟨f, hfirst, hfirstC, hpost⟩
rcases hD with ⟨hparse, hCparse, hnegative, hmantissa, hlex⟩
have hlexKeep := hlex
rcases hGoal with ⟨_, _, _, _, hslow⟩
have hselected : selected = C.slow body := by
have heq : ok selected = ok (C.slow body) := h.symm.trans hslow
injection heq
obtain ⟨x, hsign, hvalid, hbytes⟩ := hlex
have hclear := (hcontracts.slow_normal body x hB.1 hsign hvalid hbytes).2
have hclearSelected : (C.assemble selected).val < 2 ^ 63 := by
rw [hselected]
exact hclear
have hassemble := hrefine.assembly_all selected
change (P9_T1_ActualDispatchOperations.assemble selected = ok (C.assemble selected)) ∧
(B body ∧ D body d ∧
((∃ f, P9_T1_ActualDispatchOperations.integer d.exponent d.mantissa = ok f ∧
f = C.integer d.exponent d.mantissa ∧ selected = f ∧ 0 ≤ f.p_biased.val ∧
(C.assemble f).val < 2 ^ 63) ∨
(∃ x : DecimalLexeme, x.leadingSign = none ∧ DecimalGoalVocabularyDefault.validNumeric x ∧
DecimalGoalVocabularyDefault.renderNumeric x = DecimalGoalVocabularyDefault.bytes body ∧
selected = C.slow body ∧ (C.assemble selected).val < 2 ^ 63)))
exact ⟨hassemble, ⟨hB, ⟨hparse, hCparse, hnegative, hmantissa, hlexKeep⟩,
Or.inr ⟨x, hsign, hvalid, hbytes, hselected, hclearSelected⟩⟩⟩
| negate body d selected magnitude hprev h ih =>
rcases ih with ⟨hGoal, hInv⟩
have hclear : (C.assemble selected).val < 2 ^ 63 := by
rcases hInv with ⟨_, _, hcases⟩
rcases hcases with hdirect | hslow
· rcases hdirect with ⟨f, _, _, hsel, _, hclear⟩
rw [hsel]
exact hclear
· rcases hslow with ⟨x, _, _, _, _, hclear⟩
exact hclear
have hmag : magnitude = C.assemble selected := by
have heq : ok magnitude = ok (C.assemble selected) := h.symm.trans hGoal
injection heq
have hnegate := hrefine.negate_all magnitude
rcases hInv with ⟨hB, hD, _⟩
change (magnitude.val < 2 ^ 63 ∧
P9_T1_ActualDispatchOperations.negate magnitude = ok (C.negate magnitude)) ∧
(B body ∧ D body d ∧ (C.assemble selected).val < 2 ^ 63)
refine ⟨⟨?_, hnegate⟩, ⟨hB, hD, hclear⟩⟩
rw [hmag]
exact hclear
exact (stronger call hreach).1
end dec2flt_model
Download Lean source · Download TeX source
Complete Lean module
import Tablet.DispatchContracts
import Tablet.P9_T1_NormalComponentRefinement
import Tablet.P9_T1_ReachedDispatchCall
import Tablet.P13_T1_NumberHelperRejection
import Tablet.P14_NativeTotality
import Tablet.P661_T1_IntegerExecution
import Tablet.P661_T1_SlowExecution
open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false
namespace dec2flt_model
-- [TABLET NODE: P661_T1_PrefixRealization]
theorem P661_T1_PrefixRealization (C : P9_T1_AbstractComponents)
(hcontracts : DispatchContracts C)
(hrefine : P9_T1_NormalComponentRefinement C)
(s : Str) (hsource : DecimalGoalVocabularyDefault.sourceString s)
(hA : s.val.length <= 3458764513820540928) :
forall call : P9_T1_DispatchCall, P9_T1_ReachedDispatchCall s call ->
match call with
| .number body _ =>
SourceValidByteSlice body /\ body.val ≠ [] /\ body.val.length <= s.val.length /\
P9_T1_ActualDispatchOperations.parseNumber body = ok (C.parseNumber body)
| .special body neg =>
SourceValidByteSlice body /\ body.val ≠ [] /\ body.val.length <= s.val.length /\
P9_T1_ActualDispatchOperations.parseSpecial body neg = ok (C.parseSpecial body neg)
| .native body neg d =>
SourceValidByteSlice body /\ body.val ≠ [] /\ body.val.length <= s.val.length /\
d.negative = false /\ d.mantissa.val < 10 ^ 19 /\
P9_T1_ActualDispatchOperations.native { d with negative := neg } =
ok (C.native { d with negative := neg })
| .first body _ d =>
SourceValidByteSlice body /\ body.val ≠ [] /\ body.val.length <= s.val.length /\
d.mantissa.val < 10 ^ 19 /\
P9_T1_ActualDispatchOperations.integer d.exponent d.mantissa =
ok (C.integer d.exponent d.mantissa)
| .increment _ _ d _ =>
d.mantissa.val < 10 ^ 19 /\ exists next : Std.U64,
d.mantissa + 1#u64 = ok next /\ next.val = d.mantissa.val + 1
| .second _ _ d _ next =>
next.val = d.mantissa.val + 1 /\
P9_T1_ActualDispatchOperations.integer d.exponent next =
ok (C.integer d.exponent next)
| .compare _ _ _ first second =>
num.imp.dec2flt.common.BiasedFp.Insts.CoreCmpPartialEqBiasedFp.eq first second =
ok (decide (first.m = second.m /\ first.p_biased = second.p_biased))
| .post body _ d _ =>
SourceValidByteSlice body /\ body.val ≠ [] /\ body.val.length <= s.val.length /\
d.negative = false /\ d.mantissa.val < 10 ^ 19
| .slow body _ _ _ =>
SourceValidByteSlice body /\ body.val ≠ [] /\ body.val.length <= s.val.length /\
(exists x : DecimalLexeme, x.leadingSign = none /\
DecimalGoalVocabularyDefault.validNumeric x /\
DecimalGoalVocabularyDefault.renderNumeric x = DecimalGoalVocabularyDefault.bytes body) /\
P9_T1_ActualDispatchOperations.slow body = ok (C.slow body)
| .assemble _ _ _ selected =>
P9_T1_ActualDispatchOperations.assemble selected = ok (C.assemble selected)
| .negate _ _ _ magnitude =>
magnitude.val < 2 ^ 63 /\
P9_T1_ActualDispatchOperations.negate magnitude = ok (C.negate magnitude) := by
-- BODY
intro call hreach
let Goal : P9_T1_DispatchCall → Prop := fun call =>
match call with
| .number body _ =>
SourceValidByteSlice body ∧ body.val ≠ [] ∧ body.val.length ≤ s.val.length ∧
P9_T1_ActualDispatchOperations.parseNumber body = ok (C.parseNumber body)
| .special body neg =>
SourceValidByteSlice body ∧ body.val ≠ [] ∧ body.val.length ≤ s.val.length ∧
P9_T1_ActualDispatchOperations.parseSpecial body neg = ok (C.parseSpecial body neg)
| .native body neg d =>
SourceValidByteSlice body ∧ body.val ≠ [] ∧ body.val.length ≤ s.val.length ∧
d.negative = false ∧ d.mantissa.val < 10 ^ 19 ∧
P9_T1_ActualDispatchOperations.native { d with negative := neg } = ok (C.native { d with negative := neg })
| .first body _ d =>
SourceValidByteSlice body ∧ body.val ≠ [] ∧ body.val.length ≤ s.val.length ∧
d.mantissa.val < 10 ^ 19 ∧
P9_T1_ActualDispatchOperations.integer d.exponent d.mantissa = ok (C.integer d.exponent d.mantissa)
| .increment _ _ d _ =>
d.mantissa.val < 10 ^ 19 ∧ ∃ next : Std.U64,
d.mantissa + 1#u64 = ok next ∧ next.val = d.mantissa.val + 1
| .second _ _ d _ next =>
next.val = d.mantissa.val + 1 ∧
P9_T1_ActualDispatchOperations.integer d.exponent next = ok (C.integer d.exponent next)
| .compare _ _ _ first second =>
num.imp.dec2flt.common.BiasedFp.Insts.CoreCmpPartialEqBiasedFp.eq first second =
ok (decide (first.m = second.m ∧ first.p_biased = second.p_biased))
| .post body _ d _ =>
SourceValidByteSlice body ∧ body.val ≠ [] ∧ body.val.length ≤ s.val.length ∧
d.negative = false ∧ d.mantissa.val < 10 ^ 19
| .slow body _ _ _ =>
SourceValidByteSlice body ∧ body.val ≠ [] ∧ body.val.length ≤ s.val.length ∧
(∃ x : DecimalLexeme, x.leadingSign = none ∧
DecimalGoalVocabularyDefault.validNumeric x ∧
DecimalGoalVocabularyDefault.renderNumeric x = DecimalGoalVocabularyDefault.bytes body) ∧
P9_T1_ActualDispatchOperations.slow body = ok (C.slow body)
| .assemble _ _ _ selected =>
P9_T1_ActualDispatchOperations.assemble selected = ok (C.assemble selected)
| .negate _ _ _ magnitude =>
magnitude.val < 2 ^ 63 ∧
P9_T1_ActualDispatchOperations.negate magnitude = ok (C.negate magnitude)
let B : Slice Std.U8 → Prop := fun b =>
SourceValidByteSlice b ∧ b.val ≠ [] ∧ b.val.length ≤ s.val.length ∧ b.val.length ≤ 3458764513820540928
let Lex : Slice Std.U8 → Prop := fun b =>
∃ x : DecimalLexeme, x.leadingSign = none ∧ DecimalGoalVocabularyDefault.validNumeric x ∧
DecimalGoalVocabularyDefault.renderNumeric x = DecimalGoalVocabularyDefault.bytes b
let D : Slice Std.U8 → num.imp.dec2flt.decimal.Decimal → Prop := fun b d =>
P9_T1_ActualDispatchOperations.parseNumber b = ok (some d) ∧
C.parseNumber b = some d ∧ d.negative = false ∧ d.mantissa.val < 10 ^ 19 ∧ Lex b
let Inv : P9_T1_DispatchCall → Prop := fun call =>
match call with
| .number b _ => B b
| .special b _ => B b
| .native b _ d => B b ∧ D b d
| .first b _ d => B b ∧ D b d
| .increment b _ d fp => B b ∧ D b d ∧
P9_T1_ActualDispatchOperations.integer d.exponent d.mantissa = ok fp ∧
fp = C.integer d.exponent d.mantissa ∧ d.many_digits = true ∧ 0 ≤ fp.p_biased.val
| .second b _ d fp next => B b ∧ D b d ∧
∃ f, P9_T1_ActualDispatchOperations.integer d.exponent d.mantissa = ok f ∧
f = C.integer d.exponent d.mantissa ∧ d.many_digits = true ∧ 0 ≤ f.p_biased.val ∧
d.mantissa + 1#u64 = ok next ∧ next.val = d.mantissa.val + 1 ∧ fp = f
| .compare b _ d fp second => B b ∧ D b d ∧
∃ f next, P9_T1_ActualDispatchOperations.integer d.exponent d.mantissa = ok f ∧
f = C.integer d.exponent d.mantissa ∧ d.many_digits = true ∧ 0 ≤ f.p_biased.val ∧
d.mantissa + 1#u64 = ok next ∧ next.val = d.mantissa.val + 1 ∧
P9_T1_ActualDispatchOperations.integer d.exponent next = ok second ∧
second = C.integer d.exponent next ∧ fp = f
| .post b _ d post => B b ∧ D b d ∧
∃ f, P9_T1_ActualDispatchOperations.integer d.exponent d.mantissa = ok f ∧
f = C.integer d.exponent d.mantissa ∧
(post = f ∨ post.p_biased.val = -1)
| .slow b _ d post => B b ∧ D b d ∧
∃ f, P9_T1_ActualDispatchOperations.integer d.exponent d.mantissa = ok f ∧
f = C.integer d.exponent d.mantissa ∧
(post = f ∨ post.p_biased.val = -1)
| .assemble b _ d selected => B b ∧ D b d ∧
((∃ f, P9_T1_ActualDispatchOperations.integer d.exponent d.mantissa = ok f ∧
f = C.integer d.exponent d.mantissa ∧ selected = f ∧ 0 ≤ f.p_biased.val ∧
(C.assemble f).val < 2 ^ 63) ∨
(∃ x : DecimalLexeme, x.leadingSign = none ∧ DecimalGoalVocabularyDefault.validNumeric x ∧
DecimalGoalVocabularyDefault.renderNumeric x = DecimalGoalVocabularyDefault.bytes b ∧
selected = C.slow b ∧ (C.assemble selected).val < 2 ^ 63))
| .negate b d selected magnitude => B b ∧ D b d ∧
(C.assemble selected).val < 2 ^ 63
have stronger : ∀ call, P9_T1_ReachedDispatchCall s call → Goal call ∧ Inv call := by
intro call hreach
induction hreach with
| number c tail body hs hb hne =>
have hlen : body.val.length ≤ s.val.length := by
rw [hb, hs]
by_cases hc : c = 45#u8 ∨ c = 43#u8 <;> simp [hc]
have hbvalid : SourceValidByteSlice body := by
rw [SourceValidByteSlice]
exact le_trans hlen hsource.1
have hB : B body := ⟨hbvalid, hne, hlen, le_trans hlen hA⟩
change (SourceValidByteSlice body ∧ body.val ≠ [] ∧ body.val.length ≤ s.val.length ∧
P9_T1_ActualDispatchOperations.parseNumber body = ok (C.parseNumber body)) ∧ B body
refine ⟨?_, hB⟩
exact ⟨hbvalid, hne, hlen, hrefine.number_bounded body hbvalid hne (le_trans hlen hA)⟩
| special body neg hprev h ih =>
rcases ih with ⟨_, hB⟩
rcases hB with ⟨hbvalid, hne, hlen, hA'⟩
have hs := hrefine.special_all body neg hbvalid
change (SourceValidByteSlice body ∧ body.val ≠ [] ∧ body.val.length ≤ s.val.length ∧
P9_T1_ActualDispatchOperations.parseSpecial body neg = ok (C.parseSpecial body neg)) ∧ B body
exact ⟨⟨hbvalid, hne, hlen, hs⟩, ⟨hbvalid, hne, hlen, hA'⟩⟩
| native body neg d hprev h ih =>
rcases ih with ⟨_, hB⟩
rcases hB with ⟨hbvalid, hne, hlen, hA'⟩
have hC : C.parseNumber body = some d := by
have hn := hrefine.number_normal body (some d) hbvalid hne h
exact hn.symm
have hbounds := hcontracts.record_bounds body d hbvalid hne hC
have hlex : Lex body := by
by_contra hnot
have hnone := P13_T1_NumberHelperRejection body hbvalid hne hA' hnot
rw [h] at hnone
cases hnone
obtain ⟨r, hr⟩ := P14_NativeTotality { d with negative := neg }
have hnormal := hrefine.native_normal { d with negative := neg } r hr
have hret : P9_T1_ActualDispatchOperations.native { d with negative := neg } =
ok (C.native { d with negative := neg }) := by
rw [hr, hnormal]
change (SourceValidByteSlice body ∧ body.val ≠ [] ∧ body.val.length ≤ s.val.length ∧
d.negative = false ∧ d.mantissa.val < 10 ^ 19 ∧
P9_T1_ActualDispatchOperations.native { d with negative := neg } =
ok (C.native { d with negative := neg })) ∧ (B body ∧ D body d)
exact ⟨⟨hbvalid, hne, hlen, hbounds.1, hbounds.2, hret⟩,
⟨⟨hbvalid, hne, hlen, hA'⟩, h, hC, hbounds.1, hbounds.2, hlex⟩⟩
| first body neg d hprev h ih =>
rcases ih with ⟨_, hInv⟩
rcases hInv with ⟨hB, hD⟩
have hBkeep := hB
have hDkeep := hD
obtain ⟨fp, hfp⟩ := P661_T1_IntegerExecution d.exponent d.mantissa
have hfpC : fp = C.integer d.exponent d.mantissa :=
hrefine.integer_normal d.exponent d.mantissa fp hfp
rcases hD with ⟨_, _, hnegative, hmantissa, hlex⟩
rcases hB with ⟨hbvalid, hne, hlen, hA'⟩
change (SourceValidByteSlice body ∧ body.val ≠ [] ∧ body.val.length ≤ s.val.length ∧
d.mantissa.val < 10 ^ 19 ∧
P9_T1_ActualDispatchOperations.integer d.exponent d.mantissa =
ok (C.integer d.exponent d.mantissa)) ∧ (B body ∧ D body d)
refine ⟨⟨hbvalid, hne, hlen, hmantissa, ?_⟩, ⟨hBkeep, hDkeep⟩⟩
simpa [hfpC] using hfp
| increment body neg d fp hprev h hguard ih =>
rcases ih with ⟨_, hInv⟩
rcases hInv with ⟨hB, hD⟩
have hBkeep := hB
have hDkeep := hD
rcases hD with ⟨_, _, hnegative, hmantissa, hlex⟩
have hfpC : fp = C.integer d.exponent d.mantissa :=
hrefine.integer_normal d.exponent d.mantissa fp h
have hsumBound : d.mantissa.val + 1 ≤ U64.max := by
rw [U64.max_eq]
omega
have hadd := UScalar.add_spec (x := d.mantissa) (y := 1#u64) (by simpa using hsumBound)
obtain ⟨next, hadd, hnext⟩ := Aeneas.Std.WP.spec_imp_exists hadd
change (d.mantissa.val < 10 ^ 19 ∧ ∃ next : Std.U64,
d.mantissa + 1#u64 = ok next ∧ next.val = d.mantissa.val + 1) ∧
(B body ∧ D body d ∧
P9_T1_ActualDispatchOperations.integer d.exponent d.mantissa = ok fp ∧
fp = C.integer d.exponent d.mantissa ∧ d.many_digits = true ∧ 0 ≤ fp.p_biased.val)
exact ⟨⟨hmantissa, ⟨next, hadd, hnext⟩⟩,
⟨hBkeep, hDkeep, h, hfpC, hguard.1, hguard.2⟩⟩
| second body neg d fp next hprev h ih =>
rcases ih with ⟨hGoal, hInv⟩
rcases hInv with ⟨hB, hD, hfirst, hfirstC, hmany, hnonneg⟩
have hmantissa := hGoal.1
obtain ⟨next0, hinc0, hnextval0⟩ := hGoal.2
have hnextval : next.val = d.mantissa.val + 1 := by
have hv := congrArg (fun r : Result Std.U64 =>
match r with | .ok u => u.val | .fail _ => 0 | .div => 0) (hinc0.symm.trans h)
simpa using hv.symm.trans hnextval0
obtain ⟨second, hsecond⟩ := P661_T1_IntegerExecution d.exponent next
have hsecondC : second = C.integer d.exponent next :=
hrefine.integer_normal d.exponent next second hsecond
change (next.val = d.mantissa.val + 1 ∧
P9_T1_ActualDispatchOperations.integer d.exponent next = ok (C.integer d.exponent next)) ∧
(B body ∧ D body d ∧ ∃ f,
P9_T1_ActualDispatchOperations.integer d.exponent d.mantissa = ok f ∧
f = C.integer d.exponent d.mantissa ∧ d.many_digits = true ∧ 0 ≤ f.p_biased.val ∧
d.mantissa + 1#u64 = ok next ∧ next.val = d.mantissa.val + 1 ∧ fp = f)
refine ⟨⟨hnextval, ?_⟩, ⟨hB, hD, fp, hfirst, hfirstC, hmany, hnonneg, h, hnextval, rfl⟩⟩
simpa [hsecondC] using hsecond
| compare body neg d fp second next hprev h ih =>
rcases ih with ⟨_, hInv⟩
rcases hInv with ⟨hB, hD, f, hfirst, hfirstC, hmany, hnonneg, hinc, hnextval, hfpF⟩
have hcmp : num.imp.dec2flt.common.BiasedFp.Insts.CoreCmpPartialEqBiasedFp.eq fp second =
ok (decide (fp.m = second.m ∧ fp.p_biased = second.p_biased)) := by
unfold num.imp.dec2flt.common.BiasedFp.Insts.CoreCmpPartialEqBiasedFp.eq
by_cases hm : fp.m = second.m
· simp [hm]
· simp [hm]
change (num.imp.dec2flt.common.BiasedFp.Insts.CoreCmpPartialEqBiasedFp.eq fp second =
ok (decide (fp.m = second.m ∧ fp.p_biased = second.p_biased))) ∧
(B body ∧ D body d ∧ ∃ f next,
P9_T1_ActualDispatchOperations.integer d.exponent d.mantissa = ok f ∧
f = C.integer d.exponent d.mantissa ∧ d.many_digits = true ∧ 0 ≤ f.p_biased.val ∧
d.mantissa + 1#u64 = ok next ∧ next.val = d.mantissa.val + 1 ∧
P9_T1_ActualDispatchOperations.integer d.exponent next = ok second ∧
second = C.integer d.exponent next ∧ fp = f)
exact ⟨hcmp, ⟨hB, hD, f, next, hfirst, hfirstC, hmany, hnonneg,
hinc, hnextval, h, (by
have hh := hrefine.integer_normal d.exponent next second h
exact hh), hfpF⟩⟩
| post_direct body neg d fp hprev h hguard ih =>
rcases ih with ⟨_, hInv⟩
rcases hInv with ⟨hB, hD⟩
rcases hD with ⟨hparse, hCparse, hnegative, hmantissa, hlex⟩
have hfpC := hrefine.integer_normal d.exponent d.mantissa fp h
change (SourceValidByteSlice body ∧ body.val ≠ [] ∧ body.val.length ≤ s.val.length ∧
d.negative = false ∧ d.mantissa.val < 10 ^ 19) ∧
(B body ∧ D body d ∧ ∃ f,
P9_T1_ActualDispatchOperations.integer d.exponent d.mantissa = ok f ∧
f = C.integer d.exponent d.mantissa ∧ (fp = f ∨ fp.p_biased.val = -1))
exact ⟨⟨hB.1, hB.2.1, hB.2.2.1, hnegative, hmantissa⟩,
⟨hB, ⟨hparse, hCparse, hnegative, hmantissa, hlex⟩, fp, h, hfpC, Or.inl rfl⟩⟩
| post_compared body neg d fp second equal hprev h ih =>
rcases ih with ⟨_, hInv⟩
rcases hInv with ⟨hB, hD, f, next, hfirst, hfirstC, hmany, hnonneg,
hinc, hnextval, hsecond, hsecondC, hfpF⟩
rcases hD with ⟨hparse, hCparse, hnegative, hmantissa, hlex⟩
change (SourceValidByteSlice body ∧ body.val ≠ [] ∧ body.val.length ≤ s.val.length ∧
d.negative = false ∧ d.mantissa.val < 10 ^ 19) ∧
(B body ∧ D body d ∧ ∃ f,
P9_T1_ActualDispatchOperations.integer d.exponent d.mantissa = ok f ∧
f = C.integer d.exponent d.mantissa ∧
((if equal then fp else { fp with p_biased := (-1)#i32 }) = f ∨
(if equal then fp else { fp with p_biased := (-1)#i32 }).p_biased.val = -1))
refine ⟨⟨hB.1, hB.2.1, hB.2.2.1, hnegative, hmantissa⟩,
⟨hB, ⟨hparse, hCparse, hnegative, hmantissa, hlex⟩, f, hfirst, hfirstC, ?_⟩⟩
cases equal <;> simp [hfpF]
| slow body neg d post hprev hguard ih =>
rcases ih with ⟨_, hInv⟩
rcases hInv with ⟨hB, hD, hPost⟩
rcases hPost with ⟨f, hfirst, hfirstC, hpost⟩
rcases hD with ⟨hparse, hCparse, hnegative, hmantissa, hlex⟩
have hlexKeep := hlex
obtain ⟨x, hsign, hvalid, hbytes⟩ := hlex
have ⟨g, hg⟩ := P661_T1_SlowExecution body x hB.1 hsign hvalid hbytes
have hnormal := hrefine.slow_normal body x g hB.1 hsign hvalid hbytes hg
have hslow : P9_T1_ActualDispatchOperations.slow body = ok (C.slow body) := by
rw [hg, hnormal]
change (SourceValidByteSlice body ∧ body.val ≠ [] ∧ body.val.length ≤ s.val.length ∧
Lex body ∧ P9_T1_ActualDispatchOperations.slow body = ok (C.slow body)) ∧
(B body ∧ D body d ∧ ∃ f,
P9_T1_ActualDispatchOperations.integer d.exponent d.mantissa = ok f ∧
f = C.integer d.exponent d.mantissa ∧ (post = f ∨ post.p_biased.val = -1))
exact ⟨⟨hB.1, hB.2.1, hB.2.2.1, hlexKeep, hslow⟩,
⟨hB, ⟨hparse, hCparse, hnegative, hmantissa, hlexKeep⟩, f, hfirst, hfirstC, hpost⟩⟩
| assemble_direct body neg d post hprev hguard ih =>
rcases ih with ⟨_, hInv⟩
rcases hInv with ⟨hB, hD, hPost⟩
rcases hPost with ⟨f, hfirst, hfirstC, hpost⟩
have hpostEq : post = f := by
rcases hpost with heq | hneg
· exact heq
· omega
have hinteger := hcontracts.integer_normal d.exponent d.mantissa
rw [← hfirstC] at hinteger
have hclear : (C.assemble f).val < 2 ^ 63 := by
rcases hinteger with hneg | ⟨_, hclear⟩
· rw [hpostEq] at hguard
omega
· exact hclear
have hguardF : 0 ≤ f.p_biased.val := by
rw [← hpostEq]
exact hguard
have hassemble := hrefine.assembly_all post
rcases hD with ⟨hparse, hCparse, hnegative, hmantissa, hlex⟩
change (P9_T1_ActualDispatchOperations.assemble post = ok (C.assemble post)) ∧
(B body ∧ D body d ∧
((∃ f, P9_T1_ActualDispatchOperations.integer d.exponent d.mantissa = ok f ∧
f = C.integer d.exponent d.mantissa ∧ post = f ∧ 0 ≤ f.p_biased.val ∧
(C.assemble f).val < 2 ^ 63) ∨
(∃ x : DecimalLexeme, x.leadingSign = none ∧ DecimalGoalVocabularyDefault.validNumeric x ∧
DecimalGoalVocabularyDefault.renderNumeric x = DecimalGoalVocabularyDefault.bytes body ∧
post = C.slow body ∧ (C.assemble post).val < 2 ^ 63)))
exact ⟨hassemble, ⟨hB, ⟨hparse, hCparse, hnegative, hmantissa, hlex⟩,
Or.inl ⟨f, hfirst, hfirstC, hpostEq, hguardF, hclear⟩⟩⟩
| assemble_slow body neg d post selected hprev h ih =>
rcases ih with ⟨hGoal, hInv⟩
rcases hInv with ⟨hB, hD, hPost⟩
rcases hPost with ⟨f, hfirst, hfirstC, hpost⟩
rcases hD with ⟨hparse, hCparse, hnegative, hmantissa, hlex⟩
have hlexKeep := hlex
rcases hGoal with ⟨_, _, _, _, hslow⟩
have hselected : selected = C.slow body := by
have heq : ok selected = ok (C.slow body) := h.symm.trans hslow
injection heq
obtain ⟨x, hsign, hvalid, hbytes⟩ := hlex
have hclear := (hcontracts.slow_normal body x hB.1 hsign hvalid hbytes).2
have hclearSelected : (C.assemble selected).val < 2 ^ 63 := by
rw [hselected]
exact hclear
have hassemble := hrefine.assembly_all selected
change (P9_T1_ActualDispatchOperations.assemble selected = ok (C.assemble selected)) ∧
(B body ∧ D body d ∧
((∃ f, P9_T1_ActualDispatchOperations.integer d.exponent d.mantissa = ok f ∧
f = C.integer d.exponent d.mantissa ∧ selected = f ∧ 0 ≤ f.p_biased.val ∧
(C.assemble f).val < 2 ^ 63) ∨
(∃ x : DecimalLexeme, x.leadingSign = none ∧ DecimalGoalVocabularyDefault.validNumeric x ∧
DecimalGoalVocabularyDefault.renderNumeric x = DecimalGoalVocabularyDefault.bytes body ∧
selected = C.slow body ∧ (C.assemble selected).val < 2 ^ 63)))
exact ⟨hassemble, ⟨hB, ⟨hparse, hCparse, hnegative, hmantissa, hlexKeep⟩,
Or.inr ⟨x, hsign, hvalid, hbytes, hselected, hclearSelected⟩⟩⟩
| negate body d selected magnitude hprev h ih =>
rcases ih with ⟨hGoal, hInv⟩
have hclear : (C.assemble selected).val < 2 ^ 63 := by
rcases hInv with ⟨_, _, hcases⟩
rcases hcases with hdirect | hslow
· rcases hdirect with ⟨f, _, _, hsel, _, hclear⟩
rw [hsel]
exact hclear
· rcases hslow with ⟨x, _, _, _, _, hclear⟩
exact hclear
have hmag : magnitude = C.assemble selected := by
have heq : ok magnitude = ok (C.assemble selected) := h.symm.trans hGoal
injection heq
have hnegate := hrefine.negate_all magnitude
rcases hInv with ⟨hB, hD, _⟩
change (magnitude.val < 2 ^ 63 ∧
P9_T1_ActualDispatchOperations.negate magnitude = ok (C.negate magnitude)) ∧
(B body ∧ D body d ∧ (C.assemble selected).val < 2 ^ 63)
refine ⟨⟨?_, hnegate⟩, ⟨hB, hD, hclear⟩⟩
rw [hmag]
exact hclear
exact (stronger call hreach).1
end dec2flt_model
Proof structure
Follow the declared dependencies to read the supporting statements and proofs.
Uses
Inspect related source (198)
- eq · dec2flt/common.rs:55 Program Rust
- compute_float · dec2flt/lemire.rs:26 Program Rust
- parse_long_mantissa · dec2flt/slow.rs:27 Program Rust
More program dependencies (156)
- parse_long_mantissa_loop0 · dec2flt/slow.rs:51 Program Rust
- body · dec2flt/slow.rs:51 Program Rust
- parse_long_mantissa_loop1 · dec2flt/slow.rs:69 Program Rust
- body · dec2flt/slow.rs:69 Program Rust
- parse_long_mantissa_loop2 · dec2flt/slow.rs:94 Program Rust
- body · dec2flt/slow.rs:94 Program Rust
- Dec2flt_modelNumImpDec2fltLemireU64 · dec2flt/mod.rs:217 Program Rust
- MAX_EXPONENT_DISGUISED_FAST_PATH · dec2flt/mod.rs:220 Program Rust
- MAX_EXPONENT_FAST_PATH · dec2flt/mod.rs:219 Program Rust
- Dec2flt_modelNumImpTraitsFloatU64 · traits.rs:309 Program Rust
- BITS · traits.rs:319 Program Rust
- LARGEST_POWER_OF_TEN · traits.rs:327 Program Rust
- MAX_EXPONENT_ROUND_TO_EVEN · traits.rs:325 Program Rust
- MIN_EXPONENT_ROUND_TO_EVEN · traits.rs:324 Program Rust
- SIG_TOTAL_BITS · traits.rs:320 Program Rust
- SMALLEST_POWER_OF_TEN · traits.rs:328 Program Rust
- BiasedFp · dec2flt/common.rs:56 Program Rust
- zero_pow2 · dec2flt/common.rs:66 Program Rust
- dec2flt_with_trace · dec2flt/mod.rs:355 Program Rust
- can_use_fast_path · dec2flt/decimal.rs:42 Program Rust
- INT_POW10 · dec2flt/decimal.rs:8 Program Rust
- DecimalSeq · dec2flt/decimal_seq.rs:22 Program Rust
- DECIMAL_POINT_RANGE · dec2flt/decimal_seq.rs:68 Program Rust
- left_shift · dec2flt/decimal_seq.rs:130 Program Rust
- left_shift_loop0 · dec2flt/decimal_seq.rs:139 Program Rust
- body · dec2flt/decimal_seq.rs:139 Program Rust
- left_shift_loop1 · dec2flt/decimal_seq.rs:153 Program Rust
- body · dec2flt/decimal_seq.rs:153 Program Rust
- right_shift · dec2flt/decimal_seq.rs:176 Program Rust
- right_shift_loop0 · dec2flt/decimal_seq.rs:181 Program Rust
- body · dec2flt/decimal_seq.rs:181 Program Rust
- right_shift_loop0_loop0 · dec2flt/decimal_seq.rs:191 Program Rust
- body · dec2flt/decimal_seq.rs:191 Program Rust
- right_shift_loop1 · dec2flt/decimal_seq.rs:210 Program Rust
- body · dec2flt/decimal_seq.rs:210 Program Rust
- right_shift_loop2 · dec2flt/decimal_seq.rs:217 Program Rust
- body · dec2flt/decimal_seq.rs:217 Program Rust
- round · dec2flt/decimal_seq.rs:97 Program Rust
- round_loop · dec2flt/decimal_seq.rs:107 Program Rust
- body · dec2flt/decimal_seq.rs:107 Program Rust
- parse_decimal_seq · dec2flt/decimal_seq.rs:288 Program Rust
- parse_decimal_seq_loop0 · dec2flt/decimal_seq.rs:296 Program Rust
- body · dec2flt/decimal_seq.rs:296 Program Rust
- parse_decimal_seq_loop1 · dec2flt/decimal_seq.rs:368 Program Rust
- body · dec2flt/decimal_seq.rs:368 Program Rust
- parse_decimal_seq_loop2 · dec2flt/decimal_seq.rs:309 Program Rust
- body · dec2flt/decimal_seq.rs:309 Program Rust
- parse_decimal_seq_loop3 · dec2flt/decimal_seq.rs:313 Program Rust
- body · dec2flt/decimal_seq.rs:313 Program Rust
- parse_decimal_seq_loop4 · dec2flt/decimal_seq.rs:368 Program Rust
- body · dec2flt/decimal_seq.rs:368 Program Rust
- parse_decimal_seq_loop5 · dec2flt/decimal_seq.rs:313 Program Rust
- body · dec2flt/decimal_seq.rs:313 Program Rust
- parse_decimal_seq_loop6 · dec2flt/decimal_seq.rs:368 Program Rust
- body · dec2flt/decimal_seq.rs:368 Program Rust
- parse_decimal_seq_loop7 · dec2flt/decimal_seq.rs:368 Program Rust
- body · dec2flt/decimal_seq.rs:368 Program Rust
- compute_product_approx · dec2flt/lemire.rs:134 Program Rust
- power · dec2flt/lemire.rs:121 Program Rust
- parse_number · dec2flt/parse.rs:234 Program Rust
- MAX_SHIFT · dec2flt/slow.rs:28 Program Rust
- call · dec2flt/slow.rs:33 Program Rust
- POWER_OF_FIVE_128 · dec2flt/table.rs:19 Program Rust
- Float · traits.rs:74 Program Rust
- default · traits.rs:116 Program Rust
- default · traits.rs:104 Program Rust
- default · traits.rs:119 Program Rust
- default · traits.rs:110 Program Rust
- default · traits.rs:113 Program Rust
- default · traits.rs:101 Program Rust
- from_u64 · dec2flt/mod.rs:263 Program Rust
- pow10_fast_path · dec2flt/mod.rs:222 Program Rust
- Dec2flt_modelNumImpTraitsFloatExtU64 · traits.rs:339 Program Rust
- EXP_MASK · traits.rs:321 Program Rust
- INFINITY · traits.rs:312 Program Rust
- NAN · traits.rs:314 Program Rust
- NEG_INFINITY · traits.rs:313 Program Rust
- NEG_NAN · traits.rs:317 Program Rust
- SIG_MASK · traits.rs:322 Program Rust
- classify · traits.rs:334 Program Rust
- to_bits · traits.rs:330 Program Rust
- read_u64 · dec2flt/common.rs:22 Program Rust
- write_u64 · dec2flt/common.rs:29 Program Rust
- Dec2flt_modelNumImpTraitsInt · traits.rs:51 Program Rust
- FloatErrorKind · num/mod.rs:18 Program Rust
- ParseFloatError · num/mod.rs:13 Program Rust
- Dec2FltAssemblyTrace · dec2flt/mod.rs:329 Program Rust
- Dec2FltTrace · dec2flt/mod.rs:295 Program Rust
- Lemire · dec2flt/mod.rs:115 Program Rust
- default · dec2flt/mod.rs:128 Program Rust
- default · dec2flt/mod.rs:121 Program Rust
- biased_fp_to_float · dec2flt/mod.rs:282 Program Rust
- ByteSlice · dec2flt/common.rs:4 Program Rust
- is_8digits · dec2flt/common.rs:44 Program Rust
- Decimal · dec2flt/decimal.rs:32 Program Rust
- try_fast_path · dec2flt/decimal.rs:59 Program Rust
- default · dec2flt/decimal_seq.rs:34 Program Rust
- MAX_DIGITS · dec2flt/decimal_seq.rs:64 Program Rust
- MAX_DIGITS_WITHOUT_OVERFLOW · dec2flt/decimal_seq.rs:67 Program Rust
- trim · dec2flt/decimal_seq.rs:83 Program Rust
- trim_loop · dec2flt/decimal_seq.rs:92 Program Rust
- body · dec2flt/decimal_seq.rs:92 Program Rust
- count_trailing_zeros · dec2flt/decimal_seq.rs:236 Program Rust
- count_trailing_zeros_loop · dec2flt/decimal_seq.rs:240 Program Rust
- body · dec2flt/decimal_seq.rs:240 Program Rust
- final_decimal_point · dec2flt/decimal_seq.rs:269 Program Rust
- number_of_digits_decimal_left_shift · dec2flt/decimal_seq.rs:375 Program Rust
- number_of_digits_decimal_left_shift_loop · dec2flt/decimal_seq.rs:441 Program Rust
- body · dec2flt/decimal_seq.rs:441 Program Rust
- parse_digits_into_seq · dec2flt/decimal_seq.rs:257 Program Rust
- parse_digits_into_seq_loop · dec2flt/decimal_seq.rs:259 Program Rust
- body · dec2flt/decimal_seq.rs:259 Program Rust
- full_multiplication · dec2flt/lemire.rs:126 Program Rust
- parse_inf_nan · dec2flt/parse.rs:244 Program Rust
- parse_partial_number · dec2flt/parse.rs:164 Program Rust
- parse_scientific · dec2flt/parse.rs:121 Program Rust
- parse_scientific_loop · dec2flt/parse.rs:145 Program Rust
- body · dec2flt/parse.rs:145 Program Rust
- pfe_empty · dec2flt/mod.rs:270 Program Rust
- pfe_invalid · dec2flt/mod.rs:277 Program Rust
- NUM_POWERS · dec2flt/slow.rs:29 Program Rust
- POWERS · dec2flt/slow.rs:30 Program Rust
- closure · dec2flt/slow.rs:33 Program Rust
- LARGEST_POWER_OF_FIVE · dec2flt/table.rs:10 Program Rust
- SMALLEST_POWER_OF_FIVE · dec2flt/table.rs:9 Program Rust
- CastInto · traits.rs:18 Program Rust
- FloatExt · traits.rs:170 Program Rust
- Int · traits.rs:27 Program Rust
- from_u64_bits · traits.rs:341 Program Rust
- integer_decode · traits.rs:348 Program Rust
- offset_from · dec2flt/common.rs:34 Program Rust
- Dec2flt_modelNumImpTraitsCastIntoI16 · traits.rs:45 Program Rust
- ONE · traits.rs:53 Program Rust
- ZERO · traits.rs:52 Program Rust
- try_add_digit · dec2flt/decimal_seq.rs:74 Program Rust
- TABLE · dec2flt/decimal_seq.rs:377 Program Rust
- TABLE_POW5 · dec2flt/decimal_seq.rs:386 Program Rust
- set_precision · dec2flt/fpu.rs:99 Program Rust
- adjust_many_digit_count · dec2flt/parse.rs:86 Program Rust
- adjust_many_digit_count_loop · dec2flt/parse.rs:89 Program Rust
- body · dec2flt/parse.rs:89 Program Rust
- parse_8digits · dec2flt/parse.rs:18 Program Rust
- parse_many_digits · dec2flt/parse.rs:104 Program Rust
- try_parse_digits · dec2flt/parse.rs:30 Program Rust
- try_parse_digits_loop0 · dec2flt/parse.rs:33 Program Rust
- body · dec2flt/parse.rs:33 Program Rust
- try_parse_digits_loop1 · dec2flt/parse.rs:50 Program Rust
- body · dec2flt/parse.rs:50 Program Rust
- cast · traits.rs:46 Program Rust
- MIN_19DIGIT_INT · dec2flt/parse.rs:8 Program Rust
- MASK · dec2flt/parse.rs:19 Program Rust
- MUL1 · dec2flt/parse.rs:20 Program Rust
- MUL2 · dec2flt/parse.rs:21 Program Rust
- try_parse_19digits · dec2flt/parse.rs:61 Program Rust
- try_parse_19digits_loop · dec2flt/parse.rs:64 Program Rust
- body · dec2flt/parse.rs:64 Program Rust
Standard-library dependencies (39)
- 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
- MANTISSA_DIGITS · core/src/num/f64.rs:412 Rust library
- 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
- 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_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
- CoreOpsArithDivF64F64 · core/src/ops/arith.rs:511 Rust library
- CoreOpsArithMulF64F64 · core/src/ops/arith.rs:344 Rust library
- CoreOpsArithNegF64 · core/src/ops/arith.rs:713 Rust library
- CoreMarkerCopy · core/src/marker.rs:57 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
- CoreCloneClone · core/src/clone.rs:696 Rust library
- CoreOpsBitBitAndU64U64 · core/src/ops/bit.rs:174 Rust library
- CoreOpsBitBitOrU64U64 · core/src/ops/bit.rs:278 Rust library
- CoreOpsBitShlU32U64 · core/src/ops/bit.rs:483 Rust library
- CoreOpsBitShrU32U64 · core/src/ops/bit.rs:606 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
- Dec2Flt.P340_T1_selected_target_numBits
- 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
- Binary64AdjacentNormalValues
- Binary64ApplySign
- Binary64EncoderCarryArithmetic
- Binary64ExactPositiveDivRounds
- Binary64ExactPositiveMulRounds
- Binary64FastPathGuard
All 298 entries
- Binary64AdjacentNormalValues
- Binary64ApplySign
- Binary64EncoderCarryArithmetic
- Binary64ExactPositiveDivRounds
- Binary64ExactPositiveMulRounds
- Binary64FastPathGuard
- Binary64FiniteMagnitudeStrictMono
- Binary64FromU64Exact
- Binary64IntPow10Index
- Binary64Model
- Binary64ModelDefault
- Binary64NativeCallDomain
- Binary64NearestEvenAssembly
- Binary64NormalEncoderRounds
- Binary64Pow10FastPathExact
- Binary64ZeroDivRounds
- Binary64ZeroMulRounds
- DecimalDigitLexScale
- DecimalDigitTrimDecomposition
- DecimalGoalVocabulary
- DecimalGoalVocabularyDefault
- DecimalLeftShiftDigitGrowth
- DecimalLeftShiftFirstLoopSemantics
- DecimalLeftShiftLoop1Execution
- DecimalLeftShiftLoopLex
- DecimalLeftShiftSecondLoopSemantics
- DecimalLeftShiftTableCertificate
- DecimalLexeme
- DecimalRightShiftU64DyadicBridge
- DecimalSeqBulkLaneSubtraction
- DecimalSeqDuplicateLoops
- DecimalSeqFractionalDigitInterval
- DecimalSeqLeadingZeroLoopExact
- DecimalSeqLeftShiftRecordSemantics
- DecimalSeqLittleEndianLane
- DecimalSeqRenderedSplit
- DecimalSeqRoundLoopPrefixCore
- DecimalSeqRoundLoopValue
- DecimalSeqTrailingZeroLoopExact
- DecimalSeqTrailingZeroValues
- DecimalSeqTrimSemantics
- DecimalSeqWriteU64Exact
- DispatchContracts
- F64
- F64 Insts CoreCloneClone
- F64 Insts CoreMarkerCopy
- F64 Insts CoreOpsArithDivF64F64
- F64 Insts CoreOpsArithMulF64F64
- F64 Insts CoreOpsArithNegF64
- F64 Insts Dec2flt modelNumImpDec2fltLemireU64
- F64 Insts Dec2flt modelNumImpDec2fltLemireU64 MAX EXPONENT DISGUISED FAST PATH
- F64 Insts Dec2flt modelNumImpDec2fltLemireU64 MAX EXPONENT FAST PATH
- F64 Insts Dec2flt modelNumImpDec2fltLemireU64 pow10 fast path
- F64 Insts Dec2flt modelNumImpTraitsFloatExtU64
- F64 Insts Dec2flt modelNumImpTraitsFloatExtU64 from u64 bits
- F64 Insts Dec2flt modelNumImpTraitsFloatExtU64 integer decode
- F64 Insts Dec2flt modelNumImpTraitsFloatU64
- F64 Insts Dec2flt modelNumImpTraitsFloatU64 BITS
- F64 Insts Dec2flt modelNumImpTraitsFloatU64 EXP MASK
- F64 Insts Dec2flt modelNumImpTraitsFloatU64 INFINITY
- F64 Insts Dec2flt modelNumImpTraitsFloatU64 LARGEST POWER OF TEN
- F64 Insts Dec2flt modelNumImpTraitsFloatU64 MAX EXPONENT ROUND TO EVEN
- F64 Insts Dec2flt modelNumImpTraitsFloatU64 MIN EXPONENT ROUND TO EVEN
- F64 Insts Dec2flt modelNumImpTraitsFloatU64 NAN
- F64 Insts Dec2flt modelNumImpTraitsFloatU64 NEG INFINITY
- F64 Insts Dec2flt modelNumImpTraitsFloatU64 NEG NAN
- F64 Insts Dec2flt modelNumImpTraitsFloatU64 SIG MASK
- F64 Insts Dec2flt modelNumImpTraitsFloatU64 SIG TOTAL BITS
- F64 Insts Dec2flt modelNumImpTraitsFloatU64 SMALLEST POWER OF TEN
- F64 Insts Dec2flt modelNumImpTraitsFloatU64 classify
- F64 Insts Dec2flt modelNumImpTraitsFloatU64 to bits
- IntegerPowerFiniteCertificate
- IntegerPowerRealBridge
- IntegerPowerTableCertificate
- ModelF64Classify
- ModelF64Clone
- ModelF64Div
- ModelF64ExponentMask
- ModelF64FromBits
- ModelF64FromU64
- ModelF64Infinity
- ModelF64MantissaDigits
- ModelF64MantissaMask
- ModelF64Mul
- ModelF64Nan
- ModelF64Neg
- ModelF64NegInfinity
- ModelF64ToBits
- ModelOptionBranch
- ModelOptionFromResidual
- ModelSliceFirst
- ModelSliceSplitFirst
- ModelStrAsBytes
- ModelU64BitAnd
- ModelU64BitOr
- ModelU64Shl
- ModelU64Shr
- ModelU8IsAsciiDigit
- NearestEvenOrderedGrid
- NumberHelperDecimalPrefixInterval
- NumberHelperDigitScanSourceLength
- NumberHelperEightDigitWord
- NumberHelperEightDigitWordAccepted
- NumberHelperParseEightDigitsSafe
- NumberHelperReadEightBytes
- NumberHelperScientificClassificationSourceLength
- NumberHelperScientificPrefixSafeLength
- NumberHelperSplitExponentSuffix
- NumberHelperTryParse19SafeLength
- NumberHelperRejection
- P14 FiniteMagnitudeZero
- P14 NativeDivideRounding
- P14 NativeMultiplyRounding
- P14 NativeTotality
- NumberHelperAdjustCountExact
- NumberHelperDigitPrefix
- NumberHelperOffsetSourceLength
- NumberHelperAdjustmentA
- NumberHelperExponentAddA
- NumberHelperFractionalRetryA
- NumberHelperIntegralRetryA
- NumberHelperPartialNormalA
- NumberHelperScientificScan
- NumberHelperWholeClassificationA
- ByteValueBlocks
- DigitDecoding
- DigitPrefixUnique
- PartialLexicalCertificateA
- RenderedDigitBlocks
- SignificandScanA
- DecimalRightShiftFinalLoopSemantics
- DecimalRightShiftLoop0Execution
- DecimalRightShiftMainLoopSemantics
- DecimalRightShiftPrefixLoopSemantics
- DecimalSeqDyadicShiftSemantics
- DecimalSeqRightShiftRecordSemantics
- DecimalValueBounds
- LoopZeroRightShiftTransport
- BulkLoopExact
- BulkMixedStop
- BulkStepExact
- DecimalSeqReconstruction
- DigitRunExact
- ExponentSuffix
- FillExact
- FinalizationExact
- RightLoopStep
- RightPrefixLengthBounds
- RightShiftCanonical
- ScalarScanExact
- SignificandScan
- SlowLoop0Execution
- TrailingCount
- CarryRoundExecution
- EncodingArithmetic
- FinalShiftCertificate
- LeftHistoryBoundary
- LeftLeadingProgress
- LeftLoopStep
- LeftShiftCertificate
- Loop1Execution
- Loop2Execution
- NormalizationBounds
- ReachableCapacity
- RegularSlowExecution
- RightBoundaryTransport
- RightHistoryBoundary
- RoundArbitraryEndpoint
- SeparationPackage
- FullMultiplicationExecution
- IntegerExecution
- PrefixRealization
- ProductApproximationExecution
- SlowExecution
- GridAlignment
- GridBoundaryRetained
- LeftBoundaryTransport
- ParserFactorization
- DecimalFoldBounds
- LeftShiftPointGrowth
- PointZeroGrowth
- SelectedLeftGrowth
- NormalRoundingExecution
- ProductTailExecution
- ExponentLowerBound
- PowerGridAlignment
- ResultLoopBackward
- DecodedRuns
- FinishOnNormalA
- PartialContinuationA
- PartialRunForwardA
- PartialRunReverseA
- LeftCoefficientTransport
- LeftHistoryInvariant
- LeftStepPotential
- CoefficientGridAlignment
- DecimalBinaryExponentBound
- LeftLoopBudgetTransition
- AbstractComponents
- ActualDispatchOperations
- DispatchCall
- DispatchOperations
- FinalPointArithmetic
- FinalPointExact
- NormalComponentRefinement
- ReachedDispatchCall
- ScientificLoopFold
- ScientificScannerFold
- ScientificVocabularyFold
- ParserExponentConstants
- PositiveScaleErrorTransport
- Preamble
- ResultLoopPartial
- SliceU8 Insts Dec2flt modelNumImpDec2fltCommonByteSlice offset from
- SliceU8 Insts Dec2flt modelNumImpDec2fltCommonByteSlice read u64
- SliceU8 Insts Dec2flt modelNumImpDec2fltCommonByteSlice write u64
- SlowShiftSelectorCertificate
- SourceValidByteSlice
- U64 Insts CoreOpsBitBitAndU64U64
- U64 Insts CoreOpsBitBitOrU64U64
- U64 Insts CoreOpsBitShlU32U64
- U64 Insts CoreOpsBitShrU32U64
- U64 Insts Dec2flt modelNumImpTraitsCastIntoI16
- U64 Insts Dec2flt modelNumImpTraitsCastIntoI16 cast
- U64 Insts Dec2flt modelNumImpTraitsInt
- U64 Insts Dec2flt modelNumImpTraitsInt ONE
- U64 Insts Dec2flt modelNumImpTraitsInt ZERO
- core num FpCategory
- core ops arith Div
- core ops arith Mul
- core ops arith Neg
- core ops bit BitOr
- core ops bit Shl
- core ops bit Shr
- num imp dec2flt Lemire
- num imp dec2flt Lemire MAX MANTISSA FAST PATH default
- num imp dec2flt biased fp to float
- num imp dec2flt common BiasedFp
- num imp dec2flt common BiasedFp Insts CoreCmpPartialEqBiasedFp eq
- num imp dec2flt common BiasedFp zero pow2
- num imp dec2flt common is 8digits
- num imp dec2flt decimal Decimal
- num imp dec2flt decimal Decimal can use fast path
- num imp dec2flt decimal Decimal try fast path
- num imp dec2flt decimal INT POW10
- num imp dec2flt decimal seq DecimalSeq
- num imp dec2flt decimal seq DecimalSeq DECIMAL POINT RANGE
- num imp dec2flt decimal seq DecimalSeq Insts CoreDefaultDefault default
- num imp dec2flt decimal seq DecimalSeq MAX DIGITS
- num imp dec2flt decimal seq DecimalSeq MAX DIGITS WITHOUT OVERFLOW
- num imp dec2flt decimal seq DecimalSeq left shift
- num imp dec2flt decimal seq DecimalSeq right shift
- num imp dec2flt decimal seq DecimalSeq round
- num imp dec2flt decimal seq DecimalSeq trim
- num imp dec2flt decimal seq DecimalSeq try add digit
- num imp dec2flt decimal seq count trailing zeros
- num imp dec2flt decimal seq final decimal point
- num imp dec2flt decimal seq number of digits decimal left shift
- num imp dec2flt decimal seq number of digits decimal left shift TABLE
- num imp dec2flt decimal seq number of digits decimal left shift TABLE POW5
- num imp dec2flt decimal seq parse decimal seq
- num imp dec2flt decimal seq parse digits into seq
- num imp dec2flt fpu fpu precision set precision
- num imp dec2flt lemire compute float
- num imp dec2flt lemire compute product approx
- num imp dec2flt lemire full multiplication
- num imp dec2flt lemire power
- num imp dec2flt parse MIN 19DIGIT INT
- num imp dec2flt parse adjust many digit count
- num imp dec2flt parse parse 8digits
- num imp dec2flt parse parse 8digits MASK
- num imp dec2flt parse parse 8digits MUL1
- num imp dec2flt parse parse 8digits MUL2
- num imp dec2flt parse parse inf nan
- num imp dec2flt parse parse many digits
- num imp dec2flt parse parse number
- num imp dec2flt parse parse partial number
- num imp dec2flt parse parse scientific
- num imp dec2flt parse try parse 19digits
- num imp dec2flt parse try parse digits
- num imp dec2flt slow parse long mantissa
- num imp dec2flt slow parse long mantissa MAX SHIFT
- num imp dec2flt slow parse long mantissa NUM POWERS
- num imp dec2flt slow parse long mantissa POWERS
- num imp dec2flt slow parse long mantissa closure
- num imp dec2flt slow parse long mantissa closure Insts CoreOpsFunctionFnTupleUsizeUsize call
- num imp dec2flt table LARGEST POWER OF FIVE
- num imp dec2flt table POWER OF FIVE 128
- num imp dec2flt table SMALLEST POWER OF FIVE
- num imp traits CastInto
- num imp traits Float
- num imp traits FloatExt
- num imp traits Float EXP BIAS default
- num imp traits Float EXP BITS default
- num imp traits Float EXP MIN default
- num imp traits Float EXP SAT default
- num imp traits Float SIG BITS default
- num imp traits Int
Technical checking records
Local closure summary
{
"node": "P661_T1_PrefixRealization",
"closure_version": "patch_c_v1",
"active_decl_hash": "811a580ece8f46b0a005c2488c76d0458bfe3ad4b1f0a689f155c0601c6e792f",
"active_statement_hash": "80a53e44a0d7353a8ea709eb38f464880043012819dc45642654906e89e67587",
"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-200",
"boundary_theorems": {},
"strict_theorem_deps": {
"DispatchContracts": "b6ed9d0f697e9dae",
"P13_T1_NumberHelperRejection": "77aedd7d8ab343e5",
"P14_NativeTotality": "bbfd684653fd44e9",
"P661_T1_IntegerExecution": "f47cf18e3a47b353",
"P661_T1_SlowExecution": "63a003146e72572b",
"P9_T1_NormalComponentRefinement": "367fb70d3dfcfbe1"
},
"strict_definition_deps": {
"DecimalGoalVocabulary": "f76c8174a4d58eb5",
"DecimalGoalVocabularyDefault": "71a18a6c119a3cdc",
"DecimalLexeme": "c43614ff2149ecf2",
"DispatchContracts": "008abfbd503545bf",
"F64": "ec4e25fbaf4e11d4",
"P9_T1_AbstractComponents": "0a7e8b7bdbce0180",
"P9_T1_ActualDispatchOperations": "d8bf51ebbbf153ac",
"P9_T1_DispatchCall": "c43614ff2149ecf2",
"P9_T1_DispatchOperations": "c19c8cebc80456e0",
"P9_T1_NormalComponentRefinement": "008abfbd503545bf",
"P9_T1_ReachedDispatchCall": "e52ea6e8d614c46e",
"SourceValidByteSlice": "3dc42716a6378d26",
"num_imp_dec2flt_common_BiasedFp": "31d81cf1cf22709f",
"num_imp_dec2flt_common_BiasedFp_Insts_CoreCmpPartialEqBiasedFp_eq": "fbbf553e3c502a05",
"num_imp_dec2flt_decimal_Decimal": "4da4ccbe640ef8e6"
}
}Prose assessment
{
"label": "Recorded Sound: VerifierPass",
"assessment_status": "VerifierPass",
"fingerprint_relation": "matches current fingerprint",
"assessment_fingerprint": "sound-v2:67b848e67fe6e24854a6b6adad906b72edbf7d7ac63caec63bad0b31ecac3665",
"current_fingerprint": "sound-v2:67b848e67fe6e24854a6b6adad906b72edbf7d7ac63caec63bad0b31ecac3665",
"superseded_for_theorem_closure": false
}Review verdicts
{
"corr_status": "Pass",
"sound_status": "Pass",
"substantiveness_status": "Pass"
}