Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions RealRooted/Tactic/Examples/Matrix.lean
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ example {n : ℕ} (G : List (List ℝ[X])) (fs : List ℝ[X])
(hfs_len : fs.length = n)
(hfs : IsInterlacingSeqNonneg fs) :
IsInterlacingSeqNonneg ((matPolyAction G fs).filter (· ≠ 0)) := by
rr_matrix0_filter_ne_zero using
G, hG_rect, hG_nonneg, hG_affine, fs, hfs_len, hfs
rr_matrix0_filter_ne_zero

example {n : ℕ} (G : List (List ℝ[X])) (fs : List ℝ[X])
(hG_rect : ∀ row ∈ G, row.length = n)
Expand Down Expand Up @@ -138,7 +137,7 @@ example {n : ℕ} (G : List (List ℝ[X])) (fs : List ℝ[X])
(hfs : IsInterlacingSeqNonneg fs) :
IsInterlacingSeq0Nonneg (matPolyAction G fs) ∧
∀ f ∈ matPolyAction G fs, f ≠ 0 → (f ≠ 0 ∧ f.Splits) := by
rr_matrix0_realrooted using G, hG_rect, hG_nonneg, hG_affine, fs, hfs_len, hfs
rr_matrix0_realrooted

example {n : ℕ} (G : List (List ℝ[X])) (fs : List ℝ[X])
(hG_rect : ∀ row ∈ G, row.length = n)
Expand Down Expand Up @@ -219,8 +218,7 @@ example {n : ℕ} (G : List (List ℝ[X])) (fs : List ℝ[X])
(hfs : IsInterlacingSeq0Nonneg fs)
(hfs_real : ∀ f ∈ fs, f ≠ 0 → (f ≠ 0 ∧ f.Splits)) :
IsInterlacingSeqNonneg ((matPolyAction G fs).filter (· ≠ 0)) := by
rr_matrix0_filter_ne_zero_weak using
G, hG_rect, hG_nonneg, hG_affine, fs, hfs_len, hfs, hfs_real
rr_matrix0_filter_ne_zero_weak

example {n : ℕ} (G : List (List ℝ[X])) (fs : List ℝ[X])
(hG_rect : ∀ row ∈ G, row.length = n)
Expand Down Expand Up @@ -402,8 +400,7 @@ example {n : ℕ} (G : List (List ℝ[X])) (fs : List ℝ[X])
(hfs : IsInterlacingSeq0Nonneg fs)
(hfs_real : ∀ f ∈ fs, f ≠ 0 → (f ≠ 0 ∧ f.Splits)) :
IsInterlacingSeqNonneg ((matPolyAction G fs).filter (· ≠ 0)) := by
rr_row_threshold_matrix0_filter_ne_zero_weak using
G, hG_rect, hG_threshold, hG_affine, fs, hfs_len, hfs, hfs_real
rr_row_threshold_matrix0_filter_ne_zero_weak

example {n : ℕ} (G : List (List ℝ[X])) (fs : List ℝ[X])
(hG_rect : ∀ row ∈ G, row.length = n)
Expand Down Expand Up @@ -442,8 +439,7 @@ example {n : ℕ} (G : List (List ℝ[X])) (fs : List ℝ[X])
(hfs : IsInterlacingSeqNonneg fs) :
IsInterlacingSeq0Nonneg (matPolyAction G fs) ∧
∀ f ∈ matPolyAction G fs, f ≠ 0 → (f ≠ 0 ∧ f.Splits) := by
rr_row_threshold_matrix0_realrooted using
G, hG_rect, hG_threshold, hG_affine, fs, hfs_len, hfs
rr_row_threshold_matrix0_realrooted

example {n : ℕ} (G : List (List ℝ[X])) (fs : List ℝ[X])
(hG_rect : ∀ row ∈ G, row.length = n)
Expand Down Expand Up @@ -480,8 +476,7 @@ example {n : ℕ} (G : List (List ℝ[X])) (fs : List ℝ[X])
(hfs_len : fs.length = n)
(hfs : IsInterlacingSeqNonneg fs) :
IsInterlacingSeqNonneg ((matPolyAction G fs).filter (· ≠ 0)) := by
rr_row_threshold_matrix0_filter_ne_zero using
G, hG_rect, hG_threshold, hG_affine, fs, hfs_len, hfs
rr_row_threshold_matrix0_filter_ne_zero

