#' @title Read 11-Column Navier-Stokes Working Sheet #' @description Reads the 11-column (`Columns A..K`) working spreadsheet generated #' by the local Navier-Stokes Snipe interval harness (`working_sheet_11col.csv`). #' @param path Path to `working_sheet_11col.csv` #' @return A data.frame / tibble with exactly 11 columns (`col_A` .. `col_K`) #' @export read_navier_11col <- function(path = "navier_stokes_snipe/artifacts/working_sheet_11col.csv") { df <- utils::read.csv(path, stringsAsFactors = FALSE) if (ncol(df) != 11L) { stop(sprintf("11D Bookkeeping violation: expected 11 columns (A..K), got %d", ncol(df))) } df } #' @title Decompose Euler vs. Viscous Coordinate Scaling #' @description Tidyverse verb mirroring `NavierStokes/CoordinateAlgebra.lean`: #' computes `A(h) = 1/2 + h`, `D(h) = 1/2 - h`, Jacobian `L(h, eta) = 1 - 2*h*eta^2`, #' and keeps convective Euler blowup `q^(-(3/2+h))` un-netted from viscous `-nu*Delta u`. #' @param .data A tbl or data.frame with numeric columns `h` and `eta` #' @param q Scale parameter `q -> 0+` (default `1e-4`) #' @importFrom dplyr mutate #' @export decompose_euler_coordinates <- function(.data, q = 1e-4) { .data |> dplyr::mutate( A_exp = 0.5 + h, D_exp = 0.5 - h, euler_convective_scale = q^(-(1.5 + h)), viscous_laplacian_scale = q^(-(1.5 - h)), viscous_to_euler_ratio = q^(2.0 * h), jacobian_L = 1.0 - 2.0 * h * (eta^2), coordinate_chart_valid = (h > 0.0) & (h < 0.01) & (jacobian_L > 0.0) ) } #' @title Audit Collar Forcing Plug (`f := D[u, p]`) #' @description Flags rows in the 11-column spreadsheet where PDE satisfaction relies on #' absorbing `-nu * Delta u` and Reynolds stress into `COLLAR_FORCING_PLUG` or #' non-constructive `Classical.choice` schedules. #' @param .data An 11-column Navier-Stokes working sheet #' @importFrom dplyr mutate #' @export audit_forcing_plug <- function(.data) { .data |> dplyr::mutate( uses_collar_plug = grepl("COLLAR_FORCING_PLUG", col_D_causal_origin, fixed = TRUE), uses_classical_choice = grepl("classical_choice=True", col_H_deal_D_defect_disclosure, fixed = TRUE) | (col_B_certificate_state == "NONCONSTRUCTIVE_CLASSICAL_CHOICE"), is_counterexample_regime = (col_B_certificate_state == "REGIME_BROKEN") ) } #' @title Verify Finite-Stage Jet Flatness Bounds #' @description Evaluates `LocalResidualFlatness.StageEstimates`: checks whether #' finite stage `stage_J` achieves `C^m` flatness (`gain(J)/2 - residualLoss(m) > 0`) #' or blows up at `(t=1, x=0)`. #' @param .data A tbl or data.frame with `h`, `stage_J`, and `jet_m` #' @importFrom dplyr mutate #' @export verify_jet_flatness_bounds <- function(.data) { .data |> dplyr::mutate( stage_gain_half = h * stage_J, residual_jet_loss = (1.5 + h) + jet_m * (0.5 + h), jet_smoothness_margin = stage_gain_half - residual_jet_loss, forcing_Cm_smooth_at_blowup = jet_smoothness_margin > 0.0 ) } #' @title Sweep Adversarial Smoothness Regimes #' @description Filters a regime table down to strict smoothness-breaking counterexamples #' where either coordinate invertibility fails (`jacobian_L <= 0`) or finite-stage #' forcing `f := D[u, p]` loses `C^m` smoothness (`jet_smoothness_margin <= 0`). #' @param .data A tbl processed by `decompose_euler_coordinates()` and `verify_jet_flatness_bounds()` #' @importFrom dplyr filter #' @export sweep_smoothness_regimes <- function(.data) { .data |> dplyr::filter(!coordinate_chart_valid | !forcing_Cm_smooth_at_blowup) }