From 5fb3a52ebfbdb73a37f743d9ab960560979f3b20 Mon Sep 17 00:00:00 2001 From: Dylan Roy <249851642+d6g8k5htny-coder@users.noreply.github.com> Date: Sun, 11 Oct 2026 09:59:00 -0700 Subject: [PATCH] Add source-bound two-site compact cutoff controls repair Preserve prior failed attempt, all theorem headers and witnesses; supply zero_pow exponent premise and finish equivalence coercion equality. Fresh reviewed package and bounded hosted-only workflow. --- .../compact-cutoff-controls-final-repair.yml | 286 + .../.gitignore | 1 + .../CapFirstExit.lean | 5473 +++++++++++++++++ .../CompactSourceCutoffControls.lean | 671 ++ .../CompactSourceCutoffProof.lean | 304 + .../ConeFootprint.lean | 259 + .../DeterministicSourceC4.lean | 56 + .../ElementaryHistory.lean | 110 + .../GaussianSeriesFoundation.lean | 96 + .../GlobalComponentMaps.lean | 83 + .../LeafAxiomAudit.lean | 54 + .../MorseCongruence.lean | 119 + .../OpenComponentGluing.lean | 237 + .../OrdinaryH0Elder.lean | 183 + .../OrdinaryH0Image.lean | 143 + .../PhysicalSpectral.lean | 243 + .../PushedHeight.lean | 211 + .../QuadraticCone.lean | 251 + .../README.md | 15 + .../SOURCE_MANIFEST.json | 631 ++ .../SOURCE_SHA256SUMS | 36 + .../SourceC4.lean | 141 + .../SourceCoordinates.lean | 160 + .../SourceCovariance.lean | 74 + .../SourceFourierSeries.lean | 147 + .../SourceGaussianLaw.lean | 189 + .../SourceKernel.lean | 112 + .../SourceLattice.lean | 159 + .../SourceNormalForm.lean | 209 + .../SourceTorus.lean | 111 + .../SourceTorusC4.lean | 134 + .../SpectralWeights.lean | 160 + .../TARGET_TRANSFORMATION.md | 3 + .../TaylorMatrix.lean | 233 + .../TaylorSymLift.lean | 49 + .../lake-manifest.json | 117 + .../lakefile.toml | 92 + .../lean-toolchain | 1 + 38 files changed, 11553 insertions(+) create mode 100644 .github/workflows/compact-cutoff-controls-final-repair.yml create mode 100644 frontiers/compact_source_cutoff_controls_final_repair_20261011/.gitignore create mode 100644 frontiers/compact_source_cutoff_controls_final_repair_20261011/CapFirstExit.lean create mode 100644 frontiers/compact_source_cutoff_controls_final_repair_20261011/CompactSourceCutoffControls.lean create mode 100644 frontiers/compact_source_cutoff_controls_final_repair_20261011/CompactSourceCutoffProof.lean create mode 100644 frontiers/compact_source_cutoff_controls_final_repair_20261011/ConeFootprint.lean create mode 100644 frontiers/compact_source_cutoff_controls_final_repair_20261011/DeterministicSourceC4.lean create mode 100644 frontiers/compact_source_cutoff_controls_final_repair_20261011/ElementaryHistory.lean create mode 100644 frontiers/compact_source_cutoff_controls_final_repair_20261011/GaussianSeriesFoundation.lean create mode 100644 frontiers/compact_source_cutoff_controls_final_repair_20261011/GlobalComponentMaps.lean create mode 100644 frontiers/compact_source_cutoff_controls_final_repair_20261011/LeafAxiomAudit.lean create mode 100644 frontiers/compact_source_cutoff_controls_final_repair_20261011/MorseCongruence.lean create mode 100644 frontiers/compact_source_cutoff_controls_final_repair_20261011/OpenComponentGluing.lean create mode 100644 frontiers/compact_source_cutoff_controls_final_repair_20261011/OrdinaryH0Elder.lean create mode 100644 frontiers/compact_source_cutoff_controls_final_repair_20261011/OrdinaryH0Image.lean create mode 100644 frontiers/compact_source_cutoff_controls_final_repair_20261011/PhysicalSpectral.lean create mode 100644 frontiers/compact_source_cutoff_controls_final_repair_20261011/PushedHeight.lean create mode 100644 frontiers/compact_source_cutoff_controls_final_repair_20261011/QuadraticCone.lean create mode 100644 frontiers/compact_source_cutoff_controls_final_repair_20261011/README.md create mode 100644 frontiers/compact_source_cutoff_controls_final_repair_20261011/SOURCE_MANIFEST.json create mode 100644 frontiers/compact_source_cutoff_controls_final_repair_20261011/SOURCE_SHA256SUMS create mode 100644 frontiers/compact_source_cutoff_controls_final_repair_20261011/SourceC4.lean create mode 100644 frontiers/compact_source_cutoff_controls_final_repair_20261011/SourceCoordinates.lean create mode 100644 frontiers/compact_source_cutoff_controls_final_repair_20261011/SourceCovariance.lean create mode 100644 frontiers/compact_source_cutoff_controls_final_repair_20261011/SourceFourierSeries.lean create mode 100644 frontiers/compact_source_cutoff_controls_final_repair_20261011/SourceGaussianLaw.lean create mode 100644 frontiers/compact_source_cutoff_controls_final_repair_20261011/SourceKernel.lean create mode 100644 frontiers/compact_source_cutoff_controls_final_repair_20261011/SourceLattice.lean create mode 100644 frontiers/compact_source_cutoff_controls_final_repair_20261011/SourceNormalForm.lean create mode 100644 frontiers/compact_source_cutoff_controls_final_repair_20261011/SourceTorus.lean create mode 100644 frontiers/compact_source_cutoff_controls_final_repair_20261011/SourceTorusC4.lean create mode 100644 frontiers/compact_source_cutoff_controls_final_repair_20261011/SpectralWeights.lean create mode 100644 frontiers/compact_source_cutoff_controls_final_repair_20261011/TARGET_TRANSFORMATION.md create mode 100644 frontiers/compact_source_cutoff_controls_final_repair_20261011/TaylorMatrix.lean create mode 100644 frontiers/compact_source_cutoff_controls_final_repair_20261011/TaylorSymLift.lean create mode 100644 frontiers/compact_source_cutoff_controls_final_repair_20261011/lake-manifest.json create mode 100644 frontiers/compact_source_cutoff_controls_final_repair_20261011/lakefile.toml create mode 100644 frontiers/compact_source_cutoff_controls_final_repair_20261011/lean-toolchain diff --git a/.github/workflows/compact-cutoff-controls-final-repair.yml b/.github/workflows/compact-cutoff-controls-final-repair.yml new file mode 100644 index 000000000..263b72b97 --- /dev/null +++ b/.github/workflows/compact-cutoff-controls-final-repair.yml @@ -0,0 +1,286 @@ +name: Compact cutoff controls final repair hosted proof check + +'on': + pull_request: + types: [opened, synchronize, reopened] + paths: + - 'frontiers/compact_source_cutoff_controls_final_repair_20261011/**' + - '.github/workflows/compact-cutoff-controls-final-repair.yml' + +permissions: + contents: read + +concurrency: + group: compact-cutoff-controls-final-repair-${{ github.ref }} + cancel-in-progress: false + +jobs: + first-leaf: + runs-on: ubuntu-latest + timeout-minutes: 30 + env: + LEAN_NUM_THREADS: '2' + EXPECTED_SOURCE_LIST_SHA256: '8d024d0f9e97a9527d8ff1e6ec22d9f12944a07af5d8b4e0112de646e4e1f050' + EXPECTED_BASE_REF: 'codex/compact-cutoff-controls-repair-20261011-root01a11cbf' + defaults: + run: + shell: bash + working-directory: frontiers/compact_source_cutoff_controls_final_repair_20261011 + steps: + - name: Record selected event context before checkout + timeout-minutes: 1 + working-directory: ${{ runner.temp }} + env: + EVENT_ACTION: ${{ github.event.action }} + EVENT_NUMBER: ${{ github.event.pull_request.number }} + EVENT_HEAD: ${{ github.event.pull_request.head.sha }} + EVENT_BASE: ${{ github.event.pull_request.base.ref }} + EVENT_BASE_SHA: ${{ github.event.pull_request.base.sha }} + run: | + set -euo pipefail + evidence_dir="$RUNNER_TEMP/compact-cutoff-controls-final-repair-precheckout" + mkdir -p "$evidence_dir" + date -u +%Y-%m-%dT%H:%M:%SZ > "$evidence_dir/start-utc.txt" + printf 'run=%s\nattempt=%s\nevent=%s\naction=%s\npr=%s\nref=%s\nevent_head=%s\nevent_base=%s\nevent_base_sha=%s\nexpected_merge_sha=%s\nthreads=%s\ncheckout_status=NOT_ESTABLISHED\n' "$GITHUB_RUN_ID" "$GITHUB_RUN_ATTEMPT" "$GITHUB_EVENT_NAME" "$EVENT_ACTION" "$EVENT_NUMBER" "$GITHUB_REF" "$EVENT_HEAD" "$EVENT_BASE" "$EVENT_BASE_SHA" "$GITHUB_SHA" "$LEAN_NUM_THREADS" > "$evidence_dir/context.txt" + - timeout-minutes: 1 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 + id: checkout + with: + fetch-depth: 2 + persist-credentials: false + - name: Validate one fresh admitted source checkout before setup + timeout-minutes: 1 + id: sources + env: + EVENT_ACTION: ${{ github.event.action }} + EVENT_NUMBER: ${{ github.event.pull_request.number }} + EVENT_HEAD: ${{ github.event.pull_request.head.sha }} + EVENT_BASE: ${{ github.event.pull_request.base.ref }} + EVENT_BASE_SHA: ${{ github.event.pull_request.base.sha }} + run: | + set -euo pipefail + mkdir -p .lake/evidence + date -u +%Y-%m-%dT%H:%M:%SZ > .lake/evidence/start-utc.txt + git rev-parse HEAD > .lake/evidence/checkout-sha.txt + git rev-parse HEAD^{tree} > .lake/evidence/checkout-tree.txt + git rev-parse HEAD^1 > .lake/evidence/checkout-base-parent.txt + git rev-parse HEAD^2 > .lake/evidence/checkout-head-parent.txt + printf 'event=%s\naction=%s\npr=%s\nref=%s\nhead=%s\nbase=%s\nbase_sha=%s\nmerge=%s\nrun=%s\nattempt=%s\nthreads=%s\n' "$GITHUB_EVENT_NAME" "$EVENT_ACTION" "$EVENT_NUMBER" "$GITHUB_REF" "$EVENT_HEAD" "$EVENT_BASE" "$EVENT_BASE_SHA" "$GITHUB_SHA" "$GITHUB_RUN_ID" "$GITHUB_RUN_ATTEMPT" "$LEAN_NUM_THREADS" > .lake/evidence/context.txt + test "$(date -u +%s)" -lt "$(date -u -d '2026-10-11T17:20:00Z' +%s)" + test "$GITHUB_EVENT_NAME" = pull_request + test "$GITHUB_RUN_ATTEMPT" = 1 + case "$EVENT_ACTION" in opened|synchronize|reopened) ;; *) exit 81 ;; esac + [[ "$EVENT_NUMBER" =~ ^[0-9]+$ ]] + test "$GITHUB_REF" = "refs/pull/$EVENT_NUMBER/merge" + test "$EVENT_BASE" = "$EXPECTED_BASE_REF" + [[ "$EVENT_HEAD" =~ ^[0-9a-f]{40}$ ]] + [[ "$EVENT_BASE_SHA" =~ ^[0-9a-f]{40}$ ]] + test "$(cat .lake/evidence/checkout-sha.txt)" = "$GITHUB_SHA" + test "$(cat .lake/evidence/checkout-base-parent.txt)" = "$EVENT_BASE_SHA" + test "$(cat .lake/evidence/checkout-head-parent.txt)" = "$EVENT_HEAD" + [[ "$EXPECTED_SOURCE_LIST_SHA256" =~ ^[0-9a-f]{64}$ ]] + test ! -e .lake/build + command -v jq timeout sha256sum cmp awk + printf 'leanprover/lean4:v4.34.1\n' | cmp -s - lean-toolchain + test "$(wc -l < SOURCE_SHA256SUMS)" -gt 0 + if grep -Evq '^[0-9a-f]{64} [A-Za-z0-9._/-]+$' SOURCE_SHA256SUMS; then exit 82; fi + cp SOURCE_SHA256SUMS .lake/evidence/SOURCE_SHA256SUMS + sha256sum SOURCE_SHA256SUMS > .lake/evidence/checksum-list-identity-before.txt + test "$(sha256sum SOURCE_SHA256SUMS | cut -d' ' -f1)" = "$EXPECTED_SOURCE_LIST_SHA256" + grep -Fxq '#print axioms SourceCompactCutoff.compact_cutoff_of_geometry' LeafAxiomAudit.lean + grep -Fxq '#print axioms SourceCompactCutoff.actual_source_compact_cutoff' LeafAxiomAudit.lean + sha256sum -c SOURCE_SHA256SUMS | tee .lake/evidence/sources-before.txt + while IFS= read -r line; do + file="${line#* }" + test "$file" != "$line" + sha256sum -- "$file" + done < SOURCE_SHA256SUMS > .lake/evidence/sources-actual-before.sha256 + git diff --exit-code + - name: Install pinned Lean and retrieve qualified Mathlib cache + timeout-minutes: 3 + id: setup + uses: leanprover/lean-action@f061402b660e0c34644504b324e830f2991d4865 + with: + lake-package-directory: frontiers/compact_source_cutoff_controls_final_repair_20261011 + auto-config: 'false' + build: 'false' + test: 'false' + lint: 'false' + use-mathlib-cache: 'true' + use-github-cache: 'false' + - name: Check hosted versions pins and actual post-setup source hashes + timeout-minutes: 1 + id: pincheck + run: | + set -euo pipefail + lean --version | tee .lake/evidence/lean-version.txt + grep -Eq '^Lean \(version 4\.34\.1([, ]|\))' .lake/evidence/lean-version.txt + lake --version | tee .lake/evidence/lake-version.txt + grep -Fxq 'Lake version 5.0.0-src+5045d00 (Lean version 4.34.1)' .lake/evidence/lake-version.txt + jq --version > .lake/evidence/jq-version.txt + uname -a > .lake/evidence/platform.txt + cp lake-manifest.json .lake/evidence/lake-manifest.json + sha256sum lake-manifest.json > .lake/evidence/manifest-identity.txt + sha256sum SOURCE_SHA256SUMS > .lake/evidence/checksum-list-identity-after-setup.txt + cmp -s .lake/evidence/checksum-list-identity-before.txt .lake/evidence/checksum-list-identity-after-setup.txt + sha256sum -c SOURCE_SHA256SUMS > .lake/evidence/sources-after-setup.txt + while IFS= read -r line; do + file="${line#* }" + test "$file" != "$line" + sha256sum -- "$file" + done < SOURCE_SHA256SUMS > .lake/evidence/sources-actual-after-setup.sha256 + cmp -s .lake/evidence/sources-actual-before.sha256 .lake/evidence/sources-actual-after-setup.sha256 + jq -r '.packages[] | [.name, .rev] | @tsv' lake-manifest.json > .lake/evidence/dependency-expected.tsv + test "$(wc -l < .lake/evidence/dependency-expected.tsv)" -eq 9 + cat > .lake/evidence/dependency-pins-required.tsv <<'PINS' + plausible 118aa17ee84656b8bd727fef7c458ee8c833385c + LeanSearchClient ddf04cf3949fa556442341e87d47f9f6e6074707 + importGraph e928b72544873815af278d38681b31c0293588e3 + proofwidgets 106ff4fafc74ef4ac99d81dbf3ab399118f497a5 + aesop 355695d523e41d0554926416cba2a2b3544fbbc9 + Qq 6a489d9af5d0c47e5b259e2e8bcdfc1811b5a259 + batteries f2effa3d803fda822b1f97b806c47cf2adfbcbc2 + Cli e92c9f15fdfacc8536f31cfb3b7ad26c3c8cd204 + mathlib d13f23b723b8a846827a245b89c10fc7d3f11612 + PINS + cmp -s .lake/evidence/dependency-pins-required.tsv .lake/evidence/dependency-expected.tsv + while IFS=$'\t' read -r package revision; do + actual=$(git -C ".lake/packages/$package" rev-parse HEAD) + printf '%s\t%s\t%s\n' "$package" "$revision" "$actual" >> .lake/evidence/dependency-actual.tsv + test "$actual" = "$revision" + done < .lake/evidence/dependency-expected.tsv + git diff --exit-code + - name: Build fresh project predecessor PushedHeight once + timeout-minutes: 10 + id: predecessor + run: | + set -euo pipefail + date -u +%Y-%m-%dT%H:%M:%SZ > .lake/evidence/predecessor-start.txt + phase_start=$SECONDS + set +e + timeout --signal=TERM --kill-after=15s 540s lake build PushedHeight > .lake/evidence/predecessor.stdout 2> .lake/evidence/predecessor.stderr + status=$? + set -e + printf '%s\n' "$status" > .lake/evidence/predecessor-exit.txt + printf '%s\n' "$((SECONDS-phase_start))" > .lake/evidence/predecessor-seconds.txt + date -u +%Y-%m-%dT%H:%M:%SZ > .lake/evidence/predecessor-end.txt + cat .lake/evidence/predecessor.stdout + cat .lake/evidence/predecessor.stderr >&2 + exit "$status" + - name: Compile first-leaf proof source and propagate actual exit + timeout-minutes: 2 + id: proof + run: | + set -euo pipefail + date -u +%Y-%m-%dT%H:%M:%SZ > .lake/evidence/proof-start.txt + phase_start=$SECONDS + set +e + timeout --signal=TERM --kill-after=15s 90s lake build CompactSourceCutoffProof > .lake/evidence/proof.stdout 2> .lake/evidence/proof.stderr + status=$? + set -e + printf '%s\n' "$status" > .lake/evidence/proof-exit.txt + printf '%s\n' "$((SECONDS-phase_start))" > .lake/evidence/proof-seconds.txt + date -u +%Y-%m-%dT%H:%M:%SZ > .lake/evidence/proof-end.txt + cat .lake/evidence/proof.stdout + cat .lake/evidence/proof.stderr >&2 + exit "$status" + - name: Compile substantive compact-cutoff controls and propagate actual exit + timeout-minutes: 2 + id: controls + run: | + set -euo pipefail + date -u +%Y-%m-%dT%H:%M:%SZ > .lake/evidence/controls-start.txt + phase_start=$SECONDS + set +e + timeout --signal=TERM --kill-after=15s 90s lake build CompactSourceCutoffControls > .lake/evidence/controls.stdout 2> .lake/evidence/controls.stderr + status=$? + set -e + printf '%s\n' "$status" > .lake/evidence/controls-exit.txt + printf '%s\n' "$((SECONDS-phase_start))" > .lake/evidence/controls-seconds.txt + date -u +%Y-%m-%dT%H:%M:%SZ > .lake/evidence/controls-end.txt + cat .lake/evidence/controls.stdout + cat .lake/evidence/controls.stderr >&2 + exit "$status" + - name: Recheck both compiled modules with the standalone kernel checker + id: kernel + timeout-minutes: 2 + run: | + set -euo pipefail + date -u +%Y-%m-%dT%H:%M:%SZ > .lake/evidence/kernel-start.txt + phase_start=$SECONDS + set +e + timeout --signal=TERM --kill-after=15s 90s bash -c 'set -euo pipefail; printf "KERNEL_MODULE CompactSourceCutoffProof\n"; lake env leanchecker CompactSourceCutoffProof; printf "KERNEL_MODULE CompactSourceCutoffControls\n"; lake env leanchecker CompactSourceCutoffControls' > .lake/evidence/kernel.stdout 2> .lake/evidence/kernel.stderr + status=$? + set -e + printf '%s\n' "$status" > .lake/evidence/kernel-exit.txt + printf '%s\n' "$((SECONDS-phase_start))" > .lake/evidence/kernel-seconds.txt + date -u +%Y-%m-%dT%H:%M:%SZ > .lake/evidence/kernel-end.txt + cat .lake/evidence/kernel.stdout + cat .lake/evidence/kernel.stderr >&2 + exit "$status" + - name: Audit all new declarations and propagate actual audit exit + timeout-minutes: 2 + id: audit + run: | + set -euo pipefail + date -u +%Y-%m-%dT%H:%M:%SZ > .lake/evidence/audit-start.txt + phase_start=$SECONDS + set +e + timeout --signal=TERM --kill-after=15s 90s lake env lean LeafAxiomAudit.lean > .lake/evidence/audit.stdout 2> .lake/evidence/audit.stderr + status=$? + set -e + printf '%s\n' "$status" > .lake/evidence/audit-exit.txt + printf '%s\n' "$((SECONDS-phase_start))" > .lake/evidence/audit-seconds.txt + date -u +%Y-%m-%dT%H:%M:%SZ > .lake/evidence/audit-end.txt + cat .lake/evidence/audit.stdout + cat .lake/evidence/audit.stderr >&2 + exit "$status" + - name: Retain checkout and phase outcomes even if checkout fails + timeout-minutes: 1 + if: always() + working-directory: ${{ runner.temp }} + env: + CHECKOUT_OUTCOME: ${{ steps.checkout.outcome }} + SOURCE_OUTCOME: ${{ steps.sources.outcome }} + SETUP_OUTCOME: ${{ steps.setup.outcome }} + PINCHECK_OUTCOME: ${{ steps.pincheck.outcome }} + PREDECESSOR_OUTCOME: ${{ steps.predecessor.outcome }} + PROOF_OUTCOME: ${{ steps.proof.outcome }} + CONTROLS_OUTCOME: ${{ steps.controls.outcome }} + KERNEL_OUTCOME: ${{ steps.kernel.outcome }} + AUDIT_OUTCOME: ${{ steps.audit.outcome }} + run: | + set -euo pipefail + evidence_dir="$RUNNER_TEMP/compact-cutoff-controls-final-repair-precheckout" + mkdir -p "$evidence_dir" + date -u +%Y-%m-%dT%H:%M:%SZ > "$evidence_dir/end-utc.txt" + printf 'checkout=%s\nsources=%s\nsetup=%s\npincheck=%s\npredecessor=%s\nproof=%s\ncontrols=%s\nkernel=%s\naudit=%s\nscientific_effect=NONE\n' "$CHECKOUT_OUTCOME" "$SOURCE_OUTCOME" "$SETUP_OUTCOME" "$PINCHECK_OUTCOME" "$PREDECESSOR_OUTCOME" "$PROOF_OUTCOME" "$CONTROLS_OUTCOME" "$KERNEL_OUTCOME" "$AUDIT_OUTCOME" > "$evidence_dir/outcomes.txt" + - name: Retain final exact source and tracked-tree integrity + timeout-minutes: 1 + if: ${{ always() && steps.checkout.outcome == 'success' }} + run: | + set -euo pipefail + mkdir -p .lake/evidence + date -u +%Y-%m-%dT%H:%M:%SZ > .lake/evidence/end-utc.txt + sha256sum SOURCE_SHA256SUMS > .lake/evidence/checksum-list-identity-final.txt + cmp -s .lake/evidence/checksum-list-identity-before.txt .lake/evidence/checksum-list-identity-final.txt + sha256sum -c SOURCE_SHA256SUMS > .lake/evidence/sources-final.txt + while IFS= read -r line; do + file="${line#* }" + test "$file" != "$line" + sha256sum -- "$file" + done < SOURCE_SHA256SUMS > .lake/evidence/sources-actual-final.sha256 + cmp -s .lake/evidence/sources-actual-before.sha256 .lake/evidence/sources-actual-final.sha256 + git diff --exit-code > .lake/evidence/tracked-tree-final.txt + - name: Preserve complete phase logs on success or failure + timeout-minutes: 1 + if: always() + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a + with: + name: compact-cutoff-controls-final-repair-${{ github.run_id }}-${{ github.run_attempt }} + path: | + frontiers/compact_source_cutoff_controls_final_repair_20261011/.lake/evidence/ + ${{ runner.temp }}/compact-cutoff-controls-final-repair-precheckout/ + include-hidden-files: true + if-no-files-found: error + retention-days: 14 diff --git a/frontiers/compact_source_cutoff_controls_final_repair_20261011/.gitignore b/frontiers/compact_source_cutoff_controls_final_repair_20261011/.gitignore new file mode 100644 index 000000000..01f8cdb63 --- /dev/null +++ b/frontiers/compact_source_cutoff_controls_final_repair_20261011/.gitignore @@ -0,0 +1 @@ +.lake/ diff --git a/frontiers/compact_source_cutoff_controls_final_repair_20261011/CapFirstExit.lean b/frontiers/compact_source_cutoff_controls_final_repair_20261011/CapFirstExit.lean new file mode 100644 index 000000000..01744e2cf --- /dev/null +++ b/frontiers/compact_source_cutoff_controls_final_repair_20261011/CapFirstExit.lean @@ -0,0 +1,5473 @@ +/- + CapFirstExit: the topological step from a separating cap to the global elder level. + + `CapHyp f C M z b s` bundles the conclusions that CAP §§2–5 derive from the local good event + `G_r` (reviews/d1_cap_elder_partner_second_pass_claude_20260930/REVIEW.md, L16–L20): + + (C1) `M ∈ C` and `f ≤ b` on the cap `C` (L16); + (C2) `f ≤ s` on the whole frontier of `C` (L17–L19); + (C3) `b < f z`, and a path from `M` to `z` along which `f ≥ s` (L17, L20). + + The saddle form adds (C2⁺): every frontier point other than `S` has `f < s` (L19). + + Nothing is assumed about `f` outside `C` beyond the witness path in (C3). The core theorems use + no metric, smoothness, Morse, compactness or probabilistic hypothesis, and their separation + statements do not even use continuity of `f`. `X` is an arbitrary topological space; the torus + is one instance. Only the older-peak theorems add compactness, local connectedness and + continuity of `f`, all of which hold on the torus. + + Up to v1.8 the analytic steps L6 and L9–L12 (the `w'` bound and the quantitative `‖h'‖` and `F''` + bounds) entered `ridge_capHyp_H1` as `hconv`. L1–L5, L7 (existence, + uniqueness and implicit-function regularity of the ridge `h`: `ridge_exists`, + `ridge_differentiable`), L8, L11's chain rule, L13 and L16–L20 are proved, and since v1.8 + `ridge_capHyp_source` composes them from source data on a collar `[-2r - ε, 2r + ε]` of `D` + (the source data themselves are hypotheses). Since v1.9, L6 and L9–L12 are proved too, and + `ridge_capHyp_C3` derives `hconv`; since v2.0 `ridge_capHyp_C4` also derives SP's + `f_xxx ≥ 7/4` (L4, from L2's second statement and (H2)). Since v2.1 `ridge_capHyp_C5` derives + the six derivative bounds from the block bound and `|f_xxx| ≤ m` on the pin segment, and + `ridge_capHyp_D` assumes SP's quantitative bounds on `D` only (the continuity step to the collar + is proved). Since v2.2 `ridge_capHyp_E` assumes only `f ∈ C⁴` on an open neighbourhood of `D` + and SP's quantitative bounds on `D`: it builds every derivative datum from `f`, and the collar + and its bound `K` come from compactness. + `quarticToy_E` (v2.3) exercises it away from the degenerate face, with `D⁴f ≠ 0` and (H2) sharp. + Since v2.4 `ridge_capHyp_K` states the cap on P §7's event `G_r` for every pin gap + `f(M) − f(S) = k r³` with `k > 0`, namely `(4/(3k)) r m² < λ` and `r n ≤ 3k/10`, by rescaling + `f ↦ f/(6k)` (`ridge_capHyp_E` is the case `k = 1/6`). `ridge_capHyp_norm_K` takes the bounds as + operator norms `‖D³f‖ ≤ M3`, `‖D⁴f‖ ≤ M4` on `D`. + Since v2.5 `ridge_capHyp_blocks` takes CAP (1) as written, with CAP's partial-block norms: the + block inequality for `D³f` is derived from the partial blocks (`block_of_partial`), using the + symmetry of `D³f` for `f ∈ C³` (`iteratedFDeriv_three_swap₁₂`, `iteratedFDeriv_three_swap₂₃`). + `mixedToy_blocks` exercises it with a nonzero mixed block `∂_x D_y² f = 2`. + Since v2.6 `torus_capHyp_blocks` and `torus_elder_death_level_blocks` state the cap and the elder + death level on the torus `(ℝ/Lℤ)^d` for a field whose periodic lift meets CAP (1) in any frame; + `torusToy_elder` is a concrete instance on `(ℝ/16ℤ)²`. + Also not formalized: the + identification of the H0 persistence pairing with the elder rule (L22, P §8); the + unstable-branch analysis (L23); and every probabilistic statement. +-/ +import Mathlib + +open Set unitInterval + +namespace CapFirstExit + +variable {X : Type*} [TopologicalSpace X] + +/-! ### First exit -/ + +/-- First exit along a path. A path from a point of `C` to a point outside `C` meets the frontier +of `C`. -/ +theorem path_meets_frontier {C : Set X} {x y : X} (γ : Path x y) (hx : x ∈ C) (hy : y ∉ C) : + ∃ t : I, γ t ∈ frontier C := by + have hS : (γ ⁻¹' C).Nonempty := ⟨0, by simpa using hx⟩ + have hS' : γ ⁻¹' C ≠ univ := by + intro h + have h1 : (1 : I) ∈ γ ⁻¹' C := h ▸ mem_univ _ + exact hy (by simpa using h1) + obtain ⟨t, ht⟩ := nonempty_frontier_iff.mpr ⟨hS, hS'⟩ + exact ⟨t, γ.continuous.frontier_preimage_subset C ht⟩ + +/-- First exit for connected sets. A preconnected set that contains a point of `C` and does not +meet the frontier of `C` lies inside `C`. No path-connectedness is needed. -/ +theorem preconnected_subset_of_frontier_disjoint {C K : Set X} (hK : IsPreconnected K) {M : X} + (hMK : M ∈ K) (hMC : M ∈ C) (hfr : ∀ x ∈ K, x ∉ frontier C) : K ⊆ C := by + intro w hwK + by_contra hwC + have : PreconnectedSpace K := isPreconnected_iff_preconnectedSpace.mp hK + have hS : (((↑) : K → X) ⁻¹' C).Nonempty := ⟨⟨M, hMK⟩, hMC⟩ + have hS' : (((↑) : K → X) ⁻¹' C) ≠ univ := by + intro h + have h1 : (⟨w, hwK⟩ : K) ∈ (((↑) : K → X) ⁻¹' C) := h ▸ mem_univ _ + exact hwC h1 + obtain ⟨⟨x, hxK⟩, hx⟩ := nonempty_frontier_iff.mpr ⟨hS, hS'⟩ + exact hfr x hxK (continuous_subtype_val.frontier_preimage_subset C hx) + +/-! ### The cap hypotheses -/ + +/-- The cap hypotheses (C1)–(C3) for a local maximum `M` of height `b`, a separating level `s`, +and an older point `z`. -/ +structure CapHyp (f : X → ℝ) (C : Set X) (M z : X) (b s : ℝ) : Prop where + /-- (C1) `M` lies in the cap. -/ + mem : M ∈ C + /-- (C1) The ceiling: `f ≤ b` on the cap (L16). -/ + ceiling : ∀ x ∈ C, f x ≤ b + /-- (C2) The frontier bound: `f ≤ s` on the frontier of the cap (L17–L19). -/ + frontier_le : ∀ x ∈ frontier C, f x ≤ s + /-- (C3) The older endpoint: `f z > b` (L17). -/ + older : b < f z + /-- (C3) The ridge: a path from `M` to `z` along which `f ≥ s` (L20). -/ + ridge : ∃ γ : Path M z, ∀ t, s ≤ f (γ t) + +namespace CapHyp + +variable {f : X → ℝ} {C : Set X} {M z : X} {b s : ℝ} + +/-- `M` itself is at height at least `s` (the ridge starts at `M`). -/ +theorem s_le_f_M (H : CapHyp f C M z b s) : s ≤ f M := by + obtain ⟨γ, hγ⟩ := H.ridge + simpa using hγ 0 + +/-! ### The maximin level `d_f(M)` (L21) -/ + +/-- The upper barrier. Every path from `M` to a point strictly above `b` passes through a point +of height at most `s`, whatever the path does outside `C`. -/ +theorem barrier (H : CapHyp f C M z b s) {w : X} (hw : b < f w) (γ : Path M w) : + ∃ t : I, f (γ t) ≤ s := by + have hwC : w ∉ C := fun h => (not_le.mpr hw) (H.ceiling w h) + obtain ⟨t, ht⟩ := path_meets_frontier γ H.mem hwC + exact ⟨t, H.frontier_le _ ht⟩ + +end CapHyp + +/-- The connection levels of `M`: heights `m` such that some path from `M` to a point strictly +above `b` stays at height at least `m`. Its supremum is the maximin level `d_f(M)` of L21. -/ +def connectionLevels (f : X → ℝ) (M : X) (b : ℝ) : Set ℝ := + {m | ∃ (w : X) (γ : Path M w), b < f w ∧ ∀ t, m ≤ f (γ t)} + +namespace CapHyp + +variable {f : X → ℝ} {C : Set X} {M z : X} {b s : ℝ} + +/-- The maximin level is attained and equals `s` (L21). -/ +theorem maximin_isGreatest (H : CapHyp f C M z b s) : + IsGreatest (connectionLevels f M b) s := by + obtain ⟨γ₀, hγ₀⟩ := H.ridge + refine ⟨⟨z, γ₀, H.older, hγ₀⟩, ?_⟩ + rintro m ⟨w, γ, hw, hγ⟩ + obtain ⟨t, ht⟩ := H.barrier hw γ + exact (hγ t).trans ht + +/-- `d_f(M) = s`, as a supremum (L21). -/ +theorem maximin_eq (H : CapHyp f C M z b s) : sSup (connectionLevels f M b) = s := + H.maximin_isGreatest.csSup_eq + +/-! ### Superlevel components: the persistence filtration (L22) -/ + +/-- Component separation. If `U` avoids the frontier of `C`, the connected component of `M` in +`U` lies in `C`, so it contains no point strictly above `b`. -/ +theorem component_separated (H : CapHyp f C M z b s) {U : Set X} + (hU : ∀ x ∈ frontier C, x ∉ U) {w : X} (hw : w ∈ connectedComponentIn U M) : f w ≤ b := by + have hMU : M ∈ U := by + by_contra hMU + rw [connectedComponentIn_eq_empty hMU] at hw + exact notMem_empty w hw + exact H.ceiling w (preconnected_subset_of_frontier_disjoint isPreconnected_connectedComponentIn + (mem_connectedComponentIn hMU) H.mem + (fun x hx hxf => hU x hxf (connectedComponentIn_subset U M hx)) hw) + +end CapHyp + +/-- Component joining. If a path from `M` to `z` stays in `U`, then `z` lies in the connected +component of `M` in `U`. -/ +theorem component_joined {U : Set X} {M z : X} (γ : Path M z) (hγ : ∀ t, γ t ∈ U) : + z ∈ connectedComponentIn U M := by + have hsub : range γ ⊆ U := by + rintro _ ⟨t, rfl⟩ + exact hγ t + exact (isConnected_range γ.continuous).isPreconnected.subset_connectedComponentIn + ⟨0, γ.source⟩ hsub ⟨1, γ.target⟩ + +namespace CapHyp + +variable {f : X → ℝ} {C : Set X} {M z : X} {b s : ℝ} + +/-- **Elder merge, closed superlevel filtration `{f ≥ h}`** (the filtration of L22). The connected +component of `M` in `{f ≥ h}` contains a point strictly above `b` if and only if `h ≤ s`. -/ +theorem elder_merge_iff_closed (H : CapHyp f C M z b s) (h : ℝ) : + (∃ w ∈ connectedComponentIn {x | h ≤ f x} M, b < f w) ↔ h ≤ s := by + constructor + · rintro ⟨w, hw, hbw⟩ + by_contra hhs + rw [not_le] at hhs + have hU : ∀ x ∈ frontier C, x ∉ {x | h ≤ f x} := by + intro x hx hxU + have h1 : h ≤ f x := hxU + have h2 := H.frontier_le x hx + linarith + exact absurd (H.component_separated hU hw) (not_le.mpr hbw) + · intro hhs + obtain ⟨γ₀, hγ₀⟩ := H.ridge + exact ⟨z, component_joined γ₀ (fun t => le_trans hhs (hγ₀ t)), H.older⟩ + +/-- **Elder merge, open superlevel filtration `{f > h}`.** The connected component of `M` in +`{f > h}` contains a point strictly above `b` if and only if `h < s`. -/ +theorem elder_merge_iff_open (H : CapHyp f C M z b s) (h : ℝ) : + (∃ w ∈ connectedComponentIn {x | h < f x} M, b < f w) ↔ h < s := by + constructor + · rintro ⟨w, hw, hbw⟩ + by_contra hhs + rw [not_lt] at hhs + have hU : ∀ x ∈ frontier C, x ∉ {x | h < f x} := by + intro x hx hxU + have h1 : h < f x := hxU + have h2 := H.frontier_le x hx + linarith + exact absurd (H.component_separated hU hw) (not_le.mpr hbw) + · intro hhs + obtain ⟨γ₀, hγ₀⟩ := H.ridge + exact ⟨z, component_joined γ₀ (fun t => lt_of_lt_of_le hhs (hγ₀ t)), H.older⟩ + +/-- The set of levels at which the class born at `M` is joined to an older point. -/ +def joinedLevels (f : X → ℝ) (M : X) (b : ℝ) : Set ℝ := + {h | ∃ w ∈ connectedComponentIn {x | h ≤ f x} M, b < f w} + +/-- **Elder death level.** In the closed superlevel filtration, the largest level at which the +component of `M` contains an older point exists and equals `s`, whatever `f` does outside the cap. +This is the death level of the class born at `M` in L22. -/ +theorem elder_death_level (H : CapHyp f C M z b s) : IsGreatest (joinedLevels f M b) s := + ⟨(H.elder_merge_iff_closed s).mpr le_rfl, fun _ hh => (H.elder_merge_iff_closed _).mp hh⟩ + +/-! ### The merging saddle -/ + +/-- Every path from `M` to a point strictly above `b` that stays in `{f ≥ s}` passes through `S`, +when `S` is the only frontier point at height `s` (C2⁺, L19). The statement says something only when +`M ≠ S`, as in the source, where the pins are distinct. -/ +theorem path_through_saddle (H : CapHyp f C M z b s) {S : X} + (hS : ∀ x ∈ frontier C, x ≠ S → f x < s) {w : X} (hw : b < f w) (γ : Path M w) + (hγ : ∀ t, s ≤ f (γ t)) : ∃ t, γ t = S := by + have hwC : w ∉ C := fun h => (not_le.mpr hw) (H.ceiling w h) + obtain ⟨t, ht⟩ := path_meets_frontier γ H.mem hwC + refine ⟨t, ?_⟩ + by_contra hne + have h1 := hS _ ht hne + have h2 := hγ t + linarith + +/-- **`S` is a cut point at the death level.** Assume (C2⁺) and `M ≠ S`. Then `M` lies in its own +component of `{f ≥ s} \ {S}`, so the statement is not vacuous, and that component contains no +point strictly above `b`. By contrast, `{f ≥ s}` itself joins `M` to an older point +(`elder_merge_iff_closed` at `h = s`). Removing `S` therefore disconnects `M` from every older +point at the death level. -/ +theorem saddle_cut (H : CapHyp f C M z b s) {S : X} + (hS : ∀ x ∈ frontier C, x ≠ S → f x < s) (hMS : M ≠ S) : + M ∈ connectedComponentIn ({x | s ≤ f x} \ {S}) M ∧ + ∀ w ∈ connectedComponentIn ({x | s ≤ f x} \ {S}) M, f w ≤ b := by + refine ⟨mem_connectedComponentIn ⟨H.s_le_f_M, hMS⟩, fun w hw => ?_⟩ + refine H.component_separated (fun x hx hxU => ?_) hw + obtain ⟨h1, h2⟩ := hxU + have h3 := hS x hx h2 + have h4 : s ≤ f x := h1 + linarith + +/-! ### Exterior invariance -/ + +/-- **Exterior invariance.** Any `g` that agrees with `f` on the closure of the cap and along one +ridge path satisfies the same cap hypotheses. Every conclusion above (maximin level, elder merge +levels, death level, saddle cut) therefore holds for `g` with the same `s`, however `g` behaves +elsewhere: remote saddles, high corridors and re-entries change nothing. -/ +theorem congr {g : X → ℝ} (H : CapHyp f C M z b s) (γ₀ : Path M z) (hγ₀ : ∀ t, s ≤ f (γ₀ t)) + (hgC : ∀ x ∈ closure C, g x = f x) (hgγ : ∀ t, g (γ₀ t) = f (γ₀ t)) : + CapHyp g C M z b s where + mem := H.mem + ceiling x hx := (hgC x (subset_closure hx)).symm ▸ H.ceiling x hx + frontier_le x hx := (hgC x (frontier_subset_closure hx)).symm ▸ H.frontier_le x hx + older := by + have h1 := hgγ 1 + rw [γ₀.target] at h1 + rw [h1] + exact H.older + ridge := ⟨γ₀, fun t => (hgγ t).symm ▸ hγ₀ t⟩ + +end CapHyp + +/-! ### The elder-rule interface on a compact, locally connected space + +The elder rule pairs the class born at `M` with the level at which its superlevel component first +contains a strictly higher local maximum (an older class). On a compact, locally connected space +with continuous `f` (a closed manifold, in particular the torus), the following theorems identify +that level as `s`. -/ + +/-- A connected component of a closed set is closed. -/ +theorem isClosed_connectedComponentIn {F : Set X} (hF : IsClosed F) (x : X) : + IsClosed (connectedComponentIn F x) := by + by_cases hx : x ∈ F + · refine isClosed_of_closure_subset ?_ + exact isPreconnected_connectedComponentIn.closure.subset_connectedComponentIn + (subset_closure (mem_connectedComponentIn hx)) + (closure_minimal (connectedComponentIn_subset F x) hF) + · rw [connectedComponentIn_eq_empty hx] + exact isClosed_empty + +namespace CapHyp + +variable {f : X → ℝ} {C : Set X} {M z : X} {b s : ℝ} + +/-- **An older peak below the death level.** For every level `h ≤ s`, the component of `M` in +`{f ≥ h}` contains a point `p` with `f p > b` that maximizes `f` over the component and is a local +maximum of `f` on `X`: the older class that absorbs the class born at `M`. -/ +theorem older_peak [CompactSpace X] [LocallyConnectedSpace X] (H : CapHyp f C M z b s) + (hf : Continuous f) {h : ℝ} (hh : h ≤ s) : + ∃ p ∈ connectedComponentIn {x | h ≤ f x} M, b < f p ∧ IsLocalMax f p ∧ + ∀ w ∈ connectedComponentIn {x | h ≤ f x} M, f w ≤ f p := by + have hF : IsClosed {x | h ≤ f x} := isClosed_le continuous_const hf + obtain ⟨w, hwK, hbw⟩ := (H.elder_merge_iff_closed h).mpr hh + obtain ⟨p, hpK, hpmax⟩ := (isClosed_connectedComponentIn hF M).isCompact.exists_isMaxOn + ⟨w, hwK⟩ hf.continuousOn + have hmax : ∀ x ∈ connectedComponentIn {x | h ≤ f x} M, f x ≤ f p := isMaxOn_iff.mp hpmax + have hbp : b < f p := lt_of_lt_of_le hbw (hmax w hwK) + have hsb : s ≤ b := le_trans H.s_le_f_M (H.ceiling M H.mem) + have hpU : p ∈ {x | h < f x} := by + show h < f p + linarith + have hU : IsOpen {x | h < f x} := isOpen_lt continuous_const hf + have hVK : connectedComponentIn {x | h < f x} p ⊆ connectedComponentIn {x | h ≤ f x} M := by + rw [connectedComponentIn_eq hpK] + exact connectedComponentIn_mono p (fun x (hx : h < f x) => (le_of_lt hx : h ≤ f x)) + refine ⟨p, hpK, hbp, ?_, hmax⟩ + exact Filter.eventually_of_mem (hU.connectedComponentIn.mem_nhds (mem_connectedComponentIn hpU)) + (fun x hx => hmax x (hVK hx)) + +/-- **No older point above the death level.** For every level `h > s`, `M` is a highest point of +its component in `{f ≥ h}`, when `b = f M`: the class born at `M` is the elder of its component. -/ +theorem elder_alive (H : CapHyp f C M z b s) (hMb : f M = b) {h : ℝ} (hh : s < h) : + ∀ w ∈ connectedComponentIn {x | h ≤ f x} M, f w ≤ f M := by + intro w hw + rw [hMb] + by_contra hlt + rw [not_le] at hlt + exact absurd ((H.elder_merge_iff_closed h).mp ⟨w, hw, hlt⟩) (not_le.mpr hh) + +/-- The levels at which the component of `M` in `{f ≥ h}` contains a strictly higher local +maximum of `f`. -/ +def olderPeakLevels (f : X → ℝ) (M : X) : Set ℝ := + {h | ∃ p ∈ connectedComponentIn {x | h ≤ f x} M, f M < f p ∧ IsLocalMax f p} + +/-- **Elder death level, peak form.** On a compact, locally connected space with continuous `f` +and `b = f M`, the largest level at which the component of `M` contains a strictly higher local +maximum exists and equals `s`. This is the death level of the elder rule. -/ +theorem elder_death_level_peak [CompactSpace X] [LocallyConnectedSpace X] + (H : CapHyp f C M z b s) (hf : Continuous f) (hMb : f M = b) : + IsGreatest (olderPeakLevels f M) s := by + refine ⟨?_, fun h hh => ?_⟩ + · obtain ⟨p, hpK, hbp, hloc, -⟩ := H.older_peak hf le_rfl + exact ⟨p, hpK, hMb ▸ hbp, hloc⟩ + · obtain ⟨p, hpK, hMp, -⟩ := hh + exact (H.elder_merge_iff_closed h).mp ⟨p, hpK, hMb ▸ hMp⟩ + +end CapHyp + +/-! ### Charts: the cap on the torus and its faces + +The analysis of CAP §§2–5 runs in Euclidean coordinates on the periodic lift `f ∘ e` of a field +`f` on the torus, where `e : ℝ^d → T^d` is the covering map. The two lemmas below transport the cap +hypotheses to the torus and list the faces of the cylinder cap. The transport needs only that `e` +is continuous and open, that the target is Hausdorff and that the cap is compact; injectivity is +not used. -/ + +/-- Frontier of a compact image. If `e` is continuous and open, `X` is Hausdorff and `C` is +compact, every frontier point of `e '' C` is the image of a frontier point of `C`. -/ +theorem frontier_image_subset {Y : Type*} [TopologicalSpace Y] [T2Space X] {e : Y → X} + (hec : Continuous e) (heo : IsOpenMap e) {C : Set Y} (hC : IsCompact C) : + frontier (e '' C) ⊆ e '' frontier C := by + intro x hx + have hcl : IsClosed (e '' C) := (hC.image hec).isClosed + have hx1 : x ∈ e '' C := by + have h := hx.1 + rwa [hcl.closure_eq] at h + obtain ⟨y, hyC, rfl⟩ := hx1 + refine ⟨y, ⟨subset_closure hyC, fun hyi => hx.2 ?_⟩, rfl⟩ + exact interior_maximal (image_mono interior_subset) (heo _ isOpen_interior) ⟨y, hyi, rfl⟩ + +namespace CapHyp + +/-- **Transport along a chart.** The cap hypotheses for the lift `f ∘ e` on a compact cap `C` +give the cap hypotheses for `f` on `e '' C`, with the same `b` and `s`. -/ +theorem map {Y : Type*} [TopologicalSpace Y] [T2Space X] {e : Y → X} (hec : Continuous e) + (heo : IsOpenMap e) {f : X → ℝ} {C : Set Y} (hC : IsCompact C) {M z : Y} {b s : ℝ} + (H : CapHyp (f ∘ e) C M z b s) : CapHyp f (e '' C) (e M) (e z) b s where + mem := ⟨M, H.mem, rfl⟩ + ceiling := by + rintro _ ⟨y, hy, rfl⟩ + exact H.ceiling y hy + frontier_le := by + intro x hx + obtain ⟨y, hy, rfl⟩ := frontier_image_subset hec heo hC hx + exact H.frontier_le y hy + older := H.older + ridge := by + obtain ⟨γ, hγ⟩ := H.ridge + exact ⟨γ.map hec, fun t => hγ t⟩ + +/-- Transport of (C2⁺): if only `S` attains `s` on the frontier of `C` for the lift, only `e S` +attains it on the frontier of `e '' C`. -/ +theorem map_saddle {Y : Type*} [TopologicalSpace Y] [T2Space X] {e : Y → X} (hec : Continuous e) + (heo : IsOpenMap e) {f : X → ℝ} {C : Set Y} (hC : IsCompact C) {S : Y} {s : ℝ} + (hS : ∀ y ∈ frontier C, y ≠ S → (f ∘ e) y < s) : + ∀ x ∈ frontier (e '' C), x ≠ e S → f x < s := by + intro x hx hne + obtain ⟨y, hy, rfl⟩ := frontier_image_subset hec heo hC hx + exact hS y hy (fun h => hne (h ▸ rfl)) + +end CapHyp + +/-- **The faces of the cylinder cap** `[a, c] × B̄(0, R)`: the two end faces `{a, c} × B̄(0, R)` +and the curved side `[a, c] × S(0, R)`. These are the faces estimated in L17–L19. -/ +theorem frontier_cylinder {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] {a c R : ℝ} + (hac : a ≤ c) (hR : R ≠ 0) : + frontier (Icc a c ×ˢ Metric.closedBall (0 : E) R) = + ({a, c} : Set ℝ) ×ˢ Metric.closedBall (0 : E) R ∪ Icc a c ×ˢ Metric.sphere (0 : E) R := by + rw [frontier_prod_eq, closure_Icc, frontier_closedBall (0 : E) hR, frontier_Icc hac, + Metric.isClosed_closedBall.closure_eq] + exact union_comm _ _ + +/-- The cylinder cap is compact in finite dimension. -/ +theorem isCompact_cylinder {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [ProperSpace E] + (a c R : ℝ) : IsCompact (Icc a c ×ˢ Metric.closedBall (0 : E) R) := + isCompact_Icc.prod (isCompact_closedBall 0 R) + +/-- The covering map of the flat torus `(ℝ / Lℤ)^d`. -/ +def torusCover (L : ℝ) (d : ℕ) : (Fin d → ℝ) → (Fin d → AddCircle L) := + Pi.map fun _ => ((↑) : ℝ → AddCircle L) + +theorem torusCover_continuous (L : ℝ) (d : ℕ) : Continuous (torusCover L d) := + Continuous.piMap fun _ => continuous_quotient_mk' + +theorem torusCover_isOpenMap (L : ℝ) (d : ℕ) : IsOpenMap (torusCover L d) := + IsOpenMap.piMap (fun _ => QuotientAddGroup.isOpenMap_coe) + (Filter.Eventually.of_forall fun _ => QuotientAddGroup.mk_surjective) + +/-- **The cap on the torus.** Let `φ` be any coordinate frame (a homeomorphism onto `ℝ^d`), and +suppose the periodic lift `f ∘ torusCover L d ∘ φ` satisfies the cap hypotheses on a compact cap +`C`. Then `f` satisfies them on the image of `C` in the torus `(ℝ / Lℤ)^d`, with the same `b` and +`s`. No embedding radius is used. -/ +theorem CapHyp.toTorus {Y : Type*} [TopologicalSpace Y] {L : ℝ} {d : ℕ} + (φ : Y ≃ₜ (Fin d → ℝ)) {f : (Fin d → AddCircle L) → ℝ} {C : Set Y} (hC : IsCompact C) + {M z : Y} {b s : ℝ} (H : CapHyp (f ∘ (torusCover L d ∘ φ)) C M z b s) : + CapHyp f ((torusCover L d ∘ φ) '' C) (torusCover L d (φ M)) (torusCover L d (φ z)) b s := + H.map ((torusCover_continuous L d).comp φ.continuous) + ((torusCover_isOpenMap L d).comp φ.isOpenMap) hC + +/-! ### From the ridge to the cap hypotheses (L13, L16, L17, L19, L20) + +SP §2 normalizes the pins to `x = a = -r/2` and `x = c = r/2`, on the cap +`C = [-2r, r/2] × B̄(0, 2r)` in coordinates `(x, y) ∈ ℝ × E`. The multi-variable analytic steps +enter as hypotheses, each the output of a named step of SP: +- `hT` (L7): on the cap, `f (x, y) ≤ f (x, h x)`, with `h` the transverse maximizer; +- `hg` (L11): the ridge function `g x = f (x, h x)` has derivative `F x`; +- `hFa`, `hFc` (L13): `F a = F c = 0`, because the pins are critical; +- `hconv` (L12): `F - q` is convex, where `q x = (x - a)(x - c)/8`; this is SP's `F'' ≥ 1/4`; +- `hside` (L18): on the curved side, `f ≤ g c`; +- `hgap`: `g a - g c < 9r³/32`. SP's normalization `g a - g c = r³/6` satisfies it. + +From these inputs Lean derives the rest: +- L13: the sign pattern of `F`; +- L16: the ceiling `g ≤ g a` on `[-2r, c]`; +- L17: both exact face integrals `9r³/32`, by comparing `g` with the cubic + `Q x = x³/24 - r²x/32`; +- L19: the face assembly; +- L20: the ridge path. -/ + +section Ridge + +/-- A convex function that vanishes at `a ≤ c` is `≤ 0` between them. -/ +theorem convex_zeros_between {φ : ℝ → ℝ} {D : Set ℝ} (hφ : ConvexOn ℝ D φ) {a c : ℝ} + (haD : a ∈ D) (hcD : c ∈ D) (hac : a ≤ c) (ha : φ a = 0) (hc : φ c = 0) {x : ℝ} + (hx : x ∈ Icc a c) : φ x ≤ 0 := by + have h := hφ.le_on_segment haD hcD (by rw [segment_eq_Icc hac]; exact hx) + rwa [ha, hc, max_self] at h + +/-- A convex function that vanishes at `a < c` is `≥ 0` to the right of `c`. -/ +theorem convex_zeros_right {φ : ℝ → ℝ} {D : Set ℝ} (hφ : ConvexOn ℝ D φ) {a c : ℝ} + (haD : a ∈ D) (hac : a < c) (ha : φ a = 0) (hc : φ c = 0) {x : ℝ} (hxD : x ∈ D) + (hx : c ≤ x) : 0 ≤ φ x := by + rcases eq_or_lt_of_le hx with rfl | hlt + · rw [hc] + · have h := hφ.slope_mono_adjacent haD hxD hac hlt + rw [ha, hc, sub_self, zero_div, sub_zero] at h + rw [le_div_iff₀ (sub_pos.mpr hlt), zero_mul] at h + exact h + +/-- A convex function that vanishes at `a < c` is `≥ 0` to the left of `a`. -/ +theorem convex_zeros_left {φ : ℝ → ℝ} {D : Set ℝ} (hφ : ConvexOn ℝ D φ) {a c : ℝ} + (hcD : c ∈ D) (hac : a < c) (ha : φ a = 0) (hc : φ c = 0) {x : ℝ} (hxD : x ∈ D) + (hx : x ≤ a) : 0 ≤ φ x := by + rcases eq_or_lt_of_le hx with rfl | hlt + · rw [ha] + · have h := hφ.slope_mono_adjacent hxD hcD hlt hac + rw [ha, hc, sub_self, zero_div, zero_sub] at h + rw [div_le_iff₀ (sub_pos.mpr hlt), zero_mul] at h + linarith + +/-- **The ridge profile (L13, L16, L17, L20).** On `D = [-2r, 2r]`, let `g' = F`, with `F` +vanishing at the pins `∓r/2` and `F - (x + r/2)(x - r/2)/8` convex. Then: +- `g ≤ g(-r/2)` on `[-2r, r/2]`; +- `g ≥ g(r/2)` on `[-r/2, 2r]`; +- `g(-2r) ≤ g(-r/2) - 9r³/32`; +- `g(2r) ≥ g(r/2) + 9r³/32`. -/ +theorem ridge_profile {g F : ℝ → ℝ} {r : ℝ} (hr : 0 < r) + (hg : ∀ x ∈ Icc (-2 * r) (2 * r), HasDerivAt g (F x) x) + (hFa : F (-r / 2) = 0) (hFc : F (r / 2) = 0) + (hconv : ConvexOn ℝ (Icc (-2 * r) (2 * r)) (fun x => F x - (x + r / 2) * (x - r / 2) / 8)) : + (∀ x ∈ Icc (-2 * r) (r / 2), g x ≤ g (-r / 2)) ∧ + (∀ x ∈ Icc (-r / 2) (2 * r), g (r / 2) ≤ g x) ∧ + g (-2 * r) ≤ g (-r / 2) - 9 * r ^ 3 / 32 ∧ g (r / 2) + 9 * r ^ 3 / 32 ≤ g (2 * r) := by + have hac : -r / 2 < r / 2 := by linarith + have haD : -r / 2 ∈ Icc (-2 * r) (2 * r) := ⟨by linarith, by linarith⟩ + have hcD : r / 2 ∈ Icc (-2 * r) (2 * r) := ⟨by linarith, by linarith⟩ + have hLD : Icc (-2 * r) (-r / 2) ⊆ Icc (-2 * r) (2 * r) := Icc_subset_Icc le_rfl (by linarith) + have hMD : Icc (-r / 2) (r / 2) ⊆ Icc (-2 * r) (2 * r) := + Icc_subset_Icc (by linarith) (by linarith) + have hRD : Icc (r / 2) (2 * r) ⊆ Icc (-2 * r) (2 * r) := Icc_subset_Icc (by linarith) le_rfl + set φ : ℝ → ℝ := fun x => F x - (x + r / 2) * (x - r / 2) / 8 with hφdef + have hφa : φ (-r / 2) = 0 := by simp only [hφdef, hFa]; ring + have hφc : φ (r / 2) = 0 := by simp only [hφdef, hFc]; ring + have hgc : ContinuousOn g (Icc (-2 * r) (2 * r)) := + fun x hx => (hg x hx).continuousAt.continuousWithinAt + -- L13: the sign pattern of `F` + have hFl : ∀ x ∈ Icc (-2 * r) (-r / 2), 0 ≤ F x := by + intro x hx + have h1 := convex_zeros_left hconv hcD hac hφa hφc (hLD hx) hx.2 + have h2 : 0 ≤ (x + r / 2) * (x - r / 2) / 8 := by + have : 0 ≤ (x + r / 2) * (x - r / 2) := + mul_nonneg_of_nonpos_of_nonpos (by linarith [hx.2]) (by linarith [hx.2]) + positivity + simp only [hφdef] at h1 + linarith + have hFm : ∀ x ∈ Icc (-r / 2) (r / 2), F x ≤ 0 := by + intro x hx + have h1 := convex_zeros_between hconv haD hcD hac.le hφa hφc hx + have h2 : (x + r / 2) * (x - r / 2) ≤ 0 := + mul_nonpos_of_nonneg_of_nonpos (by linarith [hx.1]) (by linarith [hx.2]) + simp only [hφdef] at h1 + linarith + have hFr : ∀ x ∈ Icc (r / 2) (2 * r), 0 ≤ F x := by + intro x hx + have h1 := convex_zeros_right hconv haD hac hφa hφc (hRD hx) hx.1 + have h2 : 0 ≤ (x + r / 2) * (x - r / 2) := mul_nonneg (by linarith [hx.1]) (by linarith [hx.1]) + simp only [hφdef] at h1 + linarith + -- monotonicity of `g` on the three pieces + have hmonoL : MonotoneOn g (Icc (-2 * r) (-r / 2)) := + monotoneOn_of_hasDerivWithinAt_nonneg (convex_Icc _ _) (hgc.mono hLD) + (fun x hx => (hg x (hLD (interior_subset hx))).hasDerivWithinAt) + (fun x hx => hFl x (interior_subset hx)) + have hantiM : AntitoneOn g (Icc (-r / 2) (r / 2)) := + antitoneOn_of_hasDerivWithinAt_nonpos (convex_Icc _ _) (hgc.mono hMD) + (fun x hx => (hg x (hMD (interior_subset hx))).hasDerivWithinAt) + (fun x hx => hFm x (interior_subset hx)) + have hmonoR : MonotoneOn g (Icc (r / 2) (2 * r)) := + monotoneOn_of_hasDerivWithinAt_nonneg (convex_Icc _ _) (hgc.mono hRD) + (fun x hx => (hg x (hRD (interior_subset hx))).hasDerivWithinAt) + (fun x hx => hFr x (interior_subset hx)) + -- L17: compare `g` with the cubic `Q`, whose derivative is `(x + r/2)(x - r/2)/8` + set Q : ℝ → ℝ := fun x => x ^ 3 / 24 - r ^ 2 * x / 32 with hQdef + have hQ : ∀ x, HasDerivAt Q ((x + r / 2) * (x - r / 2) / 8) x := by + intro x + have h1 := ((hasDerivAt_pow 3 x).div_const 24).sub ((hasDerivAt_id x).const_mul (r ^ 2 / 32)) + convert h1 using 1 + · funext y + simp only [hQdef, id, Pi.sub_apply] + ring + · push_cast + ring + have hG : ∀ x ∈ Icc (-2 * r) (2 * r), HasDerivAt (fun x => g x - Q x) (φ x) x := + fun x hx => (hg x hx).sub (hQ x) + have hGc : ContinuousOn (fun x => g x - Q x) (Icc (-2 * r) (2 * r)) := + fun x hx => (hG x hx).continuousAt.continuousWithinAt + have hGL : MonotoneOn (fun x => g x - Q x) (Icc (-2 * r) (-r / 2)) := + monotoneOn_of_hasDerivWithinAt_nonneg (convex_Icc _ _) (hGc.mono hLD) + (fun x hx => (hG x (hLD (interior_subset hx))).hasDerivWithinAt) + (fun x hx => convex_zeros_left hconv hcD hac hφa hφc (hLD (interior_subset hx)) + (interior_subset hx).2) + have hGR : MonotoneOn (fun x => g x - Q x) (Icc (r / 2) (2 * r)) := + monotoneOn_of_hasDerivWithinAt_nonneg (convex_Icc _ _) (hGc.mono hRD) + (fun x hx => (hG x (hRD (interior_subset hx))).hasDerivWithinAt) + (fun x hx => convex_zeros_right hconv haD hac hφa hφc (hRD (interior_subset hx)) + (interior_subset hx).1) + have hLa : (-r / 2 : ℝ) ∈ Icc (-2 * r) (-r / 2) := ⟨by linarith, le_rfl⟩ + have hL2 : (-2 * r : ℝ) ∈ Icc (-2 * r) (-r / 2) := ⟨le_rfl, by linarith⟩ + have hRc : (r / 2 : ℝ) ∈ Icc (r / 2) (2 * r) := ⟨le_rfl, by linarith⟩ + have hR2 : (2 * r : ℝ) ∈ Icc (r / 2) (2 * r) := ⟨by linarith, le_rfl⟩ + refine ⟨?_, ?_, ?_, ?_⟩ + · intro x hx + rcases le_or_gt x (-r / 2) with h | h + · exact hmonoL ⟨hx.1, h⟩ hLa h + · exact hantiM ⟨le_rfl, hac.le⟩ ⟨h.le, hx.2⟩ h.le + · intro x hx + rcases le_or_gt x (r / 2) with h | h + · exact hantiM ⟨hx.1, h⟩ ⟨hac.le, le_rfl⟩ h + · exact hmonoR hRc ⟨h.le, hx.2⟩ h.le + · have h := hGL hL2 hLa (by linarith) + simp only [hQdef] at h + nlinarith [h] + · have h := hGR hRc hR2 (by linarith) + simp only [hQdef] at h + nlinarith [h] + +variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + +/-- **The cap hypotheses from the ridge (L16, L17, L19, L20).** Under the analytic inputs listed +above, `f` satisfies (C1)–(C3) on `C = [-2r, r/2] × B̄(0, 2r)`, with `M = (-r/2, h(-r/2))`, +`z = (2r, h(2r))`, `b = g(-r/2)` and `s = g(r/2)`. Every input is local: `g' = F` and the convexity +hold on `[-2r, 2r]`, and `h` is continuous on `[-r/2, 2r]`. -/ +theorem ridge_capHyp {f : ℝ × E → ℝ} {h : ℝ → E} {F : ℝ → ℝ} {r : ℝ} (hr : 0 < r) + (hh : ContinuousOn h (Icc (-r / 2) (2 * r))) + (hg : ∀ x ∈ Icc (-2 * r) (2 * r), HasDerivAt (fun x => f (x, h x)) (F x) x) + (hFa : F (-r / 2) = 0) (hFc : F (r / 2) = 0) + (hconv : ConvexOn ℝ (Icc (-2 * r) (2 * r)) (fun x => F x - (x + r / 2) * (x - r / 2) / 8)) + (hT : ∀ p ∈ Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r), f p ≤ f (p.1, h p.1)) + (hside : ∀ p ∈ Icc (-2 * r) (r / 2) ×ˢ Metric.sphere (0 : E) (2 * r), + f p ≤ f (r / 2, h (r / 2))) + (hM : ‖h (-r / 2)‖ ≤ 2 * r) + (hgap : f (-r / 2, h (-r / 2)) - f (r / 2, h (r / 2)) < 9 * r ^ 3 / 32) : + CapHyp f (Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r)) (-r / 2, h (-r / 2)) + (2 * r, h (2 * r)) (f (-r / 2, h (-r / 2))) (f (r / 2, h (r / 2))) := by + obtain ⟨hceil, hfloor, hleft, hright⟩ := ridge_profile hr hg hFa hFc hconv + have hcyl : frontier (Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r)) = + ({-2 * r, r / 2} : Set ℝ) ×ˢ Metric.closedBall (0 : E) (2 * r) ∪ + Icc (-2 * r) (r / 2) ×ˢ Metric.sphere (0 : E) (2 * r) := + frontier_cylinder (by linarith) (by positivity) + set xt : I → ℝ := fun t => -r / 2 + (t : ℝ) * (2 * r - -r / 2) with hxt + have hxc : Continuous xt := continuous_const.add (continuous_subtype_val.mul continuous_const) + have hx0 : xt 0 = -r / 2 := by simp [hxt] + have hx1 : xt 1 = 2 * r := by simp [hxt] + have hxmem : ∀ t, xt t ∈ Icc (-r / 2) (2 * r) := by + intro t + have h0 := t.2.1 + have h1 := t.2.2 + simp only [hxt] + constructor <;> nlinarith + let γ : Path ((-r / 2 : ℝ), h (-r / 2)) (2 * r, h (2 * r)) := + { toFun := fun t => (xt t, h (xt t)) + continuous_toFun := hxc.prodMk (hh.comp_continuous hxc hxmem) + source' := by simp only [hx0] + target' := by simp only [hx1] } + refine ⟨⟨⟨by linarith, by linarith⟩, mem_closedBall_zero_iff.mpr hM⟩, ?_, ?_, ?_, ⟨γ, ?_⟩⟩ + · intro p hp + exact (hT p hp).trans (hceil p.1 hp.1) + · intro p hp + rw [hcyl] at hp + rcases hp with ⟨hp1, hp2⟩ | hp + · have hpC : p ∈ Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r) := by + refine ⟨?_, hp2⟩ + rcases hp1 with h1 | h1 + · rw [h1]; exact ⟨le_refl _, by linarith⟩ + · rw [h1]; exact ⟨by linarith, le_refl _⟩ + have h0 := hT p hpC + rcases hp1 with h1 | h1 + · rw [h1] at h0 + linarith + · rw [h1] at h0 + exact h0 + · exact hside p hp + · linarith + · intro t + exact hfloor (xt t) (hxmem t) + +/-- **(C2⁺) from the ridge.** If, in addition, `h x` is the unique transverse maximizer on the +cap and the curved side is strictly below `g c` (L7, L18), then `S = (r/2, h(r/2))` is the only +frontier point at height `s`. -/ +theorem ridge_saddle_strict {f : ℝ × E → ℝ} {h : ℝ → E} {F : ℝ → ℝ} {r : ℝ} (hr : 0 < r) + (hg : ∀ x ∈ Icc (-2 * r) (2 * r), HasDerivAt (fun x => f (x, h x)) (F x) x) + (hFa : F (-r / 2) = 0) (hFc : F (r / 2) = 0) + (hconv : ConvexOn ℝ (Icc (-2 * r) (2 * r)) (fun x => F x - (x + r / 2) * (x - r / 2) / 8)) + (hT : ∀ p ∈ Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r), f p ≤ f (p.1, h p.1)) + (hTs : ∀ p ∈ Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r), p.2 ≠ h p.1 → + f p < f (p.1, h p.1)) + (hside : ∀ p ∈ Icc (-2 * r) (r / 2) ×ˢ Metric.sphere (0 : E) (2 * r), + f p < f (r / 2, h (r / 2))) + (hgap : f (-r / 2, h (-r / 2)) - f (r / 2, h (r / 2)) < 9 * r ^ 3 / 32) : + ∀ x ∈ frontier (Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r)), + x ≠ (r / 2, h (r / 2)) → f x < f (r / 2, h (r / 2)) := by + obtain ⟨-, -, hleft, -⟩ := ridge_profile hr hg hFa hFc hconv + intro p hp hne + rw [frontier_cylinder (by linarith) (by positivity)] at hp + rcases hp with ⟨hp1, hp2⟩ | hp + · rcases hp1 with h1 | h1 + · have hpC : p ∈ Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r) := + ⟨by rw [h1]; exact ⟨le_refl _, by linarith⟩, hp2⟩ + have h0 := hT p hpC + rw [h1] at h0 + linarith + · have hpC : p ∈ Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r) := + ⟨by rw [h1]; exact ⟨by linarith, le_refl _⟩, hp2⟩ + have hy : p.2 ≠ h p.1 := by + intro hy + apply hne + rw [h1] at hy + exact Prod.ext h1 hy + have h0 := hTs p hpC hy + rw [h1] at h0 + exact h0 + · exact hside p hp + +end Ridge + +/-! ### The transverse slices (L7, L8, L11, L18) + +`ridge_capHyp` takes the transverse maximum (`hT`), its uniqueness (`hTs`), the curved side +(`hside`) and the ridge equation `g' = F` as inputs. SP derives them deterministically from L4 +(each slice `y ↦ f (x, y)` is `δ`-strongly concave on `B̄(0, 2r)`), L5 (the transverse derivative +`w x` at `y = 0` has norm at most `ω`) and the ridge equation `∂_y f (x, h x) = 0`. This section +proves those derivations. -/ + +section Slice + +open Filter Topology + +variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + +/-- **Strong concavity about a point with a derivative (the engine of L7, L8, L18).** If `φ` is +`δ`-strongly concave on `K`, `p ∈ K`, and `φ` has derivative `L` at `p`, then +`φ y ≤ φ p + L (y - p) - (δ/2)‖y - p‖²` for every `y ∈ K`. `p` need not be interior: only the +segment from `p` to `y`, which lies in `K`, is used. -/ +theorem strongConcave_le_of_hasFDerivAt {K : Set E} {φ : E → ℝ} {δ : ℝ} {p : E} + {L : E →L[ℝ] ℝ} (hφ : StrongConcaveOn K δ φ) (hp : p ∈ K) (hd : HasFDerivAt φ L p) {y : E} + (hy : y ∈ K) : φ y ≤ φ p + L (y - p) - δ / 2 * ‖y - p‖ ^ 2 := by + set v := y - p with hv + have h1 : HasDerivAt (fun t : ℝ => p + t • v) v 0 := by + simpa using ((hasDerivAt_id (0 : ℝ)).smul_const v).const_add p + have h2 : HasFDerivAt φ L (p + (0 : ℝ) • v) := by simpa using hd + have hline : HasDerivAt (fun t : ℝ => φ (p + t • v)) (L v) 0 := h2.comp_hasDerivAt (0 : ℝ) h1 + have hslope := hline.tendsto_slope_zero_right + have hbound : ∀ᶠ t in 𝓝[>] (0 : ℝ), + φ y - φ p + (1 - t) * (δ / 2 * ‖v‖ ^ 2) ≤ + t⁻¹ • (φ (p + (0 + t) • v) - φ (p + (0 : ℝ) • v)) := by + have hlt : ∀ᶠ t in 𝓝[>] (0 : ℝ), t < 1 := + nhdsWithin_le_nhds (Iio_mem_nhds one_pos) + filter_upwards [self_mem_nhdsWithin, hlt] with t (ht0 : 0 < t) ht1 + have key := hφ.2 hp hy (by linarith : (0 : ℝ) ≤ 1 - t) ht0.le (by ring : 1 - t + t = 1) + have hpt : (1 - t) • p + t • y = p + t • v := by + simp only [hv, smul_sub, sub_smul, one_smul]; abel + have hnorm : ‖p - y‖ = ‖v‖ := by rw [hv, norm_sub_rev] + rw [hpt, hnorm, smul_eq_mul, smul_eq_mul] at key + simp only [zero_smul, add_zero, zero_add, smul_eq_mul] + rw [le_inv_mul_iff₀ ht0] + nlinarith [key] + have hlim : Tendsto (fun t : ℝ => φ y - φ p + (1 - t) * (δ / 2 * ‖v‖ ^ 2)) (𝓝[>] 0) + (𝓝 (φ y - φ p + (1 - 0) * (δ / 2 * ‖v‖ ^ 2))) := + ((continuous_const.add ((continuous_const.sub continuous_id).mul continuous_const)).tendsto + 0).mono_left nhdsWithin_le_nhds + have := le_of_tendsto_of_tendsto hlim hslope hbound + simp only [sub_zero, one_mul] at this + linarith + +/-- **L7 (the transverse maximum).** At a critical point `p` of a `δ`-strongly concave slice, +`φ y ≤ φ p - (δ/2)‖y - p‖²` on `K`. With `δ > 0` the maximizer is unique. -/ +theorem slice_le {K : Set E} {φ : E → ℝ} {δ : ℝ} {p : E} + (hφ : StrongConcaveOn K δ φ) (hp : p ∈ K) (hd : HasFDerivAt φ (0 : E →L[ℝ] ℝ) p) + {y : E} (hy : y ∈ K) : φ y ≤ φ p - δ / 2 * ‖y - p‖ ^ 2 := by + simpa using strongConcave_le_of_hasFDerivAt hφ hp hd hy + +/-- **L8 (the ridge bound).** If `0, p ∈ K`, `p` is critical and `w` is the derivative at `0`, +then `δ ‖p‖ ≤ ‖w‖`, i.e. `‖h(x)‖ ≤ ‖w(x)‖/δ`. -/ +theorem slice_ridge_bound {K : Set E} {φ : E → ℝ} {δ : ℝ} {p : E} {w : E →L[ℝ] ℝ} + (hφ : StrongConcaveOn K δ φ) (h0 : (0 : E) ∈ K) (hp : p ∈ K) + (hd : HasFDerivAt φ (0 : E →L[ℝ] ℝ) p) (hw : HasFDerivAt φ w 0) : δ * ‖p‖ ≤ ‖w‖ := by + have h1 := slice_le hφ hp hd h0 + have h2 := strongConcave_le_of_hasFDerivAt hφ h0 hw hp + simp only [zero_sub, norm_neg, sub_zero] at h1 h2 + have h3 : w p ≤ ‖w‖ * ‖p‖ := + (le_abs_self _).trans (by simpa [Real.norm_eq_abs] using w.le_opNorm p) + have h4 : δ * ‖p‖ * ‖p‖ ≤ ‖w‖ * ‖p‖ := by nlinarith + rcases (norm_nonneg p).eq_or_lt with h | h + · rw [← h, mul_zero]; exact norm_nonneg w + · exact le_of_mul_le_mul_right h4 h + +/-- **L18 (the curved side).** On the sphere of radius `R`, the slice is strictly below `s` +once `φ p ≤ b`, `‖w‖ ≤ ω ≤ Rδ` and `2δ(b - s) < (Rδ - ω)²`. -/ +theorem slice_curved {φ : E → ℝ} {δ ω R b s : ℝ} {p : E} {w : E →L[ℝ] ℝ} + (hφ : StrongConcaveOn (Metric.closedBall (0 : E) R) δ φ) (hδ : 0 < δ) + (hp : p ∈ Metric.closedBall (0 : E) R) (hd : HasFDerivAt φ (0 : E →L[ℝ] ℝ) p) + (hw : HasFDerivAt φ w 0) (hω : ‖w‖ ≤ ω) (hωR : ω ≤ R * δ) (hb : φ p ≤ b) + (hcurv : 2 * δ * (b - s) < (R * δ - ω) ^ 2) {y : E} (hy : y ∈ Metric.sphere (0 : E) R) : + φ y < s := by + have hyn : ‖y‖ = R := mem_sphere_zero_iff_norm.mp hy + have hR : 0 ≤ R := hyn ▸ norm_nonneg y + have h0 : (0 : E) ∈ Metric.closedBall (0 : E) R := Metric.mem_closedBall_self hR + have hL8 := slice_ridge_bound hφ h0 hp hd hw + have hL7 := slice_le hφ hp hd (Metric.sphere_subset_closedBall hy) + have htri : R - ‖p‖ ≤ ‖y - p‖ := by have := norm_sub_norm_le y p; linarith + have hρ : R * δ - ω ≤ δ * ‖y - p‖ := by nlinarith + have hsq : (R * δ - ω) ^ 2 ≤ (δ * ‖y - p‖) ^ 2 := pow_le_pow_left₀ (by linarith) hρ 2 + have h5 : δ * (2 * (b - s)) < δ * (δ * ‖y - p‖ ^ 2) := by nlinarith + have h6 : 2 * (b - s) < δ * ‖y - p‖ ^ 2 := lt_of_mul_lt_mul_left h5 hδ.le + linarith + +/-- The derivative of a slice `y ↦ f (x, y)` is the joint derivative restricted to the +transverse directions. -/ +theorem slice_hasFDerivAt {f : ℝ × E → ℝ} {x : ℝ} {y : E} {D : ℝ × E →L[ℝ] ℝ} + (hf : HasFDerivAt f D (x, y)) : + HasFDerivAt (fun y' => f (x, y')) (D.comp (ContinuousLinearMap.inr ℝ ℝ E)) y := + hf.comp y (hasFDerivAt_prodMk_right x y) + +/-- **L11 (the ridge function's derivative).** If `f` has joint derivative `D` at `(x, h x)`, +`h` has derivative `h'` at `x`, and the transverse part of `D` vanishes (the ridge equation +`∂_y f = 0`), then `g = f (·, h ·)` has derivative `F x = D (1, 0) = ∂_x f (x, h x)`: the +`∂_y f · h'` term drops out. -/ +theorem ridge_hasDerivAt {f : ℝ × E → ℝ} {h : ℝ → E} {x : ℝ} {D : ℝ × E →L[ℝ] ℝ} {h' : E} + (hf : HasFDerivAt f D (x, h x)) (hh : HasDerivAt h h' x) + (hy : D.comp (ContinuousLinearMap.inr ℝ ℝ E) = 0) : + HasDerivAt (fun t => f (t, h t)) (D (1, 0)) x := by + have hp : HasDerivAt (fun t => (t, h t)) ((1 : ℝ), h') x := (hasDerivAt_id x).prodMk hh + have hc := hf.comp_hasDerivAt x hp + have h0 : D (0, h') = 0 := by + simpa using congrArg (fun L : E →L[ℝ] ℝ => L h') hy + have hD : D (1, h') = D (1, 0) := by + calc D (1, h') = D ((1, 0) + (0, h')) := by simp + _ = D (1, 0) + D (0, h') := map_add _ _ _ + _ = D (1, 0) := by rw [h0, add_zero] + rw [← hD] + exact hc + +/-- **(C1)–(C3) and (C2⁺) from the slices.** `ridge_capHyp` and `ridge_saddle_strict` with +`hT`, `hTs`, `hside` and `hM` derived (L7, L8, L18) from L4 (`hconc`), the critical points +`h x ∈ B̄(0, 2r)` (`hball`, `hcrit`; L7's existence part), L5 (`hw`, `hω`) and the curvature +condition `2δ(b - s) < (2rδ - ω)²`, which SP's constants satisfy (`sp_curved_side_constants`). -/ +theorem ridge_capHyp_of_slices {f : ℝ × E → ℝ} {h : ℝ → E} {F : ℝ → ℝ} {w : ℝ → E →L[ℝ] ℝ} + {r δ ω : ℝ} (hr : 0 < r) (hδ : 0 < δ) + (hh : ContinuousOn h (Icc (-r / 2) (2 * r))) + (hg : ∀ x ∈ Icc (-2 * r) (2 * r), HasDerivAt (fun x => f (x, h x)) (F x) x) + (hFa : F (-r / 2) = 0) (hFc : F (r / 2) = 0) + (hconv : ConvexOn ℝ (Icc (-2 * r) (2 * r)) (fun x => F x - (x + r / 2) * (x - r / 2) / 8)) + (hconc : ∀ x ∈ Icc (-2 * r) (r / 2), + StrongConcaveOn (Metric.closedBall (0 : E) (2 * r)) δ (fun y => f (x, y))) + (hball : ∀ x ∈ Icc (-2 * r) (r / 2), h x ∈ Metric.closedBall (0 : E) (2 * r)) + (hcrit : ∀ x ∈ Icc (-2 * r) (r / 2), + HasFDerivAt (fun y => f (x, y)) (0 : E →L[ℝ] ℝ) (h x)) + (hw : ∀ x ∈ Icc (-2 * r) (r / 2), HasFDerivAt (fun y => f (x, y)) (w x) (0 : E)) + (hω : ∀ x ∈ Icc (-2 * r) (r / 2), ‖w x‖ ≤ ω) (hωr : ω ≤ 2 * r * δ) + (hcurv : 2 * δ * (f (-r / 2, h (-r / 2)) - f (r / 2, h (r / 2))) < (2 * r * δ - ω) ^ 2) + (hgap : f (-r / 2, h (-r / 2)) - f (r / 2, h (r / 2)) < 9 * r ^ 3 / 32) : + CapHyp f (Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r)) (-r / 2, h (-r / 2)) + (2 * r, h (2 * r)) (f (-r / 2, h (-r / 2))) (f (r / 2, h (r / 2))) ∧ + ∀ x ∈ frontier (Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r)), + x ≠ (r / 2, h (r / 2)) → f x < f (r / 2, h (r / 2)) := by + obtain ⟨hceil, -, -, -⟩ := ridge_profile hr hg hFa hFc hconv + have hT : ∀ p ∈ Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r), + f p ≤ f (p.1, h p.1) := by + rintro ⟨x, y⟩ ⟨hx, hy⟩ + have h1 := slice_le (hconc x hx) (hball x hx) (hcrit x hx) hy + have h2 : 0 ≤ δ / 2 * ‖y - h x‖ ^ 2 := by positivity + simp only at h1 ⊢ + linarith + have hTs : ∀ p ∈ Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r), p.2 ≠ h p.1 → + f p < f (p.1, h p.1) := by + rintro ⟨x, y⟩ ⟨hx, hy⟩ hne + have h1 := slice_le (hconc x hx) (hball x hx) (hcrit x hx) hy + have h2 : 0 < ‖y - h x‖ := norm_pos_iff.mpr (sub_ne_zero.mpr hne) + have h3 : 0 < δ / 2 * ‖y - h x‖ ^ 2 := mul_pos (by linarith) (pow_pos h2 2) + simp only at h1 ⊢ + linarith + have hside : ∀ p ∈ Icc (-2 * r) (r / 2) ×ˢ Metric.sphere (0 : E) (2 * r), + f p < f (r / 2, h (r / 2)) := by + rintro ⟨x, y⟩ ⟨hx, hy⟩ + exact slice_curved (hconc x hx) hδ (hball x hx) (hcrit x hx) (hw x hx) (hω x hx) hωr + (hceil x hx) hcurv hy + have hM : ‖h (-r / 2)‖ ≤ 2 * r := by + simpa using hball (-r / 2) ⟨by linarith, by linarith⟩ + exact ⟨ridge_capHyp hr hh hg hFa hFc hconv hT (fun p hp => (hside p hp).le) hM hgap, + ridge_saddle_strict hr hg hFa hFc hconv hT hTs hside hgap⟩ + +/-- **The joint form (L7, L11).** From a joint derivative `D x` of `f` along the ridge, a +differentiable `h` and the ridge equation `(D x) ∘ inr = 0`, the inputs `hh`, `hg` (with +`F x = D x (1, 0)`) and `hcrit` of `ridge_capHyp_of_slices` follow. -/ +theorem ridge_inputs_of_joint {f : ℝ × E → ℝ} {h h' : ℝ → E} {D : ℝ → ℝ × E →L[ℝ] ℝ} {r : ℝ} + (hr : 0 < r) (hD : ∀ x ∈ Icc (-2 * r) (2 * r), HasFDerivAt f (D x) (x, h x)) + (hh' : ∀ x ∈ Icc (-2 * r) (2 * r), HasDerivAt h (h' x) x) + (hridge : ∀ x ∈ Icc (-2 * r) (2 * r), (D x).comp (ContinuousLinearMap.inr ℝ ℝ E) = 0) : + ContinuousOn h (Icc (-r / 2) (2 * r)) ∧ + (∀ x ∈ Icc (-2 * r) (2 * r), HasDerivAt (fun x => f (x, h x)) (D x (1, 0)) x) ∧ + ∀ x ∈ Icc (-2 * r) (r / 2), HasFDerivAt (fun y => f (x, y)) (0 : E →L[ℝ] ℝ) (h x) := by + refine ⟨fun x hx => ?_, fun x hx => ridge_hasDerivAt (hD x hx) (hh' x hx) (hridge x hx), + fun x hx => ?_⟩ + · exact (hh' x ⟨by linarith [hx.1], hx.2⟩).continuousAt.continuousWithinAt + · have hx' : x ∈ Icc (-2 * r) (2 * r) := ⟨hx.1, by linarith [hx.2]⟩ + simpa [hridge x hx'] using slice_hasFDerivAt (hD x hx') + +/-- **SP's constants satisfy the curvature condition (L4, L5, L18).** With `m ≥ 2`, +`δ > r m (8m - 5)` (L4, `k = 8m - 5`), `0 ≤ ω ≤ 2 m r²` (L5) and SP's gap `b - s = r³/6`: +`ω ≤ 2rδ` and `2δ · r³/6 < (2rδ - ω)²`. -/ +theorem sp_curved_side_constants {r m δ ω : ℝ} (hr : 0 < r) (hm : 2 ≤ m) + (hδ : r * m * (8 * m - 5) < δ) (hω0 : 0 ≤ ω) (hω : ω ≤ 2 * m * r ^ 2) : + ω ≤ 2 * r * δ ∧ 2 * δ * (r ^ 3 / 6) < (2 * r * δ - ω) ^ 2 := by + have hk : 11 ≤ 8 * m - 5 := by linarith + have hrm : 0 < r * m := by positivity + have h11 : 11 * (r * m) < δ := by nlinarith + have h22 : 22 * r < δ := by nlinarith + have hωδ : 11 * ω < 2 * r * δ := by nlinarith + have hpos : 20 * r * δ < 11 * (2 * r * δ - ω) := by nlinarith + refine ⟨by linarith, ?_⟩ + have hsq : (20 * r * δ) ^ 2 < (11 * (2 * r * δ - ω)) ^ 2 := + pow_lt_pow_left₀ hpos (by have hδ0 : 0 < δ := by linarith + positivity) two_ne_zero + nlinarith [hsq] + +/-- Adding the affine function `(m/2)((t - a)(t - c) - t²)` preserves convexity. -/ +theorem convexOn_add_node {u : ℝ → ℝ} {D : Set ℝ} {a c m : ℝ} + (hcv : ConvexOn ℝ D (fun t => u t + m / 2 * t ^ 2)) : + ConvexOn ℝ D (fun t => u t + m / 2 * ((t - a) * (t - c))) := by + refine ⟨hcv.1, fun x hx y hy p q hp hq hpq => ?_⟩ + have h := hcv.2 hx hy hp hq hpq + simp only [smul_eq_mul] at h ⊢ + have key : (u (p * x + q * y) + m / 2 * ((p * x + q * y - a) * (p * x + q * y - c))) - + (p * (u x + m / 2 * ((x - a) * (x - c))) + q * (u y + m / 2 * ((y - a) * (y - c)))) = + (u (p * x + q * y) + m / 2 * (p * x + q * y) ^ 2) - + (p * (u x + m / 2 * x ^ 2) + q * (u y + m / 2 * y ^ 2)) := by + have hq' : q = 1 - p := by linarith + subst hq' + ring + linarith + +/-- **L5 (two-node interpolation), scalar form.** If `u + (m/2) t²` is convex and `u - (m/2) t²` is +concave on `D` (the weak form of `|u''| ≤ m`) and `u` vanishes at `a < c` in `D`, then +`|u x| ≤ (m/2) |(x - a)(x - c)|` for every `x ∈ D`, inside or outside `[a, c]`. -/ +theorem two_node_bound {u : ℝ → ℝ} {D : Set ℝ} {a c m : ℝ} + (hcv : ConvexOn ℝ D (fun t => u t + m / 2 * t ^ 2)) + (hcc : ConcaveOn ℝ D (fun t => u t - m / 2 * t ^ 2)) + (haD : a ∈ D) (hcD : c ∈ D) (hac : a < c) (ha : u a = 0) (hc : u c = 0) {x : ℝ} + (hx : x ∈ D) : |u x| ≤ m / 2 * |(x - a) * (x - c)| := by + have hψ := convexOn_add_node (a := a) (c := c) hcv + have hcv' : ConvexOn ℝ D (fun t => -u t + m / 2 * t ^ 2) := + hcc.neg.congr fun t _ => by simp only [Pi.neg_apply]; ring + have hχ := convexOn_add_node (a := a) (c := c) hcv' + have hψa : u a + m / 2 * ((a - a) * (a - c)) = 0 := by rw [ha]; ring + have hψc : u c + m / 2 * ((c - a) * (c - c)) = 0 := by rw [hc]; ring + have hχa : -u a + m / 2 * ((a - a) * (a - c)) = 0 := by rw [ha]; ring + have hχc : -u c + m / 2 * ((c - a) * (c - c)) = 0 := by rw [hc]; ring + rcases le_or_gt x a with hxa | hxa + · have h1 := convex_zeros_left hψ hcD hac hψa hψc hx hxa + have h2 := convex_zeros_left hχ hcD hac hχa hχc hx hxa + have hP : 0 ≤ (x - a) * (x - c) := mul_nonneg_of_nonpos_of_nonpos (by linarith) (by linarith) + rw [abs_of_nonneg hP, abs_le] + constructor <;> linarith + rcases le_or_gt c x with hcx | hcx + · have h1 := convex_zeros_right hψ haD hac hψa hψc hx hcx + have h2 := convex_zeros_right hχ haD hac hχa hχc hx hcx + have hP : 0 ≤ (x - a) * (x - c) := mul_nonneg (by linarith) (by linarith) + rw [abs_of_nonneg hP, abs_le] + constructor <;> linarith + · have h1 := convex_zeros_between hψ haD hcD hac.le hψa hψc ⟨hxa.le, hcx.le⟩ + have h2 := convex_zeros_between hχ haD hcD hac.le hχa hχc ⟨hxa.le, hcx.le⟩ + have hP : (x - a) * (x - c) ≤ 0 := mul_nonpos_of_nonneg_of_nonpos (by linarith) (by linarith) + rw [abs_of_nonpos hP, abs_le] + constructor <;> linarith + +/-- **L5 (the transverse gradient at `y = 0`).** If the slice derivatives `w t` at `y = 0` vanish at +the pins `a < c` and, for every direction `v`, `t ↦ w t v` has second derivative bounded by +`m ‖v‖` in the weak form below, then `‖w x‖ ≤ (m/2) |(x - a)(x - c)|` on `D`. -/ +theorem slice_gradient_bound {w : ℝ → E →L[ℝ] ℝ} {D : Set ℝ} {a c m : ℝ} (hm : 0 ≤ m) + (hcv : ∀ v : E, ConvexOn ℝ D (fun t => w t v + m * ‖v‖ / 2 * t ^ 2)) + (hcc : ∀ v : E, ConcaveOn ℝ D (fun t => w t v - m * ‖v‖ / 2 * t ^ 2)) + (haD : a ∈ D) (hcD : c ∈ D) (hac : a < c) (ha : w a = 0) (hc : w c = 0) {x : ℝ} + (hx : x ∈ D) : ‖w x‖ ≤ m / 2 * |(x - a) * (x - c)| := by + refine ContinuousLinearMap.opNorm_le_bound _ (by positivity) fun v => ?_ + have h := two_node_bound (u := fun t => w t v) (m := m * ‖v‖) (hcv v) (hcc v) haD hcD hac + (by simp [ha]) (by simp [hc]) hx + rw [Real.norm_eq_abs] + calc |w x v| ≤ m * ‖v‖ / 2 * |(x - a) * (x - c)| := h + _ = m / 2 * |(x - a) * (x - c)| * ‖v‖ := by ring + +/-- **The cap from SP's normalized hypotheses (L2, L4, L5, L7, L11, L12).** With `m ≥ 2` (L2), +slices `δ`-strongly concave for some `δ > r m (8m - 5)` (L4), slice derivatives at `y = 0` with +second `x`-derivative bounded by `m` in the weak form (L5), critical points `h x` with +`h(∓r/2) = 0` (L7) and the gap `b - s ≤ r³/6`, the conclusions of `ridge_capHyp_of_slices` hold. +`hω`, `hωr` and `hcurv` are derived: `‖w‖ ≤ 2 m r²` (`slice_gradient_bound`) and +`sp_curved_side_constants`. -/ +theorem ridge_capHyp_sp {f : ℝ × E → ℝ} {h : ℝ → E} {F : ℝ → ℝ} {w : ℝ → E →L[ℝ] ℝ} + {r m δ : ℝ} (hr : 0 < r) (hm : 2 ≤ m) (hδ : r * m * (8 * m - 5) < δ) + (hh : ContinuousOn h (Icc (-r / 2) (2 * r))) + (hg : ∀ x ∈ Icc (-2 * r) (2 * r), HasDerivAt (fun x => f (x, h x)) (F x) x) + (hFa : F (-r / 2) = 0) (hFc : F (r / 2) = 0) + (hconv : ConvexOn ℝ (Icc (-2 * r) (2 * r)) (fun x => F x - (x + r / 2) * (x - r / 2) / 8)) + (hconc : ∀ x ∈ Icc (-2 * r) (r / 2), + StrongConcaveOn (Metric.closedBall (0 : E) (2 * r)) δ (fun y => f (x, y))) + (hball : ∀ x ∈ Icc (-2 * r) (r / 2), h x ∈ Metric.closedBall (0 : E) (2 * r)) + (hcrit : ∀ x ∈ Icc (-2 * r) (r / 2), + HasFDerivAt (fun y => f (x, y)) (0 : E →L[ℝ] ℝ) (h x)) + (hha : h (-r / 2) = 0) (hhc : h (r / 2) = 0) + (hw : ∀ x ∈ Icc (-2 * r) (r / 2), HasFDerivAt (fun y => f (x, y)) (w x) (0 : E)) + (hwcv : ∀ v : E, ConvexOn ℝ (Icc (-2 * r) (r / 2)) (fun t => w t v + m * ‖v‖ / 2 * t ^ 2)) + (hwcc : ∀ v : E, ConcaveOn ℝ (Icc (-2 * r) (r / 2)) (fun t => w t v - m * ‖v‖ / 2 * t ^ 2)) + (hgap : f (-r / 2, h (-r / 2)) - f (r / 2, h (r / 2)) ≤ r ^ 3 / 6) : + CapHyp f (Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r)) (-r / 2, h (-r / 2)) + (2 * r, h (2 * r)) (f (-r / 2, h (-r / 2))) (f (r / 2, h (r / 2))) ∧ + ∀ x ∈ frontier (Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r)), + x ≠ (r / 2, h (r / 2)) → f x < f (r / 2, h (r / 2)) := by + have hm0 : 0 ≤ m := by linarith + have hδ0 : 0 < δ := by + have : 0 < r * m * (8 * m - 5) := by + have : 0 < 8 * m - 5 := by linarith + positivity + linarith + have ha : -r / 2 ∈ Icc (-2 * r) (r / 2) := ⟨by linarith, by linarith⟩ + have hc : r / 2 ∈ Icc (-2 * r) (r / 2) := ⟨by linarith, le_rfl⟩ + have hwa : w (-r / 2) = 0 := (hw _ ha).unique (by simpa [hha] using hcrit _ ha) + have hwc : w (r / 2) = 0 := (hw _ hc).unique (by simpa [hhc] using hcrit _ hc) + have hω : ∀ x ∈ Icc (-2 * r) (r / 2), ‖w x‖ ≤ 2 * m * r ^ 2 := by + intro x hx + have h1 := slice_gradient_bound hm0 hwcv hwcc ha hc (by linarith) hwa hwc hx + have h2 : |(x - -r / 2) * (x - r / 2)| ≤ 4 * r ^ 2 := by + rw [abs_le] + constructor <;> nlinarith [hx.1, hx.2] + calc ‖w x‖ ≤ m / 2 * |(x - -r / 2) * (x - r / 2)| := h1 + _ ≤ m / 2 * (4 * r ^ 2) := by gcongr + _ = 2 * m * r ^ 2 := by ring + obtain ⟨hωr, hcurv⟩ := sp_curved_side_constants hr hm hδ (by positivity) le_rfl + refine ridge_capHyp_of_slices hr hδ0 hh hg hFa hFc hconv hconc hball hcrit hw hω hωr ?_ ?_ + · calc 2 * δ * (f (-r / 2, h (-r / 2)) - f (r / 2, h (r / 2))) ≤ 2 * δ * (r ^ 3 / 6) := by + gcongr + _ < _ := hcurv + · have : r ^ 3 / 6 < 9 * r ^ 3 / 32 := by + have : 0 < r ^ 3 := by positivity + linarith + linarith + +/-- **L1 (the Hermite identity, as a bound).** If `g' = G` on `[a, c]`, `G` vanishes at both ends +(the pins are critical) and `|G''| ≤ m` in the weak form, then `g(a) - g(c) ≤ m (c - a)³/12`. +SP's identity `g(c) - g(a) = -(1/2)∫ φ g'''` with `∫ φ = (c - a)³/6` gives the same bound; here it +comes from `two_node_bound` and monotonicity of `g + (m/2)Φ`, `Φ' = (t - a)(c - t)`. -/ +theorem hermite_gap_le {g G : ℝ → ℝ} {a c m : ℝ} (hac : a < c) + (hg : ∀ x ∈ Icc a c, HasDerivAt g (G x) x) + (hcv : ConvexOn ℝ (Icc a c) (fun t => G t + m / 2 * t ^ 2)) + (hcc : ConcaveOn ℝ (Icc a c) (fun t => G t - m / 2 * t ^ 2)) + (hGa : G a = 0) (hGc : G c = 0) : + g a - g c ≤ m * (c - a) ^ 3 / 12 := by + have hpoly : ∀ x, HasDerivAt (fun t => (c - a) * (t - a) ^ 2 / 2 - (t - a) ^ 3 / 3) + ((x - a) * (c - x)) x := by + intro x + have h1 : HasDerivAt (fun t => t - a) 1 x := (hasDerivAt_id x).sub_const a + have h2 := ((h1.pow 2).const_mul (c - a)).div_const 2 + have h3 := (h1.pow 3).div_const 3 + convert h2.sub h3 using 1 + push_cast + ring + set k : ℝ → ℝ := fun t => g t + m / 2 * ((c - a) * (t - a) ^ 2 / 2 - (t - a) ^ 3 / 3) + with hk + have hkd : ∀ x ∈ Icc a c, HasDerivAt k (G x + m / 2 * ((x - a) * (c - x))) x := + fun x hx => (hg x hx).add ((hpoly x).const_mul (m / 2)) + have hmono : MonotoneOn k (Icc a c) := by + refine monotoneOn_of_hasDerivWithinAt_nonneg (convex_Icc a c) + (fun x hx => (hkd x hx).continuousAt.continuousWithinAt) + (fun x hx => (hkd x (interior_subset hx)).hasDerivWithinAt) (fun x hx => ?_) + have hx := interior_subset hx + have hb := two_node_bound hcv hcc (left_mem_Icc.mpr hac.le) (right_mem_Icc.mpr hac.le) hac + hGa hGc hx + have hP : (x - a) * (x - c) ≤ 0 := + mul_nonpos_of_nonneg_of_nonpos (by linarith [hx.1]) (by linarith [hx.2]) + rw [abs_of_nonpos hP] at hb + have := (abs_le.mp hb).1 + nlinarith + have hkac := hmono (left_mem_Icc.mpr hac.le) (right_mem_Icc.mpr hac.le) hac.le + simp only [hk] at hkac + have e0 : m / 2 * ((c - a) * (a - a) ^ 2 / 2 - (a - a) ^ 3 / 3) = 0 := by ring + have e1 : m / 2 * ((c - a) * (c - a) ^ 2 / 2 - (c - a) ^ 3 / 3) = m * (c - a) ^ 3 / 12 := by + ring + linarith + +/-- **L2 (`m ≥ 2`).** Under SP's normalization `g(-r/2) - g(r/2) = r³/6` on the pin interval, the +weak bound `|g'''| ≤ m` forces `m ≥ 2`. -/ +theorem hermite_m_ge_two {g G : ℝ → ℝ} {r m : ℝ} (hr : 0 < r) + (hg : ∀ x ∈ Icc (-r / 2) (r / 2), HasDerivAt g (G x) x) + (hcv : ConvexOn ℝ (Icc (-r / 2) (r / 2)) (fun t => G t + m / 2 * t ^ 2)) + (hcc : ConcaveOn ℝ (Icc (-r / 2) (r / 2)) (fun t => G t - m / 2 * t ^ 2)) + (hGa : G (-r / 2) = 0) (hGc : G (r / 2) = 0) (hgap : g (-r / 2) - g (r / 2) = r ^ 3 / 6) : + 2 ≤ m := by + have h := hermite_gap_le (by linarith) hg hcv hcc hGa hGc + have hcr : r / 2 - -r / 2 = r := by ring + rw [hgap, hcr] at h + have hr3 : 0 < r ^ 3 := by positivity + nlinarith + +/-- **The cap from SP's normalization (L1, L2 and the rest of `ridge_capHyp_sp`).** As +`ridge_capHyp_sp`, with `m ≥ 2` derived instead of assumed: `g0 = f(·, 0)` has derivative `G0` +vanishing at the pins with `|G0''| ≤ m` (weak form), and the gap is exactly `r³/6`. -/ +theorem ridge_capHyp_normalized {f : ℝ × E → ℝ} {h : ℝ → E} {F G0 : ℝ → ℝ} + {w : ℝ → E →L[ℝ] ℝ} {r m δ : ℝ} (hr : 0 < r) + (hg0 : ∀ x ∈ Icc (-r / 2) (r / 2), HasDerivAt (fun x => f (x, 0)) (G0 x) x) + (hG0cv : ConvexOn ℝ (Icc (-r / 2) (r / 2)) (fun t => G0 t + m / 2 * t ^ 2)) + (hG0cc : ConcaveOn ℝ (Icc (-r / 2) (r / 2)) (fun t => G0 t - m / 2 * t ^ 2)) + (hG0a : G0 (-r / 2) = 0) (hG0c : G0 (r / 2) = 0) + (hδ : r * m * (8 * m - 5) < δ) + (hh : ContinuousOn h (Icc (-r / 2) (2 * r))) + (hg : ∀ x ∈ Icc (-2 * r) (2 * r), HasDerivAt (fun x => f (x, h x)) (F x) x) + (hFa : F (-r / 2) = 0) (hFc : F (r / 2) = 0) + (hconv : ConvexOn ℝ (Icc (-2 * r) (2 * r)) (fun x => F x - (x + r / 2) * (x - r / 2) / 8)) + (hconc : ∀ x ∈ Icc (-2 * r) (r / 2), + StrongConcaveOn (Metric.closedBall (0 : E) (2 * r)) δ (fun y => f (x, y))) + (hball : ∀ x ∈ Icc (-2 * r) (r / 2), h x ∈ Metric.closedBall (0 : E) (2 * r)) + (hcrit : ∀ x ∈ Icc (-2 * r) (r / 2), + HasFDerivAt (fun y => f (x, y)) (0 : E →L[ℝ] ℝ) (h x)) + (hha : h (-r / 2) = 0) (hhc : h (r / 2) = 0) + (hw : ∀ x ∈ Icc (-2 * r) (r / 2), HasFDerivAt (fun y => f (x, y)) (w x) (0 : E)) + (hwcv : ∀ v : E, ConvexOn ℝ (Icc (-2 * r) (r / 2)) (fun t => w t v + m * ‖v‖ / 2 * t ^ 2)) + (hwcc : ∀ v : E, ConcaveOn ℝ (Icc (-2 * r) (r / 2)) (fun t => w t v - m * ‖v‖ / 2 * t ^ 2)) + (hnorm : f (-r / 2, h (-r / 2)) - f (r / 2, h (r / 2)) = r ^ 3 / 6) : + CapHyp f (Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r)) (-r / 2, h (-r / 2)) + (2 * r, h (2 * r)) (f (-r / 2, h (-r / 2))) (f (r / 2, h (r / 2))) ∧ + ∀ x ∈ frontier (Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r)), + x ≠ (r / 2, h (r / 2)) → f x < f (r / 2, h (r / 2)) := by + have hm : 2 ≤ m := hermite_m_ge_two hr hg0 hG0cv hG0cc hG0a hG0c (by simpa [hha, hhc] using hnorm) + exact ridge_capHyp_sp hr hm hδ hh hg hFa hFc hconv hconc hball hcrit hha hhc hw hwcv hwcc + hnorm.le + +/-- **Second-order condition for strong concavity.** If `φ` has derivative `Dφ` and `Dφ` has +derivative `H` at every point of the convex set `K`, and `H y v v ≤ -δ ‖v‖²` there, then `φ` is +`δ`-strongly concave on `K`. Along each segment, `φ(x + t v) + (δ/2)‖v‖² t²` has a nonpositive +second derivative, so it is concave on `[0, 1]`. -/ +theorem strongConcaveOn_of_hessian {K : Set E} {φ : E → ℝ} {Dφ : E → E →L[ℝ] ℝ} + {H : E → E →L[ℝ] E →L[ℝ] ℝ} {δ : ℝ} (hK : Convex ℝ K) + (hD : ∀ y ∈ K, HasFDerivAt φ (Dφ y) y) (hH : ∀ y ∈ K, HasFDerivAt Dφ (H y) y) + (hneg : ∀ y ∈ K, ∀ v : E, H y v v ≤ -δ * ‖v‖ ^ 2) : StrongConcaveOn K δ φ := by + refine ⟨hK, fun x hx y hy a b ha hb hab => ?_⟩ + set v := y - x with hv + have hmem : ∀ t ∈ Icc (0 : ℝ) 1, x + t • v ∈ K := fun t ht => hK.add_smul_sub_mem hx hy ht + set ψ : ℝ → ℝ := fun t => φ (x + t • v) + δ / 2 * ‖v‖ ^ 2 * t ^ 2 with hψ + set ψ' : ℝ → ℝ := fun t => Dφ (x + t • v) v + δ * ‖v‖ ^ 2 * t with hψ' + set ψ'' : ℝ → ℝ := fun t => H (x + t • v) v v + δ * ‖v‖ ^ 2 with hψ'' + have hline : ∀ t : ℝ, HasDerivAt (fun s : ℝ => x + s • v) v t := fun t => by + simpa using ((hasDerivAt_id t).smul_const v).const_add x + have hd1 : ∀ t ∈ Icc (0 : ℝ) 1, HasDerivAt ψ (ψ' t) t := by + intro t ht + have h1 : HasDerivAt (fun s => φ (x + s • v)) (Dφ (x + t • v) v) t := + (hD _ (hmem t ht)).comp_hasDerivAt t (hline t) + have h2 : HasDerivAt (fun s : ℝ => δ / 2 * ‖v‖ ^ 2 * s ^ 2) (δ * ‖v‖ ^ 2 * t) t := by + convert (hasDerivAt_pow 2 t).const_mul (δ / 2 * ‖v‖ ^ 2) using 1 + push_cast + ring + exact h1.add h2 + have hd2 : ∀ t ∈ Icc (0 : ℝ) 1, HasDerivAt ψ' (ψ'' t) t := by + intro t ht + have h1 : HasDerivAt (fun s => Dφ (x + s • v)) (H (x + t • v) v) t := + (hH _ (hmem t ht)).comp_hasDerivAt t (hline t) + have h1' : HasDerivAt (fun s => Dφ (x + s • v) v) (H (x + t • v) v v) t := by + simpa using h1.clm_apply (hasDerivAt_const t v) + have h2 : HasDerivAt (fun s : ℝ => δ * ‖v‖ ^ 2 * s) (δ * ‖v‖ ^ 2) t := by + simpa using (hasDerivAt_id t).const_mul (δ * ‖v‖ ^ 2) + exact h1'.add h2 + have hcc : ConcaveOn ℝ (Icc (0 : ℝ) 1) ψ := by + refine concaveOn_of_hasDerivWithinAt2_nonpos (convex_Icc 0 1) + (fun t ht => (hd1 t ht).continuousAt.continuousWithinAt) + (fun t ht => (hd1 t (interior_subset ht)).hasDerivWithinAt) + (fun t ht => (hd2 t (interior_subset ht)).hasDerivWithinAt) (fun t ht => ?_) + have := hneg _ (hmem t (interior_subset ht)) v + simp only [hψ''] + linarith + have key := hcc.2 (left_mem_Icc.mpr zero_le_one) (right_mem_Icc.mpr zero_le_one) ha hb hab + simp only [hψ, smul_eq_mul, mul_zero, zero_smul, add_zero, mul_one, one_smul, zero_add] at key + have hab' : a = 1 - b := by linarith + have hpt : a • x + b • y = x + b • v := by + rw [hab', hv, smul_sub, sub_smul, one_smul]; abel + have hn : ‖x - y‖ = ‖v‖ := by rw [hv, norm_sub_rev] + rw [hpt, hn, smul_eq_mul, smul_eq_mul] + have hxv : x + v = y := by rw [hv]; abel + rw [hxv] at key + show a * φ x + b * φ y + a * b * (δ / 2 * ‖v‖ ^ 2) ≤ φ (x + b • v) + rw [hab'] at key ⊢ + linear_combination key + +/-- **L3–L4 (the transverse Hessian bound).** If the transverse Hessian `H` satisfies +`H(M) ≤ -λ` (SP's `λ = λ_min(-D_y² f(M))`) and its increments from `M = (-r/2, 0)` are bounded by +`m (|Δx| + ‖Δy‖)` (L3, with `m` bounding the third-derivative blocks), then `H(p) ≤ -(λ - 5rm)` +on the cap. The increment is at most `3r/2 + 2r ≤ 5r` there; SP bounds it on all of `D` by +`9r/2 < 5r`. -/ +theorem transverse_hessian_le {H : ℝ × E → E →L[ℝ] E →L[ℝ] ℝ} {r m lam : ℝ} (hr : 0 < r) + (hm : 0 ≤ m) + (hlip : ∀ p ∈ Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r), + ‖H p - H (-r / 2, 0)‖ ≤ m * (|p.1 - -r / 2| + ‖p.2‖)) + (hlam : ∀ v : E, H (-r / 2, 0) v v ≤ -lam * ‖v‖ ^ 2) : + ∀ p ∈ Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r), ∀ v : E, + H p v v ≤ -(lam - 5 * r * m) * ‖v‖ ^ 2 := by + rintro ⟨x, y⟩ ⟨hx, hy⟩ v + have hy' : ‖y‖ ≤ 2 * r := by simpa using hy + have hdx : |x - -r / 2| ≤ 3 * r / 2 := by + rw [abs_le]; constructor <;> linarith [hx.1, hx.2] + have hinc : ‖H (x, y) - H (-r / 2, 0)‖ ≤ 5 * r * m := by + have := hlip (x, y) ⟨hx, hy⟩ + calc ‖H (x, y) - H (-r / 2, 0)‖ ≤ m * (|x - -r / 2| + ‖y‖) := this + _ ≤ m * (3 * r / 2 + 2 * r) := by gcongr + _ ≤ 5 * r * m := by nlinarith + have hsplit : H (x, y) v v = H (-r / 2, 0) v v + (H (x, y) - H (-r / 2, 0)) v v := by + simp + have hb := (H (x, y) - H (-r / 2, 0)).le_opNorm₂ v v + have hb' : (H (x, y) - H (-r / 2, 0)) v v ≤ 5 * r * m * ‖v‖ ^ 2 := by + have h1 := (le_abs_self _).trans (by simpa [Real.norm_eq_abs] using hb) + calc (H (x, y) - H (-r / 2, 0)) v v ≤ ‖H (x, y) - H (-r / 2, 0)‖ * ‖v‖ * ‖v‖ := h1 + _ ≤ 5 * r * m * ‖v‖ * ‖v‖ := by gcongr + _ = 5 * r * m * ‖v‖ ^ 2 := by ring + rw [hsplit] + have := hlam v + nlinarith + +/-- **L3 (increments of the transverse Hessian).** If `x ↦ H (x, 0)` has derivative `Hx x` with +`‖Hx x‖ ≤ m` on `[-2r, r/2]` (the block `∂_x D_y² f`), and along each ray `s ↦ H (x, s • y)`, +`s ∈ [0, 1]`, the derivative `Hr p s` has `‖Hr p s‖ ≤ m ‖y‖` (the block `D_y³ f` applied to `y`), +then moving first in `x` along `y = 0` and then along the ray gives `‖H p - H M‖ ≤ m (|Δx| + ‖Δy‖)` +from `M = (-r/2, 0)`, by the mean value inequality. -/ +theorem hessian_increment {H : ℝ × E → E →L[ℝ] E →L[ℝ] ℝ} {Hx : ℝ → E →L[ℝ] E →L[ℝ] ℝ} + {Hr : ℝ × E → ℝ → E →L[ℝ] E →L[ℝ] ℝ} {r m : ℝ} (hr : 0 < r) + (hHx : ∀ x ∈ Icc (-2 * r) (r / 2), HasDerivAt (fun t => H (t, 0)) (Hx x) x) + (hHxb : ∀ x ∈ Icc (-2 * r) (r / 2), ‖Hx x‖ ≤ m) + (hHr : ∀ p ∈ Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r), ∀ s ∈ Icc (0 : ℝ) 1, + HasDerivAt (fun s : ℝ => H (p.1, s • p.2)) (Hr p s) s) + (hHrb : ∀ p ∈ Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r), ∀ s ∈ Icc (0 : ℝ) 1, + ‖Hr p s‖ ≤ m * ‖p.2‖) : + ∀ p ∈ Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r), + ‖H p - H (-r / 2, 0)‖ ≤ m * (|p.1 - -r / 2| + ‖p.2‖) := by + rintro ⟨x, y⟩ hp + have hx := hp.1 + have h1 : ‖H (x, (1 : ℝ) • y) - H (x, (0 : ℝ) • y)‖ ≤ m * ‖y‖ * ‖(1 : ℝ) - 0‖ := + (convex_Icc (0 : ℝ) 1).norm_image_sub_le_of_norm_hasDerivWithin_le + (f := fun s : ℝ => H (x, s • y)) (fun s hs => (hHr (x, y) hp s hs).hasDerivWithinAt) + (fun s hs => hHrb (x, y) hp s hs) (left_mem_Icc.mpr zero_le_one) + (right_mem_Icc.mpr zero_le_one) + have ha : -r / 2 ∈ Icc (-2 * r) (r / 2) := ⟨by linarith, by linarith⟩ + have h2 : ‖H (x, 0) - H (-r / 2, 0)‖ ≤ m * ‖x - -r / 2‖ := + (convex_Icc (-2 * r) (r / 2)).norm_image_sub_le_of_norm_hasDerivWithin_le + (f := fun t => H (t, 0)) (fun t ht => (hHx t ht).hasDerivWithinAt) hHxb ha hx + simp only [one_smul, zero_smul, sub_zero, norm_one, mul_one] at h1 + rw [Real.norm_eq_abs] at h2 + calc ‖H (x, y) - H (-r / 2, 0)‖ ≤ ‖H (x, y) - H (x, 0)‖ + ‖H (x, 0) - H (-r / 2, 0)‖ := + norm_sub_le_norm_sub_add_norm_sub (H (x, y)) (H (x, 0)) (H (-r / 2, 0)) + _ ≤ m * ‖y‖ + m * |x - -r / 2| := add_le_add h1 h2 + _ = m * (|(x, y).1 - -r / 2| + ‖(x, y).2‖) := by simp only; ring + +/-- **L4 (strong concavity of the slices).** Under `transverse_hessian_le`'s hypotheses, with the +slice derivatives `Dφ` and Hessians `H` given on the cap, every slice `y ↦ f (x, y)`, +`x ∈ [-2r, r/2]`, is `(λ - 5rm)`-strongly concave on `B̄(0, 2r)`. -/ +theorem slices_strongConcave {f : ℝ × E → ℝ} {Dφ : ℝ × E → E →L[ℝ] ℝ} + {H : ℝ × E → E →L[ℝ] E →L[ℝ] ℝ} {r m lam : ℝ} (hr : 0 < r) (hm : 0 ≤ m) + (hD : ∀ p ∈ Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r), + HasFDerivAt (fun y => f (p.1, y)) (Dφ p) p.2) + (hH : ∀ p ∈ Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r), + HasFDerivAt (fun y => Dφ (p.1, y)) (H p) p.2) + (hlip : ∀ p ∈ Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r), + ‖H p - H (-r / 2, 0)‖ ≤ m * (|p.1 - -r / 2| + ‖p.2‖)) + (hlam : ∀ v : E, H (-r / 2, 0) v v ≤ -lam * ‖v‖ ^ 2) : + ∀ x ∈ Icc (-2 * r) (r / 2), + StrongConcaveOn (Metric.closedBall (0 : E) (2 * r)) (lam - 5 * r * m) (fun y => f (x, y)) := by + intro x hx + have hbd := transverse_hessian_le hr hm hlip hlam + exact strongConcaveOn_of_hessian (Dφ := fun y => Dφ (x, y)) (H := fun y => H (x, y)) + (convex_closedBall _ _) (fun y hy => hD (x, y) ⟨hx, hy⟩) (fun y hy => hH (x, y) ⟨hx, hy⟩) + (fun y hy v => hbd (x, y) ⟨hx, hy⟩ v) + +/-- **The cap from SP's hypothesis (H1) (L1–L5, L7, L8, L11, L18).** As `ridge_capHyp_normalized`, +with the slice strong concavity and `δ > rm(8m - 5)` derived from Hessian data: the slice +derivatives and Hessians on the cap, the increment bound of `H` from `M` with constant `m`, +`H(M) ≤ -λ`, and (H1) `8 r m² < λ`. Then `δ = λ - 5rm > rm(8m - 5)`. -/ +theorem ridge_capHyp_H1 {f : ℝ × E → ℝ} {h : ℝ → E} {F G0 : ℝ → ℝ} + {w : ℝ → E →L[ℝ] ℝ} {Dφ : ℝ × E → E →L[ℝ] ℝ} {H : ℝ × E → E →L[ℝ] E →L[ℝ] ℝ} + {Hx : ℝ → E →L[ℝ] E →L[ℝ] ℝ} {Hr : ℝ × E → ℝ → E →L[ℝ] E →L[ℝ] ℝ} {r m lam : ℝ} (hr : 0 < r) + (hg0 : ∀ x ∈ Icc (-r / 2) (r / 2), HasDerivAt (fun x => f (x, 0)) (G0 x) x) + (hG0cv : ConvexOn ℝ (Icc (-r / 2) (r / 2)) (fun t => G0 t + m / 2 * t ^ 2)) + (hG0cc : ConcaveOn ℝ (Icc (-r / 2) (r / 2)) (fun t => G0 t - m / 2 * t ^ 2)) + (hG0a : G0 (-r / 2) = 0) (hG0c : G0 (r / 2) = 0) + (hD : ∀ p ∈ Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r), + HasFDerivAt (fun y => f (p.1, y)) (Dφ p) p.2) + (hH : ∀ p ∈ Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r), + HasFDerivAt (fun y => Dφ (p.1, y)) (H p) p.2) + (hHx : ∀ x ∈ Icc (-2 * r) (r / 2), HasDerivAt (fun t => H (t, 0)) (Hx x) x) + (hHxb : ∀ x ∈ Icc (-2 * r) (r / 2), ‖Hx x‖ ≤ m) + (hHr : ∀ p ∈ Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r), ∀ s ∈ Icc (0 : ℝ) 1, + HasDerivAt (fun s : ℝ => H (p.1, s • p.2)) (Hr p s) s) + (hHrb : ∀ p ∈ Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r), ∀ s ∈ Icc (0 : ℝ) 1, + ‖Hr p s‖ ≤ m * ‖p.2‖) + (hlam : ∀ v : E, H (-r / 2, 0) v v ≤ -lam * ‖v‖ ^ 2) (hH1 : 8 * r * m ^ 2 < lam) + (hh : ContinuousOn h (Icc (-r / 2) (2 * r))) + (hg : ∀ x ∈ Icc (-2 * r) (2 * r), HasDerivAt (fun x => f (x, h x)) (F x) x) + (hFa : F (-r / 2) = 0) (hFc : F (r / 2) = 0) + (hconv : ConvexOn ℝ (Icc (-2 * r) (2 * r)) (fun x => F x - (x + r / 2) * (x - r / 2) / 8)) + (hball : ∀ x ∈ Icc (-2 * r) (r / 2), h x ∈ Metric.closedBall (0 : E) (2 * r)) + (hcrit : ∀ x ∈ Icc (-2 * r) (r / 2), + HasFDerivAt (fun y => f (x, y)) (0 : E →L[ℝ] ℝ) (h x)) + (hha : h (-r / 2) = 0) (hhc : h (r / 2) = 0) + (hw : ∀ x ∈ Icc (-2 * r) (r / 2), HasFDerivAt (fun y => f (x, y)) (w x) (0 : E)) + (hwcv : ∀ v : E, ConvexOn ℝ (Icc (-2 * r) (r / 2)) (fun t => w t v + m * ‖v‖ / 2 * t ^ 2)) + (hwcc : ∀ v : E, ConcaveOn ℝ (Icc (-2 * r) (r / 2)) (fun t => w t v - m * ‖v‖ / 2 * t ^ 2)) + (hnorm : f (-r / 2, h (-r / 2)) - f (r / 2, h (r / 2)) = r ^ 3 / 6) : + CapHyp f (Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r)) (-r / 2, h (-r / 2)) + (2 * r, h (2 * r)) (f (-r / 2, h (-r / 2))) (f (r / 2, h (r / 2))) ∧ + ∀ x ∈ frontier (Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r)), + x ≠ (r / 2, h (r / 2)) → f x < f (r / 2, h (r / 2)) := by + have hm : 2 ≤ m := + hermite_m_ge_two hr hg0 hG0cv hG0cc hG0a hG0c (by simpa [hha, hhc] using hnorm) + have hlip := hessian_increment hr hHx hHxb hHr hHrb + have hconc := slices_strongConcave hr (by linarith) hD hH hlip hlam + have hδ : r * m * (8 * m - 5) < lam - 5 * r * m := by nlinarith + exact ridge_capHyp_normalized hr hg0 hG0cv hG0cc hG0a hG0c hδ hh hg hFa hFc hconv hconc hball + hcrit hha hhc hw hwcv hwcc hnorm + +/-- **L7 (uniqueness of the transverse critical point).** A `δ`-strongly concave slice, `δ > 0`, +has at most one critical point in `K`. -/ +theorem slice_critical_unique {K : Set E} {φ : E → ℝ} {δ : ℝ} (hφ : StrongConcaveOn K δ φ) + (hδ : 0 < δ) {p q : E} (hp : p ∈ K) (hq : q ∈ K) (hdp : HasFDerivAt φ (0 : E →L[ℝ] ℝ) p) + (hdq : HasFDerivAt φ (0 : E →L[ℝ] ℝ) q) : p = q := by + have h1 := slice_le hφ hp hdp hq + have h2 := slice_le hφ hq hdq hp + rw [norm_sub_rev] at h2 + have h3 : δ * ‖q - p‖ ^ 2 ≤ 0 := by linarith + have h4 : ‖q - p‖ ^ 2 ≤ 0 := by + have : δ * ‖q - p‖ ^ 2 ≤ δ * 0 := by rw [mul_zero]; exact h3 + exact le_of_mul_le_mul_left this hδ + have h5 : ‖q - p‖ = 0 := by nlinarith [norm_nonneg (q - p)] + exact (sub_eq_zero.mp (norm_eq_zero.mp h5)).symm + +/-- **L7 (existence of the transverse critical point).** If the slice is `δ`-strongly concave and +differentiable on `B̄(0, R)` and its derivative at `0` has norm `< δR` (SP: `‖w‖ < δ · 2r`), the +maximum over the compact ball is attained in the open ball, so it is a critical point. On the +sphere the radial derivative is `≤ w(p) - δR² < 0` (SP's L7 computation, here from the strong +concavity engine), which contradicts maximality. -/ +theorem slice_critical_exists [ProperSpace E] {φ : E → ℝ} {Dφ : E → E →L[ℝ] ℝ} {δ R : ℝ} + (hR : 0 < R) (hφ : StrongConcaveOn (Metric.closedBall (0 : E) R) δ φ) + (hD : ∀ y ∈ Metric.closedBall (0 : E) R, HasFDerivAt φ (Dφ y) y) (hw : ‖Dφ 0‖ < δ * R) : + ∃ p ∈ Metric.ball (0 : E) R, HasFDerivAt φ (0 : E →L[ℝ] ℝ) p := by + have h0 : (0 : E) ∈ Metric.closedBall (0 : E) R := Metric.mem_closedBall_self hR.le + have hcont : ContinuousOn φ (Metric.closedBall (0 : E) R) := + fun y hy => (hD y hy).continuousAt.continuousWithinAt + obtain ⟨p, hp, hmax⟩ := (isCompact_closedBall (0 : E) R).exists_isMaxOn ⟨0, h0⟩ hcont + have hpR : ‖p‖ ≤ R := by simpa using hp + have hlt : ‖p‖ < R := by + by_contra hc + have hpn : ‖p‖ = R := le_antisymm hpR (not_lt.mp hc) + have hseg : segment ℝ p (p + -p) ⊆ Metric.closedBall (0 : E) R := by + rw [add_neg_cancel] + exact (convex_closedBall (0 : E) R).segment_subset hp h0 + have hcone := mem_posTangentConeAt_of_segment_subset hseg + have hnp := hmax.isLocalMaxOn.hasFDerivWithinAt_nonpos (hD p hp).hasFDerivWithinAt hcone + have e1 := strongConcave_le_of_hasFDerivAt hφ hp (hD p hp) h0 + have e2 := strongConcave_le_of_hasFDerivAt hφ h0 (hD 0 h0) hp + simp only [zero_sub, sub_zero, norm_neg, map_neg] at e1 e2 hnp + have hb : Dφ 0 p ≤ ‖Dφ 0‖ * ‖p‖ := + (le_abs_self _).trans (by simpa [Real.norm_eq_abs] using (Dφ 0).le_opNorm p) + rw [hpn] at e1 e2 hb + have : ‖Dφ 0‖ * R < δ * R * R := by nlinarith + nlinarith + have hpb : p ∈ Metric.ball (0 : E) R := by simpa using hlt + have hloc : IsLocalMax φ p := + hmax.isLocalMax (Metric.closedBall_mem_nhds_of_mem hpb) + refine ⟨p, hpb, ?_⟩ + have hz := hloc.hasFDerivAt_eq_zero (hD p hp) + rw [← hz] + exact hD p hp + +/-- In finite dimension, a bilinear form `A : E →L E →L ℝ` with `A v v ≤ -δ‖v‖²`, `δ > 0`, is +invertible as a map `E → E*` (SP L7: "`D_y² f` invertible"). -/ +theorem isInvertible_of_negDef [FiniteDimensional ℝ E] {A : E →L[ℝ] E →L[ℝ] ℝ} {δ : ℝ} + (hδ : 0 < δ) (hA : ∀ v : E, A v v ≤ -δ * ‖v‖ ^ 2) : A.IsInvertible := by + have hinj : Function.Injective A := by + intro v w hvw + have h1 : A (v - w) = 0 := by rw [map_sub, hvw, sub_self] + have h2 := hA (v - w) + rw [h1, zero_apply] at h2 + have h3 : ‖v - w‖ ^ 2 ≤ 0 := by nlinarith [sq_nonneg ‖v - w‖] + have h4 : ‖v - w‖ = 0 := by nlinarith [norm_nonneg (v - w)] + exact sub_eq_zero.mp (norm_eq_zero.mp h4) + have hrank : Module.finrank ℝ E = Module.finrank ℝ (E →L[ℝ] ℝ) := by + rw [← (LinearMap.toContinuousLinearMap : (E →ₗ[ℝ] ℝ) ≃ₗ[ℝ] E →L[ℝ] ℝ).finrank_eq] + exact (Subspace.dual_finrank_eq).symm + have hsurj : Function.Surjective A := + (LinearMap.injective_iff_surjective_of_finrank_eq_finrank hrank (f := (A : E →ₗ[ℝ] E →L[ℝ] ℝ))).mp hinj + refine ⟨(LinearEquiv.ofBijective (A : E →ₗ[ℝ] E →L[ℝ] ℝ) ⟨hinj, hsurj⟩).toContinuousLinearEquiv, ?_⟩ + ext v w + rfl + +/-- **L7 (regularity of the ridge, pointwise).** If the transverse gradient `G` is strictly +differentiable at `(x0, h x0)` with invertible transverse part, `h x0` is a critical point, and +near `x0` the critical point of each slice in a neighbourhood `K` of `h x0` is unique and equal to +`h x`, then `h` agrees near `x0` with the implicit function of `G = 0` (Mathlib's +`implicitFunctionOfProdDomain`), so `h` is strictly differentiable at `x0` with +`h' = -(∂_y G)⁻¹ ∂_x G` (SP L9's formula). -/ +theorem ridge_hasStrictFDerivAt [CompleteSpace E] {f : ℝ × E → ℝ} {G : ℝ × E → E →L[ℝ] ℝ} + {DG : ℝ × E →L[ℝ] E →L[ℝ] ℝ} {h : ℝ → E} {K : Set E} {x0 : ℝ} + (hGs : HasStrictFDerivAt G DG (x0, h x0)) + (hinv : (DG ∘L ContinuousLinearMap.inr ℝ ℝ E).IsInvertible) + (hG : ∀ᶠ v in 𝓝 (x0, h x0), HasFDerivAt (fun y => f (v.1, y)) (G v) v.2) + (hcrit0 : HasFDerivAt (fun y => f (x0, y)) (0 : E →L[ℝ] ℝ) (h x0)) (hK : K ∈ 𝓝 (h x0)) + (huniq : ∀ᶠ x in 𝓝 x0, ∀ y ∈ K, HasFDerivAt (fun y => f (x, y)) (0 : E →L[ℝ] ℝ) y → y = h x) : + HasStrictFDerivAt h (-(DG ∘L ContinuousLinearMap.inr ℝ ℝ E).inverse ∘L + (DG ∘L ContinuousLinearMap.inl ℝ ℝ E)) x0 := by + have hGu : G (x0, h x0) = 0 := (hG.self_of_nhds).unique hcrit0 + have hψ := hGs.hasStrictFDerivAt_implicitFunctionOfProdDomain hinv + have hev := hGs.eventually_apply_implicitFunctionOfProdDomain hinv + have htend := hGs.tendsto_implicitFunctionOfProdDomain hinv + set ψ := hGs.implicitFunctionOfProdDomain hinv with hψdef + have hpair : Tendsto (fun x => (x, ψ x)) (𝓝 x0) (𝓝 (x0, h x0)) := + (tendsto_id.prodMk_nhds htend) + have hGψ := hpair.eventually hG + have hKψ := htend.eventually hK + have heq : ψ =ᶠ[𝓝 x0] h := by + filter_upwards [hev, hGψ, hKψ, huniq] with x h1 h2 h3 h4 + rw [h1, hGu] at h2 + exact h4 (ψ x) h3 h2 + exact hψ.congr_of_eventuallyEq heq + + +/-- **L7 (regularity of the ridge on `[-2r, 2r]`).** With the slices `δ`-strongly concave and `h x` a +critical point in `B̄(0, 2r)` for `x` in an open set `U ⊇ [-2r, 2r]` (SP: `f ∈ C⁴` near `D`), `h x` +in the open ball on `[-2r, 2r]`, and the transverse gradient strictly differentiable along the +ridge with negative definite transverse part, `h` is strictly differentiable at every +`x ∈ [-2r, 2r]`. Composed with `ridge_inputs_of_joint`, as `ridge_capHyp_source` does, this supplies +its `hh'`. -/ +theorem ridge_differentiable [FiniteDimensional ℝ E] {f : ℝ × E → ℝ} {G : ℝ × E → E →L[ℝ] ℝ} + {DG : ℝ → ℝ × E →L[ℝ] E →L[ℝ] ℝ} {h : ℝ → E} {U : Set ℝ} {r δ : ℝ} (hδ : 0 < δ) + (hU : IsOpen U) (hIU : Icc (-2 * r) (2 * r) ⊆ U) + (hconc : ∀ x ∈ U, + StrongConcaveOn (Metric.closedBall (0 : E) (2 * r)) δ (fun y => f (x, y))) + (hball : ∀ x ∈ U, h x ∈ Metric.closedBall (0 : E) (2 * r)) + (hcrit : ∀ x ∈ U, HasFDerivAt (fun y => f (x, y)) (0 : E →L[ℝ] ℝ) (h x)) + (hint : ∀ x ∈ Icc (-2 * r) (2 * r), h x ∈ Metric.ball (0 : E) (2 * r)) + (hG : ∀ x ∈ Icc (-2 * r) (2 * r), + ∀ᶠ v in 𝓝 (x, h x), HasFDerivAt (fun y => f (v.1, y)) (G v) v.2) + (hGs : ∀ x ∈ Icc (-2 * r) (2 * r), HasStrictFDerivAt G (DG x) (x, h x)) + (hneg : ∀ x ∈ Icc (-2 * r) (2 * r), ∀ v : E, + (DG x ∘L ContinuousLinearMap.inr ℝ ℝ E) v v ≤ -δ * ‖v‖ ^ 2) : + ∀ x ∈ Icc (-2 * r) (2 * r), HasStrictFDerivAt h + (-(DG x ∘L ContinuousLinearMap.inr ℝ ℝ E).inverse ∘L (DG x ∘L ContinuousLinearMap.inl ℝ ℝ E)) x := by + intro x hx + have hK : Metric.closedBall (0 : E) (2 * r) ∈ 𝓝 (h x) := + Metric.closedBall_mem_nhds_of_mem (hint x hx) + have huniq : ∀ᶠ x' in 𝓝 x, ∀ y ∈ Metric.closedBall (0 : E) (2 * r), + HasFDerivAt (fun y => f (x', y)) (0 : E →L[ℝ] ℝ) y → y = h x' := by + filter_upwards [hU.mem_nhds (hIU hx)] with x' hx' y hy hdy + exact slice_critical_unique (hconc x' hx') hδ hy (hball x' hx') hdy (hcrit x' hx') + exact ridge_hasStrictFDerivAt (hGs x hx) (isInvertible_of_negDef hδ (hneg x hx)) (hG x hx) + (hcrit x (hIU hx)) hK huniq + + +/-- **L7 (existence of the ridge).** If on an open set `U` of `x`-values the slices are +`δ`-strongly concave and differentiable on `B̄(0, 2r)` with `‖∂_y f(x, 0)‖ < δ · 2r`, a map `h` +with `h x` a critical point in the open ball exists on `U` (by choice; unique by +`slice_critical_unique`). -/ +theorem ridge_exists [ProperSpace E] {f : ℝ × E → ℝ} {Dφ : ℝ → E → E →L[ℝ] ℝ} {U : Set ℝ} + {r δ : ℝ} (hr : 0 < r) + (hconc : ∀ x ∈ U, + StrongConcaveOn (Metric.closedBall (0 : E) (2 * r)) δ (fun y => f (x, y))) + (hD : ∀ x ∈ U, ∀ y ∈ Metric.closedBall (0 : E) (2 * r), + HasFDerivAt (fun y => f (x, y)) (Dφ x y) y) + (hw : ∀ x ∈ U, ‖Dφ x 0‖ < δ * (2 * r)) : + ∃ h : ℝ → E, ∀ x ∈ U, h x ∈ Metric.ball (0 : E) (2 * r) ∧ + HasFDerivAt (fun y => f (x, y)) (0 : E →L[ℝ] ℝ) (h x) := by + have hex : ∀ x : ℝ, ∃ p : E, x ∈ U → p ∈ Metric.ball (0 : E) (2 * r) ∧ + HasFDerivAt (fun y => f (x, y)) (0 : E →L[ℝ] ℝ) p := by + intro x + by_cases hx : x ∈ U + · obtain ⟨p, hp, hdp⟩ := slice_critical_exists (by positivity) (hconc x hx) (hD x hx) (hw x hx) + exact ⟨p, fun _ => ⟨hp, hdp⟩⟩ + · exact ⟨0, fun h => absurd h hx⟩ + choose h hh using hex + exact ⟨h, fun x hx => hh x hx⟩ + +/-! ### The full domain (v1.8) + +SP proves L4 on all of `D`, where the increment from `M` is at most `9r/2 < 5r`, and assumes +`f ∈ C⁴` near `D`. The lemmas below take the source data on a collar `x ∈ [-2r - ε, 2r + ε]`, +`0 < ε ≤ r/2`, where `|x + r/2| ≤ 3r` keeps the increment at most `5r`. So every slice over the open +set `(-2r - ε, 2r + ε) ⊇ [-2r, 2r]` is `(λ - 5rm)`-strongly concave, which is what the L7 lemmas +need, and `ridge_capHyp_source` composes L7 with the cap. -/ + +/-- **L3 on the full domain.** As `hessian_increment`, with the `x`-range `[-2r - ε, 2r + ε]`. -/ +theorem hessian_increment_D {H : ℝ × E → E →L[ℝ] E →L[ℝ] ℝ} {Hx : ℝ → E →L[ℝ] E →L[ℝ] ℝ} + {Hr : ℝ × E → ℝ → E →L[ℝ] E →L[ℝ] ℝ} {r m ε : ℝ} (hr : 0 < r) (hε : 0 < ε) + (hHx : ∀ x ∈ Icc (-2 * r - ε) (2 * r + ε), HasDerivAt (fun t => H (t, 0)) (Hx x) x) + (hHxb : ∀ x ∈ Icc (-2 * r - ε) (2 * r + ε), ‖Hx x‖ ≤ m) + (hHr : ∀ p ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r), + ∀ s ∈ Icc (0 : ℝ) 1, HasDerivAt (fun s : ℝ => H (p.1, s • p.2)) (Hr p s) s) + (hHrb : ∀ p ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r), + ∀ s ∈ Icc (0 : ℝ) 1, ‖Hr p s‖ ≤ m * ‖p.2‖) : + ∀ p ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r), + ‖H p - H (-r / 2, 0)‖ ≤ m * (|p.1 - -r / 2| + ‖p.2‖) := by + rintro ⟨x, y⟩ hp + have hx := hp.1 + have h1 : ‖H (x, (1 : ℝ) • y) - H (x, (0 : ℝ) • y)‖ ≤ m * ‖y‖ * ‖(1 : ℝ) - 0‖ := + (convex_Icc (0 : ℝ) 1).norm_image_sub_le_of_norm_hasDerivWithin_le + (f := fun s : ℝ => H (x, s • y)) (fun s hs => (hHr (x, y) hp s hs).hasDerivWithinAt) + (fun s hs => hHrb (x, y) hp s hs) (left_mem_Icc.mpr zero_le_one) + (right_mem_Icc.mpr zero_le_one) + have ha : -r / 2 ∈ Icc (-2 * r - ε) (2 * r + ε) := ⟨by linarith, by linarith⟩ + have h2 : ‖H (x, 0) - H (-r / 2, 0)‖ ≤ m * ‖x - -r / 2‖ := + (convex_Icc (-2 * r - ε) (2 * r + ε)).norm_image_sub_le_of_norm_hasDerivWithin_le + (f := fun t => H (t, 0)) (fun t ht => (hHx t ht).hasDerivWithinAt) hHxb ha hx + simp only [one_smul, zero_smul, sub_zero, norm_one, mul_one] at h1 + rw [Real.norm_eq_abs] at h2 + calc ‖H (x, y) - H (-r / 2, 0)‖ ≤ ‖H (x, y) - H (x, 0)‖ + ‖H (x, 0) - H (-r / 2, 0)‖ := + norm_sub_le_norm_sub_add_norm_sub (H (x, y)) (H (x, 0)) (H (-r / 2, 0)) + _ ≤ m * ‖y‖ + m * |x - -r / 2| := add_le_add h1 h2 + _ = m * (|(x, y).1 - -r / 2| + ‖(x, y).2‖) := by simp only; ring + +/-- **L4's Hessian bound on the full domain.** As `transverse_hessian_le`, for +`x ∈ [-2r - ε, 2r + ε]` with `0 < ε ≤ r/2`: there `|x + r/2| ≤ 3r`, so the increment is still at +most `5r`. -/ +theorem transverse_hessian_le_D {H : ℝ × E → E →L[ℝ] E →L[ℝ] ℝ} {r m lam ε : ℝ} + (hm : 0 ≤ m) (hε : 0 < ε) (hεr : ε ≤ r / 2) + (hlip : ∀ p ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r), + ‖H p - H (-r / 2, 0)‖ ≤ m * (|p.1 - -r / 2| + ‖p.2‖)) + (hlam : ∀ v : E, H (-r / 2, 0) v v ≤ -lam * ‖v‖ ^ 2) : + ∀ p ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r), ∀ v : E, + H p v v ≤ -(lam - 5 * r * m) * ‖v‖ ^ 2 := by + rintro ⟨x, y⟩ ⟨hx, hy⟩ v + have hy' : ‖y‖ ≤ 2 * r := by simpa using hy + have hdx : |x - -r / 2| ≤ 3 * r := by + rw [abs_le]; constructor <;> linarith [hx.1, hx.2] + have hinc : ‖H (x, y) - H (-r / 2, 0)‖ ≤ 5 * r * m := by + have := hlip (x, y) ⟨hx, hy⟩ + calc ‖H (x, y) - H (-r / 2, 0)‖ ≤ m * (|x - -r / 2| + ‖y‖) := this + _ ≤ m * (3 * r + 2 * r) := by gcongr + _ = 5 * r * m := by ring + have hsplit : H (x, y) v v = H (-r / 2, 0) v v + (H (x, y) - H (-r / 2, 0)) v v := by + simp + have hb := (H (x, y) - H (-r / 2, 0)).le_opNorm₂ v v + have hb' : (H (x, y) - H (-r / 2, 0)) v v ≤ 5 * r * m * ‖v‖ ^ 2 := by + have h1 := (le_abs_self _).trans (by simpa [Real.norm_eq_abs] using hb) + calc (H (x, y) - H (-r / 2, 0)) v v ≤ ‖H (x, y) - H (-r / 2, 0)‖ * ‖v‖ * ‖v‖ := h1 + _ ≤ 5 * r * m * ‖v‖ * ‖v‖ := by gcongr + _ = 5 * r * m * ‖v‖ ^ 2 := by ring + rw [hsplit] + have := hlam v + nlinarith + +/-- **L4 on the full domain.** Every slice `y ↦ f (x, y)`, `x ∈ [-2r - ε, 2r + ε]`, is +`(λ - 5rm)`-strongly concave on `B̄(0, 2r)`. -/ +theorem slices_strongConcave_D {f : ℝ × E → ℝ} {Dφ : ℝ × E → E →L[ℝ] ℝ} + {H : ℝ × E → E →L[ℝ] E →L[ℝ] ℝ} {r m lam ε : ℝ} (hm : 0 ≤ m) (hε : 0 < ε) + (hεr : ε ≤ r / 2) + (hD : ∀ p ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r), + HasFDerivAt (fun y => f (p.1, y)) (Dφ p) p.2) + (hH : ∀ p ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r), + HasFDerivAt (fun y => Dφ (p.1, y)) (H p) p.2) + (hlip : ∀ p ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r), + ‖H p - H (-r / 2, 0)‖ ≤ m * (|p.1 - -r / 2| + ‖p.2‖)) + (hlam : ∀ v : E, H (-r / 2, 0) v v ≤ -lam * ‖v‖ ^ 2) : + ∀ x ∈ Icc (-2 * r - ε) (2 * r + ε), + StrongConcaveOn (Metric.closedBall (0 : E) (2 * r)) (lam - 5 * r * m) (fun y => f (x, y)) := by + intro x hx + have hbd := transverse_hessian_le_D hm hε hεr hlip hlam + exact strongConcaveOn_of_hessian (Dφ := fun y => Dφ (x, y)) (H := fun y => H (x, y)) + (convex_closedBall _ _) (fun y hy => hD (x, y) ⟨hx, hy⟩) (fun y hy => hH (x, y) ⟨hx, hy⟩) + (fun y hy v => hbd (x, y) ⟨hx, hy⟩ v) + +/-- **The cap from SP's source data (L1–L5, L7, L8, L11, L18 composed).** Fix a collar +`0 < ε ≤ r/2` and assume, for `x ∈ [-2r - ε, 2r + ε]` and `y ∈ B̄(0, 2r)`: a joint derivative `Df` of `f`, strictly differentiable in +its transverse part `∂_y f = Df ∘ inr` with derivative `DG`; the transverse Hessian `H` with the +third-derivative bounds `m` of L3; (H1) `8rm² < λ` with `H(M) ≤ -λ`; the critical pins +`Df(∓r/2, 0) = 0`; the weak bounds `|∂_x³ f(·, 0)| ≤ m` on `[-r/2, r/2]` (L1) and +`|∂_x² ∂_y f(·, 0)| ≤ m` on the collar (L5); and the gap `f(M) - f(S) = r³/6`. Then: +- a ridge `h` exists: on `(-2r - ε, 2r + ε)`, `h x` is a critical point of its slice in the open + ball; +- for any such ridge (unique by `slice_critical_unique`) with L12's `hconv` for + `F x = ∂_x f(x, h x)`, `h(∓r/2) = 0`, and (C1)–(C3) and (C2⁺) hold on the cap with `M = (-r/2, 0)`, + `S = (r/2, 0)`, `b = f(M)` and `s = f(S)`. + +L8 puts `h` in the open ball on `[-2r, 2r]` (`‖w‖ ≤ 3mr² < 2rδ`); the implicit function theorem +(`ridge_differentiable`) makes `h` differentiable there, with negative definite `DG ∘ inr = H`; +`ridge_inputs_of_joint` gives L11; `ridge_capHyp_H1` gives the cap. Only L12 (`hconv`) remains an +input, with L6 and L9–L11's quantitative bounds that SP uses to prove it. -/ +theorem ridge_capHyp_source [FiniteDimensional ℝ E] {f : ℝ × E → ℝ} + {Df : ℝ × E → ℝ × E →L[ℝ] ℝ} {DG : ℝ × E → ℝ × E →L[ℝ] E →L[ℝ] ℝ} + {H : ℝ × E → E →L[ℝ] E →L[ℝ] ℝ} {Hx : ℝ → E →L[ℝ] E →L[ℝ] ℝ} + {Hr : ℝ × E → ℝ → E →L[ℝ] E →L[ℝ] ℝ} {r m lam ε : ℝ} (hr : 0 < r) (hε : 0 < ε) + (hεr : ε ≤ r / 2) + (hDf : ∀ p ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r), + HasFDerivAt f (Df p) p) + (hGs : ∀ p ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r), + HasStrictFDerivAt (fun q => (Df q).comp (ContinuousLinearMap.inr ℝ ℝ E)) (DG p) p) + (hH : ∀ p ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r), + HasFDerivAt (fun y => (Df (p.1, y)).comp (ContinuousLinearMap.inr ℝ ℝ E)) (H p) p.2) + (hHx : ∀ x ∈ Icc (-2 * r - ε) (2 * r + ε), HasDerivAt (fun t => H (t, 0)) (Hx x) x) + (hHxb : ∀ x ∈ Icc (-2 * r - ε) (2 * r + ε), ‖Hx x‖ ≤ m) + (hHr : ∀ p ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r), + ∀ s ∈ Icc (0 : ℝ) 1, HasDerivAt (fun s : ℝ => H (p.1, s • p.2)) (Hr p s) s) + (hHrb : ∀ p ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r), + ∀ s ∈ Icc (0 : ℝ) 1, ‖Hr p s‖ ≤ m * ‖p.2‖) + (hlam : ∀ v : E, H (-r / 2, 0) v v ≤ -lam * ‖v‖ ^ 2) (hH1 : 8 * r * m ^ 2 < lam) + (hM : Df (-r / 2, 0) = 0) (hS : Df (r / 2, 0) = 0) + (hG0cv : ConvexOn ℝ (Icc (-r / 2) (r / 2)) (fun t => Df (t, 0) (1, 0) + m / 2 * t ^ 2)) + (hG0cc : ConcaveOn ℝ (Icc (-r / 2) (r / 2)) (fun t => Df (t, 0) (1, 0) - m / 2 * t ^ 2)) + (hwcv : ∀ v : E, ConvexOn ℝ (Icc (-2 * r - ε) (2 * r + ε)) + (fun t => Df (t, 0) (0, v) + m * ‖v‖ / 2 * t ^ 2)) + (hwcc : ∀ v : E, ConcaveOn ℝ (Icc (-2 * r - ε) (2 * r + ε)) + (fun t => Df (t, 0) (0, v) - m * ‖v‖ / 2 * t ^ 2)) + (hnorm : f (-r / 2, 0) - f (r / 2, 0) = r ^ 3 / 6) : + (∃ h : ℝ → E, ∀ x ∈ Ioo (-2 * r - ε) (2 * r + ε), h x ∈ Metric.ball (0 : E) (2 * r) ∧ + HasFDerivAt (fun y => f (x, y)) (0 : E →L[ℝ] ℝ) (h x)) ∧ + ∀ h : ℝ → E, (∀ x ∈ Ioo (-2 * r - ε) (2 * r + ε), + h x ∈ Metric.closedBall (0 : E) (2 * r) ∧ + HasFDerivAt (fun y => f (x, y)) (0 : E →L[ℝ] ℝ) (h x)) → + ConvexOn ℝ (Icc (-2 * r) (2 * r)) + (fun x => Df (x, h x) (1, 0) - (x + r / 2) * (x - r / 2) / 8) → + h (-r / 2) = 0 ∧ h (r / 2) = 0 ∧ + CapHyp f (Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r)) (-r / 2, 0) + (2 * r, h (2 * r)) (f (-r / 2, 0)) (f (r / 2, 0)) ∧ + ∀ x ∈ frontier (Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r)), + x ≠ (r / 2, 0) → f x < f (r / 2, 0) := by + have hUX : Ioo (-2 * r - ε) (2 * r + ε) ⊆ Icc (-2 * r - ε) (2 * r + ε) := Ioo_subset_Icc_self + have hcapX : Icc (-2 * r) (r / 2) ⊆ Icc (-2 * r - ε) (2 * r + ε) := + Icc_subset_Icc (by linarith) (by linarith) + have hIU : Icc (-2 * r) (2 * r) ⊆ Ioo (-2 * r - ε) (2 * r + ε) := + fun t ht => ⟨by linarith [ht.1], by linarith [ht.2]⟩ + have h0Y : (0 : E) ∈ Metric.closedBall (0 : E) (2 * r) := Metric.mem_closedBall_self (by positivity) + -- the slice derivatives are the transverse parts of `Df` + have hD : ∀ p ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r), + HasFDerivAt (fun y => f (p.1, y)) ((Df p).comp (ContinuousLinearMap.inr ℝ ℝ E)) p.2 := by + rintro ⟨x, y⟩ hp + exact slice_hasFDerivAt (hDf (x, y) hp) + -- L1–L2: `m ≥ 2` + have hg0 : ∀ x ∈ Icc (-r / 2) (r / 2), + HasDerivAt (fun x => f (x, 0)) (Df (x, 0) (1, 0)) x := by + intro x hx + have hx' : (x, (0 : E)) ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r) := + ⟨⟨by linarith [hx.1], by linarith [hx.2]⟩, h0Y⟩ + have hp : HasDerivAt (fun t : ℝ => (t, (0 : E))) ((1 : ℝ), (0 : E)) x := + (hasDerivAt_id x).prodMk (hasDerivAt_const x (0 : E)) + exact (hDf _ hx').comp_hasDerivAt x hp + have hG0a : Df (-r / 2, 0) (1, 0) = 0 := by simp [hM] + have hG0c : Df (r / 2, 0) (1, 0) = 0 := by simp [hS] + have hm : 2 ≤ m := hermite_m_ge_two (g := fun x => f (x, 0)) hr hg0 hG0cv hG0cc hG0a hG0c hnorm + have hm0 : 0 ≤ m := by linarith + -- L3–L4 on the full domain + have hlip := hessian_increment_D hr hε hHx hHxb hHr hHrb + have hneg := transverse_hessian_le_D hm0 hε hεr hlip hlam + have hconcX := slices_strongConcave_D hm0 hε hεr hD hH hlip hlam + have h11 : 11 * (r * m) < lam - 5 * r * m := by + nlinarith [mul_nonneg (mul_nonneg hr.le hm0) (sub_nonneg.2 hm)] + have hrm : 0 < r * m := mul_pos hr (by linarith) + have hδ0 : 0 < lam - 5 * r * m := by linarith + -- L5 on the full domain: `‖w x‖ ≤ 3mr² < 2rδ` + have hwv : ∀ (t : ℝ) (v : E), + ((Df (t, 0)).comp (ContinuousLinearMap.inr ℝ ℝ E)) v = Df (t, 0) (0, v) := fun t v => by simp + have hwcv' : ∀ v : E, ConvexOn ℝ (Icc (-2 * r - ε) (2 * r + ε)) + (fun t => ((Df (t, 0)).comp (ContinuousLinearMap.inr ℝ ℝ E)) v + m * ‖v‖ / 2 * t ^ 2) := + fun v => (hwcv v).congr fun t _ => by simp only [hwv] + have hwcc' : ∀ v : E, ConcaveOn ℝ (Icc (-2 * r - ε) (2 * r + ε)) + (fun t => ((Df (t, 0)).comp (ContinuousLinearMap.inr ℝ ℝ E)) v - m * ‖v‖ / 2 * t ^ 2) := + fun v => (hwcc v).congr fun t _ => by simp only [hwv] + have hwa : (Df (-r / 2, 0)).comp (ContinuousLinearMap.inr ℝ ℝ E) = 0 := by simp [hM] + have hwc : (Df (r / 2, 0)).comp (ContinuousLinearMap.inr ℝ ℝ E) = 0 := by simp [hS] + have hwlt : ∀ x ∈ Icc (-2 * r - ε) (2 * r + ε), + ‖(Df (x, 0)).comp (ContinuousLinearMap.inr ℝ ℝ E)‖ < (lam - 5 * r * m) * (2 * r) := by + intro x hx + have h1 := slice_gradient_bound (w := fun t => (Df (t, 0)).comp (ContinuousLinearMap.inr ℝ ℝ E)) + hm0 hwcv' hwcc' (show -r / 2 ∈ Icc (-2 * r - ε) (2 * r + ε) from ⟨by linarith, by linarith⟩) + (show r / 2 ∈ Icc (-2 * r - ε) (2 * r + ε) from ⟨by linarith, by linarith⟩) (by linarith) + hwa hwc hx + have h2 : |(x - -r / 2) * (x - r / 2)| ≤ 6 * r ^ 2 := by + have hxx : 0 ≤ (x - (-2 * r - ε)) * (2 * r + ε - x) := + mul_nonneg (by linarith [hx.1]) (by linarith [hx.2]) + have hee : 0 ≤ (r / 2 - ε) * (9 * r / 2 + ε) := + mul_nonneg (by linarith) (by linarith) + rw [abs_le]; constructor <;> nlinarith [sq_nonneg x, sq_nonneg r] + have h3 : ‖(Df (x, 0)).comp (ContinuousLinearMap.inr ℝ ℝ E)‖ ≤ 3 * m * r ^ 2 := + calc ‖(Df (x, 0)).comp (ContinuousLinearMap.inr ℝ ℝ E)‖ + ≤ m / 2 * |(x - -r / 2) * (x - r / 2)| := h1 + _ ≤ m / 2 * (6 * r ^ 2) := by gcongr + _ = 3 * m * r ^ 2 := by ring + have h4 : 22 * r * (r * m) < (lam - 5 * r * m) * (2 * r) := by nlinarith + nlinarith + have hslice0 : ∀ x ∈ Icc (-2 * r - ε) (2 * r + ε), + HasFDerivAt (fun y => f (x, y)) ((Df (x, 0)).comp (ContinuousLinearMap.inr ℝ ℝ E)) 0 := + fun x hx => hD (x, 0) ⟨hx, h0Y⟩ + refine ⟨ridge_exists (Dφ := fun x y => (Df (x, y)).comp (ContinuousLinearMap.inr ℝ ℝ E)) hr + (fun x hx => hconcX x (hUX hx)) (fun x hx y hy => hD (x, y) ⟨hUX hx, hy⟩) + (fun x hx => hwlt x (hUX hx)), ?_⟩ + intro h hhU hconv + have hball : ∀ x ∈ Ioo (-2 * r - ε) (2 * r + ε), h x ∈ Metric.closedBall (0 : E) (2 * r) := + fun x hx => (hhU x hx).1 + have hcrit : ∀ x ∈ Ioo (-2 * r - ε) (2 * r + ε), + HasFDerivAt (fun y => f (x, y)) (0 : E →L[ℝ] ℝ) (h x) := fun x hx => (hhU x hx).2 + -- L7 uniqueness: the pins are on the ridge + have hMU : -r / 2 ∈ Ioo (-2 * r - ε) (2 * r + ε) := ⟨by linarith, by linarith⟩ + have hSU : r / 2 ∈ Ioo (-2 * r - ε) (2 * r + ε) := ⟨by linarith, by linarith⟩ + have hha : h (-r / 2) = 0 := + slice_critical_unique (hconcX _ (hUX hMU)) hδ0 (hball _ hMU) h0Y (hcrit _ hMU) + (by simpa [hwa] using hslice0 _ (hUX hMU)) + have hhc : h (r / 2) = 0 := + slice_critical_unique (hconcX _ (hUX hSU)) hδ0 (hball _ hSU) h0Y (hcrit _ hSU) + (by simpa [hwc] using hslice0 _ (hUX hSU)) + -- L8: the ridge is in the open ball on `[-2r, 2r]` + have hint : ∀ x ∈ Icc (-2 * r) (2 * r), h x ∈ Metric.ball (0 : E) (2 * r) := by + intro x hx + have hxU := hIU hx + have h8 := slice_ridge_bound (hconcX x (hUX hxU)) h0Y (hball x hxU) (hcrit x hxU) + (hslice0 x (hUX hxU)) + have h9 := hwlt x (hUX hxU) + rw [Metric.mem_ball, dist_zero_right] + have : (lam - 5 * r * m) * ‖h x‖ < (lam - 5 * r * m) * (2 * r) := by linarith + exact lt_of_mul_lt_mul_left this hδ0.le + have hridgeX : ∀ x ∈ Icc (-2 * r) (2 * r), + (x, h x) ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r) := + fun x hx => ⟨hUX (hIU hx), hball x (hIU hx)⟩ + -- L7 regularity: the transverse part of `DG` is `H`, negative definite + have hDGH : ∀ x ∈ Icc (-2 * r) (2 * r), + DG (x, h x) ∘L ContinuousLinearMap.inr ℝ ℝ E = H (x, h x) := by + intro x hx + have h1 : HasFDerivAt (fun y => (Df (x, y)).comp (ContinuousLinearMap.inr ℝ ℝ E)) + ((DG (x, h x)).comp (ContinuousLinearMap.inr ℝ ℝ E)) (h x) := + (hGs _ (hridgeX x hx)).hasFDerivAt.comp (h x) (hasFDerivAt_prodMk_right x (h x)) + exact h1.unique (hH _ (hridgeX x hx)) + have hnegR : ∀ x ∈ Icc (-2 * r) (2 * r), ∀ v : E, + (DG (x, h x) ∘L ContinuousLinearMap.inr ℝ ℝ E) v v ≤ -(lam - 5 * r * m) * ‖v‖ ^ 2 := by + intro x hx v + rw [hDGH x hx] + exact hneg _ (hridgeX x hx) v + have hG : ∀ x ∈ Icc (-2 * r) (2 * r), ∀ᶠ v in 𝓝 (x, h x), + HasFDerivAt (fun y => f (v.1, y)) ((Df v).comp (ContinuousLinearMap.inr ℝ ℝ E)) v.2 := by + intro x hx + have hopen : IsOpen (Ioo (-2 * r - ε) (2 * r + ε) ×ˢ Metric.ball (0 : E) (2 * r)) := + isOpen_Ioo.prod Metric.isOpen_ball + filter_upwards [hopen.mem_nhds ⟨hIU hx, hint x hx⟩] with v hv + exact hD v ⟨hUX hv.1, Metric.ball_subset_closedBall hv.2⟩ + have hstrict := ridge_differentiable (f := f) + (G := fun q => (Df q).comp (ContinuousLinearMap.inr ℝ ℝ E)) (DG := fun x => DG (x, h x)) + (h := h) (U := Ioo (-2 * r - ε) (2 * r + ε)) hδ0 isOpen_Ioo hIU + (fun x hx => hconcX x (hUX hx)) hball hcrit hint hG + (fun x hx => hGs _ (hridgeX x hx)) hnegR + -- L11 + have hDr : ∀ x ∈ Icc (-2 * r) (2 * r), HasFDerivAt f (Df (x, h x)) (x, h x) := + fun x hx => hDf _ (hridgeX x hx) + have hridge : ∀ x ∈ Icc (-2 * r) (2 * r), + (Df (x, h x)).comp (ContinuousLinearMap.inr ℝ ℝ E) = 0 := + fun x hx => (slice_hasFDerivAt (hDr x hx)).unique (hcrit x (hIU hx)) + obtain ⟨hh, hg, -⟩ := ridge_inputs_of_joint hr hDr + (fun x hx => (hstrict x hx).hasFDerivAt.hasDerivAt) hridge + have hFa : Df (-r / 2, h (-r / 2)) (1, 0) = 0 := by simp [hha, hM] + have hFc : Df (r / 2, h (r / 2)) (1, 0) = 0 := by simp [hhc, hS] + have hcap : ∀ x ∈ Icc (-2 * r) (r / 2), x ∈ Ioo (-2 * r - ε) (2 * r + ε) := + fun x hx => ⟨by linarith [hx.1], by linarith [hx.2]⟩ + have key := ridge_capHyp_H1 (w := fun t => (Df (t, 0)).comp (ContinuousLinearMap.inr ℝ ℝ E)) + hr hg0 hG0cv hG0cc hG0a hG0c + (fun p hp => hD p ⟨hcapX hp.1, hp.2⟩) (fun p hp => hH p ⟨hcapX hp.1, hp.2⟩) + (fun x hx => hHx x (hcapX hx)) (fun x hx => hHxb x (hcapX hx)) + (fun p hp => hHr p ⟨hcapX hp.1, hp.2⟩) (fun p hp => hHrb p ⟨hcapX hp.1, hp.2⟩) hlam hH1 + hh hg hFa hFc hconv (fun x hx => hball x (hcap x hx)) (fun x hx => hcrit x (hcap x hx)) + hha hhc (fun x hx => hslice0 x (hcapX hx)) + (fun v => (hwcv' v).subset hcapX (convex_Icc _ _)) + (fun v => (hwcc' v).subset hcapX (convex_Icc _ _)) (by rw [hha, hhc]; exact hnorm) + rw [hha, hhc] at key + exact ⟨hha, hhc, key⟩ + + +/-! ### L6, L9 and L12 (v1.9) + +The last analytic input of the cap, L12's convexity `hconv`, is derived here. L6 bounds `w'` by +chord slopes of L5's convexity pair (no integral), L9 bounds `h'` through the differentiated ridge +equation, and L12 uses that `F' = D²f[(1, h'), (1, 0)]` is the maximum of `ζ ↦ D²f[(1, ζ), (1, ζ)]`, +so that no second derivative of `h` is needed. `ridge_capHyp_C3` composes them with +`ridge_capHyp_source`. -/ + +/-- A convex function with equal values at `a < c` has derivative `≥ 0` to the right of `c` and +`≤ 0` to the left of `a`. -/ +theorem convex_deriv_sign {φ : ℝ → ℝ} {D : Set ℝ} {a c x d : ℝ} (hφ : ConvexOn ℝ D φ) + (haD : a ∈ D) (hcD : c ∈ D) (hac : a < c) (heq : φ a = φ c) (hx : x ∈ D) + (hd : HasDerivAt φ d x) : (c ≤ x → 0 ≤ d) ∧ (x ≤ a → d ≤ 0) := by + have h0 : (φ c - φ a) / (c - a) = 0 := by rw [heq, sub_self, zero_div] + constructor + · intro hcx + have hax : a < x := hac.trans_le hcx + have h1 : (φ c - φ a) / (c - a) ≤ (φ x - φ a) / (x - a) := + hφ.secant_mono haD hcD hx hac.ne' hax.ne' hcx + have h2 := hφ.slope_le_of_hasDerivAt haD hx hax hd + rw [slope_def_field] at h2 + linarith + · intro hxa + rcases hxa.eq_or_lt with h | h + · subst h + have h2 := hφ.le_slope_of_hasDerivAt hx hcD hac hd + rw [slope_def_field] at h2 + linarith + · have h1 : (φ a - φ x) / (a - x) ≤ (φ c - φ a) / (c - a) := + hφ.slope_mono_adjacent hx hcD h hac + have h2 := hφ.le_slope_of_hasDerivAt hx haD h hd + rw [slope_def_field] at h2 + linarith + +/-- **L6 (scalar).** If `u + (m/2)t²` is convex and `u - (m/2)t²` concave on `D` (weakly +`|u''| ≤ m`), `u(∓r/2) = 0` and `u` has derivative `d` at `x ∈ D`, then `|d| ≤ m · max(|x|, r/2)`. +Outside the pins the chord through them has slope `0`; between them the chord to the nearer pin and +L5's bound on `u(x)` give `mr/2`. -/ +theorem two_node_deriv_bound {u : ℝ → ℝ} {D : Set ℝ} {r m x d : ℝ} (hr : 0 < r) (hm : 0 ≤ m) + (hcv : ConvexOn ℝ D (fun t => u t + m / 2 * t ^ 2)) + (hcc : ConcaveOn ℝ D (fun t => u t - m / 2 * t ^ 2)) + (haD : -r / 2 ∈ D) (hcD : r / 2 ∈ D) (ha : u (-r / 2) = 0) (hc : u (r / 2) = 0) + (hx : x ∈ D) (hd : HasDerivAt u d x) : |d| ≤ m * max |x| (r / 2) := by + have hac : -r / 2 < r / 2 := by linarith + have hq : HasDerivAt (fun t : ℝ => m / 2 * t ^ 2) (m * x) x := by + convert (hasDerivAt_pow 2 x).const_mul (m / 2) using 1 + push_cast + ring + have hg : HasDerivAt (fun t => u t + m / 2 * t ^ 2) (d + m * x) x := hd.add hq + have hcv' : ConvexOn ℝ D (fun t => -u t + m / 2 * t ^ 2) := + hcc.neg.congr fun t _ => by simp only [Pi.neg_apply]; ring + have hk : HasDerivAt (fun t => -u t + m / 2 * t ^ 2) (-d + m * x) x := hd.neg.add hq + have hgeq : (fun t => u t + m / 2 * t ^ 2) (-r / 2) = (fun t => u t + m / 2 * t ^ 2) (r / 2) := by + simp only [ha, hc]; ring + have hkeq : (fun t => -u t + m / 2 * t ^ 2) (-r / 2) = + (fun t => -u t + m / 2 * t ^ 2) (r / 2) := by + simp only [ha, hc]; ring + obtain ⟨g1, g2⟩ := convex_deriv_sign hcv haD hcD hac hgeq hx hg + obtain ⟨k1, k2⟩ := convex_deriv_sign hcv' haD hcD hac hkeq hx hk + rcases le_or_gt (r / 2) x with hcx | hxc + · have h1 := g1 hcx + have h2 := k1 hcx + have hxpos : 0 ≤ x := by linarith + rw [abs_of_nonneg hxpos] + calc |d| ≤ m * x := abs_le.mpr ⟨by linarith, by linarith⟩ + _ ≤ m * max x (r / 2) := mul_le_mul_of_nonneg_left (le_max_left _ _) hm + rcases le_or_gt x (-r / 2) with hxa | hax + · have h1 := g2 hxa + have h2 := k2 hxa + have hxneg : x ≤ 0 := by linarith + rw [abs_of_nonpos hxneg] + calc |d| ≤ m * -x := abs_le.mpr ⟨by linarith, by linarith⟩ + _ ≤ m * max (-x) (r / 2) := mul_le_mul_of_nonneg_left (le_max_left _ _) hm + · -- between the pins + have hu := two_node_bound hcv hcc haD hcD hac ha hc hx + have hP : (x - -r / 2) * (x - r / 2) ≤ 0 := + mul_nonpos_of_nonneg_of_nonpos (by linarith) (by linarith) + rw [abs_of_nonpos hP] at hu + have hcx : 0 < r / 2 - x := by linarith + have hs1 := hcv.le_slope_of_hasDerivAt hx hcD hxc hg + have hs2 := hcv'.le_slope_of_hasDerivAt hx hcD hxc hk + rw [slope_def_field, le_div_iff₀ hcx] at hs1 hs2 + simp only [hc] at hs1 hs2 + have hu1 := (abs_le.mp hu).1 + have hu2 := (abs_le.mp hu).2 + have key1 : d * (r / 2 - x) ≤ m / 2 * r * (r / 2 - x) := by nlinarith + have key2 : -d * (r / 2 - x) ≤ m / 2 * r * (r / 2 - x) := by nlinarith + have hd1 := le_of_mul_le_mul_right key1 hcx + have hd2 := le_of_mul_le_mul_right key2 hcx + calc |d| ≤ m / 2 * r := abs_le.mpr ⟨by linarith, hd1⟩ + _ = m * (r / 2) := by ring + _ ≤ m * max |x| (r / 2) := mul_le_mul_of_nonneg_left (le_max_right _ _) hm + + +/-- **L6 (CAP (7)).** For the slice derivatives `w t` at `y = 0` with derivative `w' x` at `x`, under +L5's hypotheses: `‖w' x‖ ≤ m · max(|x|, r/2)`; on `[-2r, 2r]` this is SP's `‖w'‖ ≤ 2mr`. -/ +theorem slice_gradient_deriv_bound {w : ℝ → E →L[ℝ] ℝ} {w' : E →L[ℝ] ℝ} {D : Set ℝ} {r m x : ℝ} + (hr : 0 < r) (hm : 0 ≤ m) + (hcv : ∀ v : E, ConvexOn ℝ D (fun t => w t v + m * ‖v‖ / 2 * t ^ 2)) + (hcc : ∀ v : E, ConcaveOn ℝ D (fun t => w t v - m * ‖v‖ / 2 * t ^ 2)) + (haD : -r / 2 ∈ D) (hcD : r / 2 ∈ D) (ha : w (-r / 2) = 0) (hc : w (r / 2) = 0) + (hx : x ∈ D) (hd : HasDerivAt w w' x) : ‖w'‖ ≤ m * max |x| (r / 2) := by + refine ContinuousLinearMap.opNorm_le_bound _ (by positivity) fun v => ?_ + have hdv : HasDerivAt (fun t => w t v) (w' v) x := by + simpa using hd.clm_apply (hasDerivAt_const x v) + have h := two_node_deriv_bound (u := fun t => w t v) (m := m * ‖v‖) hr (by positivity) (hcv v) + (hcc v) haD hcD (by simp [ha]) (by simp [hc]) hx hdv + rw [Real.norm_eq_abs] + calc |w' v| ≤ m * ‖v‖ * max |x| (r / 2) := h + _ = m * max |x| (r / 2) * ‖v‖ := by ring + +/-- **L9 and the Schur maximum.** Let `Q` be a bilinear form on `ℝ × E` with `δ`-negative definite +transverse part, and let `η` satisfy the differentiated ridge equation `Q (1, η) (0, ·) = 0`. Then +`δ ‖η‖ ≤ ‖Q (1, 0) (0, ·)‖` (L9: `‖h'‖ ≤ ‖∂_x ∇_y f‖ / δ`), `Q (1, η) (1, η) = Q (1, η) (1, 0)`, and, +if `Q` is symmetric, `Q (1, ζ) (1, ζ) ≤ Q (1, η) (1, η)` for every `ζ`: the Schur complement +`F' = f_xx + f_xy[h']` is the maximum of `ζ ↦ D²f[(1, ζ), (1, ζ)]`. -/ +theorem schur_max {Q : ℝ × E →L[ℝ] ℝ × E →L[ℝ] ℝ} {δ : ℝ} {η : E} (hδ : 0 < δ) + (hneg : ∀ v : E, Q (0, v) (0, v) ≤ -δ * ‖v‖ ^ 2) + (hridge : (Q (1, η)).comp (ContinuousLinearMap.inr ℝ ℝ E) = 0) : + δ * ‖η‖ ≤ ‖(Q (1, 0)).comp (ContinuousLinearMap.inr ℝ ℝ E)‖ ∧ + Q (1, η) (1, η) = Q (1, η) (1, 0) ∧ + ((∀ v w, Q v w = Q w v) → ∀ ζ : E, Q (1, ζ) (1, ζ) ≤ Q (1, η) (1, η)) := by + have h0 : ∀ v : E, Q (1, η) (0, v) = 0 := fun v => by + simpa using congrArg (fun L : E →L[ℝ] ℝ => L v) hridge + have hsplit : ∀ ζ : E, ((1 : ℝ), ζ) = ((1 : ℝ), (0 : E)) + ((0 : ℝ), ζ) := fun ζ => by simp + refine ⟨?_, ?_, ?_⟩ + · have h1 : Q (1, 0) (0, η) + Q (0, η) (0, η) = 0 := by + have := h0 η + rw [hsplit η, map_add, add_apply] at this + exact this + have h2 : Q (1, 0) (0, η) ≤ ‖(Q (1, 0)).comp (ContinuousLinearMap.inr ℝ ℝ E)‖ * ‖η‖ := by + have := ((Q (1, 0)).comp (ContinuousLinearMap.inr ℝ ℝ E)).le_opNorm η + have h3 : ((Q (1, 0)).comp (ContinuousLinearMap.inr ℝ ℝ E)) η = Q (1, 0) (0, η) := by simp + rw [h3] at this + exact (le_abs_self _).trans (by simpa [Real.norm_eq_abs] using this) + have h4 := hneg η + have h5 : δ * ‖η‖ * ‖η‖ ≤ ‖(Q (1, 0)).comp (ContinuousLinearMap.inr ℝ ℝ E)‖ * ‖η‖ := by + nlinarith + rcases (norm_nonneg η).eq_or_lt with h | h + · rw [← h, mul_zero]; exact norm_nonneg _ + · exact le_of_mul_le_mul_right h5 h + · have e : Q (1, η) (1, η) = Q (1, η) ((1, 0) + (0, η)) := by rw [← hsplit η] + rw [e, map_add, h0 η, add_zero] + · intro hsym ζ + have hz : ((1 : ℝ), ζ) = ((1 : ℝ), η) + ((0 : ℝ), ζ - η) := by simp + have h1 := h0 (ζ - η) + have h2 : Q (0, ζ - η) (1, η) = 0 := by rw [hsym]; exact h1 + have h3 := hneg (ζ - η) + rw [hz, map_add, map_add, add_apply, add_apply, h1, h2] + nlinarith [sq_nonneg ‖ζ - η‖] + +/-- **The correction terms of L12.** Let `T a b v` be the third derivative of `f` (the derivative of +`D²f[a, b]` in direction `v`). If every block other than `f_xxx` has norm at most `m`, in the combined +form below, then `T (1, b) (1, b) (1, a) ≥ f_xxx - m((1 + ‖b‖)²(1 + ‖a‖) - 1)`. With `‖a‖, ‖b‖ ≤ u` +this is SP's adverse bound `m u (3 + 3u + u²)`. -/ +theorem trilinear_lower {T : ℝ × E → ℝ × E → ℝ × E →L[ℝ] ℝ} {m : ℝ} + (hT : ∀ (s₁ s₂ s₃ : ℝ) (y₁ y₂ y₃ : E), + |T (s₁, y₁) (s₂, y₂) (s₃, y₃) - s₁ * s₂ * s₃ * T (1, 0) (1, 0) (1, 0)| ≤ + m * ((|s₁| + ‖y₁‖) * (|s₂| + ‖y₂‖) * (|s₃| + ‖y₃‖) - |s₁| * |s₂| * |s₃|)) + (a b : E) : + T (1, 0) (1, 0) (1, 0) - m * ((1 + ‖b‖) * (1 + ‖b‖) * (1 + ‖a‖) - 1) ≤ T (1, b) (1, b) (1, a) := by + have h := (abs_le.mp (hT 1 1 1 b b a)).1 + simp only [abs_one, one_mul, mul_one] at h + linarith + +/-- **SP's constants close L12.** With `m ≥ 2`, `δ > rm(8m - 5)` and `u = 2s + 2s²`, `s = mr/δ` +(L9's bound on `‖h'‖`): `7/4 - m((1 + u)³ - 1) ≥ 1/4`. SP's exact value at `k = 11` is +`7/4 - 2554128/1771561 = 0.308… > 1/4`. -/ +theorem l12_constants {r m δ : ℝ} (hr : 0 < r) (hm : 2 ≤ m) (hδ : r * m * (8 * m - 5) < δ) : + 1 / 4 ≤ 7 / 4 - m * ((1 + (2 * (m * r / δ) + 2 * (m * r / δ) ^ 2)) ^ 3 - 1) := by + have hrm : 0 < r * m := mul_pos hr (by linarith) + have h11 : 11 * (r * m) ≤ r * m * (8 * m - 5) := by nlinarith + have hδ0 : 0 < δ := by linarith + set s := m * r / δ with hs + have hs0 : 0 ≤ s := by positivity + have hs1 : s ≤ 1 / 11 := by + rw [hs, div_le_iff₀ hδ0]; nlinarith + have hms : m * s ≤ 2 / 11 := by + have : m * s = m * m * r / δ := by rw [hs]; ring + rw [this, div_le_iff₀ hδ0] + nlinarith [mul_nonneg (mul_nonneg hr.le (by linarith : (0 : ℝ) ≤ m)) (by linarith : (0 : ℝ) ≤ m - 2)] + set u := 2 * s + 2 * s ^ 2 with hu + have hu0 : 0 ≤ u := by positivity + have hu1 : u ≤ 24 / 121 := by rw [hu]; nlinarith + have hmu : m * u ≤ 48 / 121 := by + have : m * u = 2 * (m * s) * (1 + s) := by rw [hu]; ring + rw [this] + have h1 : 1 + s ≤ 12 / 11 := by linarith + have h2 : 0 ≤ m * s := by positivity + nlinarith + have hexp : m * ((1 + u) ^ 3 - 1) = (m * u) * (3 + 3 * u + u ^ 2) := by ring + rw [hexp] + have h3 : 3 + 3 * u + u ^ 2 ≤ 3 + 3 * (24 / 121) + (24 / 121) ^ 2 := by nlinarith + have h4 : (m * u) * (3 + 3 * u + u ^ 2) ≤ (48 / 121) * (3 + 3 * (24 / 121) + (24 / 121) ^ 2) := + mul_le_mul hmu h3 (by positivity) (by norm_num) + norm_num at h4 ⊢ + linarith + +/-- **The transverse Hessian is the transverse block of `D²f`.** If `y ↦ ∂_y f (x, y)` has +derivative `H` at `y₀` and `Df` has derivative `D2f` at `(x, y₀)`, then +`H v w = D²f (x, y₀) [(0, v), (0, w)]`. -/ +theorem transverse_hessian_eq {Df : ℝ × E → ℝ × E →L[ℝ] ℝ} {D2f : ℝ × E →L[ℝ] ℝ × E →L[ℝ] ℝ} + {H : E →L[ℝ] E →L[ℝ] ℝ} {x : ℝ} {y₀ : E} + (hH : HasFDerivAt (fun y => (Df (x, y)).comp (ContinuousLinearMap.inr ℝ ℝ E)) H y₀) + (hD2 : HasFDerivAt Df D2f (x, y₀)) (v w : E) : H v w = D2f (0, v) (0, w) := by + have h1 := hH.clm_apply (hasFDerivAt_const w y₀) + have h2 := (hD2.comp y₀ (hasFDerivAt_prodMk_right x y₀)).clm_apply + (hasFDerivAt_const ((0 : ℝ), w) y₀) + have h3 := h1.unique h2 + have := congrArg (fun L : E →L[ℝ] ℝ => L v) h3 + simpa using this + +/-- **The differentiated ridge equation.** If `∂_y f (t, h t) = 0` for `t` near `x`, `h` has +derivative `h'` at `x` and `Df` has derivative `D2f` at `(x, h x)`, then +`D²f (x, h x) [(1, h'), (0, ·)] = 0`, i.e. `∂_x ∇_y f + D_y² f · h' = 0` (L11's first identity). -/ +theorem ridge_second_identity {Df : ℝ × E → ℝ × E →L[ℝ] ℝ} + {D2f : ℝ × E →L[ℝ] ℝ × E →L[ℝ] ℝ} {h : ℝ → E} {h' : E} {x : ℝ} + (hridge : ∀ᶠ t in 𝓝 x, (Df (t, h t)).comp (ContinuousLinearMap.inr ℝ ℝ E) = 0) + (hh : HasDerivAt h h' x) (hD2 : HasFDerivAt Df D2f (x, h x)) : + (D2f (1, h')).comp (ContinuousLinearMap.inr ℝ ℝ E) = 0 := by + have hp : HasDerivAt (fun t => (t, h t)) ((1 : ℝ), h') x := (hasDerivAt_id x).prodMk hh + have h1 : HasDerivAt (fun t => Df (t, h t)) (D2f (1, h')) x := hD2.comp_hasDerivAt x hp + have h2 : HasDerivAt (fun t => (Df (t, h t)).comp (ContinuousLinearMap.inr ℝ ℝ E)) + ((D2f (1, h')).comp (ContinuousLinearMap.inr ℝ ℝ E)) x := by + have := h1.clm_comp (hasDerivAt_const x (ContinuousLinearMap.inr ℝ ℝ E)) + simpa using this + have h3 : HasDerivAt (fun t => (Df (t, h t)).comp (ContinuousLinearMap.inr ℝ ℝ E)) 0 x := + (hasDerivAt_const x (0 : E →L[ℝ] ℝ)).congr_of_eventuallyEq hridge + exact h2.unique h3 + +/-- **L12 (CAP (11)–(12)): the convexity input `hconv`.** Along the ridge, let `Df`, `D2f` be the +first two derivatives of `f`, with `D2f` symmetric and its transverse part `δ`-negative definite, +`‖h'‖ ≤ u`, and for every `‖b‖ ≤ u` let `s ↦ D²f(s, h s)[(1, b), (1, b)]` have derivative `≥ 1/4` +(SP: `f_xxx ≥ 7/4` minus the adverse part `m u (3 + 3u + u²)`; see `trilinear_lower`). Then +`F - (x + r/2)(x - r/2)/8`, `F x = ∂_x f (x, h x)`, is convex on `[-2r, 2r]`. No second derivative of +`h` is used: `F' = D²f[(1, h'), (1, 0)]` is the maximum of `ζ ↦ D²f[(1, ζ), (1, ζ)]` (`schur_max`), +so `F'(x₂) - F'(x₁) ≥ D²f(x₂)[(1, η), (1, η)] - D²f(x₁)[(1, η), (1, η)] ≥ (x₂ - x₁)/4` with +`η = h'(x₁)`. -/ +theorem ridge_hconv {Df : ℝ × E → ℝ × E →L[ℝ] ℝ} {D2f : ℝ × E → ℝ × E →L[ℝ] ℝ × E →L[ℝ] ℝ} + {Φ : ℝ → E → ℝ} {h h' : ℝ → E} {U : Set ℝ} {r δ u : ℝ} (hδ : 0 < δ) (hU : IsOpen U) + (hIU : Icc (-2 * r) (2 * r) ⊆ U) + (hridge : ∀ x ∈ U, (Df (x, h x)).comp (ContinuousLinearMap.inr ℝ ℝ E) = 0) + (hh : ∀ x ∈ Icc (-2 * r) (2 * r), HasDerivAt h (h' x) x) + (hD2 : ∀ x ∈ Icc (-2 * r) (2 * r), HasFDerivAt Df (D2f (x, h x)) (x, h x)) + (hsym : ∀ x ∈ Icc (-2 * r) (2 * r), ∀ v w, D2f (x, h x) v w = D2f (x, h x) w v) + (hneg : ∀ x ∈ Icc (-2 * r) (2 * r), ∀ v : E, D2f (x, h x) (0, v) (0, v) ≤ -δ * ‖v‖ ^ 2) + (hu : ∀ x ∈ Icc (-2 * r) (2 * r), ‖h' x‖ ≤ u) + (hΦ : ∀ x ∈ Icc (-2 * r) (2 * r), ∀ b : E, + HasDerivAt (fun s => D2f (s, h s) (1, b) (1, b)) (Φ x b) x) + (hΦb : ∀ x ∈ Icc (-2 * r) (2 * r), ∀ b : E, ‖b‖ ≤ u → 1 / 4 ≤ Φ x b) : + ConvexOn ℝ (Icc (-2 * r) (2 * r)) + (fun x => Df (x, h x) (1, 0) - (x + r / 2) * (x - r / 2) / 8) := by + have hid : ∀ x ∈ Icc (-2 * r) (2 * r), + (D2f (x, h x) (1, h' x)).comp (ContinuousLinearMap.inr ℝ ℝ E) = 0 := fun x hx => + ridge_second_identity (Filter.eventually_of_mem (hU.mem_nhds (hIU hx)) hridge) (hh x hx) + (hD2 x hx) + have hF : ∀ x ∈ Icc (-2 * r) (2 * r), + HasDerivAt (fun t => Df (t, h t) (1, 0) - (t + r / 2) * (t - r / 2) / 8) + (D2f (x, h x) (1, h' x) (1, 0) - x / 4) x := by + intro x hx + have hp : HasDerivAt (fun t => (t, h t)) ((1 : ℝ), h' x) x := (hasDerivAt_id x).prodMk (hh x hx) + have h1 : HasDerivAt (fun t => Df (t, h t)) (D2f (x, h x) (1, h' x)) x := + (hD2 x hx).comp_hasDerivAt x hp + have h2 : HasDerivAt (fun t => Df (t, h t) (1, 0)) (D2f (x, h x) (1, h' x) (1, 0)) x := by + simpa using h1.clm_apply (hasDerivAt_const x ((1 : ℝ), (0 : E))) + have h3 : HasDerivAt (fun t : ℝ => (t + r / 2) * (t - r / 2) / 8) (x / 4) x := by + have := ((hasDerivAt_pow 2 x).div_const 8).sub_const (r ^ 2 / 32) + convert this using 1 + · funext t + ring + · push_cast + ring + exact h2.sub h3 + have hmono : MonotoneOn (fun x => D2f (x, h x) (1, h' x) (1, 0) - x / 4) + (Icc (-2 * r) (2 * r)) := by + intro x1 hx1 x2 hx2 hle + have hφ : ∀ t ∈ Icc (-2 * r) (2 * r), + HasDerivAt (fun s => D2f (s, h s) (1, h' x1) (1, h' x1) - s / 4) + (Φ t (h' x1) - 1 / 4) t := fun t ht => + (hΦ t ht (h' x1)).sub ((hasDerivAt_id t).div_const 4) + have hφmono : MonotoneOn (fun s => D2f (s, h s) (1, h' x1) (1, h' x1) - s / 4) + (Icc (-2 * r) (2 * r)) := by + refine monotoneOn_of_deriv_nonneg (convex_Icc _ _) + (fun t ht => (hφ t ht).continuousAt.continuousWithinAt) + (fun t ht => (hφ t (interior_subset ht)).differentiableAt.differentiableWithinAt) ?_ + intro t ht + rw [(hφ t (interior_subset ht)).deriv] + have := hΦb t (interior_subset ht) (h' x1) (hu x1 hx1) + linarith + have h12 := hφmono hx1 hx2 hle + obtain ⟨-, he1, -⟩ := schur_max hδ (hneg x1 hx1) (hid x1 hx1) + obtain ⟨-, he2, hmax2⟩ := schur_max hδ (hneg x2 hx2) (hid x2 hx2) + have hm2 := hmax2 (hsym x2 hx2) (h' x1) + simp only at h12 ⊢ + rw [← he1, ← he2] + linarith + refine MonotoneOn.convexOn_of_deriv (convex_Icc _ _) + (fun x hx => (hF x hx).continuousAt.continuousWithinAt) + (fun x hx => (hF x (interior_subset hx)).differentiableAt.differentiableWithinAt) ?_ + intro x1 hx1 x2 hx2 hle + rw [(hF x1 (interior_subset hx1)).deriv, (hF x2 (interior_subset hx2)).deriv] + exact hmono (interior_subset hx1) (interior_subset hx2) hle + + +/-- **L3 in `y` for `∂_x ∇_y f`.** If along the segment `s ↦ (x, s • y)` the third derivatives +satisfy `|T (1, 0) (0, v) (0, y)| ≤ m ‖v‖ ‖y‖` (the block `f_xyy`), then +`‖∂_x ∇_y f (x, y) - ∂_x ∇_y f (x, 0)‖ ≤ m ‖y‖`. -/ +theorem dx_grad_increment {D2f : ℝ × E → ℝ × E →L[ℝ] ℝ × E →L[ℝ] ℝ} + {T3 : ℝ × E → ℝ × E → ℝ × E → ℝ × E →L[ℝ] ℝ} {x m : ℝ} {y : E} (hm : 0 ≤ m) + (hD3 : ∀ s ∈ Icc (0 : ℝ) 1, ∀ a b : ℝ × E, + HasFDerivAt (fun q => D2f q a b) (T3 (x, s • y) a b) (x, s • y)) + (hT : ∀ s ∈ Icc (0 : ℝ) 1, ∀ v : E, |T3 (x, s • y) (1, 0) (0, v) (0, y)| ≤ m * ‖v‖ * ‖y‖) : + ‖(D2f (x, y) (1, 0)).comp (ContinuousLinearMap.inr ℝ ℝ E) - + (D2f (x, 0) (1, 0)).comp (ContinuousLinearMap.inr ℝ ℝ E)‖ ≤ m * ‖y‖ := by + refine ContinuousLinearMap.opNorm_le_bound _ (by positivity) fun v => ?_ + have hφ : ∀ s ∈ Icc (0 : ℝ) 1, HasDerivAt (fun s : ℝ => D2f (x, s • y) (1, 0) (0, v)) + (T3 (x, s • y) (1, 0) (0, v) (0, y)) s := by + intro s hs + have hp : HasDerivAt (fun s : ℝ => (x, s • y)) ((0 : ℝ), y) s := by + simpa using (hasDerivAt_const s x).prodMk ((hasDerivAt_id s).smul_const y) + exact (hD3 s hs (1, 0) (0, v)).comp_hasDerivAt s hp + have hφb : ∀ s ∈ Icc (0 : ℝ) 1, ‖T3 (x, s • y) (1, 0) (0, v) (0, y)‖ ≤ m * ‖v‖ * ‖y‖ := + fun s hs => by rw [Real.norm_eq_abs]; exact hT s hs v + have := (convex_Icc (0 : ℝ) 1).norm_image_sub_le_of_norm_hasDerivWithin_le + (fun s hs => (hφ s hs).hasDerivWithinAt) hφb (left_mem_Icc.mpr zero_le_one) + (right_mem_Icc.mpr zero_le_one) + simp only [one_smul, zero_smul, sub_zero, norm_one, mul_one] at this + simp only [sub_apply, ContinuousLinearMap.comp_apply, + ContinuousLinearMap.inr_apply] + calc ‖(D2f (x, y)) (1, 0) (0, v) - (D2f (x, 0)) (1, 0) (0, v)‖ ≤ m * ‖v‖ * ‖y‖ := this + _ = m * ‖y‖ * ‖v‖ := by ring + +/-- **L9's arithmetic.** From `δ ‖h'‖ ≤ ‖∂_x∇_y f(x, h)‖ ≤ 2mr + m‖h‖` and `δ ‖h‖ ≤ 2mr²`: +`‖h'‖ ≤ 2s + 2s²` with `s = mr/δ` (SP: `u = 2/k + 2/k²`). -/ +theorem l9_arith {δ m r a b c : ℝ} (hδ : 0 < δ) (hm : 0 ≤ m) (ha : δ * a ≤ c) + (hc : c ≤ 2 * m * r + m * b) (hb : δ * b ≤ 2 * m * r ^ 2) : + a ≤ 2 * (m * r / δ) + 2 * (m * r / δ) ^ 2 := by + have key : δ * δ * a ≤ 2 * m * r * δ + 2 * m * m * r ^ 2 := by nlinarith + have hrhs : 2 * (m * r / δ) + 2 * (m * r / δ) ^ 2 = + (2 * m * r * δ + 2 * m * m * r ^ 2) / (δ * δ) := by + field_simp + rw [hrhs, le_div_iff₀ (by positivity)] + linarith + +/-- **L12's bound at one point.** With the combined block bound, `f_xxx ≥ 7/4`, `‖a‖, ‖b‖ ≤ u` +and `7/4 - m((1 + u)³ - 1) ≥ 1/4` (`l12_constants`): `T (1, b) (1, b) (1, a) ≥ 1/4`. -/ +theorem l12_lower {T : ℝ × E → ℝ × E → ℝ × E →L[ℝ] ℝ} {m u : ℝ} {a b : E} (hm : 0 ≤ m) + (hT : ∀ (s₁ s₂ s₃ : ℝ) (y₁ y₂ y₃ : E), + |T (s₁, y₁) (s₂, y₂) (s₃, y₃) - s₁ * s₂ * s₃ * T (1, 0) (1, 0) (1, 0)| ≤ + m * ((|s₁| + ‖y₁‖) * (|s₂| + ‖y₂‖) * (|s₃| + ‖y₃‖) - |s₁| * |s₂| * |s₃|)) + (hxxx : 7 / 4 ≤ T (1, 0) (1, 0) (1, 0)) (hc : 1 / 4 ≤ 7 / 4 - m * ((1 + u) ^ 3 - 1)) + (ha : ‖a‖ ≤ u) (hb : ‖b‖ ≤ u) : 1 / 4 ≤ T (1, b) (1, b) (1, a) := by + have h1 := trilinear_lower hT a b + have hnb := norm_nonneg b + have hna := norm_nonneg a + have hb1 : 1 + ‖b‖ ≤ 1 + u := by linarith + have ha1 : 1 + ‖a‖ ≤ 1 + u := by linarith + have h4 : (1 + ‖b‖) * (1 + ‖b‖) * (1 + ‖a‖) ≤ (1 + u) ^ 3 := by + have e : (1 + u) ^ 3 = (1 + u) * (1 + u) * (1 + u) := by ring + rw [e] + exact mul_le_mul (mul_le_mul hb1 hb1 (by linarith) (by linarith)) ha1 (by linarith) + (mul_nonneg (by linarith) (by linarith)) + have h5 := mul_le_mul_of_nonneg_left (sub_le_sub_right h4 1) hm + linarith + +/-- **The ridge facts from SP's source data.** Under the hypotheses of `ridge_capHyp_source`, for a +ridge `h` on the collar: `m ≥ 2`, `δ = λ - 5rm > rm(8m - 5)`, `h x` lies in the open ball and +`δ ‖h x‖ ≤ 2mr²` on `[-2r, 2r]` (L5 and L8), `h` is differentiable there (L7), and the transverse +Hessian along the ridge is `δ`-negative definite (L4). -/ +theorem ridge_source_facts [FiniteDimensional ℝ E] {f : ℝ × E → ℝ} + {Df : ℝ × E → ℝ × E →L[ℝ] ℝ} {DG : ℝ × E → ℝ × E →L[ℝ] E →L[ℝ] ℝ} + {H : ℝ × E → E →L[ℝ] E →L[ℝ] ℝ} {Hx : ℝ → E →L[ℝ] E →L[ℝ] ℝ} + {Hr : ℝ × E → ℝ → E →L[ℝ] E →L[ℝ] ℝ} {r m lam ε : ℝ} (hr : 0 < r) (hε : 0 < ε) + (hεr : ε ≤ r / 2) + (hDf : ∀ p ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r), HasFDerivAt f (Df p) p) + (hGs : ∀ p ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r), + HasStrictFDerivAt (fun q => (Df q).comp (ContinuousLinearMap.inr ℝ ℝ E)) (DG p) p) + (hH : ∀ p ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r), + HasFDerivAt (fun y => (Df (p.1, y)).comp (ContinuousLinearMap.inr ℝ ℝ E)) (H p) p.2) + (hHx : ∀ x ∈ Icc (-2 * r - ε) (2 * r + ε), HasDerivAt (fun t => H (t, 0)) (Hx x) x) + (hHxb : ∀ x ∈ Icc (-2 * r - ε) (2 * r + ε), ‖Hx x‖ ≤ m) + (hHr : ∀ p ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r), + ∀ s ∈ Icc (0 : ℝ) 1, HasDerivAt (fun s : ℝ => H (p.1, s • p.2)) (Hr p s) s) + (hHrb : ∀ p ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r), + ∀ s ∈ Icc (0 : ℝ) 1, ‖Hr p s‖ ≤ m * ‖p.2‖) + (hlam : ∀ v : E, H (-r / 2, 0) v v ≤ -lam * ‖v‖ ^ 2) (hH1 : 8 * r * m ^ 2 < lam) + (hM : Df (-r / 2, 0) = 0) (hS : Df (r / 2, 0) = 0) + (hG0cv : ConvexOn ℝ (Icc (-r / 2) (r / 2)) (fun t => Df (t, 0) (1, 0) + m / 2 * t ^ 2)) + (hG0cc : ConcaveOn ℝ (Icc (-r / 2) (r / 2)) (fun t => Df (t, 0) (1, 0) - m / 2 * t ^ 2)) + (hwcv : ∀ v : E, ConvexOn ℝ (Icc (-2 * r - ε) (2 * r + ε)) + (fun t => Df (t, 0) (0, v) + m * ‖v‖ / 2 * t ^ 2)) + (hwcc : ∀ v : E, ConcaveOn ℝ (Icc (-2 * r - ε) (2 * r + ε)) + (fun t => Df (t, 0) (0, v) - m * ‖v‖ / 2 * t ^ 2)) + (hnorm : f (-r / 2, 0) - f (r / 2, 0) = r ^ 3 / 6) {h : ℝ → E} + (hhU : ∀ x ∈ Ioo (-2 * r - ε) (2 * r + ε), h x ∈ Metric.closedBall (0 : E) (2 * r) ∧ + HasFDerivAt (fun y => f (x, y)) (0 : E →L[ℝ] ℝ) (h x)) : + 2 ≤ m ∧ r * m * (8 * m - 5) < lam - 5 * r * m ∧ + (∀ x ∈ Icc (-2 * r) (2 * r), h x ∈ Metric.ball (0 : E) (2 * r)) ∧ + (∀ x ∈ Icc (-2 * r) (2 * r), (lam - 5 * r * m) * ‖h x‖ ≤ 2 * m * r ^ 2) ∧ + (∃ h' : ℝ → E, ∀ x ∈ Icc (-2 * r) (2 * r), HasDerivAt h (h' x) x) ∧ + (∀ x ∈ Icc (-2 * r) (2 * r), ∀ v : E, H (x, h x) v v ≤ -(lam - 5 * r * m) * ‖v‖ ^ 2) := by + have hUX : Ioo (-2 * r - ε) (2 * r + ε) ⊆ Icc (-2 * r - ε) (2 * r + ε) := Ioo_subset_Icc_self + have hcapX : Icc (-2 * r) (r / 2) ⊆ Icc (-2 * r - ε) (2 * r + ε) := + Icc_subset_Icc (by linarith) (by linarith) + have hIU : Icc (-2 * r) (2 * r) ⊆ Ioo (-2 * r - ε) (2 * r + ε) := + fun t ht => ⟨by linarith [ht.1], by linarith [ht.2]⟩ + have h0Y : (0 : E) ∈ Metric.closedBall (0 : E) (2 * r) := Metric.mem_closedBall_self (by positivity) + -- the slice derivatives are the transverse parts of `Df` + have hD : ∀ p ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r), + HasFDerivAt (fun y => f (p.1, y)) ((Df p).comp (ContinuousLinearMap.inr ℝ ℝ E)) p.2 := by + rintro ⟨x, y⟩ hp + exact slice_hasFDerivAt (hDf (x, y) hp) + -- L1–L2: `m ≥ 2` + have hg0 : ∀ x ∈ Icc (-r / 2) (r / 2), + HasDerivAt (fun x => f (x, 0)) (Df (x, 0) (1, 0)) x := by + intro x hx + have hx' : (x, (0 : E)) ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r) := + ⟨⟨by linarith [hx.1], by linarith [hx.2]⟩, h0Y⟩ + have hp : HasDerivAt (fun t : ℝ => (t, (0 : E))) ((1 : ℝ), (0 : E)) x := + (hasDerivAt_id x).prodMk (hasDerivAt_const x (0 : E)) + exact (hDf _ hx').comp_hasDerivAt x hp + have hG0a : Df (-r / 2, 0) (1, 0) = 0 := by simp [hM] + have hG0c : Df (r / 2, 0) (1, 0) = 0 := by simp [hS] + have hm : 2 ≤ m := hermite_m_ge_two (g := fun x => f (x, 0)) hr hg0 hG0cv hG0cc hG0a hG0c hnorm + have hm0 : 0 ≤ m := by linarith + -- L3–L4 on the full domain + have hlip := hessian_increment_D hr hε hHx hHxb hHr hHrb + have hneg := transverse_hessian_le_D hm0 hε hεr hlip hlam + have hconcX := slices_strongConcave_D hm0 hε hεr hD hH hlip hlam + have h11 : 11 * (r * m) < lam - 5 * r * m := by + nlinarith [mul_nonneg (mul_nonneg hr.le hm0) (sub_nonneg.2 hm)] + have hrm : 0 < r * m := mul_pos hr (by linarith) + have hδ0 : 0 < lam - 5 * r * m := by linarith + -- L5 on the full domain: `‖w x‖ ≤ 3mr² < 2rδ` + have hwv : ∀ (t : ℝ) (v : E), + ((Df (t, 0)).comp (ContinuousLinearMap.inr ℝ ℝ E)) v = Df (t, 0) (0, v) := fun t v => by simp + have hwcv' : ∀ v : E, ConvexOn ℝ (Icc (-2 * r - ε) (2 * r + ε)) + (fun t => ((Df (t, 0)).comp (ContinuousLinearMap.inr ℝ ℝ E)) v + m * ‖v‖ / 2 * t ^ 2) := + fun v => (hwcv v).congr fun t _ => by simp only [hwv] + have hwcc' : ∀ v : E, ConcaveOn ℝ (Icc (-2 * r - ε) (2 * r + ε)) + (fun t => ((Df (t, 0)).comp (ContinuousLinearMap.inr ℝ ℝ E)) v - m * ‖v‖ / 2 * t ^ 2) := + fun v => (hwcc v).congr fun t _ => by simp only [hwv] + have hwa : (Df (-r / 2, 0)).comp (ContinuousLinearMap.inr ℝ ℝ E) = 0 := by simp [hM] + have hwc : (Df (r / 2, 0)).comp (ContinuousLinearMap.inr ℝ ℝ E) = 0 := by simp [hS] + have hwlt : ∀ x ∈ Icc (-2 * r - ε) (2 * r + ε), + ‖(Df (x, 0)).comp (ContinuousLinearMap.inr ℝ ℝ E)‖ < (lam - 5 * r * m) * (2 * r) := by + intro x hx + have h1 := slice_gradient_bound (w := fun t => (Df (t, 0)).comp (ContinuousLinearMap.inr ℝ ℝ E)) + hm0 hwcv' hwcc' (show -r / 2 ∈ Icc (-2 * r - ε) (2 * r + ε) from ⟨by linarith, by linarith⟩) + (show r / 2 ∈ Icc (-2 * r - ε) (2 * r + ε) from ⟨by linarith, by linarith⟩) (by linarith) + hwa hwc hx + have h2 : |(x - -r / 2) * (x - r / 2)| ≤ 6 * r ^ 2 := by + have hxx : 0 ≤ (x - (-2 * r - ε)) * (2 * r + ε - x) := + mul_nonneg (by linarith [hx.1]) (by linarith [hx.2]) + have hee : 0 ≤ (r / 2 - ε) * (9 * r / 2 + ε) := + mul_nonneg (by linarith) (by linarith) + rw [abs_le]; constructor <;> nlinarith [sq_nonneg x, sq_nonneg r] + have h3 : ‖(Df (x, 0)).comp (ContinuousLinearMap.inr ℝ ℝ E)‖ ≤ 3 * m * r ^ 2 := + calc ‖(Df (x, 0)).comp (ContinuousLinearMap.inr ℝ ℝ E)‖ + ≤ m / 2 * |(x - -r / 2) * (x - r / 2)| := h1 + _ ≤ m / 2 * (6 * r ^ 2) := by gcongr + _ = 3 * m * r ^ 2 := by ring + have h4 : 22 * r * (r * m) < (lam - 5 * r * m) * (2 * r) := by nlinarith + nlinarith + have hslice0 : ∀ x ∈ Icc (-2 * r - ε) (2 * r + ε), + HasFDerivAt (fun y => f (x, y)) ((Df (x, 0)).comp (ContinuousLinearMap.inr ℝ ℝ E)) 0 := + fun x hx => hD (x, 0) ⟨hx, h0Y⟩ + have hball : ∀ x ∈ Ioo (-2 * r - ε) (2 * r + ε), h x ∈ Metric.closedBall (0 : E) (2 * r) := + fun x hx => (hhU x hx).1 + have hcrit : ∀ x ∈ Ioo (-2 * r - ε) (2 * r + ε), + HasFDerivAt (fun y => f (x, y)) (0 : E →L[ℝ] ℝ) (h x) := fun x hx => (hhU x hx).2 + -- L8: the ridge is in the open ball on `[-2r, 2r]` + have hint : ∀ x ∈ Icc (-2 * r) (2 * r), h x ∈ Metric.ball (0 : E) (2 * r) := by + intro x hx + have hxU := hIU hx + have h8 := slice_ridge_bound (hconcX x (hUX hxU)) h0Y (hball x hxU) (hcrit x hxU) + (hslice0 x (hUX hxU)) + have h9 := hwlt x (hUX hxU) + rw [Metric.mem_ball, dist_zero_right] + have : (lam - 5 * r * m) * ‖h x‖ < (lam - 5 * r * m) * (2 * r) := by linarith + exact lt_of_mul_lt_mul_left this hδ0.le + have hridgeX : ∀ x ∈ Icc (-2 * r) (2 * r), + (x, h x) ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r) := + fun x hx => ⟨hUX (hIU hx), hball x (hIU hx)⟩ + -- L7 regularity: the transverse part of `DG` is `H`, negative definite + have hDGH : ∀ x ∈ Icc (-2 * r) (2 * r), + DG (x, h x) ∘L ContinuousLinearMap.inr ℝ ℝ E = H (x, h x) := by + intro x hx + have h1 : HasFDerivAt (fun y => (Df (x, y)).comp (ContinuousLinearMap.inr ℝ ℝ E)) + ((DG (x, h x)).comp (ContinuousLinearMap.inr ℝ ℝ E)) (h x) := + (hGs _ (hridgeX x hx)).hasFDerivAt.comp (h x) (hasFDerivAt_prodMk_right x (h x)) + exact h1.unique (hH _ (hridgeX x hx)) + have hnegR : ∀ x ∈ Icc (-2 * r) (2 * r), ∀ v : E, + (DG (x, h x) ∘L ContinuousLinearMap.inr ℝ ℝ E) v v ≤ -(lam - 5 * r * m) * ‖v‖ ^ 2 := by + intro x hx v + rw [hDGH x hx] + exact hneg _ (hridgeX x hx) v + have hG : ∀ x ∈ Icc (-2 * r) (2 * r), ∀ᶠ v in 𝓝 (x, h x), + HasFDerivAt (fun y => f (v.1, y)) ((Df v).comp (ContinuousLinearMap.inr ℝ ℝ E)) v.2 := by + intro x hx + have hopen : IsOpen (Ioo (-2 * r - ε) (2 * r + ε) ×ˢ Metric.ball (0 : E) (2 * r)) := + isOpen_Ioo.prod Metric.isOpen_ball + filter_upwards [hopen.mem_nhds ⟨hIU hx, hint x hx⟩] with v hv + exact hD v ⟨hUX hv.1, Metric.ball_subset_closedBall hv.2⟩ + have hstrict := ridge_differentiable (f := f) + (G := fun q => (Df q).comp (ContinuousLinearMap.inr ℝ ℝ E)) (DG := fun x => DG (x, h x)) + (h := h) (U := Ioo (-2 * r - ε) (2 * r + ε)) hδ0 isOpen_Ioo hIU + (fun x hx => hconcX x (hUX hx)) hball hcrit hint hG + (fun x hx => hGs _ (hridgeX x hx)) hnegR + have hmemA : -r / 2 ∈ Icc (-2 * r - ε) (2 * r + ε) := ⟨by linarith, by linarith⟩ + have hmemC : r / 2 ∈ Icc (-2 * r - ε) (2 * r + ε) := ⟨by linarith, by linarith⟩ + have hw2 : ∀ x ∈ Icc (-2 * r) (2 * r), + ‖(Df (x, 0)).comp (ContinuousLinearMap.inr ℝ ℝ E)‖ ≤ 2 * m * r ^ 2 := by + intro x hx + have h1 := slice_gradient_bound + (w := fun t => (Df (t, 0)).comp (ContinuousLinearMap.inr ℝ ℝ E)) hm0 hwcv' hwcc' hmemA hmemC + (by linarith) hwa hwc (hUX (hIU hx)) + have h2 : |(x - -r / 2) * (x - r / 2)| ≤ 4 * r ^ 2 := by + have hxx : 0 ≤ (x - -2 * r) * (2 * r - x) := + mul_nonneg (by linarith [hx.1]) (by linarith [hx.2]) + rw [abs_le]; constructor <;> nlinarith [sq_nonneg x, sq_nonneg r] + calc ‖(Df (x, 0)).comp (ContinuousLinearMap.inr ℝ ℝ E)‖ + ≤ m / 2 * |(x - -r / 2) * (x - r / 2)| := h1 + _ ≤ m / 2 * (4 * r ^ 2) := by gcongr + _ = 2 * m * r ^ 2 := by ring + refine ⟨hm, by nlinarith, hint, fun x hx => + (slice_ridge_bound (hconcX x (hUX (hIU hx))) h0Y (hball x (hIU hx)) (hcrit x (hIU hx)) + (hslice0 x (hUX (hIU hx)))).trans (hw2 x hx), + ⟨_, fun x hx => (hstrict x hx).hasFDerivAt.hasDerivAt⟩, + fun x hx v => hneg _ (hridgeX x hx) v⟩ + + +/-- **The cap from SP's `C³` source data (L1–L20 composed; L12 proved).** As +`ridge_capHyp_source`, with L12's `hconv` derived instead of assumed. Additionally assume, on the +collar: a second derivative `D2f` of `f`, third derivatives `T3 p a b` of `p ↦ D²f p [a, b]`, every +third-derivative block other than `f_xxx` of norm at most `m` (combined form), and `f_xxx ≥ 7/4` on +`D = [-2r, 2r] × B̄(0, 2r)` (SP's L4, from L2 and (H2), on SP's domain). Then the ridge exists, and every ridge has `h(∓r/2) = 0` and yields +(C1)–(C3) and (C2⁺) on the cap. Inside: L5 gives `‖w‖ ≤ 2mr²` on `[-2r, 2r]`, L8 `‖h‖ ≤ 2mr²/δ`, L6 +`‖w'‖ ≤ 2mr`, L3 in `y` `‖∂_x∇_y f(x, h)‖ ≤ ‖w'‖ + m‖h‖`, L9 `‖h'‖ ≤ 2s + 2s²` with `s = mr/δ`, +`trilinear_lower` and `l12_constants` give `F'' ≥ 1/4` in the form of `ridge_hconv`. -/ +theorem ridge_capHyp_C3 [FiniteDimensional ℝ E] {f : ℝ × E → ℝ} + {Df : ℝ × E → ℝ × E →L[ℝ] ℝ} {D2f : ℝ × E → ℝ × E →L[ℝ] ℝ × E →L[ℝ] ℝ} + {T3 : ℝ × E → ℝ × E → ℝ × E → ℝ × E →L[ℝ] ℝ} + {DG : ℝ × E → ℝ × E →L[ℝ] E →L[ℝ] ℝ} + {H : ℝ × E → E →L[ℝ] E →L[ℝ] ℝ} {Hx : ℝ → E →L[ℝ] E →L[ℝ] ℝ} + {Hr : ℝ × E → ℝ → E →L[ℝ] E →L[ℝ] ℝ} {r m lam ε : ℝ} (hr : 0 < r) (hε : 0 < ε) + (hεr : ε ≤ r / 2) + (hDf : ∀ p ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r), HasFDerivAt f (Df p) p) + (hD2 : ∀ p ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r), HasFDerivAt Df (D2f p) p) + (hD3 : ∀ p ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r), ∀ a b : ℝ × E, HasFDerivAt (fun q => D2f q a b) (T3 p a b) p) + (hT : ∀ p ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r), ∀ (s₁ s₂ s₃ : ℝ) (y₁ y₂ y₃ : E), + |T3 p (s₁, y₁) (s₂, y₂) (s₃, y₃) - s₁ * s₂ * s₃ * T3 p (1, 0) (1, 0) (1, 0)| ≤ + m * ((|s₁| + ‖y₁‖) * (|s₂| + ‖y₂‖) * (|s₃| + ‖y₃‖) - |s₁| * |s₂| * |s₃|)) + (hxxx : ∀ p ∈ Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r), + 7 / 4 ≤ T3 p (1, 0) (1, 0) (1, 0)) + (hGs : ∀ p ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r), + HasStrictFDerivAt (fun q => (Df q).comp (ContinuousLinearMap.inr ℝ ℝ E)) (DG p) p) + (hH : ∀ p ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r), + HasFDerivAt (fun y => (Df (p.1, y)).comp (ContinuousLinearMap.inr ℝ ℝ E)) (H p) p.2) + (hHx : ∀ x ∈ Icc (-2 * r - ε) (2 * r + ε), HasDerivAt (fun t => H (t, 0)) (Hx x) x) + (hHxb : ∀ x ∈ Icc (-2 * r - ε) (2 * r + ε), ‖Hx x‖ ≤ m) + (hHr : ∀ p ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r), + ∀ s ∈ Icc (0 : ℝ) 1, HasDerivAt (fun s : ℝ => H (p.1, s • p.2)) (Hr p s) s) + (hHrb : ∀ p ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r), + ∀ s ∈ Icc (0 : ℝ) 1, ‖Hr p s‖ ≤ m * ‖p.2‖) + (hlam : ∀ v : E, H (-r / 2, 0) v v ≤ -lam * ‖v‖ ^ 2) (hH1 : 8 * r * m ^ 2 < lam) + (hM : Df (-r / 2, 0) = 0) (hS : Df (r / 2, 0) = 0) + (hG0cv : ConvexOn ℝ (Icc (-r / 2) (r / 2)) (fun t => Df (t, 0) (1, 0) + m / 2 * t ^ 2)) + (hG0cc : ConcaveOn ℝ (Icc (-r / 2) (r / 2)) (fun t => Df (t, 0) (1, 0) - m / 2 * t ^ 2)) + (hwcv : ∀ v : E, ConvexOn ℝ (Icc (-2 * r - ε) (2 * r + ε)) + (fun t => Df (t, 0) (0, v) + m * ‖v‖ / 2 * t ^ 2)) + (hwcc : ∀ v : E, ConcaveOn ℝ (Icc (-2 * r - ε) (2 * r + ε)) + (fun t => Df (t, 0) (0, v) - m * ‖v‖ / 2 * t ^ 2)) + (hnorm : f (-r / 2, 0) - f (r / 2, 0) = r ^ 3 / 6) : + (∃ h : ℝ → E, ∀ x ∈ Ioo (-2 * r - ε) (2 * r + ε), h x ∈ Metric.ball (0 : E) (2 * r) ∧ + HasFDerivAt (fun y => f (x, y)) (0 : E →L[ℝ] ℝ) (h x)) ∧ + ∀ h : ℝ → E, (∀ x ∈ Ioo (-2 * r - ε) (2 * r + ε), + h x ∈ Metric.closedBall (0 : E) (2 * r) ∧ + HasFDerivAt (fun y => f (x, y)) (0 : E →L[ℝ] ℝ) (h x)) → + h (-r / 2) = 0 ∧ h (r / 2) = 0 ∧ + CapHyp f (Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r)) (-r / 2, 0) + (2 * r, h (2 * r)) (f (-r / 2, 0)) (f (r / 2, 0)) ∧ + ∀ x ∈ frontier (Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r)), + x ≠ (r / 2, 0) → f x < f (r / 2, 0) := by + obtain ⟨hex, hcapS⟩ := ridge_capHyp_source hr hε hεr hDf hGs hH hHx hHxb hHr hHrb hlam hH1 hM hS + hG0cv hG0cc hwcv hwcc hnorm + refine ⟨hex, fun h hhU => hcapS h hhU ?_⟩ + obtain ⟨hm, hδ, hint, hh8, ⟨h', hhd⟩, hnegH⟩ := ridge_source_facts hr hε hεr hDf hGs hH hHx hHxb + hHr hHrb hlam hH1 hM hS hG0cv hG0cc hwcv hwcc hnorm hhU + have hm0 : 0 ≤ m := by linarith + have hδ0 : 0 < lam - 5 * r * m := by + have : 0 < r * m * (8 * m - 5) := mul_pos (mul_pos hr (by linarith)) (by linarith) + linarith + have hUX : Ioo (-2 * r - ε) (2 * r + ε) ⊆ Icc (-2 * r - ε) (2 * r + ε) := Ioo_subset_Icc_self + have hIU : Icc (-2 * r) (2 * r) ⊆ Ioo (-2 * r - ε) (2 * r + ε) := + fun t ht => ⟨by linarith [ht.1], by linarith [ht.2]⟩ + have h0Y : (0 : E) ∈ Metric.closedBall (0 : E) (2 * r) := Metric.mem_closedBall_self (by positivity) + have hball : ∀ x ∈ Ioo (-2 * r - ε) (2 * r + ε), h x ∈ Metric.closedBall (0 : E) (2 * r) := + fun x hx => (hhU x hx).1 + have hridgeX : ∀ x ∈ Icc (-2 * r) (2 * r), + (x, h x) ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r) := + fun x hx => ⟨hUX (hIU hx), hball x (hIU hx)⟩ + have hridgeU : ∀ x ∈ Ioo (-2 * r - ε) (2 * r + ε), + (Df (x, h x)).comp (ContinuousLinearMap.inr ℝ ℝ E) = 0 := fun x hx => + (slice_hasFDerivAt (hDf _ ⟨hUX hx, hball x hx⟩)).unique (hhU x hx).2 + have hD2r : ∀ x ∈ Icc (-2 * r) (2 * r), HasFDerivAt Df (D2f (x, h x)) (x, h x) := + fun x hx => hD2 _ (hridgeX x hx) + have hsym : ∀ x ∈ Icc (-2 * r) (2 * r), ∀ v w, D2f (x, h x) v w = D2f (x, h x) w v := by + intro x hx v w + have hopen : IsOpen (Ioo (-2 * r - ε) (2 * r + ε) ×ˢ Metric.ball (0 : E) (2 * r)) := + isOpen_Ioo.prod Metric.isOpen_ball + have hev : ∀ᶠ q in 𝓝 (x, h x), HasFDerivAt f (Df q) q := by + filter_upwards [hopen.mem_nhds ⟨hIU hx, hint x hx⟩] with q hq + exact hDf q ⟨hUX hq.1, Metric.ball_subset_closedBall hq.2⟩ + exact second_derivative_symmetric_of_eventually hev (hD2r x hx) v w + have hnegD : ∀ x ∈ Icc (-2 * r) (2 * r), ∀ v : E, + D2f (x, h x) (0, v) (0, v) ≤ -(lam - 5 * r * m) * ‖v‖ ^ 2 := by + intro x hx v + rw [← transverse_hessian_eq (hH _ (hridgeX x hx)) (hD2r x hx) v v] + exact hnegH x hx v + -- L6: `‖w' x‖ ≤ 2mr` + have hwcv' : ∀ v : E, ConvexOn ℝ (Icc (-2 * r - ε) (2 * r + ε)) + (fun t => ((Df (t, 0)).comp (ContinuousLinearMap.inr ℝ ℝ E)) v + m * ‖v‖ / 2 * t ^ 2) := + fun v => (hwcv v).congr fun t _ => by simp + have hwcc' : ∀ v : E, ConcaveOn ℝ (Icc (-2 * r - ε) (2 * r + ε)) + (fun t => ((Df (t, 0)).comp (ContinuousLinearMap.inr ℝ ℝ E)) v - m * ‖v‖ / 2 * t ^ 2) := + fun v => (hwcc v).congr fun t _ => by simp + have hw6 : ∀ x ∈ Icc (-2 * r) (2 * r), + ‖(D2f (x, 0) (1, 0)).comp (ContinuousLinearMap.inr ℝ ℝ E)‖ ≤ 2 * m * r := by + intro x hx + have hp : HasDerivAt (fun t : ℝ => (t, (0 : E))) ((1 : ℝ), (0 : E)) x := + (hasDerivAt_id x).prodMk (hasDerivAt_const x (0 : E)) + have h1 : HasDerivAt (fun t => Df (t, 0)) (D2f (x, 0) (1, 0)) x := + (hD2 _ ⟨hUX (hIU hx), h0Y⟩).comp_hasDerivAt x hp + have hd : HasDerivAt (fun t => (Df (t, 0)).comp (ContinuousLinearMap.inr ℝ ℝ E)) + ((D2f (x, 0) (1, 0)).comp (ContinuousLinearMap.inr ℝ ℝ E)) x := by + simpa using h1.clm_comp (hasDerivAt_const x (ContinuousLinearMap.inr ℝ ℝ E)) + have h2 := slice_gradient_deriv_bound hr hm0 hwcv' hwcc' + (show -r / 2 ∈ Icc (-2 * r - ε) (2 * r + ε) from ⟨by linarith, by linarith⟩) + (show r / 2 ∈ Icc (-2 * r - ε) (2 * r + ε) from ⟨by linarith, by linarith⟩) + (by simp [hM]) (by simp [hS]) (hUX (hIU hx)) hd + have h3 : max |x| (r / 2) ≤ 2 * r := + max_le (abs_le.mpr ⟨by linarith [hx.1], by linarith [hx.2]⟩) (by linarith) + calc ‖(D2f (x, 0) (1, 0)).comp (ContinuousLinearMap.inr ℝ ℝ E)‖ ≤ m * max |x| (r / 2) := h2 + _ ≤ m * (2 * r) := mul_le_mul_of_nonneg_left h3 hm0 + _ = 2 * m * r := by ring + -- L3 in `y`, then L9 + have hu : ∀ x ∈ Icc (-2 * r) (2 * r), ‖h' x‖ ≤ + 2 * (m * r / (lam - 5 * r * m)) + 2 * (m * r / (lam - 5 * r * m)) ^ 2 := by + intro x hx + have hseg : ∀ s ∈ Icc (0 : ℝ) 1, + (x, s • h x) ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r) := by + intro s hs + have hhY : ‖h x‖ ≤ 2 * r := by + simpa [Metric.mem_closedBall, dist_zero_right] using hball x (hIU hx) + refine ⟨hUX (hIU hx), ?_⟩ + rw [Metric.mem_closedBall, dist_zero_right, norm_smul, Real.norm_eq_abs, abs_of_nonneg hs.1] + nlinarith [hs.2, norm_nonneg (h x)] + have hinc := dx_grad_increment (D2f := D2f) (T3 := T3) (x := x) (y := h x) hm0 + (fun s hs => hD3 _ (hseg s hs)) + (fun s hs v => by + have := hT _ (hseg s hs) 1 0 0 0 v (h x) + simpa [mul_assoc] using this) + have hBn : ‖(D2f (x, h x) (1, 0)).comp (ContinuousLinearMap.inr ℝ ℝ E)‖ ≤ + 2 * m * r + m * ‖h x‖ := + (norm_le_norm_add_norm_sub' _ _).trans (add_le_add (hw6 x hx) hinc) + have hid := ridge_second_identity + (Filter.eventually_of_mem (isOpen_Ioo.mem_nhds (hIU hx)) hridgeU) (hhd x hx) (hD2r x hx) + obtain ⟨h9, -, -⟩ := schur_max hδ0 (hnegD x hx) hid + exact l9_arith hδ0 hm0 h9 hBn (hh8 x hx) + -- L12 + have hc := l12_constants hr hm hδ + have hΦ : ∀ x ∈ Icc (-2 * r) (2 * r), ∀ b : E, + HasDerivAt (fun s => D2f (s, h s) (1, b) (1, b)) (T3 (x, h x) (1, b) (1, b) (1, h' x)) x := by + intro x hx b + have hp : HasDerivAt (fun s => (s, h s)) ((1 : ℝ), h' x) x := (hasDerivAt_id x).prodMk (hhd x hx) + exact (hD3 _ (hridgeX x hx) (1, b) (1, b)).comp_hasDerivAt x hp + exact ridge_hconv (Φ := fun x b => T3 (x, h x) (1, b) (1, b) (1, h' x)) hδ0 isOpen_Ioo hIU + hridgeU hhd hD2r hsym hnegD hu hΦ + (fun x hx b hb => l12_lower hm0 (hT _ (hridgeX x hx)) (hxxx _ ⟨hx, hball x (hIU hx)⟩) hc + (hu x hx) hb) + + +/-! ### L2's second statement and (H2) (v2.0) + +SP's L4 lower bound `f_xxx ≥ 7/4` was the last analytic hypothesis of `ridge_capHyp_C3`. It follows +from the normalization (some point of the pin interval has `f_xxx ≥ 2`, by a one-sided Hermite bound) +and (H2) `rn ≤ 1/20` with a bound `n` on the derivative of `f_xxx`. `ridge_capHyp_C4` takes SP's +hypotheses only. -/ + +/-- **L1, one-sided.** As `hermite_gap_le`, from the concave half alone (`G'' ≤ m` weakly): +`g(a) - g(c) ≤ m (c - a)³/12`. -/ +theorem hermite_gap_le_concave {g G : ℝ → ℝ} {a c m : ℝ} (hac : a < c) + (hg : ∀ x ∈ Icc a c, HasDerivAt g (G x) x) + (hcc : ConcaveOn ℝ (Icc a c) (fun t => G t - m / 2 * t ^ 2)) + (hGa : G a = 0) (hGc : G c = 0) : + g a - g c ≤ m * (c - a) ^ 3 / 12 := by + have hpoly : ∀ x, HasDerivAt (fun t => (c - a) * (t - a) ^ 2 / 2 - (t - a) ^ 3 / 3) + ((x - a) * (c - x)) x := by + intro x + have h1 : HasDerivAt (fun t => t - a) 1 x := (hasDerivAt_id x).sub_const a + have h2 := ((h1.pow 2).const_mul (c - a)).div_const 2 + have h3 := (h1.pow 3).div_const 3 + convert h2.sub h3 using 1 + push_cast + ring + set k : ℝ → ℝ := fun t => g t + m / 2 * ((c - a) * (t - a) ^ 2 / 2 - (t - a) ^ 3 / 3) + with hk + have hkd : ∀ x ∈ Icc a c, HasDerivAt k (G x + m / 2 * ((x - a) * (c - x))) x := + fun x hx => (hg x hx).add ((hpoly x).const_mul (m / 2)) + have hcv' : ConvexOn ℝ (Icc a c) (fun t => -G t + m / 2 * t ^ 2) := + hcc.neg.congr fun t _ => by simp only [Pi.neg_apply]; ring + have hχ := convexOn_add_node (a := a) (c := c) hcv' + have hmono : MonotoneOn k (Icc a c) := by + refine monotoneOn_of_hasDerivWithinAt_nonneg (convex_Icc a c) + (fun x hx => (hkd x hx).continuousAt.continuousWithinAt) + (fun x hx => (hkd x (interior_subset hx)).hasDerivWithinAt) (fun x hx => ?_) + have hx := interior_subset hx + have h0 := convex_zeros_between hχ (left_mem_Icc.mpr hac.le) (right_mem_Icc.mpr hac.le) hac.le + (by rw [hGa]; ring) (by rw [hGc]; ring) hx + nlinarith + have hkac := hmono (left_mem_Icc.mpr hac.le) (right_mem_Icc.mpr hac.le) hac.le + simp only [hk] at hkac + have e0 : m / 2 * ((c - a) * (a - a) ^ 2 / 2 - (a - a) ^ 3 / 3) = 0 := by ring + have e1 : m / 2 * ((c - a) * (c - a) ^ 2 / 2 - (c - a) ^ 3 / 3) = m * (c - a) ^ 3 / 12 := by + ring + linarith + +/-- **L2, second statement.** Under SP's normalization `g(-r/2) - g(r/2) = r³/6` with critical pins, +if `g''' = φ` is continuous on the pin interval, then `φ(x₀) ≥ 2` for some `x₀` there (SP: the +`φ`-weighted average of `f_xxx` is `2`). -/ +theorem third_deriv_exists_two {g G G' φ : ℝ → ℝ} {r : ℝ} (hr : 0 < r) + (hg : ∀ x ∈ Icc (-r / 2) (r / 2), HasDerivAt g (G x) x) + (hG : ∀ x ∈ Icc (-r / 2) (r / 2), HasDerivAt G (G' x) x) + (hG' : ∀ x ∈ Icc (-r / 2) (r / 2), HasDerivAt G' (φ x) x) + (hφ : ContinuousOn φ (Icc (-r / 2) (r / 2))) + (hGa : G (-r / 2) = 0) (hGc : G (r / 2) = 0) (hgap : g (-r / 2) - g (r / 2) = r ^ 3 / 6) : + ∃ x₀ ∈ Icc (-r / 2) (r / 2), 2 ≤ φ x₀ := by + by_contra hcon + simp only [not_exists, not_and, not_le] at hcon + have hne : (Icc (-r / 2) (r / 2)).Nonempty := ⟨-r / 2, left_mem_Icc.mpr (by linarith)⟩ + obtain ⟨x₁, hx₁, hmax⟩ := isCompact_Icc.exists_isMaxOn hne hφ + set M := φ x₁ with hM + have hcc : ConcaveOn ℝ (Icc (-r / 2) (r / 2)) (fun t => G t - M / 2 * t ^ 2) := by + refine concaveOn_of_hasDerivWithinAt2_nonpos (convex_Icc _ _) (f' := fun t => G' t - M * t) + (f'' := fun t => φ t - M) + (fun t ht => ((hG t ht).sub ((hasDerivAt_pow 2 t).const_mul (M / 2))).continuousAt.continuousWithinAt) + (fun t ht => ?_) (fun t ht => ?_) (fun t ht => ?_) + · have := (hG t (interior_subset ht)).sub ((hasDerivAt_pow 2 t).const_mul (M / 2)) + convert this.hasDerivWithinAt using 1 + push_cast + ring + · have := (hG' t (interior_subset ht)).sub ((hasDerivAt_id' t).const_mul M) + convert this.hasDerivWithinAt using 1 + ring + · have h' : φ t ≤ φ x₁ := hmax (interior_subset ht) + show φ t - M ≤ 0 + linarith + have h1 := hermite_gap_le_concave (by linarith) hg hcc hGa hGc + have hcr : r / 2 - -r / 2 = r := by ring + rw [hgap, hcr] at h1 + have h2 := hcon x₁ hx₁ + have hr3 : 0 < r ^ 3 := by positivity + nlinarith + +/-- **L4 (`f_xxx ≥ 7/4`).** Let `ψ = f_xxx` have derivative `Dψ` on SP's domain +`D = [-2r, 2r] × B̄(0, 2r)`, with the two fourth-order blocks bounded by `n = M_4` there: +`|∂_x ψ| = |Dψ (1, 0)| ≤ n` and `‖D_y ψ‖ = ‖Dψ ∘ inr‖ ≤ n`. If `ψ(x₀, 0) ≥ 2` at a point of the pin +interval and (H2) `rn ≤ 1/20`, then `ψ ≥ 7/4` on `D` (the proof bounds `ψ ≥ 2 - 9rn/2`; the +statement exports `7/4`). As in SP's L3, move first in `x` +along `y = 0` (`|Δx| ≤ 5r/2`), then along the ray to `y` (`‖Δy‖ ≤ 2r`); SP rounds `9r/2` up to `5r`. -/ +theorem fxxx_lower {ψ : ℝ × E → ℝ} {Dψ : ℝ × E → ℝ × E →L[ℝ] ℝ} {r n x₀ : ℝ} (hr : 0 < r) + (hψ : ∀ p ∈ Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r), HasFDerivAt ψ (Dψ p) p) + (hnx : ∀ p ∈ Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r), |Dψ p (1, 0)| ≤ n) + (hny : ∀ p ∈ Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r), ‖(Dψ p).comp (ContinuousLinearMap.inr ℝ ℝ E)‖ ≤ n) + (hx₀ : x₀ ∈ Icc (-r / 2) (r / 2)) (h2 : 2 ≤ ψ (x₀, 0)) (hH2 : r * n ≤ 1 / 20) : + ∀ p ∈ Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r), 7 / 4 ≤ ψ p := by + rintro ⟨x, y⟩ ⟨hx, hy⟩ + have h0Y : (0 : E) ∈ Metric.closedBall (0 : E) (2 * r) := Metric.mem_closedBall_self (by positivity) + have hyn : ‖y‖ ≤ 2 * r := by simpa [Metric.mem_closedBall, dist_zero_right] using hy + have hn0 : 0 ≤ n := (abs_nonneg _).trans (hnx (x, y) ⟨hx, hy⟩) + -- along `y = 0` + have hx₀D : x₀ ∈ Icc (-2 * r) (2 * r) := ⟨by linarith [hx₀.1], by linarith [hx₀.2]⟩ + have hd1 : ∀ t ∈ Icc (-2 * r) (2 * r), + HasDerivAt (fun t : ℝ => ψ (t, 0)) (Dψ (t, 0) (1, 0)) t := by + intro t ht + have hp : HasDerivAt (fun s : ℝ => (s, (0 : E))) ((1 : ℝ), (0 : E)) t := + (hasDerivAt_id t).prodMk (hasDerivAt_const t (0 : E)) + exact (hψ (t, 0) ⟨ht, h0Y⟩).comp_hasDerivAt t hp + have h1 := (convex_Icc (-2 * r) (2 * r)).norm_image_sub_le_of_norm_hasDerivWithin_le + (f := fun t : ℝ => ψ (t, 0)) (fun t ht => (hd1 t ht).hasDerivWithinAt) + (fun t ht => by rw [Real.norm_eq_abs]; exact hnx (t, 0) ⟨ht, h0Y⟩) hx₀D hx + -- along the ray to `y` + have hseg : ∀ s ∈ Icc (0 : ℝ) 1, (x, s • y) ∈ Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r) := by + intro s hs + refine ⟨hx, ?_⟩ + rw [Metric.mem_closedBall, dist_zero_right, norm_smul, Real.norm_eq_abs, abs_of_nonneg hs.1] + nlinarith [hs.2, norm_nonneg y] + have hd2 : ∀ s ∈ Icc (0 : ℝ) 1, + HasDerivAt (fun s : ℝ => ψ (x, s • y)) (Dψ (x, s • y) (0, y)) s := by + intro s hs + have hp : HasDerivAt (fun s : ℝ => (x, s • y)) ((0 : ℝ), y) s := by + simpa using (hasDerivAt_const s x).prodMk ((hasDerivAt_id s).smul_const y) + exact (hψ _ (hseg s hs)).comp_hasDerivAt s hp + have hb2 : ∀ s ∈ Icc (0 : ℝ) 1, ‖Dψ (x, s • y) (0, y)‖ ≤ n * ‖y‖ := by + intro s hs + have := ((Dψ (x, s • y)).comp (ContinuousLinearMap.inr ℝ ℝ E)).le_opNorm y + simp only [ContinuousLinearMap.comp_apply, ContinuousLinearMap.inr_apply] at this + exact this.trans (mul_le_mul_of_nonneg_right (hny _ (hseg s hs)) (norm_nonneg y)) + have h2' := (convex_Icc (0 : ℝ) 1).norm_image_sub_le_of_norm_hasDerivWithin_le + (f := fun s : ℝ => ψ (x, s • y)) (fun s hs => (hd2 s hs).hasDerivWithinAt) hb2 + (left_mem_Icc.mpr zero_le_one) (right_mem_Icc.mpr zero_le_one) + simp only [one_smul, zero_smul, sub_zero, norm_one, mul_one] at h2' + have h1' : |ψ (x, 0) - ψ (x₀, 0)| ≤ n * |x - x₀| := by simpa [Real.norm_eq_abs] using h1 + rw [Real.norm_eq_abs] at h2' + have hdx : |x - x₀| ≤ 5 * r / 2 := by + rw [abs_le]; constructor <;> linarith [hx.1, hx.2, hx₀.1, hx₀.2] + have e1 := (abs_le.mp h1').1 + have e2 := (abs_le.mp h2').1 + have h5 : n * |x - x₀| ≤ n * (5 * r / 2) := mul_le_mul_of_nonneg_left hdx hn0 + have h6 : n * ‖y‖ ≤ n * (2 * r) := mul_le_mul_of_nonneg_left hyn hn0 + nlinarith + +/-- **The cap from SP's hypotheses (H1), (H2) and the derivative bounds (L1–L20 composed).** As +`ridge_capHyp_C3`, with `f_xxx ≥ 7/4` derived instead of assumed: from a derivative `Φ4` of `f_xxx` +on `D = [-2r, 2r] × B̄(0, 2r)` whose two blocks `∂_x f_xxx` and `D_y f_xxx` are bounded by +`n = M_4` there, as in SP, and (H2) `rn ≤ 1/20`. L2's second statement gives `f_xxx(x₀, 0) ≥ 2` on +the pin interval (`third_deriv_exists_two`), and `fxxx_lower` gives `f_xxx ≥ 7/4` on `D`. -/ +theorem ridge_capHyp_C4 [FiniteDimensional ℝ E] {f : ℝ × E → ℝ} + {Df : ℝ × E → ℝ × E →L[ℝ] ℝ} {D2f : ℝ × E → ℝ × E →L[ℝ] ℝ × E →L[ℝ] ℝ} + {T3 : ℝ × E → ℝ × E → ℝ × E → ℝ × E →L[ℝ] ℝ} {Φ4 : ℝ × E → ℝ × E →L[ℝ] ℝ} {n : ℝ} + {DG : ℝ × E → ℝ × E →L[ℝ] E →L[ℝ] ℝ} + {H : ℝ × E → E →L[ℝ] E →L[ℝ] ℝ} {Hx : ℝ → E →L[ℝ] E →L[ℝ] ℝ} + {Hr : ℝ × E → ℝ → E →L[ℝ] E →L[ℝ] ℝ} {r m lam ε : ℝ} (hr : 0 < r) (hε : 0 < ε) + (hεr : ε ≤ r / 2) + (hDf : ∀ p ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r), HasFDerivAt f (Df p) p) + (hD2 : ∀ p ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r), HasFDerivAt Df (D2f p) p) + (hD3 : ∀ p ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r), ∀ a b : ℝ × E, HasFDerivAt (fun q => D2f q a b) (T3 p a b) p) + (hT : ∀ p ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r), ∀ (s₁ s₂ s₃ : ℝ) (y₁ y₂ y₃ : E), + |T3 p (s₁, y₁) (s₂, y₂) (s₃, y₃) - s₁ * s₂ * s₃ * T3 p (1, 0) (1, 0) (1, 0)| ≤ + m * ((|s₁| + ‖y₁‖) * (|s₂| + ‖y₂‖) * (|s₃| + ‖y₃‖) - |s₁| * |s₂| * |s₃|)) + (hD4 : ∀ p ∈ Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r), + HasFDerivAt (fun q => T3 q (1, 0) (1, 0) (1, 0)) (Φ4 p) p) + (hn4x : ∀ p ∈ Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r), |Φ4 p (1, 0)| ≤ n) + (hn4y : ∀ p ∈ Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r), ‖(Φ4 p).comp (ContinuousLinearMap.inr ℝ ℝ E)‖ ≤ n) + (hH2 : r * n ≤ 1 / 20) + (hGs : ∀ p ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r), + HasStrictFDerivAt (fun q => (Df q).comp (ContinuousLinearMap.inr ℝ ℝ E)) (DG p) p) + (hH : ∀ p ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r), + HasFDerivAt (fun y => (Df (p.1, y)).comp (ContinuousLinearMap.inr ℝ ℝ E)) (H p) p.2) + (hHx : ∀ x ∈ Icc (-2 * r - ε) (2 * r + ε), HasDerivAt (fun t => H (t, 0)) (Hx x) x) + (hHxb : ∀ x ∈ Icc (-2 * r - ε) (2 * r + ε), ‖Hx x‖ ≤ m) + (hHr : ∀ p ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r), + ∀ s ∈ Icc (0 : ℝ) 1, HasDerivAt (fun s : ℝ => H (p.1, s • p.2)) (Hr p s) s) + (hHrb : ∀ p ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r), + ∀ s ∈ Icc (0 : ℝ) 1, ‖Hr p s‖ ≤ m * ‖p.2‖) + (hlam : ∀ v : E, H (-r / 2, 0) v v ≤ -lam * ‖v‖ ^ 2) (hH1 : 8 * r * m ^ 2 < lam) + (hM : Df (-r / 2, 0) = 0) (hS : Df (r / 2, 0) = 0) + (hG0cv : ConvexOn ℝ (Icc (-r / 2) (r / 2)) (fun t => Df (t, 0) (1, 0) + m / 2 * t ^ 2)) + (hG0cc : ConcaveOn ℝ (Icc (-r / 2) (r / 2)) (fun t => Df (t, 0) (1, 0) - m / 2 * t ^ 2)) + (hwcv : ∀ v : E, ConvexOn ℝ (Icc (-2 * r - ε) (2 * r + ε)) + (fun t => Df (t, 0) (0, v) + m * ‖v‖ / 2 * t ^ 2)) + (hwcc : ∀ v : E, ConcaveOn ℝ (Icc (-2 * r - ε) (2 * r + ε)) + (fun t => Df (t, 0) (0, v) - m * ‖v‖ / 2 * t ^ 2)) + (hnorm : f (-r / 2, 0) - f (r / 2, 0) = r ^ 3 / 6) : + (∃ h : ℝ → E, ∀ x ∈ Ioo (-2 * r - ε) (2 * r + ε), h x ∈ Metric.ball (0 : E) (2 * r) ∧ + HasFDerivAt (fun y => f (x, y)) (0 : E →L[ℝ] ℝ) (h x)) ∧ + ∀ h : ℝ → E, (∀ x ∈ Ioo (-2 * r - ε) (2 * r + ε), + h x ∈ Metric.closedBall (0 : E) (2 * r) ∧ + HasFDerivAt (fun y => f (x, y)) (0 : E →L[ℝ] ℝ) (h x)) → + h (-r / 2) = 0 ∧ h (r / 2) = 0 ∧ + CapHyp f (Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r)) (-r / 2, 0) + (2 * r, h (2 * r)) (f (-r / 2, 0)) (f (r / 2, 0)) ∧ + ∀ x ∈ frontier (Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r)), + x ≠ (r / 2, 0) → f x < f (r / 2, 0) := by + have hmem : ∀ t ∈ Icc (-r / 2) (r / 2), (t, (0 : E)) ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r) := fun t ht => + ⟨⟨by linarith [ht.1], by linarith [ht.2]⟩, Metric.mem_closedBall_self (by positivity)⟩ + have hp : ∀ t : ℝ, HasDerivAt (fun s : ℝ => (s, (0 : E))) ((1 : ℝ), (0 : E)) t := fun t => + (hasDerivAt_id t).prodMk (hasDerivAt_const t (0 : E)) + have hg : ∀ x ∈ Icc (-r / 2) (r / 2), HasDerivAt (fun x => f (x, 0)) (Df (x, 0) (1, 0)) x := by + intro x hx + exact (hDf _ (hmem x hx)).comp_hasDerivAt x (hp x) + have hG : ∀ x ∈ Icc (-r / 2) (r / 2), + HasDerivAt (fun t => Df (t, 0) (1, 0)) (D2f (x, 0) (1, 0) (1, 0)) x := by + intro x hx + have h1 : HasDerivAt (fun t => Df (t, 0)) (D2f (x, 0) (1, 0)) x := + (hD2 _ (hmem x hx)).comp_hasDerivAt x (hp x) + simpa using h1.clm_apply (hasDerivAt_const x ((1 : ℝ), (0 : E))) + have hG' : ∀ x ∈ Icc (-r / 2) (r / 2), + HasDerivAt (fun t => D2f (t, 0) (1, 0) (1, 0)) (T3 (x, 0) (1, 0) (1, 0) (1, 0)) x := by + intro x hx + exact (hD3 _ (hmem x hx) (1, 0) (1, 0)).comp_hasDerivAt x (hp x) + have hc : Continuous (fun s : ℝ => (s, (0 : E))) := continuous_id.prodMk continuous_const + have hmemD : ∀ t ∈ Icc (-r / 2) (r / 2), (t, (0 : E)) ∈ Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r) := fun t ht => + ⟨⟨by linarith [ht.1], by linarith [ht.2]⟩, Metric.mem_closedBall_self (by positivity)⟩ + have hφc : ContinuousOn (fun t => T3 (t, 0) (1, 0) (1, 0) (1, 0)) (Icc (-r / 2) (r / 2)) := by + intro t ht + have h1 : ContinuousAt (fun q => T3 q (1, 0) (1, 0) (1, 0)) (t, (0 : E)) := + (hD4 _ (hmemD t ht)).continuousAt + have h2 : ContinuousAt (fun s : ℝ => T3 (s, 0) (1, 0) (1, 0) (1, 0)) t := + ContinuousAt.comp (g := fun q => T3 q (1, 0) (1, 0) (1, 0)) (f := fun s : ℝ => (s, (0 : E))) + h1 hc.continuousAt + exact h2.continuousWithinAt + have hGa : Df (-r / 2, 0) (1, 0) = 0 := by simp [hM] + have hGc : Df (r / 2, 0) (1, 0) = 0 := by simp [hS] + have hxxx : ∀ p ∈ Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r), 7 / 4 ≤ T3 p (1, 0) (1, 0) (1, 0) := by + obtain ⟨x₀, hx₀, h2⟩ := third_deriv_exists_two hr hg hG hG' hφc hGa hGc hnorm + exact fxxx_lower (ψ := fun q => T3 q (1, 0) (1, 0) (1, 0)) hr hD4 hn4x hn4y hx₀ h2 hH2 + exact ridge_capHyp_C3 hr hε hεr hDf hD2 hD3 hT hxxx hGs hH hHx hHxb hHr hHrb hlam hH1 hM hS + hG0cv hG0cc hwcv hwcc hnorm + + +/-! ### The derivative bounds from the block bound, and SP's bounds on `D` (v2.1) + +Up to v2.0 the capstones took six derivative bounds besides the block bound `hT`: +- `hHxb` and `hHrb`, the inputs of L3; +- `hwcv` and `hwcc`, the envelope inputs of L5–L6; +- `hG0cv` and `hG0cc`, the envelope inputs of L1–L2. + +All six follow from `hT` and from `|f_xxx| ≤ m` on the pin segment, and `ridge_capHyp_C5` derives +them. Up to v2.0 the bounds `m` were also assumed on a collar `[−2r − ε, 2r + ε]` of SP's `D`. +`ridge_capHyp_D` assumes them on `D` only, through the continuity step `block_bound_collar` (I3). -/ + +/-- **L3's `x`-input from the block bound.** Let `y ↦ ∂_y f (t, y)` have derivative `H (t, 0)` at `0` +and `Df` have derivative `D2f (t, 0)` at `(t, 0)` for every `t ∈ J`, where `J` is uniquely +differentiable at `x ∈ J`. If `t ↦ H (t, 0)` has derivative `Hx'` at `x`, then +`Hx' v w = T3 (x, 0) [(0, v), (0, w), (1, 0)]`, so `‖Hx'‖ ≤ m` when that block is at most +`m ‖v‖ ‖w‖`. This derives v1.6's hypothesis `hHxb`. -/ +theorem hessian_x_bound {Df : ℝ × E → ℝ × E →L[ℝ] ℝ} {D2f : ℝ × E → ℝ × E →L[ℝ] ℝ × E →L[ℝ] ℝ} + {T3 : ℝ × E → ℝ × E → ℝ × E → ℝ × E →L[ℝ] ℝ} + {H : ℝ × E → E →L[ℝ] E →L[ℝ] ℝ} {Hx' : E →L[ℝ] E →L[ℝ] ℝ} {J : Set ℝ} {m x : ℝ} + (hJ : UniqueDiffWithinAt ℝ J x) (hxJ : x ∈ J) (hm : 0 ≤ m) + (hH : ∀ t ∈ J, HasFDerivAt (fun y => (Df (t, y)).comp (ContinuousLinearMap.inr ℝ ℝ E)) + (H (t, 0)) 0) + (hD2 : ∀ t ∈ J, HasFDerivAt Df (D2f (t, 0)) (t, 0)) + (hD3 : ∀ a b : ℝ × E, HasFDerivAt (fun q => D2f q a b) (T3 (x, 0) a b) (x, 0)) + (hT : ∀ v w : E, |T3 (x, 0) (0, v) (0, w) (1, 0)| ≤ m * (‖v‖ * ‖w‖)) + (hHx : HasDerivAt (fun t => H (t, 0)) Hx' x) : ‖Hx'‖ ≤ m := by + have hp : HasDerivAt (fun t : ℝ => (t, (0 : E))) ((1 : ℝ), (0 : E)) x := + (hasDerivAt_id x).prodMk (hasDerivAt_const x (0 : E)) + have key : ∀ v w : E, Hx' v w = T3 (x, 0) (0, v) (0, w) (1, 0) := by + intro v w + have h1 : HasDerivAt (fun t => H (t, 0) v w) (Hx' v w) x := by + have := (hHx.clm_apply (hasDerivAt_const x v)).clm_apply (hasDerivAt_const x w) + simpa using this + have h2 : HasDerivAt (fun t => D2f (t, 0) (0, v) (0, w)) (T3 (x, 0) (0, v) (0, w) (1, 0)) x := + HasFDerivAt.comp_hasDerivAt (l := fun q => D2f q (0, v) (0, w)) x (hD3 (0, v) (0, w)) hp + have h3 : HasDerivWithinAt (fun t => D2f (t, 0) (0, v) (0, w)) (Hx' v w) J x := + h1.hasDerivWithinAt.congr_of_mem (fun t ht => (transverse_hessian_eq (hH t ht) (hD2 t ht) v w).symm) hxJ + exact hJ.eq_deriv _ h3 h2.hasDerivWithinAt + refine ContinuousLinearMap.opNorm_le_bound _ hm fun v => ?_ + refine ContinuousLinearMap.opNorm_le_bound _ (mul_nonneg hm (norm_nonneg v)) fun w => ?_ + rw [key, Real.norm_eq_abs, mul_assoc] + exact hT v w + +/-- **L3's radial input from the block bound.** Along the radius `τ ↦ (x, τ y)`, `τ ∈ [0, 1]`, if +`τ ↦ H (x, τ y)` has derivative `Hr'` at `s`, then `Hr' v w = T3 (x, s y) [(0, v), (0, w), (0, y)]`, +so `‖Hr'‖ ≤ m ‖y‖` when that block is at most `m ‖v‖ ‖w‖ ‖y‖`. The identification uses derivatives +within `[0, 1]`, so the endpoint `τ = 1` may lie on the sphere `‖y‖ = 2r`. This derives v1.6's +hypothesis `hHrb`. -/ +theorem hessian_r_bound {Df : ℝ × E → ℝ × E →L[ℝ] ℝ} {D2f : ℝ × E → ℝ × E →L[ℝ] ℝ × E →L[ℝ] ℝ} + {T3 : ℝ × E → ℝ × E → ℝ × E → ℝ × E →L[ℝ] ℝ} + {H : ℝ × E → E →L[ℝ] E →L[ℝ] ℝ} {Hr' : E →L[ℝ] E →L[ℝ] ℝ} {x m s : ℝ} {y : E} + (hm : 0 ≤ m) (hs : s ∈ Icc (0 : ℝ) 1) + (hH : ∀ τ ∈ Icc (0 : ℝ) 1, HasFDerivAt (fun z => (Df (x, z)).comp (ContinuousLinearMap.inr ℝ ℝ E)) + (H (x, τ • y)) (τ • y)) + (hD2 : ∀ τ ∈ Icc (0 : ℝ) 1, HasFDerivAt Df (D2f (x, τ • y)) (x, τ • y)) + (hD3 : ∀ a b : ℝ × E, HasFDerivAt (fun q => D2f q a b) (T3 (x, s • y) a b) (x, s • y)) + (hT : ∀ v w : E, |T3 (x, s • y) (0, v) (0, w) (0, y)| ≤ m * (‖v‖ * ‖w‖ * ‖y‖)) + (hHr : HasDerivAt (fun τ : ℝ => H (x, τ • y)) Hr' s) : ‖Hr'‖ ≤ m * ‖y‖ := by + have hp : HasDerivAt (fun τ : ℝ => (x, τ • y)) ((0 : ℝ), y) s := by + have := (hasDerivAt_const s x).prodMk ((hasDerivAt_id s).smul_const y) + simpa using this + have key : ∀ v w : E, Hr' v w = T3 (x, s • y) (0, v) (0, w) (0, y) := by + intro v w + have h1 : HasDerivAt (fun τ => H (x, τ • y) v w) (Hr' v w) s := by + have := (hHr.clm_apply (hasDerivAt_const s v)).clm_apply (hasDerivAt_const s w) + simpa using this + have h2 : HasDerivAt (fun τ : ℝ => D2f (x, τ • y) (0, v) (0, w)) + (T3 (x, s • y) (0, v) (0, w) (0, y)) s := + HasFDerivAt.comp_hasDerivAt (l := fun q => D2f q (0, v) (0, w)) s (hD3 (0, v) (0, w)) hp + have h3 : HasDerivWithinAt (fun τ : ℝ => D2f (x, τ • y) (0, v) (0, w)) (Hr' v w) (Icc 0 1) s := + h1.hasDerivWithinAt.congr_of_mem + (fun τ hτ => (transverse_hessian_eq (hH τ hτ) (hD2 τ hτ) v w).symm) hs + exact (uniqueDiffOn_Icc zero_lt_one s hs).eq_deriv _ h3 h2.hasDerivWithinAt + have hmy : 0 ≤ m * ‖y‖ := mul_nonneg hm (norm_nonneg y) + refine ContinuousLinearMap.opNorm_le_bound _ hmy fun v => ?_ + refine ContinuousLinearMap.opNorm_le_bound _ (mul_nonneg hmy (norm_nonneg v)) fun w => ?_ + rw [key, Real.norm_eq_abs] + calc |T3 (x, s • y) (0, v) (0, w) (0, y)| ≤ m * (‖v‖ * ‖w‖ * ‖y‖) := hT v w + _ = m * ‖y‖ * ‖v‖ * ‖w‖ := by ring + +/-- **The envelope inputs of L1 and L5–L6 from a second-derivative bound.** If the second derivative +`T3 (t, 0) [(1, 0), u, (1, 0)]` of `t ↦ Df (t, 0) u` has absolute value at most `B` on `[a, c]`, then +`Df (·, 0) u + (B/2) t²` is convex and `Df (·, 0) u − (B/2) t²` is concave there. With `u = (0, v)` +and `B = m‖v‖` (from the block bound) this gives `hwcv` and `hwcc`. With `u = (1, 0)` and `B = m` +(SP: `|f_xxx| ≤ M₃`) it gives `hG0cv` and `hG0cc`. -/ +theorem axis_convexConcave {Df : ℝ × E → ℝ × E →L[ℝ] ℝ} + {D2f : ℝ × E → ℝ × E →L[ℝ] ℝ × E →L[ℝ] ℝ} + {T3 : ℝ × E → ℝ × E → ℝ × E → ℝ × E →L[ℝ] ℝ} {a c B : ℝ} {u : ℝ × E} + (hD2 : ∀ t ∈ Icc a c, HasFDerivAt Df (D2f (t, 0)) (t, 0)) + (hD3 : ∀ t ∈ Icc a c, HasFDerivAt (fun q => D2f q (1, 0) u) (T3 (t, 0) (1, 0) u) (t, 0)) + (hB : ∀ t ∈ Icc a c, |T3 (t, 0) (1, 0) u (1, 0)| ≤ B) : + ConvexOn ℝ (Icc a c) (fun t => Df (t, 0) u + B / 2 * t ^ 2) ∧ + ConcaveOn ℝ (Icc a c) (fun t => Df (t, 0) u - B / 2 * t ^ 2) := by + have hp : ∀ t : ℝ, HasDerivAt (fun s : ℝ => (s, (0 : E))) ((1 : ℝ), (0 : E)) t := fun t => + (hasDerivAt_id t).prodMk (hasDerivAt_const t (0 : E)) + have hg : ∀ t ∈ Icc a c, HasDerivAt (fun s => Df (s, 0) u) (D2f (t, 0) (1, 0) u) t := by + intro t ht + have h1 : HasDerivAt (fun s => Df (s, 0)) (D2f (t, 0) (1, 0)) t := + (hD2 t ht).comp_hasDerivAt t (hp t) + simpa using h1.clm_apply (hasDerivAt_const t u) + have hg' : ∀ t ∈ Icc a c, HasDerivAt (fun s => D2f (s, 0) (1, 0) u) (T3 (t, 0) (1, 0) u (1, 0)) t := + fun t ht => HasFDerivAt.comp_hasDerivAt (l := fun q => D2f q (1, 0) u) t (hD3 t ht) (hp t) + have hcont : ContinuousOn (fun s => Df (s, 0) u) (Icc a c) := + fun t ht => (hg t ht).continuousAt.continuousWithinAt + have hsq : ∀ t : ℝ, HasDerivAt (fun s : ℝ => B / 2 * s ^ 2) (B * t) t := by + intro t + have := (hasDerivAt_pow 2 t).const_mul (B / 2) + convert this using 1 + ring + have hlin : ∀ t : ℝ, HasDerivAt (fun s : ℝ => B * s) B t := by + intro t + simpa using (hasDerivAt_id t).const_mul B + have hIo : ∀ t ∈ interior (Icc a c), t ∈ Icc a c := fun t ht => interior_subset ht + constructor + · refine convexOn_of_hasDerivWithinAt2_nonneg (convex_Icc a c) + (f' := fun t => D2f (t, 0) (1, 0) u + B * t) (f'' := fun t => T3 (t, 0) (1, 0) u (1, 0) + B) + (hcont.add (continuousOn_const.mul (continuousOn_id.pow 2))) ?_ ?_ ?_ + · intro t ht + exact ((hg t (hIo t ht)).add (hsq t)).hasDerivWithinAt + · intro t ht + exact ((hg' t (hIo t ht)).add (hlin t)).hasDerivWithinAt + · intro t ht + have := hB t (hIo t ht) + have := neg_abs_le (T3 (t, 0) (1, 0) u (1, 0)) + show 0 ≤ T3 (t, 0) (1, 0) u (1, 0) + B + linarith + · refine concaveOn_of_hasDerivWithinAt2_nonpos (convex_Icc a c) + (f' := fun t => D2f (t, 0) (1, 0) u - B * t) (f'' := fun t => T3 (t, 0) (1, 0) u (1, 0) - B) + (hcont.sub (continuousOn_const.mul (continuousOn_id.pow 2))) ?_ ?_ ?_ + · intro t ht + exact ((hg t (hIo t ht)).sub (hsq t)).hasDerivWithinAt + · intro t ht + exact ((hg' t (hIo t ht)).sub (hlin t)).hasDerivWithinAt + · intro t ht + have := hB t (hIo t ht) + have := le_abs_self (T3 (t, 0) (1, 0) u (1, 0)) + show T3 (t, 0) (1, 0) u (1, 0) - B ≤ 0 + linarith + +/-- The block weight `∏ (|sᵢ| + ‖yᵢ‖) − ∏ |sᵢ|` is nonnegative. -/ +theorem block_nonneg {F : Type*} [SeminormedAddCommGroup F] (s₁ s₂ s₃ : ℝ) (y₁ y₂ y₃ : F) : + 0 ≤ (|s₁| + ‖y₁‖) * (|s₂| + ‖y₂‖) * (|s₃| + ‖y₃‖) - |s₁| * |s₂| * |s₃| := by + have a1 : |s₁| ≤ |s₁| + ‖y₁‖ := le_add_of_nonneg_right (norm_nonneg _) + have a2 : |s₂| ≤ |s₂| + ‖y₂‖ := le_add_of_nonneg_right (norm_nonneg _) + have a3 : |s₃| ≤ |s₃| + ‖y₃‖ := le_add_of_nonneg_right (norm_nonneg _) + have := mul_le_mul (mul_le_mul a1 a2 (abs_nonneg _) (by positivity)) a3 (abs_nonneg _) + (by positivity) + linarith + +/-- **The continuity step of I3: the block bound from `D` to a collar.** Assume the block bound holds +with `m` on SP's `D = [−2r, 2r] × B̄(0, 2r)`. Assume also that on the collar +`[−2r − ε₀, 2r + ε₀] × B̄(0, 2r)` the `x`-derivative `T4` of `T3` exists and satisfies the same block +bound with some `K ≥ 0` (SP: `f ∈ C⁴` near `D`, so `‖D⁴ f‖` is bounded on a compact collar). Then the +block bound holds with `m + Kε` on the collar of width `ε ≤ ε₀`. Each collar point `(x, y)` is +within `ε` of a point `(x₀, y) ∈ D`, and the mean value inequality along `x` gives the rest. -/ +theorem block_bound_collar {T3 : ℝ × E → ℝ × E → ℝ × E → ℝ × E →L[ℝ] ℝ} + {T4 : ℝ × E → ℝ × E → ℝ × E → ℝ × E → ℝ} {r m K ε₀ ε : ℝ} (hr : 0 < r) (hK : 0 ≤ K) + (hε : 0 ≤ ε) (hεε : ε ≤ ε₀) + (hT : ∀ p ∈ Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r), ∀ (s₁ s₂ s₃ : ℝ) (y₁ y₂ y₃ : E), + |T3 p (s₁, y₁) (s₂, y₂) (s₃, y₃) - s₁ * s₂ * s₃ * T3 p (1, 0) (1, 0) (1, 0)| ≤ + m * ((|s₁| + ‖y₁‖) * (|s₂| + ‖y₂‖) * (|s₃| + ‖y₃‖) - |s₁| * |s₂| * |s₃|)) + (hD4x : ∀ p ∈ Icc (-2 * r - ε₀) (2 * r + ε₀) ×ˢ Metric.closedBall (0 : E) (2 * r), + ∀ a b c : ℝ × E, HasDerivAt (fun t => T3 (t, p.2) a b c) (T4 p a b c) p.1) + (hT4 : ∀ p ∈ Icc (-2 * r - ε₀) (2 * r + ε₀) ×ˢ Metric.closedBall (0 : E) (2 * r), + ∀ (s₁ s₂ s₃ : ℝ) (y₁ y₂ y₃ : E), + |T4 p (s₁, y₁) (s₂, y₂) (s₃, y₃) - s₁ * s₂ * s₃ * T4 p (1, 0) (1, 0) (1, 0)| ≤ + K * ((|s₁| + ‖y₁‖) * (|s₂| + ‖y₂‖) * (|s₃| + ‖y₃‖) - |s₁| * |s₂| * |s₃|)) : + ∀ p ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r), + ∀ (s₁ s₂ s₃ : ℝ) (y₁ y₂ y₃ : E), + |T3 p (s₁, y₁) (s₂, y₂) (s₃, y₃) - s₁ * s₂ * s₃ * T3 p (1, 0) (1, 0) (1, 0)| ≤ + (m + K * ε) * ((|s₁| + ‖y₁‖) * (|s₂| + ‖y₂‖) * (|s₃| + ‖y₃‖) - |s₁| * |s₂| * |s₃|) := by + rintro ⟨x, y⟩ ⟨hx, hy⟩ s₁ s₂ s₃ y₁ y₂ y₃ + have hX := block_nonneg s₁ s₂ s₃ y₁ y₂ y₃ + set X := (|s₁| + ‖y₁‖) * (|s₂| + ‖y₂‖) * (|s₃| + ‖y₃‖) - |s₁| * |s₂| * |s₃| with hXdef + obtain ⟨x₀, hx₀, hxx₀⟩ : ∃ x₀ ∈ Icc (-2 * r) (2 * r), |x - x₀| ≤ ε := by + by_cases h1 : x ≤ -2 * r + · refine ⟨-2 * r, ⟨le_rfl, ?_⟩, ?_⟩ + · linarith [hx.1] + · rw [abs_le]; constructor <;> linarith [hx.1] + · by_cases h2 : 2 * r ≤ x + · refine ⟨2 * r, ⟨?_, le_rfl⟩, ?_⟩ + · linarith + · rw [abs_le]; constructor <;> linarith [hx.2] + · exact ⟨x, ⟨by linarith, by linarith⟩, by simp [hε]⟩ + set g : ℝ → ℝ := fun t => T3 (t, y) (s₁, y₁) (s₂, y₂) (s₃, y₃) - + s₁ * s₂ * s₃ * T3 (t, y) (1, 0) (1, 0) (1, 0) with hg + have hderiv : ∀ t ∈ Icc (-2 * r - ε₀) (2 * r + ε₀), HasDerivWithinAt g + (T4 (t, y) (s₁, y₁) (s₂, y₂) (s₃, y₃) - s₁ * s₂ * s₃ * T4 (t, y) (1, 0) (1, 0) (1, 0)) + (Icc (-2 * r - ε₀) (2 * r + ε₀)) t := by + intro t ht + have hp : (t, y) ∈ Icc (-2 * r - ε₀) (2 * r + ε₀) ×ˢ Metric.closedBall (0 : E) (2 * r) := ⟨ht, hy⟩ + have h1 : HasDerivAt (fun t => T3 (t, y) (s₁, y₁) (s₂, y₂) (s₃, y₃)) + (T4 (t, y) (s₁, y₁) (s₂, y₂) (s₃, y₃)) t := hD4x _ hp _ _ _ + have h2 : HasDerivAt (fun t => T3 (t, y) (1, 0) (1, 0) (1, 0)) (T4 (t, y) (1, 0) (1, 0) (1, 0)) t := + hD4x _ hp _ _ _ + exact (h1.sub (h2.const_mul (s₁ * s₂ * s₃))).hasDerivWithinAt + have hbound : ∀ t ∈ Icc (-2 * r - ε₀) (2 * r + ε₀), + ‖T4 (t, y) (s₁, y₁) (s₂, y₂) (s₃, y₃) - s₁ * s₂ * s₃ * T4 (t, y) (1, 0) (1, 0) (1, 0)‖ ≤ K * X := + fun t ht => by rw [Real.norm_eq_abs]; exact hT4 (t, y) ⟨ht, hy⟩ _ _ _ _ _ _ + have hxS : x ∈ Icc (-2 * r - ε₀) (2 * r + ε₀) := ⟨by linarith [hx.1], by linarith [hx.2]⟩ + have hx₀S : x₀ ∈ Icc (-2 * r - ε₀) (2 * r + ε₀) := + ⟨by linarith [hx₀.1, hε, hεε], by linarith [hx₀.2, hε, hεε]⟩ + have hmvt := (convex_Icc (-2 * r - ε₀) (2 * r + ε₀)).norm_image_sub_le_of_norm_hasDerivWithin_le + hderiv hbound hx₀S hxS + rw [Real.norm_eq_abs, Real.norm_eq_abs] at hmvt + have h0 : |g x₀| ≤ m * X := hT (x₀, y) ⟨hx₀, hy⟩ s₁ s₂ s₃ y₁ y₂ y₃ + have hKX : 0 ≤ K * X := mul_nonneg hK hX + have h3 : K * X * |x - x₀| ≤ K * X * ε := mul_le_mul_of_nonneg_left hxx₀ hKX + have h4 := abs_sub_abs_le_abs_sub (g x) (g x₀) + show |g x| ≤ (m + K * ε) * X + nlinarith + +/-- **The cap from the block bound alone.** `ridge_capHyp_C4` with its six derivative-bound +hypotheses derived. `hHxb`, `hHrb`, `hwcv` and `hwcc` come from the block bound `hT` +(`hessian_x_bound`, `hessian_r_bound`, `axis_convexConcave`). `hG0cv` and `hG0cc` come from +`|f_xxx| ≤ m` on the pin segment (`hTe`, SP: `|f_xxx| ≤ M₃`). The conclusion is unchanged. -/ +theorem ridge_capHyp_C5 [FiniteDimensional ℝ E] {f : ℝ × E → ℝ} + {Df : ℝ × E → ℝ × E →L[ℝ] ℝ} {D2f : ℝ × E → ℝ × E →L[ℝ] ℝ × E →L[ℝ] ℝ} + {T3 : ℝ × E → ℝ × E → ℝ × E → ℝ × E →L[ℝ] ℝ} {Φ4 : ℝ × E → ℝ × E →L[ℝ] ℝ} {n : ℝ} + {DG : ℝ × E → ℝ × E →L[ℝ] E →L[ℝ] ℝ} + {H : ℝ × E → E →L[ℝ] E →L[ℝ] ℝ} {Hx : ℝ → E →L[ℝ] E →L[ℝ] ℝ} + {Hr : ℝ × E → ℝ → E →L[ℝ] E →L[ℝ] ℝ} {r m lam ε : ℝ} (hr : 0 < r) (hε : 0 < ε) + (hεr : ε ≤ r / 2) + (hDf : ∀ p ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r), HasFDerivAt f (Df p) p) + (hD2 : ∀ p ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r), HasFDerivAt Df (D2f p) p) + (hD3 : ∀ p ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r), ∀ a b : ℝ × E, HasFDerivAt (fun q => D2f q a b) (T3 p a b) p) + (hT : ∀ p ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r), ∀ (s₁ s₂ s₃ : ℝ) (y₁ y₂ y₃ : E), + |T3 p (s₁, y₁) (s₂, y₂) (s₃, y₃) - s₁ * s₂ * s₃ * T3 p (1, 0) (1, 0) (1, 0)| ≤ + m * ((|s₁| + ‖y₁‖) * (|s₂| + ‖y₂‖) * (|s₃| + ‖y₃‖) - |s₁| * |s₂| * |s₃|)) + (hTe : ∀ x ∈ Icc (-r / 2) (r / 2), |T3 (x, 0) (1, 0) (1, 0) (1, 0)| ≤ m) + (hD4 : ∀ p ∈ Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r), + HasFDerivAt (fun q => T3 q (1, 0) (1, 0) (1, 0)) (Φ4 p) p) + (hn4x : ∀ p ∈ Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r), |Φ4 p (1, 0)| ≤ n) + (hn4y : ∀ p ∈ Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r), ‖(Φ4 p).comp (ContinuousLinearMap.inr ℝ ℝ E)‖ ≤ n) + (hH2 : r * n ≤ 1 / 20) + (hGs : ∀ p ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r), + HasStrictFDerivAt (fun q => (Df q).comp (ContinuousLinearMap.inr ℝ ℝ E)) (DG p) p) + (hH : ∀ p ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r), + HasFDerivAt (fun y => (Df (p.1, y)).comp (ContinuousLinearMap.inr ℝ ℝ E)) (H p) p.2) + (hHx : ∀ x ∈ Icc (-2 * r - ε) (2 * r + ε), HasDerivAt (fun t => H (t, 0)) (Hx x) x) + (hHr : ∀ p ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r), + ∀ s ∈ Icc (0 : ℝ) 1, HasDerivAt (fun s : ℝ => H (p.1, s • p.2)) (Hr p s) s) + (hlam : ∀ v : E, H (-r / 2, 0) v v ≤ -lam * ‖v‖ ^ 2) (hH1 : 8 * r * m ^ 2 < lam) + (hM : Df (-r / 2, 0) = 0) (hS : Df (r / 2, 0) = 0) + (hnorm : f (-r / 2, 0) - f (r / 2, 0) = r ^ 3 / 6) : + (∃ h : ℝ → E, ∀ x ∈ Ioo (-2 * r - ε) (2 * r + ε), h x ∈ Metric.ball (0 : E) (2 * r) ∧ + HasFDerivAt (fun y => f (x, y)) (0 : E →L[ℝ] ℝ) (h x)) ∧ + ∀ h : ℝ → E, (∀ x ∈ Ioo (-2 * r - ε) (2 * r + ε), + h x ∈ Metric.closedBall (0 : E) (2 * r) ∧ + HasFDerivAt (fun y => f (x, y)) (0 : E →L[ℝ] ℝ) (h x)) → + h (-r / 2) = 0 ∧ h (r / 2) = 0 ∧ + CapHyp f (Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r)) (-r / 2, 0) + (2 * r, h (2 * r)) (f (-r / 2, 0)) (f (r / 2, 0)) ∧ + ∀ x ∈ frontier (Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r)), + x ≠ (r / 2, 0) → f x < f (r / 2, 0) := by + have hm0 : 0 ≤ m := (abs_nonneg _).trans (hTe 0 ⟨by linarith, by linarith⟩) + have h0Y : (0 : E) ∈ Metric.closedBall (0 : E) (2 * r) := Metric.mem_closedBall_self (by positivity) + have hax : ∀ t ∈ Icc (-2 * r - ε) (2 * r + ε), + (t, (0 : E)) ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r) := + fun t ht => ⟨ht, h0Y⟩ + have hpin : ∀ t ∈ Icc (-r / 2) (r / 2), + (t, (0 : E)) ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r) := + fun t ht => hax t ⟨by linarith [ht.1], by linarith [ht.2]⟩ + -- `∂_x D_y² f` + have hHxb : ∀ x ∈ Icc (-2 * r - ε) (2 * r + ε), ‖Hx x‖ ≤ m := by + intro x hx + refine hessian_x_bound (J := Icc (-2 * r - ε) (2 * r + ε)) + (uniqueDiffOn_Icc (by linarith) x hx) hx hm0 (fun t ht => hH _ (hax t ht)) + (fun t ht => hD2 _ (hax t ht)) (hD3 _ (hax x hx)) (fun v w => ?_) (hHx x hx) + have := hT _ (hax x hx) 0 0 1 v w 0 + simpa using this + -- `∂_ρ D_y² f` + have hHrb : ∀ p ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r), + ∀ s ∈ Icc (0 : ℝ) 1, ‖Hr p s‖ ≤ m * ‖p.2‖ := by + rintro ⟨x, y⟩ hp s hs + have hyb : ‖y‖ ≤ 2 * r := by simpa [Metric.mem_closedBall, dist_zero_right] using hp.2 + have hseg : ∀ τ ∈ Icc (0 : ℝ) 1, + (x, τ • y) ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r) := by + intro τ hτ + refine ⟨hp.1, ?_⟩ + rw [Metric.mem_closedBall, dist_zero_right, norm_smul, Real.norm_eq_abs, abs_of_nonneg hτ.1] + nlinarith [hτ.2, norm_nonneg y] + refine hessian_r_bound hm0 hs (fun τ hτ => hH _ (hseg τ hτ)) (fun τ hτ => hD2 _ (hseg τ hτ)) + (hD3 _ (hseg s hs)) (fun v w => ?_) (hHr _ hp s hs) + have := hT _ (hseg s hs) 0 0 0 v w y + simpa using this + -- `w = ∂_y f (·, 0)` and `G0 = ∂_x f (·, 0)` + have hw : ∀ v : E, ConvexOn ℝ (Icc (-2 * r - ε) (2 * r + ε)) + (fun t => Df (t, 0) (0, v) + m * ‖v‖ / 2 * t ^ 2) ∧ + ConcaveOn ℝ (Icc (-2 * r - ε) (2 * r + ε)) (fun t => Df (t, 0) (0, v) - m * ‖v‖ / 2 * t ^ 2) := + fun v => axis_convexConcave (fun t ht => hD2 _ (hax t ht)) + (fun t ht => hD3 _ (hax t ht) (1, 0) (0, v)) + (fun t ht => by have := hT _ (hax t ht) 1 0 1 0 v 0; simpa using this) + have hG0 := axis_convexConcave (u := ((1 : ℝ), (0 : E))) (fun t ht => hD2 _ (hpin t ht)) + (fun t ht => hD3 _ (hpin t ht) (1, 0) (1, 0)) hTe + exact ridge_capHyp_C4 hr hε hεr hDf hD2 hD3 hT hD4 hn4x hn4y hH2 hGs hH hHx hHxb hHr hHrb hlam + hH1 hM hS hG0.1 hG0.2 (fun v => (hw v).1) (fun v => (hw v).2) hnorm + +/-- **The cap from SP's bounds on `D` (the continuity step of I3).** The quantitative hypotheses are +assumed on SP's `D` only: +- the block bound `m` and `|f_xxx| ≤ m` on the pin segment; +- SP's `M₄` blocks `n`; +- (H1) and (H2). + +On a collar of some width `ε₀ > 0`, only qualitative data are assumed: the derivatives, the strict +derivative of `∂_y f`, and some bound `K ≥ 0` on the `x`-derivative of `T3` in block form (SP: +`f ∈ C⁴` near `D`). Because (H1) is strict, some `ε ∈ (0, ε₀]` keeps `8r(m + Kε)² < λ`. +`ridge_capHyp_C5` then applies with `m + Kε` (`block_bound_collar`). -/ +theorem ridge_capHyp_D [FiniteDimensional ℝ E] {f : ℝ × E → ℝ} + {Df : ℝ × E → ℝ × E →L[ℝ] ℝ} {D2f : ℝ × E → ℝ × E →L[ℝ] ℝ × E →L[ℝ] ℝ} + {T3 : ℝ × E → ℝ × E → ℝ × E → ℝ × E →L[ℝ] ℝ} {T4 : ℝ × E → ℝ × E → ℝ × E → ℝ × E → ℝ} + {Φ4 : ℝ × E → ℝ × E →L[ℝ] ℝ} {n : ℝ} + {DG : ℝ × E → ℝ × E →L[ℝ] E →L[ℝ] ℝ} + {H : ℝ × E → E →L[ℝ] E →L[ℝ] ℝ} {Hx : ℝ → E →L[ℝ] E →L[ℝ] ℝ} + {Hr : ℝ × E → ℝ → E →L[ℝ] E →L[ℝ] ℝ} {r m K lam ε₀ : ℝ} (hr : 0 < r) (hε₀ : 0 < ε₀) + (hK : 0 ≤ K) + (hDf : ∀ p ∈ Icc (-2 * r - ε₀) (2 * r + ε₀) ×ˢ Metric.closedBall (0 : E) (2 * r), HasFDerivAt f (Df p) p) + (hD2 : ∀ p ∈ Icc (-2 * r - ε₀) (2 * r + ε₀) ×ˢ Metric.closedBall (0 : E) (2 * r), HasFDerivAt Df (D2f p) p) + (hD3 : ∀ p ∈ Icc (-2 * r - ε₀) (2 * r + ε₀) ×ˢ Metric.closedBall (0 : E) (2 * r), ∀ a b : ℝ × E, + HasFDerivAt (fun q => D2f q a b) (T3 p a b) p) + (hD4x : ∀ p ∈ Icc (-2 * r - ε₀) (2 * r + ε₀) ×ˢ Metric.closedBall (0 : E) (2 * r), + ∀ a b c : ℝ × E, HasDerivAt (fun t => T3 (t, p.2) a b c) (T4 p a b c) p.1) + (hT4 : ∀ p ∈ Icc (-2 * r - ε₀) (2 * r + ε₀) ×ˢ Metric.closedBall (0 : E) (2 * r), + ∀ (s₁ s₂ s₃ : ℝ) (y₁ y₂ y₃ : E), + |T4 p (s₁, y₁) (s₂, y₂) (s₃, y₃) - s₁ * s₂ * s₃ * T4 p (1, 0) (1, 0) (1, 0)| ≤ + K * ((|s₁| + ‖y₁‖) * (|s₂| + ‖y₂‖) * (|s₃| + ‖y₃‖) - |s₁| * |s₂| * |s₃|)) + (hT : ∀ p ∈ Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r), ∀ (s₁ s₂ s₃ : ℝ) (y₁ y₂ y₃ : E), + |T3 p (s₁, y₁) (s₂, y₂) (s₃, y₃) - s₁ * s₂ * s₃ * T3 p (1, 0) (1, 0) (1, 0)| ≤ + m * ((|s₁| + ‖y₁‖) * (|s₂| + ‖y₂‖) * (|s₃| + ‖y₃‖) - |s₁| * |s₂| * |s₃|)) + (hTe : ∀ x ∈ Icc (-r / 2) (r / 2), |T3 (x, 0) (1, 0) (1, 0) (1, 0)| ≤ m) + (hD4 : ∀ p ∈ Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r), + HasFDerivAt (fun q => T3 q (1, 0) (1, 0) (1, 0)) (Φ4 p) p) + (hn4x : ∀ p ∈ Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r), |Φ4 p (1, 0)| ≤ n) + (hn4y : ∀ p ∈ Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r), ‖(Φ4 p).comp (ContinuousLinearMap.inr ℝ ℝ E)‖ ≤ n) + (hH2 : r * n ≤ 1 / 20) + (hGs : ∀ p ∈ Icc (-2 * r - ε₀) (2 * r + ε₀) ×ˢ Metric.closedBall (0 : E) (2 * r), + HasStrictFDerivAt (fun q => (Df q).comp (ContinuousLinearMap.inr ℝ ℝ E)) (DG p) p) + (hH : ∀ p ∈ Icc (-2 * r - ε₀) (2 * r + ε₀) ×ˢ Metric.closedBall (0 : E) (2 * r), + HasFDerivAt (fun y => (Df (p.1, y)).comp (ContinuousLinearMap.inr ℝ ℝ E)) (H p) p.2) + (hHx : ∀ x ∈ Icc (-2 * r - ε₀) (2 * r + ε₀), HasDerivAt (fun t => H (t, 0)) (Hx x) x) + (hHr : ∀ p ∈ Icc (-2 * r - ε₀) (2 * r + ε₀) ×ˢ Metric.closedBall (0 : E) (2 * r), + ∀ s ∈ Icc (0 : ℝ) 1, HasDerivAt (fun s : ℝ => H (p.1, s • p.2)) (Hr p s) s) + (hlam : ∀ v : E, H (-r / 2, 0) v v ≤ -lam * ‖v‖ ^ 2) (hH1 : 8 * r * m ^ 2 < lam) + (hM : Df (-r / 2, 0) = 0) (hS : Df (r / 2, 0) = 0) + (hnorm : f (-r / 2, 0) - f (r / 2, 0) = r ^ 3 / 6) : + ∃ ε, 0 < ε ∧ ε ≤ ε₀ ∧ + (∃ h : ℝ → E, ∀ x ∈ Ioo (-2 * r - ε) (2 * r + ε), h x ∈ Metric.ball (0 : E) (2 * r) ∧ + HasFDerivAt (fun y => f (x, y)) (0 : E →L[ℝ] ℝ) (h x)) ∧ + ∀ h : ℝ → E, (∀ x ∈ Ioo (-2 * r - ε) (2 * r + ε), + h x ∈ Metric.closedBall (0 : E) (2 * r) ∧ + HasFDerivAt (fun y => f (x, y)) (0 : E →L[ℝ] ℝ) (h x)) → + h (-r / 2) = 0 ∧ h (r / 2) = 0 ∧ + CapHyp f (Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r)) (-r / 2, 0) + (2 * r, h (2 * r)) (f (-r / 2, 0)) (f (r / 2, 0)) ∧ + ∀ x ∈ frontier (Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r)), + x ≠ (r / 2, 0) → f x < f (r / 2, 0) := by + have hev : ∀ᶠ ε in 𝓝[>] (0 : ℝ), 0 < ε ∧ ε ≤ ε₀ ∧ ε ≤ r / 2 ∧ 8 * r * (m + K * ε) ^ 2 < lam := by + have hc : ContinuousAt (fun ε : ℝ => 8 * r * (m + K * ε) ^ 2) 0 := by fun_prop + have h1 : ∀ᶠ ε in 𝓝 (0 : ℝ), 8 * r * (m + K * ε) ^ 2 < lam := + hc.eventually_lt continuousAt_const (by simpa using hH1) + have h2 : ∀ᶠ ε in 𝓝 (0 : ℝ), ε < ε₀ := eventually_lt_nhds hε₀ + have h3 : ∀ᶠ ε in 𝓝 (0 : ℝ), ε < r / 2 := eventually_lt_nhds (by linarith) + filter_upwards [self_mem_nhdsWithin, nhdsWithin_le_nhds h1, nhdsWithin_le_nhds h2, + nhdsWithin_le_nhds h3] with ε hε h1 h2 h3 + exact ⟨hε, h2.le, h3.le, h1⟩ + obtain ⟨ε, hε, hεε, hεr, hH1'⟩ := hev.exists + have hsub : ∀ p ∈ Icc (-2 * r - ε) (2 * r + ε) ×ˢ Metric.closedBall (0 : E) (2 * r), + p ∈ Icc (-2 * r - ε₀) (2 * r + ε₀) ×ˢ Metric.closedBall (0 : E) (2 * r) := + fun p hp => ⟨⟨by linarith [hp.1.1], by linarith [hp.1.2]⟩, hp.2⟩ + have hsubI : ∀ x ∈ Icc (-2 * r - ε) (2 * r + ε), x ∈ Icc (-2 * r - ε₀) (2 * r + ε₀) := + fun x hx => ⟨by linarith [hx.1], by linarith [hx.2]⟩ + have hmm : m ≤ m + K * ε := le_add_of_nonneg_right (mul_nonneg hK hε.le) + exact ⟨ε, hε, hεε, ridge_capHyp_C5 (m := m + K * ε) hr hε hεr (fun p hp => hDf p (hsub p hp)) + (fun p hp => hD2 p (hsub p hp)) (fun p hp => hD3 p (hsub p hp)) + (block_bound_collar hr hK hε.le hεε hT hD4x hT4) (fun x hx => (hTe x hx).trans hmm) + hD4 hn4x hn4y hH2 (fun p hp => hGs p (hsub p hp)) (fun p hp => hH p (hsub p hp)) + (fun x hx => hHx x (hsubI x hx)) (fun p hp => hHr p (hsub p hp)) hlam hH1' hM hS hnorm⟩ + + +/-! ### SP's `f ∈ C⁴` near `D` supplies the collar data (v2.2) + +`block_of_norm` turns a bound on the norm of a trilinear form into the block bound, and +`collar_subset_open` finds a closed collar inside an open neighbourhood of `D`. `ridge_capHyp_E` +takes `f ∈ C⁴` on an open `U ⊇ D` and SP's quantitative bounds on `D`, written with the iterated +derivatives `iteratedFDeriv ℝ k f`. It builds every derivative datum of `ridge_capHyp_D` from `f`, +and it takes the collar width from `collar_subset_open` and `K` from the continuity of `D⁴f` on the +compact collar. -/ + +/-- **The block bound from the norm.** A trilinear form `B` on `ℝ × E` with `‖B‖ ≤ K` satisfies +the block bound with constant `K`. For `a = (s₁, y₁)`, `b = (s₂, y₂)`, `c = (s₃, y₃)` and +`e = (1, 0)`: +`|B(a, b, c) - s₁s₂s₃ B(e, e, e)| ≤ K((|s₁| + ‖y₁‖)(|s₂| + ‖y₂‖)(|s₃| + ‖y₃‖) - |s₁||s₂||s₃|)`. +Replacing one slot at a time by `sᵢ e` leaves three terms, and each has a transverse argument +`(0, yᵢ)`. -/ +theorem block_of_norm {B : ContinuousMultilinearMap ℝ (fun _ : Fin 3 => ℝ × E) ℝ} {K : ℝ} + (hB : ‖B‖ ≤ K) (s₁ s₂ s₃ : ℝ) (y₁ y₂ y₃ : E) : + |B ![(s₁, y₁), (s₂, y₂), (s₃, y₃)] - s₁ * s₂ * s₃ * B ![(1, 0), (1, 0), (1, 0)]| ≤ + K * ((|s₁| + ‖y₁‖) * (|s₂| + ‖y₂‖) * (|s₃| + ‖y₃‖) - |s₁| * |s₂| * |s₃|) := by + have hK : 0 ≤ K := (norm_nonneg _).trans hB + have hb : ∀ a b c : ℝ × E, |B ![a, b, c]| ≤ K * ‖a‖ * ‖b‖ * ‖c‖ := by + intro a b c + have h := B.le_opNorm ![a, b, c] + simp only [Fin.prod_univ_three, Matrix.cons_val_zero, Matrix.cons_val_one, + Matrix.cons_val_two, Matrix.tail_cons, Matrix.head_cons] at h + rw [← Real.norm_eq_abs] + calc ‖B ![a, b, c]‖ ≤ ‖B‖ * (‖a‖ * ‖b‖ * ‖c‖) := h + _ ≤ K * (‖a‖ * ‖b‖ * ‖c‖) := by gcongr + _ = K * ‖a‖ * ‖b‖ * ‖c‖ := by ring + have h1 : ∀ x x' b c : ℝ × E, B ![x, b, c] - B ![x', b, c] = B ![x - x', b, c] := by + intro x x' b c + have hu : ∀ z, Function.update ![x, b, c] 0 z = ![z, b, c] := fun z => by + funext i; fin_cases i <;> simp + have := B.map_update_sub ![x, b, c] 0 x x' + rw [hu, hu, hu] at this + exact this.symm + have h2 : ∀ a x x' c : ℝ × E, B ![a, x, c] - B ![a, x', c] = B ![a, x - x', c] := by + intro a x x' c + have hu : ∀ z, Function.update ![a, x, c] 1 z = ![a, z, c] := fun z => by + funext i; fin_cases i <;> simp + have := B.map_update_sub ![a, x, c] 1 x x' + rw [hu, hu, hu] at this + exact this.symm + have h3 : ∀ a b x x' : ℝ × E, B ![a, b, x] - B ![a, b, x'] = B ![a, b, x - x'] := by + intro a b x x' + have hu : ∀ z, Function.update ![a, b, x] 2 z = ![a, b, z] := fun z => by + funext i; fin_cases i <;> simp + have := B.map_update_sub ![a, b, x] 2 x x' + rw [hu, hu, hu] at this + exact this.symm + set e : ℝ × E := ((1 : ℝ), (0 : E)) with he_def + have hsm : B ![s₁ • e, s₂ • e, s₃ • e] = s₁ * s₂ * s₃ * B ![e, e, e] := by + have := B.map_smul_univ ![s₁, s₂, s₃] ![e, e, e] + have hv : (fun i => (![s₁, s₂, s₃] : Fin 3 → ℝ) i • (![e, e, e] : Fin 3 → ℝ × E) i) = + ![s₁ • e, s₂ • e, s₃ • e] := by + funext i; fin_cases i <;> simp + rw [hv, Fin.prod_univ_three] at this + simpa [smul_eq_mul, mul_assoc] using this + have hd : ∀ (s : ℝ) (y : E), ((s, y) : ℝ × E) - s • e = ((0 : ℝ), y) := by + intro s y; ext <;> simp [he_def] + have hn : ∀ (s : ℝ) (y : E), ‖((s, y) : ℝ × E)‖ ≤ |s| + ‖y‖ := by + intro s y + rw [Prod.norm_def, Real.norm_eq_abs] + exact max_le_add_of_nonneg (abs_nonneg _) (norm_nonneg _) + have hn0 : ∀ y : E, ‖((0 : ℝ), y)‖ = ‖y‖ := by intro y; simp [Prod.norm_def] + have hne : ∀ s : ℝ, ‖s • e‖ = |s| := by + intro s; rw [norm_smul, Real.norm_eq_abs]; simp [he_def, Prod.norm_def] + have tel : B ![(s₁, y₁), (s₂, y₂), (s₃, y₃)] - s₁ * s₂ * s₃ * B ![e, e, e] = + B ![((0 : ℝ), y₁), (s₂, y₂), (s₃, y₃)] + B ![s₁ • e, ((0 : ℝ), y₂), (s₃, y₃)] + + B ![s₁ • e, s₂ • e, ((0 : ℝ), y₃)] := by + rw [← hsm, ← hd s₁ y₁, ← hd s₂ y₂, ← hd s₃ y₃, ← h1, ← h2, ← h3] + ring + rw [tel] + have k1 : |B ![((0 : ℝ), y₁), (s₂, y₂), (s₃, y₃)]| ≤ + K * ‖y₁‖ * (|s₂| + ‖y₂‖) * (|s₃| + ‖y₃‖) := by + refine (hb _ _ _).trans ?_ + rw [hn0] + gcongr + · exact hn _ _ + · exact hn _ _ + have k2 : |B ![s₁ • e, ((0 : ℝ), y₂), (s₃, y₃)]| ≤ K * |s₁| * ‖y₂‖ * (|s₃| + ‖y₃‖) := by + refine (hb _ _ _).trans ?_ + rw [hn0, hne] + gcongr + exact hn _ _ + have k3 : |B ![s₁ • e, s₂ • e, ((0 : ℝ), y₃)]| ≤ K * |s₁| * |s₂| * ‖y₃‖ := by + refine (hb _ _ _).trans ?_ + rw [hn0, hne, hne] + calc _ ≤ _ := abs_add_three _ _ _ + _ ≤ K * ‖y₁‖ * (|s₂| + ‖y₂‖) * (|s₃| + ‖y₃‖) + K * |s₁| * ‖y₂‖ * (|s₃| + ‖y₃‖) + + K * |s₁| * |s₂| * ‖y₃‖ := by gcongr + _ = _ := by ring + +omit [NormedSpace ℝ E] in +/-- **A collar inside a neighbourhood of `D`.** If an open `U` contains +`D = [-2r, 2r] × B̄(0, 2r)` and `E` is proper, then some closed collar +`[-2r - ε₀, 2r + ε₀] × B̄(0, 2r)` with `ε₀ > 0` lies in `U`: `D` is compact, so a closed +thickening of `D` lies in `U`. -/ +theorem collar_subset_open [ProperSpace E] {U : Set (ℝ × E)} {r : ℝ} (hr : 0 < r) (hU : IsOpen U) + (hDU : Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r) ⊆ U) : + ∃ ε₀ > 0, Icc (-2 * r - ε₀) (2 * r + ε₀) ×ˢ Metric.closedBall (0 : E) (2 * r) ⊆ U := by + obtain ⟨δ, hδ, hsub⟩ := + (isCompact_Icc.prod (isCompact_closedBall (0 : E) (2 * r))).exists_cthickening_subset_open hU hDU + refine ⟨δ, hδ, ?_⟩ + rintro ⟨x, y⟩ ⟨hx, hy⟩ + apply hsub + obtain ⟨x₀, hx₀, hxx₀⟩ : ∃ x₀ ∈ Icc (-2 * r) (2 * r), |x - x₀| ≤ δ := by + by_cases h1 : x ≤ -2 * r + · refine ⟨-2 * r, ⟨le_rfl, ?_⟩, ?_⟩ + · linarith [hx.1] + · rw [abs_le]; constructor <;> linarith [hx.1] + · by_cases h2 : 2 * r ≤ x + · refine ⟨2 * r, ⟨?_, le_rfl⟩, ?_⟩ + · linarith + · rw [abs_le]; constructor <;> linarith [hx.2] + · exact ⟨x, ⟨by linarith, by linarith⟩, by simp [hδ.le]⟩ + refine Metric.mem_cthickening_of_dist_le (x, y) (x₀, y) δ _ ⟨hx₀, hy⟩ ?_ + rw [Prod.dist_eq, dist_self, Real.dist_eq] + exact max_le hxx₀ hδ.le + +/-- **The cap from `f ∈ C⁴` near `D` and SP's bounds on `D` (I3's qualitative part).** Assume +that `f` is `C⁴` on an open `U ⊇ D` (SP: `f ∈ C⁴` near `D`). Assume also SP's quantitative +hypotheses on `D`, written with `D^k f(p)[v₁, …, v_k] = iteratedFDeriv ℝ k f p ![v₁, …, v_k]` and +`e = (1, 0)`: +- the block bound `m` on `D³f`, and `|f_xxx| ≤ m` on the pin segment; +- SP's `M₄` blocks `n`: `|D⁴f[e, e, e, e]| ≤ n` and `|D⁴f[(0, v), e, e, e]| ≤ n‖v‖`; +- (H1): `D²f(M)[(0, v), (0, v)] ≤ -λ‖v‖²` with `8rm² < λ`; and (H2); +- `M = (-r/2, 0)` and `S = (r/2, 0)` are critical, and `f(M) - f(S) = r³/6`. + +Then `ridge_capHyp_D` applies. Its collar width comes from `collar_subset_open`, and its derivative +data are the Fréchet derivatives of `f` (`T3`, `T4` and `Φ4` are slices of `D³f` and `D⁴f`). Its +`K` bounds `‖D⁴f‖` on the compact collar. No derivative datum and no bound off `D` is assumed. -/ +theorem ridge_capHyp_E [FiniteDimensional ℝ E] {f : ℝ × E → ℝ} {U : Set (ℝ × E)} + {r m n lam : ℝ} (hr : 0 < r) (hU : IsOpen U) + (hDU : Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r) ⊆ U) + (hf : ContDiffOn ℝ 4 f U) + (hT : ∀ p ∈ Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r), + ∀ (s₁ s₂ s₃ : ℝ) (y₁ y₂ y₃ : E), + |iteratedFDeriv ℝ 3 f p ![(s₁, y₁), (s₂, y₂), (s₃, y₃)] - + s₁ * s₂ * s₃ * iteratedFDeriv ℝ 3 f p ![(1, 0), (1, 0), (1, 0)]| ≤ + m * ((|s₁| + ‖y₁‖) * (|s₂| + ‖y₂‖) * (|s₃| + ‖y₃‖) - |s₁| * |s₂| * |s₃|)) + (hTe : ∀ x ∈ Icc (-r / 2) (r / 2), |iteratedFDeriv ℝ 3 f (x, 0) ![(1, 0), (1, 0), (1, 0)]| ≤ m) + (hn4x : ∀ p ∈ Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r), + |iteratedFDeriv ℝ 4 f p ![(1, 0), (1, 0), (1, 0), (1, 0)]| ≤ n) + (hn4y : ∀ p ∈ Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r), ∀ v : E, + |iteratedFDeriv ℝ 4 f p ![(0, v), (1, 0), (1, 0), (1, 0)]| ≤ n * ‖v‖) + (hH2 : r * n ≤ 1 / 20) + (hlam : ∀ v : E, iteratedFDeriv ℝ 2 f (-r / 2, 0) ![(0, v), (0, v)] ≤ -lam * ‖v‖ ^ 2) + (hH1 : 8 * r * m ^ 2 < lam) + (hM : fderiv ℝ f (-r / 2, 0) = 0) (hS : fderiv ℝ f (r / 2, 0) = 0) + (hnorm : f (-r / 2, 0) - f (r / 2, 0) = r ^ 3 / 6) : + ∃ ε, 0 < ε ∧ + (∃ h : ℝ → E, ∀ x ∈ Ioo (-2 * r - ε) (2 * r + ε), h x ∈ Metric.ball (0 : E) (2 * r) ∧ + HasFDerivAt (fun y => f (x, y)) (0 : E →L[ℝ] ℝ) (h x)) ∧ + ∀ h : ℝ → E, (∀ x ∈ Ioo (-2 * r - ε) (2 * r + ε), + h x ∈ Metric.closedBall (0 : E) (2 * r) ∧ + HasFDerivAt (fun y => f (x, y)) (0 : E →L[ℝ] ℝ) (h x)) → + h (-r / 2) = 0 ∧ h (r / 2) = 0 ∧ + CapHyp f (Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r)) (-r / 2, 0) + (2 * r, h (2 * r)) (f (-r / 2, 0)) (f (r / 2, 0)) ∧ + ∀ x ∈ frontier (Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r)), + x ≠ (r / 2, 0) → f x < f (r / 2, 0) := by + obtain ⟨ε₀, hε₀, hcU⟩ := collar_subset_open hr hU hDU + have hcpt : IsCompact (Icc (-2 * r - ε₀) (2 * r + ε₀) ×ˢ Metric.closedBall (0 : E) (2 * r)) := + isCompact_Icc.prod (isCompact_closedBall _ _) + -- regularity of the derivatives on `U` + have hf1 : ContDiffOn ℝ 3 (fderiv ℝ f) U := hf.fderiv_of_isOpen hU (by norm_num) + have hf2 : ContDiffOn ℝ 2 (fderiv ℝ (fderiv ℝ f)) U := hf1.fderiv_of_isOpen hU (by norm_num) + have dDf : ∀ p ∈ U, HasFDerivAt f (fderiv ℝ f p) p := fun p hp => + ((hf.differentiableOn (by norm_num)).differentiableAt (hU.mem_nhds hp)).hasFDerivAt + have dD2 : ∀ p ∈ U, HasFDerivAt (fderiv ℝ f) (fderiv ℝ (fderiv ℝ f) p) p := fun p hp => + ((hf1.differentiableOn (by norm_num)).differentiableAt (hU.mem_nhds hp)).hasFDerivAt + have dD3 : ∀ p ∈ U, HasFDerivAt (fderiv ℝ (fderiv ℝ f)) (fderiv ℝ (fderiv ℝ (fderiv ℝ f)) p) p := + fun p hp => ((hf2.differentiableOn (by norm_num)).differentiableAt (hU.mem_nhds hp)).hasFDerivAt + have sD2 : ∀ p ∈ U, HasStrictFDerivAt (fderiv ℝ f) (fderiv ℝ (fderiv ℝ f) p) p := fun p hp => + (hf1.contDiffAt (hU.mem_nhds hp)).hasStrictFDerivAt (by norm_num) + have dI2 : ∀ p ∈ U, HasFDerivAt (iteratedFDeriv ℝ 2 f) (fderiv ℝ (iteratedFDeriv ℝ 2 f) p) p := + fun p hp => ((hf.contDiffAt (hU.mem_nhds hp)).differentiableAt_iteratedFDeriv + (by norm_num)).hasFDerivAt + have dI3 : ∀ p ∈ U, HasFDerivAt (iteratedFDeriv ℝ 3 f) (fderiv ℝ (iteratedFDeriv ℝ 3 f) p) p := + fun p hp => ((hf.contDiffAt (hU.mem_nhds hp)).differentiableAt_iteratedFDeriv + (by norm_num)).hasFDerivAt + have hc4 : ContinuousOn (iteratedFDeriv ℝ 4 f) U := + (hf.continuousOn_iteratedFDerivWithin le_rfl hU.uniqueDiffOn).congr + (fun x hx => (iteratedFDerivWithin_of_isOpen 4 hU hx).symm) + -- the bound `K` on `D⁴f` over the compact collar + obtain ⟨C, hC⟩ := hcpt.exists_bound_of_continuousOn (hc4.mono hcU) + have hD2 : ∀ (p : ℝ × E) (a b : ℝ × E), + fderiv ℝ (fderiv ℝ f) p a b = iteratedFDeriv ℝ 2 f p ![a, b] := by + intro p a b; rw [iteratedFDeriv_two_apply]; rfl + have he : ‖((1 : ℝ), (0 : E))‖ = 1 := by simp [Prod.norm_def] + have hpath : ∀ (x : ℝ) (y : E), HasDerivAt (fun t : ℝ => ((t, y) : ℝ × E)) ((1 : ℝ), (0 : E)) x := + fun x y => (hasDerivAt_id x).prodMk (hasDerivAt_const x y) + set Ψ : ((ℝ × E) →L[ℝ] ℝ) →L[ℝ] (E →L[ℝ] ℝ) := + ContinuousLinearMap.precomp ℝ (ContinuousLinearMap.inr ℝ ℝ E) with hΨ + set Ξ : ((ℝ × E) →L[ℝ] (ℝ × E) →L[ℝ] ℝ) →L[ℝ] (E →L[ℝ] E →L[ℝ] ℝ) := + (ContinuousLinearMap.postcomp E Ψ).comp + (ContinuousLinearMap.precomp ((ℝ × E) →L[ℝ] ℝ) (ContinuousLinearMap.inr ℝ ℝ E)) with hΞ + have hn0 : 0 ≤ n := (abs_nonneg _).trans (hn4x (0, 0) ⟨⟨by linarith, by linarith⟩, by + simp only [Metric.mem_closedBall, dist_self]; linarith⟩) + have key := ridge_capHyp_D (E := E) (f := f) (Df := fderiv ℝ f) (D2f := fderiv ℝ (fderiv ℝ f)) + (T3 := fun p a b => (ContinuousMultilinearMap.apply ℝ (fun _ : Fin 2 => ℝ × E) ℝ ![a, b]).comp + (fderiv ℝ (iteratedFDeriv ℝ 2 f) p)) + (T4 := fun p a b c => iteratedFDeriv ℝ 4 f p ![(1, 0), c, a, b]) + (Φ4 := fun p => (ContinuousMultilinearMap.apply ℝ (fun _ : Fin 3 => ℝ × E) ℝ + ![(1, 0), (1, 0), (1, 0)]).comp (fderiv ℝ (iteratedFDeriv ℝ 3 f) p)) (n := n) + (DG := fun p => Ψ.comp (fderiv ℝ (fderiv ℝ f) p)) + (H := fun p => Ξ (fderiv ℝ (fderiv ℝ f) p)) + (Hx := fun x => Ξ (fderiv ℝ (fderiv ℝ (fderiv ℝ f)) (x, 0) (1, 0))) + (Hr := fun p s => Ξ (fderiv ℝ (fderiv ℝ (fderiv ℝ f)) (p.1, s • p.2) (0, p.2))) + (r := r) (m := m) (K := max C 0) (lam := lam) (ε₀ := ε₀) hr hε₀ (le_max_right _ _) + (fun p hp => dDf p (hcU hp)) (fun p hp => dD2 p (hcU hp)) + (fun p hp a b => by + have h := (ContinuousMultilinearMap.apply ℝ (fun _ : Fin 2 => ℝ × E) ℝ ![a, b]).hasFDerivAt.comp + p (dI2 p (hcU hp)) + have hfun : (fun q => fderiv ℝ (fderiv ℝ f) q a b) = + (ContinuousMultilinearMap.apply ℝ (fun _ : Fin 2 => ℝ × E) ℝ ![a, b]) ∘ + iteratedFDeriv ℝ 2 f := funext fun q => hD2 q a b + rw [hfun]; exact h) + (fun p hp a b c => by + have h := (ContinuousMultilinearMap.apply ℝ (fun _ : Fin 3 => ℝ × E) ℝ ![c, a, b]).hasFDerivAt.comp_hasDerivAt + p.1 ((dI3 (p.1, p.2) (hcU hp)).comp_hasDerivAt p.1 (hpath p.1 p.2)) + exact h) + (fun p hp s₁ s₂ s₃ y₁ y₂ y₃ => by + have hB : ‖(iteratedFDeriv ℝ 4 f p).curryLeft ((1 : ℝ), (0 : E))‖ ≤ max C 0 := by + refine ((iteratedFDeriv ℝ 4 f p).curryLeft.le_opNorm _).trans ?_ + rw [ContinuousMultilinearMap.curryLeft_norm, he, mul_one] + exact (hC p hp).trans (le_max_left _ _) + have h := block_of_norm hB s₃ s₁ s₂ y₃ y₁ y₂ + show |iteratedFDeriv ℝ 4 f p ![(1, 0), (s₃, y₃), (s₁, y₁), (s₂, y₂)] - + s₁ * s₂ * s₃ * iteratedFDeriv ℝ 4 f p ![(1, 0), (1, 0), (1, 0), (1, 0)]| ≤ _ + rw [show s₁ * s₂ * s₃ = s₃ * s₁ * s₂ by ring] + refine h.trans (le_of_eq ?_) + ring) + (fun p hp s₁ s₂ s₃ y₁ y₂ y₃ => by + have h := hT p hp s₃ s₁ s₂ y₃ y₁ y₂ + show |iteratedFDeriv ℝ 3 f p ![(s₃, y₃), (s₁, y₁), (s₂, y₂)] - + s₁ * s₂ * s₃ * iteratedFDeriv ℝ 3 f p ![(1, 0), (1, 0), (1, 0)]| ≤ _ + rw [show s₁ * s₂ * s₃ = s₃ * s₁ * s₂ by ring] + refine h.trans (le_of_eq ?_) + ring) + (fun x hx => hTe x hx) + (fun p hp => (ContinuousMultilinearMap.apply ℝ (fun _ : Fin 3 => ℝ × E) ℝ + ![(1, 0), (1, 0), (1, 0)]).hasFDerivAt.comp p (dI3 p (hDU hp))) + (fun p hp => hn4x p hp) + (fun p hp => ContinuousLinearMap.opNorm_le_bound _ hn0 fun v => by + rw [Real.norm_eq_abs]; exact hn4y p hp v) + hH2 + (fun p hp => Ψ.hasStrictFDerivAt.comp p (sD2 p (hcU hp))) + (fun p hp => Ψ.hasFDerivAt.comp p.2 ((dD2 (p.1, p.2) (hcU hp)).comp p.2 + (hasFDerivAt_prodMk_right p.1 p.2))) + (fun x hx => by + have hx' : ((x, 0) : ℝ × E) ∈ U := hcU ⟨hx, by + simp only [Metric.mem_closedBall, dist_self]; linarith⟩ + have hΞ : HasFDerivAt Ξ Ξ (fderiv ℝ (fderiv ℝ f) (x, 0)) := + ContinuousLinearMap.hasFDerivAt (E := (ℝ × E) →L[ℝ] (ℝ × E) →L[ℝ] ℝ) + (F := E →L[ℝ] E →L[ℝ] ℝ) _ + exact HasFDerivAt.comp_hasDerivAt (l := Ξ) + (f := fun t => fderiv ℝ (fderiv ℝ f) (t, 0)) x hΞ (HasFDerivAt.comp_hasDerivAt + (l := fderiv ℝ (fderiv ℝ f)) (f := fun t : ℝ => ((t, (0 : E)) : ℝ × E)) x (dD3 (x, 0) hx') + (hpath x 0))) + (fun p hp s hs => by + have hmem : ((p.1, s • p.2) : ℝ × E) ∈ U := hcU ⟨hp.1, by + have := hp.2 + rw [Metric.mem_closedBall, dist_zero_right] at this ⊢ + rw [norm_smul, Real.norm_eq_abs, abs_of_nonneg hs.1] + nlinarith [hs.2, norm_nonneg p.2]⟩ + have hp' : HasDerivAt (fun s : ℝ => ((p.1, s • p.2) : ℝ × E)) ((0 : ℝ), p.2) s := by + have := (hasDerivAt_const s p.1).prodMk ((hasDerivAt_id s).smul_const p.2) + simpa using this + have hΞ : HasFDerivAt Ξ Ξ (fderiv ℝ (fderiv ℝ f) (p.1, s • p.2)) := + ContinuousLinearMap.hasFDerivAt (E := (ℝ × E) →L[ℝ] (ℝ × E) →L[ℝ] ℝ) + (F := E →L[ℝ] E →L[ℝ] ℝ) _ + exact HasFDerivAt.comp_hasDerivAt (l := Ξ) + (f := fun s => fderiv ℝ (fderiv ℝ f) (p.1, s • p.2)) s hΞ (HasFDerivAt.comp_hasDerivAt + (l := fderiv ℝ (fderiv ℝ f)) (f := fun s : ℝ => ((p.1, s • p.2) : ℝ × E)) s (dD3 _ hmem) hp')) + (fun v => by + have h := hlam v + rw [← hD2] at h + exact h) + hH1 hM hS hnorm + obtain ⟨ε, hε, -, hrest⟩ := key + exact ⟨ε, hε, hrest⟩ + +end Slice + +/-! ### A concrete instance and the necessity of each hypothesis + +On `ℝ`, `toyF x = max (-|x|) (x - 2)` has a local maximum `M = 0` at height `b = 0`, a +separating local minimum `S = 1` at height `s = -1`, and an older point `z = 3` at height `1`. +The cap is `[-2, 1]`. The instance shows that `CapHyp` is satisfiable (the theorems are not +vacuous), and the three counterexamples show that dropping (C1), (C2) or (C3) breaks the +maximin conclusion. -/ + +/-- The toy height function. -/ +noncomputable def toyF (x : ℝ) : ℝ := max (-|x|) (x - 2) + +/-- The toy ridge, `t ↦ 3t` from `0` to `3`. -/ +def toyRidge : Path (0 : ℝ) 3 where + toFun t := 3 * (t : ℝ) + continuous_toFun := continuous_const.mul continuous_subtype_val + source' := by simp + target' := by simp + +theorem toy_ridge_ge (t : I) : (-1 : ℝ) ≤ toyF (toyRidge t) := by + have ht0 : (0 : ℝ) ≤ t := t.2.1 + show -1 ≤ max (-|3 * (t : ℝ)|) (3 * (t : ℝ) - 2) + rcases le_or_gt (3 * (t : ℝ)) 1 with h | h + · refine le_max_of_le_left ?_ + rw [abs_of_nonneg (by linarith)] + linarith + · exact le_max_of_le_right (by linarith) + +theorem toy_frontier : frontier (Icc (-2 : ℝ) 1) = {-2, 1} := frontier_Icc (by norm_num) + +/-- The toy satisfies (C1)–(C3) with `C = [-2, 1]`, `M = 0`, `z = 3`, `b = 0`, `s = -1`. -/ +theorem toy_capHyp : CapHyp toyF (Icc (-2 : ℝ) 1) 0 3 0 (-1) where + mem := ⟨by norm_num, by norm_num⟩ + ceiling x hx := by + obtain ⟨_, hx2⟩ := hx + show max (-|x|) (x - 2) ≤ 0 + exact max_le (by linarith [abs_nonneg x]) (by linarith) + frontier_le x hx := by + rw [toy_frontier] at hx + rcases hx with rfl | rfl + · show max (-|(-2 : ℝ)|) ((-2 : ℝ) - 2) ≤ -1 + norm_num [abs_of_neg] + · show max (-|(1 : ℝ)|) ((1 : ℝ) - 2) ≤ -1 + norm_num + older := by + show (0 : ℝ) < max (-|(3 : ℝ)|) ((3 : ℝ) - 2) + norm_num + ridge := ⟨toyRidge, toy_ridge_ge⟩ + +/-- In the toy, `S = 1` is the only frontier point at height `-1` (C2⁺). -/ +theorem toy_saddle_strict : ∀ x ∈ frontier (Icc (-2 : ℝ) 1), x ≠ 1 → toyF x < -1 := by + intro x hx hne + rw [toy_frontier] at hx + rcases hx with rfl | h + · show max (-|(-2 : ℝ)|) ((-2 : ℝ) - 2) < -1 + norm_num [abs_of_neg] + · exact absurd h hne + +/-- In the toy, removing `S = 1` from `{f ≥ -1}` disconnects `M = 0` from every older point. The +cut is not vacuous: `M` lies in its own component. -/ +theorem toy_saddle_cut : + (0 : ℝ) ∈ connectedComponentIn ({x | (-1 : ℝ) ≤ toyF x} \ {1}) 0 ∧ + ∀ w ∈ connectedComponentIn ({x | (-1 : ℝ) ≤ toyF x} \ {1}) 0, toyF w ≤ 0 := + toy_capHyp.saddle_cut toy_saddle_strict (by norm_num) + +/-- The toy's elder death level is `-1`. -/ +theorem toy_death_level : IsGreatest (CapHyp.joinedLevels toyF 0 0) (-1) := + toy_capHyp.elder_death_level + +theorem toy_f_M : toyF 0 = 0 := by + show max (-|(0 : ℝ)|) ((0 : ℝ) - 2) = 0 + norm_num + +theorem toy_f_S : toyF 1 = -1 := by + show max (-|(1 : ℝ)|) ((1 : ℝ) - 2) = -1 + norm_num + +/-- Necessity of (C2). At the level `s = -3/2`, (C1) and (C3) hold, (C2) fails (the frontier point +`1` has height `-1 > -3/2`), and the maximin level is not `-3/2`. -/ +theorem toy_needs_C2 : + (∀ x ∈ Icc (-2 : ℝ) 1, toyF x ≤ 0) ∧ (0 : ℝ) < toyF 3 ∧ + (∃ γ : Path (0 : ℝ) 3, ∀ t, (-3 / 2 : ℝ) ≤ toyF (γ t)) ∧ + ¬ (∀ x ∈ frontier (Icc (-2 : ℝ) 1), toyF x ≤ -3 / 2) ∧ + ¬ IsGreatest (connectionLevels toyF 0 0) (-3 / 2) := by + refine ⟨toy_capHyp.ceiling, toy_capHyp.older, + ⟨toyRidge, fun t => le_trans (by norm_num) (toy_ridge_ge t)⟩, fun h => ?_, ?_⟩ + · have h1 := h 1 (by rw [toy_frontier]; simp) + rw [toy_f_S] at h1 + norm_num at h1 + · rintro ⟨-, hub⟩ + have hmem : (-1 : ℝ) ∈ connectionLevels toyF 0 0 := + ⟨3, toyRidge, toy_capHyp.older, toy_ridge_ge⟩ + have := hub hmem + norm_num at this + +/-- Necessity of (C1). At the ceiling `b = -1/2`, (C2) and (C3) hold, (C1) fails (`f M = 0 > -1/2`), +and the constant path at `M` shows that the maximin level is not `-1`. -/ +theorem toy_needs_C1 : + ¬ (∀ x ∈ Icc (-2 : ℝ) 1, toyF x ≤ -1 / 2) ∧ + (∀ x ∈ frontier (Icc (-2 : ℝ) 1), toyF x ≤ -1) ∧ (-1 / 2 : ℝ) < toyF 3 ∧ + (∃ γ : Path (0 : ℝ) 3, ∀ t, (-1 : ℝ) ≤ toyF (γ t)) ∧ + ¬ IsGreatest (connectionLevels toyF 0 (-1 / 2)) (-1) := by + refine ⟨fun h => ?_, toy_capHyp.frontier_le, lt_trans (by norm_num) toy_capHyp.older, + toy_capHyp.ridge, ?_⟩ + · have h1 := h 0 ⟨by norm_num, by norm_num⟩ + rw [toy_f_M] at h1 + norm_num at h1 + · rintro ⟨-, hub⟩ + have hmem : (0 : ℝ) ∈ connectionLevels toyF 0 (-1 / 2) := + ⟨0, Path.refl 0, by rw [toy_f_M]; norm_num, fun t => by simp [toy_f_M]⟩ + have := hub hmem + norm_num at this + +/-- Necessity of (C3). At the level `s = 5`, (C1) and (C2) hold and `z` is older, but no ridge stays +at height `≥ 5` (it starts at `f M = 0`), and the maximin level is not `5`: the barrier at the true +level `-1` excludes it. -/ +theorem toy_needs_C3 : + (∀ x ∈ Icc (-2 : ℝ) 1, toyF x ≤ 0) ∧ + (∀ x ∈ frontier (Icc (-2 : ℝ) 1), toyF x ≤ 5) ∧ (0 : ℝ) < toyF 3 ∧ + ¬ (∃ γ : Path (0 : ℝ) 3, ∀ t, (5 : ℝ) ≤ toyF (γ t)) ∧ + ¬ IsGreatest (connectionLevels toyF 0 0) 5 := by + refine ⟨toy_capHyp.ceiling, fun x hx => le_trans (toy_capHyp.frontier_le x hx) (by norm_num), + toy_capHyp.older, ?_, ?_⟩ + · rintro ⟨γ, hγ⟩ + have h0 := hγ 0 + rw [Path.source, toy_f_M] at h0 + norm_num at h0 + · rintro ⟨hmem, -⟩ + have h1 := toy_capHyp.maximin_isGreatest.2 hmem + norm_num at h1 + +/-- The ridge toy: SP's normalization at `r = 1` with one transverse coordinate, +`f (x, y) = x³/3 - x/4 - y²`, ridge `h = 0`, ridge derivative `F x = x² - 1/4`. -/ +noncomputable def ridgeToyF (p : ℝ × ℝ) : ℝ := p.1 ^ 3 / 3 - p.1 / 4 - p.2 ^ 2 + +/-- The ridge hypotheses of `ridge_capHyp` are jointly satisfiable. Here the gap is +`g(-1/2) - g(1/2) = 1/6`, which is SP's normalization `r³/6`. -/ +theorem ridgeToy_capHyp : + CapHyp ridgeToyF (Icc (-2 * 1) (1 / 2) ×ˢ Metric.closedBall (0 : ℝ) (2 * 1)) (-1 / 2, 0) + (2 * 1, 0) (ridgeToyF (-1 / 2, 0)) (ridgeToyF (1 / 2, 0)) := by + refine ridge_capHyp (E := ℝ) (f := ridgeToyF) (h := fun _ => (0 : ℝ)) + (F := fun x => x ^ 2 - 1 / 4) (r := 1) one_pos continuousOn_const ?_ ?_ ?_ ?_ ?_ ?_ ?_ ?_ + · intro x _ + have h1 := ((hasDerivAt_pow 3 x).div_const 3).sub ((hasDerivAt_id x).div_const 4) + convert h1 using 1 + · funext y + simp only [ridgeToyF, id, Pi.sub_apply] + ring + · push_cast + ring + · norm_num + · norm_num + · have hc : ConvexOn ℝ univ (fun x : ℝ => (7 / 8 : ℝ) • x ^ 2 + (-7 / 32 : ℝ)) := + ((even_two.convexOn_pow).smul (by norm_num)).add (convexOn_const _ convex_univ) + refine (hc.subset (subset_univ _) (convex_Icc _ _)).congr ?_ + intro x _ + simp only [smul_eq_mul] + ring + · rintro ⟨x, y⟩ - + simp only [ridgeToyF] + nlinarith [sq_nonneg y] + · rintro ⟨x, y⟩ ⟨⟨hx1, hx2⟩, hy⟩ + rw [mem_sphere_zero_iff_norm, Real.norm_eq_abs] at hy + have hy2 : y ^ 2 = 4 := by rw [← sq_abs, hy]; norm_num + simp only [ridgeToyF, hy2] + nlinarith [mul_nonneg (sub_nonneg.mpr hx2) (sq_nonneg x), + mul_nonneg (by linarith : (0 : ℝ) ≤ x + 2) (by linarith : (0 : ℝ) ≤ 2 - x)] + · simp + · simp only [ridgeToyF] + norm_num + +/-- In the ridge toy, `S = (1/2, 0)` is the only frontier point at height `s` (C2⁺). -/ +theorem ridgeToy_saddle_strict : + ∀ x ∈ frontier (Icc (-2 * 1) (1 / 2) ×ˢ Metric.closedBall (0 : ℝ) (2 * 1)), + x ≠ (1 / 2, 0) → ridgeToyF x < ridgeToyF (1 / 2, 0) := by + refine ridge_saddle_strict (E := ℝ) (f := ridgeToyF) (h := fun _ => (0 : ℝ)) + (F := fun x => x ^ 2 - 1 / 4) (r := 1) one_pos ?_ ?_ ?_ ?_ ?_ ?_ ?_ ?_ + · intro x _ + have h1 := ((hasDerivAt_pow 3 x).div_const 3).sub ((hasDerivAt_id x).div_const 4) + convert h1 using 1 + · funext y + simp only [ridgeToyF, id, Pi.sub_apply] + ring + · push_cast + ring + · norm_num + · norm_num + · have hc : ConvexOn ℝ univ (fun x : ℝ => (7 / 8 : ℝ) • x ^ 2 + (-7 / 32 : ℝ)) := + ((even_two.convexOn_pow).smul (by norm_num)).add (convexOn_const _ convex_univ) + refine (hc.subset (subset_univ _) (convex_Icc _ _)).congr ?_ + intro x _ + simp only [smul_eq_mul] + ring + · rintro ⟨x, y⟩ - + simp only [ridgeToyF] + nlinarith [sq_nonneg y] + · rintro ⟨x, y⟩ - hy + have hy' : y ≠ 0 := hy + simp only [ridgeToyF] + nlinarith [sq_pos_of_ne_zero hy'] + · rintro ⟨x, y⟩ ⟨⟨hx1, hx2⟩, hy⟩ + rw [mem_sphere_zero_iff_norm, Real.norm_eq_abs] at hy + have hy2 : y ^ 2 = 4 := by rw [← sq_abs, hy]; norm_num + simp only [ridgeToyF, hy2] + nlinarith [mul_nonneg (sub_nonneg.mpr hx2) (sq_nonneg x), + mul_nonneg (by linarith : (0 : ℝ) ≤ x + 2) (by linarith : (0 : ℝ) ≤ 2 - x)] + · simp only [ridgeToyF] + norm_num + +/-! ### The ridge toy through the slice route -/ + +/-- The ridge toy's joint derivative along the ridge `y = 0` is `D x = (x² - 1/4) · dx`. Its +transverse part vanishes (the ridge equation), and `D x (1, 0) = x² - 1/4 = F x`. -/ +theorem ridgeToy_joint (x : ℝ) : + HasFDerivAt ridgeToyF ((x ^ 2 - 1 / 4) • ContinuousLinearMap.fst ℝ ℝ ℝ) (x, 0) ∧ + ((x ^ 2 - 1 / 4) • ContinuousLinearMap.fst ℝ ℝ ℝ).comp (ContinuousLinearMap.inr ℝ ℝ ℝ) = + 0 ∧ + ((x ^ 2 - 1 / 4) • ContinuousLinearMap.fst ℝ ℝ ℝ) (1, 0) = x ^ 2 - 1 / 4 := by + refine ⟨?_, by ext; simp, by simp⟩ + have hu : HasDerivAt (fun t : ℝ => t ^ 3 / 3 - t / 4) (x ^ 2 - 1 / 4) x := by + have h1 := ((hasDerivAt_pow 3 x).div_const 3).sub ((hasDerivAt_id x).div_const 4) + convert h1 using 1 + · funext t; simp + · push_cast; ring + have hv : HasDerivAt (fun t : ℝ => t ^ 2) 0 (0 : ℝ) := by + simpa using hasDerivAt_pow 2 (0 : ℝ) + have h1 := hu.comp_hasFDerivAt ((x, (0 : ℝ)) : ℝ × ℝ) (hasFDerivAt_fst (𝕜 := ℝ)) + have h2 := hv.comp_hasFDerivAt ((x, (0 : ℝ)) : ℝ × ℝ) (hasFDerivAt_snd (𝕜 := ℝ)) + convert h1.sub h2 using 1 + · funext p; simp [ridgeToyF] + · simp + +/-- **The slice route is jointly satisfiable.** The ridge toy (`r = 1`, `h = 0`) meets every +input of `ridge_inputs_of_joint` and `ridge_capHyp_of_slices`, with `δ = 2` (each slice is +`-y²` plus a constant), `w = 0`, `ω = 0`, and the curvature condition +`2δ(b - s) = 2/3 < 16 = (2rδ - ω)²`. The combined theorems re-derive (C1)–(C3) and (C2⁺). -/ +theorem ridgeToy_slices : + CapHyp ridgeToyF (Icc (-2 * 1) (1 / 2) ×ˢ Metric.closedBall (0 : ℝ) (2 * 1)) (-1 / 2, 0) + (2 * 1, 0) (ridgeToyF (-1 / 2, 0)) (ridgeToyF (1 / 2, 0)) ∧ + ∀ x ∈ frontier (Icc (-2 * 1) (1 / 2) ×ˢ Metric.closedBall (0 : ℝ) (2 * 1)), + x ≠ (1 / 2, 0) → ridgeToyF x < ridgeToyF (1 / 2, 0) := by + obtain ⟨hh, hg, hcrit⟩ := ridge_inputs_of_joint (E := ℝ) (f := ridgeToyF) + (h := fun _ => (0 : ℝ)) (h' := fun _ => (0 : ℝ)) + (D := fun x => (x ^ 2 - 1 / 4) • ContinuousLinearMap.fst ℝ ℝ ℝ) (r := 1) one_pos + (fun x _ => (ridgeToy_joint x).1) (fun x _ => hasDerivAt_const x (0 : ℝ)) + (fun x _ => (ridgeToy_joint x).2.1) + refine ridge_capHyp_of_slices (E := ℝ) (f := ridgeToyF) (h := fun _ => (0 : ℝ)) + (w := fun _ => 0) (r := 1) (δ := 2) (ω := 0) one_pos two_pos hh hg ?_ ?_ ?_ ?_ ?_ + hcrit (fun x hx => hcrit x hx) ?_ ?_ ?_ ?_ + · simp only [(ridgeToy_joint _).2.2] + norm_num + · simp only [(ridgeToy_joint _).2.2] + norm_num + · have hc : ConvexOn ℝ univ (fun x : ℝ => (7 / 8 : ℝ) • x ^ 2 + (-7 / 32 : ℝ)) := + ((even_two.convexOn_pow).smul (by norm_num)).add (convexOn_const _ convex_univ) + refine (hc.subset (subset_univ _) (convex_Icc _ _)).congr ?_ + intro x _ + simp only [(ridgeToy_joint _).2.2, smul_eq_mul] + ring + · intro x _ + rw [strongConcaveOn_iff_convex] + refine (concaveOn_const (x ^ 3 / 3 - x / 4) (convex_closedBall (0 : ℝ) (2 * 1))).congr ?_ + intro y _ + simp only [ridgeToyF, Real.norm_eq_abs, sq_abs] + ring + · intro x _ + simp + · intro x _ + simp + · norm_num + · simp only [ridgeToyF] + norm_num + · simp only [ridgeToyF] + norm_num + + +/-- A field that meets SP's normalized hypotheses: `f (x, y) = x³/3 - x/4 - 12 y²`, so `m = 2` +(`f_xxx = 2`), `δ = 24 > r m (8m - 5) = 22` at `r = 1`, and gap exactly `r³/6`. -/ +noncomputable def spToyF (p : ℝ × ℝ) : ℝ := p.1 ^ 3 / 3 - p.1 / 4 - 12 * p.2 ^ 2 + +/-- **`ridge_capHyp_sp` is not vacuous.** `spToyF` meets every hypothesis, with `h = 0`, `w = 0`, +`F = x² - 1/4`, `m = 2` and `δ = 24`. -/ +theorem spToy_capHyp : + CapHyp spToyF (Icc (-2 * 1) (1 / 2) ×ˢ Metric.closedBall (0 : ℝ) (2 * 1)) (-1 / 2, 0) + (2 * 1, 0) (spToyF (-1 / 2, 0)) (spToyF (1 / 2, 0)) ∧ + ∀ x ∈ frontier (Icc (-2 * 1) (1 / 2) ×ˢ Metric.closedBall (0 : ℝ) (2 * 1)), + x ≠ (1 / 2, 0) → spToyF x < spToyF (1 / 2, 0) := by + have hslice : ∀ x : ℝ, HasFDerivAt (fun y : ℝ => spToyF (x, y)) (0 : ℝ →L[ℝ] ℝ) 0 := by + intro x + rw [hasFDerivAt_iff_hasDerivAt] + have h1 := ((hasDerivAt_pow 2 (0 : ℝ)).const_mul 12).const_sub (x ^ 3 / 3 - x / 4) + convert h1 using 1 + · funext y + simp only [spToyF] + · simp + refine ridge_capHyp_sp (E := ℝ) (f := spToyF) (h := fun _ => (0 : ℝ)) + (F := fun x => x ^ 2 - 1 / 4) (w := fun _ => 0) (r := 1) (m := 2) (δ := 24) one_pos le_rfl + (by norm_num) continuousOn_const ?_ ?_ ?_ ?_ ?_ ?_ (fun x _ => hslice x) rfl rfl + (fun x _ => hslice x) ?_ ?_ ?_ + · intro x _ + have h1 := ((hasDerivAt_pow 3 x).div_const 3).sub ((hasDerivAt_id x).div_const 4) + convert h1 using 1 + · funext y + simp only [spToyF, id, Pi.sub_apply] + ring + · push_cast + ring + · norm_num + · norm_num + · have hc : ConvexOn ℝ univ (fun x : ℝ => (7 / 8 : ℝ) • x ^ 2 + (-7 / 32 : ℝ)) := + ((even_two.convexOn_pow).smul (by norm_num)).add (convexOn_const _ convex_univ) + refine (hc.subset (subset_univ _) (convex_Icc _ _)).congr ?_ + intro x _ + simp only [smul_eq_mul] + ring + · intro x _ + rw [strongConcaveOn_iff_convex] + refine (concaveOn_const (x ^ 3 / 3 - x / 4) (convex_closedBall (0 : ℝ) (2 * 1))).congr ?_ + intro y _ + simp only [spToyF, Real.norm_eq_abs, sq_abs] + ring + · intro x _ + simp + · intro v + have hc : ConvexOn ℝ univ (fun t : ℝ => ‖v‖ • t ^ 2) := + (even_two.convexOn_pow).smul (norm_nonneg v) + refine (hc.subset (subset_univ _) (convex_Icc _ _)).congr ?_ + intro t _ + simp only [smul_eq_mul, zero_apply] + ring + · intro v + have hc : ConcaveOn ℝ univ (fun t : ℝ => -(‖v‖ • t ^ 2)) := + ((even_two.convexOn_pow).smul (norm_nonneg v)).neg + refine (hc.subset (subset_univ _) (convex_Icc _ _)).congr ?_ + intro t _ + simp only [smul_eq_mul, zero_apply] + ring + · simp only [spToyF] + norm_num + + +/-- **`ridge_capHyp_normalized` is not vacuous.** `spToyF` meets every hypothesis, with +`G0 = x² - 1/4` (so `|G0''| = 2 = m`) and gap exactly `1/6`. -/ +theorem spToy_normalized : + CapHyp spToyF (Icc (-2 * 1) (1 / 2) ×ˢ Metric.closedBall (0 : ℝ) (2 * 1)) (-1 / 2, 0) + (2 * 1, 0) (spToyF (-1 / 2, 0)) (spToyF (1 / 2, 0)) ∧ + ∀ x ∈ frontier (Icc (-2 * 1) (1 / 2) ×ˢ Metric.closedBall (0 : ℝ) (2 * 1)), + x ≠ (1 / 2, 0) → spToyF x < spToyF (1 / 2, 0) := by + have hslice : ∀ x : ℝ, HasFDerivAt (fun y : ℝ => spToyF (x, y)) (0 : ℝ →L[ℝ] ℝ) 0 := by + intro x + rw [hasFDerivAt_iff_hasDerivAt] + have h1 := ((hasDerivAt_pow 2 (0 : ℝ)).const_mul 12).const_sub (x ^ 3 / 3 - x / 4) + convert h1 using 1 + · funext y + simp only [spToyF] + · simp + have hgx : ∀ x : ℝ, HasDerivAt (fun x => spToyF (x, 0)) (x ^ 2 - 1 / 4) x := by + intro x + have h1 := ((hasDerivAt_pow 3 x).div_const 3).sub ((hasDerivAt_id x).div_const 4) + convert h1 using 1 + · funext y + simp only [spToyF, id, Pi.sub_apply] + ring + · push_cast + ring + have hq : ConvexOn ℝ univ (fun x : ℝ => (7 / 8 : ℝ) • x ^ 2 + (-7 / 32 : ℝ)) := + ((even_two.convexOn_pow).smul (by norm_num)).add (convexOn_const _ convex_univ) + refine ridge_capHyp_normalized (E := ℝ) (f := spToyF) (h := fun _ => (0 : ℝ)) + (F := fun x => x ^ 2 - 1 / 4) (G0 := fun x => x ^ 2 - 1 / 4) (w := fun _ => 0) (r := 1) + (m := 2) (δ := 24) one_pos (fun x _ => hgx x) ?_ ?_ (by norm_num) (by norm_num) + (by norm_num) continuousOn_const (fun x _ => hgx x) (by norm_num) (by norm_num) ?_ ?_ + (fun x _ => by simp) (fun x _ => hslice x) rfl rfl (fun x _ => hslice x) ?_ ?_ ?_ + · have hc : ConvexOn ℝ univ (fun x : ℝ => (2 : ℝ) • x ^ 2 + (-1 / 4 : ℝ)) := + ((even_two.convexOn_pow).smul (by norm_num)).add (convexOn_const _ convex_univ) + refine (hc.subset (subset_univ _) (convex_Icc _ _)).congr ?_ + intro x _ + simp only [smul_eq_mul] + ring + · refine (concaveOn_const (-1 / 4 : ℝ) (convex_Icc _ _)).congr ?_ + intro x _ + ring + · refine (hq.subset (subset_univ _) (convex_Icc _ _)).congr ?_ + intro x _ + simp only [smul_eq_mul] + ring + · intro x _ + rw [strongConcaveOn_iff_convex] + refine (concaveOn_const (x ^ 3 / 3 - x / 4) (convex_closedBall (0 : ℝ) (2 * 1))).congr ?_ + intro y _ + simp only [spToyF, Real.norm_eq_abs, sq_abs] + ring + · intro v + have hc : ConvexOn ℝ univ (fun t : ℝ => ‖v‖ • t ^ 2) := + (even_two.convexOn_pow).smul (norm_nonneg v) + refine (hc.subset (subset_univ _) (convex_Icc _ _)).congr ?_ + intro t _ + simp only [smul_eq_mul, zero_apply] + ring + · intro v + have hc : ConcaveOn ℝ univ (fun t : ℝ => -(‖v‖ • t ^ 2)) := + ((even_two.convexOn_pow).smul (norm_nonneg v)).neg + refine (hc.subset (subset_univ _) (convex_Icc _ _)).congr ?_ + intro t _ + simp only [smul_eq_mul, zero_apply] + ring + · simp only [spToyF] + norm_num + + +/-- A field meeting (H1): `f (x, y) = x³/3 - x/4 - 20 y²`, so `λ = 40 > 8 r m² = 32` at `r = 1`, +`m = 2`, and gap exactly `r³/6`. -/ +noncomputable def h1ToyF (p : ℝ × ℝ) : ℝ := p.1 ^ 3 / 3 - p.1 / 4 - 20 * p.2 ^ 2 + +/-- **`ridge_capHyp_H1` is not vacuous.** `h1ToyF` meets every hypothesis, with a constant +transverse Hessian `-40`, `h = 0`, `w = 0`, `G0 = F = x² - 1/4`, `m = 2` and `λ = 40`. -/ +theorem h1Toy_capHyp : + CapHyp h1ToyF (Icc (-2 * 1) (1 / 2) ×ˢ Metric.closedBall (0 : ℝ) (2 * 1)) (-1 / 2, 0) + (2 * 1, 0) (h1ToyF (-1 / 2, 0)) (h1ToyF (1 / 2, 0)) ∧ + ∀ x ∈ frontier (Icc (-2 * 1) (1 / 2) ×ˢ Metric.closedBall (0 : ℝ) (2 * 1)), + x ≠ (1 / 2, 0) → h1ToyF x < h1ToyF (1 / 2, 0) := by + have hslope : ∀ x y : ℝ, HasFDerivAt (fun y : ℝ => h1ToyF (x, y)) + (ContinuousLinearMap.mul ℝ ℝ (-40 * y)) y := by + intro x y + rw [hasFDerivAt_iff_hasDerivAt] + have h1 := ((hasDerivAt_pow 2 y).const_mul 20).const_sub (x ^ 3 / 3 - x / 4) + convert h1 using 1 + · funext t + simp only [h1ToyF] + · simp + ring + have hslice : ∀ x : ℝ, HasFDerivAt (fun y : ℝ => h1ToyF (x, y)) (0 : ℝ →L[ℝ] ℝ) 0 := by + intro x + simpa using hslope x 0 + have hhess : ∀ y : ℝ, HasFDerivAt (fun y : ℝ => ContinuousLinearMap.mul ℝ ℝ (-40 * y)) + ((-40 : ℝ) • ContinuousLinearMap.mul ℝ ℝ) y := by + intro y + convert ((-40 : ℝ) • ContinuousLinearMap.mul ℝ ℝ).hasFDerivAt (x := y) using 1 + funext t + ext + simp + have hgx : ∀ x : ℝ, HasDerivAt (fun x => h1ToyF (x, 0)) (x ^ 2 - 1 / 4) x := by + intro x + have h1 := ((hasDerivAt_pow 3 x).div_const 3).sub ((hasDerivAt_id x).div_const 4) + convert h1 using 1 + · funext y + simp only [h1ToyF, id, Pi.sub_apply] + ring + · push_cast + ring + have hq : ConvexOn ℝ univ (fun x : ℝ => (7 / 8 : ℝ) • x ^ 2 + (-7 / 32 : ℝ)) := + ((even_two.convexOn_pow).smul (by norm_num)).add (convexOn_const _ convex_univ) + refine ridge_capHyp_H1 (E := ℝ) (f := h1ToyF) (h := fun _ => (0 : ℝ)) + (F := fun x => x ^ 2 - 1 / 4) (G0 := fun x => x ^ 2 - 1 / 4) (w := fun _ => 0) + (Dφ := fun p => ContinuousLinearMap.mul ℝ ℝ (-40 * p.2)) + (H := fun _ => (-40 : ℝ) • ContinuousLinearMap.mul ℝ ℝ) (Hx := fun _ => 0) (Hr := fun _ _ => 0) + (r := 1) (m := 2) (lam := 40) + one_pos (fun x _ => hgx x) ?_ ?_ (by norm_num) (by norm_num) + (fun p _ => hslope p.1 p.2) (fun p _ => hhess p.2) + (fun x _ => hasDerivAt_const x ((-40 : ℝ) • ContinuousLinearMap.mul ℝ ℝ)) + (fun x _ => by simp only [ContinuousLinearMap.opNorm_zero]; norm_num) + (fun p _ s _ => hasDerivAt_const s ((-40 : ℝ) • ContinuousLinearMap.mul ℝ ℝ)) + (fun p _ s _ => by simp only [ContinuousLinearMap.opNorm_zero]; positivity) ?_ (by norm_num) + continuousOn_const (fun x _ => hgx x) (by norm_num) (by norm_num) ?_ + (fun x _ => by simp) (fun x _ => hslice x) rfl rfl (fun x _ => hslice x) ?_ ?_ ?_ + · have hc : ConvexOn ℝ univ (fun x : ℝ => (2 : ℝ) • x ^ 2 + (-1 / 4 : ℝ)) := + ((even_two.convexOn_pow).smul (by norm_num)).add (convexOn_const _ convex_univ) + refine (hc.subset (subset_univ _) (convex_Icc _ _)).congr ?_ + intro x _ + simp only [smul_eq_mul] + ring + · refine (concaveOn_const (-1 / 4 : ℝ) (convex_Icc _ _)).congr ?_ + intro x _ + ring + · intro v + simp only [smul_apply, ContinuousLinearMap.mul_apply', smul_eq_mul, + Real.norm_eq_abs, sq_abs] + nlinarith [sq_nonneg v] + · refine (hq.subset (subset_univ _) (convex_Icc _ _)).congr ?_ + intro x _ + simp only [smul_eq_mul] + ring + · intro v + have hc : ConvexOn ℝ univ (fun t : ℝ => ‖v‖ • t ^ 2) := + (even_two.convexOn_pow).smul (norm_nonneg v) + refine (hc.subset (subset_univ _) (convex_Icc _ _)).congr ?_ + intro t _ + simp only [smul_eq_mul, zero_apply] + ring + · intro v + have hc : ConcaveOn ℝ univ (fun t : ℝ => -(‖v‖ • t ^ 2)) := + ((even_two.convexOn_pow).smul (norm_nonneg v)).neg + refine (hc.subset (subset_univ _) (convex_Icc _ _)).congr ?_ + intro t _ + simp only [smul_eq_mul, zero_apply] + ring + · simp only [h1ToyF] + norm_num + + +/-- **`ridge_differentiable` is not vacuous.** For `h1ToyF`, with `h = 0`, transverse gradient +`G (x, y) = -40 y`, its constant derivative `DG = -40 · snd`, `δ = 40` and `U = (-3, 3)`, the +statement lists every hypothesis of `ridge_differentiable` at this instance, and its last +conjunct is that theorem's conclusion, obtained by applying it. -/ +theorem h1Toy_ridge_differentiable : + IsOpen (Ioo (-3 : ℝ) 3) ∧ Icc (-2 * (1 : ℝ)) (2 * 1) ⊆ Ioo (-3) 3 ∧ + (∀ x ∈ Ioo (-3 : ℝ) 3, + StrongConcaveOn (Metric.closedBall (0 : ℝ) (2 * 1)) 40 (fun y => h1ToyF (x, y))) ∧ + (∀ x ∈ Ioo (-3 : ℝ) 3, (0 : ℝ) ∈ Metric.closedBall (0 : ℝ) (2 * 1)) ∧ + (∀ x ∈ Ioo (-3 : ℝ) 3, HasFDerivAt (fun y => h1ToyF (x, y)) (0 : ℝ →L[ℝ] ℝ) 0) ∧ + (∀ x ∈ Icc (-2 * (1 : ℝ)) (2 * 1), (0 : ℝ) ∈ Metric.ball (0 : ℝ) (2 * 1)) ∧ + (∀ x ∈ Icc (-2 * (1 : ℝ)) (2 * 1), ∀ᶠ v in nhds (x, (0 : ℝ)), + HasFDerivAt (fun y => h1ToyF (v.1, y)) (ContinuousLinearMap.mul ℝ ℝ (-40 * v.2)) v.2) ∧ + (∀ x ∈ Icc (-2 * (1 : ℝ)) (2 * 1), + HasStrictFDerivAt (fun p : ℝ × ℝ => ContinuousLinearMap.mul ℝ ℝ (-40 * p.2)) + (((-40 : ℝ) • ContinuousLinearMap.mul ℝ ℝ) ∘L ContinuousLinearMap.snd ℝ ℝ ℝ) (x, 0)) ∧ + (∀ v : ℝ, ((((-40 : ℝ) • ContinuousLinearMap.mul ℝ ℝ) ∘L ContinuousLinearMap.snd ℝ ℝ ℝ) ∘L + ContinuousLinearMap.inr ℝ ℝ ℝ) v v ≤ -40 * ‖v‖ ^ 2) ∧ + ∀ x ∈ Icc (-2 * (1 : ℝ)) (2 * 1), HasStrictFDerivAt (fun _ : ℝ => (0 : ℝ)) + (-((((-40 : ℝ) • ContinuousLinearMap.mul ℝ ℝ) ∘L ContinuousLinearMap.snd ℝ ℝ ℝ) ∘L + ContinuousLinearMap.inr ℝ ℝ ℝ).inverse ∘L + ((((-40 : ℝ) • ContinuousLinearMap.mul ℝ ℝ) ∘L ContinuousLinearMap.snd ℝ ℝ ℝ) ∘L + ContinuousLinearMap.inl ℝ ℝ ℝ)) x := by + have hslope : ∀ x y : ℝ, HasFDerivAt (fun y : ℝ => h1ToyF (x, y)) + (ContinuousLinearMap.mul ℝ ℝ (-40 * y)) y := by + intro x y + rw [hasFDerivAt_iff_hasDerivAt] + have h1 := ((hasDerivAt_pow 2 y).const_mul 20).const_sub (x ^ 3 / 3 - x / 4) + convert h1 using 1 + · funext t + simp only [h1ToyF] + · simp + ring + have hGs : ∀ p : ℝ × ℝ, HasStrictFDerivAt (fun p : ℝ × ℝ => ContinuousLinearMap.mul ℝ ℝ (-40 * p.2)) + (((-40 : ℝ) • ContinuousLinearMap.mul ℝ ℝ) ∘L ContinuousLinearMap.snd ℝ ℝ ℝ) p := by + intro p + convert (((-40 : ℝ) • ContinuousLinearMap.mul ℝ ℝ) ∘L + ContinuousLinearMap.snd ℝ ℝ ℝ).hasStrictFDerivAt (x := p) using 1 + funext q + ext + simp + have hIU : Icc (-2 * (1 : ℝ)) (2 * 1) ⊆ Ioo (-3) 3 := + fun t ht => ⟨by linarith [ht.1], by linarith [ht.2]⟩ + have hconc : ∀ x ∈ Ioo (-3 : ℝ) 3, + StrongConcaveOn (Metric.closedBall (0 : ℝ) (2 * 1)) 40 (fun y => h1ToyF (x, y)) := by + intro t _ + rw [strongConcaveOn_iff_convex] + refine (concaveOn_const (t ^ 3 / 3 - t / 4) (convex_closedBall (0 : ℝ) (2 * 1))).congr ?_ + intro y _ + simp only [h1ToyF, Real.norm_eq_abs, sq_abs] + ring + have hball : ∀ x ∈ Ioo (-3 : ℝ) 3, (0 : ℝ) ∈ Metric.closedBall (0 : ℝ) (2 * 1) := + fun t _ => by simp + have hcrit : ∀ x ∈ Ioo (-3 : ℝ) 3, HasFDerivAt (fun y => h1ToyF (x, y)) (0 : ℝ →L[ℝ] ℝ) 0 := + fun t _ => by simpa using hslope t 0 + have hint : ∀ x ∈ Icc (-2 * (1 : ℝ)) (2 * 1), (0 : ℝ) ∈ Metric.ball (0 : ℝ) (2 * 1) := + fun t _ => by simp + have hG : ∀ x ∈ Icc (-2 * (1 : ℝ)) (2 * 1), ∀ᶠ v in nhds (x, (0 : ℝ)), + HasFDerivAt (fun y => h1ToyF (v.1, y)) (ContinuousLinearMap.mul ℝ ℝ (-40 * v.2)) v.2 := + fun t _ => Filter.Eventually.of_forall (fun v => hslope v.1 v.2) + have hneg : ∀ v : ℝ, ((((-40 : ℝ) • ContinuousLinearMap.mul ℝ ℝ) ∘L + ContinuousLinearMap.snd ℝ ℝ ℝ) ∘L ContinuousLinearMap.inr ℝ ℝ ℝ) v v ≤ -40 * ‖v‖ ^ 2 := by + intro v + simp only [ContinuousLinearMap.comp_apply, ContinuousLinearMap.inr_apply, + ContinuousLinearMap.coe_snd', smul_apply, ContinuousLinearMap.mul_apply', smul_eq_mul, + Real.norm_eq_abs, sq_abs] + nlinarith [sq_nonneg v] + refine ⟨isOpen_Ioo, hIU, hconc, hball, hcrit, hint, hG, fun x _ => hGs (x, 0), hneg, ?_⟩ + exact ridge_differentiable (E := ℝ) (f := h1ToyF) + (G := fun p => ContinuousLinearMap.mul ℝ ℝ (-40 * p.2)) + (DG := fun _ => ((-40 : ℝ) • ContinuousLinearMap.mul ℝ ℝ) ∘L ContinuousLinearMap.snd ℝ ℝ ℝ) + (h := fun _ => (0 : ℝ)) (U := Ioo (-3) 3) (r := 1) (δ := 40) (by norm_num) isOpen_Ioo hIU + hconc hball hcrit hint hG (fun x _ => hGs (x, 0)) (fun _ _ => hneg) + +/-- **`ridge_capHyp_source` is not vacuous.** `h1ToyF` meets every source hypothesis on the full +collar `[-5/2, 5/2] × B̄(0, 2)` (`ε = 1/2`): joint derivative `(x² - 1/4, -40y)`, transverse gradient `-40y` +with derivative `-40 · snd`, constant transverse Hessian `-40`, `m = 2`, `λ = 40 > 32`, pins +`(∓1/2, 0)` and gap `1/6`. The theorem then gives the ridge, and for `h = 0`, which meets L12 +(`F = x² - 1/4`), the cap with `M = (-1/2, 0)`. -/ +theorem h1Toy_source : + (∃ h : ℝ → ℝ, ∀ x ∈ Ioo (-2 * 1 - 1 / 2 : ℝ) (2 * 1 + 1 / 2), h x ∈ Metric.ball (0 : ℝ) (2 * 1) ∧ + HasFDerivAt (fun y => h1ToyF (x, y)) (0 : ℝ →L[ℝ] ℝ) (h x)) ∧ + CapHyp h1ToyF (Icc (-2 * 1) (1 / 2) ×ˢ Metric.closedBall (0 : ℝ) (2 * 1)) (-1 / 2, 0) + (2 * 1, 0) (h1ToyF (-1 / 2, 0)) (h1ToyF (1 / 2, 0)) := by + have hDf : ∀ p : ℝ × ℝ, HasFDerivAt h1ToyF ((p.1 ^ 2 - 1 / 4) • ContinuousLinearMap.fst ℝ ℝ ℝ + + (-40 * p.2) • ContinuousLinearMap.snd ℝ ℝ ℝ) p := by + intro p + have hf : HasFDerivAt (fun q : ℝ × ℝ => q.1) (ContinuousLinearMap.fst ℝ ℝ ℝ) p := + hasFDerivAt_fst + have hs : HasFDerivAt (fun q : ℝ × ℝ => q.2) (ContinuousLinearMap.snd ℝ ℝ ℝ) p := + hasFDerivAt_snd + have h1 := HasFDerivAt.sub (HasFDerivAt.sub + (HasFDerivAt.const_mul (HasFDerivAt.pow hf 3) (1 / 3)) (HasFDerivAt.const_mul hf (1 / 4))) + (HasFDerivAt.const_mul (HasFDerivAt.pow hs 2) 20) + convert h1 using 1 + · funext q + simp only [h1ToyF, Pi.sub_apply] + ring + · ext <;> simp; ring + have hGs : ∀ p : ℝ × ℝ, HasStrictFDerivAt (fun q : ℝ × ℝ => ((q.1 ^ 2 - 1 / 4) • + ContinuousLinearMap.fst ℝ ℝ ℝ + (-40 * q.2) • ContinuousLinearMap.snd ℝ ℝ ℝ).comp + (ContinuousLinearMap.inr ℝ ℝ ℝ)) + (((-40 : ℝ) • ContinuousLinearMap.mul ℝ ℝ) ∘L ContinuousLinearMap.snd ℝ ℝ ℝ) p := by + intro p + convert (((-40 : ℝ) • ContinuousLinearMap.mul ℝ ℝ) ∘L + ContinuousLinearMap.snd ℝ ℝ ℝ).hasStrictFDerivAt (x := p) using 1 + funext q + ext + simp + have hH : ∀ p : ℝ × ℝ, HasFDerivAt (fun y => ((p.1 ^ 2 - 1 / 4) • ContinuousLinearMap.fst ℝ ℝ ℝ + + (-40 * y) • ContinuousLinearMap.snd ℝ ℝ ℝ).comp (ContinuousLinearMap.inr ℝ ℝ ℝ)) + ((-40 : ℝ) • ContinuousLinearMap.mul ℝ ℝ) p.2 := by + intro p + convert ((-40 : ℝ) • ContinuousLinearMap.mul ℝ ℝ).hasFDerivAt (x := p.2) using 1 + funext y + ext + simp + have hsrc := ridge_capHyp_source (E := ℝ) (f := h1ToyF) + (Df := fun p => (p.1 ^ 2 - 1 / 4) • ContinuousLinearMap.fst ℝ ℝ ℝ + + (-40 * p.2) • ContinuousLinearMap.snd ℝ ℝ ℝ) + (DG := fun _ => ((-40 : ℝ) • ContinuousLinearMap.mul ℝ ℝ) ∘L ContinuousLinearMap.snd ℝ ℝ ℝ) + (H := fun _ => (-40 : ℝ) • ContinuousLinearMap.mul ℝ ℝ) (Hx := fun _ => 0) + (Hr := fun _ _ => 0) (r := 1) (m := 2) (lam := 40) (ε := 1 / 2) one_pos (by norm_num) + (by norm_num) + (fun p _ => hDf p) (fun p _ => hGs p) (fun p _ => hH p) + (fun x _ => hasDerivAt_const x ((-40 : ℝ) • ContinuousLinearMap.mul ℝ ℝ)) + (fun x _ => by simp only [ContinuousLinearMap.opNorm_zero]; norm_num) + (fun p _ s _ => hasDerivAt_const s ((-40 : ℝ) • ContinuousLinearMap.mul ℝ ℝ)) + (fun p _ s _ => by simp only [ContinuousLinearMap.opNorm_zero]; positivity) + (fun v => by + simp only [smul_apply, ContinuousLinearMap.mul_apply', smul_eq_mul, Real.norm_eq_abs, sq_abs] + nlinarith [sq_nonneg v]) + (by norm_num) (by ext <;> norm_num) (by ext <;> norm_num) ?_ ?_ ?_ ?_ (by simp only [h1ToyF]; norm_num) + · obtain ⟨hex, hcap⟩ := hsrc + have hcrit0 : ∀ x : ℝ, HasFDerivAt (fun y => h1ToyF (x, y)) (0 : ℝ →L[ℝ] ℝ) 0 := by + intro x + have := slice_hasFDerivAt (hDf (x, 0)) + convert this using 1 + ext + simp + have hq : ConvexOn ℝ univ (fun x : ℝ => (7 / 8 : ℝ) • x ^ 2 + (-7 / 32 : ℝ)) := + ((even_two.convexOn_pow).smul (by norm_num)).add (convexOn_const _ convex_univ) + obtain ⟨-, -, hC, -⟩ := hcap (fun _ => 0) (fun x _ => ⟨by simp, hcrit0 x⟩) + ((hq.subset (subset_univ _) (convex_Icc _ _)).congr fun x _ => by + simp only [smul_eq_mul] + simp + ring) + exact ⟨hex, hC⟩ + · have hc : ConvexOn ℝ univ (fun x : ℝ => (2 : ℝ) • x ^ 2 + (-1 / 4 : ℝ)) := + ((even_two.convexOn_pow).smul (by norm_num)).add (convexOn_const _ convex_univ) + refine (hc.subset (subset_univ _) (convex_Icc _ _)).congr ?_ + intro x _ + simp only [smul_eq_mul] + simp + ring + · refine (concaveOn_const (-1 / 4 : ℝ) (convex_Icc _ _)).congr ?_ + intro x _ + simp + ring + · intro v + have hc : ConvexOn ℝ univ (fun t : ℝ => ‖v‖ • t ^ 2) := + (even_two.convexOn_pow).smul (norm_nonneg v) + refine (hc.subset (subset_univ _) (convex_Icc _ _)).congr ?_ + intro t _ + simp only [smul_eq_mul] + simp + · intro v + have hc : ConcaveOn ℝ univ (fun t : ℝ => -(‖v‖ • t ^ 2)) := + ((even_two.convexOn_pow).smul (norm_nonneg v)).neg + refine (hc.subset (subset_univ _) (convex_Icc _ _)).congr ?_ + intro t _ + simp only [smul_eq_mul] + simp + +/-- **`ridge_capHyp_C3` is not vacuous.** `h1ToyF` meets every hypothesis of `ridge_capHyp_C3` +on the collar `ε = 1/2`: besides the data of `h1Toy_source`, second derivative +`D²f = diag(2x, -40)`, third derivatives `T a b = 2 a₁ b₁ · fst` (only `f_xxx = 2 ≥ 7/4` is nonzero, +so every other block vanishes). The theorem then gives the ridge and the cap with `M = (-1/2, 0)`, +with L12 derived rather than supplied. -/ +theorem h1Toy_C3 : + (∃ h : ℝ → ℝ, ∀ x ∈ Ioo (-2 * 1 - 1 / 2 : ℝ) (2 * 1 + 1 / 2), h x ∈ Metric.ball (0 : ℝ) (2 * 1) ∧ + HasFDerivAt (fun y => h1ToyF (x, y)) (0 : ℝ →L[ℝ] ℝ) (h x)) ∧ + CapHyp h1ToyF (Icc (-2 * 1) (1 / 2) ×ˢ Metric.closedBall (0 : ℝ) (2 * 1)) (-1 / 2, 0) + (2 * 1, 0) (h1ToyF (-1 / 2, 0)) (h1ToyF (1 / 2, 0)) := by + have hDf : ∀ p : ℝ × ℝ, HasFDerivAt h1ToyF ((p.1 ^ 2 - 1 / 4) • ContinuousLinearMap.fst ℝ ℝ ℝ + + (-40 * p.2) • ContinuousLinearMap.snd ℝ ℝ ℝ) p := by + intro p + have hf : HasFDerivAt (fun q : ℝ × ℝ => q.1) (ContinuousLinearMap.fst ℝ ℝ ℝ) p := + hasFDerivAt_fst + have hs : HasFDerivAt (fun q : ℝ × ℝ => q.2) (ContinuousLinearMap.snd ℝ ℝ ℝ) p := + hasFDerivAt_snd + have h1 := HasFDerivAt.sub (HasFDerivAt.sub + (HasFDerivAt.const_mul (HasFDerivAt.pow hf 3) (1 / 3)) (HasFDerivAt.const_mul hf (1 / 4))) + (HasFDerivAt.const_mul (HasFDerivAt.pow hs 2) 20) + convert h1 using 1 + · funext q + simp only [h1ToyF, Pi.sub_apply] + ring + · ext <;> simp; ring + have hGs : ∀ p : ℝ × ℝ, HasStrictFDerivAt (fun q : ℝ × ℝ => ((q.1 ^ 2 - 1 / 4) • + ContinuousLinearMap.fst ℝ ℝ ℝ + (-40 * q.2) • ContinuousLinearMap.snd ℝ ℝ ℝ).comp + (ContinuousLinearMap.inr ℝ ℝ ℝ)) + (((-40 : ℝ) • ContinuousLinearMap.mul ℝ ℝ) ∘L ContinuousLinearMap.snd ℝ ℝ ℝ) p := by + intro p + convert (((-40 : ℝ) • ContinuousLinearMap.mul ℝ ℝ) ∘L + ContinuousLinearMap.snd ℝ ℝ ℝ).hasStrictFDerivAt (x := p) using 1 + funext q + ext + simp + have hH : ∀ p : ℝ × ℝ, HasFDerivAt (fun y => ((p.1 ^ 2 - 1 / 4) • ContinuousLinearMap.fst ℝ ℝ ℝ + + (-40 * y) • ContinuousLinearMap.snd ℝ ℝ ℝ).comp (ContinuousLinearMap.inr ℝ ℝ ℝ)) + ((-40 : ℝ) • ContinuousLinearMap.mul ℝ ℝ) p.2 := by + intro p + convert ((-40 : ℝ) • ContinuousLinearMap.mul ℝ ℝ).hasFDerivAt (x := p.2) using 1 + funext y + ext + simp + have hf : ∀ p : ℝ × ℝ, HasFDerivAt (fun q : ℝ × ℝ => q.1) (ContinuousLinearMap.fst ℝ ℝ ℝ) p := + fun p => hasFDerivAt_fst + have hs : ∀ p : ℝ × ℝ, HasFDerivAt (fun q : ℝ × ℝ => q.2) (ContinuousLinearMap.snd ℝ ℝ ℝ) p := + fun p => hasFDerivAt_snd + have hD2 : ∀ p : ℝ × ℝ, HasFDerivAt (fun q : ℝ × ℝ => (q.1 ^ 2 - 1 / 4) • + ContinuousLinearMap.fst ℝ ℝ ℝ + (-40 * q.2) • ContinuousLinearMap.snd ℝ ℝ ℝ) + (((2 * p.1) • ContinuousLinearMap.fst ℝ ℝ ℝ).smulRight (ContinuousLinearMap.fst ℝ ℝ ℝ) + + ((-40 : ℝ) • ContinuousLinearMap.snd ℝ ℝ ℝ).smulRight (ContinuousLinearMap.snd ℝ ℝ ℝ)) p := by + intro p + have h1 : HasFDerivAt (fun q : ℝ × ℝ => q.1 ^ 2 - 1 / 4) ((2 * p.1) • ContinuousLinearMap.fst ℝ ℝ ℝ) + p := by + have := (HasFDerivAt.pow (hf p) 2).sub_const (1 / 4) + convert this using 1 + ext <;> simp + have h2 : HasFDerivAt (fun q : ℝ × ℝ => -40 * q.2) ((-40 : ℝ) • ContinuousLinearMap.snd ℝ ℝ ℝ) p := + HasFDerivAt.const_mul (hs p) (-40) + exact (h1.smul_const (ContinuousLinearMap.fst ℝ ℝ ℝ)).add + (h2.smul_const (ContinuousLinearMap.snd ℝ ℝ ℝ)) + have hD3 : ∀ p : ℝ × ℝ, ∀ a b : ℝ × ℝ, HasFDerivAt (fun q : ℝ × ℝ => + ((((2 * q.1) • ContinuousLinearMap.fst ℝ ℝ ℝ).smulRight (ContinuousLinearMap.fst ℝ ℝ ℝ) + + ((-40 : ℝ) • ContinuousLinearMap.snd ℝ ℝ ℝ).smulRight (ContinuousLinearMap.snd ℝ ℝ ℝ)) a) b) + ((2 * a.1 * b.1) • ContinuousLinearMap.fst ℝ ℝ ℝ) p := by + intro p a b + have := (HasFDerivAt.const_mul (hf p) (2 * a.1 * b.1)).add_const (-40 * a.2 * b.2) + convert this using 1 + funext q + simp + ring + have hT : ∀ p : ℝ × ℝ, ∀ (s₁ s₂ s₃ : ℝ) (y₁ y₂ y₃ : ℝ), + |((2 * (s₁, y₁).1 * (s₂, y₂).1) • ContinuousLinearMap.fst ℝ ℝ ℝ) (s₃, y₃) - + s₁ * s₂ * s₃ * ((2 * ((1 : ℝ), (0 : ℝ)).1 * ((1 : ℝ), (0 : ℝ)).1) • + ContinuousLinearMap.fst ℝ ℝ ℝ) (1, 0)| ≤ + 2 * ((|s₁| + ‖y₁‖) * (|s₂| + ‖y₂‖) * (|s₃| + ‖y₃‖) - |s₁| * |s₂| * |s₃|) := by + intro p s₁ s₂ s₃ y₁ y₂ y₃ + have h0 : ((2 * (s₁, y₁).1 * (s₂, y₂).1) • ContinuousLinearMap.fst ℝ ℝ ℝ) (s₃, y₃) - + s₁ * s₂ * s₃ * ((2 * ((1 : ℝ), (0 : ℝ)).1 * ((1 : ℝ), (0 : ℝ)).1) • + ContinuousLinearMap.fst ℝ ℝ ℝ) (1, 0) = 0 := by + simp + ring + rw [h0, abs_zero] + have a1 : |s₁| ≤ |s₁| + ‖y₁‖ := le_add_of_nonneg_right (norm_nonneg _) + have a2 : |s₂| ≤ |s₂| + ‖y₂‖ := le_add_of_nonneg_right (norm_nonneg _) + have a3 : |s₃| ≤ |s₃| + ‖y₃‖ := le_add_of_nonneg_right (norm_nonneg _) + have := mul_le_mul (mul_le_mul a1 a2 (abs_nonneg _) (by positivity)) a3 (abs_nonneg _) + (by positivity) + linarith + have hsrc := ridge_capHyp_C3 (E := ℝ) (f := h1ToyF) + (Df := fun p => (p.1 ^ 2 - 1 / 4) • ContinuousLinearMap.fst ℝ ℝ ℝ + + (-40 * p.2) • ContinuousLinearMap.snd ℝ ℝ ℝ) + (D2f := fun p => ((2 * p.1) • ContinuousLinearMap.fst ℝ ℝ ℝ).smulRight + (ContinuousLinearMap.fst ℝ ℝ ℝ) + + ((-40 : ℝ) • ContinuousLinearMap.snd ℝ ℝ ℝ).smulRight (ContinuousLinearMap.snd ℝ ℝ ℝ)) + (T3 := fun _ a b => (2 * a.1 * b.1) • ContinuousLinearMap.fst ℝ ℝ ℝ) + (DG := fun _ => ((-40 : ℝ) • ContinuousLinearMap.mul ℝ ℝ) ∘L ContinuousLinearMap.snd ℝ ℝ ℝ) + (H := fun _ => (-40 : ℝ) • ContinuousLinearMap.mul ℝ ℝ) (Hx := fun _ => 0) + (Hr := fun _ _ => 0) (r := 1) (m := 2) (lam := 40) (ε := 1 / 2) one_pos (by norm_num) + (by norm_num) (fun p _ => hDf p) (fun p _ => hD2 p) (fun p _ a b => hD3 p a b) + (fun p _ => hT p) (fun p _ => by norm_num) (fun p _ => hGs p) (fun p _ => hH p) + (fun x _ => hasDerivAt_const x ((-40 : ℝ) • ContinuousLinearMap.mul ℝ ℝ)) + (fun x _ => by simp only [ContinuousLinearMap.opNorm_zero]; norm_num) + (fun p _ s _ => hasDerivAt_const s ((-40 : ℝ) • ContinuousLinearMap.mul ℝ ℝ)) + (fun p _ s _ => by simp only [ContinuousLinearMap.opNorm_zero]; positivity) + (fun v => by + simp only [smul_apply, ContinuousLinearMap.mul_apply', smul_eq_mul, Real.norm_eq_abs, sq_abs] + nlinarith [sq_nonneg v]) + (by norm_num) (by ext <;> norm_num) (by ext <;> norm_num) ?_ ?_ ?_ ?_ + (by simp only [h1ToyF]; norm_num) + · obtain ⟨hex, hcap⟩ := hsrc + have hcrit0 : ∀ x : ℝ, HasFDerivAt (fun y => h1ToyF (x, y)) (0 : ℝ →L[ℝ] ℝ) 0 := by + intro x + have := slice_hasFDerivAt (hDf (x, 0)) + convert this using 1 + ext + simp + obtain ⟨-, -, hC, -⟩ := hcap (fun _ => 0) (fun x _ => ⟨by simp, hcrit0 x⟩) + exact ⟨hex, hC⟩ + · have hc : ConvexOn ℝ univ (fun x : ℝ => (2 : ℝ) • x ^ 2 + (-1 / 4 : ℝ)) := + ((even_two.convexOn_pow).smul (by norm_num)).add (convexOn_const _ convex_univ) + refine (hc.subset (subset_univ _) (convex_Icc _ _)).congr ?_ + intro x _ + simp only [smul_eq_mul] + simp + ring + · refine (concaveOn_const (-1 / 4 : ℝ) (convex_Icc _ _)).congr ?_ + intro x _ + simp + ring + · intro v + have hc : ConvexOn ℝ univ (fun t : ℝ => ‖v‖ • t ^ 2) := + (even_two.convexOn_pow).smul (norm_nonneg v) + refine (hc.subset (subset_univ _) (convex_Icc _ _)).congr ?_ + intro t _ + simp only [smul_eq_mul] + simp + · intro v + have hc : ConcaveOn ℝ univ (fun t : ℝ => -(‖v‖ • t ^ 2)) := + ((even_two.convexOn_pow).smul (norm_nonneg v)).neg + refine (hc.subset (subset_univ _) (convex_Icc _ _)).congr ?_ + intro t _ + simp only [smul_eq_mul] + simp + +/-- **`ridge_capHyp_C4` is not vacuous.** `h1ToyF` meets every hypothesis of `ridge_capHyp_C4` +on the collar `ε = 1/2`: the data of `h1Toy_C3`, with `f_xxx = 2` constant, so its derivative is `0`, +both fourth-order blocks vanish and (H2) holds with `n = 0`. The theorem gives the ridge and the cap with `M = (-1/2, 0)`, with +neither L12 nor `f_xxx ≥ 7/4` supplied. -/ +theorem h1Toy_C4 : + (∃ h : ℝ → ℝ, ∀ x ∈ Ioo (-2 * 1 - 1 / 2 : ℝ) (2 * 1 + 1 / 2), h x ∈ Metric.ball (0 : ℝ) (2 * 1) ∧ + HasFDerivAt (fun y => h1ToyF (x, y)) (0 : ℝ →L[ℝ] ℝ) (h x)) ∧ + CapHyp h1ToyF (Icc (-2 * 1) (1 / 2) ×ˢ Metric.closedBall (0 : ℝ) (2 * 1)) (-1 / 2, 0) + (2 * 1, 0) (h1ToyF (-1 / 2, 0)) (h1ToyF (1 / 2, 0)) := by + have hDf : ∀ p : ℝ × ℝ, HasFDerivAt h1ToyF ((p.1 ^ 2 - 1 / 4) • ContinuousLinearMap.fst ℝ ℝ ℝ + + (-40 * p.2) • ContinuousLinearMap.snd ℝ ℝ ℝ) p := by + intro p + have hf : HasFDerivAt (fun q : ℝ × ℝ => q.1) (ContinuousLinearMap.fst ℝ ℝ ℝ) p := + hasFDerivAt_fst + have hs : HasFDerivAt (fun q : ℝ × ℝ => q.2) (ContinuousLinearMap.snd ℝ ℝ ℝ) p := + hasFDerivAt_snd + have h1 := HasFDerivAt.sub (HasFDerivAt.sub + (HasFDerivAt.const_mul (HasFDerivAt.pow hf 3) (1 / 3)) (HasFDerivAt.const_mul hf (1 / 4))) + (HasFDerivAt.const_mul (HasFDerivAt.pow hs 2) 20) + convert h1 using 1 + · funext q + simp only [h1ToyF, Pi.sub_apply] + ring + · ext <;> simp; ring + have hGs : ∀ p : ℝ × ℝ, HasStrictFDerivAt (fun q : ℝ × ℝ => ((q.1 ^ 2 - 1 / 4) • + ContinuousLinearMap.fst ℝ ℝ ℝ + (-40 * q.2) • ContinuousLinearMap.snd ℝ ℝ ℝ).comp + (ContinuousLinearMap.inr ℝ ℝ ℝ)) + (((-40 : ℝ) • ContinuousLinearMap.mul ℝ ℝ) ∘L ContinuousLinearMap.snd ℝ ℝ ℝ) p := by + intro p + convert (((-40 : ℝ) • ContinuousLinearMap.mul ℝ ℝ) ∘L + ContinuousLinearMap.snd ℝ ℝ ℝ).hasStrictFDerivAt (x := p) using 1 + funext q + ext + simp + have hH : ∀ p : ℝ × ℝ, HasFDerivAt (fun y => ((p.1 ^ 2 - 1 / 4) • ContinuousLinearMap.fst ℝ ℝ ℝ + + (-40 * y) • ContinuousLinearMap.snd ℝ ℝ ℝ).comp (ContinuousLinearMap.inr ℝ ℝ ℝ)) + ((-40 : ℝ) • ContinuousLinearMap.mul ℝ ℝ) p.2 := by + intro p + convert ((-40 : ℝ) • ContinuousLinearMap.mul ℝ ℝ).hasFDerivAt (x := p.2) using 1 + funext y + ext + simp + have hf : ∀ p : ℝ × ℝ, HasFDerivAt (fun q : ℝ × ℝ => q.1) (ContinuousLinearMap.fst ℝ ℝ ℝ) p := + fun p => hasFDerivAt_fst + have hs : ∀ p : ℝ × ℝ, HasFDerivAt (fun q : ℝ × ℝ => q.2) (ContinuousLinearMap.snd ℝ ℝ ℝ) p := + fun p => hasFDerivAt_snd + have hD2 : ∀ p : ℝ × ℝ, HasFDerivAt (fun q : ℝ × ℝ => (q.1 ^ 2 - 1 / 4) • + ContinuousLinearMap.fst ℝ ℝ ℝ + (-40 * q.2) • ContinuousLinearMap.snd ℝ ℝ ℝ) + (((2 * p.1) • ContinuousLinearMap.fst ℝ ℝ ℝ).smulRight (ContinuousLinearMap.fst ℝ ℝ ℝ) + + ((-40 : ℝ) • ContinuousLinearMap.snd ℝ ℝ ℝ).smulRight (ContinuousLinearMap.snd ℝ ℝ ℝ)) p := by + intro p + have h1 : HasFDerivAt (fun q : ℝ × ℝ => q.1 ^ 2 - 1 / 4) ((2 * p.1) • ContinuousLinearMap.fst ℝ ℝ ℝ) + p := by + have := (HasFDerivAt.pow (hf p) 2).sub_const (1 / 4) + convert this using 1 + ext <;> simp + have h2 : HasFDerivAt (fun q : ℝ × ℝ => -40 * q.2) ((-40 : ℝ) • ContinuousLinearMap.snd ℝ ℝ ℝ) p := + HasFDerivAt.const_mul (hs p) (-40) + exact (h1.smul_const (ContinuousLinearMap.fst ℝ ℝ ℝ)).add + (h2.smul_const (ContinuousLinearMap.snd ℝ ℝ ℝ)) + have hD3 : ∀ p : ℝ × ℝ, ∀ a b : ℝ × ℝ, HasFDerivAt (fun q : ℝ × ℝ => + ((((2 * q.1) • ContinuousLinearMap.fst ℝ ℝ ℝ).smulRight (ContinuousLinearMap.fst ℝ ℝ ℝ) + + ((-40 : ℝ) • ContinuousLinearMap.snd ℝ ℝ ℝ).smulRight (ContinuousLinearMap.snd ℝ ℝ ℝ)) a) b) + ((2 * a.1 * b.1) • ContinuousLinearMap.fst ℝ ℝ ℝ) p := by + intro p a b + have := (HasFDerivAt.const_mul (hf p) (2 * a.1 * b.1)).add_const (-40 * a.2 * b.2) + convert this using 1 + funext q + simp + ring + have hT : ∀ p : ℝ × ℝ, ∀ (s₁ s₂ s₃ : ℝ) (y₁ y₂ y₃ : ℝ), + |((2 * (s₁, y₁).1 * (s₂, y₂).1) • ContinuousLinearMap.fst ℝ ℝ ℝ) (s₃, y₃) - + s₁ * s₂ * s₃ * ((2 * ((1 : ℝ), (0 : ℝ)).1 * ((1 : ℝ), (0 : ℝ)).1) • + ContinuousLinearMap.fst ℝ ℝ ℝ) (1, 0)| ≤ + 2 * ((|s₁| + ‖y₁‖) * (|s₂| + ‖y₂‖) * (|s₃| + ‖y₃‖) - |s₁| * |s₂| * |s₃|) := by + intro p s₁ s₂ s₃ y₁ y₂ y₃ + have h0 : ((2 * (s₁, y₁).1 * (s₂, y₂).1) • ContinuousLinearMap.fst ℝ ℝ ℝ) (s₃, y₃) - + s₁ * s₂ * s₃ * ((2 * ((1 : ℝ), (0 : ℝ)).1 * ((1 : ℝ), (0 : ℝ)).1) • + ContinuousLinearMap.fst ℝ ℝ ℝ) (1, 0) = 0 := by + simp + ring + rw [h0, abs_zero] + have a1 : |s₁| ≤ |s₁| + ‖y₁‖ := le_add_of_nonneg_right (norm_nonneg _) + have a2 : |s₂| ≤ |s₂| + ‖y₂‖ := le_add_of_nonneg_right (norm_nonneg _) + have a3 : |s₃| ≤ |s₃| + ‖y₃‖ := le_add_of_nonneg_right (norm_nonneg _) + have := mul_le_mul (mul_le_mul a1 a2 (abs_nonneg _) (by positivity)) a3 (abs_nonneg _) + (by positivity) + linarith + have hsrc := ridge_capHyp_C4 (E := ℝ) (f := h1ToyF) + (Df := fun p => (p.1 ^ 2 - 1 / 4) • ContinuousLinearMap.fst ℝ ℝ ℝ + + (-40 * p.2) • ContinuousLinearMap.snd ℝ ℝ ℝ) + (D2f := fun p => ((2 * p.1) • ContinuousLinearMap.fst ℝ ℝ ℝ).smulRight + (ContinuousLinearMap.fst ℝ ℝ ℝ) + + ((-40 : ℝ) • ContinuousLinearMap.snd ℝ ℝ ℝ).smulRight (ContinuousLinearMap.snd ℝ ℝ ℝ)) + (T3 := fun _ a b => (2 * a.1 * b.1) • ContinuousLinearMap.fst ℝ ℝ ℝ) (Φ4 := fun _ => 0) (n := 0) + (DG := fun _ => ((-40 : ℝ) • ContinuousLinearMap.mul ℝ ℝ) ∘L ContinuousLinearMap.snd ℝ ℝ ℝ) + (H := fun _ => (-40 : ℝ) • ContinuousLinearMap.mul ℝ ℝ) (Hx := fun _ => 0) + (Hr := fun _ _ => 0) (r := 1) (m := 2) (lam := 40) (ε := 1 / 2) one_pos (by norm_num) + (by norm_num) (fun p _ => hDf p) (fun p _ => hD2 p) (fun p _ a b => hD3 p a b) + (fun p _ => hT p) (fun p _ => hasFDerivAt_const _ p) (fun p _ => by simp) (fun p _ => by simp) + (by norm_num) + (fun p _ => hGs p) (fun p _ => hH p) + (fun x _ => hasDerivAt_const x ((-40 : ℝ) • ContinuousLinearMap.mul ℝ ℝ)) + (fun x _ => by simp only [ContinuousLinearMap.opNorm_zero]; norm_num) + (fun p _ s _ => hasDerivAt_const s ((-40 : ℝ) • ContinuousLinearMap.mul ℝ ℝ)) + (fun p _ s _ => by simp only [ContinuousLinearMap.opNorm_zero]; positivity) + (fun v => by + simp only [smul_apply, ContinuousLinearMap.mul_apply', smul_eq_mul, Real.norm_eq_abs, sq_abs] + nlinarith [sq_nonneg v]) + (by norm_num) (by ext <;> norm_num) (by ext <;> norm_num) ?_ ?_ ?_ ?_ + (by simp only [h1ToyF]; norm_num) + · obtain ⟨hex, hcap⟩ := hsrc + have hcrit0 : ∀ x : ℝ, HasFDerivAt (fun y => h1ToyF (x, y)) (0 : ℝ →L[ℝ] ℝ) 0 := by + intro x + have := slice_hasFDerivAt (hDf (x, 0)) + convert this using 1 + ext + simp + obtain ⟨-, -, hC, -⟩ := hcap (fun _ => 0) (fun x _ => ⟨by simp, hcrit0 x⟩) + exact ⟨hex, hC⟩ + · have hc : ConvexOn ℝ univ (fun x : ℝ => (2 : ℝ) • x ^ 2 + (-1 / 4 : ℝ)) := + ((even_two.convexOn_pow).smul (by norm_num)).add (convexOn_const _ convex_univ) + refine (hc.subset (subset_univ _) (convex_Icc _ _)).congr ?_ + intro x _ + simp only [smul_eq_mul] + simp + ring + · refine (concaveOn_const (-1 / 4 : ℝ) (convex_Icc _ _)).congr ?_ + intro x _ + simp + ring + · intro v + have hc : ConvexOn ℝ univ (fun t : ℝ => ‖v‖ • t ^ 2) := + (even_two.convexOn_pow).smul (norm_nonneg v) + refine (hc.subset (subset_univ _) (convex_Icc _ _)).congr ?_ + intro t _ + simp only [smul_eq_mul] + simp + · intro v + have hc : ConcaveOn ℝ univ (fun t : ℝ => -(‖v‖ • t ^ 2)) := + ((even_two.convexOn_pow).smul (norm_nonneg v)).neg + refine (hc.subset (subset_univ _) (convex_Icc _ _)).congr ?_ + intro t _ + simp only [smul_eq_mul] + simp + +/-- **`ridge_capHyp_D` is not vacuous.** `h1ToyF` meets every hypothesis of `ridge_capHyp_D` with +`ε₀ = 1/2`. `T3` is constant, so `T4 = 0` and `K = 0`, and `|f_xxx| = 2 = m` on the pin segment. +The theorem chooses the collar width itself. It gives the ridge on `(−2 − ε, 2 + ε)` for some +`ε > 0` and the cap with `M = (−1/2, 0)`, from hypotheses on `D` and qualitative collar data only. -/ +theorem h1Toy_D : + (∃ ε > 0, ∃ h : ℝ → ℝ, ∀ x ∈ Ioo (-2 * 1 - ε : ℝ) (2 * 1 + ε), h x ∈ Metric.ball (0 : ℝ) (2 * 1) ∧ + HasFDerivAt (fun y => h1ToyF (x, y)) (0 : ℝ →L[ℝ] ℝ) (h x)) ∧ + CapHyp h1ToyF (Icc (-2 * 1) (1 / 2) ×ˢ Metric.closedBall (0 : ℝ) (2 * 1)) (-1 / 2, 0) + (2 * 1, 0) (h1ToyF (-1 / 2, 0)) (h1ToyF (1 / 2, 0)) := by + have hDf : ∀ p : ℝ × ℝ, HasFDerivAt h1ToyF ((p.1 ^ 2 - 1 / 4) • ContinuousLinearMap.fst ℝ ℝ ℝ + + (-40 * p.2) • ContinuousLinearMap.snd ℝ ℝ ℝ) p := by + intro p + have hf : HasFDerivAt (fun q : ℝ × ℝ => q.1) (ContinuousLinearMap.fst ℝ ℝ ℝ) p := + hasFDerivAt_fst + have hs : HasFDerivAt (fun q : ℝ × ℝ => q.2) (ContinuousLinearMap.snd ℝ ℝ ℝ) p := + hasFDerivAt_snd + have h1 := HasFDerivAt.sub (HasFDerivAt.sub + (HasFDerivAt.const_mul (HasFDerivAt.pow hf 3) (1 / 3)) (HasFDerivAt.const_mul hf (1 / 4))) + (HasFDerivAt.const_mul (HasFDerivAt.pow hs 2) 20) + convert h1 using 1 + · funext q + simp only [h1ToyF, Pi.sub_apply] + ring + · ext <;> simp; ring + have hGs : ∀ p : ℝ × ℝ, HasStrictFDerivAt (fun q : ℝ × ℝ => ((q.1 ^ 2 - 1 / 4) • + ContinuousLinearMap.fst ℝ ℝ ℝ + (-40 * q.2) • ContinuousLinearMap.snd ℝ ℝ ℝ).comp + (ContinuousLinearMap.inr ℝ ℝ ℝ)) + (((-40 : ℝ) • ContinuousLinearMap.mul ℝ ℝ) ∘L ContinuousLinearMap.snd ℝ ℝ ℝ) p := by + intro p + convert (((-40 : ℝ) • ContinuousLinearMap.mul ℝ ℝ) ∘L + ContinuousLinearMap.snd ℝ ℝ ℝ).hasStrictFDerivAt (x := p) using 1 + funext q + ext + simp + have hH : ∀ p : ℝ × ℝ, HasFDerivAt (fun y => ((p.1 ^ 2 - 1 / 4) • ContinuousLinearMap.fst ℝ ℝ ℝ + + (-40 * y) • ContinuousLinearMap.snd ℝ ℝ ℝ).comp (ContinuousLinearMap.inr ℝ ℝ ℝ)) + ((-40 : ℝ) • ContinuousLinearMap.mul ℝ ℝ) p.2 := by + intro p + convert ((-40 : ℝ) • ContinuousLinearMap.mul ℝ ℝ).hasFDerivAt (x := p.2) using 1 + funext y + ext + simp + have hf : ∀ p : ℝ × ℝ, HasFDerivAt (fun q : ℝ × ℝ => q.1) (ContinuousLinearMap.fst ℝ ℝ ℝ) p := + fun p => hasFDerivAt_fst + have hs : ∀ p : ℝ × ℝ, HasFDerivAt (fun q : ℝ × ℝ => q.2) (ContinuousLinearMap.snd ℝ ℝ ℝ) p := + fun p => hasFDerivAt_snd + have hD2 : ∀ p : ℝ × ℝ, HasFDerivAt (fun q : ℝ × ℝ => (q.1 ^ 2 - 1 / 4) • + ContinuousLinearMap.fst ℝ ℝ ℝ + (-40 * q.2) • ContinuousLinearMap.snd ℝ ℝ ℝ) + (((2 * p.1) • ContinuousLinearMap.fst ℝ ℝ ℝ).smulRight (ContinuousLinearMap.fst ℝ ℝ ℝ) + + ((-40 : ℝ) • ContinuousLinearMap.snd ℝ ℝ ℝ).smulRight (ContinuousLinearMap.snd ℝ ℝ ℝ)) p := by + intro p + have h1 : HasFDerivAt (fun q : ℝ × ℝ => q.1 ^ 2 - 1 / 4) ((2 * p.1) • ContinuousLinearMap.fst ℝ ℝ ℝ) + p := by + have := (HasFDerivAt.pow (hf p) 2).sub_const (1 / 4) + convert this using 1 + ext <;> simp + have h2 : HasFDerivAt (fun q : ℝ × ℝ => -40 * q.2) ((-40 : ℝ) • ContinuousLinearMap.snd ℝ ℝ ℝ) p := + HasFDerivAt.const_mul (hs p) (-40) + exact (h1.smul_const (ContinuousLinearMap.fst ℝ ℝ ℝ)).add + (h2.smul_const (ContinuousLinearMap.snd ℝ ℝ ℝ)) + have hD3 : ∀ p : ℝ × ℝ, ∀ a b : ℝ × ℝ, HasFDerivAt (fun q : ℝ × ℝ => + ((((2 * q.1) • ContinuousLinearMap.fst ℝ ℝ ℝ).smulRight (ContinuousLinearMap.fst ℝ ℝ ℝ) + + ((-40 : ℝ) • ContinuousLinearMap.snd ℝ ℝ ℝ).smulRight (ContinuousLinearMap.snd ℝ ℝ ℝ)) a) b) + ((2 * a.1 * b.1) • ContinuousLinearMap.fst ℝ ℝ ℝ) p := by + intro p a b + have := (HasFDerivAt.const_mul (hf p) (2 * a.1 * b.1)).add_const (-40 * a.2 * b.2) + convert this using 1 + funext q + simp + ring + have hT : ∀ p : ℝ × ℝ, ∀ (s₁ s₂ s₃ : ℝ) (y₁ y₂ y₃ : ℝ), + |((2 * (s₁, y₁).1 * (s₂, y₂).1) • ContinuousLinearMap.fst ℝ ℝ ℝ) (s₃, y₃) - + s₁ * s₂ * s₃ * ((2 * ((1 : ℝ), (0 : ℝ)).1 * ((1 : ℝ), (0 : ℝ)).1) • + ContinuousLinearMap.fst ℝ ℝ ℝ) (1, 0)| ≤ + 2 * ((|s₁| + ‖y₁‖) * (|s₂| + ‖y₂‖) * (|s₃| + ‖y₃‖) - |s₁| * |s₂| * |s₃|) := by + intro p s₁ s₂ s₃ y₁ y₂ y₃ + have h0 : ((2 * (s₁, y₁).1 * (s₂, y₂).1) • ContinuousLinearMap.fst ℝ ℝ ℝ) (s₃, y₃) - + s₁ * s₂ * s₃ * ((2 * ((1 : ℝ), (0 : ℝ)).1 * ((1 : ℝ), (0 : ℝ)).1) • + ContinuousLinearMap.fst ℝ ℝ ℝ) (1, 0) = 0 := by + simp + ring + rw [h0, abs_zero] + have a1 : |s₁| ≤ |s₁| + ‖y₁‖ := le_add_of_nonneg_right (norm_nonneg _) + have a2 : |s₂| ≤ |s₂| + ‖y₂‖ := le_add_of_nonneg_right (norm_nonneg _) + have a3 : |s₃| ≤ |s₃| + ‖y₃‖ := le_add_of_nonneg_right (norm_nonneg _) + have := mul_le_mul (mul_le_mul a1 a2 (abs_nonneg _) (by positivity)) a3 (abs_nonneg _) + (by positivity) + linarith + have hsrc := ridge_capHyp_D (E := ℝ) (f := h1ToyF) + (Df := fun p => (p.1 ^ 2 - 1 / 4) • ContinuousLinearMap.fst ℝ ℝ ℝ + + (-40 * p.2) • ContinuousLinearMap.snd ℝ ℝ ℝ) + (D2f := fun p => ((2 * p.1) • ContinuousLinearMap.fst ℝ ℝ ℝ).smulRight + (ContinuousLinearMap.fst ℝ ℝ ℝ) + + ((-40 : ℝ) • ContinuousLinearMap.snd ℝ ℝ ℝ).smulRight (ContinuousLinearMap.snd ℝ ℝ ℝ)) + (T3 := fun _ a b => (2 * a.1 * b.1) • ContinuousLinearMap.fst ℝ ℝ ℝ) + (T4 := fun _ _ _ _ => 0) (Φ4 := fun _ => 0) (n := 0) + (DG := fun _ => ((-40 : ℝ) • ContinuousLinearMap.mul ℝ ℝ) ∘L ContinuousLinearMap.snd ℝ ℝ ℝ) + (H := fun _ => (-40 : ℝ) • ContinuousLinearMap.mul ℝ ℝ) (Hx := fun _ => 0) + (Hr := fun _ _ => 0) (r := 1) (m := 2) (K := 0) (lam := 40) (ε₀ := 1 / 2) one_pos + (by norm_num) le_rfl + (fun p _ => hDf p) (fun p _ => hD2 p) (fun p _ a b => hD3 p a b) + (fun p _ a b c => hasDerivAt_const p.1 _) (fun p _ s₁ s₂ s₃ y₁ y₂ y₃ => by simp) + (fun p _ => hT p) (fun x _ => by simp) (fun p _ => hasFDerivAt_const _ p) (fun p _ => by simp) + (fun p _ => by simp) (by norm_num) + (fun p _ => hGs p) (fun p _ => hH p) + (fun x _ => hasDerivAt_const x ((-40 : ℝ) • ContinuousLinearMap.mul ℝ ℝ)) + (fun p _ s _ => hasDerivAt_const s ((-40 : ℝ) • ContinuousLinearMap.mul ℝ ℝ)) + (fun v => by + simp only [smul_apply, ContinuousLinearMap.mul_apply', smul_eq_mul, Real.norm_eq_abs, sq_abs] + nlinarith [sq_nonneg v]) + (by norm_num) (by ext <;> norm_num) (by ext <;> norm_num) + (by simp only [h1ToyF]; norm_num) + obtain ⟨ε, hε, -, hex, hcap⟩ := hsrc + have hcrit0 : ∀ x : ℝ, HasFDerivAt (fun y => h1ToyF (x, y)) (0 : ℝ →L[ℝ] ℝ) 0 := by + intro x + have := slice_hasFDerivAt (hDf (x, 0)) + convert this using 1 + ext + simp + obtain ⟨-, -, hC, -⟩ := hcap (fun _ => 0) (fun x _ => ⟨by simp, hcrit0 x⟩) + exact ⟨⟨ε, hε, hex⟩, hC⟩ + + +/-- **`ridge_capHyp_E` is not vacuous.** `h1ToyF` is a polynomial, so it is `C⁴` on `U = ℝ²`. +Its third derivative is `D³f[a, b, c] = 2 a.1 b.1 c.1` and its fourth derivative vanishes, so +`m = 2` and `n = 0`; `D²f[(0, v), (0, v)] = -40 v²` gives `λ = 40`. From these hypotheses on `D` +alone, the theorem gives the ridge on `(-2 - ε, 2 + ε)` for some `ε > 0` and the cap with +`M = (-1/2, 0)`. -/ +theorem h1Toy_E : + (∃ ε > 0, ∃ h : ℝ → ℝ, ∀ x ∈ Ioo (-2 * 1 - ε : ℝ) (2 * 1 + ε), h x ∈ Metric.ball (0 : ℝ) (2 * 1) ∧ + HasFDerivAt (fun y => h1ToyF (x, y)) (0 : ℝ →L[ℝ] ℝ) (h x)) ∧ + CapHyp h1ToyF (Icc (-2 * 1) (1 / 2) ×ˢ Metric.closedBall (0 : ℝ) (2 * 1)) (-1 / 2, 0) + (2 * 1, 0) (h1ToyF (-1 / 2, 0)) (h1ToyF (1 / 2, 0)) := by + have hf : ∀ p : ℝ × ℝ, HasFDerivAt (fun q : ℝ × ℝ => q.1) (ContinuousLinearMap.fst ℝ ℝ ℝ) p := + fun p => hasFDerivAt_fst + have hs : ∀ p : ℝ × ℝ, HasFDerivAt (fun q : ℝ × ℝ => q.2) (ContinuousLinearMap.snd ℝ ℝ ℝ) p := + fun p => hasFDerivAt_snd + have hDf : ∀ p : ℝ × ℝ, HasFDerivAt h1ToyF ((p.1 ^ 2 - 1 / 4) • ContinuousLinearMap.fst ℝ ℝ ℝ + + (-40 * p.2) • ContinuousLinearMap.snd ℝ ℝ ℝ) p := by + intro p + have h1 := HasFDerivAt.sub (HasFDerivAt.sub + (HasFDerivAt.const_mul (HasFDerivAt.pow (hf p) 3) (1 / 3)) + (HasFDerivAt.const_mul (hf p) (1 / 4))) + (HasFDerivAt.const_mul (HasFDerivAt.pow (hs p) 2) 20) + convert h1 using 1 + · funext q + simp only [h1ToyF, Pi.sub_apply] + ring + · ext <;> simp; ring + have hD2 : ∀ p : ℝ × ℝ, HasFDerivAt (fun q : ℝ × ℝ => (q.1 ^ 2 - 1 / 4) • + ContinuousLinearMap.fst ℝ ℝ ℝ + (-40 * q.2) • ContinuousLinearMap.snd ℝ ℝ ℝ) + (((2 * p.1) • ContinuousLinearMap.fst ℝ ℝ ℝ).smulRight (ContinuousLinearMap.fst ℝ ℝ ℝ) + + ((-40 : ℝ) • ContinuousLinearMap.snd ℝ ℝ ℝ).smulRight (ContinuousLinearMap.snd ℝ ℝ ℝ)) p := by + intro p + have h1 : HasFDerivAt (fun q : ℝ × ℝ => q.1 ^ 2 - 1 / 4) ((2 * p.1) • ContinuousLinearMap.fst ℝ ℝ ℝ) + p := by + have := (HasFDerivAt.pow (hf p) 2).sub_const (1 / 4) + convert this using 1 + ext <;> simp + have h2 : HasFDerivAt (fun q : ℝ × ℝ => -40 * q.2) ((-40 : ℝ) • ContinuousLinearMap.snd ℝ ℝ ℝ) p := + HasFDerivAt.const_mul (hs p) (-40) + exact (h1.smul_const (ContinuousLinearMap.fst ℝ ℝ ℝ)).add + (h2.smul_const (ContinuousLinearMap.snd ℝ ℝ ℝ)) + have hcd : ContDiff ℝ 4 h1ToyF := by unfold h1ToyF; fun_prop + have hfd : fderiv ℝ h1ToyF = fun p => (p.1 ^ 2 - 1 / 4) • ContinuousLinearMap.fst ℝ ℝ ℝ + + (-40 * p.2) • ContinuousLinearMap.snd ℝ ℝ ℝ := funext fun p => (hDf p).fderiv + have h2 : ∀ (y : ℝ × ℝ) (m : Fin 2 → ℝ × ℝ), + iteratedFDeriv ℝ 2 h1ToyF y m = 2 * y.1 * (m 0).1 * (m 1).1 - 40 * (m 0).2 * (m 1).2 := by + intro y m + rw [iteratedFDeriv_two_apply, hfd, (hD2 y).fderiv] + simp + ring + have h3 : ∀ (x : ℝ × ℝ) (m : Fin 3 → ℝ × ℝ), + iteratedFDeriv ℝ 3 h1ToyF x m = 2 * (m 0).1 * (m 1).1 * (m 2).1 := by + intro x m + rw [DifferentiableAt.iteratedFDeriv_succ_apply_left' + (hcd.contDiffAt.differentiableAt_iteratedFDeriv (by norm_num))] + have hg : HasFDerivAt (fun y => iteratedFDeriv ℝ 2 h1ToyF y (Fin.tail m)) + ((2 * (m 1).1 * (m 2).1) • ContinuousLinearMap.fst ℝ ℝ ℝ) x := by + have := ((hf x).const_mul (2 * (m 1).1 * (m 2).1)).sub_const (40 * (m 1).2 * (m 2).2) + convert this using 1 + funext y; rw [h2]; simp [Fin.tail]; ring + rw [hg.fderiv] + simp + ring + have h4 : ∀ (x : ℝ × ℝ) (m : Fin 4 → ℝ × ℝ), iteratedFDeriv ℝ 4 h1ToyF x m = 0 := by + intro x m + rw [DifferentiableAt.iteratedFDeriv_succ_apply_left' + (hcd.contDiffAt.differentiableAt_iteratedFDeriv (by norm_num))] + have hg : (fun y => iteratedFDeriv ℝ 3 h1ToyF y (Fin.tail m)) = + fun _ => 2 * (m 1).1 * (m 2).1 * (m 3).1 := by + funext y; rw [h3]; simp [Fin.tail] + rw [hg] + simp + have hsrc := ridge_capHyp_E (E := ℝ) (f := h1ToyF) (U := univ) (r := 1) (m := 2) (n := 0) + (lam := 40) one_pos isOpen_univ (subset_univ _) hcd.contDiffOn + (fun p _ s₁ s₂ s₃ y₁ y₂ y₃ => by + rw [h3, h3] + simp only [Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.cons_val_two, Matrix.tail_cons, + Matrix.head_cons] + have h0 : 2 * s₁ * s₂ * s₃ - s₁ * s₂ * s₃ * (2 * 1 * 1 * 1) = 0 := by ring + rw [h0, abs_zero] + exact mul_nonneg (by norm_num) (block_nonneg s₁ s₂ s₃ y₁ y₂ y₃)) + (fun x _ => by rw [h3]; simp) + (fun p _ => by rw [h4]; simp) + (fun p _ v => by rw [h4]; simp) + (by norm_num) + (fun v => by + rw [h2] + simp only [Matrix.cons_val_zero, Matrix.cons_val_one, Real.norm_eq_abs, sq_abs] + nlinarith [sq_nonneg v]) + (by norm_num) + (by rw [(hDf _).fderiv]; ext <;> norm_num) + (by rw [(hDf _).fderiv]; ext <;> norm_num) + (by simp only [h1ToyF]; norm_num) + obtain ⟨ε, hε, hex, hcap⟩ := hsrc + have hcrit0 : ∀ x : ℝ, HasFDerivAt (fun y => h1ToyF (x, y)) (0 : ℝ →L[ℝ] ℝ) 0 := by + intro x + have := slice_hasFDerivAt (hDf (x, 0)) + convert this using 1 + ext + simp + obtain ⟨-, -, hC, -⟩ := hcap (fun _ => 0) (fun x _ => ⟨by simp, hcrit0 x⟩) + exact ⟨⟨ε, hε, hex⟩, hC⟩ + + +/-- A pin-preserving quartic perturbation of `h1ToyF`: `q(x) = (x² - 1/4)²/480` vanishes to second +order at both pins, so they stay critical and the gap stays `1/6`, while `f_xxx = 2 + x/20` varies +and `D⁴f = 1/20 ≠ 0`. -/ +noncomputable def quarticToyF (p : ℝ × ℝ) : ℝ := + p.1 ^ 3 / 3 - p.1 / 4 - 20 * p.2 ^ 2 + (p.1 ^ 2 - 1 / 4) ^ 2 / 480 + +/-- **`ridge_capHyp_E` away from the degenerate face.** On `quarticToyF` the third derivative +`f_xxx = 2 + x/20` varies, the fourth derivative `D⁴f = 1/20` is nonzero, and (H2) holds with +equality, `rn = 1/20` (`r = 1`, `n = 1/20`); `|f_xxx| ≤ 81/40 = m` on the pin segment, and (H1) holds +as `8m² = 32.805 < 40 = λ`. So `fxxx_lower`'s estimate is used with `n > 0` and the collar bound +`K` is positive, unlike `h1Toy_E` (where `D⁴f = 0`). The theorem gives the ridge on +`(-2 - ε, 2 + ε)` for some `ε > 0` and the cap with `M = (-1/2, 0)`. -/ +theorem quarticToy_E : + (∃ ε > 0, ∃ h : ℝ → ℝ, ∀ x ∈ Ioo (-2 * 1 - ε : ℝ) (2 * 1 + ε), h x ∈ Metric.ball (0 : ℝ) (2 * 1) ∧ + HasFDerivAt (fun y => quarticToyF (x, y)) (0 : ℝ →L[ℝ] ℝ) (h x)) ∧ + CapHyp quarticToyF (Icc (-2 * 1) (1 / 2) ×ˢ Metric.closedBall (0 : ℝ) (2 * 1)) (-1 / 2, 0) + (2 * 1, 0) (quarticToyF (-1 / 2, 0)) (quarticToyF (1 / 2, 0)) := by + have hf : ∀ p : ℝ × ℝ, HasFDerivAt (fun q : ℝ × ℝ => q.1) (ContinuousLinearMap.fst ℝ ℝ ℝ) p := + fun p => hasFDerivAt_fst + have hs : ∀ p : ℝ × ℝ, HasFDerivAt (fun q : ℝ × ℝ => q.2) (ContinuousLinearMap.snd ℝ ℝ ℝ) p := + fun p => hasFDerivAt_snd + have hDf : ∀ p : ℝ × ℝ, HasFDerivAt quarticToyF + ((p.1 ^ 2 - 1 / 4 + (4 * p.1 ^ 3 - p.1) / 480) • ContinuousLinearMap.fst ℝ ℝ ℝ + + (-40 * p.2) • ContinuousLinearMap.snd ℝ ℝ ℝ) p := by + intro p + have h1 := HasFDerivAt.add (HasFDerivAt.sub (HasFDerivAt.sub + (HasFDerivAt.const_mul (HasFDerivAt.pow (hf p) 3) (1 / 3)) + (HasFDerivAt.const_mul (hf p) (1 / 4))) + (HasFDerivAt.const_mul (HasFDerivAt.pow (hs p) 2) 20)) + (HasFDerivAt.const_mul (HasFDerivAt.pow ((HasFDerivAt.pow (hf p) 2).sub_const (1 / 4)) 2) + (1 / 480)) + convert h1 using 1 + · funext q + simp only [quarticToyF, Pi.sub_apply, Pi.add_apply] + ring + · ext <;> simp <;> ring + have hD2 : ∀ p : ℝ × ℝ, HasFDerivAt (fun q : ℝ × ℝ => (q.1 ^ 2 - 1 / 4 + (4 * q.1 ^ 3 - q.1) / 480) • + ContinuousLinearMap.fst ℝ ℝ ℝ + (-40 * q.2) • ContinuousLinearMap.snd ℝ ℝ ℝ) + (((2 * p.1 + (12 * p.1 ^ 2 - 1) / 480) • ContinuousLinearMap.fst ℝ ℝ ℝ).smulRight + (ContinuousLinearMap.fst ℝ ℝ ℝ) + + ((-40 : ℝ) • ContinuousLinearMap.snd ℝ ℝ ℝ).smulRight (ContinuousLinearMap.snd ℝ ℝ ℝ)) p := by + intro p + have h1 : HasFDerivAt (fun q : ℝ × ℝ => q.1 ^ 2 - 1 / 4 + (4 * q.1 ^ 3 - q.1) / 480) + ((2 * p.1 + (12 * p.1 ^ 2 - 1) / 480) • ContinuousLinearMap.fst ℝ ℝ ℝ) p := by + have := ((HasFDerivAt.pow (hf p) 2).sub_const (1 / 4)).add + (HasFDerivAt.const_mul ((HasFDerivAt.const_mul (HasFDerivAt.pow (hf p) 3) 4).sub (hf p)) + (1 / 480)) + convert this using 1 <;> first | (funext q; simp; ring) | (ext <;> simp; ring) + have h2 : HasFDerivAt (fun q : ℝ × ℝ => -40 * q.2) ((-40 : ℝ) • ContinuousLinearMap.snd ℝ ℝ ℝ) p := + HasFDerivAt.const_mul (hs p) (-40) + exact (h1.smul_const (ContinuousLinearMap.fst ℝ ℝ ℝ)).add + (h2.smul_const (ContinuousLinearMap.snd ℝ ℝ ℝ)) + have hcd : ContDiff ℝ 4 quarticToyF := by unfold quarticToyF; fun_prop + have hfd : fderiv ℝ quarticToyF = fun p => (p.1 ^ 2 - 1 / 4 + (4 * p.1 ^ 3 - p.1) / 480) • + ContinuousLinearMap.fst ℝ ℝ ℝ + (-40 * p.2) • ContinuousLinearMap.snd ℝ ℝ ℝ := + funext fun p => (hDf p).fderiv + have h2 : ∀ (y : ℝ × ℝ) (m : Fin 2 → ℝ × ℝ), iteratedFDeriv ℝ 2 quarticToyF y m = + (2 * y.1 + (12 * y.1 ^ 2 - 1) / 480) * (m 0).1 * (m 1).1 - 40 * (m 0).2 * (m 1).2 := by + intro y m + rw [iteratedFDeriv_two_apply, hfd, (hD2 y).fderiv] + simp + ring + have h3 : ∀ (x : ℝ × ℝ) (m : Fin 3 → ℝ × ℝ), + iteratedFDeriv ℝ 3 quarticToyF x m = (2 + x.1 / 20) * (m 0).1 * (m 1).1 * (m 2).1 := by + intro x m + rw [DifferentiableAt.iteratedFDeriv_succ_apply_left' + (hcd.contDiffAt.differentiableAt_iteratedFDeriv (by norm_num))] + have hg : HasFDerivAt (fun y => iteratedFDeriv ℝ 2 quarticToyF y (Fin.tail m)) + (((2 + x.1 / 20) * (m 1).1 * (m 2).1) • ContinuousLinearMap.fst ℝ ℝ ℝ) x := by + have hp : HasFDerivAt (fun y : ℝ × ℝ => 2 * y.1 + (12 * y.1 ^ 2 - 1) / 480) + ((2 + x.1 / 20) • ContinuousLinearMap.fst ℝ ℝ ℝ) x := by + have := (HasFDerivAt.const_mul (hf x) 2).add + (HasFDerivAt.const_mul ((HasFDerivAt.const_mul (HasFDerivAt.pow (hf x) 2) 12).sub_const 1) + (1 / 480)) + convert this using 1 <;> first | (funext q; simp; ring) | (ext <;> simp; ring) + have := (hp.mul_const ((m 1).1 * (m 2).1)).sub_const (40 * (m 1).2 * (m 2).2) + convert this using 1 + · funext y; rw [h2]; simp [Fin.tail]; ring + · (ext <;> simp); ring + rw [hg.fderiv] + simp + ring + have h4 : ∀ (x : ℝ × ℝ) (m : Fin 4 → ℝ × ℝ), + iteratedFDeriv ℝ 4 quarticToyF x m = (1 / 20) * (m 0).1 * (m 1).1 * (m 2).1 * (m 3).1 := by + intro x m + rw [DifferentiableAt.iteratedFDeriv_succ_apply_left' + (hcd.contDiffAt.differentiableAt_iteratedFDeriv (by norm_num))] + have hg : HasFDerivAt (fun y => iteratedFDeriv ℝ 3 quarticToyF y (Fin.tail m)) + ((1 / 20 * (m 1).1 * (m 2).1 * (m 3).1) • ContinuousLinearMap.fst ℝ ℝ ℝ) x := by + have := (((hf x).const_mul (1 / 20)).const_add 2).mul_const ((m 1).1 * (m 2).1 * (m 3).1) + convert this using 1 + · funext y; rw [h3]; simp [Fin.tail]; ring + · (ext <;> simp); ring + rw [hg.fderiv] + simp + ring + have hsrc := ridge_capHyp_E (E := ℝ) (f := quarticToyF) (U := univ) (r := 1) (m := 81 / 40) + (n := 1 / 20) (lam := 40) one_pos isOpen_univ (subset_univ _) hcd.contDiffOn + (fun p _ s₁ s₂ s₃ y₁ y₂ y₃ => by + rw [h3, h3] + simp only [Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.cons_val_two, Matrix.tail_cons, + Matrix.head_cons] + have h0 : (2 + p.1 / 20) * s₁ * s₂ * s₃ - s₁ * s₂ * s₃ * ((2 + p.1 / 20) * 1 * 1 * 1) = 0 := by + ring + rw [h0, abs_zero] + exact mul_nonneg (by norm_num) (block_nonneg s₁ s₂ s₃ y₁ y₂ y₃)) + (fun x hx => by + rw [h3] + simp only [Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.cons_val_two, Matrix.tail_cons, + Matrix.head_cons, mul_one] + rw [abs_le] + constructor <;> linarith [hx.1, hx.2]) + (fun p _ => by rw [h4]; simp) + (fun p _ v => by rw [h4]; simp) + (by norm_num) + (fun v => by + rw [h2] + simp only [Matrix.cons_val_zero, Matrix.cons_val_one, Real.norm_eq_abs, sq_abs] + nlinarith [sq_nonneg v]) + (by norm_num) + (by rw [(hDf _).fderiv]; ext <;> norm_num) + (by rw [(hDf _).fderiv]; ext <;> norm_num) + (by simp only [quarticToyF]; norm_num) + obtain ⟨ε, hε, hex, hcap⟩ := hsrc + have hcrit0 : ∀ x : ℝ, HasFDerivAt (fun y => quarticToyF (x, y)) (0 : ℝ →L[ℝ] ℝ) 0 := by + intro x + have := slice_hasFDerivAt (hDf (x, 0)) + convert this using 1 + ext + simp + obtain ⟨-, -, hC, -⟩ := hcap (fun _ => 0) (fun x _ => ⟨by simp, hcrit0 x⟩) + exact ⟨⟨ε, hε, hex⟩, hC⟩ + +/-! ### v2.4: the cap on P §7's event `G_r`, for every pin gap `k > 0` + +P §7 (`imports/lifetime_parent_20260925/UNIFORM_MATRIX_CAP_AND_LIFETIME.md`) uses the deterministic +cap on `G_r = {λ_min(−A_M) > [4/(3k)] r M3², r M4 ≤ 3k/10}` with the pin gap `f(M) − f(S) = k r³`. +`ridge_capHyp_E` is the case `k = 1/6`. A positive factor `f ↦ c f` multiplies every derivative +bound and the transverse curvature by `c`, and changes neither the critical points nor the cap. -/ + +namespace CapHyp + +variable {f : X → ℝ} {C : Set X} {M z : X} {b s : ℝ} + +/-- A positive factor. A cap for `c f` at the levels `c b`, `c s` is a cap for `f` at `b`, `s`. -/ +theorem of_const_mul {c : ℝ} (hc : 0 < c) + (H : CapHyp (fun x => c * f x) C M z (c * b) (c * s)) : CapHyp f C M z b s where + mem := H.mem + ceiling x hx := le_of_mul_le_mul_left (H.ceiling x hx) hc + frontier_le x hx := le_of_mul_le_mul_left (H.frontier_le x hx) hc + older := lt_of_mul_lt_mul_left H.older hc.le + ridge := by + obtain ⟨γ, hγ⟩ := H.ridge + exact ⟨γ, fun t => le_of_mul_le_mul_left (hγ t) hc⟩ + +end CapHyp + +section GapK + +variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + +/-- A nonzero factor does not move the points where the derivative vanishes. -/ +theorem hasFDerivAt_zero_const_mul_iff {φ : E → ℝ} {c : ℝ} (hc : c ≠ 0) {y : E} : + HasFDerivAt (fun y => c * φ y) (0 : E →L[ℝ] ℝ) y ↔ HasFDerivAt φ (0 : E →L[ℝ] ℝ) y := by + constructor + · intro h + have h' := h.const_mul c⁻¹ + rw [smul_zero] at h' + exact h'.congr_of_eventuallyEq + (Filter.Eventually.of_forall fun y => (inv_mul_cancel_left₀ hc (φ y)).symm) + · intro h + have h' := h.const_mul c + rwa [smul_zero] at h' + +/-- On an open set where `f ∈ C⁴`, the derivatives of order `≤ 4` of `c f` are `c` times those of +`f`. -/ +theorem iteratedFDeriv_const_mul_of_isOpen {f : ℝ × E → ℝ} {U : Set (ℝ × E)} (hU : IsOpen U) + (hf : ContDiffOn ℝ 4 f U) (c : ℝ) {i : ℕ} (hi : i ≤ 4) {p : ℝ × E} (hp : p ∈ U) : + iteratedFDeriv ℝ i (fun q => c * f q) p = c • iteratedFDeriv ℝ i f p := by + have hfa : ContDiffAt ℝ i f p := + (hf.contDiffAt (hU.mem_nhds hp)).of_le (by exact_mod_cast hi) + exact iteratedFDeriv_const_smul_apply' (a := c) hfa + +/-- **The cap for every gap `k > 0`** (P §7's event `G_r`). With the pin gap +`f(M) − f(S) = k r³`, the hypotheses `(4/(3k)) r m² < λ` and `r n ≤ 3k/10` give the conclusion of +`ridge_capHyp_E`. That theorem is the case `k = 1/6`; the proof applies it to `f / (6k)`. -/ +theorem ridge_capHyp_K [FiniteDimensional ℝ E] {f : ℝ × E → ℝ} {U : Set (ℝ × E)} + {r k m n lam : ℝ} (hr : 0 < r) (hk : 0 < k) (hU : IsOpen U) + (hDU : Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r) ⊆ U) + (hf : ContDiffOn ℝ 4 f U) + (hT : ∀ p ∈ Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r), + ∀ (s₁ s₂ s₃ : ℝ) (y₁ y₂ y₃ : E), + |iteratedFDeriv ℝ 3 f p ![(s₁, y₁), (s₂, y₂), (s₃, y₃)] - + s₁ * s₂ * s₃ * iteratedFDeriv ℝ 3 f p ![(1, 0), (1, 0), (1, 0)]| ≤ + m * ((|s₁| + ‖y₁‖) * (|s₂| + ‖y₂‖) * (|s₃| + ‖y₃‖) - |s₁| * |s₂| * |s₃|)) + (hTe : ∀ x ∈ Icc (-r / 2) (r / 2), |iteratedFDeriv ℝ 3 f (x, 0) ![(1, 0), (1, 0), (1, 0)]| ≤ m) + (hn4x : ∀ p ∈ Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r), + |iteratedFDeriv ℝ 4 f p ![(1, 0), (1, 0), (1, 0), (1, 0)]| ≤ n) + (hn4y : ∀ p ∈ Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r), ∀ v : E, + |iteratedFDeriv ℝ 4 f p ![(0, v), (1, 0), (1, 0), (1, 0)]| ≤ n * ‖v‖) + (hH2 : r * n ≤ 3 * k / 10) + (hlam : ∀ v : E, iteratedFDeriv ℝ 2 f (-r / 2, 0) ![(0, v), (0, v)] ≤ -lam * ‖v‖ ^ 2) + (hH1 : 4 / (3 * k) * r * m ^ 2 < lam) + (hM : fderiv ℝ f (-r / 2, 0) = 0) (hS : fderiv ℝ f (r / 2, 0) = 0) + (hnorm : f (-r / 2, 0) - f (r / 2, 0) = k * r ^ 3) : + ∃ ε, 0 < ε ∧ + (∃ h : ℝ → E, ∀ x ∈ Ioo (-2 * r - ε) (2 * r + ε), h x ∈ Metric.ball (0 : E) (2 * r) ∧ + HasFDerivAt (fun y => f (x, y)) (0 : E →L[ℝ] ℝ) (h x)) ∧ + ∀ h : ℝ → E, (∀ x ∈ Ioo (-2 * r - ε) (2 * r + ε), + h x ∈ Metric.closedBall (0 : E) (2 * r) ∧ + HasFDerivAt (fun y => f (x, y)) (0 : E →L[ℝ] ℝ) (h x)) → + h (-r / 2) = 0 ∧ h (r / 2) = 0 ∧ + CapHyp f (Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r)) (-r / 2, 0) + (2 * r, h (2 * r)) (f (-r / 2, 0)) (f (r / 2, 0)) ∧ + ∀ x ∈ frontier (Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r)), + x ≠ (r / 2, 0) → f x < f (r / 2, 0) := by + obtain ⟨c, hc_def⟩ : ∃ c : ℝ, c = 1 / (6 * k) := ⟨_, rfl⟩ + have hk0 : k ≠ 0 := hk.ne' + have hc : 0 < c := by rw [hc_def]; positivity + have hD : ∀ p ∈ Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r), p ∈ U := + fun p hp => hDU hp + have hseg : ∀ x ∈ Icc (-r / 2) (r / 2), ((x, 0) : ℝ × E) ∈ U := by + intro x hx + apply hDU + refine ⟨⟨by linarith [hx.1], by linarith [hx.2]⟩, ?_⟩ + simp only [Metric.mem_closedBall, dist_self] + linarith + have hsc : ∀ {i : ℕ}, i ≤ 4 → ∀ p ∈ U, + iteratedFDeriv ℝ i (fun q => c * f q) p = c • iteratedFDeriv ℝ i f p := + fun hi p hp => iteratedFDeriv_const_mul_of_isOpen hU hf c hi hp + have hdiff : ∀ p ∈ U, DifferentiableAt ℝ f p := fun p hp => + (hf.contDiffAt (hU.mem_nhds hp)).differentiableAt (by norm_num) + have hMU : ((-r / 2, 0) : ℝ × E) ∈ U := hseg _ ⟨le_refl _, by linarith⟩ + have hSU : ((r / 2, 0) : ℝ × E) ∈ U := hseg _ ⟨by linarith, le_refl _⟩ + have key := ridge_capHyp_E (E := E) (f := fun q => c * f q) (U := U) (m := c * m) + (n := c * n) (lam := c * lam) hr hU hDU (contDiffOn_const.mul hf) + (fun p hp s₁ s₂ s₃ y₁ y₂ y₃ => by + rw [hsc (by norm_num) p (hD p hp)] + simp only [smul_apply, smul_eq_mul] + have h := hT p hp s₁ s₂ s₃ y₁ y₂ y₃ + generalize iteratedFDeriv ℝ 3 f p ![(s₁, y₁), (s₂, y₂), (s₃, y₃)] = A at h ⊢ + generalize iteratedFDeriv ℝ 3 f p ![(1, 0), (1, 0), (1, 0)] = B at h ⊢ + rw [show c * A - s₁ * s₂ * s₃ * (c * B) = c * (A - s₁ * s₂ * s₃ * B) by ring, abs_mul, + abs_of_pos hc, mul_assoc c m] + exact mul_le_mul_of_nonneg_left h hc.le) + (fun x hx => by + rw [hsc (by norm_num) _ (hseg x hx)] + simp only [smul_apply, smul_eq_mul] + rw [abs_mul, abs_of_pos hc] + exact mul_le_mul_of_nonneg_left (hTe x hx) hc.le) + (fun p hp => by + rw [hsc (by norm_num) p (hD p hp)] + simp only [smul_apply, smul_eq_mul] + rw [abs_mul, abs_of_pos hc] + exact mul_le_mul_of_nonneg_left (hn4x p hp) hc.le) + (fun p hp v => by + rw [hsc (by norm_num) p (hD p hp)] + simp only [smul_apply, smul_eq_mul] + rw [abs_mul, abs_of_pos hc, mul_assoc] + exact mul_le_mul_of_nonneg_left (hn4y p hp v) hc.le) + (by + rw [hc_def, show r * (1 / (6 * k) * n) = r * n / (6 * k) by ring, + div_le_iff₀ (by positivity)] + linarith) + (fun v => by + rw [hsc (by norm_num) _ hMU] + simp only [smul_apply, smul_eq_mul] + calc c * iteratedFDeriv ℝ 2 f (-r / 2, 0) ![(0, v), (0, v)] + ≤ c * (-lam * ‖v‖ ^ 2) := mul_le_mul_of_nonneg_left (hlam v) hc.le + _ = -(c * lam) * ‖v‖ ^ 2 := by ring) + (by + have h8 : 8 * r * (c * m) ^ 2 = c * (4 / (3 * k) * r * m ^ 2) := by + rw [hc_def]; field_simp; ring + rw [h8] + exact mul_lt_mul_of_pos_left hH1 hc) + (by rw [fderiv_const_mul (hdiff _ hMU) c, hM, smul_zero]) + (by rw [fderiv_const_mul (hdiff _ hSU) c, hS, smul_zero]) + (by + show c * f (-r / 2, 0) - c * f (r / 2, 0) = r ^ 3 / 6 + rw [← mul_sub, hnorm, hc_def] + field_simp) + obtain ⟨ε, hε, hex, hcap⟩ := key + refine ⟨ε, hε, ?_, ?_⟩ + · obtain ⟨h, hh⟩ := hex + exact ⟨h, fun x hx => ⟨(hh x hx).1, (hasFDerivAt_zero_const_mul_iff hc.ne').1 (hh x hx).2⟩⟩ + · intro h hh + obtain ⟨h1, h2, hC, hfr⟩ := hcap h fun x hx => + ⟨(hh x hx).1, (hasFDerivAt_zero_const_mul_iff hc.ne').2 (hh x hx).2⟩ + exact ⟨h1, h2, hC.of_const_mul hc, fun x hx hne => lt_of_mul_lt_mul_left (hfr x hx hne) hc.le⟩ + +/-- **P §7's `G_r` with operator norms.** If `‖D³f‖ ≤ M3` and `‖D⁴f‖ ≤ M4` on +`D = [−2r, 2r] × B̄(0, 2r)`, then `(4/(3k)) r M3² < λ` and `r M4 ≤ 3k/10` give the cap. Each +partial-block bound used by `ridge_capHyp_K` is at most the operator norm (`block_of_norm`). -/ +theorem ridge_capHyp_norm_K [FiniteDimensional ℝ E] {f : ℝ × E → ℝ} {U : Set (ℝ × E)} + {r k M3 M4 lam : ℝ} (hr : 0 < r) (hk : 0 < k) (hU : IsOpen U) + (hDU : Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r) ⊆ U) + (hf : ContDiffOn ℝ 4 f U) + (h3 : ∀ p ∈ Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r), + ‖iteratedFDeriv ℝ 3 f p‖ ≤ M3) + (h4 : ∀ p ∈ Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r), + ‖iteratedFDeriv ℝ 4 f p‖ ≤ M4) + (hH2 : r * M4 ≤ 3 * k / 10) + (hlam : ∀ v : E, iteratedFDeriv ℝ 2 f (-r / 2, 0) ![(0, v), (0, v)] ≤ -lam * ‖v‖ ^ 2) + (hH1 : 4 / (3 * k) * r * M3 ^ 2 < lam) + (hM : fderiv ℝ f (-r / 2, 0) = 0) (hS : fderiv ℝ f (r / 2, 0) = 0) + (hnorm : f (-r / 2, 0) - f (r / 2, 0) = k * r ^ 3) : + ∃ ε, 0 < ε ∧ + (∃ h : ℝ → E, ∀ x ∈ Ioo (-2 * r - ε) (2 * r + ε), h x ∈ Metric.ball (0 : E) (2 * r) ∧ + HasFDerivAt (fun y => f (x, y)) (0 : E →L[ℝ] ℝ) (h x)) ∧ + ∀ h : ℝ → E, (∀ x ∈ Ioo (-2 * r - ε) (2 * r + ε), + h x ∈ Metric.closedBall (0 : E) (2 * r) ∧ + HasFDerivAt (fun y => f (x, y)) (0 : E →L[ℝ] ℝ) (h x)) → + h (-r / 2) = 0 ∧ h (r / 2) = 0 ∧ + CapHyp f (Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r)) (-r / 2, 0) + (2 * r, h (2 * r)) (f (-r / 2, 0)) (f (r / 2, 0)) ∧ + ∀ x ∈ frontier (Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r)), + x ≠ (r / 2, 0) → f x < f (r / 2, 0) := by + have he : ‖((1 : ℝ), (0 : E))‖ = 1 := by simp [Prod.norm_def] + have hv : ∀ v : E, ‖((0 : ℝ), v)‖ = ‖v‖ := fun v => by simp [Prod.norm_def] + refine ridge_capHyp_K hr hk hU hDU hf + (fun p hp s₁ s₂ s₃ y₁ y₂ y₃ => block_of_norm (h3 p hp) s₁ s₂ s₃ y₁ y₂ y₃) + (fun x hx => ?_) (fun p hp => ?_) (fun p hp v => ?_) hH2 hlam hH1 hM hS hnorm + · have hp : ((x, 0) : ℝ × E) ∈ Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r) := by + refine ⟨⟨by linarith [hx.1], by linarith [hx.2]⟩, ?_⟩ + simp only [Metric.mem_closedBall, dist_self] + linarith + have h := (iteratedFDeriv ℝ 3 f (x, 0)).le_opNorm ![(1, 0), (1, 0), (1, 0)] + simp only [Fin.prod_univ_three, Matrix.cons_val_zero, Matrix.cons_val_one, + Matrix.cons_val_two, Matrix.tail_cons, Matrix.head_cons, he, mul_one] at h + rw [← Real.norm_eq_abs] + exact h.trans (h3 _ hp) + · have h := (iteratedFDeriv ℝ 4 f p).le_opNorm ![(1, 0), (1, 0), (1, 0), (1, 0)] + simp only [Fin.prod_univ_four, Matrix.cons_val_zero, Matrix.cons_val_one, + Matrix.cons_val_two, Matrix.cons_val_three, Matrix.tail_cons, Matrix.head_cons, he, + mul_one] at h + rw [← Real.norm_eq_abs] + exact h.trans (h4 p hp) + · have h := (iteratedFDeriv ℝ 4 f p).le_opNorm ![(0, v), (1, 0), (1, 0), (1, 0)] + simp only [Fin.prod_univ_four, Matrix.cons_val_zero, Matrix.cons_val_one, + Matrix.cons_val_two, Matrix.cons_val_three, Matrix.tail_cons, Matrix.head_cons, he, hv, + mul_one] at h + rw [← Real.norm_eq_abs] + exact h.trans (mul_le_mul_of_nonneg_right (h4 p hp) (norm_nonneg v)) + +end GapK + +/-! ### v2.5: CAP (1) in its own partial-block norms + +CAP §1 (`imports/lifetime_parent_20260925/MARKED_CYLINDER_CAP_PROOF.md`) states the deterministic +theorem with `M_j = max_{a+c=j} sup_D ‖∂_x^a D_y^c f‖_op` (`c` transverse Euclidean unit vectors, +chosen independently) and `λ = λ_min(−D_y² f(M))`, under (1): `λ > (4/(3κ)) r M_3²`, +`r M_4 ≤ 3κ/10`. `ridge_capHyp_K` takes the third derivative as one block inequality `hT`. +`block_of_partial` derives `hT` from CAP's partial blocks with `c = 1, 2, 3`, using the symmetry of +`D³f`, which holds for `f ∈ C³` (`iteratedFDeriv_three_swap₁₂`, `iteratedFDeriv_three_swap₂₃`). +`ridge_capHyp_blocks` then states the cap under CAP's hypotheses as written. -/ + +section PartialBlock + +open Filter Topology + +variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] + +/-- The third derivative of a `C³` function is symmetric in its first two slots: here +`D³f[a, b, c] = D²(Df)[a, b] c`, and `Df` has a symmetric second derivative. -/ +theorem iteratedFDeriv_three_swap₁₂ {f : F → ℝ} {p : F} (hf : ContDiffAt ℝ 3 f p) (a b c : F) : + iteratedFDeriv ℝ 3 f p ![a, b, c] = iteratedFDeriv ℝ 3 f p ![b, a, c] := by + have h2 : ContDiffAt ℝ 2 (fderiv ℝ f) p := hf.fderiv_right (by norm_num) + have hs : IsSymmSndFDerivAt ℝ (fderiv ℝ f) p := h2.isSymmSndFDerivAt (by simp) + have hr : ∀ x y : F, iteratedFDeriv ℝ 3 f p ![x, y, c] = + iteratedFDeriv ℝ 2 (fderiv ℝ f) p ![x, y] c := by + intro x y + rw [iteratedFDeriv_succ_apply_right] + have e : Fin.init ![x, y, c] = ![x, y] := by ext i; fin_cases i <;> rfl + rw [e] + rfl + rw [hr, hr, IsSymmSndFDerivAt.iteratedFDeriv_cons (hf := hs)] + +/-- The third derivative of a `C³` function is symmetric in its last two slots: here +`D³f[a, b, c] = (D(D²f)[a])[b, c]`, and `D²f` is symmetric on a neighbourhood of `p`, so its +derivative at `p` is symmetric too. -/ +theorem iteratedFDeriv_three_swap₂₃ {f : F → ℝ} {p : F} (hf : ContDiffAt ℝ 3 f p) (a b c : F) : + iteratedFDeriv ℝ 3 f p ![a, b, c] = iteratedFDeriv ℝ 3 f p ![a, c, b] := by + have hev : (fun q => iteratedFDeriv ℝ 2 f q ![b, c]) =ᶠ[𝓝 p] + (fun q => iteratedFDeriv ℝ 2 f q ![c, b]) := by + filter_upwards [hf.eventually (by simp)] with q hq + have hq2 : ContDiffAt ℝ 2 f q := hq.of_le (by norm_num) + exact IsSymmSndFDerivAt.iteratedFDeriv_cons (hf := hq2.isSymmSndFDerivAt (by simp)) + have hd : DifferentiableAt ℝ (iteratedFDeriv ℝ 2 f) p := + (hf.iteratedFDeriv_right (i := 2) (m := 1) (by norm_num)).differentiableAt (by norm_num) + have key : ∀ v : Fin 2 → F, fderiv ℝ (fun q => iteratedFDeriv ℝ 2 f q v) p a = + fderiv ℝ (iteratedFDeriv ℝ 2 f) p a v := by + intro v + have := ((ContinuousMultilinearMap.apply ℝ (fun _ : Fin 2 => F) ℝ v).hasFDerivAt.comp p + hd.hasFDerivAt).fderiv + rw [show (fun q => iteratedFDeriv ℝ 2 f q v) = + (ContinuousMultilinearMap.apply ℝ (fun _ : Fin 2 => F) ℝ v) ∘ iteratedFDeriv ℝ 2 f from rfl, + this] + rfl + rw [iteratedFDeriv_succ_apply_left, iteratedFDeriv_succ_apply_left] + have t1 : Fin.tail ![a, b, c] = ![b, c] := by ext i; fin_cases i <;> rfl + have t2 : Fin.tail ![a, c, b] = ![c, b] := by ext i; fin_cases i <;> rfl + simp only [Matrix.cons_val_zero, t1, t2] + rw [← key, ← key, hev.fderiv_eq] + +variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + +/-- **CAP's partial blocks give the block inequality.** For a symmetric trilinear form `B` on +`ℝ × E`, bounds by `m` on the three partial blocks with `c = 1, 2, 3` transverse slots, namely +`|B[(0, y), e, e]| ≤ m‖y‖`, `|B[(0, y₁), (0, y₂), e]| ≤ m‖y₁‖‖y₂‖` and +`|B[(0, y₁), (0, y₂), (0, y₃)]| ≤ m‖y₁‖‖y₂‖‖y₃‖` with `e = (1, 0)`, give the block inequality `hT` of +`ridge_capHyp_E` and `ridge_capHyp_K`. The proof expands `B[(s₁, y₁), (s₂, y₂), (s₃, y₃)]` +multilinearly: the seven mixed terms are partial blocks in some slot order, symmetry brings each to +the canonical order, and their bounds add up to `m(Π(|sᵢ| + ‖yᵢ‖) − Π|sᵢ|)`. No sign of `m` is +assumed. -/ +theorem block_of_partial {B : ContinuousMultilinearMap ℝ (fun _ : Fin 3 => ℝ × E) ℝ} {m : ℝ} + (hs₁₂ : ∀ a b c : ℝ × E, B ![a, b, c] = B ![b, a, c]) + (hs₂₃ : ∀ a b c : ℝ × E, B ![a, b, c] = B ![a, c, b]) + (k₁ : ∀ y : E, |B ![((0 : ℝ), y), (1, 0), (1, 0)]| ≤ m * ‖y‖) + (k₂ : ∀ y₁ y₂ : E, |B ![((0 : ℝ), y₁), (0, y₂), (1, 0)]| ≤ m * ‖y₁‖ * ‖y₂‖) + (k₃ : ∀ y₁ y₂ y₃ : E, |B ![((0 : ℝ), y₁), (0, y₂), (0, y₃)]| ≤ m * ‖y₁‖ * ‖y₂‖ * ‖y₃‖) + (s₁ s₂ s₃ : ℝ) (y₁ y₂ y₃ : E) : + |B ![(s₁, y₁), (s₂, y₂), (s₃, y₃)] - s₁ * s₂ * s₃ * B ![(1, 0), (1, 0), (1, 0)]| ≤ + m * ((|s₁| + ‖y₁‖) * (|s₂| + ‖y₂‖) * (|s₃| + ‖y₃‖) - |s₁| * |s₂| * |s₃|) := by + have hu0 : ∀ x b c z : ℝ × E, Function.update ![x, b, c] 0 z = ![z, b, c] := fun _ _ _ _ => by + funext i; fin_cases i <;> simp + have hu1 : ∀ a x c z : ℝ × E, Function.update ![a, x, c] 1 z = ![a, z, c] := fun _ _ _ _ => by + funext i; fin_cases i <;> simp + have hu2 : ∀ a b x z : ℝ × E, Function.update ![a, b, x] 2 z = ![a, b, z] := fun _ _ _ _ => by + funext i; fin_cases i <;> simp + have a₁ : ∀ x x' b c : ℝ × E, B ![x + x', b, c] = B ![x, b, c] + B ![x', b, c] := by + intro x x' b c + have := B.map_update_add ![x, b, c] 0 x x' + rwa [hu0, hu0, hu0] at this + have a₂ : ∀ a x x' c : ℝ × E, B ![a, x + x', c] = B ![a, x, c] + B ![a, x', c] := by + intro a x x' c + have := B.map_update_add ![a, x, c] 1 x x' + rwa [hu1, hu1, hu1] at this + have a₃ : ∀ a b x x' : ℝ × E, B ![a, b, x + x'] = B ![a, b, x] + B ![a, b, x'] := by + intro a b x x' + have := B.map_update_add ![a, b, x] 2 x x' + rwa [hu2, hu2, hu2] at this + have m₁ : ∀ (t : ℝ) (x b c : ℝ × E), B ![t • x, b, c] = t * B ![x, b, c] := by + intro t x b c + have := B.map_update_smul ![x, b, c] 0 t x + rwa [hu0, hu0, smul_eq_mul] at this + have m₂ : ∀ (t : ℝ) (a x c : ℝ × E), B ![a, t • x, c] = t * B ![a, x, c] := by + intro t a x c + have := B.map_update_smul ![a, x, c] 1 t x + rwa [hu1, hu1, smul_eq_mul] at this + have m₃ : ∀ (t : ℝ) (a b x : ℝ × E), B ![a, b, t • x] = t * B ![a, b, x] := by + intro t a b x + have := B.map_update_smul ![a, b, x] 2 t x + rwa [hu2, hu2, smul_eq_mul] at this + set e : ℝ × E := ((1 : ℝ), (0 : E)) with he_def + have hsp : ∀ (s : ℝ) (y : E), ((s, y) : ℝ × E) = s • e + ((0 : ℝ), y) := by + intro s y; ext <;> simp [he_def] + set P₁ := |s₁| + ‖y₁‖ + set P₂ := |s₂| + ‖y₂‖ + set P₃ := |s₃| + ‖y₃‖ + -- the multilinear expansion + have expand : B ![(s₁, y₁), (s₂, y₂), (s₃, y₃)] - s₁ * s₂ * s₃ * B ![e, e, e] = + (s₂ * s₃ * B ![((0 : ℝ), y₁), e, e] + s₂ * B ![((0 : ℝ), y₁), e, (0, y₃)] + + s₃ * B ![((0 : ℝ), y₁), (0, y₂), e] + B ![((0 : ℝ), y₁), (0, y₂), (0, y₃)]) + + (s₁ * s₃ * B ![e, ((0 : ℝ), y₂), e] + s₁ * B ![e, ((0 : ℝ), y₂), (0, y₃)]) + + s₁ * s₂ * B ![e, e, ((0 : ℝ), y₃)] := by + rw [hsp s₁ y₁, hsp s₂ y₂, hsp s₃ y₃] + simp only [a₁, a₂, a₃, m₁, m₂, m₃] + ring + rw [he_def] at expand ⊢ + rw [expand] + -- the seven partial blocks, brought to the canonical order by symmetry + have b₁ := k₁ y₁ + have b₂ : |B ![((0 : ℝ), y₁), (1, 0), (0, y₃)]| ≤ m * ‖y₁‖ * ‖y₃‖ := by + rw [hs₂₃]; exact k₂ y₁ y₃ + have b₃ := k₂ y₁ y₂ + have b₄ := k₃ y₁ y₂ y₃ + have b₅ : |B ![(1, 0), ((0 : ℝ), y₂), (1, 0)]| ≤ m * ‖y₂‖ := by + rw [hs₁₂]; exact k₁ y₂ + have b₆ : |B ![(1, 0), ((0 : ℝ), y₂), (0, y₃)]| ≤ m * ‖y₂‖ * ‖y₃‖ := by + rw [hs₁₂, hs₂₃]; exact k₂ y₂ y₃ + have b₇ : |B ![(1, 0), (1, 0), ((0 : ℝ), y₃)]| ≤ m * ‖y₃‖ := by + rw [hs₂₃, hs₁₂]; exact k₁ y₃ + have hP : m * (P₁ * P₂ * P₃ - |s₁| * |s₂| * |s₃|) = + (|s₂| * |s₃| * (m * ‖y₁‖) + |s₂| * (m * ‖y₁‖ * ‖y₃‖) + |s₃| * (m * ‖y₁‖ * ‖y₂‖) + + m * ‖y₁‖ * ‖y₂‖ * ‖y₃‖) + + (|s₁| * |s₃| * (m * ‖y₂‖) + |s₁| * (m * ‖y₂‖ * ‖y₃‖)) + |s₁| * |s₂| * (m * ‖y₃‖) := by + simp only [P₁, P₂, P₃]; ring + rw [hP] + refine (abs_add_le _ _).trans (add_le_add ((abs_add_le _ _).trans (add_le_add + ((abs_add_le _ _).trans (add_le_add ((abs_add_le _ _).trans (add_le_add + ((abs_add_le _ _).trans (add_le_add ?_ ?_)) ?_)) ?_)) ((abs_add_le _ _).trans + (add_le_add ?_ ?_)))) ?_) + · rw [abs_mul, abs_mul]; exact mul_le_mul_of_nonneg_left b₁ (by positivity) + · rw [abs_mul]; exact mul_le_mul_of_nonneg_left b₂ (abs_nonneg _) + · rw [abs_mul]; exact mul_le_mul_of_nonneg_left b₃ (abs_nonneg _) + · exact b₄ + · rw [abs_mul, abs_mul]; exact mul_le_mul_of_nonneg_left b₅ (by positivity) + · rw [abs_mul]; exact mul_le_mul_of_nonneg_left b₆ (abs_nonneg _) + · rw [abs_mul, abs_mul]; exact mul_le_mul_of_nonneg_left b₇ (by positivity) + +/-- **The cap under CAP (1) as written.** `f ∈ C⁴` on an open `U ⊇ D`; CAP's partial-block bounds +on `D` with `M3` for `c = 1, 2, 3` transverse slots, and for `c = 0` on the pin segment only (CAP +bounds it on all of `D`); the two partial blocks of the fourth derivative that the proof uses, +`c = 0` and `c = 1`, with `M4`; the transverse curvature `λ` at `M`; and (1), +`(4/(3k)) r M3² < λ` and `r M4 ≤ 3k/10`, for the pin gap `k r³`. The conclusion is that of +`ridge_capHyp_K`. -/ +theorem ridge_capHyp_blocks [FiniteDimensional ℝ E] {f : ℝ × E → ℝ} {U : Set (ℝ × E)} + {r k M3 M4 lam : ℝ} (hr : 0 < r) (hk : 0 < k) (hU : IsOpen U) + (hDU : Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r) ⊆ U) + (hf : ContDiffOn ℝ 4 f U) + (h30 : ∀ x ∈ Icc (-r / 2) (r / 2), |iteratedFDeriv ℝ 3 f (x, 0) ![(1, 0), (1, 0), (1, 0)]| ≤ M3) + (h31 : ∀ p ∈ Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r), ∀ y : E, + |iteratedFDeriv ℝ 3 f p ![(0, y), (1, 0), (1, 0)]| ≤ M3 * ‖y‖) + (h32 : ∀ p ∈ Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r), ∀ y₁ y₂ : E, + |iteratedFDeriv ℝ 3 f p ![(0, y₁), (0, y₂), (1, 0)]| ≤ M3 * ‖y₁‖ * ‖y₂‖) + (h33 : ∀ p ∈ Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r), ∀ y₁ y₂ y₃ : E, + |iteratedFDeriv ℝ 3 f p ![(0, y₁), (0, y₂), (0, y₃)]| ≤ M3 * ‖y₁‖ * ‖y₂‖ * ‖y₃‖) + (h40 : ∀ p ∈ Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r), + |iteratedFDeriv ℝ 4 f p ![(1, 0), (1, 0), (1, 0), (1, 0)]| ≤ M4) + (h41 : ∀ p ∈ Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r), ∀ v : E, + |iteratedFDeriv ℝ 4 f p ![(0, v), (1, 0), (1, 0), (1, 0)]| ≤ M4 * ‖v‖) + (hlam : ∀ v : E, iteratedFDeriv ℝ 2 f (-r / 2, 0) ![(0, v), (0, v)] ≤ -lam * ‖v‖ ^ 2) + (hH1 : 4 / (3 * k) * r * M3 ^ 2 < lam) (hH2 : r * M4 ≤ 3 * k / 10) + (hM : fderiv ℝ f (-r / 2, 0) = 0) (hS : fderiv ℝ f (r / 2, 0) = 0) + (hnorm : f (-r / 2, 0) - f (r / 2, 0) = k * r ^ 3) : + ∃ ε, 0 < ε ∧ + (∃ h : ℝ → E, ∀ x ∈ Ioo (-2 * r - ε) (2 * r + ε), h x ∈ Metric.ball (0 : E) (2 * r) ∧ + HasFDerivAt (fun y => f (x, y)) (0 : E →L[ℝ] ℝ) (h x)) ∧ + ∀ h : ℝ → E, (∀ x ∈ Ioo (-2 * r - ε) (2 * r + ε), + h x ∈ Metric.closedBall (0 : E) (2 * r) ∧ + HasFDerivAt (fun y => f (x, y)) (0 : E →L[ℝ] ℝ) (h x)) → + h (-r / 2) = 0 ∧ h (r / 2) = 0 ∧ + CapHyp f (Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r)) (-r / 2, 0) + (2 * r, h (2 * r)) (f (-r / 2, 0)) (f (r / 2, 0)) ∧ + ∀ x ∈ frontier (Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r)), + x ≠ (r / 2, 0) → f x < f (r / 2, 0) := by + refine ridge_capHyp_K hr hk hU hDU hf (fun p hp s₁ s₂ s₃ y₁ y₂ y₃ => ?_) h30 h40 h41 hH2 hlam + hH1 hM hS hnorm + have hp3 : ContDiffAt ℝ 3 f p := (hf.contDiffAt (hU.mem_nhds (hDU hp))).of_le (by norm_num) + exact block_of_partial (iteratedFDeriv_three_swap₁₂ hp3) (iteratedFDeriv_three_swap₂₃ hp3) + (h31 p hp) (h32 p hp) (h33 p hp) s₁ s₂ s₃ y₁ y₂ y₃ + +end PartialBlock + +/-- A toy with a nonzero mixed block. `x³/3 − x/4 − 20y²` plus `xy²`: the pins and the gap `1/6` are +unchanged, and `∂_x D_y² f = 2`. -/ +noncomputable def mixedToyF (p : ℝ × ℝ) : ℝ := + p.1 ^ 3 / 3 - p.1 / 4 - 20 * p.2 ^ 2 + p.1 * p.2 ^ 2 + +/-- **`ridge_capHyp_blocks` with a nonzero mixed block.** On `mixedToyF` the partial blocks of +`D³f` are `2` (`c = 0`), `0` (`c = 1`), `2` (`c = 2`, the mixed block `∂_x D_y² f`) and `0` +(`c = 3`), so `M3 = 2`; `D⁴f = 0`, so `M4 = 0`; and `λ = 41`. CAP (1) holds with `k = 1/6`, `r = 1`: +`8 M3² = 32 < 41` and `r M4 = 0 ≤ 1/20`. Unlike `h1Toy_E` and `quarticToy_E`, the block inequality +`hT` is not trivial here, since the mixed terms of `D³f` do not vanish. -/ +theorem mixedToy_blocks : + (∃ ε > 0, ∃ h : ℝ → ℝ, ∀ x ∈ Ioo (-2 * 1 - ε : ℝ) (2 * 1 + ε), h x ∈ Metric.ball (0 : ℝ) (2 * 1) ∧ + HasFDerivAt (fun y => mixedToyF (x, y)) (0 : ℝ →L[ℝ] ℝ) (h x)) ∧ + CapHyp mixedToyF (Icc (-2 * 1) (1 / 2) ×ˢ Metric.closedBall (0 : ℝ) (2 * 1)) (-1 / 2, 0) + (2 * 1, 0) (mixedToyF (-1 / 2, 0)) (mixedToyF (1 / 2, 0)) := by + have hf : ∀ p : ℝ × ℝ, HasFDerivAt (fun q : ℝ × ℝ => q.1) (ContinuousLinearMap.fst ℝ ℝ ℝ) p := + fun p => hasFDerivAt_fst + have hs : ∀ p : ℝ × ℝ, HasFDerivAt (fun q : ℝ × ℝ => q.2) (ContinuousLinearMap.snd ℝ ℝ ℝ) p := + fun p => hasFDerivAt_snd + have hDf : ∀ p : ℝ × ℝ, HasFDerivAt mixedToyF + ((p.1 ^ 2 - 1 / 4 + p.2 ^ 2) • ContinuousLinearMap.fst ℝ ℝ ℝ + + (-40 * p.2 + 2 * p.1 * p.2) • ContinuousLinearMap.snd ℝ ℝ ℝ) p := by + intro p + have h1 := HasFDerivAt.add (HasFDerivAt.sub (HasFDerivAt.sub + (HasFDerivAt.const_mul (HasFDerivAt.pow (hf p) 3) (1 / 3)) + (HasFDerivAt.const_mul (hf p) (1 / 4))) + (HasFDerivAt.const_mul (HasFDerivAt.pow (hs p) 2) 20)) + (HasFDerivAt.mul (hf p) (HasFDerivAt.pow (hs p) 2)) + convert h1 using 1 + · funext q + simp only [mixedToyF, Pi.sub_apply, Pi.add_apply, Pi.mul_apply] + ring + · ext <;> simp + ring + have hD2 : ∀ p : ℝ × ℝ, HasFDerivAt (fun q : ℝ × ℝ => (q.1 ^ 2 - 1 / 4 + q.2 ^ 2) • + ContinuousLinearMap.fst ℝ ℝ ℝ + (-40 * q.2 + 2 * q.1 * q.2) • ContinuousLinearMap.snd ℝ ℝ ℝ) + (((2 * p.1) • ContinuousLinearMap.fst ℝ ℝ ℝ + (2 * p.2) • ContinuousLinearMap.snd ℝ ℝ ℝ).smulRight + (ContinuousLinearMap.fst ℝ ℝ ℝ) + + ((2 * p.2) • ContinuousLinearMap.fst ℝ ℝ ℝ + + (-40 + 2 * p.1) • ContinuousLinearMap.snd ℝ ℝ ℝ).smulRight + (ContinuousLinearMap.snd ℝ ℝ ℝ)) p := by + intro p + have h1 : HasFDerivAt (fun q : ℝ × ℝ => q.1 ^ 2 - 1 / 4 + q.2 ^ 2) + ((2 * p.1) • ContinuousLinearMap.fst ℝ ℝ ℝ + (2 * p.2) • ContinuousLinearMap.snd ℝ ℝ ℝ) p := by + have := ((HasFDerivAt.pow (hf p) 2).sub_const (1 / 4)).add (HasFDerivAt.pow (hs p) 2) + convert this using 1 + ext <;> simp + have h2 : HasFDerivAt (fun q : ℝ × ℝ => -40 * q.2 + 2 * q.1 * q.2) + ((2 * p.2) • ContinuousLinearMap.fst ℝ ℝ ℝ + (-40 + 2 * p.1) • ContinuousLinearMap.snd ℝ ℝ ℝ) + p := by + have := (HasFDerivAt.const_mul (hs p) (-40)).add + ((HasFDerivAt.const_mul (hf p) 2).mul (hs p)) + convert this using 1 + ext <;> simp + ring + exact (h1.smul_const (ContinuousLinearMap.fst ℝ ℝ ℝ)).add + (h2.smul_const (ContinuousLinearMap.snd ℝ ℝ ℝ)) + have hcd : ContDiff ℝ 4 mixedToyF := by unfold mixedToyF; fun_prop + have hfd : fderiv ℝ mixedToyF = fun p => (p.1 ^ 2 - 1 / 4 + p.2 ^ 2) • + ContinuousLinearMap.fst ℝ ℝ ℝ + (-40 * p.2 + 2 * p.1 * p.2) • ContinuousLinearMap.snd ℝ ℝ ℝ := + funext fun p => (hDf p).fderiv + have h2 : ∀ (y : ℝ × ℝ) (m : Fin 2 → ℝ × ℝ), iteratedFDeriv ℝ 2 mixedToyF y m = + 2 * y.1 * (m 0).1 * (m 1).1 + 2 * y.2 * ((m 0).1 * (m 1).2 + (m 0).2 * (m 1).1) + + (-40 + 2 * y.1) * (m 0).2 * (m 1).2 := by + intro y m + rw [iteratedFDeriv_two_apply, hfd, (hD2 y).fderiv] + simp + ring + have h3 : ∀ (x : ℝ × ℝ) (m : Fin 3 → ℝ × ℝ), iteratedFDeriv ℝ 3 mixedToyF x m = + 2 * (m 0).1 * (m 1).1 * (m 2).1 + 2 * (m 0).2 * ((m 1).1 * (m 2).2 + (m 1).2 * (m 2).1) + + 2 * (m 0).1 * (m 1).2 * (m 2).2 := by + intro x m + rw [DifferentiableAt.iteratedFDeriv_succ_apply_left' + (hcd.contDiffAt.differentiableAt_iteratedFDeriv (by norm_num))] + have hg : HasFDerivAt (fun y => iteratedFDeriv ℝ 2 mixedToyF y (Fin.tail m)) + ((2 * (m 1).1 * (m 2).1 + 2 * (m 1).2 * (m 2).2) • ContinuousLinearMap.fst ℝ ℝ ℝ + + (2 * ((m 1).1 * (m 2).2 + (m 1).2 * (m 2).1)) • ContinuousLinearMap.snd ℝ ℝ ℝ) x := by + have := (((2 * (m 1).1 * (m 2).1 + 2 * (m 1).2 * (m 2).2) • ContinuousLinearMap.fst ℝ ℝ ℝ + + (2 * ((m 1).1 * (m 2).2 + (m 1).2 * (m 2).1)) • + ContinuousLinearMap.snd ℝ ℝ ℝ).hasFDerivAt (x := x)).add_const (-40 * (m 1).2 * (m 2).2) + convert this using 1 + funext y; rw [h2]; simp [Fin.tail]; ring + rw [hg.fderiv] + simp + ring + have h4 : ∀ (x : ℝ × ℝ) (m : Fin 4 → ℝ × ℝ), iteratedFDeriv ℝ 4 mixedToyF x m = 0 := by + intro x m + rw [DifferentiableAt.iteratedFDeriv_succ_apply_left' + (hcd.contDiffAt.differentiableAt_iteratedFDeriv (by norm_num))] + have hc : (fun y => iteratedFDeriv ℝ 3 mixedToyF y (Fin.tail m)) = + fun _ => iteratedFDeriv ℝ 3 mixedToyF x (Fin.tail m) := by + funext y; rw [h3, h3] + have hg : HasFDerivAt (fun y => iteratedFDeriv ℝ 3 mixedToyF y (Fin.tail m)) + (0 : ℝ × ℝ →L[ℝ] ℝ) x := by + rw [hc]; exact hasFDerivAt_const _ _ + rw [hg.fderiv] + simp + have hsrc := ridge_capHyp_blocks (E := ℝ) (f := mixedToyF) (U := univ) (r := 1) (k := 1 / 6) + (M3 := 2) (M4 := 0) (lam := 41) one_pos (by norm_num) isOpen_univ (subset_univ _) + hcd.contDiffOn + (fun x _ => by rw [h3]; simp) + (fun p _ y => by rw [h3]; simp) + (fun p _ y₁ y₂ => by + rw [h3] + simp only [Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.cons_val_two, Matrix.tail_cons, + Matrix.head_cons, Real.norm_eq_abs] + rw [show (2 * (0 : ℝ) * 0 * 1 + 2 * y₁ * (0 * 0 + y₂ * 1) + 2 * 0 * y₂ * 0) = 2 * (y₁ * y₂) by + ring, abs_mul, abs_mul] + norm_num [mul_assoc]) + (fun p _ y₁ y₂ y₃ => by + rw [h3] + simp only [Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.cons_val_two, Matrix.tail_cons, + Matrix.head_cons, Real.norm_eq_abs] + rw [show (2 * (0 : ℝ) * 0 * 0 + 2 * y₁ * (0 * y₃ + y₂ * 0) + 2 * 0 * y₂ * y₃) = 0 by ring, + abs_zero] + positivity) + (fun p _ => by rw [h4]; simp) + (fun p _ v => by rw [h4]; simp) + (fun v => by + rw [h2] + simp only [Matrix.cons_val_zero, Matrix.cons_val_one, Real.norm_eq_abs, sq_abs] + nlinarith [sq_nonneg v]) + (by norm_num) (by norm_num) + (by rw [(hDf _).fderiv]; ext <;> norm_num) + (by rw [(hDf _).fderiv]; ext <;> norm_num) + (by simp only [mixedToyF]; norm_num) + obtain ⟨ε, hε, hex, hcap⟩ := hsrc + have hcrit0 : ∀ x : ℝ, HasFDerivAt (fun y => mixedToyF (x, y)) (0 : ℝ →L[ℝ] ℝ) 0 := by + intro x + have := slice_hasFDerivAt (hDf (x, 0)) + convert this using 1 + ext + simp + obtain ⟨-, -, hC, -⟩ := hcap (fun _ => 0) (fun x _ => ⟨by simp, hcrit0 x⟩) + exact ⟨⟨ε, hε, hex⟩, hC⟩ + +/-! ### v2.6: the cap and the elder death level on the torus, under CAP (1) + +P §7 applies the cap theorem to the periodic lift of the field on `(ℝ/Lℤ)^d`, in a contact frame +whose first axis joins the pins. `torus_capHyp_blocks` composes `ridge_capHyp_blocks` (v2.5) with +`CapHyp.toTorus` and `CapHyp.map_saddle` for any frame `φ : ℝ × E ≃ₜ ℝ^d`. Then +`torus_elder_death_level_blocks` adds `elder_death_level_peak` on the torus, which is compact +(`L > 0`) and locally connected (`torus_locallyConnectedSpace`). `torusToy_elder` instantiates it +on `(ℝ/16ℤ)²`. -/ + +/-- The circle `ℝ/Lℤ` is locally connected: its topology is coinduced by the covering map from +`ℝ`, and local connectedness passes to coinduced topologies. -/ +theorem addCircle_locallyConnectedSpace (L : ℝ) : LocallyConnectedSpace (AddCircle L) := + (QuotientAddGroup.isQuotientMap_mk (AddSubgroup.zmultiples L)).isCoinducing.locallyConnectedSpace + +/-- The torus `(ℝ/Lℤ)^d` is locally connected: a finite product of locally connected spaces. -/ +theorem torus_locallyConnectedSpace (L : ℝ) (d : ℕ) : + LocallyConnectedSpace (Fin d → AddCircle L) := + haveI := addCircle_locallyConnectedSpace L + Pi.locallyConnectedSpace_of_finite_not_preconnectedSpace (Set.toFinite _) + +section Torus + +variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + +/-- **The cap on the torus under CAP (1).** Let `φ : ℝ × E ≃ₜ ℝ^d` be any frame and let +`g = f ∘ torusCover L d ∘ φ` be the lift of a function `f` on the torus `(ℝ/Lℤ)^d`. If `g` meets +the hypotheses of `ridge_capHyp_blocks` (CAP §1's (1) with its partial-block norms, in the frame +`φ`), then `f` satisfies (C1)–(C3) on the image of the cap in the torus, with `M` and `S` the images +of the pins, and (C2⁺): every other frontier point of the image is strictly below `f(S)`. -/ +theorem torus_capHyp_blocks [FiniteDimensional ℝ E] {L : ℝ} {d : ℕ} + (φ : ℝ × E ≃ₜ (Fin d → ℝ)) {f : (Fin d → AddCircle L) → ℝ} {g : ℝ × E → ℝ} + (hg : ∀ p, g p = f (torusCover L d (φ p))) {U : Set (ℝ × E)} + {r k M3 M4 lam : ℝ} (hr : 0 < r) (hk : 0 < k) (hU : IsOpen U) + (hDU : Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r) ⊆ U) + (hf : ContDiffOn ℝ 4 g U) + (h30 : ∀ x ∈ Icc (-r / 2) (r / 2), |iteratedFDeriv ℝ 3 g (x, 0) ![(1, 0), (1, 0), (1, 0)]| ≤ M3) + (h31 : ∀ p ∈ Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r), ∀ y : E, + |iteratedFDeriv ℝ 3 g p ![(0, y), (1, 0), (1, 0)]| ≤ M3 * ‖y‖) + (h32 : ∀ p ∈ Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r), ∀ y₁ y₂ : E, + |iteratedFDeriv ℝ 3 g p ![(0, y₁), (0, y₂), (1, 0)]| ≤ M3 * ‖y₁‖ * ‖y₂‖) + (h33 : ∀ p ∈ Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r), ∀ y₁ y₂ y₃ : E, + |iteratedFDeriv ℝ 3 g p ![(0, y₁), (0, y₂), (0, y₃)]| ≤ M3 * ‖y₁‖ * ‖y₂‖ * ‖y₃‖) + (h40 : ∀ p ∈ Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r), + |iteratedFDeriv ℝ 4 g p ![(1, 0), (1, 0), (1, 0), (1, 0)]| ≤ M4) + (h41 : ∀ p ∈ Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r), ∀ v : E, + |iteratedFDeriv ℝ 4 g p ![(0, v), (1, 0), (1, 0), (1, 0)]| ≤ M4 * ‖v‖) + (hlam : ∀ v : E, iteratedFDeriv ℝ 2 g (-r / 2, 0) ![(0, v), (0, v)] ≤ -lam * ‖v‖ ^ 2) + (hH1 : 4 / (3 * k) * r * M3 ^ 2 < lam) (hH2 : r * M4 ≤ 3 * k / 10) + (hM : fderiv ℝ g (-r / 2, 0) = 0) (hS : fderiv ℝ g (r / 2, 0) = 0) + (hnorm : g (-r / 2, 0) - g (r / 2, 0) = k * r ^ 3) : + ∃ z, CapHyp f ((torusCover L d ∘ φ) '' (Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r))) + (torusCover L d (φ (-r / 2, 0))) z (f (torusCover L d (φ (-r / 2, 0)))) + (f (torusCover L d (φ (r / 2, 0)))) ∧ + ∀ x ∈ frontier ((torusCover L d ∘ φ) '' + (Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r))), + x ≠ torusCover L d (φ (r / 2, 0)) → f x < f (torusCover L d (φ (r / 2, 0))) := by + obtain ⟨ε, -, ⟨h0, hh0⟩, hall⟩ := ridge_capHyp_blocks hr hk hU hDU hf h30 h31 h32 h33 h40 h41 + hlam hH1 hH2 hM hS hnorm + obtain ⟨-, -, hC, hSf⟩ := hall h0 fun x hx => ⟨Metric.ball_subset_closedBall (hh0 x hx).1, + (hh0 x hx).2⟩ + have hgf : g = f ∘ (torusCover L d ∘ φ) := funext hg + subst hgf + have hK : IsCompact (Icc (-2 * r) (r / 2) ×ˢ Metric.closedBall (0 : E) (2 * r)) := + isCompact_Icc.prod (isCompact_closedBall 0 (2 * r)) + exact ⟨_, hC.toTorus φ hK, CapHyp.map_saddle ((torusCover_continuous L d).comp φ.continuous) + ((torusCover_isOpenMap L d).comp φ.isOpenMap) hK hSf⟩ + +/-- **The elder death level on the torus under CAP (1).** For `L > 0` and a continuous `f` on +`(ℝ/Lℤ)^d` whose lift in the frame `φ` meets CAP §1's (1), the largest level at which the +component of the image of `M` contains a strictly higher local maximum is `f` at the image of `S`. +This is `elder_death_level_peak` on the torus, which is compact and locally connected. -/ +theorem torus_elder_death_level_blocks [FiniteDimensional ℝ E] {L : ℝ} [Fact (0 < L)] {d : ℕ} + (φ : ℝ × E ≃ₜ (Fin d → ℝ)) {f : (Fin d → AddCircle L) → ℝ} (hfc : Continuous f) + {g : ℝ × E → ℝ} (hg : ∀ p, g p = f (torusCover L d (φ p))) {U : Set (ℝ × E)} + {r k M3 M4 lam : ℝ} (hr : 0 < r) (hk : 0 < k) (hU : IsOpen U) + (hDU : Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r) ⊆ U) + (hf : ContDiffOn ℝ 4 g U) + (h30 : ∀ x ∈ Icc (-r / 2) (r / 2), |iteratedFDeriv ℝ 3 g (x, 0) ![(1, 0), (1, 0), (1, 0)]| ≤ M3) + (h31 : ∀ p ∈ Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r), ∀ y : E, + |iteratedFDeriv ℝ 3 g p ![(0, y), (1, 0), (1, 0)]| ≤ M3 * ‖y‖) + (h32 : ∀ p ∈ Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r), ∀ y₁ y₂ : E, + |iteratedFDeriv ℝ 3 g p ![(0, y₁), (0, y₂), (1, 0)]| ≤ M3 * ‖y₁‖ * ‖y₂‖) + (h33 : ∀ p ∈ Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r), ∀ y₁ y₂ y₃ : E, + |iteratedFDeriv ℝ 3 g p ![(0, y₁), (0, y₂), (0, y₃)]| ≤ M3 * ‖y₁‖ * ‖y₂‖ * ‖y₃‖) + (h40 : ∀ p ∈ Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r), + |iteratedFDeriv ℝ 4 g p ![(1, 0), (1, 0), (1, 0), (1, 0)]| ≤ M4) + (h41 : ∀ p ∈ Icc (-2 * r) (2 * r) ×ˢ Metric.closedBall (0 : E) (2 * r), ∀ v : E, + |iteratedFDeriv ℝ 4 g p ![(0, v), (1, 0), (1, 0), (1, 0)]| ≤ M4 * ‖v‖) + (hlam : ∀ v : E, iteratedFDeriv ℝ 2 g (-r / 2, 0) ![(0, v), (0, v)] ≤ -lam * ‖v‖ ^ 2) + (hH1 : 4 / (3 * k) * r * M3 ^ 2 < lam) (hH2 : r * M4 ≤ 3 * k / 10) + (hM : fderiv ℝ g (-r / 2, 0) = 0) (hS : fderiv ℝ g (r / 2, 0) = 0) + (hnorm : g (-r / 2, 0) - g (r / 2, 0) = k * r ^ 3) : + IsGreatest (CapHyp.olderPeakLevels f (torusCover L d (φ (-r / 2, 0)))) + (f (torusCover L d (φ (r / 2, 0)))) := by + obtain ⟨z, H, -⟩ := torus_capHyp_blocks φ hg hr hk hU hDU hf h30 h31 h32 h33 h40 h41 hlam hH1 + hH2 hM hS hnorm + have := torus_locallyConnectedSpace L d + exact H.elder_death_level_peak hfc rfl + +end Torus + +/-- A continuous chart of the circle near `0`: `circleChart L θ = ‖θ + L/4‖ − L/4`, which equals +`x` at the image of every `x` with `|x| ≤ L/4` (`circleChart_coe`). -/ +noncomputable def circleChart (L : ℝ) (θ : AddCircle L) : ℝ := + ‖θ + ((L / 4 : ℝ) : AddCircle L)‖ - L / 4 + +/-- `circleChart` is continuous. -/ +theorem circleChart_continuous (L : ℝ) : Continuous (circleChart L) := + (continuous_norm.comp (continuous_id.add continuous_const)).sub continuous_const + +/-- `circleChart L` inverts the covering map on `[−L/4, L/4]`. -/ +theorem circleChart_coe {L : ℝ} (hL : 0 < L) {x : ℝ} (hx : |x| ≤ L / 4) : + circleChart L (x : AddCircle L) = x := by + have h1 := (abs_le.mp hx).1 + have h2 := (abs_le.mp hx).2 + have hn : ‖((x + L / 4 : ℝ) : AddCircle L)‖ = |x + L / 4| := + (AddCircle.norm_coe_eq_abs_iff L hL.ne').mpr (by + rw [abs_of_nonneg (by linarith), abs_of_pos hL]; linarith) + unfold circleChart + rw [← AddCircle.coe_add, hn, abs_of_nonneg (by linarith)] + ring + +/-- The derivative of `mixedToyF` (v2.5's toy), stated as a lemma for reuse. -/ +theorem mixedToy_hasFDerivAt (p : ℝ × ℝ) : HasFDerivAt mixedToyF + ((p.1 ^ 2 - 1 / 4 + p.2 ^ 2) • ContinuousLinearMap.fst ℝ ℝ ℝ + + (-40 * p.2 + 2 * p.1 * p.2) • ContinuousLinearMap.snd ℝ ℝ ℝ) p := by + have hf : HasFDerivAt (fun q : ℝ × ℝ => q.1) (ContinuousLinearMap.fst ℝ ℝ ℝ) p := hasFDerivAt_fst + have hs : HasFDerivAt (fun q : ℝ × ℝ => q.2) (ContinuousLinearMap.snd ℝ ℝ ℝ) p := hasFDerivAt_snd + have h1 := HasFDerivAt.add (HasFDerivAt.sub (HasFDerivAt.sub + (HasFDerivAt.const_mul (HasFDerivAt.pow hf 3) (1 / 3)) + (HasFDerivAt.const_mul hf (1 / 4))) + (HasFDerivAt.const_mul (HasFDerivAt.pow hs 2) 20)) + (HasFDerivAt.mul hf (HasFDerivAt.pow hs 2)) + convert h1 using 1 + · funext q + simp only [mixedToyF, Pi.sub_apply, Pi.add_apply, Pi.mul_apply] + ring + · ext <;> simp + ring + +/-- `mixedToyF` is `C⁴`. -/ +theorem mixedToy_contDiff : ContDiff ℝ 4 mixedToyF := by unfold mixedToyF; fun_prop + +/-- The second derivative of `mixedToyF`. -/ +theorem mixedToy_iteratedFDeriv_two (y : ℝ × ℝ) (m : Fin 2 → ℝ × ℝ) : + iteratedFDeriv ℝ 2 mixedToyF y m = + 2 * y.1 * (m 0).1 * (m 1).1 + 2 * y.2 * ((m 0).1 * (m 1).2 + (m 0).2 * (m 1).1) + + (-40 + 2 * y.1) * (m 0).2 * (m 1).2 := by + have hf : ∀ p : ℝ × ℝ, HasFDerivAt (fun q : ℝ × ℝ => q.1) (ContinuousLinearMap.fst ℝ ℝ ℝ) p := + fun p => hasFDerivAt_fst + have hs : ∀ p : ℝ × ℝ, HasFDerivAt (fun q : ℝ × ℝ => q.2) (ContinuousLinearMap.snd ℝ ℝ ℝ) p := + fun p => hasFDerivAt_snd + have hD2 : HasFDerivAt (fun q : ℝ × ℝ => (q.1 ^ 2 - 1 / 4 + q.2 ^ 2) • + ContinuousLinearMap.fst ℝ ℝ ℝ + (-40 * q.2 + 2 * q.1 * q.2) • ContinuousLinearMap.snd ℝ ℝ ℝ) + (((2 * y.1) • ContinuousLinearMap.fst ℝ ℝ ℝ + (2 * y.2) • ContinuousLinearMap.snd ℝ ℝ ℝ).smulRight + (ContinuousLinearMap.fst ℝ ℝ ℝ) + + ((2 * y.2) • ContinuousLinearMap.fst ℝ ℝ ℝ + + (-40 + 2 * y.1) • ContinuousLinearMap.snd ℝ ℝ ℝ).smulRight + (ContinuousLinearMap.snd ℝ ℝ ℝ)) y := by + have h1 : HasFDerivAt (fun q : ℝ × ℝ => q.1 ^ 2 - 1 / 4 + q.2 ^ 2) + ((2 * y.1) • ContinuousLinearMap.fst ℝ ℝ ℝ + (2 * y.2) • ContinuousLinearMap.snd ℝ ℝ ℝ) y := by + have := ((HasFDerivAt.pow (hf y) 2).sub_const (1 / 4)).add (HasFDerivAt.pow (hs y) 2) + convert this using 1 + ext <;> simp + have h2 : HasFDerivAt (fun q : ℝ × ℝ => -40 * q.2 + 2 * q.1 * q.2) + ((2 * y.2) • ContinuousLinearMap.fst ℝ ℝ ℝ + (-40 + 2 * y.1) • ContinuousLinearMap.snd ℝ ℝ ℝ) + y := by + have := (HasFDerivAt.const_mul (hs y) (-40)).add + ((HasFDerivAt.const_mul (hf y) 2).mul (hs y)) + convert this using 1 + ext <;> simp + ring + exact (h1.smul_const (ContinuousLinearMap.fst ℝ ℝ ℝ)).add + (h2.smul_const (ContinuousLinearMap.snd ℝ ℝ ℝ)) + have hfd : fderiv ℝ mixedToyF = fun p => (p.1 ^ 2 - 1 / 4 + p.2 ^ 2) • + ContinuousLinearMap.fst ℝ ℝ ℝ + (-40 * p.2 + 2 * p.1 * p.2) • ContinuousLinearMap.snd ℝ ℝ ℝ := + funext fun p => (mixedToy_hasFDerivAt p).fderiv + rw [iteratedFDeriv_two_apply, hfd, hD2.fderiv] + simp + ring + +/-- The third derivative of `mixedToyF`: `2a₁b₁c₁ + 2a₂(b₁c₂ + b₂c₁) + 2a₁b₂c₂`. -/ +theorem mixedToy_iteratedFDeriv_three (x : ℝ × ℝ) (m : Fin 3 → ℝ × ℝ) : + iteratedFDeriv ℝ 3 mixedToyF x m = + 2 * (m 0).1 * (m 1).1 * (m 2).1 + 2 * (m 0).2 * ((m 1).1 * (m 2).2 + (m 1).2 * (m 2).1) + + 2 * (m 0).1 * (m 1).2 * (m 2).2 := by + rw [DifferentiableAt.iteratedFDeriv_succ_apply_left' + (mixedToy_contDiff.contDiffAt.differentiableAt_iteratedFDeriv (by norm_num))] + have hg : HasFDerivAt (fun y => iteratedFDeriv ℝ 2 mixedToyF y (Fin.tail m)) + ((2 * (m 1).1 * (m 2).1 + 2 * (m 1).2 * (m 2).2) • ContinuousLinearMap.fst ℝ ℝ ℝ + + (2 * ((m 1).1 * (m 2).2 + (m 1).2 * (m 2).1)) • ContinuousLinearMap.snd ℝ ℝ ℝ) x := by + have := (((2 * (m 1).1 * (m 2).1 + 2 * (m 1).2 * (m 2).2) • ContinuousLinearMap.fst ℝ ℝ ℝ + + (2 * ((m 1).1 * (m 2).2 + (m 1).2 * (m 2).1)) • + ContinuousLinearMap.snd ℝ ℝ ℝ).hasFDerivAt (x := x)).add_const (-40 * (m 1).2 * (m 2).2) + convert this using 1 + funext y; rw [mixedToy_iteratedFDeriv_two]; simp [Fin.tail]; ring + rw [hg.fderiv] + simp + ring + +/-- The fourth derivative of `mixedToyF` vanishes. -/ +theorem mixedToy_iteratedFDeriv_four (x : ℝ × ℝ) (m : Fin 4 → ℝ × ℝ) : + iteratedFDeriv ℝ 4 mixedToyF x m = 0 := by + rw [DifferentiableAt.iteratedFDeriv_succ_apply_left' + (mixedToy_contDiff.contDiffAt.differentiableAt_iteratedFDeriv (by norm_num))] + have hc : (fun y => iteratedFDeriv ℝ 3 mixedToyF y (Fin.tail m)) = + fun _ => iteratedFDeriv ℝ 3 mixedToyF x (Fin.tail m) := by + funext y; rw [mixedToy_iteratedFDeriv_three, mixedToy_iteratedFDeriv_three] + have hg : HasFDerivAt (fun y => iteratedFDeriv ℝ 3 mixedToyF y (Fin.tail m)) + (0 : ℝ × ℝ →L[ℝ] ℝ) x := by + rw [hc]; exact hasFDerivAt_const _ _ + rw [hg.fderiv] + simp + +/-- A function on the torus `(ℝ/16ℤ)²` whose lift equals `mixedToyF` on `(−4, 4)²`: +`mixedToyF` read through `circleChart` in each coordinate. It is continuous. -/ +noncomputable def torusToyF (θ : Fin 2 → AddCircle (16 : ℝ)) : ℝ := + mixedToyF (circleChart 16 (θ 0), circleChart 16 (θ 1)) + +/-- **A concrete instance of the elder death level on the torus.** On `(ℝ/16ℤ)²`, with the standard +frame `ℝ × ℝ ≃ₜ ℝ²`, the lift of `torusToyF` agrees with `mixedToyF` near the cap, so it meets +CAP (1) with `r = 1`, `k = 1/6`, `M3 = 2`, `M4 = 0` and `λ = 41`. `torus_elder_death_level_blocks` +then gives the death level of the class born at the image of `M = (−1/2, 0)`: it is the value at +the image of `S = (1/2, 0)`. This is the first concrete instance of the older-peak theorems +(`older_peak`, `elder_death_level_peak`), whose compactness hypothesis fails on the earlier toys' +domain `ℝ`. -/ +theorem torusToy_elder : + IsGreatest (CapHyp.olderPeakLevels torusToyF + (torusCover 16 2 ((Homeomorph.finTwoArrow (X := ℝ)).symm (-1 / 2, 0)))) + (torusToyF (torusCover 16 2 ((Homeomorph.finTwoArrow (X := ℝ)).symm (1 / 2, 0)))) := by + have : Fact ((0 : ℝ) < 16) := ⟨by norm_num⟩ + set φ : ℝ × ℝ ≃ₜ (Fin 2 → ℝ) := (Homeomorph.finTwoArrow (X := ℝ)).symm with hφ + set U : Set (ℝ × ℝ) := Ioo (-4) 4 ×ˢ Ioo (-4) 4 with hU_def + have hU : IsOpen U := isOpen_Ioo.prod isOpen_Ioo + have hGU : ∀ p ∈ U, torusToyF (torusCover 16 2 (φ p)) = mixedToyF p := by + rintro ⟨a, b⟩ ⟨ha, hb⟩ + have ha' : |a| ≤ 16 / 4 := by rw [abs_le]; constructor <;> linarith [ha.1, ha.2] + have hb' : |b| ≤ 16 / 4 := by rw [abs_le]; constructor <;> linarith [hb.1, hb.2] + simp only [torusToyF, torusCover, hφ, Homeomorph.finTwoArrow_symm_apply, Pi.map_apply] + simp [circleChart_coe (by norm_num : (0 : ℝ) < 16) ha', + circleChart_coe (by norm_num : (0 : ℝ) < 16) hb'] + have hev : ∀ p ∈ U, (fun q => torusToyF (torusCover 16 2 (φ q))) =ᶠ[nhds p] mixedToyF := + fun p hp => Filter.eventuallyEq_of_mem (hU.mem_nhds hp) hGU + have hD : ∀ n p, p ∈ U → iteratedFDeriv ℝ n (fun q => torusToyF (torusCover 16 2 (φ q))) p = + iteratedFDeriv ℝ n mixedToyF p := + fun n p hp => ((hev p hp).iteratedFDeriv ℝ n).eq_of_nhds + have hDU : Icc (-2 * 1) (2 * 1) ×ˢ Metric.closedBall (0 : ℝ) (2 * 1) ⊆ U := by + rintro ⟨a, b⟩ ⟨ha, hb⟩ + rw [Metric.mem_closedBall, Real.dist_eq, sub_zero, abs_le] at hb + exact ⟨⟨by linarith [ha.1], by linarith [ha.2]⟩, ⟨by linarith [hb.1], by linarith [hb.2]⟩⟩ + have hseg : ∀ x ∈ Icc (-1 / 2 : ℝ) (1 / 2), ((x, 0) : ℝ × ℝ) ∈ U := fun x hx => + ⟨⟨by linarith [hx.1], by linarith [hx.2]⟩, ⟨by norm_num, by norm_num⟩⟩ + have hM : ((-1 / 2, 0) : ℝ × ℝ) ∈ U := hseg _ ⟨by norm_num, by norm_num⟩ + have hS : ((1 / 2, 0) : ℝ × ℝ) ∈ U := hseg _ ⟨by norm_num, by norm_num⟩ + refine torus_elder_death_level_blocks (E := ℝ) (L := 16) (d := 2) φ + (mixedToy_contDiff.continuous.comp ((circleChart_continuous 16).comp (continuous_apply 0) |>.prodMk + ((circleChart_continuous 16).comp (continuous_apply 1)))) + (g := fun q => torusToyF (torusCover 16 2 (φ q))) (fun p => rfl) (U := U) + (r := 1) (k := 1 / 6) (M3 := 2) (M4 := 0) (lam := 41) one_pos (by norm_num) hU hDU + (mixedToy_contDiff.contDiffOn.congr fun p hp => hGU p hp) + (fun x hx => ?_) (fun p hp y => ?_) (fun p hp y₁ y₂ => ?_) (fun p hp y₁ y₂ y₃ => ?_) + (fun p hp => ?_) (fun p hp v => ?_) (fun v => ?_) (by norm_num) (by norm_num) ?_ ?_ ?_ + · rw [hD 3 _ (hseg _ (by simpa using hx)), mixedToy_iteratedFDeriv_three]; simp + · rw [hD 3 _ (hDU hp), mixedToy_iteratedFDeriv_three]; simp + · rw [hD 3 _ (hDU hp), mixedToy_iteratedFDeriv_three] + simp only [Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.cons_val_two, Matrix.tail_cons, + Matrix.head_cons, Real.norm_eq_abs] + rw [show (2 * (0 : ℝ) * 0 * 1 + 2 * y₁ * (0 * 0 + y₂ * 1) + 2 * 0 * y₂ * 0) = 2 * (y₁ * y₂) by + ring, abs_mul, abs_mul] + norm_num [mul_assoc] + · rw [hD 3 _ (hDU hp), mixedToy_iteratedFDeriv_three] + simp only [Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.cons_val_two, Matrix.tail_cons, + Matrix.head_cons, Real.norm_eq_abs] + rw [show (2 * (0 : ℝ) * 0 * 0 + 2 * y₁ * (0 * y₃ + y₂ * 0) + 2 * 0 * y₂ * y₃) = 0 by ring, + abs_zero] + positivity + · rw [hD 4 _ (hDU hp), mixedToy_iteratedFDeriv_four]; simp + · rw [hD 4 _ (hDU hp), mixedToy_iteratedFDeriv_four]; simp + · rw [hD 2 _ (by simpa using hM), mixedToy_iteratedFDeriv_two] + simp only [Matrix.cons_val_zero, Matrix.cons_val_one, Real.norm_eq_abs, sq_abs] + nlinarith [sq_nonneg v] + · rw [(hev _ (by simpa using hM)).fderiv_eq, (mixedToy_hasFDerivAt _).fderiv] + ext <;> norm_num + · rw [(hev _ (by simpa using hS)).fderiv_eq, (mixedToy_hasFDerivAt _).fderiv] + ext <;> norm_num + · rw [hGU _ (by simpa using hM), hGU _ (by simpa using hS)] + simp only [mixedToyF]; norm_num + +end CapFirstExit diff --git a/frontiers/compact_source_cutoff_controls_final_repair_20261011/CompactSourceCutoffControls.lean b/frontiers/compact_source_cutoff_controls_final_repair_20261011/CompactSourceCutoffControls.lean new file mode 100644 index 000000000..a8a899548 --- /dev/null +++ b/frontiers/compact_source_cutoff_controls_final_repair_20261011/CompactSourceCutoffControls.lean @@ -0,0 +1,671 @@ +import CompactSourceCutoffProof +import Mathlib.Topology.Order.IntermediateValue + +/-! +Static falsifying controls for the compact source cutoff. This file has not been +elaborated. It deliberately consumes the actual `CompactGeometry` conclusion; +the final theorem also consumes the literal actual-source theorem and retains its +original premises. No toy quadratic is identified with the Gaussian source. +-/ + +noncomputable section +set_option backward.isDefEq.respectTransparency false +open Set SourceCoordinates SourceNormalForm SourcePushedHeight SourceCompactCutoff MorseCongruence +open scoped Topology ContDiff Manifold Matrix.Norms.Frobenius +namespace CompactSourceCutoffControls +attribute [local instance] Classical.propDecidable +attribute [local instance] I4TorusC4.actualChartedSpace + +theorem actual_beta_at_zero {n k : ℕ} (hk : k ≤ n) + (ρ : ℝ) (hρ : 0 < ρ) : beta hk ρ hρ 0 = 1 := by + change (cutoffBump ρ hρ) ((split hk).symm 0) = 1 + apply (cutoffBump ρ hρ).one_of_mem_closedBall + simp only [map_zero, Metric.mem_closedBall, dist_self] + exact (cutoffBump ρ hρ).rIn_pos.le + +/- The closed inner and outer boundaries belong to opposite plateaus. -/ +theorem boundary_plateaus {n k : ℕ} (hk : k ≤ n) (ρ : ℝ) (hρ : 0 < ρ) + (F : X n → ℝ) (phi : OpenPartialHomeomorph (X n) (E k × E (n-k))) + (T : Set (E k × E (n-k))) (U : Set (X n)) (x0 : X n) + (g : CompactGeometry hk ρ hρ F phi T U x0) : + beta hk ρ hρ 0 = 1 ∧ + (∀ z, ‖(split hk).symm z‖ = ρ / 4 → beta hk ρ hρ z = 1) ∧ + (∀ z, ρ / 2 ≤ ‖(split hk).symm z‖ → beta hk ρ hρ z = 0) := by + refine ⟨?_, ?_, g.outer_zero⟩ + · apply g.inner_one + simp only [map_zero, norm_zero] + linarith + · intro z hz + exact g.inner_one z hz.le + +/- The separation is stated in the actual split product with its max norm. +The two one-dimensional norms are explicit premises, so the argument also +applies to any witnessed point with those coordinates. -/ +theorem euclidean_outer_product_inner {n k : ℕ} (hk : k ≤ n) + (z : E k × E (n-k)) (hplus : ‖z.1‖ = (3 : ℝ) / 8) + (hminus : ‖z.2‖ = (3 : ℝ) / 8) : + ‖z‖ < (1 : ℝ) / 2 ∧ + (1 : ℝ) / 2 ≤ ‖(split hk).symm z‖ := by + have henergy := split_energy hk ((split hk).symm z) + rw [(split hk).apply_symm_apply] at henergy + have hnorm : 0 ≤ ‖(split hk).symm z‖ := norm_nonneg _ + constructor + · simpa [Prod.norm_def, hplus, hminus] using + (show max ((3 : ℝ) / 8) (3 / 8) < 1 / 2 by norm_num) + · rw [hplus, hminus] at henergy + nlinarith + +theorem product_max_substitution_rejected {n k : ℕ} (hk : k ≤ n) + (z : E k × E (n-k)) (hplus : ‖z.1‖ = (3 : ℝ) / 8) + (hminus : ‖z.2‖ = (3 : ℝ) / 8) : + ‖z‖ < (1 : ℝ) / 2 ∧ beta hk 1 (by norm_num) z = 0 := by + obtain ⟨hmax, houter⟩ := euclidean_outer_product_inner hk z hplus hminus + refine ⟨hmax, ?_⟩ + change (cutoffBump 1 (by norm_num)) ((split hk).symm z) = 0 + exact (cutoffBump 1 (by norm_num)).zero_of_le_dist + (by simpa only [cutoffBump, dist_zero_right] using houter) + +private def axis (t : ℝ) : E 1 := EuclideanSpace.single (0 : Fin 1) t + +private theorem axis_norm (t : ℝ) : ‖axis t‖ = |t| := by + simp [axis, EuclideanSpace.norm_single, Real.norm_eq_abs] + +private def corner : E 1 × E 1 := (axis (3/8), axis (3/8)) + +theorem concrete_n2_k1_product_max_rejected : + ‖corner‖ < (1 : ℝ) / 2 ∧ + beta (by decide : 1 ≤ 2) 1 (by norm_num) corner = 0 := by + apply product_max_substitution_rejected (by decide : 1 ≤ 2) + · norm_num [corner, axis_norm] + · change ‖axis ((3 : ℝ) / 8)‖ = (3 : ℝ) / 8 + rw [axis_norm] + norm_num + +/- Uncompiled integration fragment. Place inside the controls namespace after its opens. + `import Mathlib.Topology.Order.IntermediateValue` may be needed explicitly. + The unit-vector argument is a real witness, not an assumed beta midpoint. -/ + +private theorem intermediate_beta_of_unit {n k : ℕ} (hk : k ≤ n) + (ρ : ℝ) (hρ : 0 < ρ) (w : E n) (hw : ‖w‖ = 1) : + ∃ t ∈ Set.Ioo (ρ / 4) (ρ / 2), + beta hk ρ hρ (split hk (t • w)) = (1 : ℝ) / 2 := by + let a : ℝ := ρ / 4 + let b : ℝ := ρ / 2 + let B := cutoffBump (n := n) ρ hρ + let f : ℝ → ℝ := fun t => B (t • w) + have ha0 : 0 ≤ a := by dsimp [a]; linarith + have hb0 : 0 ≤ b := by dsimp [b]; linarith + have hab : a ≤ b := by dsimp [a, b]; linarith + have hnorm (t : ℝ) (ht : 0 ≤ t) : ‖t • w‖ = t := by + simp [norm_smul, Real.norm_eq_abs, abs_of_nonneg ht, hw] + have ha : f a = 1 := by + change B (a • w) = 1 + apply B.one_of_mem_closedBall + change dist (a • w) 0 ≤ ρ / 4 + simpa [dist_zero_right, hnorm a ha0, a] + have hb : f b = 0 := by + change B (b • w) = 0 + apply B.zero_of_le_dist + change ρ / 2 ≤ dist (b • w) 0 + simpa [dist_zero_right, hnorm b hb0, b] + have hf : Continuous f := by + letI : IsBoundedSMul ℝ (E n) := NormedSpace.toIsBoundedSMul + letI : ContinuousSMul ℝ (E n) := IsBoundedSMul.continuousSMul + exact B.continuous.comp + ((continuous_id : Continuous (fun t : ℝ => t)).smul + (continuous_const : Continuous (fun _ : ℝ => w))) + have hmid : (1 / 2 : ℝ) ∈ Set.Ioo (f b) (f a) := by + change f b < 1 / 2 ∧ 1 / 2 < f a + rw [hb, ha] + norm_num + obtain ⟨t, ht, hft⟩ := intermediate_value_Ioo' hab hf.continuousOn hmid + refine ⟨t, by simpa [a, b] using ht, ?_⟩ + change B ((split hk).symm (split hk (t • w))) = (1 : ℝ) / 2 + simpa only [(split hk).symm_apply_apply] using hft + +/- Concrete n=2, k=1 instantiation; `E 2 = EuclideanSpace ℝ (Fin 2)`. + This second theorem supplies the unit vector rather than adding it as a + premise to the falsifying control. -/ +private theorem intermediate_beta_n2_k1 : + ∃ t ∈ Set.Ioo ((1 : ℝ) / 4) (1 / 2), + beta (by decide : 1 ≤ 2) 1 (by norm_num) + (split (by decide : 1 ≤ 2) + (t • (EuclideanSpace.single (0 : Fin 2) (1 : ℝ) : E 2))) = 1 / 2 := by + have hw : ‖(EuclideanSpace.single (0 : Fin 2) (1 : ℝ) : E 2)‖ = 1 := by + simp [EuclideanSpace.norm_single] + simpa using intermediate_beta_of_unit (by decide : 1 ≤ 2) + (1 : ℝ) (by norm_num) _ hw + +private def identityCone : MorseCone.NormalForm (E 1 × E 1) (E 1) (E 1) where + f := MorseCone.quadratic + p := 0 + c := 0 + ρ := 1 + hρ := by norm_num + chart := (Homeomorph.refl (E 1 × E 1)).toOpenPartialHomeomorph + center_mem := by simp + center_eq := rfl + ball_target := by intro z hz; simp + equation := by intro z hz; simp + +private def annulusCoordinate : E 1 × E 1 := (axis (3/4), 0) + +private theorem annulus_first_norm : ‖annulusCoordinate.1‖ = (3 : ℝ) / 4 := by + norm_num [annulusCoordinate, axis_norm] + +private def annulusOldPoint : MorseCone.oldSet identityCone := by + have hlevel : (0 : ℝ) ≤ MorseCone.quadratic annulusCoordinate := by + norm_num [MorseCone.quadratic, annulus_first_norm, annulusCoordinate] + have hne : annulusCoordinate ≠ (0 : E 1 × E 1) := by + intro he + have hn := congrArg (fun z : E 1 × E 1 => ‖z.1‖) he + rw [annulus_first_norm] at hn + norm_num at hn + exact ⟨⟨annulusCoordinate, hlevel⟩, hne⟩ + +private theorem annulus_in_original_patch : + annulusOldPoint.val ∈ MorseCone.patchSet identityCone := by + constructor + · simp [identityCone] + · change ‖annulusCoordinate.1‖ ^ 2 + ‖annulusCoordinate.2‖ ^ 2 < (1 : ℝ) ^ 2 + rw [annulus_first_norm] + norm_num [annulusCoordinate] + +theorem concrete_original_Foot_annulus_zero : + MorseOpenGluing.Foot (MorseCone.oldSet identityCone) + (MorseCone.patchSet identityCone) (ZerothHomotopy.mk annulusOldPoint) ∧ + beta (by decide : 1 ≤ 2) 1 (by norm_num) + (identityCone.chart annulusOldPoint.val.val) = 0 := by + have houter : identityCone.ρ / 2 ≤ + ‖(split (by decide : 1 ≤ 2)).symm + (identityCone.chart annulusOldPoint.val.val)‖ := by + have he := split_energy (by decide : 1 ≤ 2) + ((split (by decide : 1 ≤ 2)).symm annulusCoordinate) + rw [(split (by decide : 1 ≤ 2)).apply_symm_apply] at he + have hn : 0 ≤ ‖(split (by decide : 1 ≤ 2)).symm annulusCoordinate‖ := norm_nonneg _ + have hsq : ‖(split (by decide : 1 ≤ 2)).symm annulusCoordinate‖ ^ 2 = + ((3 : ℝ) / 4) ^ 2 := by + rw [annulus_first_norm] at he + simpa only [annulusCoordinate, Prod.snd, norm_zero, + zero_pow (M₀ := ℝ) (by decide : (2 : ℕ) ≠ 0), add_zero] using he + have hnorm : ‖(split (by decide : 1 ≤ 2)).symm annulusCoordinate‖ = 3 / 4 := by + nlinarith + simpa [identityCone, annulusOldPoint, hnorm] using + (show (1 : ℝ) / 2 ≤ 3 / 4 by norm_num) + refine ⟨⟨annulusOldPoint, annulus_in_original_patch, rfl⟩, ?_⟩ + change (cutoffBump 1 (by norm_num)) + ((split (by decide : 1 ≤ 2)).symm + (identityCone.chart annulusOldPoint.val.val)) = 0 + exact (cutoffBump 1 (by norm_num)).zero_of_le_dist + (by simpa only [cutoffBump, identityCone, dist_zero_right] using houter) + +/- The literal oldSet/patchSet Foot witness can lie where the cutoff vanishes. +The annulus coordinate is explicit; no all-Foot coverage follows. -/ +theorem literal_Foot_outer_annulus {n k : ℕ} (hk : k ≤ n) + (D : MorseCone.NormalForm (X n) (E k) (E (n-k))) + (a : MorseCone.oldSet D) (hpatch : a.val ∈ MorseCone.patchSet D) + (houter : D.ρ / 2 ≤ ‖(split hk).symm (D.chart a.val.val)‖) : + MorseOpenGluing.Foot (MorseCone.oldSet D) (MorseCone.patchSet D) + (ZerothHomotopy.mk a) ∧ + beta hk D.ρ D.hρ (D.chart a.val.val) = 0 := by + refine ⟨⟨a, hpatch, rfl⟩, ?_⟩ + change (cutoffBump D.ρ D.hρ) ((split hk).symm (D.chart a.val.val)) = 0 + exact (cutoffBump D.ρ D.hρ).zero_of_le_dist + (by simpa only [cutoffBump, dist_zero_right] using houter) + +/- The support boundary is admitted by the actual target inclusion, whereas +the full closed radius-ρ boundary has no such conclusion. -/ +theorem closed_half_radius_in_target {n k : ℕ} (hk : k ≤ n) + (ρ : ℝ) (hρ : 0 < ρ) (F : X n → ℝ) + (phi : OpenPartialHomeomorph (X n) (E k × E (n-k))) + (T : Set (E k × E (n-k))) (U : Set (X n)) (x0 : X n) + (g : CompactGeometry hk ρ hρ F phi T U x0) + (z : E k × E (n-k)) (hz : ‖(split hk).symm z‖ = ρ / 2) : z ∈ T := by + apply g.K_target + refine ⟨(split hk).symm z, ?_, (split hk).apply_symm_apply z⟩ + simpa only [Metric.mem_closedBall, dist_zero_right] using hz.le + +theorem full_closed_radius_rejected_by_strict_target (ρ : ℝ) (hρ : 0 < ρ) : + ¬ Metric.closedBall (0 : ℝ) ρ ⊆ Metric.ball 0 ρ := by + intro hsubset + have hclosed : ρ ∈ Metric.closedBall (0 : ℝ) ρ := by + simpa only [Metric.mem_closedBall, Real.dist_eq, sub_zero, + abs_of_nonneg hρ.le] using (le_refl ρ) + have hopen := hsubset hclosed + have hbad : ρ < ρ := by + simpa only [Metric.mem_ball, Real.dist_eq, sub_zero, + abs_of_nonneg hρ.le] using hopen + exact (lt_irrefl ρ) hbad + +private def fullRadiusCoordinate : E 1 × E 1 := (axis 1, 0) + +theorem n2_closed_rho_boundary_rejected_by_radiusBall : + ‖(split (by decide : 1 ≤ 2)).symm fullRadiusCoordinate‖ = 1 ∧ + fullRadiusCoordinate ∉ MorseCone.radiusBall (E := E 1) (F := E 1) 1 := by + have he := split_energy (by decide : 1 ≤ 2) + ((split (by decide : 1 ≤ 2)).symm fullRadiusCoordinate) + rw [(split (by decide : 1 ≤ 2)).apply_symm_apply] at he + have hsq : ‖(split (by decide : 1 ≤ 2)).symm fullRadiusCoordinate‖ ^ 2 = 1 := by + simpa [fullRadiusCoordinate, axis_norm] using he + have hn : 0 ≤ ‖(split (by decide : 1 ≤ 2)).symm fullRadiusCoordinate‖ := norm_nonneg _ + have hnorm : ‖(split (by decide : 1 ≤ 2)).symm fullRadiusCoordinate‖ = 1 := by + nlinarith + constructor + · exact hnorm + · change ¬ (‖fullRadiusCoordinate.1‖ ^ 2 + ‖fullRadiusCoordinate.2‖ ^ 2 < + (1 : ℝ) ^ 2) + norm_num [fullRadiusCoordinate, axis_norm] + +private def strictRadiusIdentityChart : + OpenPartialHomeomorph (E 1 × E 1) (E 1 × E 1) := + OpenPartialHomeomorph.ofSet + (MorseCone.radiusBall (E := E 1) (F := E 1) 1) + (isOpen_lt (by fun_prop) continuous_const) + +theorem strict_identity_target_rejects_full_closed_rho : + fullRadiusCoordinate ∈ + (split (by decide : 1 ≤ 2)) '' Metric.closedBall (0 : E 2) 1 ∧ + fullRadiusCoordinate ∉ strictRadiusIdentityChart.target := by + obtain ⟨hnorm, houtside⟩ := n2_closed_rho_boundary_rejected_by_radiusBall + constructor + · refine ⟨(split (by decide : 1 ≤ 2)).symm fullRadiusCoordinate, ?_, + (split (by decide : 1 ≤ 2)).apply_symm_apply fullRadiusCoordinate⟩ + simpa only [Metric.mem_closedBall, dist_zero_right] using hnorm.le + · simpa [strictRadiusIdentityChart] using houtside + +theorem half_closed_K_in_strict_identity_target : + K (by decide : 1 ≤ 2) 1 ⊆ strictRadiusIdentityChart.target := by + rintro z ⟨u, hu, rfl⟩ + have hnorm : ‖u‖ ≤ (1 : ℝ) / 2 := by + simpa only [Metric.mem_closedBall, dist_zero_right] using hu + have hsq : ‖u‖ ^ 2 ≤ ((1 : ℝ) / 2) ^ 2 := + (sq_le_sq₀ (norm_nonneg u) (by norm_num)).mpr hnorm + change ‖(split (by decide : 1 ≤ 2) u).1‖ ^ 2 + + ‖(split (by decide : 1 ≤ 2) u).2‖ ^ 2 < (1 : ℝ) ^ 2 + rw [← split_energy (by decide : 1 ≤ 2) u] + nlinarith + +/- Canonical physical-to-split linear chart, with no assumed P. -/ +private def partialSplit : X 2 ≃L[ℝ] (E 1 × E 1) := + (EuclideanSpace.equiv (Fin 2) ℝ).symm.trans (split (by decide : 1 ≤ 2)) + +private def partialTarget : Set (E 1 × E 1) := + MorseCone.radiusBall (E := E 1) (F := E 1) 1 + +private def partialSource : Set (X 2) := partialSplit ⁻¹' partialTarget + +private def innerZ : E 1 × E 1 := (axis (1 / 8), 0) +private def outerZ : E 1 × E 1 := (axis 2, 0) +private def outerX : X 2 := partialSplit.symm outerZ + +/- On the nonempty open source this is the canonical linear equivalence. + Outside source it deliberately returns a small nonzero chart coordinate. -/ +private def offSourceSmallChart : OpenPartialHomeomorph (X 2) (E 1 × E 1) := by + have hT : IsOpen partialTarget := + isOpen_lt (by fun_prop) continuous_const + have hS : IsOpen partialSource := hT.preimage partialSplit.continuous + refine { + toFun := fun x => if x ∈ partialSource then partialSplit x else innerZ + invFun := partialSplit.symm + source := partialSource + target := partialTarget + map_source' := ?_ + map_target' := ?_ + left_inv' := ?_ + right_inv' := ?_ + continuousOn_toFun := ?_ + continuousOn_invFun := partialSplit.symm.continuous.continuousOn + open_source := hS + open_target := hT + } + · intro x hx + change (if x ∈ partialSource then partialSplit x else innerZ) ∈ partialTarget + rw [if_pos hx] + exact hx + · intro z hz + change partialSplit.symm z ∈ partialSource + simpa [partialSource] using hz + · intro x hx + change partialSplit.symm + (if x ∈ partialSource then partialSplit x else innerZ) = x + simp [hx] + · intro z hz + have hs : partialSplit.symm z ∈ partialSource := by + simpa [partialSource] using hz + change (if partialSplit.symm z ∈ partialSource then + partialSplit (partialSplit.symm z) else innerZ) = z + simp [hs] + · exact partialSplit.continuous.continuousOn.congr + (by intro x hx; simp [hx]) + +theorem off_source_small_chart_has_nonempty_source : + (0 : X 2) ∈ offSourceSmallChart.source := by + change (0 : X 2) ∈ partialSource + change partialSplit (0 : X 2) ∈ partialTarget + norm_num [partialTarget, MorseCone.radiusBall] + +/- This binds the off-source behavior to the actual V1 and Q1 definitions. + No premise asserts that beta is 1 or raw Q1 is nonzero. -/ +theorem concrete_off_source_small_chart_guard : + outerX ∉ offSourceSmallChart.source ∧ + offSourceSmallChart outerX = innerZ ∧ + beta (by decide : 1 ≤ 2) 1 (by norm_num) innerZ = 1 ∧ + Q1 offSourceSmallChart.symm innerZ ≠ 0 ∧ + V1 (by decide : 1 ≤ 2) 1 (by norm_num) + offSourceSmallChart offSourceSmallChart.source outerX = 0 := by + have hout : outerZ ∉ partialTarget := by + norm_num [partialTarget, MorseCone.radiusBall, outerZ, axis_norm] + have hx : outerX ∉ offSourceSmallChart.source := by + change outerX ∉ partialSource + simpa [partialSource, outerX] using hout + have hchart : offSourceSmallChart outerX = innerZ := by + change (if outerX ∈ partialSource then partialSplit outerX else innerZ) = innerZ + simp [show outerX ∉ partialSource from hx] + have he := split_energy (by decide : 1 ≤ 2) + ((split (by decide : 1 ≤ 2)).symm innerZ) + rw [(split (by decide : 1 ≤ 2)).apply_symm_apply] at he + have hsq : ‖(split (by decide : 1 ≤ 2)).symm innerZ‖ ^ 2 = + ((1 : ℝ) / 8) ^ 2 := by + simpa [innerZ, axis_norm] using he + have hn : 0 ≤ ‖(split (by decide : 1 ≤ 2)).symm innerZ‖ := norm_nonneg _ + have hnorm : ‖(split (by decide : 1 ≤ 2)).symm innerZ‖ = 1 / 8 := by + nlinarith + have hb : beta (by decide : 1 ≤ 2) 1 (by norm_num) innerZ = 1 := by + change (cutoffBump 1 (by norm_num)) + ((split (by decide : 1 ≤ 2)).symm innerZ) = 1 + apply (cutoffBump 1 (by norm_num)).one_of_mem_closedBall + change dist ((split (by decide : 1 ≤ 2)).symm innerZ) 0 ≤ (1 : ℝ) / 4 + norm_num [dist_zero_right, hnorm] + have hW : W1 innerZ ≠ (0 : E 1 × E 1) := by + intro heq + have hf := congrArg (fun z : E 1 × E 1 => ‖z.1‖) heq + norm_num [W1, innerZ, axis_norm] at hf + have hQeq : Q1 offSourceSmallChart.symm innerZ = + partialSplit.symm (W1 innerZ) := by + change fderiv ℝ (partialSplit.symm : E 1 × E 1 → X 2) innerZ + (W1 innerZ) = partialSplit.symm (W1 innerZ) + rw [ContinuousLinearEquiv.fderiv] + rfl + have hQ : Q1 offSourceSmallChart.symm innerZ ≠ 0 := by + rw [hQeq] + intro heq + apply hW + apply partialSplit.symm.injective + simpa using heq + refine ⟨hx, hchart, hb, hQ, ?_⟩ + simp [V1, extension, hx] + +/- Membership in U is essential even when the totalized chart happens to +return an inner coordinate. This is a direct assertion about the literal +extension and both piecewise rates, with no assumptions on phi outside U. -/ +theorem off_overlap_zero_despite_small_chart {n k : ℕ} (hk : k ≤ n) + (ρ : ℝ) (hρ : 0 < ρ) (F : X n → ℝ) + (phi : OpenPartialHomeomorph (X n) (E k × E (n-k))) + (U : Set (X n)) (x : X n) + (hx : x ∉ U) (hsmall : ‖(split hk).symm (phi x)‖ ≤ ρ / 4) : + beta hk ρ hρ (phi x) = 1 ∧ + V0 hk ρ hρ phi U x = 0 ∧ V1 hk ρ hρ phi U x = 0 ∧ + fderiv ℝ F x (V0 hk ρ hρ phi U x) = 0 ∧ + fderiv ℝ F x (V1 hk ρ hρ phi U x) = 0 := by + refine ⟨?_, ?_, ?_, ?_, ?_⟩ + · change (cutoffBump ρ hρ) ((split hk).symm (phi x)) = 1 + apply (cutoffBump ρ hρ).one_of_mem_closedBall + simpa only [cutoffBump, Metric.mem_closedBall, dist_zero_right] using hsmall + · simp [V0, extension, hx] + · simp [V1, extension, hx] + · simp [V0, extension, hx] + · simp [V1, extension, hx] + +theorem smaller_overlap_rejects_coordinate_only_extension {n k : ℕ} + (hk : k ≤ n) (ρ : ℝ) (hρ : 0 < ρ) + (phi : OpenPartialHomeomorph (X n) (E k × E (n-k))) + (x : X n) (hxsource : x ∈ phi.source) + (hsmall : ‖(split hk).symm (phi x)‖ ≤ ρ / 4) + (Q : (E k × E (n-k)) → X n) : + (phi.source \ {x} : Set (X n)) ⊆ phi.source ∧ + beta hk ρ hρ (phi x) = 1 ∧ + extension hk ρ hρ phi (phi.source \ {x}) Q x = 0 := by + refine ⟨diff_subset, ?_, ?_⟩ + · change (cutoffBump ρ hρ) ((split hk).symm (phi x)) = 1 + apply (cutoffBump ρ hρ).one_of_mem_closedBall + simpa only [cutoffBump, Metric.mem_closedBall, dist_zero_right] using hsmall + · simp [extension] + +/- These tests cover all endpoint dimensions. They assert zero rates only +for the factor that is genuinely trivial; no positive rate is inferred. -/ +theorem zero_factor_rate {n k : ℕ} (hk : k ≤ n) (ρ : ℝ) (hρ : 0 < ρ) + (F : X n → ℝ) (phi : OpenPartialHomeomorph (X n) (E k × E (n-k))) + (T : Set (E k × E (n-k))) (U : Set (X n)) (x0 : X n) + (g : CompactGeometry hk ρ hρ F phi T U x0) + (x : X n) (hzero : (phi x).2 = 0) : + fderiv ℝ F x (V0 hk ρ hρ phi U x) = 0 := by + rw [g.rate0] + by_cases hx : x ∈ U + · simp [hx, hzero] + · simp [hx] + +theorem n0_k0_rates (ρ : ℝ) (hρ : 0 < ρ) + (F : X 0 → ℝ) (phi : OpenPartialHomeomorph (X 0) (E 0 × E 0)) + (T : Set (E 0 × E 0)) (U : Set (X 0)) (x0 : X 0) + (g : CompactGeometry (by decide : 0 ≤ 0) ρ hρ F phi T U x0) + (x : X 0) : + fderiv ℝ F x (V0 (by decide : 0 ≤ 0) ρ hρ phi U x) = 0 ∧ + fderiv ℝ F x (V1 (by decide : 0 ≤ 0) ρ hρ phi U x) = 0 := by + have hfst : (phi x).1 = 0 := Subsingleton.elim _ _ + have hsnd : (phi x).2 = 0 := Subsingleton.elim _ _ + constructor + · rw [g.rate0] + simp [hsnd] + · rw [g.rate1] + simp [hfst, hsnd] + +theorem k0_rates_agree {n : ℕ} (ρ : ℝ) (hρ : 0 < ρ) + (F : X n → ℝ) (phi : OpenPartialHomeomorph (X n) (E 0 × E n)) + (T : Set (E 0 × E n)) (U : Set (X n)) (x0 : X n) + (g : CompactGeometry (Nat.zero_le n) ρ hρ F phi T U x0) + (x : X n) : + fderiv ℝ F x (V1 (Nat.zero_le n) ρ hρ phi U x) = + fderiv ℝ F x (V0 (Nat.zero_le n) ρ hρ phi U x) := by + have hfst : (phi x).1 = 0 := Subsingleton.elim _ _ + rw [g.rate0, g.rate1] + simp [hfst] + +theorem kn_rate0_zero {n : ℕ} (ρ : ℝ) (hρ : 0 < ρ) + (F : X n → ℝ) (phi : OpenPartialHomeomorph (X n) (E n × E (n-n))) + (T : Set (E n × E (n-n))) (U : Set (X n)) (x0 : X n) + (g : CompactGeometry (Nat.le_refl n) ρ hρ F phi T U x0) + (x : X n) : + fderiv ℝ F x (V0 (Nat.le_refl n) ρ hρ phi U x) = 0 := by + haveI : Subsingleton (E (n - n)) := by + simpa only [Nat.sub_self] using (inferInstance : Subsingleton (E 0)) + exact zero_factor_rate (Nat.le_refl n) ρ hρ F phi T U x0 g x + (Subsingleton.elim _ _) + +/- Arithmetic checkpoint for the anisotropic inverse ψ(y,z)=(2y,3z). +At (1,1), F(x)=(x₁/2)²-(x₂/3)² has gradient (1,-2/3). +Thus the pushed direction (2,-3) gives 4, the raw direction +(1,-1) gives 5/3, and the reversed negative-axis direction (0,3) +gives -2. The following controls connect these values to actual `fderiv`; hosted +elaboration is still required. -/ +theorem anisotropic_direction_arithmetic : + (1 : ℝ) * 2 + (-(2 : ℝ) / 3) * (-3) = 4 ∧ + (1 : ℝ) * 1 + (-(2 : ℝ) / 3) * (-1) = 5 / 3 ∧ + (1 : ℝ) * 0 + (-(2 : ℝ) / 3) * 3 = -2 ∧ + (∀ b : ℝ, b * ((1 : ℝ) * 2 + (-(2 : ℝ) / 3) * (-3)) = b * 4) := by + constructor + · norm_num + constructor + · norm_num + constructor + · norm_num + · intro b + ring + +private def anisotropicInverse (z : ℝ × ℝ) : ℝ × ℝ := (2 * z.1, 3 * z.2) +private def anisotropicPotential (x : ℝ × ℝ) : ℝ := + (x.1 / 2) ^ 2 - (x.2 / 3) ^ 2 + +private theorem anisotropic_actual_Q_vectors : + Q0 anisotropicInverse ((1, 1) : ℝ × ℝ) = (0, -3) ∧ + Q1 anisotropicInverse ((1, 1) : ℝ × ℝ) = (2, -3) := by + have hd : HasFDerivAt anisotropicInverse + (((2 : ℝ) • (ContinuousLinearMap.fst ℝ ℝ ℝ)).prod + ((3 : ℝ) • (ContinuousLinearMap.snd ℝ ℝ ℝ))) (1, 1) := by + let d : (ℝ × ℝ) →L[ℝ] (ℝ × ℝ) := + ((2 : ℝ) • ContinuousLinearMap.fst ℝ ℝ ℝ).prod + ((3 : ℝ) • ContinuousLinearMap.snd ℝ ℝ ℝ) + have hfun : anisotropicInverse = (d : ℝ × ℝ → ℝ × ℝ) := by + funext z + simp [anisotropicInverse, d, smul_eq_mul] + change HasFDerivAt anisotropicInverse d (1, 1) + rw [hfun] + exact d.hasFDerivAt + constructor + · simp [Q0, W0, hd.fderiv] + · simp [Q1, W1, hd.fderiv] + +theorem anisotropic_actual_Q_rates : + fderiv ℝ anisotropicPotential (anisotropicInverse (1, 1)) + (Q1 anisotropicInverse (1, 1)) = 4 ∧ + fderiv ℝ anisotropicPotential (anisotropicInverse (1, 1)) + (Q0 anisotropicInverse (1, 1)) = 2 ∧ + fderiv ℝ anisotropicPotential (anisotropicInverse (1, 1)) + (-(Q0 anisotropicInverse (1, 1))) = -2 := by + have hF : Differentiable ℝ anisotropicPotential := by + intro x + change DifferentiableAt ℝ + (fun x : ℝ × ℝ => (x.1 / 2)^2 - (x.2 / 3)^2) x + fun_prop + have hpsi : ContDiffOn ℝ 2 anisotropicInverse (Set.univ : Set (ℝ × ℝ)) := by + apply ContDiff.contDiffOn + change ContDiff ℝ 2 (fun z : ℝ × ℝ => (2 * z.1, 3 * z.2)) + fun_prop + have hidentity : ∀ z ∈ (Set.univ : Set (ℝ × ℝ)), + anisotropicPotential (anisotropicInverse z) = + (0 : ℝ) + MorseCone.quadratic z := by + intro z _ + simp only [anisotropicPotential, anisotropicInverse, MorseCone.quadratic, + Real.norm_eq_abs, sq_abs, zero_add] + ring + have hr := rates_of_local_identity anisotropicPotential anisotropicInverse + (Set.univ : Set (ℝ × ℝ)) 0 isOpen_univ hF hpsi hidentity + (1, 1) (Set.mem_univ _) + have h0 : fderiv ℝ anisotropicPotential (anisotropicInverse (1, 1)) + (Q0 anisotropicInverse (1, 1)) = 2 := by + simpa only [Real.norm_eq_abs, abs_one, one_pow, mul_one] using hr.1 + have h1 : fderiv ℝ anisotropicPotential (anisotropicInverse (1, 1)) + (Q1 anisotropicInverse (1, 1)) = 4 := by + convert hr.2 using 1 <;> norm_num [Real.norm_eq_abs] + refine ⟨h1, h0, ?_⟩ + rw [map_neg, h0] + +theorem anisotropic_raw_tuple_rate : + fderiv ℝ anisotropicPotential (anisotropicInverse ((1, 1) : ℝ × ℝ)) + ((1, -1) : ℝ × ℝ) = 5 / 3 := by + obtain ⟨hQ0, hQ1⟩ := anisotropic_actual_Q_vectors + obtain ⟨h1, h0, _⟩ := anisotropic_actual_Q_rates + have hdecomp : ((1, -1) : ℝ × ℝ) = + ((1 : ℝ) / 2) • Q1 anisotropicInverse (1, 1) - + ((1 : ℝ) / 6) • Q0 anisotropicInverse (1, 1) := by + rw [hQ0, hQ1] + norm_num [Prod.smul_def] + rw [hdecomp, map_sub, map_smul, map_smul, h1, h0] + norm_num + +theorem anisotropic_actual_scaled_Q1_rate (b : ℝ) : + fderiv ℝ anisotropicPotential (anisotropicInverse ((1, 1) : ℝ × ℝ)) + (b • Q1 anisotropicInverse (1, 1)) = b * 4 := by + rw [map_smul, (anisotropic_actual_Q_rates).1, smul_eq_mul] + +theorem anisotropic_midpoint_beta_scales_Q1_rate : + ∃ t ∈ Set.Ioo ((1 : ℝ) / 4) (1 / 2), + fderiv ℝ anisotropicPotential (anisotropicInverse ((1, 1) : ℝ × ℝ)) + ((beta (by decide : 1 ≤ 2) 1 (by norm_num) + (split (by decide : 1 ≤ 2) + (t • (EuclideanSpace.single (0 : Fin 2) (1 : ℝ) : E 2)))) • + Q1 anisotropicInverse (1, 1)) = 2 := by + obtain ⟨t, ht, hb⟩ := intermediate_beta_n2_k1 + refine ⟨t, ht, ?_⟩ + rw [hb, anisotropic_actual_scaled_Q1_rate] + norm_num + +theorem concrete_intermediate_beta_scales_actual_V1_rate + (F : X 2 → ℝ) (phi : OpenPartialHomeomorph (X 2) (E 1 × E 1)) + (T : Set (E 1 × E 1)) (U : Set (X 2)) (c : ℝ) (x0 : X 2) + (hgeo : LocalGeometry F phi T U c x0) + (g : CompactGeometry (by decide : 1 ≤ 2) 1 (by norm_num) F phi T U x0) : + ∃ x ∈ U, + beta (by decide : 1 ≤ 2) 1 (by norm_num) (phi x) = 1 / 2 ∧ + fderiv ℝ F x (V1 (by decide : 1 ≤ 2) 1 (by norm_num) phi U x) = + (1 / 2 : ℝ) * (2 * (‖(phi x).1‖ ^ 2 + ‖(phi x).2‖ ^ 2)) := by + obtain ⟨t, ht, hbeta⟩ := intermediate_beta_n2_k1 + let hk : 1 ≤ 2 := by decide + let w : E 2 := EuclideanSpace.single (0 : Fin 2) (1 : ℝ) + let z : E 1 × E 1 := split hk (t • w) + have ht0 : 0 ≤ t := by linarith [ht.1] + have hw : ‖w‖ = 1 := by simp [w, EuclideanSpace.norm_single] + have hnorm : ‖t • w‖ = t := by + simp [norm_smul, Real.norm_eq_abs, abs_of_nonneg ht0, hw] + have hzK : z ∈ K hk 1 := by + refine ⟨t • w, ?_, rfl⟩ + simpa only [Metric.mem_closedBall, dist_zero_right, hnorm] using ht.2.le + have hzT : z ∈ T := g.K_target hzK + have hxU : phi.symm z ∈ U := hgeo.inverse_target hzT + have hright : phi (phi.symm z) = z := phi.right_inv (hgeo.target_subset hzT) + have hbetaZ : beta hk 1 (by norm_num) z = 1 / 2 := by + simpa only [hk, z, w] using hbeta + refine ⟨phi.symm z, hxU, ?_, ?_⟩ + · simpa only [hright] using hbetaZ + · rw [g.rate1, if_pos hxU, hright, hbetaZ] + +theorem actual_source_consumer_preserves_premises {n : ℕ} {L : ℝ} + [Fact (0 < L)] (omega : I4Source.SourceMode n → ℝ) + (hmajor : Summable (fun m => I4Source.modeMajorant n L m * |omega m|)) + (x0 : X n) (hdet : (PhysicalSpectral.hessian (L := L) omega x0).det ≠ 0) + (hcrit : fderiv ℝ (I4Source.sourceField n L omega) x0 = 0) : + ∃ (k : ℕ) (hk : k ≤ n) (P : E n ≃L[ℝ] X n) (s : Sym n → Sym n) + (e : OpenPartialHomeomorph (E n) (E n)) + (D : MorseCone.NormalForm (I4Torus.SourceTorus n L) (E k) (E (n-k))), + D.f = I4Torus.torusSourceField n L omega ∧ + D.p = I4Torus.torusProjection n L x0 ∧ + D.chart = (liftChart (L := L) x0).trans (physicalChart hk x0 P e) ∧ + CompactGeometry hk D.ρ D.hρ (I4Source.sourceField n L omega) + (physicalChart hk x0 P e) D.chart.target + ((physicalChart hk x0 P e).source ∩ (liftChart (L := L) x0).target) x0 := by + obtain ⟨k, hk, P, s, e, D, _, _, _, _, _, _, _, _, _, + hf, hp, _, hchart, _, _, _, _, _, hcompact⟩ := + actual_source_compact_cutoff omega hmajor x0 hdet hcrit + exact ⟨k, hk, P, s, e, D, hf, hp, hchart, hcompact⟩ + +/- A literal signature parity check: all original conjuncts and the new geometry +are returned by the one actual-source consumer with its original inputs. -/ +theorem actual_source_exact_witness_parity {n : ℕ} {L : ℝ} [Fact (0 < L)] + (omega : I4Source.SourceMode n → ℝ) + (hmajor : Summable (fun m => I4Source.modeMajorant n L m * |omega m|)) + (x0 : X n) (hdet : (PhysicalSpectral.hessian (L := L) omega x0).det ≠ 0) + (hcrit : fderiv ℝ (I4Source.sourceField n L omega) x0 = 0) : + ∃ (k : ℕ) (hk : k ≤ n) (P : E n ≃L[ℝ] X n) (s : Sym n → Sym n) + (e : OpenPartialHomeomorph (E n) (E n)) + (D : MorseCone.NormalForm (I4Torus.SourceTorus n L) (E k) (E (n-k))), + let J := PhysicalSpectral.signSym n k + let M := TaylorSymLift.sourceSymMatrix (L := L) omega x0 P.toContinuousLinearMap + M 0 = J ∧ (∀ u, e u = theta J s M u) ∧ + e 0 = 0 ∧ e.symm 0 = 0 ∧ 0 ∈ e.source ∧ 0 ∈ e.target ∧ + HasFDerivAt e (ContinuousLinearMap.id ℝ (E n)) 0 ∧ + ContDiffOn ℝ 2 e e.source ∧ ContDiffOn ℝ 2 e.symm e.target ∧ + D.f = I4Torus.torusSourceField n L omega ∧ + D.p = I4Torus.torusProjection n L x0 ∧ D.c = I4Source.sourceField n L omega x0 ∧ + D.chart = (liftChart (L := L) x0).trans (physicalChart hk x0 P e) ∧ + (∀ q, D.chart q = split hk (e (P.symm (liftChart (L := L) x0 q - x0)))) ∧ + (∀ z, D.chart.symm z = I4Torus.torusProjection n L (x0 + P (e.symm ((split hk).symm z)))) ∧ + ContMDiffOn 𝓘(ℝ, X n) 𝓘(ℝ, E k × E (n-k)) 2 D.chart D.chart.source ∧ + ContMDiffOn 𝓘(ℝ, E k × E (n-k)) 𝓘(ℝ, X n) 2 D.chart.symm D.chart.target ∧ + LocalGeometry (I4Source.sourceField n L omega) (physicalChart hk x0 P e) + D.chart.target ((physicalChart hk x0 P e).source ∩ (liftChart (L := L) x0).target) + D.c x0 ∧ + CompactGeometry hk D.ρ D.hρ (I4Source.sourceField n L omega) + (physicalChart hk x0 P e) D.chart.target + ((physicalChart hk x0 P e).source ∩ (liftChart (L := L) x0).target) x0 := by + exact actual_source_compact_cutoff omega hmajor x0 hdet hcrit + +end CompactSourceCutoffControls diff --git a/frontiers/compact_source_cutoff_controls_final_repair_20261011/CompactSourceCutoffProof.lean b/frontiers/compact_source_cutoff_controls_final_repair_20261011/CompactSourceCutoffProof.lean new file mode 100644 index 000000000..eb7a073dc --- /dev/null +++ b/frontiers/compact_source_cutoff_controls_final_repair_20261011/CompactSourceCutoffProof.lean @@ -0,0 +1,304 @@ +import PushedHeight +import Mathlib.Analysis.Calculus.BumpFunction.InnerProduct +import Mathlib.Topology.Algebra.Support + +noncomputable section +#eval IO.eprintln "BOUNDARY imports" +set_option backward.isDefEq.respectTransparency false +open Filter Set SourceCoordinates SourceNormalForm SourcePushedHeight +open MorseCongruence +open scoped Topology ContDiff Manifold Matrix.Norms.Frobenius +namespace SourceCompactCutoff +attribute [local instance] I4TorusC4.actualChartedSpace +attribute [local instance] Classical.propDecidable + +def cutoffBump {n : ℕ} (ρ : ℝ) (hρ : 0 < ρ) : ContDiffBump (0 : E n) := + ⟨ρ/4, ρ/2, by linarith, by linarith⟩ + + +#eval IO.eprintln "BOUNDARY bump" +def beta {n k : ℕ} (hk : k ≤ n) (ρ : ℝ) (hρ : 0 < ρ) (z : E k × E (n-k)) : ℝ := + cutoffBump (n := n) ρ hρ ((split hk).symm z) + +def K {n k : ℕ} (hk : k ≤ n) (ρ : ℝ) : Set (E k × E (n-k)) := + split hk '' Metric.closedBall 0 (ρ/2) + +def M {n k : ℕ} (hk : k ≤ n) (ρ : ℝ) + (phi : OpenPartialHomeomorph (X n) (E k × E (n-k))) : Set (X n) := + phi.symm '' K hk ρ + +def extension {n k : ℕ} (hk : k ≤ n) (ρ : ℝ) (hρ : 0 < ρ) + (phi : OpenPartialHomeomorph (X n) (E k × E (n-k))) (U : Set (X n)) + (Q : (E k × E (n-k)) → X n) (x : X n) : X n := + if x ∈ U then beta hk ρ hρ (phi x) • Q (phi x) else 0 + +def V0 {n k : ℕ} (hk : k ≤ n) (ρ : ℝ) (hρ : 0 < ρ) + (phi : OpenPartialHomeomorph (X n) (E k × E (n-k))) (U : Set (X n)) : X n → X n := + extension hk ρ hρ phi U (Q0 phi.symm) + +def V1 {n k : ℕ} (hk : k ≤ n) (ρ : ℝ) (hρ : 0 < ρ) + (phi : OpenPartialHomeomorph (X n) (E k × E (n-k))) (U : Set (X n)) : X n → X n := + extension hk ρ hρ phi U (Q1 phi.symm) + + +#eval IO.eprintln "BOUNDARY defs" +structure CompactGeometry {n k : ℕ} (hk : k ≤ n) (ρ : ℝ) (hρ : 0 < ρ) + (F : X n → ℝ) (phi : OpenPartialHomeomorph (X n) (E k × E (n-k))) + (T : Set (E k × E (n-k))) (U : Set (X n)) (x0 : X n) : Prop where + inner_one : ∀ z, ‖(split hk).symm z‖ ≤ ρ/4 → beta hk ρ hρ z = 1 + outer_zero : ∀ z, ρ/2 ≤ ‖(split hk).symm z‖ → beta hk ρ hρ z = 0 + beta_bounds : ∀ z, 0 ≤ beta hk ρ hρ z ∧ beta hk ρ hρ z ≤ 1 + compact_K : IsCompact (K hk ρ) + compact_M : IsCompact (M hk ρ phi) + K_target : K hk ρ ⊆ T + M_physical : M hk ρ phi ⊆ U + support0 : Function.support (V0 hk ρ hρ phi U) ⊆ M hk ρ phi + support1 : Function.support (V1 hk ρ hρ phi U) ⊆ M hk ρ phi + C1_0 : ContDiff ℝ 1 (V0 hk ρ hρ phi U) + C1_1 : ContDiff ℝ 1 (V1 hk ρ hρ phi U) + compact0 : HasCompactSupport (V0 hk ρ hρ phi U) + compact1 : HasCompactSupport (V1 hk ρ hρ phi U) + rate0 : ∀ x, fderiv ℝ F x (V0 hk ρ hρ phi U x) = + if x ∈ U then beta hk ρ hρ (phi x) * (2 * ‖(phi x).2‖^2) else 0 + rate1 : ∀ x, fderiv ℝ F x (V1 hk ρ hρ phi U x) = + if x ∈ U then beta hk ρ hρ (phi x) * (2 * (‖(phi x).1‖^2 + ‖(phi x).2‖^2)) else 0 + nonnegative0 : ∀ x, 0 ≤ fderiv ℝ F x (V0 hk ρ hρ phi U x) + nonnegative1 : ∀ x, 0 ≤ fderiv ℝ F x (V1 hk ρ hρ phi U x) + inner_rate0 : ∀ z, ‖(split hk).symm z‖ ≤ ρ/4 → + fderiv ℝ F (phi.symm z) (V0 hk ρ hρ phi U (phi.symm z)) = 2 * ‖z.2‖^2 + inner_rate1 : ∀ z, ‖(split hk).symm z‖ ≤ ρ/4 → + fderiv ℝ F (phi.symm z) (V1 hk ρ hρ phi U (phi.symm z)) = + 2 * (‖z.1‖^2 + ‖z.2‖^2) + center0 : V0 hk ρ hρ phi U x0 = 0 + center1 : V1 hk ρ hρ phi U x0 = 0 + + +#eval IO.eprintln "BOUNDARY structure" +private theorem compact_K_of_split {n k : ℕ} (hk : k ≤ n) (ρ : ℝ) : + IsCompact (K hk ρ) := by + change IsCompact ((split hk) '' Metric.closedBall 0 (ρ / 2)) + exact (isCompact_closedBall (0 : E n) (ρ / 2)).image + (split hk).continuous + +private theorem K_subset_radiusBall {n k : ℕ} (hk : k ≤ n) (ρ : ℝ) + (hρ : 0 < ρ) : K hk ρ ⊆ MorseCone.radiusBall ρ := by + rintro z ⟨u, hu, rfl⟩ + have hu' : ‖u‖ ≤ ρ / 2 := by + simpa only [Metric.mem_closedBall, dist_zero_right] using hu + have hhalf : 0 ≤ ρ / 2 := by linarith + have hsq : ‖u‖ ^ 2 ≤ (ρ / 2) ^ 2 := + (sq_le_sq₀ (norm_nonneg u) hhalf).mpr hu' + change ‖(split hk u).1‖ ^ 2 + ‖(split hk u).2‖ ^ 2 < ρ ^ 2 + rw [← split_energy hk u] + nlinarith + +private theorem support_extension {n k : ℕ} (hk : k ≤ n) (ρ : ℝ) (hρ : 0 < ρ) + (phi : OpenPartialHomeomorph (X n) (E k × E (n-k))) (U : Set (X n)) + (Q : (E k × E (n-k)) → X n) (hsource : U ⊆ phi.source) + (houter : ∀ z, ρ / 2 ≤ ‖(split hk).symm z‖ → beta hk ρ hρ z = 0) : + Function.support (extension hk ρ hρ phi U Q) ⊆ M hk ρ phi := by + intro x hx + change extension hk ρ hρ phi U Q x ≠ 0 at hx + have hxU : x ∈ U := by + by_contra h + simp [extension, h] at hx + have hb : beta hk ρ hρ (phi x) ≠ 0 := by + intro h + simp [extension, hxU, h] at hx + have hlt : ‖(split hk).symm (phi x)‖ < ρ / 2 := by + by_contra h + exact hb (houter _ (le_of_not_gt h)) + have hK : phi x ∈ K hk ρ := by + refine ⟨(split hk).symm (phi x), ?_, (split hk).apply_symm_apply (phi x)⟩ + simpa only [Metric.mem_closedBall, dist_zero_right] using le_of_lt hlt + exact ⟨phi x, hK, phi.left_inv (hsource hxU)⟩ + +private theorem contDiff_extension {n k : ℕ} (hk : k ≤ n) (ρ : ℝ) (hρ : 0 < ρ) + (phi : OpenPartialHomeomorph (X n) (E k × E (n-k))) (U : Set (X n)) + (Q : (E k × E (n-k)) → X n) (hU : IsOpen U) + (hphi : ContDiffOn ℝ 1 phi U) (hQ : ContDiffOn ℝ 1 (Q ∘ phi) U) + (hM : IsCompact (M hk ρ phi)) (hMU : M hk ρ phi ⊆ U) + (hsupport : Function.support (extension hk ρ hρ phi U Q) ⊆ M hk ρ phi) : + ContDiff ℝ 1 (extension hk ρ hρ phi U Q) := by + have hb : ContDiff ℝ 1 (beta hk ρ hρ) := by + unfold beta + exact (cutoffBump ρ hρ).contDiff.comp (split hk).symm.contDiff + have hlocal : ContDiffOn ℝ 1 (extension hk ρ hρ phi U Q) U := by + have hbeta : ContDiffOn ℝ 1 (fun x => beta hk ρ hρ (phi x)) U := + hb.comp_contDiffOn hphi + apply (hbeta.smul hQ).congr + intro x hx + simp [extension, hx] + rw [contDiff_iff_contDiffAt] + intro x + by_cases hx : x ∈ U + · exact hlocal.contDiffAt (hU.mem_nhds hx) + · have hxM : x ∉ M hk ρ phi := fun h => hx (hMU h) + have hzero : extension hk ρ hρ phi U Q =ᶠ[𝓝 x] (fun _ => (0 : X n)) := + Filter.eventually_of_mem (hM.isClosed.compl_mem_nhds hxM) (by + intro y hy + by_contra hn + exact hy (hsupport hn)) + exact (contDiff_const : ContDiff ℝ 1 (fun _ : X n => (0 : X n))).contDiffAt.congr_of_eventuallyEq hzero + +private theorem extension_rate {n k : ℕ} (hk : k ≤ n) (ρ : ℝ) (hρ : 0 < ρ) + (F : X n → ℝ) (phi : OpenPartialHomeomorph (X n) (E k × E (n-k))) + (T : Set (E k × E (n-k))) (U : Set (X n)) + (Q : (E k × E (n-k)) → X n) (R : (E k × E (n-k)) → ℝ) + (hsource : U ⊆ phi.source) (hforward : MapsTo phi U T) + (hrate : ∀ z ∈ T, fderiv ℝ F (phi.symm z) (Q z) = R z) : + ∀ x, fderiv ℝ F x (extension hk ρ hρ phi U Q x) = + if x ∈ U then beta hk ρ hρ (phi x) * R (phi x) else 0 := by + intro x + by_cases hx : x ∈ U + · have hr := hrate (phi x) (hforward hx) + rw [phi.left_inv (hsource hx)] at hr + simp only [extension, if_pos hx, map_smul, smul_eq_mul] + rw [hr] + · simp [extension, hx] + +theorem compact_cutoff_of_geometry {n k : ℕ} (hk : k ≤ n) (ρ : ℝ) (hρ : 0 < ρ) + (F : X n → ℝ) (phi : OpenPartialHomeomorph (X n) (E k × E (n-k))) + (T : Set (E k × E (n-k))) (U : Set (X n)) (c : ℝ) (x0 : X n) + (hgeo : LocalGeometry F phi T U c x0) (hsource : U ⊆ phi.source) + (hrad : MorseCone.radiusBall ρ ⊆ T) : CompactGeometry hk ρ hρ F phi T U x0 := by + have hK : IsCompact (K hk ρ) := compact_K_of_split hk ρ + have hKT : K hk ρ ⊆ T := (K_subset_radiusBall hk ρ hρ).trans hrad + have hM : IsCompact (M hk ρ phi) := + hK.image_of_continuousOn (phi.continuousOn_symm.mono (hKT.trans hgeo.target_subset)) + have hMU : M hk ρ phi ⊆ U := by + rintro x ⟨z, hz, rfl⟩ + exact hgeo.inverse_target (hKT hz) + have hinner : ∀ z, ‖(split hk).symm z‖ ≤ ρ / 4 → beta hk ρ hρ z = 1 := by + intro z hz + change (cutoffBump ρ hρ) ((split hk).symm z) = 1 + apply (cutoffBump ρ hρ).one_of_mem_closedBall + simpa only [cutoffBump, Metric.mem_closedBall, dist_zero_right] using hz + have houter : ∀ z, ρ / 2 ≤ ‖(split hk).symm z‖ → beta hk ρ hρ z = 0 := by + intro z hz + change (cutoffBump ρ hρ) ((split hk).symm z) = 0 + apply (cutoffBump ρ hρ).zero_of_le_dist + simpa only [cutoffBump, dist_zero_right] using hz + have hs0 : Function.support (V0 hk ρ hρ phi U) ⊆ M hk ρ phi := + support_extension hk ρ hρ phi U (Q0 phi.symm) hsource houter + have hs1 : Function.support (V1 hk ρ hρ phi U) ⊆ M hk ρ phi := + support_extension hk ρ hρ phi U (Q1 phi.symm) hsource houter + have hphi : ContDiffOn ℝ 1 phi U := + (hgeo.forward_C2.of_le (by norm_num)).mono hsource + have hC0 : ContDiff ℝ 1 (V0 hk ρ hρ phi U) := + contDiff_extension hk ρ hρ phi U (Q0 phi.symm) hgeo.physical_open + hphi hgeo.physical0_C1 hM hMU hs0 + have hC1 : ContDiff ℝ 1 (V1 hk ρ hρ phi U) := + contDiff_extension hk ρ hρ phi U (Q1 phi.symm) hgeo.physical_open + hphi hgeo.physical1_C1 hM hMU hs1 + have hr0 : ∀ x, fderiv ℝ F x (V0 hk ρ hρ phi U x) = + if x ∈ U then beta hk ρ hρ (phi x) * (2 * ‖(phi x).2‖ ^ 2) else 0 := + extension_rate hk ρ hρ F phi T U (Q0 phi.symm) + (fun z => 2 * ‖z.2‖ ^ 2) hsource hgeo.forward_target hgeo.rate0 + have hr1 : ∀ x, fderiv ℝ F x (V1 hk ρ hρ phi U x) = + if x ∈ U then beta hk ρ hρ (phi x) * + (2 * (‖(phi x).1‖ ^ 2 + ‖(phi x).2‖ ^ 2)) else 0 := + extension_rate hk ρ hρ F phi T U (Q1 phi.symm) + (fun z => 2 * (‖z.1‖ ^ 2 + ‖z.2‖ ^ 2)) hsource hgeo.forward_target hgeo.rate1 + have hcenter : x0 ∈ U := by + simpa only [hgeo.center_inverse] using hgeo.inverse_target hgeo.center_target + have hinnerT : ∀ z, ‖(split hk).symm z‖ ≤ ρ / 4 → z ∈ T := by + intro z hz + have hle : ‖(split hk).symm z‖ ≤ ρ / 2 := by linarith + have hzK : z ∈ K hk ρ := by + refine ⟨(split hk).symm z, ?_, (split hk).apply_symm_apply z⟩ + simpa only [Metric.mem_closedBall, dist_zero_right] using hle + exact hKT hzK + have hinnerU : ∀ z, ‖(split hk).symm z‖ ≤ ρ / 4 → phi.symm z ∈ U := + fun z hz => hgeo.inverse_target (hinnerT z hz) + refine { + inner_one := hinner + outer_zero := houter + beta_bounds := fun z => + ⟨(cutoffBump ρ hρ).nonneg' ((split hk).symm z), + (cutoffBump ρ hρ).le_one (x := (split hk).symm z)⟩ + compact_K := hK + compact_M := hM + K_target := hKT + M_physical := hMU + support0 := hs0 + support1 := hs1 + C1_0 := hC0 + C1_1 := hC1 + compact0 := hM.closure_of_subset hs0 + compact1 := hM.closure_of_subset hs1 + rate0 := hr0 + rate1 := hr1 + nonnegative0 := by + intro x + rw [hr0] + split_ifs with hx + · exact mul_nonneg ((cutoffBump ρ hρ).nonneg' ((split hk).symm (phi x))) + (by positivity) + · exact le_refl 0 + nonnegative1 := by + intro x + rw [hr1] + split_ifs with hx + · exact mul_nonneg ((cutoffBump ρ hρ).nonneg' ((split hk).symm (phi x))) + (by positivity) + · exact le_refl 0 + inner_rate0 := by + intro z hz + have hxU := hinnerU z hz + rw [hr0, if_pos hxU, phi.right_inv (hgeo.target_subset (hinnerT z hz)), + hinner z hz] + ring + inner_rate1 := by + intro z hz + have hxU := hinnerU z hz + rw [hr1, if_pos hxU, + phi.right_inv (hgeo.target_subset (hinnerT z hz)), hinner z hz] + ring + center0 := by + simp [V0, extension, hcenter, hgeo.center_forward, hgeo.center_push0] + center1 := by + simp [V1, extension, hcenter, hgeo.center_forward, hgeo.center_push1] } + + +#eval IO.eprintln "BOUNDARY generic-target" +theorem actual_source_compact_cutoff {n : ℕ} {L : ℝ} [Fact (0 < L)] + (omega : I4Source.SourceMode n → ℝ) + (hmajor : Summable (fun m => I4Source.modeMajorant n L m * |omega m|)) + (x0 : X n) (hdet : (PhysicalSpectral.hessian (L := L) omega x0).det ≠ 0) + (hcrit : fderiv ℝ (I4Source.sourceField n L omega) x0 = 0) : + ∃ (k : ℕ) (hk : k ≤ n) (P : E n ≃L[ℝ] X n) (s : Sym n → Sym n) + (e : OpenPartialHomeomorph (E n) (E n)) + (D : MorseCone.NormalForm (I4Torus.SourceTorus n L) (E k) (E (n-k))), + let J := PhysicalSpectral.signSym n k + let M := TaylorSymLift.sourceSymMatrix (L := L) omega x0 P.toContinuousLinearMap + M 0 = J ∧ (∀ u, e u = theta J s M u) ∧ + e 0 = 0 ∧ e.symm 0 = 0 ∧ 0 ∈ e.source ∧ 0 ∈ e.target ∧ + HasFDerivAt e (ContinuousLinearMap.id ℝ (E n)) 0 ∧ + ContDiffOn ℝ 2 e e.source ∧ ContDiffOn ℝ 2 e.symm e.target ∧ + D.f = I4Torus.torusSourceField n L omega ∧ + D.p = I4Torus.torusProjection n L x0 ∧ D.c = I4Source.sourceField n L omega x0 ∧ + D.chart = (liftChart (L := L) x0).trans (physicalChart hk x0 P e) ∧ + (∀ q, D.chart q = split hk (e (P.symm (liftChart (L := L) x0 q - x0)))) ∧ + (∀ z, D.chart.symm z = I4Torus.torusProjection n L (x0 + P (e.symm ((split hk).symm z)))) ∧ + ContMDiffOn 𝓘(ℝ, X n) 𝓘(ℝ, E k × E (n-k)) 2 D.chart D.chart.source ∧ + ContMDiffOn 𝓘(ℝ, E k × E (n-k)) 𝓘(ℝ, X n) 2 D.chart.symm D.chart.target ∧ + LocalGeometry (I4Source.sourceField n L omega) (physicalChart hk x0 P e) + D.chart.target ((physicalChart hk x0 P e).source ∩ (liftChart (L := L) x0).target) + D.c x0 ∧ + CompactGeometry hk D.ρ D.hρ (I4Source.sourceField n L omega) + (physicalChart hk x0 P e) D.chart.target + ((physicalChart hk x0 P e).source ∩ (liftChart (L := L) x0).target) x0 := by + obtain ⟨k, hk, P, s, e, D, hM0, heq, he0, hi0, h0s, h0t, hd, heC, hiC, + hf, hp, hc, hchart, happly, hsymm, hC, hCi, hgeo⟩ := + actual_source_pushed_height omega hmajor x0 hdet hcrit + refine ⟨k, hk, P, s, e, D, hM0, heq, he0, hi0, h0s, h0t, hd, heC, hiC, + hf, hp, hc, hchart, happly, hsymm, hC, hCi, hgeo, ?_⟩ + exact compact_cutoff_of_geometry hk D.ρ D.hρ (I4Source.sourceField n L omega) + (physicalChart hk x0 P e) D.chart.target + ((physicalChart hk x0 P e).source ∩ (liftChart (L := L) x0).target) + D.c x0 hgeo inter_subset_left D.ball_target + + +#eval IO.eprintln "BOUNDARY actual-target" +end SourceCompactCutoff diff --git a/frontiers/compact_source_cutoff_controls_final_repair_20261011/ConeFootprint.lean b/frontiers/compact_source_cutoff_controls_final_repair_20261011/ConeFootprint.lean new file mode 100644 index 000000000..7784d1469 --- /dev/null +++ b/frontiers/compact_source_cutoff_controls_final_repair_20261011/ConeFootprint.lean @@ -0,0 +1,259 @@ +import QuadraticCone +import OpenComponentGluing + +noncomputable section +open Set CategoryTheory +namespace MorseCone +universe u +variable {X : Type u} [TopologicalSpace X] [T1Space X] +variable {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + [NormedAddCommGroup F] [NormedSpace ℝ F] + +/-- Genuine local function normal form; no component or attachment conclusions. -/ +structure NormalForm (X E F : Type*) [TopologicalSpace X] + [NormedAddCommGroup E] [NormedSpace ℝ E] + [NormedAddCommGroup F] [NormedSpace ℝ F] where + f : X → ℝ + p : X + c : ℝ + ρ : ℝ + hρ : 0 < ρ + chart : OpenPartialHomeomorph X (E × F) + center_mem : p ∈ chart.source + center_eq : chart p = 0 + ball_target : radiusBall ρ ⊆ chart.target + equation : ∀ x ∈ chart.source, f x = c + quadratic (chart x) + +def closedLevel (D : NormalForm X E F) := {x : X | D.c ≤ D.f x} +def oldSet (D : NormalForm X E F) : Set (closedLevel D) := {x | x.val ≠ D.p} +def patchSet (D : NormalForm X E F) : Set (closedLevel D) := + {x | x.val ∈ D.chart.source ∧ D.chart x.val ∈ radiusBall D.ρ} + +private theorem radius_open (ρ : ℝ) : IsOpen (radiusBall (E := E) (F := F) ρ) := + isOpen_lt (by fun_prop) continuous_const + +private theorem symm_zero (D : NormalForm X E F) : D.chart.symm 0 = D.p := by + simpa only [D.center_eq] using D.chart.left_inv D.center_mem + +private def liftCone (D : NormalForm X E F) (q : cone (E := E) (F := F) D.ρ) : + closedLevel D := by + refine ⟨D.chart.symm q.val, ?_⟩ + have hq := D.ball_target q.property.2 + change D.c ≤ D.f (D.chart.symm q.val) + rw [D.equation _ (D.chart.map_target hq), D.chart.right_inv hq] + have hs := (sq_le_sq₀ (norm_nonneg q.val.2) (norm_nonneg q.val.1)).2 q.property.1 + change D.c ≤ D.c + (‖q.val.1‖^2 - ‖q.val.2‖^2) + linarith + +private theorem liftCone_continuous (D : NormalForm X E F) : Continuous (liftCone D) := by + apply Continuous.subtype_mk + exact D.chart.continuousOn_symm.comp_continuous continuous_subtype_val + (fun q => D.ball_target q.property.2) + +private theorem patch_range (D : NormalForm X E F) : patchSet D = range (liftCone D) := by + ext x + constructor + · intro hx + have he := D.equation x.val hx.1 + have hf : D.c ≤ D.f x.val := x.property + rw [he] at hf + have hs : ‖(D.chart x.val).2‖^2 ≤ ‖(D.chart x.val).1‖^2 := by + dsimp [quadratic] at hf + linarith + let q : cone (E := E) (F := F) D.ρ := ⟨D.chart x.val, + ⟨(sq_le_sq₀ (norm_nonneg _) (norm_nonneg _)).1 hs, hx.2⟩⟩ + refine ⟨q, ?_⟩ + apply Subtype.ext + exact D.chart.left_inv hx.1 + · rintro ⟨q, rfl⟩ + refine ⟨D.chart.map_target (D.ball_target q.property.2), ?_⟩ + change D.chart (D.chart.symm q.val) ∈ radiusBall D.ρ + rw [D.chart.right_inv (D.ball_target q.property.2)] + exact q.property.2 + +private def liftPuncture (D : NormalForm X E F) + (q : puncture (E := E) (F := F) D.ρ) : oldSet D := by + refine ⟨liftCone D ⟨q.val,q.property.1⟩, ?_⟩ + intro he + have hh := congrArg D.chart he + change D.chart (D.chart.symm q.val) = D.chart D.p at hh + rw [D.chart.right_inv (D.ball_target q.property.1.2), D.center_eq] at hh + exact q.property.2 (mem_singleton_iff.mpr hh) + +private theorem liftPuncture_continuous (D : NormalForm X E F) : Continuous (liftPuncture D) := by + apply Continuous.subtype_mk + exact (liftCone_continuous D).comp (Continuous.subtype_mk continuous_subtype_val (fun q => q.property.1)) + +private theorem old_patch_range (D : NormalForm X E F) : + {x : oldSet D | x.val ∈ patchSet D} = range (liftPuncture D) := by + ext x + constructor + · intro hx + have hx' : x.val ∈ range (liftCone D) := by rw [← patch_range D]; exact hx + obtain ⟨q,hq⟩ := hx' + have hn : q.val ≠ 0 := by + intro hzero + apply x.property + calc + x.val.val = D.chart.symm q.val := (congrArg Subtype.val hq).symm + _ = D.chart.symm 0 := congrArg D.chart.symm hzero + _ = D.p := symm_zero D + refine ⟨⟨q.val, q.property, by simpa using hn⟩, ?_⟩ + exact Subtype.ext hq + · rintro ⟨q,rfl⟩ + change liftCone D ⟨q.val,q.property.1⟩ ∈ patchSet D + rw [patch_range D] + exact ⟨⟨q.val,q.property.1⟩,rfl⟩ + +private theorem range_pc {A B : Type*} [TopologicalSpace A] [PathConnectedSpace A] + [TopologicalSpace B] (g : A → B) (hg : Continuous g) : IsPathConnected (range g) := by + simpa only [image_univ] using (pathConnectedSpace_iff_univ.mp inferInstance).image hg + +private theorem old_open (D : NormalForm X E F) : IsOpen (oldSet D) := + isClosed_singleton.isOpen_compl.preimage continuous_subtype_val + +private def positiveLift (D : NormalForm X ℝ F) (q : positiveLobe (F := F) D.ρ) : oldSet D := + liftPuncture D ⟨q.val, by rw [one_puncture_partition]; exact Or.inl q.property⟩ + +private def negativeLift (D : NormalForm X ℝ F) (q : negativeLobe (F := F) D.ρ) : oldSet D := + liftPuncture D ⟨q.val, by rw [one_puncture_partition]; exact Or.inr q.property⟩ + +private theorem positiveLift_continuous (D : NormalForm X ℝ F) : Continuous (positiveLift D) := by + exact (liftPuncture_continuous D).comp (Continuous.subtype_mk continuous_subtype_val + (fun q : positiveLobe (F := F) D.ρ => by + rw [one_puncture_partition]; exact Or.inl q.property)) + +private theorem negativeLift_continuous (D : NormalForm X ℝ F) : Continuous (negativeLift D) := by + exact (liftPuncture_continuous D).comp (Continuous.subtype_mk continuous_subtype_val + (fun q : negativeLobe (F := F) D.ρ => by + rw [one_puncture_partition]; exact Or.inr q.property)) + +private theorem old_patch_lobes (D : NormalForm X ℝ F) : + {x : oldSet D | x.val ∈ patchSet D} = range (positiveLift D) ∪ range (negativeLift D) := by + rw [old_patch_range D] + ext x + constructor + · rintro ⟨q,rfl⟩ + have hq : q.val ∈ positiveLobe D.ρ ∪ negativeLobe D.ρ := by + rw [← one_puncture_partition] + exact q.property + rcases hq with hp | hn + · exact Or.inl ⟨⟨q.val,hp⟩,rfl⟩ + · exact Or.inr ⟨⟨q.val,hn⟩,rfl⟩ + · rintro (⟨q,rfl⟩ | ⟨q,rfl⟩) + · exact ⟨⟨q.val,by rw [one_puncture_partition]; exact Or.inl q.property⟩,rfl⟩ + · exact ⟨⟨q.val,by rw [one_puncture_partition]; exact Or.inr q.property⟩,rfl⟩ + +theorem patch_open (D : NormalForm X E F) : IsOpen (patchSet D) := by + change IsOpen (Subtype.val ⁻¹' (D.chart.source ∩ D.chart ⁻¹' radiusBall D.ρ)) + exact (D.chart.isOpen_inter_preimage (radius_open D.ρ)).preimage continuous_subtype_val + +theorem critical_cover (D : NormalForm X E F) : oldSet D ∪ patchSet D = univ := by + ext x + constructor + · intro _; trivial + · intro _ + by_cases he : x.val = D.p + · refine Or.inr ⟨he ▸ D.center_mem, ?_⟩ + change ‖(D.chart x.val).1‖^2+‖(D.chart x.val).2‖^2 q.val ∈ S) + (cone_zero_positive D.ρ D.hρ)).mp hh + exact mem_singleton_iff.mp hh' + apply x.property + calc + x.val.val = D.chart.symm q.val := (congrArg Subtype.val hq).symm + _ = D.chart.symm 0 := congrArg D.chart.symm hz + _ = D.p := symm_zero D + +theorem higher_foot (D : NormalForm X E F) (hE : 1 < Module.rank ℝ E) : + ∃ a : ZerothHomotopy (oldSet D), ∀ q, + MorseOpenGluing.Foot (oldSet D) (patchSet D) q ↔ q = a := by + letI : PathConnectedSpace (puncture (E := E) (F := F) D.ρ) := + isPathConnected_iff_pathConnectedSpace.mp (higher_puncture_pathConnected D.ρ D.hρ hE) + have hs := range_pc (liftPuncture D) (liftPuncture_continuous D) + obtain ⟨a,ha,hjoin⟩ := hs + refine ⟨ZerothHomotopy.mk a, ?_⟩ + intro q + constructor + · rintro ⟨x,hx,hq⟩ + have hx' : x ∈ range (liftPuncture D) := by rw [← old_patch_range D]; exact hx + exact hq.symm.trans (ZerothHomotopy.sound (hjoin hx').symm.somePath) + · intro hq + subst q + exact ⟨a,by + change a ∈ {x : oldSet D | x.val ∈ patchSet D} + rw [old_patch_range D]; exact ha,rfl⟩ + +theorem one_foot (D : NormalForm X ℝ F) : + ∃ a b : ZerothHomotopy (oldSet D), ∀ q, + MorseOpenGluing.Foot (oldSet D) (patchSet D) q ↔ q = a ∨ q = b := by + letI : PathConnectedSpace (positiveLobe (F := F) D.ρ) := + isPathConnected_iff_pathConnectedSpace.mp (one_positive_lobe D.ρ D.hρ) + letI : PathConnectedSpace (negativeLobe (F := F) D.ρ) := + isPathConnected_iff_pathConnectedSpace.mp (one_negative_lobe D.ρ D.hρ) + have hp := range_pc (positiveLift D) (positiveLift_continuous D) + have hn := range_pc (negativeLift D) (negativeLift_continuous D) + obtain ⟨a,ha,hpa⟩ := hp + obtain ⟨b,hb,hnb⟩ := hn + refine ⟨ZerothHomotopy.mk a,ZerothHomotopy.mk b,?_⟩ + intro q + constructor + · rintro ⟨x,hx,hq⟩ + have hx' : x ∈ range (positiveLift D) ∪ range (negativeLift D) := by + rw [← old_patch_lobes D]; exact hx + rcases hx' with hxpos | hxneg + · exact Or.inl (hq.symm.trans (ZerothHomotopy.sound (hpa hxpos).symm.somePath)) + · exact Or.inr (hq.symm.trans (ZerothHomotopy.sound (hnb hxneg).symm.somePath)) + · rintro (hq | hq) + · subst q + exact ⟨a,by + change a ∈ {x : oldSet D | x.val ∈ patchSet D} + rw [old_patch_lobes D]; exact Or.inl ha,rfl⟩ + · subst q + exact ⟨b,by + change b ∈ {x : oldSet D | x.val ∈ patchSet D} + rw [old_patch_lobes D]; exact Or.inr hb,rfl⟩ + +noncomputable def zero_event (D : NormalForm X (EuclideanSpace ℝ (Fin 0)) F) : + ElementaryHistory.Event (MorseOpenGluing.inclusionMap (oldSet D)) := by + exact MorseOpenGluing.birthEvent (oldSet D) (patchSet D) (old_open D) (patch_open D) + (critical_cover D) (patch_pathConnected D) (zero_foot D) + +noncomputable def higher_event (D : NormalForm X E F) (hE : 1 < Module.rank ℝ E) : + ElementaryHistory.Event (MorseOpenGluing.inclusionMap (oldSet D)) := by + let a := Classical.choose (higher_foot D hE) + have ha := Classical.choose_spec (higher_foot D hE) + exact MorseOpenGluing.neutralEvent (oldSet D) (patchSet D) (old_open D) (patch_open D) + (critical_cover D) (patch_pathConnected D) a ha + +noncomputable def one_event (D : NormalForm X ℝ F) : + ElementaryHistory.Event (MorseOpenGluing.inclusionMap (oldSet D)) := by + let a := Classical.choose (one_foot D) + let b := Classical.choose (Classical.choose_spec (one_foot D)) + have hf : ∀ q, MorseOpenGluing.Foot (oldSet D) (patchSet D) q ↔ q=a ∨ q=b := + Classical.choose_spec (Classical.choose_spec (one_foot D)) + by_cases hab : a=b + · exact MorseOpenGluing.neutralEvent (oldSet D) (patchSet D) (old_open D) (patch_open D) + (critical_cover D) (patch_pathConnected D) a (by intro q; simpa only [← hab, or_self] using hf q) + · exact MorseOpenGluing.mergeEvent (oldSet D) (patchSet D) (old_open D) (patch_open D) + (critical_cover D) (patch_pathConnected D) a b hab hf + +end MorseCone diff --git a/frontiers/compact_source_cutoff_controls_final_repair_20261011/DeterministicSourceC4.lean b/frontiers/compact_source_cutoff_controls_final_repair_20261011/DeterministicSourceC4.lean new file mode 100644 index 000000000..fee363e46 --- /dev/null +++ b/frontiers/compact_source_cutoff_controls_final_repair_20261011/DeterministicSourceC4.lean @@ -0,0 +1,56 @@ +import SourceTorusC4 + +noncomputable section +open I4Foundation I4Weights I4Source I4C4 I4Torus I4TorusC4 +open scoped Manifold ContDiff Topology +namespace I4DeterministicC4 +attribute [local instance] actualChartedSpace + +theorem sourceField_contDiff_of_majorant (d : ℕ) {L : ℝ} (hL : L ≠ 0) + (coeff : SourceMode d → ℝ) (hcoeff : Summable (fun m => modeMajorant d L m * |coeff m|)) : + ContDiff ℝ 4 (sourceField d L coeff) := by + have hc (m : SourceMode d) : ContDiff ℝ 4 (modeCoefficient d L m) := by + cases m with + | none => + change ContDiff ℝ 4 (fun _ : Fin d → ℝ => Real.sqrt (1 / sourceZ d L)) + fun_prop + | some p => + rcases p with ⟨k, b⟩ + change ContDiff ℝ 4 (fun x : Fin d → ℝ => + Real.sqrt (2 * sourceWeight d L k / sourceZ d L) * + (if b then Real.sin (phase d L k x) else Real.cos (phase d L k x))) + cases b <;> simp [phase] <;> fun_prop + change ContDiff ℝ 4 (fun x => ∑' m, modeCoefficient d L m x * coeff m) + apply contDiff_tsum (v := fun _ m => modeMajorant d L m * |coeff m|) + · intro m + exact (hc m).mul contDiff_const + · intro j hj + exact hcoeff + · intro j m x hj + have hj' : j ≤ 4 := by exact_mod_cast hj + have hcj : ContDiff ℝ j (modeCoefficient d L m) := + (hc m).of_le (by exact_mod_cast hj') + have heq : (fun y => modeCoefficient d L m y * coeff m) = coeff m • modeCoefficient d L m := by + funext y + simp [smul_eq_mul, mul_comm] + rw [heq, iteratedFDeriv_const_smul_apply hcj.contDiffAt, norm_smul, Real.norm_eq_abs] + simpa only [mul_comm] using mul_le_mul_of_nonneg_left + (modeCoefficient_iteratedFDeriv_bound d hL m j hj' x) (abs_nonneg (coeff m)) + +theorem torusSourceField_contMDiff_of_majorant (d : ℕ) (L : ℝ) [Fact (0 < L)] + (coeff : SourceMode d → ℝ) (hcoeff : Summable (fun m => modeMajorant d L m * |coeff m|)) : + ContMDiff 𝓘(ℝ, Fin d → ℝ) 𝓘(ℝ) 4 (torusSourceField d L coeff) := by + let _ := torus_isManifold d L + have hs := sourceField_contDiff_of_majorant d (Fact.out : 0 < L).ne' coeff hcoeff + intro q + rw [contMDiffAt_iff_source] + have heq : torusSourceField d L coeff ∘ (extChartAt 𝓘(ℝ, Fin d → ℝ) q).symm = + sourceField d L coeff := by + funext x + change torusSourceField d L coeff ((quotientChart d L (chartCenter d L q)).symm x) = _ + rw [quotientChart_symm] + exact torusSourceField_pullback d L coeff x + rw [heq, contMDiffWithinAt_iff_contDiffWithinAt] + exact hs.contDiffAt.contDiffWithinAt + +end I4DeterministicC4 diff --git a/frontiers/compact_source_cutoff_controls_final_repair_20261011/ElementaryHistory.lean b/frontiers/compact_source_cutoff_controls_final_repair_20261011/ElementaryHistory.lean new file mode 100644 index 000000000..56062748f --- /dev/null +++ b/frontiers/compact_source_cutoff_controls_final_repair_20261011/ElementaryHistory.lean @@ -0,0 +1,110 @@ +import Mathlib.CategoryTheory.Category.Preorder +import Mathlib.CategoryTheory.Types.Basic +import Mathlib.Data.Finset.Max +import Mathlib.Order.Fin.Basic + +noncomputable section +open CategoryTheory +universe u +namespace ElementaryHistory + +/-- Primitive unlabelled component transitions. No elder, basis or interval data. -/ +inductive Event {A B : Type u} (f : A → B) where + | birth (fresh : B) (injective : Function.Injective f) + (new : fresh ∉ Set.range f) (cover : ∀ b, b = fresh ∨ b ∈ Set.range f) + | merge (left right : A) (distinct : left ≠ right) (surjective : Function.Surjective f) + (fiber : ∀ a b, f a = f b ↔ a = b ∨ + (a = left ∧ b = right) ∨ (a = right ∧ b = left)) + | neutral (bijective : Function.Bijective f) + +def Event.isBirth {A B : Type u} {f : A → B} : Event f → Prop + | .birth .. => True + | .merge .. => False + | .neutral .. => False + +def Event.birthPoint {A B : Type u} {f : A → B} (e : Event f) (h : e.isBirth) : B := by + cases e with + | birth fresh _ _ _ => exact fresh + | merge _ _ _ _ _ => exact False.elim h + | neutral _ => exact False.elim h + +private theorem Event.birthPoint_eq_birth {A B : Type u} {f : A → B} + {e : Event f} {fresh : B} {hi : Function.Injective f} {hn : fresh ∉ Set.range f} + {hc : ∀ b, b = fresh ∨ b ∈ Set.range f} (he : e = .birth fresh hi hn hc) + (h : e.isBirth) : e.birthPoint h = fresh := by + cases he + rfl + +structure History (n : ℕ) where + diagram : Fin (n + 1) ⥤ Type u + finite : ∀ t, Finite (diagram.obj t) + initial : IsEmpty (diagram.obj 0) + event : ∀ i : Fin n, Event (diagram.map (homOfLE (show i.castSucc ≤ i.succ by + simp only [Fin.le_def, Fin.val_castSucc, Fin.val_succ]; omega))) + +namespace History + +variable {n : ℕ} (H : History.{u} n) + +abbrev Component (t : Fin (n + 1)) := H.diagram.obj t +instance (t : Fin (n + 1)) : Finite (H.Component t) := H.finite t + +def step (i : Fin n) : H.Component i.castSucc → H.Component i.succ := + H.diagram.map (homOfLE (show i.castSucc ≤ i.succ by + simp only [Fin.le_def, Fin.val_castSucc, Fin.val_succ]; omega)) + +def BirthTag := {i : Fin n // (H.event i).isBirth} +def bornStage (b : H.BirthTag) : Fin (n + 1) := b.1.succ +def BornAt (t : Fin (n + 1)) := {b : H.BirthTag // H.bornStage b ≤ t} + +def birthPoint (b : H.BirthTag) : H.Component (H.bornStage b) := + (H.event b.1).birthPoint b.2 + +def origin (t : Fin (n + 1)) (b : H.BornAt t) : H.Component t := + H.diagram.map (homOfLE b.2) (H.birthPoint b.1) + +theorem origin_map {t s : Fin (n + 1)} (h : t ≤ s) (b : H.BornAt t) : + H.diagram.map (homOfLE h) (H.origin t b) = + H.origin s ⟨b.1, b.2.trans h⟩ := by + simpa only [origin, homOfLE_comp] using + (H.diagram.map_comp_apply (homOfLE b.2) (homOfLE h) (H.birthPoint b.1)).symm + +theorem origin_surjective (t : Fin (n + 1)) : Function.Surjective (H.origin t) := by + classical + induction t using Fin.induction with + | zero => + intro x + exact (H.initial.false x).elim + | succ i ih => + have hs : i.castSucc ≤ i.succ := by + simp only [Fin.le_def, Fin.val_castSucc, Fin.val_succ] + omega + have hold : ∀ x : H.Component i.castSucc, + ∃ b : H.BornAt i.succ, H.origin i.succ b = H.step i x := by + intro x + obtain ⟨b, hb⟩ := ih x + refine ⟨⟨b.1, b.2.trans hs⟩, ?_⟩ + rw [← H.origin_map hs b, hb] + rfl + cases he : H.event i with + | birth fresh hinj hnew hcover => + intro y + rcases hcover y with rfl | ⟨x, rfl⟩ + · let b : H.BirthTag := ⟨i, by rw [he]; trivial⟩ + refine ⟨⟨b, le_rfl⟩, ?_⟩ + have hp : H.birthPoint b = y := Event.birthPoint_eq_birth he b.2 + change (H.diagram.map (homOfLE (le_refl i.succ))) (H.birthPoint b) = y + rw [hp] + exact H.diagram.map_id_apply i.succ y + · exact hold x + | merge left right hne hsurj hfiber => + intro y + obtain ⟨x, rfl⟩ := hsurj y + exact hold x + | neutral hbij => + intro y + obtain ⟨x, rfl⟩ := hbij.surjective y + exact hold x + +end History +end ElementaryHistory diff --git a/frontiers/compact_source_cutoff_controls_final_repair_20261011/GaussianSeriesFoundation.lean b/frontiers/compact_source_cutoff_controls_final_repair_20261011/GaussianSeriesFoundation.lean new file mode 100644 index 000000000..93651da7f --- /dev/null +++ b/frontiers/compact_source_cutoff_controls_final_repair_20261011/GaussianSeriesFoundation.lean @@ -0,0 +1,96 @@ +import Mathlib.Probability.Distributions.Gaussian.Real +import Mathlib.Probability.Independence.InfinitePi +import Mathlib.MeasureTheory.Function.LpSpace.InfiniteSum +import Mathlib.MeasureTheory.Function.LpSeminorm.SMul + +/-! The actual product law and the almost-sure absolute-series foundation. +This does not assert a Fourier covariance, sample smoothness or finite-jet rank. -/ + +noncomputable section + +open MeasureTheory ProbabilityTheory +open scoped ENNReal + +namespace I4Foundation + +/-- The same actual probability measure used for every coefficient and series assertion. -/ +def coefficientLaw (ι : Type*) : Measure (ι → ℝ) := + Measure.infinitePi (fun _ : ι => gaussianReal 0 1) + +instance coefficientLaw_isProbabilityMeasure (ι : Type*) : + IsProbabilityMeasure (coefficientLaw ι) := by + unfold coefficientLaw + infer_instance + +theorem coordinate_measurePreserving {ι : Type*} (i : ι) : + MeasurePreserving (fun ω : ι → ℝ => ω i) (coefficientLaw ι) + (gaussianReal 0 1) := by + exact measurePreserving_eval_infinitePi (fun _ : ι => gaussianReal 0 1) i + +theorem coordinate_marginal {ι : Type*} (i : ι) : + (coefficientLaw ι).map (fun ω => ω i) = gaussianReal 0 1 := by + exact (coordinate_measurePreserving i).map_eq + +theorem coordinates_independent (ι : Type*) : + iIndepFun (fun i (ω : ι → ℝ) => ω i) (coefficientLaw ι) := by + exact iIndepFun_infinitePi (P := fun _ : ι => gaussianReal 0 1) + (X := fun _ : ι => id) (fun _ => measurable_id) + +theorem coordinate_memLp {ι : Type*} (i : ι) (p : ℝ≥0∞) (hp : p ≠ ∞) : + MemLp (fun ω : ι → ℝ => ω i) p (coefficientLaw ι) := by + exact (memLp_id_gaussianReal' p hp).comp_measurePreserving + (coordinate_measurePreserving i) + +theorem coordinate_integrable {ι : Type*} (i : ι) : + Integrable (fun ω : ι → ℝ => ω i) (coefficientLaw ι) := by + exact memLp_one_iff_integrable.mp (coordinate_memLp i 1 (by simp)) + +theorem coordinate_abs_integrable {ι : Type*} (i : ι) : + Integrable (fun ω : ι → ℝ => |ω i|) (coefficientLaw ι) := by + simpa only [Real.norm_eq_abs] using (coordinate_integrable i).norm + +theorem weighted_abs_summable_ae {ι : Type*} [Countable ι] + (a : ι → ℝ) (ha : ∀ i, 0 ≤ a i) (hs : Summable a) : + ∀ᵐ ω ∂coefficientLaw ι, Summable (fun i => a i * |ω i|) := by + let C := eLpNorm id 1 (gaussianReal 0 1) + have hC : C < ∞ := (memLp_id_gaussianReal' 1 (by simp)).eLpNorm_lt_top + have hcoord (i : ι) : + eLpNorm (fun ω : ι → ℝ => ω i) 1 (coefficientLaw ι) = C := by + exact eLpNorm_comp_measurePreserving + (memLp_id_gaussianReal' 1 (by simp)).aestronglyMeasurable + (coordinate_measurePreserving i) + have hnorm (i : ι) : + eLpNorm (fun ω : ι → ℝ => a i * ω i) 1 (coefficientLaw ι) = + ENNReal.ofReal (a i) * C := by + change eLpNorm (a i • (fun ω : ι → ℝ => ω i)) 1 (coefficientLaw ι) = _ + rw [eLpNorm_const_smul, Real.enorm_eq_ofReal (ha i), hcoord] + have hsum : (∑' i, eLpNorm (fun ω : ι → ℝ => a i * ω i) 1 + (coefficientLaw ι)) ≠ ∞ := by + simp_rw [hnorm] + rw [ENNReal.tsum_mul_right] + exact ENNReal.mul_ne_top hs.tsum_ofReal_ne_top hC.ne + have h := summable_norm_of_tsum_eLpNorm_ne_top (p := 1) (le_refl 1) hsum + filter_upwards [h] with ω hω + simpa only [Real.norm_eq_abs, abs_mul, abs_of_nonneg (ha _)] using hω + +/-- The actual scalar sum; its convergence is proved separately on the product law. -/ +def scalarSeries {ι : Type*} (a : ι → ℝ) (ω : ι → ℝ) : ℝ := + ∑' i, a i * ω i + +theorem scalarSeries_measurable {ι : Type*} [Countable ι] (a : ι → ℝ) : + Measurable (scalarSeries a) := by + unfold scalarSeries + apply Measurable.tsum + intro i + exact measurable_const.mul (measurable_pi_apply i) + +theorem scalarSeries_hasSum_ae {ι : Type*} [Countable ι] + (a : ι → ℝ) (hs : Summable a) : + ∀ᵐ ω ∂coefficientLaw ι, HasSum (fun i => a i * ω i) (scalarSeries a ω) := by + filter_upwards [weighted_abs_summable_ae (fun i => |a i|) + (fun i => abs_nonneg _) hs.abs] with ω hω + have hnorm : Summable (fun i => ‖a i * ω i‖) := by + simpa only [Real.norm_eq_abs, abs_mul] using hω + exact hnorm.of_norm.hasSum + +end I4Foundation diff --git a/frontiers/compact_source_cutoff_controls_final_repair_20261011/GlobalComponentMaps.lean b/frontiers/compact_source_cutoff_controls_final_repair_20261011/GlobalComponentMaps.lean new file mode 100644 index 000000000..7d2d8ef33 --- /dev/null +++ b/frontiers/compact_source_cutoff_controls_final_repair_20261011/GlobalComponentMaps.lean @@ -0,0 +1,83 @@ +import OrdinaryH0Image + +noncomputable section +open CategoryTheory OrdinaryH0Elder OrdinaryH0Image +universe u +namespace GlobalComponentMaps + +variable (K : Type u) [Field K] + +def componentMap {X Y : TopCat.{u}} (g : X ⟶ Y) : + ZerothHomotopy X → ZerothHomotopy Y := + ZerothHomotopy.lift (fun x => ZerothHomotopy.mk (g x)) + (fun {_ _} p => ZerothHomotopy.sound (p.map g.hom.continuous)) + +theorem componentEquiv_map {X Y : TopCat.{u}} (g : X ⟶ Y) (v : H0 K X) : + componentEquiv K Y ((h0Functor K).map g v) = + Finsupp.mapDomain (componentMap g) (componentEquiv K X v) := by + have he : (componentEquiv K Y).toLinearMap.comp ((h0Functor K).map g).hom = + (Finsupp.lmapDomain K K (componentMap g)).comp (componentEquiv K X).toLinearMap := by + apply LinearMap.ext_on_range (pointClasses_span_top K X) + intro x + simp only [LinearMap.comp_apply, LinearEquiv.coe_coe, pointClass_map] + simp [pointClass, componentMap] + exact LinearMap.congr_fun he v + +def binaryMerge {ι : Type u} : Option (Option ι) → Option ι + | none => none + | some none => none + | some (some i) => some i + +def mergeDifference (ι : Type u) : Option (Option ι) →₀ K := + Finsupp.single none 1 - Finsupp.single (some none) 1 + +private theorem merge_none {ι : Type u} (v : Option (Option ι) →₀ K) : + Finsupp.mapDomain binaryMerge v none = v none + v (some none) := by + classical + induction v using Finsupp.induction_linear with + | zero => simp + | add a b ha hb => simp only [Finsupp.mapDomain_add, Finsupp.add_apply, ha, hb]; ring + | single j a => cases j with + | none => simp [binaryMerge] + | some j => cases j <;> simp [binaryMerge] + +private theorem merge_some {ι : Type u} (v : Option (Option ι) →₀ K) (i : ι) : + Finsupp.mapDomain binaryMerge v (some i) = v (some (some i)) := by + classical + induction v using Finsupp.induction_linear with + | zero => simp + | add a b ha hb => simp only [Finsupp.mapDomain_add, Finsupp.add_apply, ha, hb] + | single j a => cases j with + | none => simp [binaryMerge] + | some j => cases j <;> simp [binaryMerge, Finsupp.single_apply] + +theorem binaryMerge_kernel (ι : Type u) : + LinearMap.ker (Finsupp.lmapDomain K K (binaryMerge (ι := ι))) = + Submodule.span K {mergeDifference K ι} := by + classical + ext v + rw [LinearMap.mem_ker, Submodule.mem_span_singleton] + constructor + · intro hv + refine ⟨v none, ?_⟩ + have hn : v none + v (some none) = 0 := by + simpa only [Finsupp.lmapDomain_apply, merge_none, Finsupp.zero_apply] using + congrArg (fun w : Option ι →₀ K => w none) hv + ext j + cases j with + | none => simp [mergeDifference] + | some j => cases j with + | none => simp [mergeDifference, smul_eq_mul]; linear_combination -hn + | some i => + have hi : v (some (some i)) = 0 := by + simpa only [Finsupp.lmapDomain_apply, merge_some, Finsupp.zero_apply] using + congrArg (fun w : Option ι →₀ K => w (some i)) hv + simp [mergeDifference, hi] + · rintro ⟨a, rfl⟩ + simp [mergeDifference, binaryMerge, map_sub] + +theorem binaryMerge_point_survives (ι : Type u) (i : Option (Option ι)) : + Finsupp.lmapDomain K K binaryMerge (Finsupp.single i 1) ≠ 0 := by + simp + +end GlobalComponentMaps diff --git a/frontiers/compact_source_cutoff_controls_final_repair_20261011/LeafAxiomAudit.lean b/frontiers/compact_source_cutoff_controls_final_repair_20261011/LeafAxiomAudit.lean new file mode 100644 index 000000000..b2a458fe2 --- /dev/null +++ b/frontiers/compact_source_cutoff_controls_final_repair_20261011/LeafAxiomAudit.lean @@ -0,0 +1,54 @@ +import CompactSourceCutoffProof +import CompactSourceCutoffControls +import Lean + +#print axioms SourceCompactCutoff.compact_cutoff_of_geometry +#print axioms SourceCompactCutoff.actual_source_compact_cutoff + +-- Enumerate the imported modules' kernel constants, including private helpers +-- and generated declarations; do not infer coverage from two endpoint lines. +open Lean Elab Command in +run_cmd do + let env := (← getEnv).setExporting false + let allowed : Array Name := #[`propext, `Classical.choice, `Quot.sound] + let modules : Array Name := #[`CompactSourceCutoffProof, `CompactSourceCutoffControls] + let some proofIdx := env.getModuleIdx? `CompactSourceCutoffProof + | throwError "missing proof module for private-helper guards" + let mut allNames : Array Name := #[] + for modName in modules do + let some idx := env.getModuleIdx? modName + | throwError "missing audited module: {modName}" + let names := (env.constants.toList.filterMap fun (name, _) => + if env.getModuleIdxFor? name == some idx then some name else none).toArray.qsort Name.lt + if names.isEmpty then + throwError "empty declaration inventory for audited module: {modName}" + logInfo m!"CUTOFF_AUDIT_MODULE {modName} COUNT {names.size}" + for name in names do + if (env.checked.get.find? name).isNone then + throwError "missing kernel declaration: {name}" + let axs ← Lean.collectAxioms name + logInfo m!"CUTOFF_AUDIT_DECL {name} AXIOMS {axs}" + for ax in axs do + unless allowed.contains ax do + throwError "forbidden transitive axiom {ax} in {name}" + allNames := allNames.push name + let required : Array Name := #[ + `SourceCompactCutoff.cutoffBump, `SourceCompactCutoff.beta, + `SourceCompactCutoff.K, `SourceCompactCutoff.M, + `SourceCompactCutoff.extension, `SourceCompactCutoff.V0, + `SourceCompactCutoff.V1, `SourceCompactCutoff.CompactGeometry, + `SourceCompactCutoff.compact_cutoff_of_geometry, + `SourceCompactCutoff.actual_source_compact_cutoff] + for name in required do + unless allNames.contains name do + throwError "required cutoff declaration omitted from audit: {name}" + let privateHelpers : Array Name := #[ + `SourceCompactCutoff.compact_K_of_split, `SourceCompactCutoff.K_subset_radiusBall, + `SourceCompactCutoff.support_extension, `SourceCompactCutoff.contDiff_extension, + `SourceCompactCutoff.extension_rate] + for helper in privateHelpers do + unless allNames.any (fun name => + env.getModuleIdxFor? name == some proofIdx && + Lean.privateToUserName? name == some helper) do + throwError "required proof-private helper omitted from audit: {helper}" + logInfo m!"CUTOFF_AUDIT_STANDARD_ONLY_PASS COUNT {allNames.size}" diff --git a/frontiers/compact_source_cutoff_controls_final_repair_20261011/MorseCongruence.lean b/frontiers/compact_source_cutoff_controls_final_repair_20261011/MorseCongruence.lean new file mode 100644 index 000000000..f67f9400b --- /dev/null +++ b/frontiers/compact_source_cutoff_controls_final_repair_20261011/MorseCongruence.lean @@ -0,0 +1,119 @@ +import Mathlib.Analysis.Matrix.Normed +import Mathlib.Analysis.Normed.Module.FiniteDimension +import Mathlib.Analysis.Calculus.InverseFunctionTheorem.ContDiff +import Mathlib.Topology.Algebra.Module.Star +import Mathlib.Tactic + +noncomputable section +open scoped Matrix.Norms.Frobenius Topology ContDiff + +namespace MorseCongruence + +abbrev Mat (n : ℕ) := Matrix (Fin n) (Fin n) ℝ +abbrev Sym (n : ℕ) := selfAdjoint.submodule ℝ (Mat n) + +def project (n : ℕ) : Mat n →L[ℝ] Sym n := selfAdjointPartL ℝ (Mat n) + +def polynomial {n : ℕ} (J S : Sym n) : Sym n := + J + (2 : ℝ) • S + project n ((S : Mat n) * (J : Mat n) * (S : Mat n)) + +theorem polynomial_contDiff {n : ℕ} (J : Sym n) : + ContDiff ℝ ∞ (polynomial J) := by + let i : Sym n →L[ℝ] Mat n := (selfAdjoint.submodule ℝ (Mat n)).subtypeL + exact (contDiff_const.add (contDiff_id.const_smul (2 : ℝ))).add + ((project n).contDiff.comp ((i.contDiff.mul contDiff_const).mul i.contDiff)) + +set_option backward.isDefEq.respectTransparency false in +theorem polynomial_hasFDerivAt_zero {n : ℕ} (J : Sym n) : + HasFDerivAt (polynomial J) + ((2 : ℝ) • ContinuousLinearMap.id ℝ (Sym n)) 0 := by + let i : Sym n →L[ℝ] Mat n := (selfAdjoint.submodule ℝ (Mat n)).subtypeL + have hq : HasFDerivAt (fun S : Sym n => (S : Mat n) * (J : Mat n) * (S : Mat n)) + (0 : Sym n →L[ℝ] Mat n) 0 := by + convert! ((i.hasFDerivAt (x := (0 : Sym n))).mul_const' (𝕜 := ℝ) (J : Mat n)).mul' (𝕜 := ℝ) + (i.hasFDerivAt (x := (0 : Sym n))) using 1 + ext S + simp [i] + have hp : HasFDerivAt (fun S : Sym n => + project n ((S : Mat n) * (J : Mat n) * (S : Mat n))) + (0 : Sym n →L[ℝ] Sym n) 0 := by + convert! (project n).hasFDerivAt.comp (0 : Sym n) hq using 1 + ext S + simp + convert! ((hasFDerivAt_const J (0 : Sym n)).add + ((hasFDerivAt_id (0 : Sym n)).const_smul (2 : ℝ))).add hp using 1 + ext S + simp + +theorem polynomial_congruence {n : ℕ} (J S : Sym n) + (hJ : (J : Mat n) * (J : Mat n) = 1) : + (polynomial J S : Mat n) = + star (1 + (J : Mat n) * (S : Mat n)) * (J : Mat n) * + (1 + (J : Mat n) * (S : Mat n)) := by + have hs : IsSelfAdjoint ((S : Mat n) * (J : Mat n) * (S : Mat n)) := by + change star ((S : Mat n) * (J : Mat n) * (S : Mat n)) = _ + simp only [star_mul, S.2.star_eq, J.2.star_eq, mul_assoc] + have hp : (project n ((S : Mat n) * (J : Mat n) * (S : Mat n)) : Mat n) = + (S : Mat n) * (J : Mat n) * (S : Mat n) := + hs.coe_selfAdjointPart_apply ℝ + change (J : Mat n) + (2 : ℝ) • (S : Mat n) + + (project n ((S : Mat n) * (J : Mat n) * (S : Mat n)) : Mat n) = _ + rw [hp] + simp only [star_add, star_one, star_mul, S.2.star_eq, J.2.star_eq] + calc + (J : Mat n) + (2 : ℝ) • (S : Mat n) + (S : Mat n) * (J : Mat n) * (S : Mat n) = + (J : Mat n) + (S : Mat n) + (S : Mat n) + (S : Mat n) * (J : Mat n) * (S : Mat n) := by + simp [two_smul, add_assoc] + _ = (1 + (S : Mat n) * (J : Mat n)) * (J : Mat n) * + (1 + (J : Mat n) * (S : Mat n)) := by + symm + calc + (1 + (S : Mat n) * (J : Mat n)) * (J : Mat n) * (1 + (J : Mat n) * (S : Mat n)) = + (J : Mat n) + (S : Mat n) * ((J : Mat n) * (J : Mat n)) + + ((J : Mat n) * (J : Mat n)) * (S : Mat n) + + (S : Mat n) * ((J : Mat n) * (J : Mat n)) * (J : Mat n) * (S : Mat n) := by + noncomm_ring + _ = _ := by simp [hJ, add_assoc] + +def doubleEquiv (n : ℕ) : Sym n ≃L[ℝ] Sym n where + toFun S := (2 : ℝ) • S + invFun S := (1 / 2 : ℝ) • S + left_inv S := by simp [smul_smul] + right_inv S := by simp [smul_smul] + map_add' S T := smul_add _ _ _ + map_smul' a S := by simp [smul_smul, mul_comm] + continuous_toFun := continuous_const_smul _ + continuous_invFun := continuous_const_smul _ + +theorem doubleEquiv_coe (n : ℕ) : + (doubleEquiv n : Sym n →L[ℝ] Sym n) = + (2 : ℝ) • ContinuousLinearMap.id ℝ (Sym n) := rfl + +theorem exists_congruence_branch {n : ℕ} (J : Sym n) + (hJ : (J : Mat n) * (J : Mat n) = 1) : + ∃ (V : Set (Sym n)) (s : Sym n → Sym n), + IsOpen V ∧ J ∈ V ∧ s J = 0 ∧ ContDiffOn ℝ 2 s V ∧ + ∀ M ∈ V, (M : Mat n) = + star (1 + (J : Mat n) * (s M : Mat n)) * (J : Mat n) * + (1 + (J : Mat n) * (s M : Mat n)) := by + have hz : polynomial J 0 = J := by simp [polynomial] + have hf : ContDiffAt ℝ 2 (polynomial J) 0 := + (polynomial_contDiff J).of_le (by simp) |>.contDiffAt + have hd : HasFDerivAt (polynomial J) (doubleEquiv n : Sym n →L[ℝ] Sym n) 0 := + polynomial_hasFDerivAt_zero J + let e := hf.toOpenPartialHomeomorph (polynomial J) hd (by norm_num) + let s := hf.localInverse hd (by norm_num) + have hc : s J = 0 := by simpa [s, hz] using hf.localInverse_apply_image hd (by norm_num) + have hsm : ContDiffAt ℝ 2 s J := by simpa [s, hz] using hf.to_localInverse hd (by norm_num) + obtain ⟨U, hU, hUs⟩ := hsm.contDiffOn le_rfl (by simp) + obtain ⟨W, hWU, hWo, hJW⟩ := mem_nhds_iff.mp hU + have hJe : J ∈ e.target := by + simpa [e, hz] using hf.image_mem_toOpenPartialHomeomorph_target hd (by norm_num) + refine ⟨W ∩ e.target, s, hWo.inter e.open_target, ⟨hJW, hJe⟩, hc, + hUs.mono (fun M hM => hWU hM.1), ?_⟩ + intro M hM + have he : polynomial J (s M) = M := e.right_inv hM.2 + exact (congrArg (fun T : Sym n => (T : Mat n)) he).symm.trans + (polynomial_congruence J (s M) hJ) + +end MorseCongruence diff --git a/frontiers/compact_source_cutoff_controls_final_repair_20261011/OpenComponentGluing.lean b/frontiers/compact_source_cutoff_controls_final_repair_20261011/OpenComponentGluing.lean new file mode 100644 index 000000000..af0328312 --- /dev/null +++ b/frontiers/compact_source_cutoff_controls_final_repair_20261011/OpenComponentGluing.lean @@ -0,0 +1,237 @@ +import ElementaryHistory +import GlobalComponentMaps +import Mathlib.Topology.Algebra.Module.LocallyConvex +import Mathlib.Topology.LocallyConstant.Basic + +noncomputable section +open CategoryTheory Set GlobalComponentMaps +universe u +namespace MorseOpenGluing +variable {X : Type u} [TopologicalSpace X] + +/-- The actual subtype inclusion, not a supplied component chart. -/ +def inclusion (U : Set X) : TopCat.of U ⟶ TopCat.of X := + TopCat.ofHom ⟨Subtype.val, continuous_subtype_val⟩ + +def inclusionMap (U : Set X) : ZerothHomotopy U → ZerothHomotopy X := + componentMap (inclusion U) + +/-- The image of the actual attaching intersection in actual old path components. -/ +def Foot (U V : Set X) (c : ZerothHomotopy U) : Prop := + ∃ x : U, x.val ∈ V ∧ ZerothHomotopy.mk x = c + +/-- A genuine point in the nonempty path-connected patch. -/ +def patchComponent (V : Set X) (hV : IsPathConnected V) : ZerothHomotopy X := + ZerothHomotopy.mk (Classical.choose hV) + +private def Attached (U V : Set X) : Option (ZerothHomotopy U) → Prop + | none => True + | some c => Foot U V c + +private def attachSetoid (U V : Set X) : Setoid (Option (ZerothHomotopy U)) where + r a b := a = b ∨ (Attached U V a ∧ Attached U V b) + iseqv := by + refine ⟨fun _ => Or.inl rfl, ?_, ?_⟩ + · intro a b h + exact h.elim (fun e => Or.inl e.symm) (fun h => Or.inr ⟨h.2, h.1⟩) + · intro a b c hab hbc + rcases hab with rfl | ⟨ha, hb⟩ + · exact hbc + rcases hbc with rfl | ⟨_, hc⟩ + · exact Or.inr ⟨ha, hb⟩ + · exact Or.inr ⟨ha, hc⟩ + +private def glueLabel (U V : Set X) (x : X) : Quotient (attachSetoid U V) := by + classical + exact if hx : x ∈ U then Quotient.mk _ (some (ZerothHomotopy.mk ⟨x, hx⟩)) + else Quotient.mk _ none + +private theorem glueLabel_old (U V : Set X) (x : U) : + glueLabel U V x.val = Quotient.mk _ (some (ZerothHomotopy.mk x)) := by + classical + simp [glueLabel, x.property] + +private theorem glueLabel_patch (U V : Set X) {x : X} (hx : x ∈ V) : + glueLabel U V x = Quotient.mk _ none := by + classical + by_cases hu : x ∈ U + · simp only [glueLabel, dite_eq_left hu] + apply Quotient.sound + exact Or.inr ⟨⟨⟨x, hu⟩, hx, rfl⟩, trivial⟩ + · simp [glueLabel, hu] + +private theorem open_cover_path_constant {Y : Type*} (U V : Set X) + (hU : IsOpen U) (hV : IsOpen V) (hcover : U ∪ V = univ) + (F : X → Y) + (hFU : ∀ {x y}, JoinedIn U x y → F x = F y) + (hFV : ∀ {x y}, JoinedIn V x y → F x = F y) + {x y : X} (p : Path x y) : F x = F y := by + have hloc : IsLocallyConstant (fun t : ℝ => F (p.extend t)) := by + apply (IsLocallyConstant.iff_exists_open _).2 + intro t + have hmem : p.extend t ∈ U ∪ V := by rw [hcover]; trivial + rcases hmem with ht | ht + · let S := p.extend ⁻¹' U + have hs : IsOpen S := hU.preimage p.continuous_extend + refine ⟨pathComponentIn S t, hs.pathComponentIn t, mem_pathComponentIn_self ht, ?_⟩ + intro s hst + have hm : JoinedIn U (p.extend t) (p.extend s) := + ((show JoinedIn S t s from hst).map p.continuous_extend.continuousOn).mono + (image_preimage_subset _ _) + exact (hFU hm).symm + · let S := p.extend ⁻¹' V + have hs : IsOpen S := hV.preimage p.continuous_extend + refine ⟨pathComponentIn S t, hs.pathComponentIn t, mem_pathComponentIn_self ht, ?_⟩ + intro s hst + have hm : JoinedIn V (p.extend t) (p.extend s) := + ((show JoinedIn S t s from hst).map p.continuous_extend.continuousOn).mono + (image_preimage_subset _ _) + exact (hFV hm).symm + simpa only [p.extend_zero, p.extend_one] using hloc.apply_eq_of_preconnectedSpace 0 1 + +private theorem glueLabel_path (U V : Set X) (hU : IsOpen U) (hV : IsOpen V) + (hcover : U ∪ V = univ) {x y : X} (p : Path x y) : + glueLabel U V x = glueLabel U V y := by + apply open_cover_path_constant U V hU hV hcover (glueLabel U V) _ _ p + · intro a b hab + rw [glueLabel_old U V ⟨a, hab.source_mem⟩, + glueLabel_old U V ⟨b, hab.target_mem⟩] + exact congrArg (fun c => Quotient.mk (attachSetoid U V) (some c)) + (ZerothHomotopy.sound hab.joined_subtype.somePath) + · intro a b hab + rw [glueLabel_patch U V hab.source_mem, glueLabel_patch U V hab.target_mem] + +private theorem patch_eq_of_foot (U V : Set X) (hpatch : IsPathConnected V) + {a : ZerothHomotopy U} (ha : Foot U V a) : + patchComponent V hpatch = inclusionMap U a := by + obtain ⟨x, hx, rfl⟩ := ha + exact ZerothHomotopy.sound + (hpatch.joinedIn _ (Classical.choose_spec hpatch).1 _ hx).somePath + +private theorem inclusion_patch_iff (U V : Set X) (hU : IsOpen U) (hV : IsOpen V) + (hcover : U ∪ V = univ) (hpatch : IsPathConnected V) (a : ZerothHomotopy U) : + inclusionMap U a = patchComponent V hpatch ↔ Foot U V a := by + constructor + · induction a using ZerothHomotopy.rec with + | mk x => + intro h + have hp : Joined x.val (Classical.choose hpatch) := Quotient.exact h + have hl := glueLabel_path U V hU hV hcover hp.somePath + rw [glueLabel_old U V x, + glueLabel_patch U V (Classical.choose_spec hpatch).1] at hl + have hr := Quotient.exact hl + change some (ZerothHomotopy.mk x) = none ∨ + (Foot U V (ZerothHomotopy.mk x) ∧ True) at hr + rcases hr with hfalse | htrue + · cases hfalse + · exact htrue.1 + · intro ha + exact (patch_eq_of_foot U V hpatch ha).symm + + +theorem inclusion_fiber (U V : Set X) (hU : IsOpen U) (hV : IsOpen V) + (hcover : U ∪ V = univ) (hpatch : IsPathConnected V) + (a b : ZerothHomotopy U) : + inclusionMap U a = inclusionMap U b ↔ a = b ∨ (Foot U V a ∧ Foot U V b) := by + constructor + · induction a using ZerothHomotopy.rec with + | mk x => + induction b using ZerothHomotopy.rec with + | mk y => + intro h + have hp : Joined x.val y.val := Quotient.exact h + have hl := glueLabel_path U V hU hV hcover hp.somePath + rw [glueLabel_old U V x, glueLabel_old U V y] at hl + have hr := Quotient.exact hl + change some (ZerothHomotopy.mk x) = some (ZerothHomotopy.mk y) ∨ + (Foot U V (ZerothHomotopy.mk x) ∧ Foot U V (ZerothHomotopy.mk y)) at hr + exact hr.elim (fun e => Or.inl (Option.some.inj e)) Or.inr + · rintro (rfl | ⟨ha, hb⟩) + · rfl + obtain ⟨x, hx, rfl⟩ := ha + obtain ⟨y, hy, rfl⟩ := hb + exact ZerothHomotopy.sound (hpatch.joinedIn _ hx _ hy).somePath + +theorem component_coverage (U V : Set X) (hcover : U ∪ V = univ) + (hpatch : IsPathConnected V) (c : ZerothHomotopy X) : + c = patchComponent V hpatch ∨ ∃ a : ZerothHomotopy U, inclusionMap U a = c := by + induction c using ZerothHomotopy.rec with + | mk x => + have hx : x ∈ U ∪ V := by rw [hcover]; trivial + rcases hx with hu | hv + · exact Or.inr ⟨ZerothHomotopy.mk ⟨x, hu⟩, rfl⟩ + · exact Or.inl (ZerothHomotopy.sound + (hpatch.joinedIn _ hv _ (Classical.choose_spec hpatch).1).somePath) + +/-- Construct the primitive birth witness from empty actual intersection footprint. -/ +def birthEvent (U V : Set X) (hU : IsOpen U) (hV : IsOpen V) + (hcover : U ∪ V = univ) (hpatch : IsPathConnected V) + (hfoot : ∀ c, ¬ Foot U V c) : ElementaryHistory.Event (inclusionMap U) := by + refine .birth (patchComponent V hpatch) ?_ ?_ ?_ + · intro a b hab + rcases (inclusion_fiber U V hU hV hcover hpatch a b).1 hab with he | ⟨ha, _⟩ + · exact he + · exact False.elim (hfoot a ha) + · rintro ⟨a, ha⟩ + exact hfoot a ((inclusion_patch_iff U V hU hV hcover hpatch a).1 ha) + · intro c + exact component_coverage U V hcover hpatch c + +/-- A one-component attachment is a genuine nonmerge event. -/ +def neutralEvent (U V : Set X) (hU : IsOpen U) (hV : IsOpen V) + (hcover : U ∪ V = univ) (hpatch : IsPathConnected V) + (a : ZerothHomotopy U) (hfoot : ∀ c, Foot U V c ↔ c = a) : + ElementaryHistory.Event (inclusionMap U) := by + refine .neutral ⟨?_, ?_⟩ + · intro x y hxy + rcases (inclusion_fiber U V hU hV hcover hpatch x y).1 hxy with he | ⟨hx, hy⟩ + · exact he + · exact ((hfoot x).1 hx).trans ((hfoot y).1 hy).symm + · intro c + rcases component_coverage U V hcover hpatch c with hc | ⟨x, hx⟩ + · refine ⟨a, ?_⟩ + exact (patch_eq_of_foot U V hpatch ((hfoot a).2 rfl)).symm.trans hc.symm + · exact ⟨x, hx⟩ + +/-- Two distinct actual old components give exactly one binary merge fiber. -/ +def mergeEvent (U V : Set X) (hU : IsOpen U) (hV : IsOpen V) + (hcover : U ∪ V = univ) (hpatch : IsPathConnected V) + (a b : ZerothHomotopy U) (hab : a ≠ b) + (hfoot : ∀ c, Foot U V c ↔ c = a ∨ c = b) : + ElementaryHistory.Event (inclusionMap U) := by + refine .merge a b hab ?_ ?_ + · intro c + rcases component_coverage U V hcover hpatch c with hc | ⟨x, hx⟩ + · refine ⟨a, ?_⟩ + exact (patch_eq_of_foot U V hpatch ((hfoot a).2 (Or.inl rfl))).symm.trans hc.symm + · exact ⟨x, hx⟩ + · intro x y + constructor + · intro hxy + rcases (inclusion_fiber U V hU hV hcover hpatch x y).1 hxy with he | ⟨hx, hy⟩ + · exact Or.inl he + · rcases (hfoot x).1 hx with rfl | rfl <;> rcases (hfoot y).1 hy with rfl | rfl + · exact Or.inl rfl + · exact Or.inr (Or.inl ⟨rfl, rfl⟩) + · exact Or.inr (Or.inr ⟨rfl, rfl⟩) + · exact Or.inl rfl + · rintro (he | ⟨hx, hy⟩ | ⟨hx, hy⟩) + · exact congrArg (inclusionMap U) he + · subst x + subst y + exact (inclusion_fiber U V hU hV hcover hpatch a b).2 + (Or.inr ⟨(hfoot a).2 (Or.inl rfl), (hfoot b).2 (Or.inr rfl)⟩) + · subst x + subst y + exact (inclusion_fiber U V hU hV hcover hpatch b a).2 + (Or.inr ⟨(hfoot b).2 (Or.inr rfl), (hfoot a).2 (Or.inl rfl)⟩) + +/-- Actual path-component maps respect composition, including inclusion chains. +This is compatibility with the existing map, not a new elder pairing theorem. -/ +theorem componentMap_comp {A B C : TopCat.{u}} (g : A ⟶ B) (h : B ⟶ C) + (c : ZerothHomotopy A) : + componentMap h (componentMap g c) = componentMap (g ≫ h) c := by + induction c using ZerothHomotopy.rec with + | mk x => rfl + +end MorseOpenGluing diff --git a/frontiers/compact_source_cutoff_controls_final_repair_20261011/OrdinaryH0Elder.lean b/frontiers/compact_source_cutoff_controls_final_repair_20261011/OrdinaryH0Elder.lean new file mode 100644 index 000000000..b571b3af5 --- /dev/null +++ b/frontiers/compact_source_cutoff_controls_final_repair_20261011/OrdinaryH0Elder.lean @@ -0,0 +1,183 @@ +import Mathlib.AlgebraicTopology.SingularHomology.HomologyZero +import Mathlib.Algebra.Category.ModuleCat.Colimits +import Mathlib.Algebra.Category.ModuleCat.Abelian +import Mathlib.LinearAlgebra.Finsupp.VectorSpace +import CapFirstExit + +/-! +Actual ordinary singular H₀ point generators and elder-span criterion. +No interval decomposition or Morse/barcode interface is assumed. +-/ + +noncomputable section + +open CategoryTheory Limits AlgebraicTopology Set +open scoped Simplicial + +universe u + +namespace OrdinaryH0Elder + +variable (K : Type u) [Field K] + +/-- Ordinary singular H₀ with coefficients in the one-dimensional K-module. -/ +def h0Functor : TopCat.{u} ⥤ ModuleCat.{u} K := + (singularHomologyFunctor (ModuleCat.{u} K) 0).obj (ModuleCat.of K K) + +abbrev H0 (X : TopCat.{u}) := (h0Functor K).obj X + +/-- The existing singular H₀ isomorphism followed by the concrete coproduct model. -/ +def componentIso (X : TopCat.{u}) : + H0 K X ≅ ModuleCat.of K (ZerothHomotopy X →₀ K) := + TopCat.singularHomology₀Iso X (ModuleCat.of K K) ≪≫ + (coproductIsCoproduct _).coconePointUniqueUpToIso + (ModuleCat.finsuppCoconeIsColimit K K (ZerothHomotopy X)) + +def componentEquiv (X : TopCat.{u}) : + H0 K X ≃ₗ[K] (ZerothHomotopy X →₀ K) := + (componentIso K X).toLinearEquiv + +/-- The actual ordinary H₀ class of a point, corresponding to its component basis vector. -/ +def pointClass (X : TopCat.{u}) (x : X) : H0 K X := + (componentEquiv K X).symm (Finsupp.single (ZerothHomotopy.mk x) 1) + +def olderSpan (X : TopCat.{u}) (older : X → Prop) : Submodule K (H0 K X) := + Submodule.span K (pointClass K X '' {x | older x}) + +theorem pointClass_eq_iff_joined (X : TopCat.{u}) (x y : X) : + pointClass K X x = pointClass K X y ↔ Joined x y := by + rw [pointClass, pointClass, (componentEquiv K X).symm.injective.eq_iff, + Finsupp.single_left_inj (one_ne_zero : (1 : K) ≠ 0)] + exact Quotient.eq + +theorem pointClass_ne_zero (X : TopCat.{u}) (x : X) : + pointClass K X x ≠ 0 := by + intro h + have hs : Finsupp.single (ZerothHomotopy.mk x) (1 : K) = 0 := by + simpa [pointClass] using congrArg (componentEquiv K X) h + exact one_ne_zero (Finsupp.single_eq_zero.mp hs) + +/-- The actual zero-simplex cycle, projected into singular H₀. -/ +def pointCycleMorph (X : TopCat.{u}) (x : X) : ModuleCat.of K K ⟶ H0 K X := + ((TopCat.toSSet.obj X).chainComplex (ModuleCat.of K K)).liftCycles + ((TopCat.toSSet.obj X).ιChainComplex (TopCat.toSSetObj₀Equiv.symm x)) + 0 (by simp) (by simp) ≫ + ((TopCat.toSSet.obj X).chainComplex (ModuleCat.of K K)).homologyπ 0 + +set_option backward.isDefEq.respectTransparency false in +lemma pointCycleMorph_componentIso (X : TopCat.{u}) (x : X) : + pointCycleMorph K X x ≫ (componentIso K X).hom = + ModuleCat.ofHom (Finsupp.lsingle (ZerothHomotopy.mk x)) := by + simp [pointCycleMorph, componentIso, TopCat.singularHomology₀Iso, sigmaConst, + ModuleCat.finsuppCocone] + exact IsColimit.comp_coconePointUniqueUpToIso_hom + (coproductIsCoproduct _) (ModuleCat.finsuppCoconeIsColimit K K (ZerothHomotopy X)) + ⟨ZerothHomotopy.mk x⟩ + +lemma pointClass_eq_pointCycleMorph (X : TopCat.{u}) (x : X) : + pointClass K X x = pointCycleMorph K X x (1 : K) := by + apply (componentEquiv K X).injective + simp only [pointClass, LinearEquiv.apply_symm_apply] + change Finsupp.single (ZerothHomotopy.mk x) (1 : K) = + (componentIso K X).hom (pointCycleMorph K X x (1 : K)) + have h := congrArg (fun g : ModuleCat.of K K ⟶ + ModuleCat.of K (ZerothHomotopy X →₀ K) => g (1 : K)) + (pointCycleMorph_componentIso K X x) + exact h.symm + +set_option backward.isDefEq.respectTransparency false in +lemma pointCycleMorph_map {X Y : TopCat.{u}} (f : X ⟶ Y) (x : X) : + pointCycleMorph K X x ≫ (h0Functor K).map f = pointCycleMorph K Y (f x) := by + change pointCycleMorph K X x ≫ + SSet.homologyMap (TopCat.toSSet.map f) (ModuleCat.of K K) 0 = _ + simp only [pointCycleMorph, SSet.homologyMap, Category.assoc, + HomologicalComplex.homologyπ_naturality] + rw [← Category.assoc, HomologicalComplex.liftCycles_comp_cyclesMap, + SSet.ι_chainComplexMap_f] + rfl + +/-- Naturality under genuine singular homology maps. -/ +theorem pointClass_map {X Y : TopCat.{u}} (f : X ⟶ Y) (x : X) : + (h0Functor K).map f (pointClass K X x) = pointClass K Y (f x) := by + rw [pointClass_eq_pointCycleMorph, pointClass_eq_pointCycleMorph] + change (pointCycleMorph K X x ≫ (h0Functor K).map f) (1 : K) = _ + rw [pointCycleMorph_map] + +theorem mem_olderSpan_iff_joinedOlder (X : TopCat.{u}) (older : X → Prop) (x : X) : + pointClass K X x ∈ olderSpan K X older ↔ ∃ y, older y ∧ Joined x y := by + classical + constructor + · intro hm + by_contra h + have hne : ∀ y, older y → ZerothHomotopy.mk x ≠ ZerothHomotopy.mk y := by + intro y hy he + exact h ⟨y, hy, Quotient.exact he⟩ + let ev : H0 K X →ₗ[K] K := + (Finsupp.lapply (ZerothHomotopy.mk x)).comp (componentEquiv K X).toLinearMap + have hs : olderSpan K X older ≤ LinearMap.ker ev := by + apply Submodule.span_le.mpr + rintro _ ⟨y, hy, rfl⟩ + change ((componentEquiv K X) (pointClass K X y)) (ZerothHomotopy.mk x) = 0 + simp only [pointClass, LinearEquiv.apply_symm_apply] + exact Finsupp.single_eq_of_ne (hne y hy) + have hc := hs hm + change ((componentEquiv K X) (pointClass K X x)) (ZerothHomotopy.mk x) = 0 at hc + simp [pointClass] at hc + · rintro ⟨y, hy, hxy⟩ + rw [(pointClass_eq_iff_joined K X x y).mpr hxy] + exact Submodule.subset_span ⟨y, hy, rfl⟩ + +section Superlevel + +variable {X : Type u} [TopologicalSpace X] + +def superlevel (f : X → ℝ) (h : ℝ) : TopCat.{u} := + TopCat.of {x : X // h ≤ f x} + +/-- The continuous closed-superlevel inclusion from a higher level to a lower level. -/ +def superlevelInclusion (f : X → ℝ) {high low : ℝ} (hle : low ≤ high) : + superlevel f high ⟶ superlevel f low := + TopCat.ofHom ⟨fun x => ⟨x.1, hle.trans x.2⟩, continuous_subtype_val.subtype_mk _⟩ + +/-- The genuine closed-superlevel diagram, indexed by decreasing levels. -/ +def superlevelFunctor (f : X → ℝ) : ℝᵒᵈ ⥤ TopCat.{u} where + obj h := superlevel f h + map {a b} g := superlevelInclusion f (@leOfHom ℝᵒᵈ _ a b g) + map_id _ := rfl + map_comp _ _ := rfl + +/-- The actual ordinary singular H₀ persistence diagram of closed superlevels. -/ +def closedH0Persistence (f : X → ℝ) : ℝᵒᵈ ⥤ ModuleCat.{u} K := + superlevelFunctor f ⋙ h0Functor K + +theorem pointClass_superlevelInclusion (f : X → ℝ) {high low : ℝ} + (hle : low ≤ high) (x : X) (hx : high ≤ f x) : + (h0Functor K).map (superlevelInclusion f hle) + (pointClass K (superlevel f high) ⟨x, hx⟩) = + pointClass K (superlevel f low) ⟨x, hle.trans hx⟩ := + pointClass_map K (superlevelInclusion f hle) ⟨x, hx⟩ + +set_option backward.isDefEq.respectTransparency false in +/-- A cap's point class becomes dependent on strictly older point classes exactly at s. -/ +theorem cap_mem_olderSpan_iff {f : X → ℝ} {C : Set X} {M z : X} {b s : ℝ} + (H : CapFirstExit.CapHyp f C M z b s) (hMb : f M = b) {h : ℝ} (hh : h ≤ b) : + pointClass K (superlevel f h) ⟨M, by rwa [hMb]⟩ ∈ + olderSpan K (superlevel f h) (fun y => b < f y.1) ↔ h ≤ s := by + rw [mem_olderSpan_iff_joinedOlder] + constructor + · rintro ⟨y, hy, hjoin⟩ + have hj : JoinedIn {x | h ≤ f x} M y.1 := + (joinedIn_iff_joined (F := {x | h ≤ f x}) (x := M) (y := y.1) + (by simpa [hMb] using hh) y.2).mpr hjoin + exact (H.elder_merge_iff_closed h).mp + ⟨y.1, CapFirstExit.component_joined hj.somePath hj.somePath_mem, hy⟩ + · intro hhs + obtain ⟨γ, hγ⟩ := H.ridge + have hz : h ≤ f z := by simpa using hhs.trans (hγ 1) + have hj : JoinedIn {x | h ≤ f x} M z := ⟨γ, fun t => hhs.trans (hγ t)⟩ + exact ⟨⟨z, hz⟩, H.older, + (joinedIn_iff_joined (F := {x | h ≤ f x}) (x := M) (y := z) + (by simpa [hMb] using hh) hz).mp hj⟩ + +end Superlevel +end OrdinaryH0Elder diff --git a/frontiers/compact_source_cutoff_controls_final_repair_20261011/OrdinaryH0Image.lean b/frontiers/compact_source_cutoff_controls_final_repair_20261011/OrdinaryH0Image.lean new file mode 100644 index 000000000..045eeef0d --- /dev/null +++ b/frontiers/compact_source_cutoff_controls_final_repair_20261011/OrdinaryH0Image.lean @@ -0,0 +1,143 @@ +import OrdinaryH0Elder + +/-! +Actual induced-map images in ordinary singular H₀. +The strict superlevel source is explicit; no single higher closed source or barcode is assumed. +-/ + +noncomputable section + +set_option backward.isDefEq.respectTransparency false + +open CategoryTheory Set OrdinaryH0Elder + +universe u + +namespace OrdinaryH0Image + +variable (K : Type u) [Field K] + +def predicateSpace (X : TopCat.{u}) (older : X → Prop) : TopCat.{u} := + TopCat.of {x : X // older x} + +def predicateInclusion (X : TopCat.{u}) (older : X → Prop) : + predicateSpace X older ⟶ X := + TopCat.ofHom ⟨Subtype.val, continuous_subtype_val⟩ + +theorem pointClasses_span_top (X : TopCat.{u}) : + Submodule.span K (Set.range (pointClass K X)) = ⊤ := by + classical + apply Submodule.eq_top_iff'.mpr + intro q + have hs : ∀ v : ZerothHomotopy X →₀ K, + (componentEquiv K X).symm v ∈ Submodule.span K (Set.range (pointClass K X)) := by + intro v + induction v using Finsupp.induction_linear with + | zero => simp + | add a b ha hb => simpa using Submodule.add_mem _ ha hb + | single c a => + obtain ⟨x, rfl⟩ := Quotient.exists_rep c + rw [← Finsupp.smul_single_one, map_smul] + exact Submodule.smul_mem _ a (Submodule.subset_span ⟨x, rfl⟩) + simpa using hs ((componentEquiv K X) q) + +theorem range_h0Map_eq_span_pointImages {X Y : TopCat.{u}} (g : X ⟶ Y) : + LinearMap.range ((h0Functor K).map g).hom = + Submodule.span K (Set.range (fun x : X => pointClass K Y (g x))) := by + rw [LinearMap.range_eq_map, ← pointClasses_span_top K X, Submodule.map_span] + congr 1 + ext q + constructor + · rintro ⟨_, ⟨x, rfl⟩, rfl⟩ + exact ⟨x, (pointClass_map K g x).symm⟩ + · rintro ⟨x, rfl⟩ + exact ⟨pointClass K X x, ⟨x, rfl⟩, pointClass_map K g x⟩ + +theorem olderSpan_eq_range (X : TopCat.{u}) (older : X → Prop) : + olderSpan K X older = + LinearMap.range ((h0Functor K).map (predicateInclusion X older)).hom := by + rw [range_h0Map_eq_span_pointImages, olderSpan] + congr 1 + ext q + constructor + · rintro ⟨x, hx, rfl⟩ + exact ⟨⟨x, hx⟩, rfl⟩ + · rintro ⟨x, rfl⟩ + exact ⟨x.1, x.2, rfl⟩ + +section Superlevel + +variable {X : Type u} [TopologicalSpace X] + +def strictSuperlevel (f : X → ℝ) (b : ℝ) : TopCat.{u} := + TopCat.of {x : X // b < f x} + +def strictToWeak (f : X → ℝ) (b : ℝ) {h : ℝ} (hh : h ≤ b) : + strictSuperlevel f b ⟶ superlevel f h := + TopCat.ofHom ⟨fun x => ⟨x.1, hh.trans (le_of_lt x.2)⟩, + continuous_subtype_val.subtype_mk _⟩ + +theorem olderSpan_superlevel_eq_range (f : X → ℝ) (b : ℝ) {h : ℝ} (hh : h ≤ b) : + olderSpan K (superlevel f h) (fun y => b < f y.1) = + LinearMap.range ((h0Functor K).map (strictToWeak f b hh)).hom := by + rw [range_h0Map_eq_span_pointImages, olderSpan] + congr 1 + ext q + constructor + · rintro ⟨y, hy, rfl⟩ + exact ⟨⟨y.1, hy⟩, rfl⟩ + · rintro ⟨y, rfl⟩ + exact ⟨⟨y.1, hh.trans (le_of_lt y.2)⟩, y.2, rfl⟩ + +theorem cap_mem_range_iff {f : X → ℝ} {C : Set X} {M z : X} {b s : ℝ} + (H : CapFirstExit.CapHyp f C M z b s) (hMb : f M = b) {h : ℝ} (hh : h ≤ b) : + pointClass K (superlevel f h) ⟨M, by rwa [hMb]⟩ ∈ + LinearMap.range ((h0Functor K).map (strictToWeak f b hh)).hom ↔ h ≤ s := by + rw [← olderSpan_superlevel_eq_range] + exact cap_mem_olderSpan_iff K H hMb hh + +/-- The distinguished cap point lies in this genuine closed-level image exactly at the cutoff. -/ +theorem cap_mem_closedRange_iff {f : X → ℝ} {C : Set X} {M z : X} {b s : ℝ} + (H : CapFirstExit.CapHyp f C M z b s) (hMb : f M = b) {h r : ℝ} + (hh : h ≤ b) (hbr : b < r) (hrz : r ≤ f z) : + pointClass K (superlevel f h) ⟨M, by rwa [hMb]⟩ ∈ + LinearMap.range ((h0Functor K).map + (superlevelInclusion f (hh.trans (le_of_lt hbr)))).hom ↔ h ≤ s := by + constructor + · intro hm + have hrange : LinearMap.range ((h0Functor K).map + (superlevelInclusion f (hh.trans (le_of_lt hbr)))).hom ≤ + olderSpan K (superlevel f h) (fun y => b < f y.1) := by + rw [range_h0Map_eq_span_pointImages] + apply Submodule.span_le.mpr + rintro _ ⟨y, rfl⟩ + exact Submodule.subset_span + ⟨superlevelInclusion f (hh.trans (le_of_lt hbr)) y, hbr.trans_le y.2, rfl⟩ + exact (cap_mem_olderSpan_iff K H hMb hh).mp (hrange hm) + · intro hhs + obtain ⟨γ, hγ⟩ := H.ridge + have hz : h ≤ f z := (hh.trans (le_of_lt hbr)).trans hrz + have hj : JoinedIn {x | h ≤ f x} M z := ⟨γ, fun t => hhs.trans (hγ t)⟩ + have hjoin := (joinedIn_iff_joined (F := {x | h ≤ f x}) (x := M) (y := z) + (by simpa [hMb] using hh) hz).mp hj + have hq := (pointClass_eq_iff_joined K (superlevel f h) + ⟨M, by rwa [hMb]⟩ ⟨z, hz⟩).mpr hjoin + refine ⟨pointClass K (superlevel f r) ⟨z, hrz⟩, ?_⟩ + rw [pointClass_map K (superlevelInclusion f (hh.trans (le_of_lt hbr))) ⟨z, hrz⟩] + exact hq.symm + +/-- A positive separating gap forces a weak local maximum; no strictness or Morse property. -/ +theorem cap_isLocalMax_of_positive_gap {f : X → ℝ} {C : Set X} {M z : X} {b s : ℝ} + (H : CapFirstExit.CapHyp f C M z b s) (hMb : f M = b) (hsb : s < b) : + IsLocalMax f M := by + have hfront : M ∉ frontier C := by + intro hm + exact (not_le_of_gt hsb) (by simpa [hMb] using H.frontier_le M hm) + have hinterior : M ∈ interior C := (mem_interior_iff_notMem_frontier H.mem).mpr hfront + have hmax : IsMaxOn f C M := by + intro x hx + simpa [hMb] using H.ceiling x hx + exact hmax.isLocalMax (mem_interior_iff_mem_nhds.mp hinterior) + +end Superlevel +end OrdinaryH0Image diff --git a/frontiers/compact_source_cutoff_controls_final_repair_20261011/PhysicalSpectral.lean b/frontiers/compact_source_cutoff_controls_final_repair_20261011/PhysicalSpectral.lean new file mode 100644 index 000000000..fc28bf1c7 --- /dev/null +++ b/frontiers/compact_source_cutoff_controls_final_repair_20261011/PhysicalSpectral.lean @@ -0,0 +1,243 @@ +import TaylorSymLift +import Mathlib.Analysis.Matrix.Spectrum +import Mathlib.LinearAlgebra.Basis.SMul + +noncomputable section +open scoped ContDiff Matrix.Norms.Frobenius +open TaylorMatrix Matrix +namespace PhysicalSpectral + +def hessian {n : ℕ} {L : ℝ} (omega : I4Source.SourceMode n → ℝ) + (x0 : X n) : Matrix (Fin n) (Fin n) ℝ := fun i j => + iteratedFDeriv ℝ 2 (I4Source.sourceField n L omega) x0 + ![Pi.single i 1, Pi.single j 1] + +theorem hessian_hermitian {n : ℕ} {L : ℝ} (hL : L ≠ 0) + (omega : I4Source.SourceMode n → ℝ) + (hmajor : Summable (fun m => I4Source.modeMajorant n L m * |omega m|)) + (x0 : X n) : (hessian (L := L) omega x0).IsHermitian := by + have hf := I4DeterministicC4.sourceField_contDiff_of_majorant n hL omega hmajor + change (hessian (L := L) omega x0).conjTranspose = _ + ext i j + simp only [Matrix.conjTranspose_apply, star_trivial, hessian] + exact (hf.contDiffAt.isSymmSndFDerivAt (by norm_num)).iteratedFDeriv_cons + +theorem eigenvalues_ne_zero {n : ℕ} {H : Matrix (Fin n) (Fin n) ℝ} + (hH : H.IsHermitian) (hdet : H.det ≠ 0) (i : Fin n) : hH.eigenvalues i ≠ 0 := by + rw [hH.det_eq_prod_eigenvalues] at hdet + exact (Finset.prod_ne_zero_iff.mp hdet) i (Finset.mem_univ i) + +def scale (a : ℝ) : ℝ := Real.sqrt (2 / |a|) + +theorem scale_pos {a : ℝ} (ha : a ≠ 0) : 0 < scale a := by + exact Real.sqrt_pos.2 (div_pos (by norm_num) (abs_pos.2 ha)) + +theorem scale_square {a : ℝ} (ha : a ≠ 0) : scale a * scale a = 2 / |a| := by + exact Real.mul_self_sqrt (le_of_lt (div_pos (by norm_num) (abs_pos.2 ha))) + +theorem scale_normalizes {a : ℝ} (ha : a ≠ 0) : + scale a * a * scale a = if 0 < a then 2 else -2 := by + have hs := scale_square ha + by_cases hp : 0 < a + · rw [ite_eq_left hp] + rw [abs_of_pos hp] at hs + calc + scale a * a * scale a = (scale a * scale a) * a := by ring + _ = 2 := by rw [hs]; field_simp + · rw [ite_eq_right hp] + have hn : a < 0 := lt_of_le_of_ne (le_of_not_gt hp) ha + rw [abs_of_neg hn] at hs + calc + scale a * a * scale a = (scale a * scale a) * a := by ring + _ = -2 := by rw [hs]; field_simp + +theorem bilinear_coordinates {n : ℕ} (B : X n →L[ℝ] X n →L[ℝ] ℝ) (x y : X n) : + B x y = dotProduct x ((fun i j => B (Pi.single i 1) (Pi.single j 1)) *ᵥ y) := by + have hx : x = ∑ i, x i • Pi.single i (1 : ℝ) := by + ext k + simp [Finset.sum_apply, Pi.single_apply] + have hy : y = ∑ i, y i • Pi.single i (1 : ℝ) := by + ext k + simp [Finset.sum_apply, Pi.single_apply] + conv_lhs => rw [hx, hy] + simp only [map_sum, map_smul, _root_.sum_apply, _root_.smul_apply, smul_eq_mul, + dotProduct, Matrix.mulVec, Finset.mul_sum] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro i hi + apply Finset.sum_congr rfl + intro j hj + ring + +theorem source_hessian_coordinates {n : ℕ} {L : ℝ} + (omega : I4Source.SourceMode n → ℝ) (x0 x y : X n) : + iteratedFDeriv ℝ 2 (I4Source.sourceField n L omega) x0 ![x,y] = + dotProduct x (hessian (L := L) omega x0 *ᵥ y) := by + unfold hessian + simp only [iteratedFDeriv_two_apply, Matrix.cons_val_zero, Matrix.cons_val_one] + exact bilinear_coordinates (fderiv ℝ (fderiv ℝ (I4Source.sourceField n L omega)) x0) x y + +def frameBasis {n : ℕ} {H : Matrix (Fin n) (Fin n) ℝ} + (hH : H.IsHermitian) (hdet : H.det ≠ 0) (e : Fin n ≃ Fin n) : + Module.Basis (Fin n) ℝ (X n) := + ((hH.eigenvectorBasis.reindex e).toBasis.map + (EuclideanSpace.equiv (Fin n) ℝ).toLinearEquiv).unitsSMul + (fun i => Units.mk0 (scale (hH.eigenvalues (e.symm i))) + (ne_of_gt (scale_pos (eigenvalues_ne_zero hH hdet (e.symm i))))) + +def frame {n : ℕ} {H : Matrix (Fin n) (Fin n) ℝ} + (hH : H.IsHermitian) (hdet : H.det ≠ 0) (e : Fin n ≃ Fin n) : E n ≃L[ℝ] X n := + (EuclideanSpace.equiv (Fin n) ℝ).trans (frameBasis hH hdet e).equivFunL.symm + +theorem frame_single {n : ℕ} {H : Matrix (Fin n) (Fin n) ℝ} + (hH : H.IsHermitian) (hdet : H.det ≠ 0) (e : Fin n ≃ Fin n) (i : Fin n) : + frame hH hdet e (EuclideanSpace.single i 1) = + scale (hH.eigenvalues (e.symm i)) • ⇑(hH.eigenvectorBasis (e.symm i)) := by + have hh : frame hH hdet e (EuclideanSpace.single i 1) = frameBasis hH hdet e i := by + change (frameBasis hH hdet e).equivFun.symm (Pi.single i (1 : ℝ)) = _ + rw [Module.Basis.equivFun_symm_apply] + simp [Pi.single_apply] + rw [hh] + simp only [frameBasis, Module.Basis.unitsSMul_apply, Units.smul_def, + Module.Basis.map_apply, OrthonormalBasis.coe_toBasis, OrthonormalBasis.reindex_apply] + rfl + +theorem eigen_dot {n : ℕ} {H : Matrix (Fin n) (Fin n) ℝ} + (hH : H.IsHermitian) (i j : Fin n) : + dotProduct ⇑(hH.eigenvectorBasis i) ⇑(hH.eigenvectorBasis j) = + if i = j then 1 else 0 := by + simpa only [EuclideanSpace.inner_eq_star_dotProduct, star_trivial, dotProduct_comm] + using hH.eigenvectorBasis.inner_eq_ite i j + +theorem frame_normalizes {n : ℕ} {H : Matrix (Fin n) (Fin n) ℝ} + (hH : H.IsHermitian) (hdet : H.det ≠ 0) (e : Fin n ≃ Fin n) (i j : Fin n) : + dotProduct (frame hH hdet e (EuclideanSpace.single i 1)) + (H *ᵥ frame hH hdet e (EuclideanSpace.single j 1)) = + if i = j then (if 0 < hH.eigenvalues (e.symm i) then 2 else -2) else 0 := by + rw [frame_single, frame_single, Matrix.mulVec_smul, hH.mulVec_eigenvectorBasis] + simp only [smul_dotProduct, dotProduct_smul, smul_eq_mul, eigen_dot] + by_cases hij : i = j + · subst j + simpa [mul_assoc] using scale_normalizes (eigenvalues_ne_zero hH hdet (e.symm i)) + · have hh : e.symm i ≠ e.symm j := fun h => hij (e.symm.injective h) + simp [hij, hh] + +theorem positive_reorder {n : ℕ} (lam : Fin n → ℝ) : + ∃ k : ℕ, k ≤ n ∧ ∃ e : Fin n ≃ Fin n, ∀ i : Fin n, + 0 < lam (e.symm i) ↔ i.val < k := by + classical + let Pos := {i : Fin n // 0 < lam i} + let Neg := {i : Fin n // ¬ 0 < lam i} + let p := Fintype.card Pos + let q := Fintype.card Neg + have hcard : p + q = n := by + simpa only [Fintype.card_sum, Fintype.card_fin] using + (Fintype.card_congr (Equiv.sumCompl (fun i : Fin n => 0 < lam i))) + let e₀ : Fin n ≃ Fin (p + q) := + (Equiv.sumCompl (fun i : Fin n => 0 < lam i)).symm.trans + (((Fintype.equivFin Pos).sumCongr (Fintype.equivFin Neg)).trans finSumFinEquiv) + let e : Fin n ≃ Fin n := e₀.trans (finCongr hcard) + have he (j : Fin n) : 0 < lam j ↔ (e j).val < p := by + simp_rw [e, e₀, Equiv.trans_apply, Equiv.sumCongr_apply, + finCongr_apply, Fin.val_cast] + by_cases hj : 0 < lam j <;> simp [hj, p] + refine ⟨p, by omega, e, ?_⟩ + intro i + simpa only [Equiv.apply_symm_apply] using he (e.symm i) + +theorem source_normalization {n : ℕ} {L : ℝ} (hL : L ≠ 0) + (omega : I4Source.SourceMode n → ℝ) + (hmajor : Summable (fun m => I4Source.modeMajorant n L m * |omega m|)) + (x0 : X n) (hdet : (hessian (L := L) omega x0).det ≠ 0) : + ∃ k : ℕ, k ≤ n ∧ ∃ P : E n ≃L[ℝ] X n, ∀ i j : Fin n, + iteratedFDeriv ℝ 2 (I4Source.sourceField n L omega) x0 + ![P (EuclideanSpace.single i 1), P (EuclideanSpace.single j 1)] = + if i = j then (if i.val < k then 2 else -2) else 0 := by + have hH := hessian_hermitian hL omega hmajor x0 + obtain ⟨k, hk, e, he⟩ := positive_reorder hH.eigenvalues + refine ⟨k, hk, frame hH hdet e, ?_⟩ + intro i j + rw [source_hessian_coordinates, frame_normalizes] + simp only [he] + +/-- Positive coordinates precede negative coordinates; there are no zero entries. -/ +def signMatrix (n k : ℕ) : MorseCongruence.Mat n := + Matrix.diagonal (fun i : Fin n => if i.val < k then (1 : ℝ) else -1) + +theorem signMatrix_selfAdjoint (n k : ℕ) : IsSelfAdjoint (signMatrix n k) := by + change star (signMatrix n k) = _ + ext i j + by_cases hij : i = j + · subst j; simp [signMatrix, Matrix.star_apply] + · simp [signMatrix, Matrix.star_apply, hij, Ne.symm hij] + +theorem signMatrix_involution (n k : ℕ) : signMatrix n k * signMatrix n k = 1 := by + rw [signMatrix, Matrix.diagonal_mul_diagonal] + have hd : (fun i : Fin n => (if i.val < k then (1 : ℝ) else -1) * + (if i.val < k then (1 : ℝ) else -1)) = fun _ => 1 := by + funext i + split_ifs <;> norm_num + rw [hd] + exact Matrix.diagonal_one + +def signSym (n k : ℕ) : MorseCongruence.Sym n := + ⟨signMatrix n k, signMatrix_selfAdjoint n k⟩ + +theorem matrix_normalization {n : ℕ} {H : Matrix (Fin n) (Fin n) ℝ} + (hH : H.IsHermitian) (hdet : H.det ≠ 0) : + ∃ k : ℕ, k ≤ n ∧ ∃ P : E n ≃L[ℝ] X n, ∀ i j : Fin n, + dotProduct (P (EuclideanSpace.single i 1)) (H *ᵥ P (EuclideanSpace.single j 1)) = + 2 * signMatrix n k i j := by + obtain ⟨k, hk, e, he⟩ := positive_reorder hH.eigenvalues + refine ⟨k, hk, frame hH hdet e, ?_⟩ + intro i j + rw [frame_normalizes] + simp only [he, signMatrix, Matrix.diagonal_apply] + split_ifs <;> norm_num + +/-- The actual source Taylor matrix has center J, not 2J or J/2. -/ +theorem source_taylor_center {n : ℕ} {L : ℝ} (hL : L ≠ 0) + (omega : I4Source.SourceMode n → ℝ) + (hmajor : Summable (fun m => I4Source.modeMajorant n L m * |omega m|)) + (x0 : X n) (hdet : (hessian (L := L) omega x0).det ≠ 0) : + ∃ k : ℕ, k ≤ n ∧ ∃ P : E n ≃L[ℝ] X n, + TaylorSymLift.sourceSymMatrix (L := L) omega x0 P.toContinuousLinearMap 0 = signSym n k := by + obtain ⟨k, hk, P, hP⟩ := matrix_normalization (hessian_hermitian hL omega hmajor x0) hdet + refine ⟨k, hk, P, ?_⟩ + apply Subtype.ext + ext i j + rw [TaylorSymLift.sourceSymMatrix_zero hL omega hmajor] + rw [source_hessian_coordinates] + change (1 / 2 : ℝ) * (dotProduct (P (EuclideanSpace.single i 1)) + (hessian (L := L) omega x0 *ᵥ P (EuclideanSpace.single j 1))) = signMatrix n k i j + rw [hP] + ring + +/-- One and the same source, point, frame and positive-first sign matrix feed the +literal directional Hessian and the C2 symmetric Taylor matrix. No chart is assumed. -/ +theorem source_normalization_bundle {n : ℕ} {L : ℝ} (hL : L ≠ 0) + (omega : I4Source.SourceMode n → ℝ) + (hmajor : Summable (fun m => I4Source.modeMajorant n L m * |omega m|)) + (x0 : X n) (hdet : (hessian (L := L) omega x0).det ≠ 0) : + ∃ k : ℕ, k ≤ n ∧ ∃ P : E n ≃L[ℝ] X n, + signMatrix n k * signMatrix n k = 1 ∧ + (∀ i j : Fin n, iteratedFDeriv ℝ 2 (I4Source.sourceField n L omega) x0 + ![P (EuclideanSpace.single i 1), P (EuclideanSpace.single j 1)] = + 2 * signMatrix n k i j) ∧ + TaylorSymLift.sourceSymMatrix (L := L) omega x0 P.toContinuousLinearMap 0 = signSym n k ∧ + ContDiff ℝ 2 (TaylorSymLift.sourceSymMatrix (L := L) omega x0 P.toContinuousLinearMap) := by + obtain ⟨k, hk, P, hP⟩ := matrix_normalization (hessian_hermitian hL omega hmajor x0) hdet + refine ⟨k, hk, P, signMatrix_involution n k, ?_, ?_, ?_⟩ + · intro i j + rw [source_hessian_coordinates] + exact hP i j + · apply Subtype.ext + ext i j + rw [TaylorSymLift.sourceSymMatrix_zero hL omega hmajor, source_hessian_coordinates] + change (1 / 2 : ℝ) * (dotProduct (P (EuclideanSpace.single i 1)) + (hessian (L := L) omega x0 *ᵥ P (EuclideanSpace.single j 1))) = signMatrix n k i j + rw [hP] + ring + · exact TaylorSymLift.sourceSymMatrix_contDiff hL omega hmajor x0 P.toContinuousLinearMap + +end PhysicalSpectral diff --git a/frontiers/compact_source_cutoff_controls_final_repair_20261011/PushedHeight.lean b/frontiers/compact_source_cutoff_controls_final_repair_20261011/PushedHeight.lean new file mode 100644 index 000000000..770e2ad3a --- /dev/null +++ b/frontiers/compact_source_cutoff_controls_final_repair_20261011/PushedHeight.lean @@ -0,0 +1,211 @@ +import SourceNormalForm +import DeterministicSourceC4 +import Mathlib.Analysis.InnerProductSpace.Calculus + +noncomputable section +set_option backward.isDefEq.respectTransparency false +open Filter Set Matrix SourceCoordinates MorseCongruence SourceNormalForm +open scoped Topology ContDiff Manifold Matrix.Norms.Frobenius RealInnerProductSpace +namespace SourcePushedHeight +attribute [local instance] I4TorusC4.actualChartedSpace + +section Core +variable {A B H : Type*} [NormedAddCommGroup A] [InnerProductSpace ℝ A] + [NormedAddCommGroup B] [InnerProductSpace ℝ B] + [NormedAddCommGroup H] [NormedSpace ℝ H] + +def W0 (z : A × B) : A × B := (0, -z.2) +def W1 (z : A × B) : A × B := (z.1, -z.2) +def Q0 (psi : A × B → H) (z : A × B) : H := fderiv ℝ psi z (W0 z) +def Q1 (psi : A × B → H) (z : A × B) : H := fderiv ℝ psi z (W1 z) + +structure LocalGeometry (f : H → ℝ) (phi : OpenPartialHomeomorph H (A × B)) + (T : Set (A × B)) (U : Set H) (c : ℝ) (center : H) : Prop where + target_open : IsOpen T + physical_open : IsOpen U + target_subset : T ⊆ phi.target + inverse_target : MapsTo phi.symm T U + forward_target : MapsTo phi U T + forward_C2 : ContDiffOn ℝ 2 phi phi.source + inverse_C2 : ContDiffOn ℝ 2 phi.symm phi.target + push0_C1 : ContDiffOn ℝ 1 (Q0 phi.symm) T + push1_C1 : ContDiffOn ℝ 1 (Q1 phi.symm) T + physical0_C1 : ContDiffOn ℝ 1 ((Q0 phi.symm) ∘ phi) U + physical1_C1 : ContDiffOn ℝ 1 ((Q1 phi.symm) ∘ phi) U + height : ∀ z ∈ T, f (phi.symm z) = c + MorseCone.quadratic z + rate0 : ∀ z ∈ T, fderiv ℝ f (phi.symm z) (Q0 phi.symm z) = 2 * ‖z.2‖^2 + rate1 : ∀ z ∈ T, fderiv ℝ f (phi.symm z) (Q1 phi.symm z) = + 2 * (‖z.1‖^2 + ‖z.2‖^2) + center_target : (0 : A × B) ∈ T + center_forward : phi center = 0 + center_inverse : phi.symm 0 = center + center_push0 : Q0 phi.symm 0 = 0 + center_push1 : Q1 phi.symm 0 = 0 + +theorem pushed_C1 (psi : A × B → H) (T : Set (A × B)) + (hT : IsOpen T) (hpsi : ContDiffOn ℝ 2 psi T) : + ContDiffOn ℝ 1 (Q0 psi) T ∧ ContDiffOn ℝ 1 (Q1 psi) T := by + have hW0 : ContDiff ℝ 1 (W0 : A × B → A × B) := by + unfold W0 + fun_prop + have hW1 : ContDiff ℝ 1 (W1 : A × B → A × B) := by + unfold W1 + fun_prop + constructor + · apply hT.contDiffOn_iff.mpr + intro z hz + exact ((hpsi.contDiffAt (hT.mem_nhds hz)).fderiv_right (m := 1) (by norm_num)).clm_apply + hW0.contDiffAt + · apply hT.contDiffOn_iff.mpr + intro z hz + exact ((hpsi.contDiffAt (hT.mem_nhds hz)).fderiv_right (m := 1) (by norm_num)).clm_apply + hW1.contDiffAt + +theorem rates_of_local_identity (f : H → ℝ) (psi : A × B → H) + (T : Set (A × B)) (c : ℝ) (hT : IsOpen T) + (hf : Differentiable ℝ f) (hpsi : ContDiffOn ℝ 2 psi T) + (hidentity : ∀ z ∈ T, f (psi z) = c + MorseCone.quadratic z) : + ∀ z ∈ T, + fderiv ℝ f (psi z) (Q0 psi z) = 2 * ‖z.2‖^2 ∧ + fderiv ℝ f (psi z) (Q1 psi z) = 2 * (‖z.1‖^2 + ‖z.2‖^2) := by + intro z hz + have hq := ((hasFDerivAt_fst (p := z)).norm_sq.sub (hasFDerivAt_snd (p := z)).norm_sq).const_add c + have hevent : (fun w => f (psi w)) =ᶠ[𝓝 z] (fun w => c + MorseCone.quadratic w) := + (hT.eventually_mem hz).mono (fun w hw => hidentity w hw) + have hq' := hq.congr_of_eventuallyEq hevent + have hc := (hf (psi z)).hasFDerivAt.comp z + ((hpsi.contDiffAt (hT.mem_nhds hz)).differentiableAt (by norm_num)).hasFDerivAt + have hder := hc.unique hq' + constructor + · have hv := congrArg (fun a : (A × B) →L[ℝ] ℝ => a (W0 z)) hder + simpa [Q0, W0, ContinuousLinearMap.comp_apply, real_inner_self_eq_norm_sq] using hv + · have hv := congrArg (fun a : (A × B) →L[ℝ] ℝ => a (W1 z)) hder + simpa [Q1, W1, ContinuousLinearMap.comp_apply, real_inner_self_eq_norm_sq, + mul_add, sub_eq_add_neg] using hv + +-- Resolve the standard derivative uniqueness within the generic normed context; +-- this avoids repeating expensive alias-specific topological instance search. +theorem derivative_eq (psi : A × B → H) (d : (A × B) →L[ℝ] H) (z : A × B) + (h : HasFDerivAt psi d z) : fderiv ℝ psi z = d := h.fderiv + +end Core + +theorem physicalChart_inverse_derivative {n k : ℕ} (hk : k ≤ n) (x0 : X n) + (P : E n ≃L[ℝ] X n) (e : OpenPartialHomeomorph (E n) (E n)) + (hi : ContDiffOn ℝ 2 e.symm e.target) (z : E k × E (n-k)) + (hz : z ∈ (physicalChart hk x0 P e).target) : + fderiv ℝ (physicalChart hk x0 P e).symm z = + P.toContinuousLinearMap.comp ((fderiv ℝ e.symm ((split hk).symm z)).comp + (split hk).symm.toContinuousLinearMap) := by + have hz' := (physicalChart_target hk x0 P e z).mp hz + have hd := ((hi.contDiffAt (e.open_target.mem_nhds hz')).differentiableAt + (by norm_num)).hasFDerivAt + have h := ((P.hasFDerivAt.comp z (hd.comp z (split hk).symm.hasFDerivAt)).const_add x0) + have hevent : ((physicalChart hk x0 P e).symm : (E k × E (n-k)) → X n) =ᶠ[𝓝 z] + (fun w => x0 + P (e.symm ((split hk).symm w))) := + Filter.Eventually.of_forall (physicalChart_symm hk x0 P e) + have h' : HasFDerivAt (physicalChart hk x0 P e).symm + (P.toContinuousLinearMap.comp ((fderiv ℝ e.symm ((split hk).symm z)).comp + (split hk).symm.toContinuousLinearMap)) z := h.congr_of_eventuallyEq hevent + exact derivative_eq _ _ _ h' + +theorem actual_source_pushed_height {n : ℕ} {L : ℝ} [Fact (0 < L)] + (omega : I4Source.SourceMode n → ℝ) + (hmajor : Summable (fun m => I4Source.modeMajorant n L m * |omega m|)) + (x0 : X n) (hdet : (PhysicalSpectral.hessian (L := L) omega x0).det ≠ 0) + (hcrit : fderiv ℝ (I4Source.sourceField n L omega) x0 = 0) : + ∃ (k : ℕ) (hk : k ≤ n) (P : E n ≃L[ℝ] X n) (s : Sym n → Sym n) + (e : OpenPartialHomeomorph (E n) (E n)) + (D : MorseCone.NormalForm (I4Torus.SourceTorus n L) (E k) (E (n-k))), + let J := PhysicalSpectral.signSym n k + let M := TaylorSymLift.sourceSymMatrix (L := L) omega x0 P.toContinuousLinearMap + M 0 = J ∧ (∀ u, e u = theta J s M u) ∧ + e 0 = 0 ∧ e.symm 0 = 0 ∧ 0 ∈ e.source ∧ 0 ∈ e.target ∧ + HasFDerivAt e (ContinuousLinearMap.id ℝ (E n)) 0 ∧ + ContDiffOn ℝ 2 e e.source ∧ ContDiffOn ℝ 2 e.symm e.target ∧ + D.f = I4Torus.torusSourceField n L omega ∧ + D.p = I4Torus.torusProjection n L x0 ∧ D.c = I4Source.sourceField n L omega x0 ∧ + D.chart = (liftChart (L := L) x0).trans (physicalChart hk x0 P e) ∧ + (∀ q, D.chart q = split hk (e (P.symm (liftChart (L := L) x0 q - x0)))) ∧ + (∀ z, D.chart.symm z = I4Torus.torusProjection n L (x0 + P (e.symm ((split hk).symm z)))) ∧ + ContMDiffOn 𝓘(ℝ, X n) 𝓘(ℝ, E k × E (n-k)) 2 D.chart D.chart.source ∧ + ContMDiffOn 𝓘(ℝ, E k × E (n-k)) 𝓘(ℝ, X n) 2 D.chart.symm D.chart.target ∧ + LocalGeometry (I4Source.sourceField n L omega) (physicalChart hk x0 P e) + D.chart.target ((physicalChart hk x0 P e).source ∩ (liftChart (L := L) x0).target) + D.c x0 := by + obtain ⟨k, hk, P, s, e, D, hM0, heq, he0, hi0, h0s, h0t, hd, heC, hiC, + hf, hp, hc, hchart, happly, hsymm, hC, hCi⟩ := + actual_source_normal_form omega hmajor x0 hdet hcrit + let phi := physicalChart hk x0 P e + let a := liftChart (L := L) x0 + let T := D.chart.target + let U := phi.source ∩ a.target + have hT : IsOpen T := D.chart.open_target + have hU : IsOpen U := phi.open_source.inter a.open_target + have htarget : T = phi.target ∩ phi.symm ⁻¹' a.target := by + change D.chart.target = _ + rw [hchart, OpenPartialHomeomorph.trans_target] + have hsub : T ⊆ phi.target := by + rw [htarget] + exact inter_subset_left + have hInv : MapsTo phi.symm T U := by + intro z hz + exact ⟨phi.map_target (hsub hz), (htarget ▸ hz).2⟩ + have hFor : MapsTo phi U T := by + intro x hx + rw [htarget] + refine ⟨phi.map_source hx.1, ?_⟩ + change phi.symm (phi x) ∈ a.target + simpa only [phi.left_inv hx.1] using hx.2 + obtain ⟨hphi, hpsi⟩ := physicalChart_C2 hk x0 P e heC hiC + have hpsiT : ContDiffOn ℝ 2 phi.symm T := hpsi.mono hsub + obtain ⟨hQ0, hQ1⟩ := pushed_C1 phi.symm T hT hpsiT + have hphiU : ContDiffOn ℝ 1 phi U := + (hphi.of_le (by norm_num)).mono inter_subset_left + have hPQ0 : ContDiffOn ℝ 1 ((Q0 phi.symm) ∘ phi) U := hQ0.comp hphiU hFor + have hPQ1 : ContDiffOn ℝ 1 ((Q1 phi.symm) ∘ phi) U := hQ1.comp hphiU hFor + have hheight : ∀ z ∈ T, + I4Source.sourceField n L omega (phi.symm z) = D.c + MorseCone.quadratic z := by + intro z hz + have h := D.equation (D.chart.symm z) (D.chart.map_target hz) + rw [D.chart.right_inv hz] at h + have hps : D.chart.symm z = I4Torus.torusProjection n L (phi.symm z) := by + simpa only [phi, physicalChart_symm] using hsymm z + rw [hf, hps, I4Torus.torusSourceField_pullback] at h + exact h + have hF := I4DeterministicC4.sourceField_contDiff_of_majorant n + (Fact.out : 0 < L).ne' omega hmajor + have hrates := rates_of_local_identity (I4Source.sourceField n L omega) phi.symm T D.c hT + (hF.differentiable (by norm_num)) hpsiT hheight + have ht0 : (0 : E k × E (n-k)) ∈ T := by + simpa only [D.center_eq] using D.chart.map_source D.center_mem + have hforward0 : phi x0 = 0 := by + simp [phi, physicalChart_apply, he0] + have hinverse0 : phi.symm 0 = x0 := by + simp [phi, physicalChart_symm, hi0] + have hgeo : LocalGeometry (I4Source.sourceField n L omega) phi T U D.c x0 := + { target_open := hT + physical_open := hU + target_subset := hsub + inverse_target := hInv + forward_target := hFor + forward_C2 := hphi + inverse_C2 := hpsi + push0_C1 := hQ0 + push1_C1 := hQ1 + physical0_C1 := hPQ0 + physical1_C1 := hPQ1 + height := hheight + rate0 := fun z hz => (hrates z hz).1 + rate1 := fun z hz => (hrates z hz).2 + center_target := ht0 + center_forward := hforward0 + center_inverse := hinverse0 + center_push0 := by simp only [Q0, W0, Prod.snd_zero, neg_zero, + Prod.mk_zero_zero, map_zero] + center_push1 := by simp only [Q1, W1, Prod.fst_zero, Prod.snd_zero, neg_zero, + Prod.mk_zero_zero, map_zero] } + exact ⟨k, hk, P, s, e, D, hM0, heq, he0, hi0, h0s, h0t, hd, heC, hiC, + hf, hp, hc, hchart, happly, hsymm, hC, hCi, hgeo⟩ + +end SourcePushedHeight diff --git a/frontiers/compact_source_cutoff_controls_final_repair_20261011/QuadraticCone.lean b/frontiers/compact_source_cutoff_controls_final_repair_20261011/QuadraticCone.lean new file mode 100644 index 000000000..6a9b3baf3 --- /dev/null +++ b/frontiers/compact_source_cutoff_controls_final_repair_20261011/QuadraticCone.lean @@ -0,0 +1,251 @@ +import Mathlib.Analysis.InnerProductSpace.PiL2 +import Mathlib.Analysis.Normed.Module.Connected +import Mathlib.Analysis.Convex.PathConnected +import Mathlib.Analysis.Normed.Lp.ProdLp +import Mathlib.Topology.Order.IntermediateValue +import Mathlib.Tactic + +noncomputable section +open Set +open scoped Convex +namespace MorseCone +variable {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + [NormedAddCommGroup F] [NormedSpace ℝ F] + +def quadratic (x : E × F) : ℝ := ‖x.1‖ ^ 2 - ‖x.2‖ ^ 2 + +def radiusBall (ρ : ℝ) : Set (E × F) := {x | ‖x.1‖ ^ 2 + ‖x.2‖ ^ 2 < ρ ^ 2} + +def cone (ρ : ℝ) : Set (E × F) := {x | ‖x.2‖ ≤ ‖x.1‖ ∧ x ∈ radiusBall ρ} + +def puncture (ρ : ℝ) : Set (E × F) := cone ρ \ {0} + +def positiveLobe (ρ : ℝ) : Set (ℝ × F) := {x | x ∈ cone ρ ∧ 0 < x.1} + +def negativeLobe (ρ : ℝ) : Set (ℝ × F) := {x | x ∈ cone ρ ∧ x.1 < 0} + +private theorem radius_convex (ρ : ℝ) (hρ : 0 < ρ) : + Convex ℝ (radiusBall (E := E) (F := F) ρ) := by + have he : radiusBall (E := E) (F := F) ρ = + (WithLp.linearEquiv 2 ℝ (E × F)).symm ⁻¹' Metric.ball 0 ρ := by + ext x + simp only [mem_preimage, Metric.mem_ball, dist_zero_right, WithLp.coe_symm_linearEquiv] + change ‖x.1‖ ^ 2 + ‖x.2‖ ^ 2 < ρ ^ 2 ↔ ‖WithLp.toLp 2 x‖ < ρ + have hn : ‖WithLp.toLp 2 x‖^2 = ‖x.1‖^2+‖x.2‖^2 := by + simpa only [WithLp.toLp_fst, WithLp.toLp_snd] using WithLp.prod_norm_sq_eq_of_L2 (WithLp.toLp 2 x) + rw [← hn] + exact sq_lt_sq₀ (norm_nonneg _) hρ.le + rw [he] + exact (convex_ball (0 : WithLp 2 (E × F)) ρ).linear_preimage + (WithLp.linearEquiv 2 ℝ (E × F)).symm.toLinearMap + +private theorem zero_mem_cone (ρ : ℝ) (hρ : 0 < ρ) : + (0 : E × F) ∈ cone ρ := by + simp only [cone, radiusBall, mem_ofPred_eq, Prod.fst_zero, Prod.snd_zero, norm_zero, + zero_pow (by decide : 2 ≠ 0), zero_add, le_refl, true_and] + positivity + +private theorem cone_star (ρ : ℝ) (hρ : 0 < ρ) : + StarConvex ℝ (0 : E × F) (cone ρ) := by + intro x hx a b ha hb hab + constructor + · change ‖a • (0 : F) + b • x.2‖ ≤ ‖a • (0 : E) + b • x.1‖ + simpa only [smul_zero, zero_add, norm_smul, Real.norm_eq_abs, abs_of_nonneg hb] + using mul_le_mul_of_nonneg_left hx.1 hb + · exact radius_convex ρ hρ (zero_mem_cone ρ hρ).2 hx.2 ha hb hab + +private theorem positive_convex (ρ : ℝ) (hρ : 0 < ρ) : + Convex ℝ (positiveLobe (F := F) ρ) := by + intro x hx y hy a b ha hb hab + have hp : 0 < a * x.1 + b * y.1 := by + by_cases hz : a = 0 + · have hb1 : b = 1 := by linarith + simpa [hz, hb1] using hy.2 + · exact add_pos_of_pos_of_nonneg (mul_pos (lt_of_le_of_ne ha (Ne.symm hz)) hx.2) + (mul_nonneg hb hy.2.le) + refine ⟨⟨?_, radius_convex ρ hρ hx.1.2 hy.1.2 ha hb hab⟩, hp⟩ + change ‖a • x.2 + b • y.2‖ ≤ ‖a * x.1 + b * y.1‖ + rw [Real.norm_eq_abs, abs_of_pos hp] + calc + _ ≤ ‖a • x.2‖ + ‖b • y.2‖ := norm_add_le _ _ + _ = a * ‖x.2‖ + b * ‖y.2‖ := by simp [norm_smul, abs_of_nonneg ha, abs_of_nonneg hb] + _ ≤ a * x.1 + b * y.1 := by + have hx' : ‖x.2‖ ≤ x.1 := by simpa [Real.norm_eq_abs, abs_of_pos hx.2] using hx.1.1 + have hy' : ‖y.2‖ ≤ y.1 := by simpa [Real.norm_eq_abs, abs_of_pos hy.2] using hy.1.1 + exact add_le_add (mul_le_mul_of_nonneg_left hx' ha) (mul_le_mul_of_nonneg_left hy' hb) + +theorem cone_pathConnected (ρ : ℝ) (hρ : 0 < ρ) : + IsPathConnected (cone (E := E) (F := F) ρ) := by + exact (cone_star ρ hρ).isPathConnected (zero_mem_cone ρ hρ) + +theorem cone_zero_positive (ρ : ℝ) (hρ : 0 < ρ) : + cone (E := EuclideanSpace ℝ (Fin 0)) (F := F) ρ = {0} := by + ext x + constructor + · intro hx + have he : x.1 = 0 := Subsingleton.elim _ _ + have hf : x.2 = 0 := norm_eq_zero.mp (le_antisymm (by simpa [he] using hx.1) (norm_nonneg _)) + exact mem_singleton_iff.mpr (Prod.ext he hf) + · rintro rfl + exact zero_mem_cone ρ hρ + +theorem one_positive_lobe (ρ : ℝ) (hρ : 0 < ρ) : + IsPathConnected (positiveLobe (F := F) ρ) := by + apply (positive_convex ρ hρ).isPathConnected + refine ⟨(ρ / 2, 0), ?_⟩ + change (‖(0 : F)‖ ≤ ‖ρ / 2‖ ∧ ‖ρ / 2‖ ^ 2 + ‖(0 : F)‖ ^ 2 < ρ ^ 2) ∧ 0 < ρ / 2 + simp only [norm_zero, Real.norm_eq_abs, abs_of_pos (by positivity : 0 < ρ / 2), zero_pow (by decide : 2 ≠ 0), add_zero] + constructor + · constructor <;> nlinarith + · positivity + +theorem one_negative_lobe (ρ : ℝ) (hρ : 0 < ρ) : + IsPathConnected (negativeLobe (F := F) ρ) := by + have he : negativeLobe (F := F) ρ = (fun x : ℝ × F => (-x.1, x.2)) '' positiveLobe ρ := by + ext x + constructor + · intro hx + refine ⟨(-x.1, x.2), ?_, by simp⟩ + simpa [positiveLobe, negativeLobe, cone, radiusBall, norm_neg] using hx + · rintro ⟨y, hy, rfl⟩ + simpa [positiveLobe, negativeLobe, cone, radiusBall, norm_neg] using hy + rw [he] + exact (one_positive_lobe ρ hρ).image (by fun_prop) + +theorem one_puncture_partition (ρ : ℝ) : + puncture (E := ℝ) (F := F) ρ = positiveLobe ρ ∪ negativeLobe ρ := by + ext x + constructor + · intro hx + have hne : x.1 ≠ 0 := by + intro hzero + have hz : x.2 = 0 := norm_eq_zero.mp (le_antisymm (by simpa [hzero] using hx.1.1) (norm_nonneg _)) + exact hx.2 (mem_singleton_iff.mpr (Prod.ext hzero hz)) + rcases lt_or_gt_of_ne hne with hn | hp + · exact Or.inr ⟨hx.1, hn⟩ + · exact Or.inl ⟨hx.1, hp⟩ + · rintro (hx | hx) + · refine ⟨hx.1, ?_⟩ + intro he + have : x = 0 := mem_singleton_iff.mp he + simpa [this] using hx.2 + · refine ⟨hx.1, ?_⟩ + intro he + have : x = 0 := mem_singleton_iff.mp he + simpa [this] using hx.2 + +theorem one_lobes_separated (ρ : ℝ) {x y : ℝ × F} + (hx : x ∈ positiveLobe ρ) (hy : y ∈ negativeLobe ρ) : + ¬ JoinedIn (puncture ρ) x y := by + intro h + have hi := isPreconnected_Icc.intermediate_value + (show (1 : ℝ) ∈ Icc 0 1 by simp) (show (0 : ℝ) ∈ Icc 0 1 by simp) + (h.somePath.continuous_extend.fst.continuousOn) + have hm : (0 : ℝ) ∈ Icc (h.somePath.extend 1).1 (h.somePath.extend 0).1 := by + simpa using And.intro hy.2.le hx.2.le + obtain ⟨t, ht, he⟩ := hi hm + have hv : h.somePath.extend t ∈ puncture ρ := by + rw [h.somePath.extend_apply ht] + exact h.somePath_mem ⟨t, ht⟩ + have hz : (h.somePath.extend t).2 = 0 := norm_eq_zero.mp + (le_antisymm (by simpa [he] using hv.1.1) (norm_nonneg _)) + exact hv.2 (mem_singleton_iff.mpr (Prod.ext he hz)) + +private theorem puncture_positive {ρ : ℝ} {x : E × F} (hx : x ∈ puncture ρ) : + 0 < ‖x.1‖ := by + apply lt_of_le_of_ne (norm_nonneg _) + intro he + have hy : x.1 = 0 := norm_eq_zero.mp he.symm + have hz : x.2 = 0 := norm_eq_zero.mp (le_antisymm (by simpa [hy] using hx.1.1) (norm_nonneg _)) + exact hx.2 (mem_singleton_iff.mpr (Prod.ext hy hz)) + +private theorem joined_axis {ρ : ℝ} {x : E × F} (hx : x ∈ puncture ρ) : + JoinedIn (puncture ρ) x (x.1, 0) := by + refine JoinedIn.ofLine (f := fun t : ℝ => (x.1, (1-t) • x.2)) (by fun_prop) + (by simp) (by simp) ?_ + rintro q ⟨t, ht, rfl⟩ + have hb : 0 ≤ 1-t := by linarith [ht.2] + have hb1 : 1-t ≤ 1 := by linarith [ht.1] + have hn : ‖(1-t) • x.2‖ ≤ ‖x.2‖ := by + rw [norm_smul, Real.norm_eq_abs, abs_of_nonneg hb] + nlinarith [norm_nonneg x.2] + refine ⟨⟨hn.trans hx.1.1, ?_⟩, ?_⟩ + · change ‖x.1‖^2+‖(1-t) • x.2‖^2<ρ^2 + have hs := sq_le_sq₀ (norm_nonneg ((1-t) • x.2)) (norm_nonneg x.2) + have hbound : ‖x.1‖^2+‖x.2‖^2<ρ^2 := hx.1.2 + nlinarith [hbound, (hs.mpr hn)] + · intro hzero + have hf := congrArg Prod.fst (mem_singleton_iff.mp hzero) + exact (norm_pos_iff.mp (puncture_positive hx)) hf + +private theorem joined_normalized (ρ : ℝ) (hρ : 0 < ρ) {y : E} + (hy : 0 < ‖y‖) (hyρ : ‖y‖ < ρ) : + JoinedIn (puncture (F := F) ρ) (y, 0) (((ρ/2)/‖y‖) • y, 0) := by + let fac : ℝ := (ρ/2)/‖y‖ + have hl : 0 < fac := by dsimp [fac]; positivity + have hn : ‖fac • y‖ = ρ/2 := by + rw [norm_smul, Real.norm_eq_abs, abs_of_pos hl] + dsimp [fac] + field_simp + have hball : [y -[ℝ] fac • y] ⊆ Metric.ball 0 ρ := + (convex_ball (0:E) ρ).segment_subset + (by simpa using hyρ) (by simpa [hn] using (show ρ/2<ρ by linarith)) + refine JoinedIn.of_segment_subset ?_ + rintro q ⟨a,b,ha,hb,hab,rfl⟩ + have ht : 0 < a+b*fac := by + by_cases ha0 : a=0 + · have hb1 : b=1 := by linarith + simpa [ha0,hb1] using hl + · exact add_pos_of_pos_of_nonneg (lt_of_le_of_ne ha (Ne.symm ha0)) (mul_nonneg hb hl.le) + have hs : a • y + b • (fac • y) = (a+b*fac) • y := by rw [add_smul,mul_smul] + have hbnd : ‖(a+b*fac) • y‖ < ρ := by + simpa [hs] using hball ⟨a,b,ha,hb,hab,rfl⟩ + simp only [Prod.smul_mk, Prod.mk_add_mk, smul_zero, add_zero] + change ((a • y + b • (fac • y), (0 : F)) ∈ puncture ρ) + rw [hs] + refine ⟨⟨by simp, ?_⟩, ?_⟩ + · change ‖(a+b*fac) • y‖^2 + ‖(0:F)‖^2 < ρ^2 + simpa using (sq_lt_sq₀ (norm_nonneg _) hρ.le).2 hbnd + · intro he + have he' : (a+b*fac) • y = 0 := congrArg Prod.fst (mem_singleton_iff.mp he) + exact (smul_ne_zero (ne_of_gt ht) (norm_pos_iff.mp hy)) he' + +theorem higher_puncture_pathConnected (ρ : ℝ) (hρ : 0 < ρ) + (hE : 1 < Module.rank ℝ E) : IsPathConnected (puncture (E := E) (F := F) ρ) := by + have hs := isPathConnected_sphere hE (0 : E) (r := ρ/2) (by positivity) + obtain ⟨y,hy,hjoin⟩ := hs + have hyn : ‖y‖ = ρ/2 := by simpa using hy + refine ⟨(y,0), ⟨⟨by simp, ?_⟩, ?_⟩, ?_⟩ + · change ‖y‖^2+‖(0:F)‖^2<ρ^2 + simp only [norm_zero,zero_pow (by decide : 2≠0),add_zero,hyn] + nlinarith + · intro he + have he' : y=0 := congrArg Prod.fst (mem_singleton_iff.mp he) + have : ρ/2=0 := by simpa [he'] using hyn.symm + linarith + · intro x hx + have hp := puncture_positive hx + have hxρ : ‖x.1‖ < ρ := by + have hh : ‖x.1‖^2 < ρ^2 := lt_of_le_of_lt (le_add_of_nonneg_right (sq_nonneg ‖x.2‖)) hx.1.2 + exact (sq_lt_sq₀ (norm_nonneg _) hρ.le).1 hh + let v := ((ρ/2)/‖x.1‖) • x.1 + have hvn : ‖v‖=ρ/2 := by + dsimp [v] + rw [norm_smul, Real.norm_eq_abs, abs_of_pos (by positivity)] + field_simp + have hv : v ∈ Metric.sphere 0 (ρ/2) := by simpa using hvn + have hmap := (hjoin hv).map (f := fun z : E => (z,(0:F))) (by fun_prop) + have hmap' : JoinedIn (puncture (F := F) ρ) (y,(0:F)) (v,(0:F)) := hmap.mono (by + rintro q ⟨z,hz,rfl⟩ + have hn : ‖z‖=ρ/2 := by simpa using hz + refine ⟨⟨by simp, ?_⟩, ?_⟩ + · change ‖z‖^2+‖(0:F)‖^2<ρ^2 + simp only [norm_zero,zero_pow (by decide : 2≠0),add_zero,hn] + nlinarith + · intro he + have he' : z=0 := congrArg Prod.fst (mem_singleton_iff.mp he) + have : ρ/2=0 := by simpa [he'] using hn.symm + linarith) + exact hmap'.trans ((joined_axis hx).trans (joined_normalized ρ hρ hp hxρ)).symm + +end MorseCone diff --git a/frontiers/compact_source_cutoff_controls_final_repair_20261011/README.md b/frontiers/compact_source_cutoff_controls_final_repair_20261011/README.md new file mode 100644 index 000000000..393ba93e4 --- /dev/null +++ b/frontiers/compact_source_cutoff_controls_final_repair_20261011/README.md @@ -0,0 +1,15 @@ +# Compact cutoff controls: second bounded repair source + +This additive F5 package preserves the complete conditional compact-source cutoff proof and all34 controls theorem statements,16 definitions and witnesses. It changes only two local theorem proof obligations diagnosed in actual failed run38155311627 attempt1: explicit nonzero exponent for zero_pow, and terminal reflexivity after the continuous-linear-equivalence derivative rewrite. Candidate controls31533bytes SHA256ddcada242950ab321fe481612827a080b412dce3228ca434392231fa9e6ae0a2 are NOT_COMPILED at this source freeze. + +Parent draftPR425/head128d96fbe39425519a30e48ce2efc7406041a61e/treec05644b379dc3657ccee0ee2be28c491c8662544 is immutable. Its actual predecessor exit0/201s and exact conditional proof exit0/13s succeeded, controls exit1/15s failed at189:6 and383:39; kernel and declaration-wide axiom audit skipped. That failure is technical elaboration, with no typed negative-control, full gate or scientific acceptance. All49 retained native artifact files, full1227-line raw log,108actual source hashes and9pins were independently qualified. Earlier failed attempts are preserved without rerun, dispatch, cancellation or synchronization. + +Actual author /root/cutoff_controls_repair_author wrote the new source2026-10-11T16:47:14.262Z after full diagnosis acceptance16:43:32 and final timestamp-only readback acceptance16:44:16. Complete34 theorem headers and16 full definition bodies are byte-identical; exactly two diff hunks. The new source contains no added theorem premise, axiom, sorry/admit, global instance, option, norm convention, chart, radius or witness. The unchanged conditional proof remains14614bytes/75be8f6bb1b6915b4ab4bb15d89c99050b68944491ba68665caa71a977f8ca0a,26predecessors504047bytes,21geometry fields,both proof endpoint headers and5helpers. All9dependency revisions and audit source are retained. Lake rootname only changes for the new isolated package. + +Claim520956e7-e071-4731-9c64-966df6b1f42d began16:41:37UTC/lease18:41:37; nativeMath1936111277615 and WorkEvents1600 fully readback before source preparation. F5 bounds: source17:00,review17:10,new FIRST source-guard admission STRICTLYbefore2026-10-11T17:20:00Z,documentary17:50. F4 retains its original distinct bounds/doc17:20. Prospective branch codex/compact-cutoff-controls-final-repair-20261011-root01a11cbf, exact base codex/compact-cutoff-controls-repair-20261011-root01a11cbf. Publication and new native attempt require immutable source freeze, fresh completed nonauthor full package/specification/quality review and native predeclaration/register readback. External records must select and bind actual head/baseSHA/testedmerge/orderedparents/tree/sourceguard time/actual hashes/pins/phase exits/fullartifact; attempt1/YAML alone does not prove exact source or global event uniqueness. + +Workflow .github/workflows/compact-cutoff-controls-final-repair.yml retains HOSTED_ONLY,two threads,30minutejob/28cumulative stepminutes,original540+15s predecessor and90+15s proof/controls/kernel/audit process limits, original3pinned actions,Mathlibcachetrue and GitHubprojectcachefalse. No local Lean/Lake/Python/project script, import,test or model ran. Defaulttarget remainsPushedHeight. New proof/controls compilation,kernel and declaration-wide axiom audit remainNOT_RUN. Allowed transitive axioms arepropext,Classical.choice,Quot.sound; this is a future gate requirement,not observed acceptance. + +The proper co-located partial anisotropic literalV1 control remainsOPEN. Separate midpoint-beta and anisotropic derivative/rate controls do not satisfy the combined obligation. No separate fragment integrated. The21geometry fields are explicit conditional premises,not a global correspondence,Hk,pointprocess or universality theorem. Provider/org/blind independence credit0,source-exposedOpenAI/nohuman. Scientific effectNONE; full landmark goalACTIVE/unmet. + +SOURCE_MANIFEST records35package payload files; SOURCE_SHA256SUMS binds36files including manifest and excludes itself; external SOURCE_FREEZE records all37package files plus workflow. External review is omitted from the source manifest to avoid circular hashes. diff --git a/frontiers/compact_source_cutoff_controls_final_repair_20261011/SOURCE_MANIFEST.json b/frontiers/compact_source_cutoff_controls_final_repair_20261011/SOURCE_MANIFEST.json new file mode 100644 index 000000000..75dbc0789 --- /dev/null +++ b/frontiers/compact_source_cutoff_controls_final_repair_20261011/SOURCE_MANIFEST.json @@ -0,0 +1,631 @@ +{ + "schema_version": 3, + "package": "frontiers/compact_source_cutoff_controls_final_repair_20261011", + "prepared_at_utc": "2026-10-11T16:49:57.588Z", + "status": "PREPARED_NOT_COMPILED_NOT_ADMITTED", + "claim": { + "id": "520956e7-e071-4731-9c64-966df6b1f42d", + "start": "2026-10-11T16:41:37Z", + "lease": "2026-10-11T18:41:37Z", + "resource": "Math-:193:C234F5_COMPACT_CONTROLS_TWO_SITE_REPAIR:ROOT01a11cbf:20261011", + "parent": "128d96fbe39425519a30e48ce2efc7406041a61e", + "source_checkpoint": "2026-10-11T17:00:00Z", + "review_checkpoint": "2026-10-11T17:10:00Z", + "admission_strict_before": "2026-10-11T17:20:00Z", + "documentary_bound": "2026-10-11T17:50:00Z", + "branch": "codex/compact-cutoff-controls-final-repair-20261011-root01a11cbf", + "base_branch": "codex/compact-cutoff-controls-repair-20261011-root01a11cbf", + "package": "frontiers/compact_source_cutoff_controls_final_repair_20261011", + "workflow": ".github/workflows/compact-cutoff-controls-final-repair.yml", + "preparation_dir": "/Users/dylanroy/Documents/Codex/2026-10-08/turn-the-below-into-a-reality/compact-cutoff-controls-final-repair-preparation-20261011-root01a11cbf", + "scope": "Two actual F4 residual elaboration sites only, after complete diagnosis acceptance; fresh isolated source, full nonauthor review and exact native predeclaration before one new first hosted attempt. Preserve34 theorem headers/16def headers/witnesses/proof/26predecessors/21fields/5helpers/pins/resource bounds; no fragment integration or old run mutation.", + "work_events_row": 1600 + }, + "parent": { + "repository": "d6g8k5htny-coder/Math-", + "commit": "128d96fbe39425519a30e48ce2efc7406041a61e", + "tree": "c05644b379dc3657ccee0ee2be28c491c8662544", + "draft_pr": 425, + "branch": "codex/compact-cutoff-controls-repair-20261011-root01a11cbf" + }, + "source_inventory": { + "name": "SOURCE_INPUTS.json", + "bytes": 13221, + "sha256": "c7febb8e99ee17481b72678ab03fe839ef50773fb96529c404cced3eb9ba0fb1", + "module_count": 27, + "total_source_bytes": 509962, + "private_source_paths_omitted": true + }, + "unchanged_predecessors": { + "count": 26, + "bytes": 504047, + "paths": [ + "PushedHeight.lean", + "TaylorSymLift.lean", + "TaylorMatrix.lean", + "MorseCongruence.lean", + "DeterministicSourceC4.lean", + "SourceTorusC4.lean", + "SourceC4.lean", + "SourceTorus.lean", + "SourceCovariance.lean", + "SourceKernel.lean", + "SourceLattice.lean", + "SourceGaussianLaw.lean", + "SourceFourierSeries.lean", + "GaussianSeriesFoundation.lean", + "SpectralWeights.lean", + "ConeFootprint.lean", + "QuadraticCone.lean", + "OpenComponentGluing.lean", + "ElementaryHistory.lean", + "GlobalComponentMaps.lean", + "OrdinaryH0Image.lean", + "OrdinaryH0Elder.lean", + "CapFirstExit.lean", + "SourceNormalForm.lean", + "SourceCoordinates.lean", + "PhysicalSpectral.lean" + ] + }, + "files": [ + { + "path": ".gitignore", + "bytes": 7, + "sha256": "fde850d24186b6e99c8c0debd641fb3ab85198b109eb66f71a1fea02bd6ea1b3" + }, + { + "path": "CapFirstExit.lean", + "bytes": 326607, + "sha256": "040aa91fcbdf25ccdaced1c828dd779318217a7c41ac928f87e8d17a8d3c3ef0" + }, + { + "path": "CompactSourceCutoffControls.lean", + "bytes": 31533, + "sha256": "ddcada242950ab321fe481612827a080b412dce3228ca434392231fa9e6ae0a2" + }, + { + "path": "CompactSourceCutoffProof.lean", + "bytes": 14614, + "sha256": "75be8f6bb1b6915b4ab4bb15d89c99050b68944491ba68665caa71a977f8ca0a" + }, + { + "path": "ConeFootprint.lean", + "bytes": 11778, + "sha256": "8082d11707849c9d786583b0acda20893df2a0ffc6e4fc3e7defa57161bd8715" + }, + { + "path": "DeterministicSourceC4.lean", + "bytes": 2551, + "sha256": "aa30073e33ff50ab5a1bc00378ff5a83b47b5002c90610014798aa44bcc31e00" + }, + { + "path": "ElementaryHistory.lean", + "bytes": 4092, + "sha256": "3ed3cff14fe98400e585376bb0210a48f92e1f672351a922242b246ea71cbde4" + }, + { + "path": "GaussianSeriesFoundation.lean", + "bytes": 4262, + "sha256": "feea566d5aeba58459bd4a1f20f070bdcd80ee30712817324cdd594e3e232c95" + }, + { + "path": "GlobalComponentMaps.lean", + "bytes": 3272, + "sha256": "9885878df9cc8ca14b1f206c360142491b868355fe2f36c89dee69656ee9200a" + }, + { + "path": "lake-manifest.json", + "bytes": 3576, + "sha256": "d9f75e73e5afebf9106eeb825bfd3c2802eeaf477dfd6509fb852e4520ea2e0c" + }, + { + "path": "lakefile.toml", + "bytes": 1361, + "sha256": "fd3f3ab88821f4c6f34741058c61a5d1ad0951c17cb00891c8a091e7d811aae9" + }, + { + "path": "LeafAxiomAudit.lean", + "bytes": 2732, + "sha256": "36439470505dfd70d69745a7d575d96d6fbf8571b6a7a34f8a059e46379dcb74" + }, + { + "path": "lean-toolchain", + "bytes": 25, + "sha256": "d5edba4e4b8faad9c1baeadb265716d20d03be4d1a2647dc5e35b0c0325bea7b" + }, + { + "path": "MorseCongruence.lean", + "bytes": 5440, + "sha256": "a922aa09945bb81d67098f46ad3879bdc780b3d8a6b1056e11f8a1716509262e" + }, + { + "path": "OpenComponentGluing.lean", + "bytes": 10241, + "sha256": "5ae10bfd0746cb8f26698544fb1e4728ee6908d195bc44cb7b009fcb11b95297" + }, + { + "path": "OrdinaryH0Elder.lean", + "bytes": 8081, + "sha256": "cc97606ddadc680dcc9d6379ba9e5587901fad1f830c9ea0838a6aa8a83b3486" + }, + { + "path": "OrdinaryH0Image.lean", + "bytes": 5681, + "sha256": "80dfe9e9ce4f005d58212ea00872efe751c72658ff2a4e574ad30c76dd82000b" + }, + { + "path": "PhysicalSpectral.lean", + "bytes": 11362, + "sha256": "64f212853a7533a9ce3462d764a670759f08cc8230d7100b5a4a7f48ed925a41" + }, + { + "path": "PushedHeight.lean", + "bytes": 10333, + "sha256": "ed697889b10e1aa15f78450fb4fc4371e2d79de628852d9a36748c024b9123ff" + }, + { + "path": "QuadraticCone.lean", + "bytes": 11155, + "sha256": "23e320de38fbb247ffe46c4723813f9b32109fae57210ee282198dd1acd71945" + }, + { + "path": "README.md", + "bytes": 4172, + "sha256": "49f670deaf0d314c1f5d6028bb2594085ca6cef4847e45c2e27e9713152d05f1" + }, + { + "path": "SourceC4.lean", + "bytes": 6438, + "sha256": "b15e53b825c2e2d6af2af18182da227d8794dddcc3e1b29611a913f89a889397" + }, + { + "path": "SourceCoordinates.lean", + "bytes": 8161, + "sha256": "b92d2936525bd120f41badb2bd9018714546d986b6ced9c4326bee9e0b1939da" + }, + { + "path": "SourceCovariance.lean", + "bytes": 3925, + "sha256": "30560009582659a100637b5510c657cf1fa762f68a37bae8fab42c1eeee6aee5" + }, + { + "path": "SourceFourierSeries.lean", + "bytes": 6524, + "sha256": "5f145e8e8693bfe4d1554092c8258dbda4f17f8e078c503029e4e8ff2c018014" + }, + { + "path": "SourceGaussianLaw.lean", + "bytes": 8984, + "sha256": "a60ab6099d3cef0eeecaefa9e35d95ec14ec54ffd6c89e42dfcf6170907166e8" + }, + { + "path": "SourceKernel.lean", + "bytes": 5293, + "sha256": "5fa3abc8fb0db0c14c67b4ee840e659cdf80f7d22c9fd4cb5e6c1c7b204fbd21" + }, + { + "path": "SourceLattice.lean", + "bytes": 6284, + "sha256": "c644305a426bc876f609c055ce999b8008f028c67a1091639d919f4122981b7b" + }, + { + "path": "SourceNormalForm.lean", + "bytes": 10589, + "sha256": "aeed9b3533361bcecd92da0170fd217c0568be8ad9777b4f2b0a02a16a0cf542" + }, + { + "path": "SourceTorus.lean", + "bytes": 5182, + "sha256": "02857b44552ab0e51a756b3b095c4ba43f8168ac332b069acb5bc8146d337eef" + }, + { + "path": "SourceTorusC4.lean", + "bytes": 6081, + "sha256": "b67b13030389dea4521e8e2afcac30ea44f84abd65c374bf208067b288fc64a1" + }, + { + "path": "SpectralWeights.lean", + "bytes": 6924, + "sha256": "92af14a2d83304de3f8576ee10b3d376587e93c4464f8c715b8d2e32360f44b0" + }, + { + "path": "TARGET_TRANSFORMATION.md", + "bytes": 1011, + "sha256": "7958ea245e4fb5929717b357fcdb266d9182f523d1399b3360d20dbb9d5189f9" + }, + { + "path": "TaylorMatrix.lean", + "bytes": 12406, + "sha256": "3ba190c557fb93ec26a259929f1f5c2db5c4425da7f7298816e7b4a18f80d7af" + }, + { + "path": "TaylorSymLift.lean", + "bytes": 2401, + "sha256": "996a1dde919a220f6e2d5a6bd939411cac8751b3bd6283be0761434870395cf4" + } + ], + "proof_transformation": { + "namespace_fixture": "CompactSourceCutoffTargetRed.lean", + "fixture_bytes": 5936, + "fixture_sha256": "6d85955aab50429251c441358a26f4cb6e670ea8f6560b5caaf026d697ede0cd", + "proof_bytes": 14614, + "proof_sha256": "75be8f6bb1b6915b4ab4bb15d89c99050b68944491ba68665caa71a977f8ca0a", + "definitions_structure_and_both_theorem_headers": "BYTE_EXACT_TO_NAMESPACE_FIXTURE", + "private_helpers_added": 5, + "proof_bodies_filled": 2, + "details": "TARGET_TRANSFORMATION.md", + "single_repair": { + "prior_bytes": 14601, + "prior_sha256": "fe26104f209cb63ef78b48a9a7540c9d56e6bb2f729726febde38cff5a1689be", + "line": 138, + "old": " (hM.isClosed.isOpen_compl.mem_nhds hxM).mono (by", + "new": " Filter.eventually_of_mem (hM.isClosed.compl_mem_nhds hxM) (by", + "all_other_bytes_unchanged": true, + "review_url": "https://github.com/d6g8k5htny-coder/Math-/issues/193#issuecomment-6110556341", + "verdict": "PASS_NONAUTHOR_STATIC_MINIMAL_REPAIR / EXACT_SOURCE_PROOF_PHASE_COMPILED_IN_F3", + "actual_author": "/root/portable_cutoff_workflow_fix", + "author_native_correction": "https://github.com/d6g8k5htny-coder/Math-/issues/193#issuecomment-6110808522", + "author_write_corroboration": "https://github.com/d6g8k5htny-coder/Math-/issues/193#issuecomment-6110833262" + } + }, + "toolchain": { + "path": "lean-toolchain", + "value": "leanprover/lean4:v4.34.1", + "bytes": 25, + "sha256": "d5edba4e4b8faad9c1baeadb265716d20d03be4d1a2647dc5e35b0c0325bea7b" + }, + "dependencies": [ + { + "name": "plausible", + "url": "https://github.com/leanprover-community/plausible", + "type": "git", + "subDir": null, + "scope": "leanprover-community", + "rev": "118aa17ee84656b8bd727fef7c458ee8c833385c", + "manifestFile": "lake-manifest.json", + "inputRev": "main", + "inherited": true, + "configFile": "lakefile.toml" + }, + { + "name": "LeanSearchClient", + "url": "https://github.com/leanprover-community/LeanSearchClient", + "type": "git", + "subDir": null, + "scope": "leanprover-community", + "rev": "ddf04cf3949fa556442341e87d47f9f6e6074707", + "manifestFile": "lake-manifest.json", + "inputRev": "main", + "inherited": true, + "configFile": "lakefile.toml" + }, + { + "name": "importGraph", + "url": "https://github.com/leanprover-community/import-graph", + "type": "git", + "subDir": null, + "scope": "leanprover-community", + "rev": "e928b72544873815af278d38681b31c0293588e3", + "manifestFile": "lake-manifest.json", + "inputRev": "main", + "inherited": true, + "configFile": "lakefile.toml" + }, + { + "name": "proofwidgets", + "url": "https://github.com/leanprover-community/ProofWidgets4", + "type": "git", + "subDir": null, + "scope": "leanprover-community", + "rev": "106ff4fafc74ef4ac99d81dbf3ab399118f497a5", + "manifestFile": "lake-manifest.json", + "inputRev": "main", + "inherited": true, + "configFile": "lakefile.lean" + }, + { + "name": "aesop", + "url": "https://github.com/leanprover-community/aesop", + "type": "git", + "subDir": null, + "scope": "leanprover-community", + "rev": "355695d523e41d0554926416cba2a2b3544fbbc9", + "manifestFile": "lake-manifest.json", + "inputRev": "master", + "inherited": true, + "configFile": "lakefile.toml" + }, + { + "name": "Qq", + "url": "https://github.com/leanprover-community/quote4", + "type": "git", + "subDir": null, + "scope": "leanprover-community", + "rev": "6a489d9af5d0c47e5b259e2e8bcdfc1811b5a259", + "manifestFile": "lake-manifest.json", + "inputRev": "master", + "inherited": true, + "configFile": "lakefile.toml" + }, + { + "name": "batteries", + "url": "https://github.com/leanprover-community/batteries", + "type": "git", + "subDir": null, + "scope": "leanprover-community", + "rev": "f2effa3d803fda822b1f97b806c47cf2adfbcbc2", + "manifestFile": "lake-manifest.json", + "inputRev": "main", + "inherited": true, + "configFile": "lakefile.toml" + }, + { + "name": "Cli", + "url": "https://github.com/leanprover/lean4-cli", + "type": "git", + "subDir": null, + "scope": "leanprover", + "rev": "e92c9f15fdfacc8536f31cfb3b7ad26c3c8cd204", + "manifestFile": "lake-manifest.json", + "inputRev": "v4.34.0", + "inherited": true, + "configFile": "lakefile.toml" + }, + { + "name": "mathlib", + "url": "https://github.com/leanprover-community/mathlib4.git", + "type": "git", + "subDir": null, + "scope": "", + "rev": "d13f23b723b8a846827a245b89c10fc7d3f11612", + "manifestFile": "lake-manifest.json", + "inputRev": "d13f23b723b8a846827a245b89c10fc7d3f11612", + "inherited": false, + "configFile": "lakefile.lean" + } + ], + "lake_manifest_change": "Root name only; all nine dependency records and other fields retained", + "default_target": { + "module": "PushedHeight", + "registered_libraries": 28, + "unchanged_predecessor_count": 26, + "unchanged_predecessor_bytes": 504047 + }, + "controls": { + "theorem_count": 34, + "direct_imports": [ + "CompactSourceCutoffProof", + "Mathlib.Topology.Order.IntermediateValue" + ], + "coverage": { + "product_max_corner": "PREPARED_NOT_COMPILED", + "original_Foot_annulus": "PREPARED_NOT_COMPILED", + "strict_half_K_and_full_boundary": "PREPARED_NOT_COMPILED", + "concrete_totalized_off_source_chart": "PREPARED_NOT_COMPILED", + "anisotropic_pushed_raw_and_signed_rates": "PREPARED_NOT_COMPILED", + "anisotropic_midpoint_scaled_Q1": "PREPARED_NOT_COMPILED", + "anisotropic_literal_chart_V1": "NOT_PREPARED", + "actual_source_signature_parity": "PREPARED_NOT_COMPILED" + }, + "not_prepared": [ + "A single explicit anisotropic partial chart and literal V1 extension instance combining inverse factors 2 and 3 with the away-inner beta-scaled rate; the direct pushed Q derivatives, beta midpoint scaling, and generic V1 consequence are separately prepared" + ], + "anisotropic_midpoint_limitation": "Beta evaluated at split(t • e0), Q1 and derivative at anisotropicInverse(1,1); algebraic scaling only, different points", + "control_first_typed_red": "NOT_RUN", + "repair": { + "original_bytes": 31473, + "original_sha256": "f1391332d0caad2d778bf75c14f6559c0e8647770a4faf302aea2343030cb0ef", + "candidate_bytes": 31533, + "candidate_sha256": "ddcada242950ab321fe481612827a080b412dce3228ca434392231fa9e6ae0a2", + "author": "/root/cutoff_controls_repair_author", + "actual_first_write_utc": "2026-10-11T16:47:14.262Z", + "affected_original_source_lines": [ + 189, + 386 + ], + "actual_diagnostic_sites": [ + "189:6", + "383:39" + ], + "affected_declarations": 2, + "all34_complete_theorem_headers": "BYTE_EXACT", + "all16_definition_headers": "BYTE_EXACT", + "all16_full_definition_bodies": "BYTE_EXACT", + "witnesses_guards_options_imports": "BYTE_EXACT_OUTSIDE_TWO_LOCAL_PROOF_EDITS", + "diagnosis_md_bytes": 26007, + "diagnosis_md_sha256": "b7bf6a43e0943e26d23cedd9470fba2c81ccff84e46c34f3fe8579304f2b5efd", + "diagnosis_json_bytes": 34722, + "diagnosis_json_sha256": "be05e1a2ed78fe62144db31cb7d09271369501a0d55cd0a1cd02e6307ebb9759", + "validation": "NOT_COMPILED", + "scope": "Only explicit zero_pow exponent nonzero premise and terminalrfl; nofragment/resourceincrease" + } + }, + "static_review": { + "proof": { + "reviewer": "delegated OpenAI agent /root/portable_cutoff_resume_review", + "specification": "PASS_STATIC", + "quality": "PASS_STATIC_WITH_ELABORATION_PENDING", + "report_bytes": 5392, + "report_sha256": "c3e70128e8e71330833b7419df1bab3ca42a3e54fffc4419b62ec91ee3f19055", + "scope": "Historical full-source review of original fe26104f; exact one-line repair separately reviewed by C252; no new whole-proof acceptance or compilation" + }, + "controls": { + "reviewer": "delegated OpenAI agent /root/portable_cutoff_resume_review", + "specification": "PARTIAL_STATIC", + "quality": "STATIC_REVIEW_PASS_WITH_LIMITS", + "report_bytes": 6169, + "report_sha256": "5c343afaecb291002fbe4b1912b73668afb347ec18ebff6d257b2492c351d1c2", + "scope": "Historical controls static report; parent controls subsequently failed14actualtechnicalsites. Fresh whole-candidate specification/quality review is external and required before publication." + }, + "workflow": { + "reviewer": "delegated OpenAI agent /root/portable_cutoff_resume_review", + "verdict": "CONDITIONAL_STATIC_PASS_REQUIRES_FINAL_PLACEHOLDER_BINDING", + "report_bytes": 4934, + "report_sha256": "2a16aa6c5bcb9d911c6dcd9a8ca7d52fb2866106575e441019e69c1633ef3858", + "scope": "Historical PR415 workflow behavior review only; current exact substitutions/bindings reviewed externally after freeze" + }, + "audit": { + "reviewer": "delegated OpenAI agent /root/portable_cutoff_workflow_fix", + "verdict": "STATIC_COHERENT_AFTER_PRIVATE_MODULE_GUARD_FIX", + "report_bytes": 2908, + "report_sha256": "ce815e4f379eaf843f450aab4042f37d8171a8d5d2854b6e06a1cdaa268e6fa5" + }, + "source_exposure": true, + "provider_independence": false, + "organizational_blind_credit": 0, + "human_review": "NOT_CLAIMED", + "current_repair": { + "reviewer": "OpenAI Codex root01a0bbb5 nonauthor; source/discussion exposed, org0", + "native_url": "https://github.com/d6g8k5htny-coder/Math-/issues/193#issuecomment-6110556341", + "specification": "PASS_NONAUTHOR_STATIC_MINIMAL_REPAIR", + "quality": "STATIC_API_RECONSTRUCTION / NOT_COMPILED", + "scope": "One line, unchanged surrounding logic and statement/source boundaries; logical negative controls not executed" + }, + "final_current_package_binding": "External exact-source review after immutable freeze; no circular embedding.", + "current_controls_repair": { + "reviewer": "Fresh nonauthor OpenAI delegated /root/f5_controls_source_review", + "status": "EXTERNAL_REVIEW_REQUIRED_AFTER_FREEZE", + "source_discussion_exposed": true, + "provider_independence_credit": 0, + "organizational_independence_credit": 0, + "blind_credit": 0, + "human_review": "NOT_CLAIMED" + }, + "prior_F4_actual_result": { + "status": "PASS_NONAUTHOR_EXACT_SOURCE_HOSTED_FAILURE_QUALIFICATION", + "full_gate": "FAIL_TECHNICAL_CONTROLS_HOLD", + "reviewer": "/root/f4_controls_source_review", + "MD_sha256": "04e8a27f183b134252feb3380360fdbbc3646f516e6a42ae9bc3ab826f9fe773", + "JSON_sha256": "c0a448ddfddded9df2ab07275bfdf9bab5239d0a4ea90f35a2c8289089a0aa7b", + "required_action_pin_addendum_MD_sha256": "ffdd185307d6ce5c3d44b5f15a926e7db0843023f7ab0aab11108cce91dc76cf", + "required_action_pin_addendum_JSON_sha256": "a0313fdc5e9f8baf406bcc077ecca3440ea93572e509efdaf6bb53e15fb3c2cc", + "scope": "ActualfailedF4 only; no candidate compilation/independentorganization/human/scientificcredit" + } + }, + "execution": { + "mode": "HOSTED_ONLY", + "workflow_path": ".github/workflows/compact-cutoff-controls-final-repair.yml", + "workflow_hash_binding": "External publication record; omitted here to avoid manifest/checksum/workflow self-reference", + "local_lean": "NOT_RUN", + "local_lake": "NOT_RUN", + "local_python": "NOT_RUN", + "project_tests": "NOT_RUN", + "hosted_ci": "NOT_RUN_FOR_THIS_SOURCE", + "kernel_checker": "NOT_RUN", + "axiom_audit": "NOT_RUN", + "mathlib_cache": true, + "github_project_build_cache": false, + "clean_dependency_rebuild": false, + "allowed_transitive_axioms": [ + "propext", + "Classical.choice", + "Quot.sound" + ], + "scientific_promotion": "NOT_CLAIMED", + "full_landmark_goal": "ACTIVE", + "proof_source_parent_compilation": { + "run": 38155311627, + "attempt": 1, + "job": 114516963800, + "proof_exit": 0, + "proof_seconds": 13, + "scope": "Exactunchangedproofcompiled inF4; controlsfullgatefailed; no kernel/auditcredit" + } + }, + "prior_failed_attempt": { + "run": 38077569264, + "attempt": 1, + "job": 114287641297, + "head": "bb3c92e3226827c9aa1d8746226efaf758e06e2c", + "proof_exit": 1, + "proof_seconds": 8, + "predecessor_exit": 0, + "predecessor_seconds": 109, + "controls": "SKIPPED", + "kernel": "SKIPPED", + "audit": "SKIPPED", + "failure_packet_sha256": "610ebdc20b8cc1e0b067ec7f6b608a9d277fb1b17e966b0b9bdf232cec3b0941", + "old_claim_expired": true, + "old_documentary_target_missed": true + }, + "prior_controls_failed_attempt": { + "run": 38155311627, + "attempt": 1, + "job": 114516963800, + "head": "128d96fbe39425519a30e48ce2efc7406041a61e", + "tree": "c05644b379dc3657ccee0ee2be28c491c8662544", + "predecessor_exit": 0, + "predecessor_seconds": 201, + "proof_exit": 0, + "proof_seconds": 13, + "controls_exit": 1, + "controls_seconds": 15, + "diagnostic_count": 2, + "kernel": "SKIPPED_NOT_RUN", + "audit": "SKIPPED_NOT_RUN", + "typed_red": "NONE_TECHNICAL_FAILURE", + "artifact_id": 11708616917, + "artifact_bytes": 30613, + "artifact_sha256": "ef8540e8dd3e3095c786e8b6ccf5171e82f38fc4ba062197dd7a5dd1d3c37207", + "raw_log_bytes": 107745, + "raw_log_sha256": "65347c01cb3a3f36e97b7220b0742df5d34cc232c22b200e9f660b5018dd4d85", + "status": "IMMUTABLE_FAILED_FIRST_ATTEMPT_NO_RERUN" + }, + "prior_controls_repair": { + "original_bytes": 30675, + "original_sha256": "a9c748bc79b222f82ea59713256a46c8cb6dc661255cfd3e66b7246818983c5f", + "candidate_bytes": 31473, + "candidate_sha256": "f1391332d0caad2d778bf75c14f6559c0e8647770a4faf302aea2343030cb0ef", + "author": "/root/cutoff_controls_repair_author", + "affected_original_source_lines": [ + 24, + 80, + 110, + 164, + 181, + 191, + 314, + 363, + 377, + 469, + 501, + 517, + 521, + 557 + ], + "affected_declarations": 11, + "all34_theorem_headers": "BYTE_EXACT_REQUIRED", + "all16_definition_headers": "BYTE_EXACT_REQUIRED", + "witnesses_guards_options_imports": "PRESERVED_REQUIRED", + "diagnosis_md_bytes": 27599, + "diagnosis_md_sha256": "3bdea6ad78390022f43b9b8f17940b473e1103114ea2453f04ad70b274866f28", + "diagnosis_json_bytes": 28563, + "diagnosis_json_sha256": "599f715aa191f989eae8ad519f3e025aa1820a5bbaa6c04c9469230015d44909", + "validation": "NOT_COMPILED", + "scope": "Proof bodies and existing local instances/API normalizations only; no fragment integration or resource increase" + }, + "older_controls_failed_attempt": { + "run": 38153098945, + "attempt": 1, + "job": 114510427134, + "head": "f7832c870cf31d4239a3a7d67b557e69029a1be1", + "tree": "81917d29f99ca4a8b0d3b8fd1186222a1c45143e", + "predecessor_exit": 0, + "predecessor_seconds": 107, + "proof_exit": 0, + "proof_seconds": 9, + "controls_exit": 1, + "controls_seconds": 10, + "diagnostic_count": 14, + "kernel": "SKIPPED_NOT_RUN", + "audit": "SKIPPED_NOT_RUN", + "typed_red": "NONE_TECHNICAL_FAILURE", + "artifact_id": 11707526713, + "artifact_bytes": 30886, + "artifact_sha256": "f369ca0b10432dba4ded47150754bf889c781e9e14e8bb1b968a0f094d4b44bc", + "raw_log_bytes": 106381, + "raw_log_sha256": "c98670e5b51494262b876dab77512bcb43722d00562be5a46c6e3c17e26cbbd3", + "status": "IMMUTABLE_FAILED_FIRST_ATTEMPT_NO_RERUN" + } +} diff --git a/frontiers/compact_source_cutoff_controls_final_repair_20261011/SOURCE_SHA256SUMS b/frontiers/compact_source_cutoff_controls_final_repair_20261011/SOURCE_SHA256SUMS new file mode 100644 index 000000000..a4e7c5ff1 --- /dev/null +++ b/frontiers/compact_source_cutoff_controls_final_repair_20261011/SOURCE_SHA256SUMS @@ -0,0 +1,36 @@ +fde850d24186b6e99c8c0debd641fb3ab85198b109eb66f71a1fea02bd6ea1b3 .gitignore +040aa91fcbdf25ccdaced1c828dd779318217a7c41ac928f87e8d17a8d3c3ef0 CapFirstExit.lean +ddcada242950ab321fe481612827a080b412dce3228ca434392231fa9e6ae0a2 CompactSourceCutoffControls.lean +75be8f6bb1b6915b4ab4bb15d89c99050b68944491ba68665caa71a977f8ca0a CompactSourceCutoffProof.lean +8082d11707849c9d786583b0acda20893df2a0ffc6e4fc3e7defa57161bd8715 ConeFootprint.lean +aa30073e33ff50ab5a1bc00378ff5a83b47b5002c90610014798aa44bcc31e00 DeterministicSourceC4.lean +3ed3cff14fe98400e585376bb0210a48f92e1f672351a922242b246ea71cbde4 ElementaryHistory.lean +feea566d5aeba58459bd4a1f20f070bdcd80ee30712817324cdd594e3e232c95 GaussianSeriesFoundation.lean +9885878df9cc8ca14b1f206c360142491b868355fe2f36c89dee69656ee9200a GlobalComponentMaps.lean +36439470505dfd70d69745a7d575d96d6fbf8571b6a7a34f8a059e46379dcb74 LeafAxiomAudit.lean +a922aa09945bb81d67098f46ad3879bdc780b3d8a6b1056e11f8a1716509262e MorseCongruence.lean +5ae10bfd0746cb8f26698544fb1e4728ee6908d195bc44cb7b009fcb11b95297 OpenComponentGluing.lean +cc97606ddadc680dcc9d6379ba9e5587901fad1f830c9ea0838a6aa8a83b3486 OrdinaryH0Elder.lean +80dfe9e9ce4f005d58212ea00872efe751c72658ff2a4e574ad30c76dd82000b OrdinaryH0Image.lean +64f212853a7533a9ce3462d764a670759f08cc8230d7100b5a4a7f48ed925a41 PhysicalSpectral.lean +ed697889b10e1aa15f78450fb4fc4371e2d79de628852d9a36748c024b9123ff PushedHeight.lean +23e320de38fbb247ffe46c4723813f9b32109fae57210ee282198dd1acd71945 QuadraticCone.lean +49f670deaf0d314c1f5d6028bb2594085ca6cef4847e45c2e27e9713152d05f1 README.md +880579d79c914b00cca11ea2c4c2d0b2e3a159d7db6fe4434d77288c03baed46 SOURCE_MANIFEST.json +b15e53b825c2e2d6af2af18182da227d8794dddcc3e1b29611a913f89a889397 SourceC4.lean +b92d2936525bd120f41badb2bd9018714546d986b6ced9c4326bee9e0b1939da SourceCoordinates.lean +30560009582659a100637b5510c657cf1fa762f68a37bae8fab42c1eeee6aee5 SourceCovariance.lean +5f145e8e8693bfe4d1554092c8258dbda4f17f8e078c503029e4e8ff2c018014 SourceFourierSeries.lean +a60ab6099d3cef0eeecaefa9e35d95ec14ec54ffd6c89e42dfcf6170907166e8 SourceGaussianLaw.lean +5fa3abc8fb0db0c14c67b4ee840e659cdf80f7d22c9fd4cb5e6c1c7b204fbd21 SourceKernel.lean +c644305a426bc876f609c055ce999b8008f028c67a1091639d919f4122981b7b SourceLattice.lean +aeed9b3533361bcecd92da0170fd217c0568be8ad9777b4f2b0a02a16a0cf542 SourceNormalForm.lean +02857b44552ab0e51a756b3b095c4ba43f8168ac332b069acb5bc8146d337eef SourceTorus.lean +b67b13030389dea4521e8e2afcac30ea44f84abd65c374bf208067b288fc64a1 SourceTorusC4.lean +92af14a2d83304de3f8576ee10b3d376587e93c4464f8c715b8d2e32360f44b0 SpectralWeights.lean +7958ea245e4fb5929717b357fcdb266d9182f523d1399b3360d20dbb9d5189f9 TARGET_TRANSFORMATION.md +3ba190c557fb93ec26a259929f1f5c2db5c4425da7f7298816e7b4a18f80d7af TaylorMatrix.lean +996a1dde919a220f6e2d5a6bd939411cac8751b3bd6283be0761434870395cf4 TaylorSymLift.lean +d9f75e73e5afebf9106eeb825bfd3c2802eeaf477dfd6509fb852e4520ea2e0c lake-manifest.json +fd3f3ab88821f4c6f34741058c61a5d1ad0951c17cb00891c8a091e7d811aae9 lakefile.toml +d5edba4e4b8faad9c1baeadb265716d20d03be4d1a2647dc5e35b0c0325bea7b lean-toolchain diff --git a/frontiers/compact_source_cutoff_controls_final_repair_20261011/SourceC4.lean b/frontiers/compact_source_cutoff_controls_final_repair_20261011/SourceC4.lean new file mode 100644 index 000000000..f5188d51c --- /dev/null +++ b/frontiers/compact_source_cutoff_controls_final_repair_20261011/SourceC4.lean @@ -0,0 +1,141 @@ +import SourceFourierSeries +import Mathlib.Analysis.Calculus.SmoothSeries +import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv + +/-! Actual same-sample C4 of the canonical normalized Fourier lift. +Covariance identification, Gaussian field/jet laws and pin regression are separate. -/ + +noncomputable section +open I4Foundation I4Weights I4Source MeasureTheory ProbabilityTheory +open scoped BigOperators + +namespace I4C4 + +def phaseCLM (d : ℕ) (L : ℝ) (k : Fin d → ℤ) : (Fin d → ℝ) →L[ℝ] ℝ := + ∑ i, (sourceC L * (k i : ℝ)) • ContinuousLinearMap.proj i + +theorem phaseCLM_apply (d : ℕ) (L : ℝ) (k : Fin d → ℤ) (x : Fin d → ℝ) : + phaseCLM d L k x = phase d L k x := by + simp [phaseCLM, phase] + +theorem phaseCLM_norm_le (d : ℕ) (L : ℝ) (k : Fin d → ℤ) : + ‖phaseCLM d L k‖ ≤ ∑ i, |sourceC L * (k i : ℝ)| := by + apply ContinuousLinearMap.opNorm_le_bound _ + (Finset.sum_nonneg (fun i _ => abs_nonneg _)) + intro x + rw [phaseCLM_apply] + calc + ‖phase d L k x‖ ≤ ∑ i, ‖sourceC L * (k i : ℝ) * x i‖ := norm_sum_le _ _ + _ ≤ ∑ i, |sourceC L * (k i : ℝ)| * ‖x‖ := by + apply Finset.sum_le_sum + intro i _ + rw [norm_mul, Real.norm_eq_abs] + exact mul_le_mul_of_nonneg_left (norm_le_pi_norm x i) (abs_nonneg _) + _ = (∑ i, |sourceC L * (k i : ℝ)|) * ‖x‖ := by rw [Finset.sum_mul] + +theorem modeCoefficient_iteratedFDeriv_bound (d : ℕ) {L : ℝ} (hL : L ≠ 0) + (m : SourceMode d) (j : ℕ) (hj : j ≤ 4) (x : Fin d → ℝ) : + ‖iteratedFDeriv ℝ j (modeCoefficient d L m) x‖ ≤ modeMajorant d L m := by + classical + cases m with + | none => + cases j with + | zero => + simpa only [norm_iteratedFDeriv_zero, Real.norm_eq_abs] using + modeCoefficient_bound d hL none x + | succ j => + change ‖iteratedFDeriv ℝ (j + 1) + (fun _ : Fin d → ℝ => Real.sqrt (1 / sourceZ d L)) x‖ ≤ Real.sqrt (1 / sourceZ d L) + rw [iteratedFDeriv_succ_const] + simp only [Pi.zero_apply, norm_zero] + exact Real.sqrt_nonneg _ + | some p => + rcases p with ⟨k, b⟩ + let A := Real.sqrt (2 * sourceWeight d L k / sourceZ d L) + let P := ∏ i, (1 + |sourceC L * (k.1 i : ℝ)|) + let g : ℝ → ℝ := if b then Real.sin else Real.cos + let ell := phaseCLM d L k + have hg : ContDiff ℝ j g := by + cases b <;> simp only [g, Bool.false_eq_true, ite_false, ite_true] <;> fun_prop + have hgc : ContDiff ℝ j (g ∘ ell) := hg.comp_continuousLinearMap + have hgn : ‖iteratedFDeriv ℝ j g (ell x)‖ ≤ 1 := by + cases b with + | false => + simpa only [g, Bool.false_eq_true, ite_false, + norm_iteratedFDeriv_eq_norm_iteratedDeriv, Real.norm_eq_abs] using + Real.abs_iteratedDeriv_cos_le_one j (ell x) + | true => + simpa only [g, ite_true, norm_iteratedFDeriv_eq_norm_iteratedDeriv, + Real.norm_eq_abs] using Real.abs_iteratedDeriv_sin_le_one j (ell x) + have hP : 1 ≤ P := by + apply Finset.one_le_prod₀ + intro i _ + linarith [abs_nonneg (sourceC L * (k.1 i : ℝ))] + have hl : ‖ell‖ ≤ P := by + calc + ‖ell‖ ≤ ∑ i, |sourceC L * (k.1 i : ℝ)| := phaseCLM_norm_le d L k + _ ≤ 1 + ∑ i, |sourceC L * (k.1 i : ℝ)| := by linarith + _ ≤ P := frequency_l1_le_product d _ (fun i => abs_nonneg _) + have hpow : ‖ell‖ ^ j ≤ P ^ 4 := by + calc + ‖ell‖ ^ j ≤ P ^ j := by gcongr + _ ≤ P ^ 4 := pow_le_pow_right₀ hP hj + have hder : ‖iteratedFDeriv ℝ j (g ∘ ell) x‖ ≤ ‖ell‖ ^ j := by + rw [ell.iteratedFDeriv_comp_right hg x le_rfl] + calc + _ ≤ ‖iteratedFDeriv ℝ j g (ell x)‖ * ∏ _i : Fin j, ‖ell‖ := + (iteratedFDeriv ℝ j g (ell x)).norm_compContinuousLinearMap_le (fun _ => ell) + _ ≤ 1 * ∏ _i : Fin j, ‖ell‖ := + mul_le_mul_of_nonneg_right hgn (Finset.prod_nonneg (fun _ _ => norm_nonneg _)) + _ = ‖ell‖ ^ j := by simp + have heq : modeCoefficient d L (some (k, b)) = A • (g ∘ ell) := by + funext y + cases b <;> simp [modeCoefficient, A, g, Function.comp_apply, Pi.smul_apply, + smul_eq_mul, ell, phaseCLM_apply] + rw [heq, iteratedFDeriv_const_smul_apply hgc.contDiffAt, norm_smul, + Real.norm_eq_abs, abs_of_nonneg (Real.sqrt_nonneg _)] + calc + _ ≤ A * P ^ 4 := mul_le_mul_of_nonneg_left (hder.trans hpow) (Real.sqrt_nonneg _) + _ = modeMajorant d L (some (k, b)) := by + rw [modeMajorant, pairedBound_eq_amplitude d hL k] + simp only [A, P, Finset.prod_pow] + +theorem sourceField_contDiff_ae (d : ℕ) {L : ℝ} (hL : L ≠ 0) : + ∀ᵐ ω ∂sourceLaw d, ContDiff ℝ 4 (sourceField d L ω) := by + have hc (m : SourceMode d) : ContDiff ℝ 4 (modeCoefficient d L m) := by + cases m with + | none => + change ContDiff ℝ 4 (fun _ : Fin d → ℝ => Real.sqrt (1 / sourceZ d L)) + fun_prop + | some p => + rcases p with ⟨k, b⟩ + change ContDiff ℝ 4 (fun x : Fin d → ℝ => + Real.sqrt (2 * sourceWeight d L k / sourceZ d L) * + (if b then Real.sin (phase d L k x) else Real.cos (phase d L k x))) + cases b <;> simp [phase] <;> fun_prop + filter_upwards [sourceMajorant_ae d hL] with ω hω + change ContDiff ℝ 4 (fun x => ∑' m, modeCoefficient d L m x * ω m) + apply contDiff_tsum (v := fun _ m => modeMajorant d L m * |ω m|) + · intro m + exact (hc m).mul contDiff_const + · intro j hj + exact hω + · intro j m x hj + have hj' : j ≤ 4 := by exact_mod_cast hj + have hcj : ContDiff ℝ j (modeCoefficient d L m) := + (hc m).of_le (by exact_mod_cast hj') + have heq : (fun y => modeCoefficient d L m y * ω m) = ω m • modeCoefficient d L m := by + funext y + simp [smul_eq_mul, mul_comm] + rw [heq, iteratedFDeriv_const_smul_apply hcj.contDiffAt, norm_smul, Real.norm_eq_abs] + simpa only [mul_comm] using mul_le_mul_of_nonneg_left + (modeCoefficient_iteratedFDeriv_bound d hL m j hj' x) (abs_nonneg (ω m)) + +theorem sourceField_contDiff_affine_ae (d : ℕ) {L : ℝ} (hL : L ≠ 0) : + ∀ᵐ ω ∂sourceLaw d, ∀ (T : (Fin d → ℝ) →L[ℝ] (Fin d → ℝ)) (a : Fin d → ℝ), + ContDiff ℝ 4 (fun x => sourceField d L ω (a + T x)) := by + filter_upwards [sourceField_contDiff_ae d hL] with ω hω + intro T a + exact hω.comp (contDiff_const.add T.contDiff) + +end I4C4 diff --git a/frontiers/compact_source_cutoff_controls_final_repair_20261011/SourceCoordinates.lean b/frontiers/compact_source_cutoff_controls_final_repair_20261011/SourceCoordinates.lean new file mode 100644 index 000000000..9211a5681 --- /dev/null +++ b/frontiers/compact_source_cutoff_controls_final_repair_20261011/SourceCoordinates.lean @@ -0,0 +1,160 @@ +import PhysicalSpectral +import Mathlib.Analysis.Calculus.FDeriv.CompCLM +import Mathlib.Topology.OpenPartialHomeomorph.IsImage + +noncomputable section +set_option backward.isDefEq.respectTransparency false +open Filter Set Matrix +open scoped Topology ContDiff Matrix.Norms.Frobenius +namespace SourceCoordinates +abbrev E (n : ℕ) := EuclideanSpace ℝ (Fin n) +abbrev X (n : ℕ) := Fin n → ℝ +open MorseCongruence + +def action (n : ℕ) : Mat n →L[ℝ] E n →L[ℝ] E n := + (Matrix.toEuclideanLin.trans LinearMap.toContinuousLinearMap).toLinearMap.toContinuousLinearMap + +def R {n : ℕ} (J : Sym n) (s : Sym n → Sym n) (M : E n → Sym n) (u : E n) : Mat n := + 1 + (J : Mat n) * (s (M u) : Mat n) + +def theta {n : ℕ} (J : Sym n) (s : Sym n → Sym n) (M : E n → Sym n) (u : E n) : E n := + action n (R J s M u) u + +def quadratic {n : ℕ} (A : Mat n) (u : E n) : ℝ := + ∑ i, ∑ j, u i * A i j * u j + +theorem action_one (n : ℕ) : action n 1 = ContinuousLinearMap.id ℝ (E n) := by + apply ContinuousLinearMap.ext + intro u + change Matrix.toLpLin 2 2 (1 : Mat n) u = u + rw [Matrix.toLpLin_one] + rfl + +theorem action_apply {n : ℕ} (A : Mat n) (u : E n) : + WithLp.ofLp (action n A u) = A *ᵥ WithLp.ofLp u := rfl + +theorem quadratic_eq_dot {n : ℕ} (A : Mat n) (u : E n) : + quadratic A u = dotProduct (WithLp.ofLp u) (A *ᵥ WithLp.ofLp u) := by + simp [quadratic, dotProduct, Matrix.mulVec, Finset.mul_sum, mul_assoc] + +theorem quadratic_congruence {n : ℕ} (J A : Mat n) (u : E n) : + quadratic (star A * J * A) u = quadratic J (action n A u) := by + rw [quadratic_eq_dot, quadratic_eq_dot, action_apply] + rw [Matrix.star_eq_conjTranspose, Matrix.conjTranspose_eq_transpose_of_trivial] + rw [← Matrix.mulVec_mulVec, ← Matrix.mulVec_mulVec] + rw [Matrix.dotProduct_transpose_mulVec, dotProduct_comm] + +theorem apply_hasFDerivAt_zero {n : ℕ} (A : E n → E n →L[ℝ] E n) + (hA : DifferentiableAt ℝ A 0) (hA0 : A 0 = ContinuousLinearMap.id ℝ (E n)) : + HasFDerivAt (fun u => A u u) (ContinuousLinearMap.id ℝ (E n)) 0 := by + simpa [hA0] + using hA.hasFDerivAt.clm_apply (hasFDerivAt_id (0 : E n)) + +theorem exists_coordinates {n : ℕ} (J : Sym n) (hJ : (J : Mat n) * (J : Mat n) = 1) + (M : E n → Sym n) (hM : ContDiff ℝ 2 M) (hM0 : M 0 = J) : + ∃ (V : Set (Sym n)) (s : Sym n → Sym n) (e : OpenPartialHomeomorph (E n) (E n)), + IsOpen V ∧ J ∈ V ∧ s J = 0 ∧ ContDiffOn ℝ 2 s V ∧ + (∀ u, e u = theta J s M u) ∧ e 0 = 0 ∧ e.symm 0 = 0 ∧ + 0 ∈ e.source ∧ 0 ∈ e.target ∧ + HasFDerivAt e (ContinuousLinearMap.id ℝ (E n)) 0 ∧ + ContDiffOn ℝ 2 e e.source ∧ ContDiffOn ℝ 2 e.symm e.target ∧ + (∀ u ∈ e.source, M u ∈ V ∧ quadratic (M u : Mat n) u = quadratic (J : Mat n) (e u)) := by + obtain ⟨V, s, hV, hJV, hs0, hs, hcong⟩ := exists_congruence_branch J hJ + let U : Set (E n) := M ⁻¹' V + have hU : IsOpen U := hV.preimage hM.continuous + have h0U : (0 : E n) ∈ U := by simpa [U, hM0] using hJV + let inc : Sym n →L[ℝ] Mat n := (selfAdjoint.submodule ℝ (Mat n)).subtypeL + have hSM : ContDiffOn ℝ 2 (fun u => s (M u)) U := + hs.comp hM.contDiffOn (fun u hu => hu) + have hR : ContDiffOn ℝ 2 (R J s M) U := by + exact contDiffOn_const.add (contDiffOn_const.mul (inc.contDiff.comp_contDiffOn hSM)) + let A : E n → E n →L[ℝ] E n := fun u => action n (R J s M u) + have hA : ContDiffOn ℝ 2 A U := (action n).contDiff.comp_contDiffOn hR + have htheta : ContDiffOn ℝ 2 (theta J s M) U := hA.clm_apply contDiffOn_id + have hR0 : R J s M 0 = 1 := by simp [R, hM0, hs0] + have hA0 : A 0 = ContinuousLinearMap.id ℝ (E n) := by + simp only [A, hR0, action_one] + have htheta0 : theta J s M 0 = 0 := by simp [theta] + have hthetaAt : ContDiffAt ℝ 2 (theta J s M) 0 := htheta.contDiffAt (hU.mem_nhds h0U) + have hd : HasFDerivAt (theta J s M) (ContinuousLinearMap.id ℝ (E n)) 0 := + apply_hasFDerivAt_zero A ((hA.contDiffAt (hU.mem_nhds h0U)).differentiableAt (by norm_num)) hA0 + let e0 := hthetaAt.toOpenPartialHomeomorph (theta J s M) + (f' := ContinuousLinearEquiv.refl ℝ (E n)) hd (by norm_num) + have h0e : (0 : E n) ∈ e0.source := + hthetaAt.mem_toOpenPartialHomeomorph_source (f' := ContinuousLinearEquiv.refl ℝ (E n)) hd (by norm_num) + have h0t : (0 : E n) ∈ e0.target := by + simpa [e0, htheta0] using hthetaAt.image_mem_toOpenPartialHomeomorph_target (f' := ContinuousLinearEquiv.refl ℝ (E n)) hd (by norm_num) + have hinv0 : e0.symm 0 = 0 := by + have h := e0.left_inv h0e + change e0.symm (theta J s M 0) = 0 at h + simpa [htheta0] using h + have hinvAt : ContDiffAt ℝ 2 e0.symm 0 := by + apply e0.contDiffAt_symm (f₀' := ContinuousLinearEquiv.refl ℝ (E n)) h0t + · change HasFDerivAt (theta J s M) _ (e0.symm 0) + rw [hinv0] + exact hd + · change ContDiffAt ℝ 2 (theta J s M) (e0.symm 0) + rw [hinv0] + exact hthetaAt + obtain ⟨T, hT, hTinverse⟩ := hinvAt.contDiffOn le_rfl (by simp) + obtain ⟨W, hWT, hW, h0W⟩ := mem_nhds_iff.mp hT + let e1 := e0.restrOpen U hU + let e := (e1.symm.restrOpen W hW).symm + have hes : e.source ⊆ U := by + intro u hu + exact hu.1.2 + have het : e.target ⊆ W := by + intro u hu + exact hu.2 + have h0e1t : (0 : E n) ∈ e1.target := by + exact ⟨h0t, by simpa [hinv0] using h0U⟩ + have h0es : (0 : E n) ∈ e.source := by + exact ⟨⟨h0e, h0U⟩, by simpa [e1, e0, htheta0] using h0W⟩ + have h0et : (0 : E n) ∈ e.target := ⟨h0e1t, h0W⟩ + refine ⟨V, s, e, hV, hJV, hs0, hs, (fun _ => rfl), htheta0, hinv0, + h0es, h0et, hd, htheta.mono hes, (hTinverse.mono (fun v hv => hWT (het hv))), ?_⟩ + intro u hu + have hMu : M u ∈ V := hes hu + refine ⟨hMu, ?_⟩ + rw [hcong (M u) hMu] + exact quadratic_congruence (J : Mat n) (R J s M u) u + +theorem source_coordinates {n : ℕ} {L : ℝ} (hL : L ≠ 0) + (omega : I4Source.SourceMode n → ℝ) + (hmajor : Summable (fun m => I4Source.modeMajorant n L m * |omega m|)) + (x0 : X n) (hdet : (PhysicalSpectral.hessian (L := L) omega x0).det ≠ 0) + (hcrit : fderiv ℝ (I4Source.sourceField n L omega) x0 = 0) : + ∃ k : ℕ, k ≤ n ∧ ∃ (P : E n ≃L[ℝ] X n) + (V : Set (Sym n)) (s : Sym n → Sym n) (e : OpenPartialHomeomorph (E n) (E n)), + let J := PhysicalSpectral.signSym n k + let M := TaylorSymLift.sourceSymMatrix (L := L) omega x0 P.toContinuousLinearMap + M 0 = J ∧ IsOpen V ∧ J ∈ V ∧ s J = 0 ∧ ContDiffOn ℝ 2 s V ∧ + (∀ u, e u = theta J s M u) ∧ e 0 = 0 ∧ e.symm 0 = 0 ∧ + 0 ∈ e.source ∧ 0 ∈ e.target ∧ + HasFDerivAt e (ContinuousLinearMap.id ℝ (E n)) 0 ∧ + ContDiffOn ℝ 2 e e.source ∧ ContDiffOn ℝ 2 e.symm e.target ∧ + (∀ u ∈ e.source, M u ∈ V ∧ I4Source.sourceField n L omega (x0 + P u) = + I4Source.sourceField n L omega x0 + quadratic (J : Mat n) (e u)) ∧ + (∀ v ∈ e.target, I4Source.sourceField n L omega (x0 + P (e.symm v)) = + I4Source.sourceField n L omega x0 + quadratic (J : Mat n) v) := by + obtain ⟨k, hk, P, hJ, hH, hM0, hM⟩ := + PhysicalSpectral.source_normalization_bundle hL omega hmajor x0 hdet + obtain ⟨V, s, e, hV, hJV, hs0, hs, heq, he0, hi0, h0s, h0t, hd, heC, hiC, hq⟩ := + exists_coordinates (PhysicalSpectral.signSym n k) hJ + (TaylorSymLift.sourceSymMatrix (L := L) omega x0 P.toContinuousLinearMap) hM hM0 + refine ⟨k, hk, P, V, s, e, hM0, hV, hJV, hs0, hs, heq, he0, hi0, + h0s, h0t, hd, heC, hiC, ?_, ?_⟩ + · intro u hu + refine ⟨(hq u hu).1, ?_⟩ + have he := TaylorSymLift.sourceSymMatrix_quadratic hL omega hmajor x0 P.toContinuousLinearMap hcrit u + exact he.trans (congrArg (fun q => I4Source.sourceField n L omega x0 + q) (hq u hu).2) + · intro v hv + have hu := e.map_target hv + have he := TaylorSymLift.sourceSymMatrix_quadratic hL omega hmajor x0 + P.toContinuousLinearMap hcrit (e.symm v) + change I4Source.sourceField n L omega (x0 + P (e.symm v)) = + I4Source.sourceField n L omega x0 + quadratic _ _ at he + rw [(hq (e.symm v) hu).2, e.right_inv hv] at he + exact he + +end SourceCoordinates diff --git a/frontiers/compact_source_cutoff_controls_final_repair_20261011/SourceCovariance.lean b/frontiers/compact_source_cutoff_controls_final_repair_20261011/SourceCovariance.lean new file mode 100644 index 000000000..50aa85f30 --- /dev/null +++ b/frontiers/compact_source_cutoff_controls_final_repair_20261011/SourceCovariance.lean @@ -0,0 +1,74 @@ +import SourceKernel +import SourceGaussianLaw +import Mathlib.Probability.Moments.Covariance +import Mathlib.Probability.Moments.Variance + +noncomputable section +open I4Foundation I4Weights I4Source I4Kernel I4SourceGaussian MeasureTheory ProbabilityTheory +open scoped BigOperators ENNReal NNReal +namespace I4SourceCovariance + +variable {ι : Type*} [Countable ι] + +theorem scalarSeries_covariance (a b : ι → ℝ) (ha : Summable a) (hb : Summable b) : + cov[scalarSeries a, scalarSeries b; coefficientLaw ι] = ∑' i, a i * b i := by + have hsq (f : ι → ℝ) (hf : Summable f) : Summable (fun i => f i ^ 2) := by + have hp := summable_mul_of_summable_norm hf.norm hf.norm + simpa only [Function.comp_def, pow_two] using hp.comp_injective + (show Function.Injective (fun i : ι => (i,i)) from + fun i j h => congrArg Prod.fst h) + have hprod : Summable (fun i => a i * b i) := by + have hp := summable_mul_of_summable_norm ha.norm hb.norm + simpa only [Function.comp_def] using hp.comp_injective + (show Function.Injective (fun i : ι => (i,i)) from + fun i j h => congrArg Prod.fst h) + have hLp (f : ι → ℝ) (hf : Summable f) : + MemLp (scalarSeries f) 2 (coefficientLaw ι) := by + have h : MemLp id 2 ((coefficientLaw ι).map (scalarSeries f)) := by + rw [scalarSeries_map_gaussian f hf] + exact memLp_id_gaussianReal' 2 (by norm_num) + simpa only [Function.comp_def, Function.id_def] using + h.comp_of_map (scalarSeries_measurable f).aemeasurable + have heq : scalarSeries (a + b) =ᵐ[coefficientLaw ι] + (fun ω => scalarSeries a ω + scalarSeries b ω) := by + filter_upwards [scalarSeries_hasSum_ae a ha, scalarSeries_hasSum_ae b hb, + scalarSeries_hasSum_ae (a+b) (ha.add hb)] with ω haω hbω habω + exact habω.unique (by simpa only [Pi.add_apply, add_mul] using haω.add hbω) + have hts : (∑' i, (a i + b i)^2) = + (∑' i, a i ^ 2) + 2 * (∑' i, a i * b i) + (∑' i, b i ^ 2) := by + calc + _ = ∑' i, (a i ^ 2 + 2 * (a i * b i) + b i ^ 2) := by + exact tsum_congr (fun i => by ring) + _ = _ := by + rw [((hsq a ha).add (hprod.mul_left 2)).tsum_add (hsq b hb), + (hsq a ha).tsum_add (hprod.mul_left 2), tsum_mul_left] + have hv := variance_fun_add (hLp a ha) (hLp b hb) + rw [← variance_congr heq, scalarSeries_variance (a+b) (ha.add hb), + scalarSeries_variance a ha, scalarSeries_variance b hb] at hv + change (∑' i, (a i+b i)^2) = _ at hv + rw [hts] at hv + linarith + +theorem sourceField_integral_zero (d : ℕ) {L : ℝ} (hL : L ≠ 0) (x : Fin d → ℝ) : + ∫ ω, sourceField d L ω x ∂sourceLaw d = 0 := by + have hc : Summable (fun m => modeCoefficient d L m x) := + (modeMajorant_summable d hL).of_norm_bounded (fun m => by + simpa only [Real.norm_eq_abs] using modeCoefficient_bound d hL m x) + exact scalarSeries_integral_zero (fun m => modeCoefficient d L m x) hc + +theorem sourceField_covariance (d : ℕ) {L : ℝ} (hL : L ≠ 0) (x y : Fin d → ℝ) : + cov[fun ω => sourceField d L ω x, fun ω => sourceField d L ω y; sourceLaw d] = + sourceSpectralKernel d L (x - y) := by + have hc (z : Fin d → ℝ) : Summable (fun m => modeCoefficient d L m z) := + (modeMajorant_summable d hL).of_norm_bounded (fun m => by + simpa only [Real.norm_eq_abs] using modeCoefficient_bound d hL m z) + change cov[scalarSeries (fun m => modeCoefficient d L m x), + scalarSeries (fun m => modeCoefficient d L m y); coefficientLaw (SourceMode d)] = _ + rw [scalarSeries_covariance _ _ (hc x) (hc y), coefficientKernel_eq_fullLattice d hL x y] + +theorem sourceField_variance_one (d : ℕ) {L : ℝ} (hL : L ≠ 0) (x : Fin d → ℝ) : + Var[fun ω => sourceField d L ω x; sourceLaw d] = 1 := by + rw [← covariance_self (sourceField_eval_measurable d L x).aemeasurable, + sourceField_covariance d hL x x, sub_self, spectralKernel_zero d hL] + +end I4SourceCovariance diff --git a/frontiers/compact_source_cutoff_controls_final_repair_20261011/SourceFourierSeries.lean b/frontiers/compact_source_cutoff_controls_final_repair_20261011/SourceFourierSeries.lean new file mode 100644 index 000000000..e4cdec9e6 --- /dev/null +++ b/frontiers/compact_source_cutoff_controls_final_repair_20261011/SourceFourierSeries.lean @@ -0,0 +1,147 @@ +import GaussianSeriesFoundation +import SpectralWeights +import Mathlib.Logic.Equiv.Option +import Mathlib.Topology.Algebra.InfiniteSum.TsumUniformlyOn + +/-! Actual canonical real Fourier series and a shared-event uniform convergence bridge. +The half-lattice partition, covariance, sample C4 and finite-jet law require separate proofs. -/ + +noncomputable section +open MeasureTheory ProbabilityTheory I4Foundation I4Weights +open scoped BigOperators ENNReal + +namespace I4Source + +/-- The representative whose first nonzero coordinate is positive. -/ +def halfLattice (d : ℕ) : Set (Fin d → ℤ) := + {k | ∃ i, 0 < k i ∧ ∀ j, j < i → k j = 0} + +abbrev SourceMode (d : ℕ) := Option (↥(halfLattice d) × Bool) + +/-- The actual common law, with independent variance-one real coefficients. -/ +abbrev sourceLaw (d : ℕ) : Measure (SourceMode d → ℝ) := + coefficientLaw (SourceMode d) + +def phase (d : ℕ) (L : ℝ) (k : Fin d → ℤ) (x : Fin d → ℝ) : ℝ := + ∑ i, sourceC L * (k i : ℝ) * x i + +/-- False is the cosine coefficient and true the independent sine coefficient. -/ +def modeCoefficient (d : ℕ) (L : ℝ) (m : SourceMode d) (x : Fin d → ℝ) : ℝ := + match m with + | none => Real.sqrt (1 / sourceZ d L) + | some (k, b) => Real.sqrt (2 * sourceWeight d L k / sourceZ d L) * + if b then Real.sin (phase d L k x) else Real.cos (phase d L k x) + +def modeMajorant (d : ℕ) (L : ℝ) (m : SourceMode d) : ℝ := + match m with + | none => Real.sqrt (1 / sourceZ d L) + | some (k, _) => pairedBound d L k + +/-- Literal normalized real Fourier sum on the common coefficient samples. -/ +def sourceField (d : ℕ) (L : ℝ) (ω : SourceMode d → ℝ) (x : Fin d → ℝ) : ℝ := + scalarSeries (fun m => modeCoefficient d L m x) ω + +theorem modeMajorant_nonneg (d : ℕ) (L : ℝ) (m : SourceMode d) : + 0 ≤ modeMajorant d L m := by + cases m with + | none => exact Real.sqrt_nonneg _ + | some p => + change 0 ≤ pairedBound d L p.1 + unfold pairedBound productBound coordinateBound decay + positivity + +theorem modeMajorant_summable (d : ℕ) {L : ℝ} (hL : L ≠ 0) : + Summable (modeMajorant d L) := by + classical + have hs := pairedBound_subtype_summable d hL (halfLattice d) + have hb : Summable (fun _ : Bool => (1 : ℝ)) := (hasSum_fintype _).summable + have hp : Summable (fun p : ↥(halfLattice d) × Bool => pairedBound d L p.1) := by + simpa only [mul_one] using hs.mul_of_nonneg hb + (fun k => modeMajorant_nonneg d L (some (k, false))) (fun _ => zero_le_one) + let e := Equiv.optionEquivSumPUnit.{0, 0} (↥(halfLattice d) × Bool) + apply e.symm.summable_iff.mp + apply Summable.sum (fun q => modeMajorant d L (e.symm q)) + · simpa [e, Function.comp_def, modeMajorant] using hp + · exact (hasSum_fintype _).summable + +theorem modeCoefficient_bound (d : ℕ) {L : ℝ} (hL : L ≠ 0) + (m : SourceMode d) (x : Fin d → ℝ) : + |modeCoefficient d L m x| ≤ modeMajorant d L m := by + cases m with + | none => + exact (abs_of_nonneg (Real.sqrt_nonneg _)).le + | some p => + rcases p with ⟨k, b⟩ + have hprod : 1 ≤ ∏ i, (1 + |sourceC L * (k.val i : ℝ)|) ^ 4 := by + apply Finset.one_le_prod₀ + intro i _ + apply one_le_pow₀ + linarith [abs_nonneg (sourceC L * (k.val i : ℝ))] + have hamp : Real.sqrt (2 * sourceWeight d L k / sourceZ d L) ≤ + pairedBound d L k := by + rw [pairedBound_eq_amplitude d hL k] + simpa only [mul_one] using mul_le_mul_of_nonneg_left hprod + (Real.sqrt_nonneg (2 * sourceWeight d L k / sourceZ d L)) + change |Real.sqrt (2 * sourceWeight d L k / sourceZ d L) * + (if b then Real.sin (phase d L k x) else Real.cos (phase d L k x))| ≤ _ + rw [abs_mul, abs_of_nonneg (Real.sqrt_nonneg _)] + have ht : |if b then Real.sin (phase d L k x) else Real.cos (phase d L k x)| ≤ 1 := by + cases b with + | false => exact Real.abs_cos_le_one _ + | true => exact Real.abs_sin_le_one _ + have hbase : Real.sqrt (2 * sourceWeight d L k / sourceZ d L) * + |if b then Real.sin (phase d L k x) else Real.cos (phase d L k x)| ≤ + Real.sqrt (2 * sourceWeight d L k / sourceZ d L) := by + simpa only [mul_one] using mul_le_mul_of_nonneg_left ht + (Real.sqrt_nonneg (2 * sourceWeight d L k / sourceZ d L)) + exact hbase.trans hamp + +theorem sourceField_eval_measurable (d : ℕ) (L : ℝ) (x : Fin d → ℝ) : + Measurable (fun ω => sourceField d L ω x) := by + exact scalarSeries_measurable _ + +theorem sourceMajorant_ae (d : ℕ) {L : ℝ} (hL : L ≠ 0) : + ∀ᵐ ω ∂sourceLaw d, Summable (fun m => modeMajorant d L m * |ω m|) := by + exact weighted_abs_summable_ae _ (modeMajorant_nonneg d L) (modeMajorant_summable d hL) + +theorem sourceAbs_uniform_ae (d : ℕ) {L : ℝ} (hL : L ≠ 0) : + ∀ᵐ ω ∂sourceLaw d, + HasSumUniformly (fun m x => |modeCoefficient d L m x * ω m|) + (fun x => ∑' m, |modeCoefficient d L m x * ω m|) := by + filter_upwards [sourceMajorant_ae d hL] with ω hω + apply hasSumUniformly_iff_tendstoUniformly.mpr + apply tendstoUniformly_tsum hω + intro m x + simp only [Real.norm_eq_abs, abs_abs, abs_mul] + exact mul_le_mul_of_nonneg_right (modeCoefficient_bound d hL m x) (abs_nonneg _) + +theorem sourceField_uniform_ae (d : ℕ) {L : ℝ} (hL : L ≠ 0) : + ∀ᵐ ω ∂sourceLaw d, + HasSumUniformly (fun m x => modeCoefficient d L m x * ω m) + (sourceField d L ω) := by + filter_upwards [sourceMajorant_ae d hL] with ω hω + apply hasSumUniformly_iff_tendstoUniformly.mpr + apply tendstoUniformly_tsum hω + intro m x + simp only [Real.norm_eq_abs, abs_mul] + exact mul_le_mul_of_nonneg_right (modeCoefficient_bound d hL m x) (abs_nonneg _) + +theorem sourceField_continuous_ae (d : ℕ) {L : ℝ} (hL : L ≠ 0) : + ∀ᵐ ω ∂sourceLaw d, Continuous (sourceField d L ω) := by + filter_upwards [sourceMajorant_ae d hL] with ω hω + change Continuous (fun x => ∑' m, modeCoefficient d L m x * ω m) + have hcont (m : SourceMode d) : + Continuous (fun x : Fin d → ℝ => modeCoefficient d L m x * ω m) := by + cases m with + | none => + change Continuous (fun _ : Fin d → ℝ => Real.sqrt (1 / sourceZ d L) * ω none) + exact continuous_const + | some p => + rcases p with ⟨k, b⟩ + cases b <;> simp [modeCoefficient, phase] <;> fun_prop + apply continuous_tsum hcont hω + intro m x + simp only [Real.norm_eq_abs, abs_mul] + exact mul_le_mul_of_nonneg_right (modeCoefficient_bound d hL m x) (abs_nonneg _) + +end I4Source diff --git a/frontiers/compact_source_cutoff_controls_final_repair_20261011/SourceGaussianLaw.lean b/frontiers/compact_source_cutoff_controls_final_repair_20261011/SourceGaussianLaw.lean new file mode 100644 index 000000000..bb8450b5a --- /dev/null +++ b/frontiers/compact_source_cutoff_controls_final_repair_20261011/SourceGaussianLaw.lean @@ -0,0 +1,189 @@ +import SourceFourierSeries +import Mathlib.MeasureTheory.Integral.DominatedConvergence +import Mathlib.Probability.Independence.CharacteristicFunction +import Mathlib.Probability.Distributions.Gaussian.HasGaussianLaw.Independence +import Mathlib.Analysis.Normed.Ring.InfiniteSum +import Mathlib.Probability.Distributions.Gaussian.IsGaussianProcess.Def + +/-! Actual Gaussian laws of summable coefficient series and finite evaluation combinations. +No covariance/source-kernel, torus, derivative-jet, or pinned-law conclusion is assumed. -/ + +noncomputable section +open I4Foundation I4Weights I4Source MeasureTheory ProbabilityTheory +open scoped BigOperators ENNReal NNReal Topology + +namespace I4SourceGaussian + +variable {ι : Type*} + +private theorem summable_square (a : ι → ℝ) (ha : Summable a) : + Summable (fun i => a i ^ 2) := by + have h := summable_mul_of_summable_norm ha.norm ha.norm + simpa only [Function.comp_def, pow_two] using h.comp_injective + (show Function.Injective (fun i : ι => (i, i)) from + fun i j hij => congrArg Prod.fst hij) + +variable [Countable ι] + +omit [Countable ι] in +private theorem partial_charFun (a : ι → ℝ) (s : Finset ι) (t : ℝ) : + charFun ((coefficientLaw ι).map (fun ω => ∑ i ∈ s, a i * ω i)) t = + Complex.exp (-((∑ i ∈ s, a i ^ 2 : ℝ) : ℂ) * (t : ℂ) ^ 2 / 2) := by + classical + have hi : iIndepFun (fun i (ω : ι → ℝ) => a i * ω i) (coefficientLaw ι) := + (coordinates_independent ι).comp (fun i y => a i * y) (fun _ => by fun_prop) + have hm (i : ι) : Measurable (fun ω : ι → ℝ => a i * ω i) := + measurable_const.mul (measurable_pi_apply i) + have hchar (i : ι) : charFun ((coefficientLaw ι).map + (fun ω : ι → ℝ => a i * ω i)) t = + Complex.exp (-((a i : ℂ) * (t : ℂ)) ^ 2 / 2) := by + rw [charFun_map_mul_comp (f := fun ω : ι → ℝ => ω i) + (measurable_pi_apply i).aemeasurable, coordinate_marginal, charFun_gaussianReal] + simp only [Complex.ofReal_mul, mul_zero, Complex.ofReal_zero, zero_mul, + NNReal.coe_one, Complex.ofReal_one, one_mul, zero_sub] + congr 1 + ring + rw [(hi.restrict s).charFun_map_fun_finsetSum_eq_prod (fun i _ => (hm i).aemeasurable)] + simp only [Finset.prod_apply] + simp_rw [hchar] + rw [← Complex.exp_sum] + congr 1 + push_cast + simp only [mul_pow] + rw [← Finset.sum_div, Finset.sum_neg_distrib, ← Finset.sum_mul] + rw [neg_mul] + +private theorem charFun_partial_tendsto (a : ι → ℝ) (ha : Summable a) (t : ℝ) : + Filter.Tendsto + (fun s : Finset ι => charFun ((coefficientLaw ι).map + (fun ω => ∑ i ∈ s, a i * ω i)) t) + Filter.atTop (𝓝 (charFun ((coefficientLaw ι).map (scalarSeries a)) t)) := by + classical + have hm (s : Finset ι) : Measurable (fun ω : ι → ℝ => ∑ i ∈ s, a i * ω i) := + Finset.measurable_sum s (fun i _ => measurable_const.mul (measurable_pi_apply i)) + have heq (s : Finset ι) : + charFun ((coefficientLaw ι).map (fun ω => ∑ i ∈ s, a i * ω i)) t = + ∫ ω, Complex.exp (((t * ∑ i ∈ s, a i * ω i : ℝ) : ℂ) * Complex.I) + ∂coefficientLaw ι := by + rw [charFun_apply_real, integral_map (hm s).aemeasurable (by fun_prop)] + push_cast + rfl + have heq' : charFun ((coefficientLaw ι).map (scalarSeries a)) t = + ∫ ω, Complex.exp (((t * scalarSeries a ω : ℝ) : ℂ) * Complex.I) + ∂coefficientLaw ι := by + rw [charFun_apply_real, integral_map (scalarSeries_measurable a).aemeasurable + (by fun_prop)] + push_cast + rfl + simp_rw [heq, heq'] + apply tendsto_integral_filter_of_norm_le_const + · filter_upwards with s + have hc : Continuous (fun q : ℝ => Complex.exp (((t * q : ℝ) : ℂ) * Complex.I)) := + by fun_prop + exact (hc.measurable.comp (hm s)).aestronglyMeasurable + · refine ⟨1, Filter.Eventually.of_forall (fun s => ?_)⟩ + filter_upwards with ω + rw [Complex.norm_exp_ofReal_mul_I] + · filter_upwards [scalarSeries_hasSum_ae a ha] with ω hω + exact ((by fun_prop : Continuous (fun q : ℝ => + Complex.exp (((t * q : ℝ) : ℂ) * Complex.I))).tendsto _).comp hω + +theorem scalarSeries_map_gaussian (a : ι → ℝ) (ha : Summable a) : + (coefficientLaw ι).map (scalarSeries a) = + gaussianReal 0 (∑' i, a i ^ 2).toNNReal := by + apply Measure.ext_of_charFun + funext t + have h1 := charFun_partial_tendsto a ha t + have h2 : Filter.Tendsto (fun s : Finset ι => + charFun ((coefficientLaw ι).map (fun ω => ∑ i ∈ s, a i * ω i)) t) + Filter.atTop (𝓝 (Complex.exp (-((∑' i, a i ^ 2 : ℝ) : ℂ) * (t : ℂ)^2 / 2))) := by + simp_rw [partial_charFun] + exact ((by fun_prop : Continuous (fun q : ℝ => + Complex.exp (-(q : ℂ) * (t : ℂ)^2 / 2))).tendsto _).comp + (summable_square a ha).hasSum + rw [tendsto_nhds_unique h1 h2, charFun_gaussianReal] + rw [Real.coe_toNNReal _ (tsum_nonneg (fun i => sq_nonneg (a i)))] + congr 1 + push_cast + ring + +theorem scalarSeries_integral_zero (a : ι → ℝ) (ha : Summable a) : + ∫ ω, scalarSeries a ω ∂coefficientLaw ι = 0 := by + have h := integral_id_gaussianReal (μ := 0) (v := (∑' i, a i ^ 2).toNNReal) + rw [← scalarSeries_map_gaussian a ha, + integral_map (scalarSeries_measurable a).aemeasurable (by fun_prop)] at h + exact h + +theorem scalarSeries_variance (a : ι → ℝ) (ha : Summable a) : + Var[scalarSeries a; coefficientLaw ι] = ∑' i, a i ^ 2 := by + rw [← variance_id_map (scalarSeries_measurable a).aemeasurable, + scalarSeries_map_gaussian a ha, variance_id_gaussianReal] + exact Real.coe_toNNReal _ (tsum_nonneg (fun i => sq_nonneg (a i))) + +theorem source_linearCombination_hasGaussianLaw (d : ℕ) {L : ℝ} (hL : L ≠ 0) + (n : ℕ) (x : Fin n → (Fin d → ℝ)) (c : Fin n → ℝ) : + HasGaussianLaw (fun ω => ∑ j, c j * sourceField d L ω (x j)) (sourceLaw d) := by + classical + have hc (j : Fin n) : Summable (fun m => modeCoefficient d L m (x j)) := + (modeMajorant_summable d hL).of_norm_bounded (fun m => by + simpa only [Real.norm_eq_abs] using modeCoefficient_bound d hL m (x j)) + let a : SourceMode d → ℝ := fun m => ∑ j, c j * modeCoefficient d L m (x j) + have ha : Summable a := by + exact summable_sum (fun j _ => (hc j).mul_left (c j)) + have hG : HasGaussianLaw (scalarSeries a) (sourceLaw d) := by + constructor + · exact (scalarSeries_measurable a).aemeasurable + · change IsGaussian ((coefficientLaw (SourceMode d)).map (scalarSeries a)) + rw [scalarSeries_map_gaussian a ha] + infer_instance + apply hG.congr + filter_upwards [ae_all_iff.2 (fun j : Fin n => + scalarSeries_hasSum_ae (fun m => modeCoefficient d L m (x j)) (hc j)), + scalarSeries_hasSum_ae a ha] with ω hω hsum + have h : HasSum (fun m => ∑ j, c j * modeCoefficient d L m (x j) * ω m) + (∑ j, c j * sourceField d L ω (x j)) := by + simpa only [sourceField, mul_assoc] using hasSum_sum (fun j _ => (hω j).mul_left (c j)) + exact hsum.unique (by simpa only [a, Finset.sum_mul] using h) + +theorem source_finiteVector_hasGaussianLaw (d : ℕ) {L : ℝ} (hL : L ≠ 0) + (n : ℕ) (x : Fin n → (Fin d → ℝ)) : + HasGaussianLaw (fun ω j => sourceField d L ω (x j)) (sourceLaw d) := by + classical + have hm : Measurable (fun ω j => sourceField d L ω (x j)) := + Measurable.of_eval (fun j => sourceField_eval_measurable d L (x j)) + refine ⟨hm.aemeasurable, ?_⟩ + apply isGaussian_of_map_eq_gaussianReal + intro ell + let c : Fin n → ℝ := fun j => ell (Pi.single j 1) + have hrep (v : Fin n → ℝ) : ell v = ∑ j, c j * v j := by + rw [← LinearMap.sum_single_apply (fun _ : Fin n => ℝ) v, map_sum] + apply Finset.sum_congr rfl + intro j _ + have hs : Pi.single j (v j) = v j • Pi.single j (1 : ℝ) := by + rw [← Pi.single_smul, smul_eq_mul, mul_one] + rw [hs, map_smul] + simp [c, smul_eq_mul, mul_comm] + have hg : HasGaussianLaw (fun ω => ell (fun j => sourceField d L ω (x j))) + (sourceLaw d) := + (source_linearCombination_hasGaussianLaw d hL n x c).congr + (Filter.Eventually.of_forall (fun ω => (hrep _).symm)) + refine ⟨(sourceLaw d)[fun ω => ell (fun j => sourceField d L ω (x j))], + Var[fun ω => ell (fun j => sourceField d L ω (x j)); sourceLaw d].toNNReal, ?_⟩ + rw [Measure.map_map ell.continuous.measurable hm] + exact hg.map_eq_gaussianReal + +theorem sourceField_isGaussianProcess (d : ℕ) {L : ℝ} (hL : L ≠ 0) : + IsGaussianProcess (fun x ω => sourceField d L ω x) (sourceLaw d) := by + classical + constructor + intro I + let e : ↥I ≃ Fin (Fintype.card ↥I) := Fintype.equivFin ↥I + let x : Fin (Fintype.card ↥I) → (Fin d → ℝ) := fun j => (e.symm j).1 + let R : (Fin (Fintype.card ↥I) → ℝ) →L[ℝ] (↥I → ℝ) := + ContinuousLinearMap.pi (fun i => ContinuousLinearMap.proj (e i)) + apply ((source_finiteVector_hasGaussianLaw d hL _ x).map_fun R).congr + filter_upwards with ω + funext i + simp [R, x] + +end I4SourceGaussian diff --git a/frontiers/compact_source_cutoff_controls_final_repair_20261011/SourceKernel.lean b/frontiers/compact_source_cutoff_controls_final_repair_20261011/SourceKernel.lean new file mode 100644 index 000000000..5d5602ac7 --- /dev/null +++ b/frontiers/compact_source_cutoff_controls_final_repair_20261011/SourceKernel.lean @@ -0,0 +1,112 @@ +import SourceLattice +import Mathlib.Analysis.Normed.Ring.InfiniteSum + +noncomputable section +open I4Foundation I4Weights I4Source I4Lattice MeasureTheory +open scoped BigOperators +namespace I4Kernel + +def frequencyEquiv (d : ℕ) : SourceMode d ≃ (Fin d → ℤ) := + Equiv.ofBijective (latticeFrequency d) (latticeFrequency_bijective d) + +/-- The prescribed normalized full-lattice real Fourier kernel; image/Poisson linkage is separate. -/ +def sourceSpectralKernel (d : ℕ) (L : ℝ) (z : Fin d → ℝ) : ℝ := + ∑' k : Fin d → ℤ, sourceWeight d L k / sourceZ d L * Real.cos (phase d L k z) + +private theorem tsum_mode (d : ℕ) (f : SourceMode d → ℝ) (hf : Summable f) : + (∑' m, f m) = f none + ∑' k : ↥(halfLattice d), + (f (some (k,false)) + f (some (k,true))) := by + classical + let e := Equiv.optionEquivSumPUnit.{0,0} (↥(halfLattice d) × Bool) + have hp : Summable (fun p : ↥(halfLattice d) × Bool => f (some p)) := + hf.comp_injective (Option.some_injective (↥(halfLattice d) × Bool)) + calc + (∑' m, f m) = ∑' q, f (e.symm q) := (e.symm.tsum_eq f).symm + _ = (∑' p : ↥(halfLattice d) × Bool, f (some p)) + f none := by + rw [Summable.tsum_sum (by simpa [e, Function.comp_def] using hp) + (hasSum_fintype _).summable] + simp [e] + _ = _ := by + rw [hp.tsum_prod] + simp_rw [tsum_bool] + ring + +theorem modeProduct_summable (d : ℕ) {L : ℝ} (hL : L ≠ 0) (x y : Fin d → ℝ) : + Summable (fun m => modeCoefficient d L m x * modeCoefficient d L m y) := by + have hc (z : Fin d → ℝ) : Summable (fun m => modeCoefficient d L m z) := by + apply Summable.of_norm_bounded (modeMajorant_summable d hL) + intro m + simpa only [Real.norm_eq_abs] using modeCoefficient_bound d hL m z + have hp : Summable (fun p : SourceMode d × SourceMode d => + modeCoefficient d L p.1 x * modeCoefficient d L p.2 y) := + summable_mul_of_summable_norm (hc x).norm (hc y).norm + simpa only [Function.comp_def] using hp.comp_injective + (show Function.Injective (fun m : SourceMode d => (m,m)) from + fun a b h => congrArg Prod.fst h) + +theorem spectralKernel_summable (d : ℕ) {L : ℝ} (hL : L ≠ 0) (z : Fin d → ℝ) : + Summable (fun k : Fin d → ℤ => + sourceWeight d L k / sourceZ d L * Real.cos (phase d L k z)) := by + have hz := sourceZ_pos d hL + apply Summable.of_norm_bounded ((sourceWeight_summable d hL).div_const (sourceZ d L)) + intro k + have hq : 0 ≤ sourceWeight d L k / sourceZ d L := by + rw [sourceWeight_eq_physical] + exact div_nonneg (Real.exp_pos _).le hz.le + rw [norm_mul, Real.norm_eq_abs, abs_of_nonneg hq, Real.norm_eq_abs] + simpa only [mul_one] using mul_le_mul_of_nonneg_left (Real.abs_cos_le_one _) hq + +theorem coefficientKernel_eq_fullLattice (d : ℕ) {L : ℝ} (hL : L ≠ 0) (x y : Fin d → ℝ) : + (∑' m, modeCoefficient d L m x * modeCoefficient d L m y) = + sourceSpectralKernel d L (x - y) := by + classical + let g : (Fin d → ℤ) → ℝ := fun k => + sourceWeight d L k / sourceZ d L * Real.cos (phase d L k (x - y)) + have hg : Summable g := spectralKernel_summable d hL (x - y) + have hneg (k : Fin d → ℤ) : g (-k) = g k := by + have hp : phase d L (-k) (x - y) = -phase d L k (x - y) := by + simp [phase, Finset.sum_neg_distrib] + simp only [g, sourceWeight_neg, hp, Real.cos_neg] + have hzero : g 0 = 1 / sourceZ d L := by + simp [g, sourceWeight_eq_physical, phase] + have hc0 : modeCoefficient d L none x * modeCoefficient d L none y = 1 / sourceZ d L := by + simp only [modeCoefficient] + exact Real.mul_self_sqrt (one_div_nonneg.mpr (sourceZ_pos d hL).le) + have hpair (k : ↥(halfLattice d)) : + modeCoefficient d L (some (k,false)) x * modeCoefficient d L (some (k,false)) y + + modeCoefficient d L (some (k,true)) x * modeCoefficient d L (some (k,true)) y = 2 * g k := by + have h := pairedCoefficient_kernel d hL k x y + rw [Fintype.sum_bool] at h + calc + _ = modeCoefficient d L (some (k,true)) x * modeCoefficient d L (some (k,true)) y + + modeCoefficient d L (some (k,false)) x * modeCoefficient d L (some (k,false)) y := add_comm _ _ + _ = _ := h + _ = 2 * g k := by dsimp [g]; ring + have hleft : (∑' m, modeCoefficient d L m x * modeCoefficient d L m y) = + 1 / sourceZ d L + ∑' k : ↥(halfLattice d), 2 * g k := by + rw [tsum_mode d _ (modeProduct_summable d hL x y), hc0] + congr 1 + exact tsum_congr hpair + have hm : Summable (fun m => g (frequencyEquiv d m)) := (frequencyEquiv d).summable_iff.mpr hg + have hright : sourceSpectralKernel d L (x - y) = + 1 / sourceZ d L + ∑' k : ↥(halfLattice d), 2 * g k := by + change (∑' k, g k) = _ + rw [← (frequencyEquiv d).tsum_eq g, tsum_mode d _ hm] + change g 0 + (∑' k : ↥(halfLattice d), (g k.1 + g (-k.1))) = _ + rw [hzero] + congr 1 + apply tsum_congr + intro k + rw [hneg] + ring + exact hleft.trans hright.symm + +theorem spectralKernel_zero (d : ℕ) {L : ℝ} (hL : L ≠ 0) : + sourceSpectralKernel d L 0 = 1 := by + unfold sourceSpectralKernel + simp only [phase, Pi.zero_apply, mul_zero, Finset.sum_const_zero, Real.cos_zero, mul_one] + rw [tsum_div_const] + change sourceZ d L / sourceZ d L = 1 + exact div_self (sourceZ_pos d hL).ne' + +end I4Kernel diff --git a/frontiers/compact_source_cutoff_controls_final_repair_20261011/SourceLattice.lean b/frontiers/compact_source_cutoff_controls_final_repair_20261011/SourceLattice.lean new file mode 100644 index 000000000..9c1e0557c --- /dev/null +++ b/frontiers/compact_source_cutoff_controls_final_repair_20261011/SourceLattice.lean @@ -0,0 +1,159 @@ +import SourceFourierSeries +import Mathlib.Data.Finset.Max + +noncomputable section +open I4Foundation I4Weights I4Source MeasureTheory +open scoped BigOperators +namespace I4Lattice + +def latticeFrequency (d : ℕ) (m : SourceMode d) : Fin d → ℤ := + match m with + | none => 0 + | some (k, b) => if b then -k.1 else k.1 + +theorem halfLattice_ne_zero (d : ℕ) {k : Fin d → ℤ} (hk : k ∈ halfLattice d) : + k ≠ 0 := by + rcases hk with ⟨i, hi, _⟩ + intro h + have : k i = 0 := congrFun h i + omega + +theorem halfLattice_partition (d : ℕ) {k : Fin d → ℤ} (hk : k ≠ 0) : + (k ∈ halfLattice d ∨ -k ∈ halfLattice d) ∧ + ¬ (k ∈ halfLattice d ∧ -k ∈ halfLattice d) := by + classical + have hex : ∃ i, k i ≠ 0 := by + by_contra h + push Not at h + exact hk (funext h) + let s : Finset (Fin d) := Finset.univ.filter (fun i => k i ≠ 0) + have hs : s.Nonempty := by + obtain ⟨i, hi⟩ := hex + exact ⟨i, Finset.mem_filter.mpr ⟨Finset.mem_univ i, hi⟩⟩ + let i := s.min' hs + have hi : k i ≠ 0 := (Finset.mem_filter.mp (Finset.min'_mem s hs)).2 + have hbefore (j : Fin d) (hj : j < i) : k j = 0 := by + by_contra hn + have hle := Finset.min'_le s j (Finset.mem_filter.mpr ⟨Finset.mem_univ j, hn⟩) + exact (not_le_of_gt hj) hle + constructor + · rcases lt_or_gt_of_ne hi with hneg | hpos + · right + refine ⟨i, ?_, ?_⟩ + · change 0 < -k i + omega + · intro j hj + change -k j = 0 + rw [hbefore j hj, neg_zero] + · exact Or.inl ⟨i, hpos, hbefore⟩ + · rintro ⟨⟨i, hi, hib⟩, ⟨j, hj, hjb⟩⟩ + change 0 < -k j at hj + rcases lt_trichotomy i j with hij | heq | hji + · have h0 := hjb i hij + change -k i = 0 at h0 + omega + · subst j + omega + · have h0 := hib j hji + omega + +theorem sourceWeight_neg (d : ℕ) (L : ℝ) (k : Fin d → ℤ) : + sourceWeight d L (-k) = sourceWeight d L k := by + rw [sourceWeight_eq_physical, sourceWeight_eq_physical] + simp only [Pi.neg_apply, Int.cast_neg, mul_neg, neg_sq] + +theorem phase_lattice_shift (d : ℕ) {L : ℝ} (hL : L ≠ 0) + (k n : Fin d → ℤ) (x : Fin d → ℝ) : + phase d L k (fun i => x i + L * (n i : ℝ)) = + phase d L k x + ((∑ i, k i * n i : ℤ) : ℝ) * (2 * Real.pi) := by + have he (i : Fin d) : sourceC L * (k i : ℝ) * (x i + L * (n i : ℝ)) = + sourceC L * (k i : ℝ) * x i + ((k i * n i : ℤ) : ℝ) * (2 * Real.pi) := by + simp only [Int.cast_mul] + unfold sourceC + field_simp + unfold phase + simp_rw [he] + rw [Finset.sum_add_distrib, ← Finset.sum_mul] + simp only [Int.cast_sum] + +theorem modeCoefficient_lattice_shift (d : ℕ) {L : ℝ} (hL : L ≠ 0) + (m : SourceMode d) (n : Fin d → ℤ) (x : Fin d → ℝ) : + modeCoefficient d L m (fun i => x i + L * (n i : ℝ)) = + modeCoefficient d L m x := by + cases m with + | none => rfl + | some p => + rcases p with ⟨k,b⟩ + cases b <;> simp only [modeCoefficient, Bool.false_eq_true, ite_false, ite_true] + · rw [phase_lattice_shift d hL, Real.cos_add_int_mul_two_pi] + · rw [phase_lattice_shift d hL, Real.sin_add_int_mul_two_pi] + +theorem sourceField_lattice_shift (d : ℕ) {L : ℝ} (hL : L ≠ 0) + (ω : SourceMode d → ℝ) (n : Fin d → ℤ) (x : Fin d → ℝ) : + sourceField d L ω (fun i => x i + L * (n i : ℝ)) = sourceField d L ω x := by + unfold sourceField scalarSeries + apply tsum_congr + intro m + change modeCoefficient d L m (fun i => x i + L * (n i : ℝ)) * ω m = + modeCoefficient d L m x * ω m + rw [modeCoefficient_lattice_shift d hL] + +theorem pairedCoefficient_kernel (d : ℕ) {L : ℝ} (hL : L ≠ 0) + (k : ↥(halfLattice d)) (x y : Fin d → ℝ) : + (∑ b : Bool, modeCoefficient d L (some (k,b)) x * + modeCoefficient d L (some (k,b)) y) = + (2 * sourceWeight d L k / sourceZ d L) * Real.cos (phase d L k (x - y)) := by + have hphase : phase d L k (x - y) = phase d L k x - phase d L k y := by + simp [phase, mul_sub, Finset.sum_sub_distrib] + have hz : 0 ≤ 2 * sourceWeight d L k / sourceZ d L := by + rw [sourceWeight_eq_physical] + exact div_nonneg (mul_nonneg (by norm_num) (Real.exp_pos _).le) (sourceZ_pos d hL).le + rw [Fintype.sum_bool] + simp only [modeCoefficient, ite_true, Bool.false_eq_true, ite_false] + rw [hphase, Real.cos_sub] + calc + _ = (Real.sqrt (2 * sourceWeight d L k / sourceZ d L) * + Real.sqrt (2 * sourceWeight d L k / sourceZ d L)) * + (Real.cos (phase d L k x) * Real.cos (phase d L k y) + + Real.sin (phase d L k x) * Real.sin (phase d L k y)) := by ring + _ = _ := by rw [Real.mul_self_sqrt hz] + +theorem latticeFrequency_bijective (d : ℕ) : Function.Bijective (latticeFrequency d) := by + classical + constructor + · intro m n he + cases m with + | none => + cases n with + | none => rfl + | some p => + rcases p with ⟨k,b⟩ + have hk := halfLattice_ne_zero d k.property + cases b <;> simp [latticeFrequency] at he <;> exact (hk (by first | exact he | exact he.symm)).elim + | some p => + rcases p with ⟨k,b⟩ + cases n with + | none => + have hk := halfLattice_ne_zero d k.property + cases b <;> simp [latticeFrequency] at he <;> exact (hk he).elim + | some q => + rcases q with ⟨l,c⟩ + cases b <;> cases c <;> simp only [latticeFrequency, Bool.false_eq_true, ite_false, ite_true] at he + · have hkl : k = l := Subtype.ext he + subst l + rfl + · have hn : -k.1 ∈ halfLattice d := by simpa only [he, neg_neg] using l.property + exact ((halfLattice_partition d (halfLattice_ne_zero d k.property)).2 ⟨k.property,hn⟩).elim + · have hn : -k.1 ∈ halfLattice d := he.symm ▸ l.property + exact ((halfLattice_partition d (halfLattice_ne_zero d k.property)).2 ⟨k.property,hn⟩).elim + · have hkl : k = l := Subtype.ext (neg_inj.mp he) + subst l + rfl + · intro k + by_cases hk : k = 0 + · exact ⟨none, by simpa [latticeFrequency] using hk.symm⟩ + · rcases (halfLattice_partition d hk).1 with hp | hn + · exact ⟨some (⟨k,hp⟩,false), by simp [latticeFrequency]⟩ + · exact ⟨some (⟨-k,hn⟩,true), by simp [latticeFrequency]⟩ + +end I4Lattice diff --git a/frontiers/compact_source_cutoff_controls_final_repair_20261011/SourceNormalForm.lean b/frontiers/compact_source_cutoff_controls_final_repair_20261011/SourceNormalForm.lean new file mode 100644 index 000000000..568665200 --- /dev/null +++ b/frontiers/compact_source_cutoff_controls_final_repair_20261011/SourceNormalForm.lean @@ -0,0 +1,209 @@ +import SourceCoordinates +import ConeFootprint +import SourceTorusC4 +import Mathlib.Geometry.Manifold.ContMDiff.Atlas +import Mathlib.Topology.OpenPartialHomeomorph.Composition + +noncomputable section +set_option backward.isDefEq.respectTransparency false +open Filter Set Matrix SourceCoordinates MorseCongruence ChartedSpace IsManifold +open scoped Topology ContDiff Manifold Matrix.Norms.Frobenius +namespace SourceNormalForm +attribute [local instance] I4TorusC4.actualChartedSpace + +def split {n k : ℕ} (hk : k ≤ n) : E n ≃L[ℝ] E k × E (n-k) := + (LinearIsometryEquiv.piLpCongrLeft 2 ℝ ℝ + (finCongr (Nat.add_sub_of_le hk).symm)).toContinuousLinearEquiv.trans + EuclideanSpace.finAddEquivProd + +theorem split_fst {n k : ℕ} (hk : k ≤ n) (u : E n) (i : Fin k) : + (split hk u).1 i = u (Fin.cast (Nat.add_sub_of_le hk) (Fin.castAdd (n-k) i)) := rfl + +theorem split_snd {n k : ℕ} (hk : k ≤ n) (u : E n) (i : Fin (n-k)) : + (split hk u).2 i = u (Fin.cast (Nat.add_sub_of_le hk) (Fin.natAdd k i)) := rfl + +theorem split_energy {n k : ℕ} (hk : k ≤ n) (u : E n) : + ‖u‖^2 = ‖(split hk u).1‖^2 + ‖(split hk u).2‖^2 := by + rw [EuclideanSpace.real_norm_sq_eq, EuclideanSpace.real_norm_sq_eq, + EuclideanSpace.real_norm_sq_eq] + rw [← Fin.sum_congr' (fun i : Fin n => u i ^ 2) (Nat.add_sub_of_le hk)] + exact Fin.sum_univ_add _ + +theorem split_quadratic {n k : ℕ} (hk : k ≤ n) (u : E n) : + quadratic (PhysicalSpectral.signMatrix n k) u = MorseCone.quadratic (split hk u) := by + rw [quadratic_eq_dot] + simp only [PhysicalSpectral.signMatrix, dotProduct, Matrix.mulVec_diagonal] + rw [← Fin.sum_congr' (fun i : Fin n => u i * ((if i.val < k then (1 : ℝ) else -1) * u i)) + (Nat.add_sub_of_le hk), Fin.sum_univ_add] + simp only [MorseCone.quadratic, EuclideanSpace.real_norm_sq_eq, sub_eq_add_neg, + ← Finset.sum_neg_distrib] + congr 1 + · apply Finset.sum_congr rfl + intro i _ + simp [split_fst, pow_two, i.isLt] + · apply Finset.sum_congr rfl + intro i _ + have hn : ¬ k + i.val < k := by omega + simp [split_snd, pow_two, hn] + +def physicalChart {n k : ℕ} (hk : k ≤ n) (x0 : X n) + (P : E n ≃L[ℝ] X n) (e : OpenPartialHomeomorph (E n) (E n)) := + (((Homeomorph.subRight x0).toOpenPartialHomeomorph.trans + P.symm.toHomeomorph.toOpenPartialHomeomorph).trans e).trans + (split hk).toHomeomorph.toOpenPartialHomeomorph + +theorem physicalChart_apply {n k : ℕ} (hk : k ≤ n) (x0 : X n) + (P : E n ≃L[ℝ] X n) (e : OpenPartialHomeomorph (E n) (E n)) (x : X n) : + physicalChart hk x0 P e x = split hk (e (P.symm (x-x0))) := rfl + +theorem physicalChart_symm {n k : ℕ} (hk : k ≤ n) (x0 : X n) + (P : E n ≃L[ℝ] X n) (e : OpenPartialHomeomorph (E n) (E n)) (z : E k × E (n-k)) : + (physicalChart hk x0 P e).symm z = x0 + P (e.symm ((split hk).symm z)) := by + change P (e.symm ((split hk).symm z)) + x0 = _ + exact add_comm _ _ + +theorem physicalChart_source {n k : ℕ} (hk : k ≤ n) (x0 : X n) + (P : E n ≃L[ℝ] X n) (e : OpenPartialHomeomorph (E n) (E n)) (x : X n) : + x ∈ (physicalChart hk x0 P e).source ↔ P.symm (x-x0) ∈ e.source := by + simp [physicalChart] + +theorem physicalChart_target {n k : ℕ} (hk : k ≤ n) (x0 : X n) + (P : E n ≃L[ℝ] X n) (e : OpenPartialHomeomorph (E n) (E n)) (z : E k × E (n-k)) : + z ∈ (physicalChart hk x0 P e).target ↔ (split hk).symm z ∈ e.target := by + simp [physicalChart] + +theorem physicalChart_C2 {n k : ℕ} (hk : k ≤ n) (x0 : X n) + (P : E n ≃L[ℝ] X n) (e : OpenPartialHomeomorph (E n) (E n)) + (he : ContDiffOn ℝ 2 e e.source) (hi : ContDiffOn ℝ 2 e.symm e.target) : + ContDiffOn ℝ 2 (physicalChart hk x0 P e) (physicalChart hk x0 P e).source ∧ + ContDiffOn ℝ 2 (physicalChart hk x0 P e).symm (physicalChart hk x0 P e).target := by + constructor + · change ContDiffOn ℝ 2 (fun x => split hk (e (P.symm (x-x0)))) _ + apply (split hk).contDiff.comp_contDiffOn + apply he.comp (P.symm.contDiff.comp (contDiff_id.sub contDiff_const)).contDiffOn + intro x hx + exact (physicalChart_source hk x0 P e x).mp hx + · have h := hi.comp (split hk).symm.contDiff.contDiffOn + (fun z hz => (physicalChart_target hk x0 P e z).mp hz) + have h' : ContDiffOn ℝ 2 (fun z => x0 + P (e.symm ((split hk).symm z))) + (physicalChart hk x0 P e).target := contDiffOn_const.add (P.contDiff.comp_contDiffOn h) + have heq : ((physicalChart hk x0 P e).symm : (E k × E (n-k)) → X n) = + (fun z => x0 + P (e.symm ((split hk).symm z))) := funext (physicalChart_symm hk x0 P e) + rw [heq] + exact h' + +def liftChart {n : ℕ} {L : ℝ} [Fact (0 < L)] (x0 : X n) := + I4TorusC4.quotientChart n L (fun i => x0 i - L/2) + +theorem liftChart_center {n : ℕ} {L : ℝ} [Fact (0 < L)] (x0 : X n) : + x0 ∈ (liftChart (L := L) x0).target ∧ + I4Torus.torusProjection n L x0 ∈ (liftChart (L := L) x0).source ∧ + liftChart (L := L) x0 (I4Torus.torusProjection n L x0) = x0 := by + have ht : x0 ∈ (liftChart (L := L) x0).target := by + change x0 ∈ Set.pi Set.univ (fun i => Set.Ioo (x0 i - L/2) (x0 i - L/2 + L)) + intro i _ + have hL : 0 < L := Fact.out + constructor <;> linarith + exact ⟨ht, (liftChart (L := L) x0).map_target ht, (liftChart (L := L) x0).right_inv ht⟩ + +theorem liftChart_C2 {n : ℕ} {L : ℝ} [Fact (0 < L)] (x0 : X n) : + ContMDiffOn 𝓘(ℝ, X n) 𝓘(ℝ, X n) 2 (liftChart (L := L) x0) (liftChart (L := L) x0).source ∧ + ContMDiffOn 𝓘(ℝ, X n) 𝓘(ℝ, X n) 2 (liftChart (L := L) x0).symm (liftChart (L := L) x0).target := by + let := I4TorusC4.torus_isManifold n L + have ha : liftChart (L := L) x0 ∈ maximalAtlas 𝓘(ℝ, X n) 2 (I4Torus.SourceTorus n L) := by + apply IsManifold.subset_maximalAtlas + exact ⟨(fun i => x0 i - L/2), rfl⟩ + exact ⟨contMDiffOn_of_mem_maximalAtlas ha, contMDiffOn_symm_of_mem_maximalAtlas ha⟩ + +theorem radiusBall_subset_ball {k m : ℕ} {ρ : ℝ} (hρ : 0 < ρ) : + MorseCone.radiusBall (E := E k) (F := E m) ρ ⊆ Metric.ball 0 ρ := by + intro z hz + change ‖z.1‖^2 + ‖z.2‖^2 < ρ^2 at hz + rw [Metric.mem_ball, dist_zero_right, Prod.norm_def, max_lt_iff] + constructor + · apply (sq_lt_sq₀ (norm_nonneg _) hρ.le).mp + nlinarith [sq_nonneg ‖z.2‖] + · apply (sq_lt_sq₀ (norm_nonneg _) hρ.le).mp + nlinarith [sq_nonneg ‖z.1‖] + +theorem actual_source_normal_form {n : ℕ} {L : ℝ} [Fact (0 < L)] + (omega : I4Source.SourceMode n → ℝ) + (hmajor : Summable (fun m => I4Source.modeMajorant n L m * |omega m|)) + (x0 : X n) (hdet : (PhysicalSpectral.hessian (L := L) omega x0).det ≠ 0) + (hcrit : fderiv ℝ (I4Source.sourceField n L omega) x0 = 0) : + ∃ (k : ℕ) (hk : k ≤ n) (P : E n ≃L[ℝ] X n) (s : Sym n → Sym n) + (e : OpenPartialHomeomorph (E n) (E n)) + (D : MorseCone.NormalForm (I4Torus.SourceTorus n L) (E k) (E (n-k))), + let J := PhysicalSpectral.signSym n k + let M := TaylorSymLift.sourceSymMatrix (L := L) omega x0 P.toContinuousLinearMap + M 0 = J ∧ (∀ u, e u = theta J s M u) ∧ + e 0 = 0 ∧ e.symm 0 = 0 ∧ 0 ∈ e.source ∧ 0 ∈ e.target ∧ + HasFDerivAt e (ContinuousLinearMap.id ℝ (E n)) 0 ∧ + ContDiffOn ℝ 2 e e.source ∧ ContDiffOn ℝ 2 e.symm e.target ∧ + D.f = I4Torus.torusSourceField n L omega ∧ + D.p = I4Torus.torusProjection n L x0 ∧ D.c = I4Source.sourceField n L omega x0 ∧ + D.chart = (liftChart (L := L) x0).trans (physicalChart hk x0 P e) ∧ + (∀ q, D.chart q = split hk (e (P.symm (liftChart (L := L) x0 q - x0)))) ∧ + (∀ z, D.chart.symm z = I4Torus.torusProjection n L (x0 + P (e.symm ((split hk).symm z)))) ∧ + ContMDiffOn 𝓘(ℝ, X n) 𝓘(ℝ, E k × E (n-k)) 2 D.chart D.chart.source ∧ + ContMDiffOn 𝓘(ℝ, E k × E (n-k)) 𝓘(ℝ, X n) 2 D.chart.symm D.chart.target := by + obtain ⟨k, hk, P, V, s, e, hM0, hV, hJV, hs0, hs, heq, he0, hi0, h0s, h0t, + hd, heC, hiC, hf, hi⟩ := source_coordinates (Fact.out : 0 < L).ne' omega hmajor x0 hdet hcrit + let a := liftChart (L := L) x0 + let b := physicalChart hk x0 P e + let c := a.trans b + obtain ⟨hat, has, hac⟩ := liftChart_center (L := L) x0 + have hbs : x0 ∈ b.source := by + apply (physicalChart_source hk x0 P e x0).mpr + simpa using h0s + have hb0 : b x0 = 0 := by + simp [b, physicalChart_apply, he0] + have hcs : I4Torus.torusProjection n L x0 ∈ c.source := by + refine ⟨has, ?_⟩ + change a (I4Torus.torusProjection n L x0) ∈ b.source + simpa only [a, hac] using hbs + have hc0 : c (I4Torus.torusProjection n L x0) = 0 := by + change b (a (I4Torus.torusProjection n L x0)) = 0 + simpa only [a, hac] using hb0 + have hct : (0 : E k × E (n-k)) ∈ c.target := by + simpa only [hc0] using c.map_source hcs + obtain ⟨ρ, hρ, hr⟩ := Metric.mem_nhds_iff.mp (c.open_target.mem_nhds hct) + have energy : ∀ q ∈ c.source, I4Torus.torusSourceField n L omega q = + I4Source.sourceField n L omega x0 + MorseCone.quadratic (c q) := by + intro q hq + have hq' : a q ∈ b.source := hq.2 + have hu := (physicalChart_source hk x0 P e (a q)).mp hq' + have he := (hf (P.symm (a q - x0)) hu).2 + have hxx : x0 + P (P.symm (a q - x0)) = a q := by simp + rw [hxx] at he + have ht : I4Torus.torusSourceField n L omega q = I4Source.sourceField n L omega (a q) := by + rw [← I4Torus.torusSourceField_pullback n L omega (a q)] + congr 1 + exact (a.left_inv hq.1).symm + rw [ht, he] + exact congrArg (fun v => I4Source.sourceField n L omega x0 + v) + (split_quadratic hk (e (P.symm (a q - x0)))) + let D : MorseCone.NormalForm (I4Torus.SourceTorus n L) (E k) (E (n-k)) := + { f := I4Torus.torusSourceField n L omega + p := I4Torus.torusProjection n L x0 + c := I4Source.sourceField n L omega x0 + ρ := ρ + hρ := hρ + chart := c + center_mem := hcs + center_eq := hc0 + ball_target := (radiusBall_subset_ball hρ).trans hr + equation := energy } + obtain ⟨haC, haiC⟩ := liftChart_C2 (L := L) x0 + obtain ⟨hbC, hbiC⟩ := physicalChart_C2 hk x0 P e heC hiC + have hcC : ContMDiffOn 𝓘(ℝ, X n) 𝓘(ℝ, E k × E (n-k)) 2 c c.source := + hbC.contMDiffOn.comp' haC + have hciC : ContMDiffOn 𝓘(ℝ, E k × E (n-k)) 𝓘(ℝ, X n) 2 c.symm c.target := + haiC.comp' hbiC.contMDiffOn + refine ⟨k, hk, P, s, e, D, hM0, heq, he0, hi0, h0s, h0t, hd, heC, hiC, + rfl, rfl, rfl, rfl, (fun _ => rfl), ?_, hcC, hciC⟩ + intro z + change I4Torus.torusProjection n L (b.symm z) = _ + rw [physicalChart_symm] + +end SourceNormalForm diff --git a/frontiers/compact_source_cutoff_controls_final_repair_20261011/SourceTorus.lean b/frontiers/compact_source_cutoff_controls_final_repair_20261011/SourceTorus.lean new file mode 100644 index 000000000..b9fe49752 --- /dev/null +++ b/frontiers/compact_source_cutoff_controls_final_repair_20261011/SourceTorus.lean @@ -0,0 +1,111 @@ +import SourceCovariance +import Mathlib.MeasureTheory.Integral.IntervalIntegral.Periodic +import Mathlib.Probability.Distributions.Gaussian.IsGaussianProcess.Basic + +/-! Literal descent of the existing real-cover field to a product of additive circles. +The sample law remains sourceLaw. Smooth torus and Banach-valued laws are separate. -/ +noncomputable section +open I4Foundation I4Weights I4Source I4Lattice I4Kernel I4SourceGaussian I4SourceCovariance +open MeasureTheory ProbabilityTheory +open scoped BigOperators ENNReal NNReal + +namespace I4Torus + +abbrev SourceTorus (d : ℕ) (L : ℝ) := Fin d → AddCircle L + +def torusProjection (d : ℕ) (L : ℝ) (x : Fin d → ℝ) : SourceTorus d L := + fun i => (x i : AddCircle L) + +def torusRepresentative (d : ℕ) (L : ℝ) [Fact (0 < L)] + (q : SourceTorus d L) : Fin d → ℝ := + fun i => (AddCircle.equivIco L 0 (q i)).1 + +def torusSourceField (d : ℕ) (L : ℝ) [Fact (0 < L)] + (ω : SourceMode d → ℝ) (q : SourceTorus d L) : ℝ := + sourceField d L ω (torusRepresentative d L q) + +theorem torusProjection_measurable (d : ℕ) (L : ℝ) : Measurable (torusProjection d L) := by + exact Measurable.of_eval (fun i => AddCircle.measurable_mk'.comp (measurable_pi_apply i)) + +theorem torusRepresentative_measurable (d : ℕ) (L : ℝ) [Fact (0 < L)] : + Measurable (torusRepresentative d L) := by + exact Measurable.of_eval (fun i => measurable_subtype_coe.comp + ((AddCircle.measurableEquivIco L 0).measurable.comp (measurable_pi_apply i))) + +theorem torusProjection_representative (d : ℕ) (L : ℝ) [Fact (0 < L)] + (q : SourceTorus d L) : torusProjection d L (torusRepresentative d L q) = q := by + funext i + exact AddCircle.coe_equivIco (p := L) (a := 0) (y := q i) + +theorem sourceField_eq_of_torusProjection_eq (d : ℕ) {L : ℝ} (hL : L ≠ 0) + (ω : SourceMode d → ℝ) (x y : Fin d → ℝ) + (h : torusProjection d L x = torusProjection d L y) : + sourceField d L ω x = sourceField d L ω y := by + classical + have hz (i : Fin d) : ∃ n : ℤ, n • L = y i - x i := by + apply (AddCircle.coe_eq_zero_iff (p := L)).mp + rw [AddCircle.coe_sub] + exact sub_eq_zero.mpr (congrFun h i).symm + choose n hn using hz + have he : y = fun i => x i + L * (n i : ℝ) := by + funext i + have hi := hn i + rw [zsmul_eq_mul] at hi + linarith + rw [he] + exact (sourceField_lattice_shift d hL ω n x).symm + +theorem torusSourceField_pullback (d : ℕ) (L : ℝ) [Fact (0 < L)] + (ω : SourceMode d → ℝ) (x : Fin d → ℝ) : + torusSourceField d L ω (torusProjection d L x) = sourceField d L ω x := by + exact sourceField_eq_of_torusProjection_eq d (Fact.out : 0 < L).ne' ω + (torusRepresentative d L (torusProjection d L x)) x + (torusProjection_representative d L (torusProjection d L x)) + +theorem torusSourceField_eval_measurable (d : ℕ) (L : ℝ) [Fact (0 < L)] + (q : SourceTorus d L) : Measurable (fun ω => torusSourceField d L ω q) := by + exact sourceField_eval_measurable d L (torusRepresentative d L q) + +theorem torusSourceField_joint_measurable (d : ℕ) (L : ℝ) [Fact (0 < L)] : + Measurable (fun p : (SourceMode d → ℝ) × SourceTorus d L => + torusSourceField d L p.1 p.2) := by + unfold torusSourceField sourceField scalarSeries + apply Measurable.tsum + intro m + have hm : Continuous (fun x : Fin d → ℝ => modeCoefficient d L m x) := by + cases m with + | none => simp only [modeCoefficient]; fun_prop + | some p => + rcases p with ⟨k,b⟩ + cases b <;> simp only [modeCoefficient, Bool.false_eq_true, ite_false, ite_true] <;> + unfold phase <;> fun_prop + exact (hm.measurable.comp ((torusRepresentative_measurable d L).comp measurable_snd)).mul + ((measurable_pi_apply m).comp measurable_fst) + +theorem torusSourceField_finiteVector_hasGaussianLaw (d : ℕ) (L : ℝ) [Fact (0 < L)] + (n : ℕ) (q : Fin n → SourceTorus d L) : + HasGaussianLaw (fun ω j => torusSourceField d L ω (q j)) (sourceLaw d) := by + exact source_finiteVector_hasGaussianLaw d (Fact.out : 0 < L).ne' n + (fun j => torusRepresentative d L (q j)) + +theorem torusSourceField_isGaussianProcess (d : ℕ) (L : ℝ) [Fact (0 < L)] : + IsGaussianProcess (fun q ω => torusSourceField d L ω q) (sourceLaw d) := by + exact (sourceField_isGaussianProcess d (Fact.out : 0 < L).ne').comp_right + (torusRepresentative d L) + +theorem torusSourceField_covariance (d : ℕ) (L : ℝ) [Fact (0 < L)] + (q p : SourceTorus d L) : + cov[fun ω => torusSourceField d L ω q, fun ω => torusSourceField d L ω p; sourceLaw d] = + sourceSpectralKernel d L (torusRepresentative d L q - torusRepresentative d L p) := by + exact sourceField_covariance d (Fact.out : 0 < L).ne' + (torusRepresentative d L q) (torusRepresentative d L p) + +theorem torusSourceField_covariance_pullback (d : ℕ) (L : ℝ) [Fact (0 < L)] + (x y : Fin d → ℝ) : + cov[fun ω => torusSourceField d L ω (torusProjection d L x), + fun ω => torusSourceField d L ω (torusProjection d L y); sourceLaw d] = + sourceSpectralKernel d L (x - y) := by + simp_rw [torusSourceField_pullback] + exact sourceField_covariance d (Fact.out : 0 < L).ne' x y + +end I4Torus diff --git a/frontiers/compact_source_cutoff_controls_final_repair_20261011/SourceTorusC4.lean b/frontiers/compact_source_cutoff_controls_final_repair_20261011/SourceTorusC4.lean new file mode 100644 index 000000000..30cfb670f --- /dev/null +++ b/frontiers/compact_source_cutoff_controls_final_repair_20261011/SourceTorusC4.lean @@ -0,0 +1,134 @@ +import SourceC4 +import SourceTorus +import Mathlib.Topology.OpenPartialHomeomorph.Constructions +import Mathlib.Geometry.Manifold.ContMDiff.Basic +import Mathlib.Geometry.Manifold.ContMDiff.NormedSpace +import Mathlib.Topology.LocallyConstant.Basic + +noncomputable section +open I4Foundation I4Weights I4Source I4C4 I4Torus MeasureTheory +open scoped Manifold ContDiff Topology +namespace I4TorusC4 + +def quotientChart (d : ℕ) (L : ℝ) [Fact (0 < L)] (a : Fin d → ℝ) : + OpenPartialHomeomorph (SourceTorus d L) (Fin d → ℝ) := + (OpenPartialHomeomorph.pi (fun i : Fin d => AddCircle.openPartialHomeomorphCoe L (a i))).symm + +def chartCenter (d : ℕ) (L : ℝ) [Fact (0 < L)] (q : SourceTorus d L) : Fin d → ℝ := + fun i => torusRepresentative d L q i - L / 2 + +theorem quotientChart_symm (d : ℕ) (L : ℝ) [Fact (0 < L)] (a : Fin d → ℝ) : + (quotientChart d L a).symm = torusProjection d L := by + rfl + +theorem centered_chart_covers (d : ℕ) (L : ℝ) [Fact (0 < L)] (q : SourceTorus d L) : + q ∈ (quotientChart d L (chartCenter d L q)).source := by + let e := OpenPartialHomeomorph.pi + (fun i : Fin d => AddCircle.openPartialHomeomorphCoe L (chartCenter d L q i)) + have hs : torusRepresentative d L q ∈ e.source := by + change torusRepresentative d L q ∈ Set.pi Set.univ + (fun i => Set.Ioo (chartCenter d L q i) (chartCenter d L q i + L)) + intro i _ + change chartCenter d L q i < torusRepresentative d L q i ∧ + torusRepresentative d L q i < chartCenter d L q i + L + have hL : 0 < L := Fact.out + dsimp [chartCenter] + constructor <;> linarith + have he : e (torusRepresentative d L q) = q := + torusProjection_representative d L q + have ht := e.map_source hs + rw [he] at ht + exact ht + +@[instance_reducible] def actualChartedSpace (d : ℕ) (L : ℝ) [Fact (0 < L)] : + ChartedSpace (Fin d → ℝ) (SourceTorus d L) where + atlas := Set.range (quotientChart d L) + chartAt := fun q => quotientChart d L (chartCenter d L q) + mem_chart_source := centered_chart_covers d L + chart_mem_atlas := fun q => ⟨chartCenter d L q, rfl⟩ + +attribute [local instance] actualChartedSpace + +theorem chart_transition_contDiff (d : ℕ) (L : ℝ) [Fact (0 < L)] (a b : Fin d → ℝ) : + ContDiffOn ℝ ∞ ((quotientChart d L a).symm.trans (quotientChart d L b)) + ((quotientChart d L a).symm.trans (quotientChart d L b)).source := by + let ea := quotientChart d L a + let eb := quotientChart d L b + let T := ea.symm.trans eb + let S := T.source + have hproj (x : S) : torusProjection d L (T x) = torusProjection d L x := by + have hb : ea.symm (x : Fin d → ℝ) ∈ eb.source := x.property.2 + have hi := eb.left_inv hb + simpa only [T, ea, eb, OpenPartialHomeomorph.trans_apply, quotientChart_symm] using hi + have hlat (x : S) (i : Fin d) : T x i - (x : Fin d → ℝ) i ∈ + AddSubgroup.zmultiples L := by + apply AddSubgroup.mem_zmultiples_iff.mpr + apply (AddCircle.coe_eq_zero_iff (p := L)).mp + rw [AddCircle.coe_sub] + exact sub_eq_zero.mpr (congrFun (hproj x) i) + let delta : S → Fin d → AddSubgroup.zmultiples L := + fun x i => ⟨T x i - (x : Fin d → ℝ) i, hlat x i⟩ + have hd : Continuous delta := by + apply continuous_pi + intro i + apply Continuous.subtype_mk + exact ((continuous_apply i).comp T.continuousOn.domRestrict).sub + ((continuous_apply i).comp continuous_subtype_val) + have hlc : IsLocallyConstant delta := + (IsLocallyConstant.iff_continuous delta).mpr hd + apply T.open_source.contDiffOn_iff.mpr + intro x hx + let x0 : S := ⟨x, hx⟩ + let c : Fin d → ℝ := fun i => (delta x0 i : ℝ) + have hsub : ∀ᶠ y : S in 𝓝 x0, T y = (y : Fin d → ℝ) + c := by + filter_upwards [hlc.eventually_eq x0] with y hy + funext i + have hi := congrArg (fun z : Fin d → AddSubgroup.zmultiples L => (z i : ℝ)) hy + change T y i - (y : Fin d → ℝ) i = c i at hi + change T y i = (y : Fin d → ℝ) i + c i + linarith + have hamb : (fun y => T y) =ᶠ[𝓝 x] (fun y => y + c) := by + have hm : ∀ᶠ y in Filter.map ((↑) : S → (Fin d → ℝ)) (𝓝 x0), T y = y + c := + Filter.eventually_map.mpr hsub + have hmap : Filter.map ((↑) : S → (Fin d → ℝ)) (𝓝 x0) = 𝓝 x := + map_nhds_subtype_coe_eq_nhds hx (T.open_source.mem_nhds hx) + rw [hmap] at hm + exact hm + exact (contDiff_id.add contDiff_const).contDiffAt.congr_of_eventuallyEq hamb + +theorem torus_isManifold (d : ℕ) (L : ℝ) [Fact (0 < L)] : + IsManifold 𝓘(ℝ, Fin d → ℝ) ∞ (SourceTorus d L) := by + apply isManifold_of_contDiffOn + intro e e' he he' + change e ∈ Set.range (quotientChart d L) at he + change e' ∈ Set.range (quotientChart d L) at he' + rcases he with ⟨a, rfl⟩ + rcases he' with ⟨b, rfl⟩ + simpa only [modelWithCornersSelf_coe, modelWithCornersSelf_coe_symm, + Function.comp_id, Function.id_comp, Set.preimage_id, Set.range_id, Set.inter_univ] using + chart_transition_contDiff d L a b + +theorem torusSourceField_contMDiff_ae (d : ℕ) (L : ℝ) [Fact (0 < L)] : + ∀ᵐ sample ∂sourceLaw d, + ContMDiff 𝓘(ℝ, Fin d → ℝ) 𝓘(ℝ) 4 (torusSourceField d L sample) := by + let _ := torus_isManifold d L + filter_upwards [sourceField_contDiff_ae d (Fact.out : 0 < L).ne'] with sample hs + intro q + rw [contMDiffAt_iff_source] + have heq : torusSourceField d L sample ∘ (extChartAt 𝓘(ℝ, Fin d → ℝ) q).symm = + sourceField d L sample := by + funext x + change torusSourceField d L sample ((quotientChart d L (chartCenter d L q)).symm x) = _ + rw [quotientChart_symm] + exact torusSourceField_pullback d L sample x + rw [heq, contMDiffWithinAt_iff_contDiffWithinAt] + exact hs.contDiffAt.contDiffWithinAt + +theorem torusSourceField_weakSuperlevel_closed_ae (d : ℕ) (L : ℝ) [Fact (0 < L)] : + ∀ᵐ sample ∂sourceLaw d, ∀ h : ℝ, + IsClosed {q : SourceTorus d L | h ≤ torusSourceField d L sample q} := by + filter_upwards [torusSourceField_contMDiff_ae d L] with sample hs + intro h + exact isClosed_Ici.preimage hs.continuous + +end I4TorusC4 diff --git a/frontiers/compact_source_cutoff_controls_final_repair_20261011/SpectralWeights.lean b/frontiers/compact_source_cutoff_controls_final_repair_20261011/SpectralWeights.lean new file mode 100644 index 000000000..191a22f14 --- /dev/null +++ b/frontiers/compact_source_cutoff_controls_final_repair_20261011/SpectralWeights.lean @@ -0,0 +1,160 @@ +import Mathlib.NumberTheory.ModularForms.JacobiTheta.TwoVariable +import Mathlib.Analysis.Normed.Ring.InfiniteSum +import Mathlib.Data.Fin.Tuple.Basic +import Mathlib.Algebra.BigOperators.Fin + +/-! Concrete square-root Gaussian spectral majorants for the required I4 bridge. +The product majorant dominates the l1 frequency norm for the default Pi sup norm. +This file alone proves neither a Gaussian field law nor sample smoothness. -/ + +noncomputable section +open Real +open scoped BigOperators +namespace I4Weights + +def decay (a : ℝ) (k : ℤ) : ℝ := exp (-a * (k : ℝ) ^ 2) +def coordinateBound (a c : ℝ) (k : ℤ) : ℝ := + decay a k * (1 + |c * (k : ℝ)|) ^ 4 +def productDecay (d : ℕ) (a : ℝ) (k : Fin d → ℤ) : ℝ := + ∏ i, decay a (k i) +def productBound (d : ℕ) (a c : ℝ) (k : Fin d → ℤ) : ℝ := + ∏ i, coordinateBound a c (k i) +def sourceA (L : ℝ) : ℝ := π ^ 2 / L ^ 2 +def sourceC (L : ℝ) : ℝ := 2 * π / L +def sourceWeight (d : ℕ) (L : ℝ) (k : Fin d → ℤ) : ℝ := + productDecay d (2 * sourceA L) k +def sourceZ (d : ℕ) (L : ℝ) : ℝ := ∑' k, sourceWeight d L k +def pairedBound (d : ℕ) (L : ℝ) (k : Fin d → ℤ) : ℝ := + Real.sqrt (2 / sourceZ d L) * productBound d (sourceA L) (sourceC L) k + +theorem summable_decay_pow {a : ℝ} (ha : 0 < a) (n : ℕ) : + Summable (fun k : ℤ => decay a k * |(k : ℝ)| ^ n) := by + have hb := summable_pow_mul_jacobiTheta₂_term_bound 0 + (show 0 < a / π by positivity) n + have he (k : ℤ) : -π * (a / π * (k : ℝ) ^ 2 - 2 * 0 * |(k : ℝ)|) = + -a * (k : ℝ) ^ 2 := by + field_simp + ring + simp_rw [Int.cast_abs, he] at hb + simpa [decay, mul_comm] using hb + +theorem coordinateBound_summable {a c : ℝ} (ha : 0 < a) : + Summable (coordinateBound a c) := by + have hs := summable_decay_pow ha + convert ((((hs 0).add ((hs 1).mul_left (4 * |c|))).add + ((hs 2).mul_left (6 * |c| ^ 2))).add + ((hs 3).mul_left (4 * |c| ^ 3))).add ((hs 4).mul_left (|c| ^ 4)) using 1 + funext k + simp only [coordinateBound, abs_mul] + ring + +set_option maxHeartbeats 800000 in +theorem finite_product_summable {f : ℤ → ℝ} (hf : Summable f) (hn : ∀ k, 0 ≤ f k) + (d : ℕ) : Summable (fun k : Fin d → ℤ => ∏ i, f (k i)) := by + classical + induction d with + | zero => exact (hasSum_fintype _).summable + | succ d ih => + have hp : Summable (fun p : ℤ × (Fin d → ℤ) => f p.1 * ∏ i, f (p.2 i)) := + Summable.mul_of_nonneg (ι := ℤ) (ι' := Fin d → ℤ) + (f := f) (g := fun k : Fin d → ℤ => ∏ i, f (k i)) + hf ih hn (fun k => Finset.prod_nonneg (fun i _ => hn (k i))) + have heq : + ((fun k : Fin (d + 1) → ℤ => ∏ i, f (k i)) ∘ + (Fin.consEquiv (fun _ : Fin (d + 1) => ℤ))) = + (fun p : ℤ × (Fin d → ℤ) => f p.1 * ∏ i, f (p.2 i)) := by + funext p + simp only [Function.comp_apply, Fin.consEquiv_apply, Fin.prod_univ_succ, + Fin.cons_zero, Fin.cons_succ] + apply (Fin.consEquiv (fun _ : Fin (d + 1) => ℤ)).summable_iff.mp + rw [heq] + exact hp + +theorem productBound_summable {a c : ℝ} (ha : 0 < a) (d : ℕ) : + Summable (productBound d a c) := by + exact finite_product_summable (coordinateBound_summable ha) + (fun k => by unfold coordinateBound decay; positivity) d + +theorem productDecay_eq_exp (d : ℕ) (a : ℝ) (k : Fin d → ℤ) : + productDecay d a k = exp (-a * ∑ i, (k i : ℝ) ^ 2) := by + unfold productDecay decay + rw [← Real.exp_sum, ← Finset.mul_sum] + +theorem frequency_l1_le_product (d : ℕ) (v : Fin d → ℝ) (hv : ∀ i, 0 ≤ v i) : + 1 + ∑ i, v i ≤ ∏ i, (1 + v i) := by + classical + have H (s : Finset (Fin d)) : 1 + ∑ i ∈ s, v i ≤ ∏ i ∈ s, (1 + v i) := by + induction s using Finset.induction_on with + | empty => simp + | @insert i s hi ih => + rw [Finset.sum_insert hi, Finset.prod_insert hi] + have hsum : 0 ≤ ∑ j ∈ s, v j := Finset.sum_nonneg (fun j _ => hv j) + calc + 1 + (v i + ∑ j ∈ s, v j) ≤ (1 + v i) * (1 + ∑ j ∈ s, v j) := by + nlinarith [mul_nonneg (hv i) hsum] + _ ≤ (1 + v i) * ∏ j ∈ s, (1 + v j) := + mul_le_mul_of_nonneg_left ih (by linarith [hv i]) + exact H Finset.univ + +theorem sourceA_pos {L : ℝ} (hL : L ≠ 0) : 0 < sourceA L := by + unfold sourceA + positivity + +theorem sourceWeight_eq_physical (d : ℕ) (L : ℝ) (k : Fin d → ℤ) : + sourceWeight d L k = exp (-(∑ i, (sourceC L * (k i : ℝ)) ^ 2) / 2) := by + have hc : sourceC L ^ 2 = 4 * sourceA L := by + unfold sourceC sourceA + ring + have hs : (∑ i, (sourceC L * (k i : ℝ)) ^ 2) = + 4 * sourceA L * ∑ i, (k i : ℝ) ^ 2 := by + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro i _ + rw [mul_pow, hc] + rw [sourceWeight, productDecay_eq_exp, hs] + congr 1 + ring + +theorem sourceWeight_summable (d : ℕ) {L : ℝ} (hL : L ≠ 0) : + Summable (sourceWeight d L) := by + have ha : 0 < 2 * sourceA L := mul_pos (by norm_num) (sourceA_pos hL) + have hs : Summable (decay (2 * sourceA L)) := by + simpa using summable_decay_pow ha 0 + exact finite_product_summable hs (fun k => (Real.exp_pos _).le) d + +theorem sourceZ_pos (d : ℕ) {L : ℝ} (hL : L ≠ 0) : 0 < sourceZ d L := by + apply (sourceWeight_summable d hL).tsum_pos + (fun k => by unfold sourceWeight productDecay decay; positivity) (fun _ => 0) + simp [sourceWeight, productDecay, decay] + +theorem pairedBound_eq_amplitude (d : ℕ) {L : ℝ} (hL : L ≠ 0) (k : Fin d → ℤ) : + pairedBound d L k = Real.sqrt (2 * sourceWeight d L k / sourceZ d L) * + ∏ i, (1 + |sourceC L * (k i : ℝ)|) ^ 4 := by + have hsqrt : Real.sqrt (sourceWeight d L k) = productDecay d (sourceA L) k := by + have hw : sourceWeight d L k = (productDecay d (sourceA L) k) ^ 2 := by + rw [sourceWeight, productDecay_eq_exp, productDecay_eq_exp, pow_two, ← Real.exp_add] + congr 1 + ring + rw [hw, Real.sqrt_sq_eq_abs, abs_of_nonneg] + unfold productDecay decay + positivity + have hamp : Real.sqrt (2 * sourceWeight d L k / sourceZ d L) = + Real.sqrt (2 / sourceZ d L) * productDecay d (sourceA L) k := by + have he : 2 * sourceWeight d L k / sourceZ d L = + (2 / sourceZ d L) * sourceWeight d L k := by ring + rw [he, Real.sqrt_mul (by have := sourceZ_pos d hL; positivity), hsqrt] + have hp : productBound d (sourceA L) (sourceC L) k = + productDecay d (sourceA L) k * ∏ i, (1 + |sourceC L * (k i : ℝ)|) ^ 4 := by + exact Finset.prod_mul_distrib + rw [pairedBound, hp, hamp] + ring + +theorem pairedBound_summable (d : ℕ) {L : ℝ} (hL : L ≠ 0) : + Summable (pairedBound d L) := by + exact (productBound_summable (sourceA_pos hL) d).mul_left _ + +theorem pairedBound_subtype_summable (d : ℕ) {L : ℝ} (hL : L ≠ 0) + (S : Set (Fin d → ℤ)) : Summable (fun k : S => pairedBound d L k) := by + exact (pairedBound_summable d hL).subtype S + +end I4Weights diff --git a/frontiers/compact_source_cutoff_controls_final_repair_20261011/TARGET_TRANSFORMATION.md b/frontiers/compact_source_cutoff_controls_final_repair_20261011/TARGET_TRANSFORMATION.md new file mode 100644 index 000000000..c49f5b5a0 --- /dev/null +++ b/frontiers/compact_source_cutoff_controls_final_repair_20261011/TARGET_TRANSFORMATION.md @@ -0,0 +1,3 @@ +The proof source is exactly the previously compiled14614-byte75be8f6bb1b6915b4ab4bb15d89c99050b68944491ba68665caa71a977f8ca0a repair of original namespace fixture6d85955aab50429251c441358a26f4cb6e670ea8f6560b5caaf026d697ede0cd. Source definitions,CompactGeometry21fields,both complete theorem headers and5helpers are unchanged. The historical original proof repair changes only line138 to Filter.eventually_of_mem(hM.isClosed.compl_mem_nhds hxM), actualauthor/root/portable_cutoff_workflow_fix corroborated outside. + +Current F5 controls changes only original189zero_pow nonzero exponent and original386terminalrfl; all34complete control theorem headers and16full definitions/witnesses remain exact. It does not integrate any partial anisotropic literalV1 fragment. Candidate NOT_COMPILED and full proper-control coverage OPEN. ActualF4parent proof compiled0/13s,controlsfailed1/15s; standalonekernel and audit skipped. Newadmission/compiler/kernel/axiom evidence required. Scientific effectNONE/fullgoalACTIVE. diff --git a/frontiers/compact_source_cutoff_controls_final_repair_20261011/TaylorMatrix.lean b/frontiers/compact_source_cutoff_controls_final_repair_20261011/TaylorMatrix.lean new file mode 100644 index 000000000..f5885f3e2 --- /dev/null +++ b/frontiers/compact_source_cutoff_controls_final_repair_20261011/TaylorMatrix.lean @@ -0,0 +1,233 @@ +import MorseCongruence +import DeterministicSourceC4 +import Mathlib.Analysis.Calculus.TaylorIntegral +import Mathlib.Analysis.Calculus.ParametricIntegral +import Mathlib.Analysis.Calculus.FDeriv.Symmetric +import Mathlib.Analysis.Normed.Group.Bounded +import Mathlib.Analysis.SpecialFunctions.Integrals.Basic + +noncomputable section +set_option backward.isDefEq.respectTransparency false +open MeasureTheory Filter Set +open scoped Topology ContDiff Matrix.Norms.Frobenius +namespace TaylorMatrix +abbrev E (n : ℕ) := EuclideanSpace ℝ (Fin n) +abbrev X (n : ℕ) := Fin n → ℝ + +def matrix {n : ℕ} (F : X n → ℝ) (x0 : X n) (P : E n →L[ℝ] X n) + (u : E n) : MorseCongruence.Mat n := fun i j => + ∫ t in (0 : ℝ)..1, (1-t) * iteratedFDeriv ℝ 2 F (x0+t • P u) + ![P (EuclideanSpace.single i 1), P (EuclideanSpace.single j 1)] + +section ParameterIntegral +variable {H B : Type*} [NormedAddCommGroup H] [NormedSpace ℝ H] + [FiniteDimensional ℝ H] [NormedAddCommGroup B] [NormedSpace ℝ B] [CompleteSpace B] + +omit [CompleteSpace B] in +private theorem integral_deriv (G : H × ℝ → B) (D : H × ℝ → H →L[ℝ] B) + (hG : Continuous G) (hD : Continuous D) + (hd : ∀ u t, HasFDerivAt (fun v => G (v,t)) (D (u,t)) u) (u0 : H) : + HasFDerivAt (fun u => ∫ t in (0 : ℝ)..1, G (u,t)) + (∫ t in (0 : ℝ)..1, D (u0,t)) u0 := by + obtain ⟨C,hC⟩ := ((isCompact_closedBall u0 1).prod (isCompact_Icc : IsCompact (Icc (0:ℝ) 1))).exists_bound_of_continuousOn hD.continuousOn + apply hasFDerivAt_integral_of_dominated_of_fderiv_le'' (s := Metric.ball u0 1) + (bound := fun _ => C) (Metric.ball_mem_nhds u0 (by norm_num)) + · exact Eventually.of_forall (fun u => (hG.comp (continuous_const.prodMk continuous_id)).aestronglyMeasurable) + · exact (hG.comp (continuous_const.prodMk continuous_id)).intervalIntegrable 0 1 + · exact (hD.comp (continuous_const.prodMk continuous_id)).aestronglyMeasurable + · filter_upwards [ae_restrict_mem measurableSet_uIoc] with t ht + intro u hu + exact hC (u,t) ⟨Metric.ball_subset_closedBall hu, (by simpa [uIcc_of_le zero_le_one] using uIoc_subset_uIcc ht)⟩ + · exact intervalIntegrable_const + · exact Eventually.of_forall (fun t u _ => hd u t) + +private def partialD (G : H × ℝ → B) (p : H × ℝ) : H →L[ℝ] B := + (fderiv ℝ G p).comp (ContinuousLinearMap.inl ℝ H ℝ) + +omit [FiniteDimensional ℝ H] [CompleteSpace B] in +private theorem partialD_contDiff {G : H × ℝ → B} {k : ℕ} + (hG : ContDiff ℝ (k+1) G) : ContDiff ℝ k (partialD G) := by + exact (hG.fderiv_right (by simp)).clm_comp contDiff_const + +omit [FiniteDimensional ℝ H] [CompleteSpace B] in +private theorem partialD_deriv {G : H × ℝ → B} {k : ℕ} + (hG : ContDiff ℝ (k+1) G) (u : H) (t : ℝ) : + HasFDerivAt (fun v => G (v,t)) (partialD G (u,t)) u := by + exact ((hG.differentiable (by simp) (u,t)).hasFDerivAt).comp u (hasFDerivAt_prodMk_left u t) + +omit [CompleteSpace B] in +private theorem integral_continuous {G : H × ℝ → B} (hG : Continuous G) : + Continuous (fun u => ∫ t in (0:ℝ)..1, G (u,t)) := by + apply continuous_iff_continuousAt.mpr + intro u0 + obtain ⟨C,hC⟩ := ((isCompact_closedBall u0 1).prod (isCompact_Icc : IsCompact (Icc (0:ℝ) 1))).exists_bound_of_continuousOn hG.continuousOn + apply intervalIntegral.continuousAt_of_dominated_interval (bound := fun _ => C) + · exact Eventually.of_forall (fun u => (hG.comp (continuous_const.prodMk continuous_id)).aestronglyMeasurable) + · filter_upwards [Metric.ball_mem_nhds u0 (by norm_num : (0:ℝ)<1)] with u hu + exact Eventually.of_forall (fun t ht => hC (u,t) + ⟨Metric.ball_subset_closedBall hu, by simpa [uIcc_of_le zero_le_one] using uIoc_subset_uIcc ht⟩) + · exact intervalIntegrable_const + · exact Eventually.of_forall (fun t _ => (hG.comp (continuous_id.prodMk continuous_const)).continuousAt) + +omit [CompleteSpace B] in +private theorem integral_contDiff_one {G : H × ℝ → B} (hG : ContDiff ℝ 1 G) : + ContDiff ℝ 1 (fun u => ∫ t in (0:ℝ)..1, G (u,t)) := by + apply contDiff_one_iff_hasFDerivAt.mpr + refine ⟨fun u => ∫ t in (0:ℝ)..1, partialD G (u,t), ?_, ?_⟩ + · exact integral_continuous (partialD_contDiff (k := 0) hG).continuous + · intro u + exact integral_deriv G (partialD G) hG.continuous + ((partialD_contDiff (k := 0) hG).continuous) (partialD_deriv (k := 0) hG) u + +omit [CompleteSpace B] in +private theorem integral_contDiff_two {G : H × ℝ → B} (hG : ContDiff ℝ 2 G) : + ContDiff ℝ 2 (fun u => ∫ t in (0:ℝ)..1, G (u,t)) := by + apply (contDiff_succ_iff_hasFDerivAt (n := 1)).mpr + refine ⟨fun u => ∫ t in (0:ℝ)..1, partialD G (u,t), ?_, ?_⟩ + · exact integral_contDiff_one (partialD_contDiff (k := 1) hG) + · intro u + exact integral_deriv G (partialD G) hG.continuous + ((partialD_contDiff (k := 1) hG).continuous) (partialD_deriv (k := 1) hG) u +end ParameterIntegral + +private def assemble (n : ℕ) : ((Fin n × Fin n) → ℝ) →L[ℝ] MorseCongruence.Mat n := + (show ((Fin n × Fin n) → ℝ) →ₗ[ℝ] MorseCongruence.Mat n from + { toFun := fun a i j => a (i,j) + map_add' := by intros; rfl + map_smul' := by intros; rfl }).toContinuousLinearMap + +theorem matrix_contDiff {n : ℕ} {F : X n → ℝ} (hF : ContDiff ℝ 4 F) + (x0 : X n) (P : E n →L[ℝ] X n) : ContDiff ℝ 2 (matrix F x0 P) := by + have he : ContDiff ℝ 2 (fun u : E n => fun ij : Fin n × Fin n => matrix F x0 P u ij.1 ij.2) := by + apply contDiff_pi.mpr + intro ij + rcases ij with ⟨i,j⟩ + change ContDiff ℝ 2 (fun u => ∫ t in (0:ℝ)..1, (1-t)*iteratedFDeriv ℝ 2 F (x0+t • P u) ![P (EuclideanSpace.single i 1),P (EuclideanSpace.single j 1)]) + apply integral_contDiff_two (G := fun q : E n × ℝ => (1-q.2)*iteratedFDeriv ℝ 2 F (x0+q.2 • P q.1) ![P (EuclideanSpace.single i 1),P (EuclideanSpace.single j 1)]) + have hD : ContDiff ℝ 2 (iteratedFDeriv ℝ 2 F) := hF.iteratedFDeriv_right (by norm_num) + have hx : ContDiff ℝ 2 (fun q : E n × ℝ => x0 + q.2 • P q.1) := by fun_prop + have hev : ContDiff ℝ 2 (ContinuousMultilinearMap.apply ℝ (fun _ : Fin 2 => X n) ℝ + ![P (EuclideanSpace.single i 1),P (EuclideanSpace.single j 1)]) := (ContinuousMultilinearMap.apply ℝ (fun _ : Fin 2 => X n) ℝ + ![P (EuclideanSpace.single i 1),P (EuclideanSpace.single j 1)]).contDiff + exact (contDiff_const.sub contDiff_snd).mul (hev.comp (hD.comp hx)) + + exact (assemble n).contDiff.comp he + +private theorem expansion {n : ℕ} (P : E n →L[ℝ] X n) (u : E n) : + P u = ∑ i, u i • P (EuclideanSpace.single i 1) := by + have hu : (∑ i, u i • EuclideanSpace.single i (1:ℝ)) = u := by + apply PiLp.ext + intro k + simp [WithLp.ofLp_sum, Pi.single_apply, Finset.sum_apply] + calc + P u = P (∑ i, u i • EuclideanSpace.single i (1:ℝ)) := congrArg P hu.symm + _ = _ := by rw [map_sum]; simp + +private theorem bilinear_expansion {n : ℕ} (P : E n →L[ℝ] X n) (u : E n) + (B : X n →L[ℝ] X n →L[ℝ] ℝ) : + B (P u) (P u) = ∑ i, ∑ j, u i * B (P (EuclideanSpace.single i 1)) + (P (EuclideanSpace.single j 1)) * u j := by + rw [expansion P u] + simp only [map_sum, map_smul, sum_apply, smul_apply, smul_eq_mul] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro i hi + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro j hj + ring + +theorem matrix_quadratic {n : ℕ} {F : X n → ℝ} (hF : ContDiff ℝ 4 F) + (x0 : X n) (P : E n →L[ℝ] X n) (hcrit : fderiv ℝ F x0 = 0) (u : E n) : + F (x0+P u) = F x0 + ∑ i, ∑ j, u i * matrix F x0 P u i j * u j := by + have ht := map_add_eq_sum_add_integral_iteratedFDeriv (n := 1) + (x := x0) (y := P u) (fun t _ => hF.contDiffAt.of_le (by norm_num)) + simp only [Finset.sum_range_succ, Finset.sum_range_zero, zero_add, + Nat.factorial_zero, Nat.factorial_one, Nat.cast_one, inv_one, + iteratedFDeriv_zero_apply, iteratedFDeriv_one_apply, hcrit, zero_apply, + add_zero, pow_one, smul_eq_mul, one_mul, mul_zero] at ht + rw [ht] + congr 1 + have hint (i j : Fin n) : IntervalIntegrable + (fun t => u i * ((1-t)*iteratedFDeriv ℝ 2 F (x0+t • P u) + ![P (EuclideanSpace.single i 1),P (EuclideanSpace.single j 1)]) * u j) volume 0 1 := by + have hD : Continuous (iteratedFDeriv ℝ 2 F) := + (hF.iteratedFDeriv_right (m := 0) (by norm_num)).continuous + apply Continuous.intervalIntegrable + fun_prop + calc + (∫ t in (0:ℝ)..1, (1-t)*iteratedFDeriv ℝ 2 F (x0+t • P u) (fun _ => P u)) = + ∫ t in (0:ℝ)..1, ∑ i, ∑ j, u i * ((1-t)*iteratedFDeriv ℝ 2 F (x0+t • P u) + ![P (EuclideanSpace.single i 1),P (EuclideanSpace.single j 1)]) * u j := by + apply intervalIntegral.integral_congr + intro t ht + simp only [iteratedFDeriv_two_apply, Matrix.cons_val_zero, Matrix.cons_val_one] + rw [bilinear_expansion P u] + simp only [Finset.mul_sum] + apply Finset.sum_congr rfl + intro i hi + apply Finset.sum_congr rfl + intro j hj + ring + _ = ∑ i, ∑ j, u i * matrix F x0 P u i j * u j := by + rw [intervalIntegral.integral_finsetSum (s := Finset.univ) + (f := fun i t => ∑ j, u i * ((1-t)*iteratedFDeriv ℝ 2 F (x0+t • P u) + ![P (EuclideanSpace.single i 1),P (EuclideanSpace.single j 1)]) * u j) + (fun i _ => by + convert IntervalIntegrable.sum Finset.univ (fun j _ => hint i j) using 1 + ext t + simp only [Finset.sum_apply])] + apply Finset.sum_congr rfl + intro i hi + rw [intervalIntegral.integral_finsetSum (s := Finset.univ) + (f := fun j t => u i * ((1-t)*iteratedFDeriv ℝ 2 F (x0+t • P u) + ![P (EuclideanSpace.single i 1),P (EuclideanSpace.single j 1)]) * u j) + (fun j _ => hint i j)] + apply Finset.sum_congr rfl + intro j hj + simp only [intervalIntegral.integral_mul_const, intervalIntegral.integral_const_mul, matrix] + +theorem source_matrix_contDiff {n : ℕ} {L : ℝ} (hL : L ≠ 0) + (omega : I4Source.SourceMode n → ℝ) + (hmajor : Summable (fun m => I4Source.modeMajorant n L m * |omega m|)) + (x0 : X n) (P : E n →L[ℝ] X n) : + ContDiff ℝ 2 (matrix (I4Source.sourceField n L omega) x0 P) := by + exact matrix_contDiff (I4DeterministicC4.sourceField_contDiff_of_majorant n hL omega hmajor) x0 P + +theorem source_matrix_selfAdjoint {n : ℕ} {L : ℝ} (hL : L ≠ 0) + (omega : I4Source.SourceMode n → ℝ) + (hmajor : Summable (fun m => I4Source.modeMajorant n L m * |omega m|)) + (x0 : X n) (P : E n →L[ℝ] X n) (u : E n) : + IsSelfAdjoint (matrix (I4Source.sourceField n L omega) x0 P u) := by + have hf := I4DeterministicC4.sourceField_contDiff_of_majorant n hL omega hmajor + change star (matrix (I4Source.sourceField n L omega) x0 P u) = _ + ext i j + simp only [Matrix.star_apply, star_trivial] + apply intervalIntegral.integral_congr + intro t ht + exact congrArg (fun a : ℝ => (1-t)*a) ((hf.contDiffAt.isSymmSndFDerivAt (by norm_num)).iteratedFDeriv_cons) + +theorem source_matrix_zero {n : ℕ} {L : ℝ} (hL : L ≠ 0) + (omega : I4Source.SourceMode n → ℝ) + (hmajor : Summable (fun m => I4Source.modeMajorant n L m * |omega m|)) + (x0 : X n) (P : E n →L[ℝ] X n) (i j : Fin n) : + matrix (I4Source.sourceField n L omega) x0 P 0 i j = + (1/2 : ℝ) * iteratedFDeriv ℝ 2 (I4Source.sourceField n L omega) x0 + ![P (EuclideanSpace.single i 1), P (EuclideanSpace.single j 1)] := by + clear hL hmajor + simp only [matrix, map_zero, smul_zero, add_zero] + rw [intervalIntegral.integral_mul_const] + congr 1 + rw [intervalIntegral.integral_sub (f := fun _ : ℝ => (1:ℝ)) (g := fun t : ℝ => t) intervalIntegrable_const (continuous_id.intervalIntegrable 0 1)] + norm_num [integral_id] + +theorem source_matrix_quadratic {n : ℕ} {L : ℝ} (hL : L ≠ 0) + (omega : I4Source.SourceMode n → ℝ) + (hmajor : Summable (fun m => I4Source.modeMajorant n L m * |omega m|)) + (x0 : X n) (P : E n →L[ℝ] X n) + (hcrit : fderiv ℝ (I4Source.sourceField n L omega) x0 = 0) (u : E n) : + I4Source.sourceField n L omega (x0+P u) = I4Source.sourceField n L omega x0 + + ∑ i, ∑ j, u i * matrix (I4Source.sourceField n L omega) x0 P u i j * u j := by + exact matrix_quadratic (I4DeterministicC4.sourceField_contDiff_of_majorant n hL omega hmajor) x0 P hcrit u + +end TaylorMatrix diff --git a/frontiers/compact_source_cutoff_controls_final_repair_20261011/TaylorSymLift.lean b/frontiers/compact_source_cutoff_controls_final_repair_20261011/TaylorSymLift.lean new file mode 100644 index 000000000..e443cf83d --- /dev/null +++ b/frontiers/compact_source_cutoff_controls_final_repair_20261011/TaylorSymLift.lean @@ -0,0 +1,49 @@ +import TaylorMatrix + +noncomputable section +open scoped ContDiff Matrix.Norms.Frobenius +open TaylorMatrix + +namespace TaylorSymLift + +def sourceSymMatrix {n : ℕ} {L : ℝ} (omega : I4Source.SourceMode n → ℝ) + (x0 : X n) (P : E n →L[ℝ] X n) (u : E n) : MorseCongruence.Sym n := + MorseCongruence.project n (matrix (I4Source.sourceField n L omega) x0 P u) + +theorem sourceSymMatrix_coe {n : ℕ} {L : ℝ} (hL : L ≠ 0) + (omega : I4Source.SourceMode n → ℝ) + (hmajor : Summable (fun m => I4Source.modeMajorant n L m * |omega m|)) + (x0 : X n) (P : E n →L[ℝ] X n) (u : E n) : + (sourceSymMatrix (L := L) omega x0 P u : MorseCongruence.Mat n) = + matrix (I4Source.sourceField n L omega) x0 P u := by + exact (source_matrix_selfAdjoint hL omega hmajor x0 P u).coe_selfAdjointPart_apply ℝ + +theorem sourceSymMatrix_contDiff {n : ℕ} {L : ℝ} (hL : L ≠ 0) + (omega : I4Source.SourceMode n → ℝ) + (hmajor : Summable (fun m => I4Source.modeMajorant n L m * |omega m|)) + (x0 : X n) (P : E n →L[ℝ] X n) : + ContDiff ℝ 2 (sourceSymMatrix (L := L) omega x0 P) := by + exact (MorseCongruence.project n).contDiff.comp + (source_matrix_contDiff hL omega hmajor x0 P) + +theorem sourceSymMatrix_zero {n : ℕ} {L : ℝ} (hL : L ≠ 0) + (omega : I4Source.SourceMode n → ℝ) + (hmajor : Summable (fun m => I4Source.modeMajorant n L m * |omega m|)) + (x0 : X n) (P : E n →L[ℝ] X n) (i j : Fin n) : + (sourceSymMatrix (L := L) omega x0 P 0 : MorseCongruence.Mat n) i j = + (1/2 : ℝ) * iteratedFDeriv ℝ 2 (I4Source.sourceField n L omega) x0 + ![P (EuclideanSpace.single i 1), P (EuclideanSpace.single j 1)] := by + rw [sourceSymMatrix_coe hL omega hmajor x0 P 0] + exact source_matrix_zero hL omega hmajor x0 P i j + +theorem sourceSymMatrix_quadratic {n : ℕ} {L : ℝ} (hL : L ≠ 0) + (omega : I4Source.SourceMode n → ℝ) + (hmajor : Summable (fun m => I4Source.modeMajorant n L m * |omega m|)) + (x0 : X n) (P : E n →L[ℝ] X n) + (hcrit : fderiv ℝ (I4Source.sourceField n L omega) x0 = 0) (u : E n) : + I4Source.sourceField n L omega (x0+P u) = I4Source.sourceField n L omega x0 + + ∑ i, ∑ j, u i * (sourceSymMatrix (L := L) omega x0 P u : MorseCongruence.Mat n) i j * u j := by + rw [sourceSymMatrix_coe hL omega hmajor x0 P u] + exact source_matrix_quadratic hL omega hmajor x0 P hcrit u + +end TaylorSymLift diff --git a/frontiers/compact_source_cutoff_controls_final_repair_20261011/lake-manifest.json b/frontiers/compact_source_cutoff_controls_final_repair_20261011/lake-manifest.json new file mode 100644 index 000000000..4afa853ce --- /dev/null +++ b/frontiers/compact_source_cutoff_controls_final_repair_20261011/lake-manifest.json @@ -0,0 +1,117 @@ +{ + "version": "1.2.0", + "packagesDir": ".lake/packages", + "packages": [ + { + "name": "plausible", + "url": "https://github.com/leanprover-community/plausible", + "type": "git", + "subDir": null, + "scope": "leanprover-community", + "rev": "118aa17ee84656b8bd727fef7c458ee8c833385c", + "manifestFile": "lake-manifest.json", + "inputRev": "main", + "inherited": true, + "configFile": "lakefile.toml" + }, + { + "name": "LeanSearchClient", + "url": "https://github.com/leanprover-community/LeanSearchClient", + "type": "git", + "subDir": null, + "scope": "leanprover-community", + "rev": "ddf04cf3949fa556442341e87d47f9f6e6074707", + "manifestFile": "lake-manifest.json", + "inputRev": "main", + "inherited": true, + "configFile": "lakefile.toml" + }, + { + "name": "importGraph", + "url": "https://github.com/leanprover-community/import-graph", + "type": "git", + "subDir": null, + "scope": "leanprover-community", + "rev": "e928b72544873815af278d38681b31c0293588e3", + "manifestFile": "lake-manifest.json", + "inputRev": "main", + "inherited": true, + "configFile": "lakefile.toml" + }, + { + "name": "proofwidgets", + "url": "https://github.com/leanprover-community/ProofWidgets4", + "type": "git", + "subDir": null, + "scope": "leanprover-community", + "rev": "106ff4fafc74ef4ac99d81dbf3ab399118f497a5", + "manifestFile": "lake-manifest.json", + "inputRev": "main", + "inherited": true, + "configFile": "lakefile.lean" + }, + { + "name": "aesop", + "url": "https://github.com/leanprover-community/aesop", + "type": "git", + "subDir": null, + "scope": "leanprover-community", + "rev": "355695d523e41d0554926416cba2a2b3544fbbc9", + "manifestFile": "lake-manifest.json", + "inputRev": "master", + "inherited": true, + "configFile": "lakefile.toml" + }, + { + "name": "Qq", + "url": "https://github.com/leanprover-community/quote4", + "type": "git", + "subDir": null, + "scope": "leanprover-community", + "rev": "6a489d9af5d0c47e5b259e2e8bcdfc1811b5a259", + "manifestFile": "lake-manifest.json", + "inputRev": "master", + "inherited": true, + "configFile": "lakefile.toml" + }, + { + "name": "batteries", + "url": "https://github.com/leanprover-community/batteries", + "type": "git", + "subDir": null, + "scope": "leanprover-community", + "rev": "f2effa3d803fda822b1f97b806c47cf2adfbcbc2", + "manifestFile": "lake-manifest.json", + "inputRev": "main", + "inherited": true, + "configFile": "lakefile.toml" + }, + { + "name": "Cli", + "url": "https://github.com/leanprover/lean4-cli", + "type": "git", + "subDir": null, + "scope": "leanprover", + "rev": "e92c9f15fdfacc8536f31cfb3b7ad26c3c8cd204", + "manifestFile": "lake-manifest.json", + "inputRev": "v4.34.0", + "inherited": true, + "configFile": "lakefile.toml" + }, + { + "name": "mathlib", + "url": "https://github.com/leanprover-community/mathlib4.git", + "type": "git", + "subDir": null, + "scope": "", + "rev": "d13f23b723b8a846827a245b89c10fc7d3f11612", + "manifestFile": "lake-manifest.json", + "inputRev": "d13f23b723b8a846827a245b89c10fc7d3f11612", + "inherited": false, + "configFile": "lakefile.lean" + } + ], + "name": "compact_source_cutoff_controls_final_repair", + "lakeDir": ".lake", + "fixedToolchain": true +} diff --git a/frontiers/compact_source_cutoff_controls_final_repair_20261011/lakefile.toml b/frontiers/compact_source_cutoff_controls_final_repair_20261011/lakefile.toml new file mode 100644 index 000000000..d8b619f62 --- /dev/null +++ b/frontiers/compact_source_cutoff_controls_final_repair_20261011/lakefile.toml @@ -0,0 +1,92 @@ +name = "compact_source_cutoff_controls_final_repair" +version = "0.1.0" +defaultTargets = ["PushedHeight"] + +[[require]] +name = "mathlib" +git = "https://github.com/leanprover-community/mathlib4.git" +rev = "d13f23b723b8a846827a245b89c10fc7d3f11612" + +[[lean_lib]] +name = "CompactSourceCutoffProof" + +[[lean_lib]] +name = "PushedHeight" + +[[lean_lib]] +name = "TaylorSymLift" + +[[lean_lib]] +name = "TaylorMatrix" + +[[lean_lib]] +name = "MorseCongruence" + +[[lean_lib]] +name = "DeterministicSourceC4" + +[[lean_lib]] +name = "SourceTorusC4" + +[[lean_lib]] +name = "SourceC4" + +[[lean_lib]] +name = "SourceTorus" + +[[lean_lib]] +name = "SourceCovariance" + +[[lean_lib]] +name = "SourceKernel" + +[[lean_lib]] +name = "SourceLattice" + +[[lean_lib]] +name = "SourceGaussianLaw" + +[[lean_lib]] +name = "SourceFourierSeries" + +[[lean_lib]] +name = "GaussianSeriesFoundation" + +[[lean_lib]] +name = "SpectralWeights" + +[[lean_lib]] +name = "ConeFootprint" + +[[lean_lib]] +name = "QuadraticCone" + +[[lean_lib]] +name = "OpenComponentGluing" + +[[lean_lib]] +name = "ElementaryHistory" + +[[lean_lib]] +name = "GlobalComponentMaps" + +[[lean_lib]] +name = "OrdinaryH0Image" + +[[lean_lib]] +name = "OrdinaryH0Elder" + +[[lean_lib]] +name = "CapFirstExit" + +[[lean_lib]] +name = "SourceNormalForm" + +[[lean_lib]] +name = "SourceCoordinates" + +[[lean_lib]] +name = "PhysicalSpectral" + +[[lean_lib]] +name = "CompactSourceCutoffControls" diff --git a/frontiers/compact_source_cutoff_controls_final_repair_20261011/lean-toolchain b/frontiers/compact_source_cutoff_controls_final_repair_20261011/lean-toolchain new file mode 100644 index 000000000..ba8ebf2db --- /dev/null +++ b/frontiers/compact_source_cutoff_controls_final_repair_20261011/lean-toolchain @@ -0,0 +1 @@ +leanprover/lean4:v4.34.1