Skip to main content

partition_mixed

Function partition_mixed 

Source
pub fn partition_mixed(source: &str) -> (String, Option<String>)
Expand description

Partition a possibly-MIXED document into its imperative and math streams.

A mixed document interleaves the language’s blocks with the kernel’s vernacular: Coq-style sentences (Definition/Inductive/Axiom/Theorem/Lemma/Fixpoint) and literate ## Theorem:/## Lemma: blocks in the kernel’s own form, the name followed by Statement:. The math feeds the Forge (extracted into mod proven); the imperative blocks compile normally and call into it.

What the language reads never reaches the kernel: ## To/## A X is one of stay imperative, an English ## Theorem: (Given:/Prove:) is the proof engine’s (opens_kernel_statement), and a block the language reads as text owns its body to the next header (language_reads_as_text), even where a line opens with a kernel keyword.

Returns (imperative_src, Some(math_src)) when math is present, or (source.to_string(), None) for a pure imperative program — so that path is a guaranteed no-op (byte-identical compile). In imperative_src the math lines are BLANKED (kept as empty lines), not deleted, so imperative line numbers — and thus error spans — stay aligned with the original source.