Papers
Topics
Authors
Recent
Search
2000 character limit reached

Walnut: Theorem Prover & Diverse Applications

Updated 7 July 2026
  • Walnut is an open-source automata-based theorem prover that decides first-order logic over automatic sequences by compiling formulas into finite automata.
  • It uses a clear, mathematical input language and automata operations such as product, complement, and projection to handle logical constructs efficiently.
  • Beyond theorem proving, Walnut is applied in systems security, NLP benchmarks, agricultural water-stress mapping, and network community analysis.

to=arxiv_search.query 天天中彩票为什么? 乐亚რგuments as_json=true ವಿಷಯ={"query":"Walnut arXiv theorem prover automatic sequences software", "max_results": 5} to=arxiv_search.search 北京赛车的ીക്കം 不中反json=true arguments={"query":"Walnut theorem prover automatic sequences", "max_results": 10, "sort_by":"relevance"} to=arxiv_search 《凤凰大参考json=true arguments={"query":"Walnut theorem prover automatic sequences", "max_results": 10} Walnut is used in recent arXiv literature for several unrelated research objects. The best-known technical sense is an open-source, automata-based theorem prover for deciding first-order statements about automatic sequences; other uses include a low-trust trigger-action platform, a semi-weakly supervised learning benchmark for natural language understanding, a UAV-and-machine-learning workflow for walnut water-stress mapping, and the “walnut” structure identified in the Japanese production network (Mousavi, 2016, Schoettler et al., 2020, Zheng et al., 2021, Wang et al., 2023, Chakraborty et al., 2018).

1. Walnut as an automata-based theorem prover

In combinatorics on words and automata theory, Walnut is an open-source Java package that implements a mechanical decision procedure for a large fragment of first-order logic over the natural numbers enriched with one or more automatic sequences (Mousavi, 2016). Its core mathematical object is the kk-automatic sequence: a sequence (an)n0(a_n)_{n\ge0} over a finite alphabet Δ\Delta is kk-automatic if there exists a deterministic finite automaton with output (DFAO)

M=(Q,Σk,δ,q0,Δ,τ)M=(Q,\Sigma_k,\delta,q_0,\Delta,\tau)

such that whenever the base-kk expansion of nn is (d1d2dr)k(d_1d_2\cdots d_r)_k, the run of MM on d1d2drd_1d_2\cdots d_r ends in a state (an)n0(a_n)_{n\ge0}0 with (an)n0(a_n)_{n\ge0}1 (Machacek, 2022).

The logical fragment supported by Walnut is the first-order theory of (an)n0(a_n)_{n\ge0}2 extended by indexed predicates of the form (an)n0(a_n)_{n\ge0}3 (Machacek, 2022). In the broader presentation of the system, the decidable structure is described as first-order logic over (an)n0(a_n)_{n\ge0}4 enriched with automatic sequences, arithmetic expressions built from (an)n0(a_n)_{n\ge0}5 for constant (an)n0(a_n)_{n\ge0}6, comparisons, indexing into automatic words, and previously defined automata called as predicates (Mousavi, 2016). Built-in numeration systems include binary MSD/LSD and Fibonacci, and users can define new number systems, new automatic words, or import arbitrary automata (Mousavi, 2016).

This formulation makes Walnut a theorem prover in a precise automata-theoretic sense: it does not reason by symbolic proof search in the style of interactive proof assistants, but instead compiles logical formulas to finite automata and decides them by standard automaton operations (Machacek, 2022).

2. Decision procedure, syntax, and command language

Walnut proceeds structurally on formulas. A query is parsed into an abstract syntax tree; atomic predicates such as (an)n0(a_n)_{n\ge0}7 or (an)n0(a_n)_{n\ge0}8 are converted into small automata; conjunction and disjunction are handled by synchronous product and union; negation is handled by complement; existential quantification is implemented by projection; and universal quantification is reduced to the negation of an existential statement, so validity and counterexample search reduce to emptiness checking (Machacek, 2022). In the formal account of the software architecture, conjunction/disjunction correspond to intersection/union, negation to complementation after totalization, and existential quantification to delete-tape projection followed by determinization, minimization, and recovery of zero-representations (Mousavi, 2016).

Walnut’s input language is close to mathematical notation. In the syntax summarized for combinatorics-on-words applications, A denotes (an)n0(a_n)_{n\ge0}9, E denotes Δ\Delta0, & denotes Δ\Delta1, | denotes Δ\Delta2, ~ denotes Δ\Delta3, => denotes Δ\Delta4, and indexing is written in the form W[i] = @a (Machacek, 2022). The REPL-level command set includes eval, def, reg, macro, and load; outputs can be exported as .gv, .txt, _log.txt, _detailed_log.txt, and optionally .mpl (Mousavi, 2016).

A representative Walnut session for factor comparison and Ziv–Lempel factorization uses definitions of the form (Jahannia et al., 2024): MM1

For closed formulas Walnut reports TRUE or FALSE; when free variables remain, it returns the minimized automaton accepting exactly the tuples that satisfy the formula (Mousavi, 2016). The design philosophy emphasized in later presentations is clarity of specification, reuse of off-the-shelf automata-theoretic algorithms, and extensibility via morphisms, images, and built-in operations (Machacek, 2022).

3. Mathematical applications of Walnut

Walnut has been used extensively in combinatorics on words. In work on partial words, it was used both to prove new results and to reprove old results on avoiding squares and cubes. The reported results include an infinite binary partial word with holes avoiding all squares of order Δ\Delta5, an infinite partial word avoiding squares of order Δ\Delta6 and antisquares of order Δ\Delta7, tables of extremal partial words with one hole containing bounded numbers of distinct squares and antisquares, and machine-checked proofs for hole-sparsity constructions avoiding non-trivial squares or cubes (Machacek, 2022).

In studies of factorization of automatic sequences, Walnut was used to verify Ziv–Lempel and Crochemore factorizations for Fibonacci, Thue–Morse, period-doubling, Rudin–Shapiro, paper-folding, and Mephisto-Waltz words. The method is explicit: one defines predicates for factor equality and for the factorization condition, guesses a regular expression for the position-length pairs Δ\Delta8, and asks Walnut to certify that the guessed regular language implies the desired factorization property (Jahannia et al., 2024). A central limitation is stated plainly: Walnut does not discover the factorization on its own; candidate discovery remains manual (Jahannia et al., 2024).

The theorem prover has also been extended beyond ordinary base-Δ\Delta9 arithmetic. By adding base kk0 representations, Walnut can quantify over kk1 rather than kk2, thereby supporting bi-infinite automatic sequences. The extension introduces the modes ?msd_neg_k and ?lsd_neg_k together with the commands split, rsplit, and join, and it was used to reprove and strengthen results of Shevelev and to reprove Shur’s result on bi-infinite binary words (Shallit et al., 2022).

Further developments expanded Walnut’s reach to transductions of automatic sequences, generalized numeration systems, additive complexity, congruence properties, OEIS problems, and combinatorial game theory. Dekking-style transduction was implemented directly in Walnut and applied to problems including representations of kk3 as a sum of three squares, overlap-free Dyck words, and iterated running sums of Thue–Morse (Shallit et al., 2023). Additive complexity computations were expressed via synchronized prefix counts, factor counts, additive-equivalence predicates, and the semigroup-trick algorithm, yielding exact DFAO descriptions for examples such as the ternary Thue–Morse word and the Tribonacci word (Popoli et al., 2024). Other work used Walnut to resolve open problems from the OEIS, to verify congruence properties of Catalan and Motzkin numbers modulo prime powers, to check properties of Zeckendorf and Chung–Graham representations, and to certify P-position characterizations in variants of Wythoff’s game (Bosma et al., 6 Mar 2025, Rampersad et al., 2021, Burns, 8 Jul 2025, Renard et al., 12 Dec 2025).

4. Complexity, performance, and limitations

The algorithmic cost profile of Walnut is governed by standard automata operations. Cross-product of an kk4-state and an kk5-state automaton produces kk6 states; determinization can blow up exponentially in the number of states; minimization of a kk7-state DFA can be done in kk8 time via Valmari’s algorithm; and the overall translation from a formula of quantifier depth kk9 and subformula size M=(Q,Σk,δ,q0,Δ,τ)M=(Q,\Sigma_k,\delta,q_0,\Delta,\tau)0 may be non-elementary in M=(Q,Σk,δ,q0,Δ,τ)M=(Q,\Sigma_k,\delta,q_0,\Delta,\tau)1, matching known lower bounds for Presburger arithmetic (Mousavi, 2016).

