Submitted:
01 December 2026
Posted:
02 December 2026
You are already at the latest version
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.
Keywords:
conceptual hydrological modeling
; structure-preserving compilation
; formal verification
; Lean 4
; recurrent neural network
; semantic equivalence
; Xinanjiang model
; graph optimization
Copyright: This open access article is published under a Creative Commons CC BY 4.0 license, which permit the free download, distribution, and reuse, provided that the author and preprint are cited in any reuse.