example {G : List (List ℝ[X])}
(hG_threshold : HasRowThresholdLinearStructure G) :
Expand Down Expand Up @@ -566,6 +561,11 @@ example (hfs_len : ([] : List ℝ[X]).length = 0)
IsInterlacingSeq0Nonneg (matPolyAction decoyMatrix []) := by
rr_matrix0

example (hfs_len : ([] : List ℝ[X]).length = 0)
(hfs : IsInterlacingSeqNonneg ([] : List ℝ[X])) :
IsInterlacingSeqNonneg ((matPolyAction decoyMatrix []).filter (· ≠ 0)) := by
rr_matrix0_filter_ne_zero

example (hfs_len : ([] : List ℝ[X]).length = 0)
(hfs : IsInterlacingSeqNonneg ([] : List ℝ[X])) :
IsInterlacingSeq0Nonneg (matPolyAction baseMatrix []) := by
Expand Down
84 changes: 81 additions & 3 deletions RealRooted/Tactic/Matrix.lean
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ The tactics apply `matrix_preserves_interlacing_seq`,
the user supplies the matrix action, rectangularity, entry nonnegativity, and
`2 x 2` Branden conditions.

The bare `rr_matrix0`, `rr_matrix0_weak`, `rr_row_threshold_matrix0`, and
`rr_row_threshold_matrix0_weak` forms infer the matrix and input from the goal.
They use exact local length and input certificates, then the registered matrix
Every `matrix0` form has a bare variant inferring the matrix and input from the
goal; `rr_matrix` and `rr_row_threshold_matrix` require `using`. The bare forms
use exact local length and input certificates, then the registered matrix
certificate attributes. The bare `rr_row_threshold_entry_nonneg` form infers
its matrix from the target.

Expand Down Expand Up @@ -143,6 +143,9 @@ syntax (name := rr_matrix0_realrooted_named)
"input_interlacing" ":=" term :
tactic

syntax (name := rr_matrix0_realrooted_inferred)
"rr_matrix0_realrooted" : tactic

syntax (name := rr_matrix0_filter_ne_zero)
"rr_matrix0_filter_ne_zero" " using " term ", "
term ", "
Expand All @@ -164,6 +167,9 @@ syntax (name := rr_matrix0_filter_ne_zero_named)
"input_interlacing" ":=" term :
tactic

syntax (name := rr_matrix0_filter_ne_zero_inferred)
"rr_matrix0_filter_ne_zero" : tactic

syntax (name := rr_matrix0_filter_ne_zero_weak)
"rr_matrix0_filter_ne_zero_weak" " using " term ", "
term ", "
Expand All @@ -187,6 +193,9 @@ syntax (name := rr_matrix0_filter_ne_zero_weak_named)
"input_real_rooted" ":=" term :
tactic

syntax (name := rr_matrix0_filter_ne_zero_weak_inferred)
"rr_matrix0_filter_ne_zero_weak" : tactic

syntax (name := rr_row_threshold_matrix_named)
"rr_row_threshold_matrix" " using "
"n_pos" ":=" term ","
Expand Down Expand Up @@ -283,6 +292,9 @@ syntax (name := rr_row_threshold_matrix0_filter_ne_zero_weak)
term :
tactic

syntax (name := rr_row_threshold_matrix0_filter_ne_zero_weak_inferred)
"rr_row_threshold_matrix0_filter_ne_zero_weak" : tactic

syntax (name := rr_row_threshold_matrix0_realrooted_named)
"rr_row_threshold_matrix0_realrooted" " using "
"matrix" ":=" term ","
Expand All @@ -304,6 +316,9 @@ syntax (name := rr_row_threshold_matrix0_realrooted)
term :
tactic

syntax (name := rr_row_threshold_matrix0_realrooted_inferred)
"rr_row_threshold_matrix0_realrooted" : tactic

