
Strings
Strings are indexed by String.Pos, which internally records byte countsrather than character counts, and thus takes constant time. String.Posincludes a proof that the byte count in fact points at the …
lean4/src/Init/Data/ToString.lean at master · leanprover/lean4
Lean 4 programming language and theorem prover. Contribute to leanprover/lean4 development by creating an account on GitHub.
How to parse the content of a string as Lean 4 code?
Mar 31, 2025 · My question is: Is it possible to do this in Lean 4, and parse a string as Lean code? I understand that Lean's syntax is influenced by the current context/state (e.g. the notation 's and type …
Init.Data.ToString.Basic - eshelyaron.com
Converts a list into a string, using ToString.toString to convert its elements. The resulting string resembles list literal syntax, with the elements separated by ", " and enclosed in square brackets. …
Parser and Syntax | leanprover/lean4 | DeepWiki
Dec 15, 2025 · Parser and Syntax Relevant source files Purpose and Scope This page documents Lean 4's parser system, which converts source text into concrete syntax trees (Syntax). The parser is a …
How to convert a string to an integer in Lean 4? - Stack Overflow
Jul 31, 2023 · As Moritz Firsching points out, Lean4 defines a String.toNat which will return a Option Nat. Because of that you have also to adapt your code to handle the possibility of failure in the conversion:
Lean.Data.Json.Basic - GitHub Pages
Attempts to convert a float to a JsonNumber, if the number isn't finite returns the appropriate string from "NaN", "Infinity", "-Infinity". Equations Instances For
GitHub - fgdorais/lean4-parser: Parser Combinator Library for Lean 4
Parser Combinator Library for Lean 4. Contribute to fgdorais/lean4-parser development by creating an account on GitHub.
Init.Data.ToString.Basic - lean-lang.org
Converts a list into a string, using ToString.toString to convert its elements. The resulting string resembles list literal syntax, with the elements separated by ", " and enclosed in square brackets.
How to write a Lean 4 REPL using Lean?
May 22, 2025 · 0 This is a follow-up question to How to parse the content of a string as Lean 4 code? . I am trying to increase my use of Lean 4 by writing a REPL that (just like Haskell's hint package) can …