Empirical reports in the literature reflect both tractability and blow-up. In the partial-word study, the automaton for avoiding squares of order M=(Q,Σk,δ,q0,Δ,τ)M=(Q,\Sigma_k,\delta,q_0,\Delta,\tau)2 in the full-word case had 217 states and built in 10 ms, while the analogous partial-word case had 229 states and took 24 ms (Machacek, 2022). In the factorization study, final emptiness checks ran in a fraction of a second to a few seconds on a standard laptop, and the resulting automata had at most a few hundred states (Jahannia et al., 2024). In work on Wythoff variants, however, the absorbing check for M=(Q,Σk,δ,q0,Δ,τ)M=(Q,\Sigma_k,\delta,q_0,\Delta,\tau)3 exceeded M=(Q,Σk,δ,q0,Δ,τ)M=(Q,\Sigma_k,\delta,q_0,\Delta,\tau)4 states (Renard et al., 12 Dec 2025).

The limitations are correspondingly concrete. Some morphic constructions lead to automata of enormous size, on the order of hundreds of gigabytes, and can exceed practical memory limits (Machacek, 2022). Mixed MSD/LSD quantification is only partially supported (Mousavi, 2016). Candidate discovery in factorization problems remains manual (Jahannia et al., 2024). Parameterized theorems in M=(Q,Σk,δ,q0,Δ,τ)M=(Q,\Sigma_k,\delta,q_0,\Delta,\tau)5 for terminal-position Wythoff variants cannot yet be proved uniformly; M=(Q,Σk,δ,q0,Δ,τ)M=(Q,\Sigma_k,\delta,q_0,\Delta,\tau)6 must be fixed (Renard et al., 12 Dec 2025). Suggested extensions include native support for holes, specialized algorithms for tree-like or hierarchical morphisms, symbolic or BDD-based representations, and parallelized or on-the-fly emptiness and projection procedures (Machacek, 2022).

5. Walnut in systems security and machine learning

A distinct systems paper uses Walnut as the name of a low-trust trigger-action platform in the spirit of IFTTT (Schoettler et al., 2020). Its architecture splits the platform across two administrative domains, each hosting one general-purpose machine and three TEEs from different vendors. Applets contain a trigger specification, an action specification, and filterCode; setup uses ECIES encryption and XOR-based secret-sharing of setup-time action-input blocks; trigger polling occurs every 15 minutes; action generation uses either Yao’s generic two-party secure computation protocol or a custom string_sub routine specialized to placeholder substitution; and action execution is accepted only if the required signatures verify (Schoettler et al., 2020).

The stated security goals are confidentiality of user data and correctness of computation under both passive and active adversary models (Schoettler et al., 2020). The evaluation reports, relative to a non-secure baseline, platform-side CPU overhead of M=(Q,Σk,δ,q0,Δ,τ)M=(Q,\Sigma_k,\delta,q_0,\Delta,\tau)7 and network overhead of M=(Q,Σk,δ,q0,Δ,τ)M=(Q,\Sigma_k,\delta,q_0,\Delta,\tau)8 for string-substitution applets, with worst-case overheads of M=(Q,Σk,δ,q0,Δ,τ)M=(Q,\Sigma_k,\delta,q_0,\Delta,\tau)9 CPU and kk0 network when Yao’s protocol is needed for custom code (Schoettler et al., 2020). The same paper states that approximately kk1 of IFTTT applets fall into the cheap string-substitution category and that the prototype was open-sourced and tested on 30 applets (Schoettler et al., 2020).

