Documentation
ForbiddenMatrix
.
ExtremalFunction
Search
return to top
source
Imports
Init
ForbiddenMatrix.Containment
Mathlib.Data.Fintype.Prod
Mathlib.Data.Finset.Lattice.Fold
Mathlib.Order.Interval.Finset.Nat
Mathlib.Algebra.BigOperators.Group.Finset.Defs
Mathlib.Algebra.Order.BigOperators.Group.Finset
Mathlib.Algebra.Order.Monoid.Canonical.Basic
Imported by
density
density_def
density_mono
row_density
col_density
ex
ex_zero
ex_le_iff
le_ex_iff
ex_le_sq
density_le_ex_of_not_contains
split_density_to_rows
density_by_rows_ub
split_density_to_cols
density_by_cols_ub
rectPtset
rectPtsetMatrix
rectPtsetSubsetMatrix
card_interval
card_rectPtSet
card_rectPtsetSubsetMatrix
density_mk_mem_product
den_all1_matrix_row_subset
den_all1_matrix_col_subset
den_all1_matrix_column_interval
den_all1_matrix_row_interval
den_all1_matrix_single_row
den_all1_matrix_single_col
le_ex_self_of_two_points
exists_av_and_ex_eq
split_density
source
noncomputable def
density
{
m
n
:
ℕ
}
(
M
:
Fin
m
→
Fin
n
→
Prop
)
:
ℕ
Equations
density
M
=
{
x
:
Fin
m
×
Fin
n
|
match
x
with |
(
i
,
j
)
=>
M
i
j
}
.
card
Instances For
source
theorem
density_def
{
n
:
ℕ
}
(
M
:
Fin
n
→
Fin
n
→
Prop
)
[
DecidableRel
M
]
:
density
M
=
{
x
:
Fin
n
×
Fin
n
|
match
x
with |
(
i
,
j
)
=>
M
i
j
}
.
card
source
theorem
density_mono
{
m
n
:
ℕ
}
{
M
N
:
Fin
m
→
Fin
n
→
Prop
}
(
h
:
∀ (
i
:
Fin
m
) (
j
:
Fin
n
),
M
i
j
→
N
i
j
)
:
density
M
≤
density
N
source
noncomputable def
row_density
{
n
:
ℕ
}
(
M
:
Fin
n
→
Fin
n
→
Prop
)
(
i
:
Fin
n
)
:
ℕ
Equations
row_density
M
i
=
{
j
:
Fin
n
|
M
i
j
}
.
card
Instances For
source
noncomputable def
col_density
{
n
:
ℕ
}
(
M
:
Fin
n
→
Fin
n
→
Prop
)
(
j
:
Fin
n
)
:
ℕ
Equations
col_density
M
j
=
{
i
:
Fin
n
|
M
i
j
}
.
card
Instances For
source
noncomputable def
ex
{
α
:
Type
u_1}
{
β
:
Type
u_2}
[
LinearOrder
α
]
[
LinearOrder
β
]
(
P
:
α
→
β
→
Prop
)
(
n
:
ℕ
)
:
ℕ
Equations
ex
P
n
=
{
M
:
Fin
n
→
Fin
n
→
Prop
|
¬
Contains
P
M
}
.
sup
density
Instances For
source
@[simp]
theorem
ex_zero
{
α
:
Type
u_1}
{
β
:
Type
u_2}
[
LinearOrder
α
]
[
LinearOrder
β
]
(
P
:
α
→
β
→
Prop
)
:
ex
P
0
=
0
source
theorem
ex_le_iff
{
α
:
Type
u_1}
{
β
:
Type
u_2}
[
LinearOrder
α
]
[
LinearOrder
β
]
{
P
:
α
→
β
→
Prop
}
{
m
n
:
ℕ
}
:
ex
P
n
≤
m
↔
∀ (
M
:
Fin
n
→
Fin
n
→
Prop
),
¬
Contains
P
M
→
density
M
≤
m
source
theorem
le_ex_iff
{
α
:
Type
u_1}
{
β
:
Type
u_2}
[
LinearOrder
α
]
[
LinearOrder
β
]
(
P
:
α
→
β
→
Prop
)
(
P_nonempty
:
∃ (
a
:
α
) (
b
:
β
),
P
a
b
)
{
m
n
:
ℕ
}
:
m
≤
ex
P
n
↔
∃ (
M
:
Fin
n
→
Fin
n
→
Prop
),
¬
Contains
P
M
∧
m
≤
density
M
source
theorem
ex_le_sq
{
α
:
Type
u_1}
{
β
:
Type
u_2}
[
LinearOrder
α
]
[
LinearOrder
β
]
{
P
:
α
→
β
→
Prop
}
(
n
:
ℕ
)
:
ex
P
n
≤
n
^
2
source
theorem
density_le_ex_of_not_contains
{
α
:
Type
u_1}
{
β
:
Type
u_2}
[
LinearOrder
α
]
[
LinearOrder
β
]
{
n
:
ℕ
}
{
P
:
α
→
β
→
Prop
}
(
M
:
Fin
n
→
Fin
n
→
Prop
)
(
AvoidP
:
¬
Contains
P
M
)
:
density
M
≤
ex
P
n
source
theorem
split_density_to_rows
{
n
:
ℕ
}
(
M
:
Fin
n
→
Fin
n
→
Prop
)
:
density
M
=
∑
i
:
Fin
n
,
row_density
M
i
source
theorem
density_by_rows_ub
{
n
c
:
ℕ
}
(
M
:
Fin
n
→
Fin
n
→
Prop
)
(
h_row_density_bounded
:
∀ (
i
:
Fin
n
),
row_density
M
i
≤
c
)
:
density
M
≤
n
*
c
source
theorem
split_density_to_cols
{
n
:
ℕ
}
(
M
:
Fin
n
→
Fin
n
→
Prop
)
:
density
M
=
∑
i
:
Fin
n
,
col_density
M
i
source
theorem
density_by_cols_ub
{
n
c
:
ℕ
}
(
M
:
Fin
n
→
Fin
n
→
Prop
)
(
h_col_bounded
:
∀ (
i
:
Fin
n
),
col_density
M
i
≤
c
)
:
density
M
≤
n
*
c
source
def
rectPtset
(
n
a₁
b₁
a₂
b₂
:
ℕ
)
:
Finset
(
Fin
n
×
Fin
n
)
Equations
rectPtset
n
a₁
b₁
a₂
b₂
=
{
a
:
Fin
n
|
↑
a
∈
Finset.Ico
a₁
b₁
}
×ˢ
{
a
:
Fin
n
|
↑
a
∈
Finset.Ico
a₂
b₂
}
Instances For
source
noncomputable def
rectPtsetMatrix
{
n
:
ℕ
}
(
M
:
Fin
n
→
Fin
n
→
Prop
)
(
a₁
b₁
a₂
b₂
:
ℕ
)
:
Finset
(
Fin
n
×
Fin
n
)
Equations
rectPtsetMatrix
M
a₁
b₁
a₂
b₂
=
{
x
:
Fin
n
×
Fin
n
|
match
x
with |
(
a
,
b
)
=>
M
a
b
∧
(
a
,
b
)
∈
rectPtset
n
a₁
b₁
a₂
b₂
}
Instances For
source
noncomputable def
rectPtsetSubsetMatrix
{
n
:
ℕ
}
(
M
:
Fin
n
→
Fin
n
→
Prop
)
(
R
C
:
Finset
(
Fin
n
)
)
:
Finset
(
Fin
n
×
Fin
n
)
Equations
rectPtsetSubsetMatrix
M
R
C
=
{
x
:
Fin
n
×
Fin
n
|
match
x
with |
(
a
,
b
)
=>
M
a
b
∧
(
a
,
b
)
∈
R
×ˢ
C
}
Instances For
source
theorem
card_interval
{
n
:
ℕ
}
(
x
y
:
ℕ
)
(
hy
:
y
≤
n
)
:
{
a
:
Fin
n
|
↑
a
∈
Finset.Ico
x
y
}
.
card
=
(
Finset.Ico
x
y
)
.
card
source
@[simp]
theorem
card_rectPtSet
(
n
a₁
b₁
a₂
b₂
:
ℕ
)
(
h
:
b₁
≤
n
∧
b₂
≤
n
)
:
(
rectPtset
n
a₁
b₁
a₂
b₂
)
.
card
=
(
b₁
-
a₁
)
*
(
b₂
-
a₂
)
source
@[simp]
theorem
card_rectPtsetSubsetMatrix
{
n
:
ℕ
}
(
M
:
Fin
n
→
Fin
n
→
Prop
)
(
R
C
:
Finset
(
Fin
n
)
)
:
(
rectPtsetSubsetMatrix
M
R
C
)
.
card
≤
R
.
card
*
C
.
card
source
theorem
density_mk_mem_product
{
n
:
ℕ
}
(
I
J
:
Finset
(
Fin
n
)
)
:
(
density
fun (
i
j
:
Fin
n
) =>
(
i
,
j
)
∈
I
×ˢ
J
)
=
I
.
card
*
J
.
card
source
theorem
den_all1_matrix_row_subset
{
n
:
ℕ
}
(
I
:
Finset
(
Fin
n
)
)
:
have
M
:=
fun (
i
j
:
Fin
n
) =>
(
i
,
j
)
∈
I
×ˢ
Finset.univ
;
density
M
=
n
*
I
.
card
source
theorem
den_all1_matrix_col_subset
{
n
:
ℕ
}
(
I
:
Finset
(
Fin
n
)
)
:
have
M
:=
fun (
i
j
:
Fin
n
) =>
(
i
,
j
)
∈
Finset.univ
×ˢ
I
;
density
M
=
n
*
I
.
card
source
theorem
den_all1_matrix_column_interval
{
n
:
ℕ
}
(
a
b
:
Fin
n
)
:
have
I
:=
{
x
:
Fin
n
|
↑
x
∈
Finset.Icc
↑
a
↑
b
}
;
have
M
:=
fun (
i
j
:
Fin
n
) =>
(
i
,
j
)
∈
Finset.univ
×ˢ
I
;
density
M
=
n
*
(
↑
b
+
1
-
↑
a
)
source
theorem
den_all1_matrix_row_interval
{
n
:
ℕ
}
(
a
b
:
Fin
n
)
:
have
I
:=
{
x
:
Fin
n
|
↑
x
∈
Finset.Icc
↑
a
↑
b
}
;
have
M
:=
fun (
i
j
:
Fin
n
) =>
(
i
,
j
)
∈
I
×ˢ
Finset.univ
;
density
M
=
n
*
(
↑
b
+
1
-
↑
a
)
source
theorem
den_all1_matrix_single_row
{
n
:
ℕ
}
(
x
:
Fin
n
)
:
have
M
:=
fun (
i
x_1
:
Fin
n
) =>
i
=
x
;
density
M
=
n
source
theorem
den_all1_matrix_single_col
{
n
:
ℕ
}
(
x
:
Fin
n
)
:
have
M
:=
fun (
x_1
j
:
Fin
n
) =>
j
=
x
;
density
M
=
n
source
theorem
le_ex_self_of_two_points
{
α
:
Type
u_1}
{
β
:
Type
u_2}
[
LinearOrder
α
]
[
LinearOrder
β
]
(
P
:
α
→
β
→
Prop
)
(
n
:
ℕ
)
(
hP
:
∃ (
x
:
α
×
β
) (
y
:
α
×
β
),
P
x
.1
x
.2
∧
P
y
.1
y
.2
∧
x
≠
y
)
:
n
≤
ex
P
n
source
theorem
exists_av_and_ex_eq
{
α
:
Type
u_1}
{
β
:
Type
u_2}
[
LinearOrder
α
]
[
LinearOrder
β
]
{
n
:
ℕ
}
{
P
:
α
→
β
→
Prop
}
(
P_nonempty
:
∃ (
a
:
α
) (
b
:
β
),
P
a
b
)
:
∃ (
M
:
Fin
n
→
Fin
n
→
Prop
),
¬
Contains
P
M
∧
ex
P
n
=
density
M
source
theorem
split_density
{
n
:
ℕ
}
(
M
Pred
:
Fin
n
→
Fin
n
→
Prop
)
:
have
M1
:=
fun (
i
j
:
Fin
n
) =>
M
i
j
∧
Pred
i
j
;
have
M2
:=
fun (
i
j
:
Fin
n
) =>
M
i
j
∧
¬
Pred
i
j
;
density
M
=
density
M1
+
density
M2