Skip to content

feat(Analysis/InnerProductSpace/Adjoint): characterize least-squares minimizers#42122

Open
bocowgill wants to merge 4 commits into
leanprover-community:masterfrom
bocowgill:ols-linear-map
Open

feat(Analysis/InnerProductSpace/Adjoint): characterize least-squares minimizers#42122
bocowgill wants to merge 4 commits into
leanprover-community:masterfrom
bocowgill:ols-linear-map

Conversation

@bocowgill

Copy link
Copy Markdown

This PR adds two theorems about least-squares minimizers for a continuous linear map A.

The first theorem states that the fitted value A x minimizes the distance to y over A.range if and only if the adjoint maps the residual y - A x to zero.

The second theorem restates the result in coefficient-space. That is, x minimizes ‖y - A z‖ over all z : E if and only if the same adjoint condition holds. This result is useful because it makes the range-level characterization applicable for least-squares problems (which are often stated in terms of coefficients).

These results provide a characterization of least-squares minimizers. The theorems use the existing APIs for range, orthogonal-complement, and adjoints. The PR adds them to Mathlib/Analysis/InnerProductSpace/Adjoint.lean.

These results were added to Mathlib/Analysis/InnerProductSpace/Adjoint.lean because a least-squares residual is orthogonal to A.range, while the orthogonal complement of A.range is the kernel of the adjoint.


LLM disclosure

For theorem planning and Lean implementation, I used OpenAI Codex substantially. I also used it for suggestions around naming and documentation, for iterating on the proofs, and for validating my commits locally.

I manually searched for the best locations and earlier results to build upon. I personally reviewed both the mathematical statements and Lean code (line-by-line), as well as the suggestions around naming and API choices. I also reviewed and confirmed that I can explain each step of the two theorems' proofs.

To validate the change, I directly compiled the modified file and ran a targeted build of Mathlib.Analysis.InnerProductSpace.Adjoint. Then I ran the style linter, and completed a full lake build and a full lake test.

Please note: This is my first Mathlib contribution. I welcome corrections or suggestions about all aspects of this PR. I'm prepared to revise it as necessary, and to learn from the review.

@github-actions github-actions Bot added the new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! label Jul 27, 2026
@github-actions

Copy link
Copy Markdown

Welcome new contributor!

Thank you for contributing to Mathlib! If you haven't done so already, please review our contribution guidelines, as well as the style guide and naming conventions. In particular, we kindly remind contributors that we have guidelines regarding the use of AI when making pull requests.

We use a review queue to manage reviews. If your PR does not appear there, it is probably because it is not successfully building (i.e., it doesn't have a green checkmark), has the awaiting-author tag, or another reason described in the Lifecycle of a PR. The review dashboard has a dedicated webpage which shows whether your PR is on the review queue, and (if not), why.

If you haven't already done so, please come to https://leanprover.zulipchat.com/, introduce yourself, and mention your new PR.

Thank you again for joining our community.

@bocowgill

Copy link
Copy Markdown
Author

LLM-generated

@github-actions github-actions Bot added LLM-generated PRs with substantial input from LLMs - review accordingly t-analysis Analysis (normed *, calculus) labels Jul 27, 2026
@github-actions

github-actions Bot commented Jul 27, 2026

Copy link
Copy Markdown

PR summary 322cf58a29

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff (regex)

+ forall_norm_sub_apply_le_iff_adjoint_apply_sub_eq_zero
+ norm_sub_apply_eq_iInf_iff_adjoint_apply_sub_eq_zero

You can run this locally as follows
## from your `mathlib4` directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci

## summary with just the declaration names:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh <optional_commit>

## more verbose report:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh long <optional_commit>

The doc-module for scripts/pr_summary/declarations_diff.sh in the mathlib-ci repository contains some details about this script.

Declarations diff (Lean)

Lean-aware diff — post-build, computed from the Lean environment (commit 322cf58).

  • +2 new declarations
  • −0 removed declarations
+ContinuousLinearMap.forall_norm_sub_apply_le_iff_adjoint_apply_sub_eq_zero
+ContinuousLinearMap.norm_sub_apply_eq_iInf_iff_adjoint_apply_sub_eq_zero

No changes to strong technical debt.

No changes to weak technical debt.

Current commit 322cf58a29
Reference commit 6996953ff1

This script lives in the mathlib-ci repository. To run it locally, from your mathlib4 directory:

git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
../mathlib-ci/scripts/reporting/technical-debt-metrics.sh pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

Comment thread Mathlib/Analysis/InnerProductSpace/Adjoint.lean Outdated
Comment thread Mathlib/Analysis/InnerProductSpace/Adjoint.lean Outdated
Comment thread Mathlib/Analysis/InnerProductSpace/Adjoint.lean Outdated
Comment thread Mathlib/Analysis/InnerProductSpace/Adjoint.lean Outdated
Comment thread Mathlib/Analysis/InnerProductSpace/Adjoint.lean Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

LLM-generated PRs with substantial input from LLMs - review accordingly new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! t-analysis Analysis (normed *, calculus)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants