num_imp_dec2flt_parse_parse_inf_nan

Lean checked

Definition and explanation

This explanation was written alongside the formalization to describe the statement and its reasoning.

No paired prose available.

Lean definition

This module includes declarations linked to the Aeneas extraction. The source view pairs each matched declaration with its Rust input.

import Tablet.Assumptions
import Tablet.Preamble
import Tablet.SliceU8_Insts_Dec2flt_modelNumImpDec2fltCommonByteSlice_read_u64
import Tablet.num_imp_traits_Float
open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false
noncomputable section
namespace dec2flt_model

-- [TABLET NODE: num_imp_dec2flt_parse_parse_inf_nan]
/-- [dec2flt_model::num::imp::dec2flt::parse::parse_inf_nan]:
    Source: 'num/imp/../../dec2flt/parse.rs', lines 241:0-284:1 -/
def num.imp.dec2flt.parse.parse_inf_nan
  {F : Type} {Clause0_Int : Type} (traitsFloatInst : num.imp.traits.Float F
  Clause0_Int) (s : Slice Std.U8) (negative : Bool) :
  Result (Option F)
  :=
-- BODY
do
  let i := Slice.len s
  if i = 8#usize
  then
    let register ←
      SliceU8.Insts.Dec2flt_modelNumImpDec2fltCommonByteSlice.read_u64 s
    let register1 ← lift (register &&& 16131858542891098079#u64)
    match register1 with
    | 4607561#uscalar => ok none
    | 6436850368004902473#uscalar =>
      let float ← traitsFloatInst.INFINITY
      if negative
      then let t ← traitsFloatInst.coreopsarithNegInst.neg float
           ok (some t)
      else ok (some float)
    | 5128526#uscalar => ok none
    | _ => ok none
  else
    let i1 := Slice.len s
    if i1 = 3#usize
    then
      let i2 ← Slice.index_usize s 0#usize
      let a ← lift (UScalar.cast .U64 i2)
      let i3 ← Slice.index_usize s 1#usize
      let b ← lift (UScalar.cast .U64 i3)
      let i4 ← Slice.index_usize s 2#usize
      let c ← lift (UScalar.cast .U64 i4)
      let i5 ← c <<< 16#i32
      let i6 ← b <<< 8#i32
      let i7 ← lift (i5 ||| i6)
      let register ← lift (i7 ||| a)
      let register1 ← lift (register &&& 16131858542891098079#u64)
      match register1 with
      | 4607561#uscalar =>
        let float ← traitsFloatInst.INFINITY
        if negative
        then
          let t ← traitsFloatInst.coreopsarithNegInst.neg float
          ok (some t)
        else ok (some float)
      | 6436850368004902473#uscalar => ok none
      | 5128526#uscalar =>
        let float ← traitsFloatInst.NAN
        if negative
        then
          let t ← traitsFloatInst.coreopsarithNegInst.neg float
          ok (some t)
        else ok (some float)
      | _ => ok none
    else ok none
Preservation and explanation

Natural-language argument

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.

The authored explanation is included with the statement above.

Download Lean source · Download TeX source

Proof structure

Follow the declared dependencies to read the supporting statements and proofs.

Explore this dependency tree

Inspect related source (46)
More program dependencies (13)
Standard-library dependencies (30)

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

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
All 12 entries
Technical checking records
Local closure summary
{
  "node": "num_imp_dec2flt_parse_parse_inf_nan",
  "closure_version": "patch_c_v1",
  "active_decl_hash": "9fe3443ee47f4a40f6e43153e6485967ed9b0f51d6ecd376373da010ef7aa07d",
  "active_statement_hash": "",
  "kernel_axioms": [
    "Classical.choice",
    "Quot.sound",
    "propext"
  ],
  "toolchain_hash": "ce4c4e3d87434b9663f46de25ce34b48a0cf0d392e0a320a0787b4674a2d7b61",
  "lean_executable_hash": "3e0d0d3d801675359f2d4cf9815bfdb417b20b92fdd9d48b3b14c95bbae28bbf",
  "checker_script_hash": "c8e4a03273e23b9a8f2e141020652a4e0b7b0a8ab0883366ea9d031ca3f37aa1",
  "approved_axioms_hash": "d5c04ffa333d9b33b238a527f5beaa2be82e021d3e9c0bbe01b1310280f7f55a",
  "axcheck_status": "Agreed",
  "accepted_at_snapshot_id": "worker-result-local-closure-issuance-cycle-23",
  "boundary_theorems": {},
  "strict_theorem_deps": {},
  "strict_definition_deps": {
    "SliceU8_Insts_Dec2flt_modelNumImpDec2fltCommonByteSlice_read_u64": "279b0c1cd8ec9e39",
    "core_ops_arith_Neg": "0ff07135a60bcbf9",
    "num_imp_traits_Float": "062e1d14cad682f2"
  }
}
Prose assessment
{
  "label": "Prose review has no verdict in this snapshot",
  "assessment_status": null,
  "fingerprint_relation": "unknown",
  "assessment_fingerprint": null,
  "current_fingerprint": null,
  "superseded_for_theorem_closure": false
}
Review verdicts
{}