Skip to content

Conversation

@MohanadAhmed
Copy link
Contributor

Rank One Update by Concatenation of inverse Equation

With $X$ an $(m+1)\times m$ matrix and $v$ a $(m+1)\times 1$ vector and $\alpha$ defined as:
$$\alpha = v^Tv - v^TXAX^Tv$$
and $A$ $A=(X^TX)^{-1}$ we have:

$$(\bar{X}^T\bar{X})^{-1} = \frac{1}{\alpha}\begin{bmatrix} \alpha A +AX^TvvX^TA^T & -AX^Tv \\\ -v^TXA^T & 1 \end{bmatrix}$$

In addition there are auxiliary lemmas:

  • reindex_equiv_eq_iff_matrix_eq (e₁ e₂ : n ≃ m) (A B: matrix n n R) : two matrices A and B are equal if after re-indexing by an equivalent re-index set they are equal and vice versa.
  • reindex_equiv_eq_if_matrix_eq and matrix_eq_if_reindex_equiv: give the forward and reverse directions of the lemmas above
  • rank_one_update_transpose_mul_self: the rank one update by concatenation with a matrix when transposed and multiplied into itself can be expressed as a $2 \times 2$ block matrix.

This Pull Request starts from where PR #8 ends. The new changes in this PR are Equation between 167 and 168 and the lemmas mentioned above in two files mat_vec_append.lean and `reindex.lean' in the 'for_mathlib' folder.

@MohanadAhmed
Copy link
Contributor Author

Seems mathlib upgrade broke two things:

  1. det_from_blocks₂₂ which has moved to linear_algebra.matrix.schur_complement. This I was able to fix by including the required file.

  2. has_deriv_at in the for_mathlib.analysis.matrix file is no longer a know identifier. Seems its PR didn't merge yet or it was removed.

Comment on lines 19 to 28
lemma reindex_equiv_eq_if_matrix_eq (e₁ : m ≃ o) (e₂: n ≃ p) (A B: matrix m n R) :
(reindex e₁ e₂ A = reindex e₁ e₂ B) → A = B :=
begin
intro h,
rw ← matrix.ext_iff at h,
funext r s,
specialize h (e₁ r) (e₂ s),
simp only [reindex_apply, submatrix_apply, equiv.symm_apply_apply] at h,
exact h,
end
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is (reindex e₁ e₂).injective

Comment on lines 39 to 41
lemma reindex_equiv_eq_iff_matrix_eq (e₁ e₂ : n ≃ m) (A B: matrix n n R) :
(reindex e₁ e₂ A = reindex e₁ e₂ B) ↔ A = B :=
⟨ reindex_equiv_eq_if_matrix_eq _ _ _ _, matrix_eq_if_reindex_equiv _ _ _ _⟩
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on my comments below, I think this whole file can be discarded.

@eric-wieser
Copy link
Owner

Seems mathlib upgrade broke two things:

I'll do a version bump separately

@eric-wieser eric-wieser added the lean3 This PR needs converting to Lean 4 if it is not already merged label Jan 7, 2024
@eric-wieser eric-wieser mentioned this pull request Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lean3 This PR needs converting to Lean 4 if it is not already merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants