Skip to content

Commit b18f6b5

Browse files
committed
feat(Data/Finsupp/Defs): induction_on_max (#16061)
A finitely supported function can be built in ascending or descending order of "degree".
1 parent cbe02ad commit b18f6b5

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

Mathlib/Data/Finsupp/Defs.lean

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,6 +1048,60 @@ theorem induction_linear {p : (α →₀ M) → Prop} (f : α →₀ M) (h0 : p
10481048
(hadd : ∀ f g : α →₀ M, p f → p g → p (f + g)) (hsingle : ∀ a b, p (single a b)) : p f :=
10491049
induction₂ f h0 fun _a _b _f _ _ w => hadd _ _ w (hsingle _ _)
10501050

1051+
section LinearOrder
1052+
1053+
variable [LinearOrder α] {p : (α →₀ M) → Prop}
1054+
1055+
/-- A finitely supported function can be built by adding up `single a b` for increasing `a`.
1056+
1057+
The theorem `induction_on_max₂` swaps the argument order in the sum. -/
1058+
theorem induction_on_max (f : α →₀ M) (h0 : p 0)
1059+
(ha : ∀ (a b) (f : α →₀ M), (∀ c ∈ f.support, c < a) → b ≠ 0 → p f → p (single a b + f)) :
1060+
p f := by
1061+
suffices ∀ (s) (f : α →₀ M), f.support = s → p f from this _ _ rfl
1062+
refine fun s => s.induction_on_max (fun f h => ?_) (fun a s hm hf f hs => ?_)
1063+
· rwa [support_eq_empty.1 h]
1064+
· have hs' : (erase a f).support = s := by
1065+
rw [support_erase, hs, erase_insert (fun ha => (hm a ha).false)]
1066+
rw [← single_add_erase a f]
1067+
refine ha _ _ _ (fun c hc => hm _ <| hs'.symm ▸ hc) ?_ (hf _ hs')
1068+
rw [← mem_support_iff, hs]
1069+
exact mem_insert_self a s
1070+
1071+
/-- A finitely supported function can be built by adding up `single a b` for decreasing `a`.
1072+
1073+
The theorem `induction_on_min₂` swaps the argument order in the sum. -/
1074+
theorem induction_on_min (f : α →₀ M) (h0 : p 0)
1075+
(ha : ∀ (a b) (f : α →₀ M), (∀ c ∈ f.support, a < c) → b ≠ 0 → p f → p (single a b + f)) :
1076+
p f :=
1077+
induction_on_max (α := αᵒᵈ) f h0 ha
1078+
1079+
/-- A finitely supported function can be built by adding up `single a b` for increasing `a`.
1080+
1081+
The theorem `induction_on_max` swaps the argument order in the sum. -/
1082+
theorem induction_on_max₂ (f : α →₀ M) (h0 : p 0)
1083+
(ha : ∀ (a b) (f : α →₀ M), (∀ c ∈ f.support, c < a) → b ≠ 0 → p f → p (f + single a b)) :
1084+
p f := by
1085+
suffices ∀ (s) (f : α →₀ M), f.support = s → p f from this _ _ rfl
1086+
refine fun s => s.induction_on_max (fun f h => ?_) (fun a s hm hf f hs => ?_)
1087+
· rwa [support_eq_empty.1 h]
1088+
· have hs' : (erase a f).support = s := by
1089+
rw [support_erase, hs, erase_insert (fun ha => (hm a ha).false)]
1090+
rw [← erase_add_single a f]
1091+
refine ha _ _ _ (fun c hc => hm _ <| hs'.symm ▸ hc) ?_ (hf _ hs')
1092+
rw [← mem_support_iff, hs]
1093+
exact mem_insert_self a s
1094+
1095+
/-- A finitely supported function can be built by adding up `single a b` for decreasing `a`.
1096+
1097+
The theorem `induction_on_min` swaps the argument order in the sum. -/
1098+
theorem induction_on_min₂ (f : α →₀ M) (h0 : p 0)
1099+
(ha : ∀ (a b) (f : α →₀ M), (∀ c ∈ f.support, a < c) → b ≠ 0 → p f → p (f + single a b)) :
1100+
p f :=
1101+
induction_on_max₂ (α := αᵒᵈ) f h0 ha
1102+
1103+
end LinearOrder
1104+
10511105
@[simp]
10521106
theorem add_closure_setOf_eq_single :
10531107
AddSubmonoid.closure { f : α →₀ M | ∃ a b, f = single a b } = ⊤ :=

0 commit comments

Comments
 (0)