@@ -165,30 +165,50 @@ def restrict (s : Finset ι) (f : (i : ι) → π i) : (i : s) → π i := fun x
165
165
166
166
theorem restrict_def (s : Finset ι) : s.restrict (π := π) = fun f x ↦ f x := rfl
167
167
168
- theorem _root_.Set.piCongrLeft_comp_restrict {s : Finset ι} :
168
+ variable {s t u : Finset ι}
169
+
170
+ theorem _root_.Set.piCongrLeft_comp_restrict :
169
171
(s.equivToSet.symm.piCongrLeft (fun i : s.toSet ↦ π i)) ∘ s.toSet.restrict = s.restrict := rfl
170
172
171
- theorem piCongrLeft_comp_restrict {s : Finset ι} :
173
+ theorem piCongrLeft_comp_restrict :
172
174
(s.equivToSet.piCongrLeft (fun i : s ↦ π i)) ∘ s.restrict = s.toSet.restrict := rfl
173
175
174
176
/-- If a function `f` is restricted to a finite set `t`, and `s ⊆ t`,
175
177
this is the restriction to `s`. -/
176
178
@[simp]
177
- def restrict₂ {s t : Finset ι} (hst : s ⊆ t) (f : (i : t) → π i) : (i : s) → π i :=
178
- fun x ↦ f ⟨x.1 , hst x.2 ⟩
179
+ def restrict₂ (hst : s ⊆ t) (f : (i : t) → π i) (i : s) : π i := f ⟨i.1 , hst i.2 ⟩
179
180
180
- theorem restrict₂_def {s t : Finset ι} (hst : s ⊆ t) :
181
- restrict₂ (π := π) hst = fun f x ↦ f ⟨x.1 , hst x.2 ⟩ := rfl
181
+ theorem restrict₂_def (hst : s ⊆ t) : restrict₂ (π := π) hst = fun f x ↦ f ⟨x.1 , hst x.2 ⟩ := rfl
182
182
183
- theorem restrict₂_comp_restrict {s t : Finset ι} (hst : s ⊆ t) :
183
+ theorem restrict₂_comp_restrict (hst : s ⊆ t) :
184
184
(restrict₂ (π := π) hst) ∘ t.restrict = s.restrict := rfl
185
185
186
- theorem restrict₂_comp_restrict₂ {s t u : Finset ι} (hst : s ⊆ t) (htu : t ⊆ u) :
186
+ theorem restrict₂_comp_restrict₂ (hst : s ⊆ t) (htu : t ⊆ u) :
187
187
(restrict₂ (π := π) hst) ∘ (restrict₂ htu) = restrict₂ (hst.trans htu) := rfl
188
188
189
189
lemma dependsOn_restrict (s : Finset ι) : DependsOn (s.restrict (π := π)) s :=
190
190
(s : Set ι).dependsOn_restrict
191
191
192
+ lemma restrict_preimage [DecidablePred (· ∈ s)] (t : (i : s) → Set (π i)) :
193
+ s.restrict ⁻¹' (Set.univ.pi t) =
194
+ Set.pi s (fun i ↦ if h : i ∈ s then t ⟨i, h⟩ else Set.univ) := by
195
+ ext x
196
+ simp only [Set.mem_preimage, Set.mem_pi, Set.mem_univ, restrict, forall_const, Subtype.forall,
197
+ mem_coe]
198
+ refine ⟨fun h i hi ↦ by simpa [hi] using h i hi, fun h i hi ↦ ?_⟩
199
+ convert h i hi
200
+ rw [dif_pos hi]
201
+
202
+ lemma restrict₂_preimage [DecidablePred (· ∈ s)] (hst : s ⊆ t) (u : (i : s) → Set (π i)) :
203
+ (restrict₂ hst) ⁻¹' (Set.univ.pi u) =
204
+ (@Set.univ t).pi (fun j ↦ if h : j.1 ∈ s then u ⟨j.1 , h⟩ else Set.univ) := by
205
+ ext x
206
+ simp only [Set.mem_preimage, Set.mem_pi, Set.mem_univ, restrict₂, forall_const, Subtype.forall]
207
+ refine ⟨fun h i hi ↦ ?_, fun h i i_mem ↦ by simpa [i_mem] using h i (hst i_mem)⟩
208
+ split_ifs with i_mem
209
+ · exact h i i_mem
210
+ · trivial
211
+
192
212
end Pi
193
213
194
214
end Finset
0 commit comments