syntax (name := rr_row_threshold_matrix0_filter_ne_zero_named)
"rr_row_threshold_matrix0_filter_ne_zero" " using "
"matrix" ":=" term ","
Expand All @@ -325,6 +340,9 @@ syntax (name := rr_row_threshold_matrix0_filter_ne_zero)
term :
tactic

syntax (name := rr_row_threshold_matrix0_filter_ne_zero_inferred)
"rr_row_threshold_matrix0_filter_ne_zero" : tactic

syntax (name := rr_row_threshold_entry_nonneg_named)
"rr_row_threshold_entry_nonneg" " using "
"row_threshold" ":=" term :
Expand Down Expand Up @@ -358,6 +376,35 @@ macro_rules
case hG_affine => rr_lookup [rr_matrix_2x2]
case hfs => assumption
case hfs_real => assumption))
| `(tactic| rr_matrix0_realrooted) =>
`(tactic|
exact (by
apply RealRooted.matrix_preserves_interlacing_seq0_of_2x2_realRooted
case hfs_len => assumption
case hG_rect => rr_lookup [rr_matrix_rect]
case hG_nonneg => rr_lookup [rr_matrix_nonneg]
case hG_affine => rr_lookup [rr_matrix_2x2]
case hfs => assumption))
| `(tactic| rr_matrix0_filter_ne_zero) =>
`(tactic|
exact (by
apply RealRooted.matrix_preserves_interlacing_seq0_filter_ne_zero_of_2x2
case hfs_len => assumption
case hG_rect => rr_lookup [rr_matrix_rect]
case hG_nonneg => rr_lookup [rr_matrix_nonneg]
case hG_affine => rr_lookup [rr_matrix_2x2]
case hfs => assumption))
| `(tactic| rr_matrix0_filter_ne_zero_weak) =>
`(tactic|
exact (by
apply
RealRooted.matrix_preserves_interlacing_seq0_filter_ne_zero_of_2x2_weak
case hfs_len => assumption
case hG_rect => rr_lookup [rr_matrix_rect]
case hG_nonneg => rr_lookup [rr_matrix_nonneg]
case hG_affine => rr_lookup [rr_matrix_2x2]
case hfs => assumption
case hfs_real => assumption))
| `(tactic| rr_row_threshold_matrix0) =>
`(tactic|
exact (by
Expand All @@ -377,6 +424,37 @@ macro_rules
case hG_affine => rr_lookup [rr_matrix_2x2]
case hfs => assumption
case hfs_real => assumption))
| `(tactic| rr_row_threshold_matrix0_realrooted) =>
`(tactic|
exact (by
apply
RealRooted.rowThreshold_matrix_preserves_interlacing_seq0_of_2x2_realRooted
case hfs_len => assumption
case hG_rect => rr_lookup [rr_matrix_rect]
case hG_threshold => rr_lookup [rr_matrix_threshold]
case hG_affine => rr_lookup [rr_matrix_2x2]
case hfs => assumption))
| `(tactic| rr_row_threshold_matrix0_filter_ne_zero) =>
`(tactic|
exact (by
apply
RealRooted.rowThreshold_matrix_preserves_interlacing_seq0_filter_ne_zero_of_2x2
case hfs_len => assumption
case hG_rect => rr_lookup [rr_matrix_rect]
case hG_threshold => rr_lookup [rr_matrix_threshold]
case hG_affine => rr_lookup [rr_matrix_2x2]
case hfs => assumption))
| `(tactic| rr_row_threshold_matrix0_filter_ne_zero_weak) =>
`(tactic|
exact (by
apply
RealRooted.rowThreshold_matrix_preserves_interlacing_seq0_filter_ne_zero_of_2x2_weak
case hfs_len => assumption
case hG_rect => rr_lookup [rr_matrix_rect]
case hG_threshold => rr_lookup [rr_matrix_threshold]
case hG_affine => rr_lookup [rr_matrix_2x2]
case hfs => assumption
case hfs_real => assumption))
| `(tactic| rr_row_threshold_entry_nonneg) =>
`(tactic|
rr_row_threshold_entry_nonneg using
Expand Down
Loading