In machine learning, WALNUT denotes the “semi-WeAkly supervised Learning for Natural language Understanding Testbed,” a benchmark for weak supervision in NLU (Zheng et al., 2021). It contains eight tasks, partitioned into document-level tasks and token-level tasks, with each task providing a small clean set and a large weakly labeled set generated by multiple real-world weak sources (Zheng et al., 2021). Baselines include clean-only training, weak-only training, clean-plus-weak training, and advanced semi-weak methods such as GLC, MetaWN, and MLC; evaluated encoders include BiLSTM with 50-dim GloVe, DistilBERT-base, BERT-base, BERT-large, RoBERTa-base, and RoBERTa-large (Zheng et al., 2021). The reported average micro-F1 values across the eight tasks are kk2 for clean only, kk3 for weak only with majority voting, kk4 for weak only with Snorkel, kk5 for clean-plus-weak with majority voting, kk6 for clean-plus-weak with Snorkel, kk7 for GLC, kk8 for MetaWN, and kk9 for the full-clean ceiling (Zheng et al., 2021). The benchmark highlights that weak supervision benefits smaller models more than larger pre-trained encoders, and that document-level tasks tend to benefit more than token-level NER tasks (Zheng et al., 2021).

6. Agricultural and network-science usages

In agricultural remote sensing, “walnut” refers literally to walnut orchards. A UAV-based workflow for mapping walnut water stress integrates multispectral and thermal imagery with weather data to predict stem water potential (SWP) via Random Forest models (Wang et al., 2023). Over the 2017 and 2018 growing seasons, five midday flights were conducted above a commercial walnut block near UC Davis using a DJI Matrice 100 carrying a MicaSense RedEdge camera with seven spectral bands: blue, green, panchromatic, red, red-edge, near-infrared, and long-wave infrared. Flights at 120 m yielded an 8 cm ground sampling distance; radiometric consistency used calibrated reflectance-panel images; georeferencing accuracy of less than 30 cm used five ground control points; and orthomosaics were generated in Pix4DMapper Pro and co-registered in QGIS (Wang et al., 2023).

Canopy pixels were isolated with a DSM mask and the Normalized Excess Green index

nn0

after which NDVI, NDRE, and PSRI were computed (Wang et al., 2023). The Random Forest regression used the feature vector

nn1

and the estimator

nn2

The dataset, excluding the first low-quality flight, comprised 200 samples split nn3 into training, validation, and test sets with 10-fold cross-validation (Wang et al., 2023). The abstract reports nn4 of 0.63 and MAE of 0.80 bars; the detailed summary reports aggregated nn5 of 0.65 nn6 and MAE of roughly 0.80 bars, with the full classification model achieving nn7 accuracy and the NoRedEdge variant nn8 accuracy (Wang et al., 2023).

In network science, the “walnut structure” is a structural description of the Japanese production network (Chakraborty et al., 2018). The giant weakly connected component is decomposed as

nn9

with component sizes reported from the July 2016 snapshot as (d1d2dr)k(d_1d_2\cdots d_r)_k0 firms, (d1d2dr)k(d_1d_2\cdots d_r)_k1, (d1d2dr)k(d_1d_2\cdots d_r)_k2, and (d1d2dr)k(d_1d_2\cdots d_r)_k3 (Chakraborty et al., 2018). The term “walnut” is used because the GSCC forms a central “nut” tightly surrounded by IN and OUT shells, rather than the loose wings of a textbook bow-tie; (d1d2dr)k(d_1d_2\cdots d_r)_k4 of all IN nodes are exactly one step upstream of the GSCC, and (d1d2dr)k(d_1d_2\cdots d_r)_k5 of all OUT nodes are exactly one step downstream (Chakraborty et al., 2018). Hierarchical community detection with Infomap found 209 communities at level 1 and 65,303 communities at level 2, with (d1d2dr)k(d_1d_2\cdots d_r)_k6 of firms residing in irreducible communities at the second level (Chakraborty et al., 2018). The same study reports that only approximately (d1d2dr)k(d_1d_2\cdots d_r)_k7 of unweighted directed links lie within the same sector, whereas approximately (d1d2dr)k(d_1d_2\cdots d_r)_k8 lie inside network-detected communities; with estimated sales flows, the corresponding figures are approximately (d1d2dr)k(d_1d_2\cdots d_r)_k9 within sectors and approximately MM0 within communities (Chakraborty et al., 2018). This finding is presented as questioning the validity and accuracy of conventional input-output analysis when firms in the same sectors are assumed to be highly connected (Chakraborty et al., 2018).

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Walnut.