Machine-Checked Equivalence and Network Compression for Structure-Preserving Compilation: A Lean 4 Formalization of the Xinanjiang Model

Structure-preserving compilation can represent conceptual hydrological models as recurrent computational networks without learning their governing equations from data. However, numerical agreement alone does not establish semantic equivalence. This study formalizes a simplified three-source Xinanjiang model in Lean 4 and Mathlib and develops verified network simplification. The reference conditional program and its handwired network are represented as real-valued state transitions. Local algebraic identities, explicit range certificates, and invariant-based reasoning establish componentwise equivalence and extend it to admissible forcing sequences. A discontinuity theorem identifies a limitation of exact compilation using exclusively continuous operators on the formalized domain. An analytical solution of the three linear routing recurrences separates a four-state nonlinear core from linear filters. Manual rewrites reduce the computational graph from 93 to 59 nodes, 117 to 78 edges, and 25 to 17 rectified linear units (ReLUs), while retaining one Step and four power operators. The maximum reported discharge deviation in a 1400-step synthetic experiment is 1.44 × 10−12 m3/s; 400 randomized parameter stress tests yield a maximum relative deviation of 2.6 × 10−15. Formalization motivates tightening the gating constant from 109 to 1024 and correcting a lower-layer evaporation expression. A verified graph optimizer further reduces a separately counted 79-node wiring graph to a 52-node rewrite normal form, including nine inputs. These results distinguish exact real-arithmetic equivalence from empirical floating-point agreement and provide an auditable foundation for embedding process-based hydrological models in hybrid learning architectures.

Authors

Publication Details

Journal
Preprints.org
Published
2026-12-02
DOI
https://doi.org/10.20944/preprints202612.0183.v1
Primary Topic
Logic, programming, and type systems
Type
preprint
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
NOV
preprint

Machine-Checked Equivalence and Network Compression for Structure-Preserving Compilation: A Lean 4 Formalization of the Xinanjiang Model

Haibin Tong, Ruonan Hao, Lei Ju, Liangliang Xin
Preprints.org
Logic, programming, and type systems
preprint

Machine-Checked Equivalence and Network Compression for Structure-Preserving Compilation: A Lean 4 Formalization of the Xinanjiang Model

Haibin Tong, Ruonan Hao, Lei Ju, Liangliang Xin
preprint en

Abstract

Structure-preserving compilation can represent conceptual hydrological models as recurrent computational networks without learning their governing equations from data. However, numerical agreement alone does not establish semantic equivalence. This study formalizes a simplified three-source Xinanjiang model in Lean 4 and Mathlib and develops verified network simplification. The reference conditional program and its handwired network are represented as real-valued state transitions. Local algebraic identities, explicit range certificates, and invariant-based reasoning establish componentwise equivalence and extend it to admissible forcing sequences. A discontinuity theorem identifies a limitation of exact compilation using exclusively continuous operators on the formalized domain. An analytical solution of the three linear routing recurrences separates a four-state nonlinear core from linear filters. Manual rewrites reduce the computational graph from 93 to 59 nodes, 117 to 78 edges, and 25 to 17 rectified linear units (ReLUs), while retaining one Step and four power operators. The maximum reported discharge deviation in a 1400-step synthetic experiment is 1.44 × 10−12 m3/s; 400 randomized parameter stress tests yield a maximum relative deviation of 2.6 × 10−15. Formalization motivates tightening the gating constant from 109 to 1024 and correcting a lower-layer evaporation expression. A verified graph optimizer further reduces a separately counted 79-node wiring graph to a 52-node rewrite normal form, including nine inputs. These results distinguish exact real-arithmetic equivalence from empirical floating-point agreement and provide an auditable foundation for embedding process-based hydrological models in hybrid learning architectures.

Preprints.org
Logic, programming, and type systems
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Laika access coming soon