Skip to content

v3.1.0 — glTF 2.1 (draft) support + Lean 4 formal verification

Latest

Choose a tag to compare

@syoyo syoyo released this 07 Nov 09:06

Highlights

glTF 2.1 (draft) support

  • GLB container version 3 with 64-bit chunk lengths (read by default; written only with tg3_write_options.write_glb_64bit).
  • Draft glTF 2.1 items: id, files, thumbnails, and the promoted-extension names.
  • Everything 2.1-specific is marked TG3_GLTF21_UNSTABLE; reading a GLB v3 container emits a warning. glTF 2.1 is not a ratified Khronos specification and may change incompatibly.

Lean 4 formalization and machine-checked verification

  • Lean 4 specification of the validation rules and GLB container framing.
  • MiniC: a small operational semantics for the C subset used by the verified core of tiny_gltf_v3.c, plus a translator from the real C source (via clang's typed AST).
  • Machine-checked refinement proofs — for every input, the translated C has no undefined behaviour, terminates, and returns the specified result. Current coverage:
    • T1 (GLB): tg3__glb_frame_parse, tg3__wr_u32le / tg3__wr_u64le, tg3__glb_write_magic, tg3__glb_write_header32/64, tg3__glb_write_headers, and tg3__glb_layout (glb_layout_correct).
    • T3 helpers: tg3_component_size, tg3_num_components, tg3__b64_decoded_len, tg3__b64_decode_char.
    • T2 validation masks (started): tg3__spec_buffer_mask, tg3__spec_skin_mask.
  • No sorry; every theorem depends only on Lean's standard axioms (propext, Classical.choice, Quot.sound). No Mathlib, no native_decide, no bv_decide.
  • See formal/README.md for the status table and build instructions.

Validation and hardening

  • Post-parse index-bounds and byte-range validation is default-on (tg3_parse_options.validate_indices / validate_ranges to opt out).
  • TG3_PERMISSIVE (warnings) / TG3_STRICT (errors) strictness levels; tg3_validate() checks hand-built models with the same rules.
  • GLB v3 out-of-bounds and size-overflow fixes.
  • New regression tests and a CI job for the Lean verification.

Changes since v3.0.1

  • Add Lean 4 formalization, MiniC semantics, C-to-Lean translator, and T1 parse/writer proofs.
  • Complete T1 GLB layout and header-writer proofs.
  • Land T3 component/base64 helper proofs and start T2 validation-mask proofs.
  • Add glTF 2.1 (draft) GLB v3 support and mark 2.1 items spec-unstable.
  • Refactor validation: default-on index/range checks, strictness levels, tg3_validate().
  • Extend the translator for switch statements, string literals, memcmp/strlen, and pointer loads.
  • Add regression tests, CI formal-verification job, and documentation updates.

Full changelog: v3.0.1...v3.1.0