Datasets:
AI4M
/

text
stringlengths
0
3.34M
[STATEMENT] lemma amult_eq_eq_r:"\<lbrakk>z \<noteq> 0; a * ant z = b * ant z\<rbrakk> \<Longrightarrow> a = b" [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<lbrakk>z \<noteq> 0; a * ant z = b * ant z\<rbrakk> \<Longrightarrow> a = b [PROOF STEP] apply (cut_tac less_linear[of "z" "0"], simp, cut_tac mem_ant[of "a"], cut_tac mem_ant[of "b"], (erule disjE)+, simp, erule disjE, erule exE, simp add:a_z_z, frule sym, thin_tac "\<infinity> = ant (za * z)", simp, simp, (erule disjE)+, simp, erule exE, simp add:a_z_z, simp) [PROOF STATE] proof (prove) goal (2 subgoals): 1. \<lbrakk>z \<noteq> 0; a * ant z = b * ant z; z < 0; (\<exists>z. a = ant z) \<or> a = \<infinity>; (\<exists>z. b = ant z) \<or> b = \<infinity>\<rbrakk> \<Longrightarrow> a = b 2. \<lbrakk>z \<noteq> 0; a * ant z = b * ant z; a = - \<infinity> \<or> (\<exists>z. a = ant z) \<or> a = \<infinity>; b = - \<infinity> \<or> (\<exists>z. b = ant z) \<or> b = \<infinity>; 0 < z\<rbrakk> \<Longrightarrow> a = b [PROOF STEP] apply ((erule disjE)+, (erule exE)+, simp add:a_z_z, erule exE, simp add:a_z_z, erule disjE, erule exE, simp add:a_z_z, frule sym, thin_tac "- \<infinity> = ant (za * z)", simp, simp, (erule disjE)+, simp, erule disjE, erule exE, simp add:a_z_z, frule sym, thin_tac "- \<infinity> = ant (za * z)", simp, simp) [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<lbrakk>z \<noteq> 0; a * ant z = b * ant z; b = - \<infinity> \<or> (\<exists>z. b = ant z) \<or> b = \<infinity>; 0 < z; (\<exists>z. a = ant z) \<or> a = \<infinity>\<rbrakk> \<Longrightarrow> a = b [PROOF STEP] apply ((erule disjE)+, erule exE, simp add:a_z_z, simp, (erule disjE)+, (erule exE)+, simp add:a_z_z, erule exE, simp add:a_z_z, erule disjE, erule exE, simp add:a_z_z, frule sym, thin_tac "\<infinity> = ant (za * z)", simp, simp) [PROOF STATE] proof (prove) goal: No subgoals! [PROOF STEP] done
{-# OPTIONS --without-K --safe #-} ------------------------------------------------------------------------ -- Re-exports of the Data.List.Kleene module, renamed to duplicate the -- Data.List API. module Data.List.Kleene.AsList where import Data.List.Kleene.Base as Kleene open import Data.List.Kleene.Base using ( [] ) renaming ( _⋆ to List ; foldr⋆ to foldr ; foldl⋆ to foldl ; _⋆++⋆_ to _++_ ; map⋆ to map ; pure⋆ to pure ; _⋆<*>⋆_ to _<*>_ ; _⋆>>=⋆_ to _>>=_ ; mapAccumL⋆ to mapAccumL ; _[_]⋆ to _[_] ; applyUpTo⋆ to applyUpTo ; upTo⋆ to upTo ; intersperse⋆ to intersperse ; _⋆<|>⋆_ to _<|>_ ; ⋆zipWith⋆ to zipWith ; unzipWith⋆ to unzipWith ; partitionSumsWith⋆ to partitionSumsWith ; ⋆transpose⋆ to transpose ; reverse⋆ to reverse ) public infixr 5 _∷_ pattern _∷_ x xs = Kleene.∹ x Kleene.& xs scanr : ∀ {a b} {A : Set a} {B : Set b} → (A → B → B) → B → List A → List B scanr f b xs = Kleene.∹ Kleene.scanr⋆ f b xs scanl : ∀ {a b} {A : Set a} {B : Set b} → (B → A → B) → B → List A → List B scanl f b xs = Kleene.∹ Kleene.scanl⋆ f b xs tails : ∀ {a} {A : Set a} → List A → List (List A) tails xs = foldr (λ x xs → (Kleene.∹ x) ∷ xs) ([] ∷ []) (Kleene.tails⋆ xs) import Data.List.Kleene.Syntax module Syntax = Data.List.Kleene.Syntax using (_]; _,_) renaming (⋆[_ to [_)
module ParseIntegerList import Oyster.Core nats : Parser (List Int) nats = do symbol "[" d <- integer ds <- many (do symbol "," ; integer) symbol "]" pure (d :: ds) partial main : IO () main = do input <- getLine printLn (parse nats input)
# Authors: Alexandre Gramfort <[email protected]> # # License: BSD (3-clause) # %% import numpy as np import matplotlib.pyplot as plt import mne from mne.time_frequency import tfr_morlet from mne.stats import permutation_cluster_1samp_test, spatio_temporal_cluster_1samp_test from mne.datasets import sample print(__doc__) data_path = sample.data_path() raw_fname = data_path + '/MEG/sample/sample_audvis_raw.fif' tmin, tmax, event_id = -0.3, 0.6, 1 # Setup for reading the raw data raw = mne.io.read_raw_fif(raw_fname) events = mne.find_events(raw, stim_channel='STI 014') include = [] raw.info['bads'] += ['MEG 2443', 'EEG 053'] # bads + 2 more # picks MEG gradiometers picks = mne.pick_types(raw.info, meg='grad', eeg=False, eog=True, stim=False, include=include, exclude='bads') # Load condition 1 event_id = 1 epochs = mne.Epochs(raw, events, event_id, tmin, tmax, picks=picks, baseline=(None, 0), preload=True, reject=dict(grad=4000e-13, eog=150e-6)) # just use right temporal sensors for speed epochs.pick_channels(mne.read_selection('Right-temporal')) evoked = epochs.average() # Factor to down-sample the temporal dimension of the TFR computed by # tfr_morlet. Decimation occurs after frequency decomposition and can # be used to reduce memory usage (and possibly computational time of downstream # operations such as nonparametric statistics) if you don't need high # spectrotemporal resolution. decim = 5 freqs = np.arange(8, 40, 2) # define frequencies of interest sfreq = raw.info['sfreq'] # sampling in Hz tfr_epochs = tfr_morlet(epochs, freqs, n_cycles=4., decim=decim, average=False, return_itc=False, n_jobs=1) # Baseline power tfr_epochs.apply_baseline(mode='logratio', baseline=(-.100, 0)) # Crop in time to keep only what is between 0 and 400 ms evoked.crop(-0.1, 0.4) tfr_epochs.crop(-0.1, 0.4) epochs_power = tfr_epochs.data sensor_adjacency, ch_names = mne.channels.find_ch_connectivity( tfr_epochs.info, 'grad') # Subselect the channels we are actually using use_idx = [ch_names.index(ch_name.replace(' ', '')) for ch_name in tfr_epochs.ch_names] sensor_adjacency = sensor_adjacency[use_idx][:, use_idx] assert sensor_adjacency.shape == \ (len(tfr_epochs.ch_names), len(tfr_epochs.ch_names)) assert epochs_power.data.shape == ( len(epochs), len(tfr_epochs.ch_names), len(tfr_epochs.freqs), len(tfr_epochs.times)) adjacency = mne.stats.combine_adjacency( sensor_adjacency, len(tfr_epochs.freqs), len(tfr_epochs.times)) # our adjacency is square with each dim matching the data size assert adjacency.shape[0] == adjacency.shape[1] == \ len(tfr_epochs.ch_names) * len(tfr_epochs.freqs) * len(tfr_epochs.times) # %% threshold = 3. n_permutations = 50 # Warning: 50 is way too small for real-world analysis. # T_obs, clusters, cluster_p_values, H0 = \ # permutation_cluster_1samp_test(epochs_power, n_permutations=n_permutations, # threshold=threshold, tail=0, # connectivity=None, # out_type='mask', verbose=True) T_obs, clusters, cluster_p_values, H0 = \ spatio_temporal_cluster_1samp_test(epochs_power, n_permutations=n_permutations, threshold=threshold, tail=0, connectivity=None, out_type='mask', verbose=True) # %%
State Before: C : Type u inst✝ : Category C X : SimplicialObject C n : ℕ i : Fin (n + 3) j : Fin (n + 2) H : Fin.succ j < i hi : i = 0 ⊢ False State After: no goals Tactic: simp only [Fin.not_lt_zero, hi] at H State Before: C : Type u inst✝ : Category C X : SimplicialObject C n : ℕ i : Fin (n + 3) j : Fin (n + 2) H : Fin.succ j < i ⊢ σ X j ≫ δ X i = δ X (Fin.pred i (_ : i = 0 → False)) ≫ σ X (Fin.castLT j (_ : ↑j < n + 1)) State After: C : Type u inst✝ : Category C X : SimplicialObject C n : ℕ i : Fin (n + 3) j : Fin (n + 2) H : Fin.succ j < i ⊢ X.map (SimplexCategory.σ j).op ≫ X.map (SimplexCategory.δ i).op = X.map (SimplexCategory.δ (Fin.pred i (_ : i = 0 → False))).op ≫ X.map (SimplexCategory.σ (Fin.castLT j (_ : ↑j < n + 1))).op Tactic: dsimp [δ, σ] State Before: C : Type u inst✝ : Category C X : SimplicialObject C n : ℕ i : Fin (n + 3) j : Fin (n + 2) H : Fin.succ j < i ⊢ X.map (SimplexCategory.σ j).op ≫ X.map (SimplexCategory.δ i).op = X.map (SimplexCategory.δ (Fin.pred i (_ : i = 0 → False))).op ≫ X.map (SimplexCategory.σ (Fin.castLT j (_ : ↑j < n + 1))).op State After: no goals Tactic: simp only [← X.map_comp, ← op_comp, SimplexCategory.δ_comp_σ_of_gt' H]
subroutine proc_allo use hydrograph_module implicit none call ru_allo call aqu_read call aqu_initial call aqu_read_init return end subroutine proc_allo
[STATEMENT] lemma kc_8x8_si: "step_in kc8x8 (2,7) (4,8)" (is "step_in ?ps _ _") [PROOF STATE] proof (prove) goal (1 subgoal): 1. step_in kc8x8 (2, 7) (4, 8) [PROOF STEP] proof - [PROOF STATE] proof (state) goal (1 subgoal): 1. step_in kc8x8 (2, 7) (4, 8) [PROOF STEP] have "0 < (4::nat)" "4 < length ?ps" "last (take 4 ?ps) = (2,7)" "hd (drop 4 ?ps) = (4,8)" [PROOF STATE] proof (prove) goal (1 subgoal): 1. (0 < 4 &&& 4 < length kc8x8) &&& last (take 4 kc8x8) = (2, 7) &&& hd (drop 4 kc8x8) = (4, 8) [PROOF STEP] by eval+ [PROOF STATE] proof (state) this: 0 < 4 4 < length kc8x8 last (take 4 kc8x8) = (2, 7) hd (drop 4 kc8x8) = (4, 8) goal (1 subgoal): 1. step_in kc8x8 (2, 7) (4, 8) [PROOF STEP] then [PROOF STATE] proof (chain) picking this: 0 < 4 4 < length kc8x8 last (take 4 kc8x8) = (2, 7) hd (drop 4 kc8x8) = (4, 8) [PROOF STEP] show ?thesis [PROOF STATE] proof (prove) using this: 0 < 4 4 < length kc8x8 last (take 4 kc8x8) = (2, 7) hd (drop 4 kc8x8) = (4, 8) goal (1 subgoal): 1. step_in kc8x8 (2, 7) (4, 8) [PROOF STEP] unfolding step_in_def [PROOF STATE] proof (prove) using this: 0 < 4 4 < length kc8x8 last (take 4 kc8x8) = (2, 7) hd (drop 4 kc8x8) = (4, 8) goal (1 subgoal): 1. \<exists>k>0. k < length kc8x8 \<and> last (take k kc8x8) = (2, 7) \<and> hd (drop k kc8x8) = (4, 8) [PROOF STEP] by blast [PROOF STATE] proof (state) this: step_in kc8x8 (2, 7) (4, 8) goal: No subgoals! [PROOF STEP] qed
lemma homotopic_with_imp_continuous_maps: assumes "homotopic_with P X Y f g" shows "continuous_map X Y f \<and> continuous_map X Y g"
function [ projdata ] = fiff_read_proj(fid,node) % % [ projdata ] = fiff_read_proj(fid,node) % % Read the SSP data under a given directory node % % % Author : Matti Hamalainen, MGH Martinos Center % License : BSD 3-clause % % % Revision 1.7 2006/05/16 00:39:32 msh % Fixed error in mne_ex_read_raw: All projection items were not activated. % List the initial states of projection items when they are loaded. % % Revision 1.6 2006/04/23 15:29:40 msh % Added MGH to the copyright % % Revision 1.5 2006/04/21 15:06:03 msh % Do not list projection item status because it might be confusing. % % Revision 1.4 2006/04/21 14:43:59 msh % Report projection operators. % Some more checks in raw data reading. % % Revision 1.3 2006/04/18 20:44:46 msh % Added reading of forward solution. % Use length instead of size when appropriate % % Revision 1.2 2006/04/12 10:29:02 msh % Made evoked data writing compatible with the structures returned in reading. % % Revision 1.1 2006/04/10 23:26:54 msh % Added fiff reading routines % % global FIFF; if isempty(FIFF) FIFF = fiff_define_constants(); end me='MNE:fiff_read_proj'; if nargin ~= 2 error(me,'Incorrect number of arguments'); end projdata = struct('kind',{},'active',{},'desc',{},'data',{}); % % Locate the projection data % nodes = fiff_dir_tree_find(node,FIFF.FIFFB_PROJ); if length(nodes) == 0 return; end tag = find_tag(nodes(1),FIFF.FIFF_NCHAN); if ~isempty(tag) global_nchan = tag.data; end items = fiff_dir_tree_find(nodes(1),FIFF.FIFFB_PROJ_ITEM); for i = 1:length(items) % % Find all desired tags in one item % item = items(i); tag = find_tag(item,FIFF.FIFF_NCHAN); if ~isempty(tag) nchan = tag.data; else nchan = global_nchan; end tag = find_tag(item,FIFF.FIFF_DESCRIPTION); if ~isempty(tag) desc = tag.data; else tag = find_tag(item,FIFF.FIFF_NAME); if ~isempty(tag) desc = tag.data; else error(me,'Projection item description missing'); end end tag = find_tag(item,FIFF.FIFF_PROJ_ITEM_CH_NAME_LIST); if ~isempty(tag) namelist = tag.data; else error(me,'Projection item channel list missing'); end tag = find_tag(item,FIFF.FIFF_PROJ_ITEM_KIND); if ~isempty(tag) kind = tag.data; else error(me,'Projection item kind missing'); end tag = find_tag(item,FIFF.FIFF_PROJ_ITEM_NVEC); if ~isempty(tag) nvec = tag.data; else error(me,'Number of projection vectors not specified'); end tag = find_tag(item,FIFF.FIFF_PROJ_ITEM_CH_NAME_LIST); if ~isempty(tag) names = fiff_split_name_list(tag.data); else error(me,'Projection item channel list missing'); end tag = find_tag(item,FIFF.FIFF_PROJ_ITEM_VECTORS); if ~isempty(tag) data = tag.data; else error(me,'Projection item data missing'); end tag = find_tag(item,FIFF.FIFF_MNE_PROJ_ITEM_ACTIVE); if ~isempty(tag) active = tag.data; else active = false; end if size(data,2) ~= length(names) error(me,'Number of channel names does not match the size of data matrix'); end one.kind = kind; one.active = active; one.desc = desc; % % Use exactly the same fields in data as in a named matrix % one.data.nrow = nvec; one.data.ncol = nchan; one.data.row_names = []; one.data.col_names = names; one.data.data = data; % projdata(i) = one; end if length(projdata) > 0 fprintf(1,'\tRead a total of %d projection items:\n', ... length(projdata)); for k = 1:length(projdata) fprintf(1,'\t\t%s (%d x %d)',projdata(k).desc, ... projdata(k).data.nrow,projdata(k).data.ncol); if projdata(k).active fprintf(1,' active\n'); else fprintf(1,' idle\n'); end end end return; function [tag] = find_tag(node,findkind) for p = 1:node.nent if node.dir(p).kind == findkind tag = fiff_read_tag(fid,node.dir(p).pos); return; end end tag = []; end end
// // keyvi - A key value store. // // Copyright 2015 Hendrik Muhs<[email protected]> // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // /* * fsa_transform_test.cpp * * Created on: Apr 8, 2015 * Author: hendrik */ #include <boost/make_shared.hpp> #include <boost/test/unit_test.hpp> #include "keyvi/testing/temp_dictionary.h" #include "keyvi/transform/fsa_transform.h" namespace keyvi { namespace transform { BOOST_AUTO_TEST_SUITE(FSATransformTests) BOOST_AUTO_TEST_CASE(Normalize) { std::vector<std::pair<std::string, std::string>> test_data = { {"aa", "b"}, {"c", "d"}, {"caa", "ef"}, {"a", "g"}, }; testing::TempDictionary dictionary(&test_data); auto transformer = FsaTransform(dictionary.GetFsa()); std::string input = "aa "; BOOST_CHECK_EQUAL("b ", transformer.Normalize(input)); input = "aa"; BOOST_CHECK_EQUAL("b", transformer.Normalize(input)); input = "caaa"; BOOST_CHECK_EQUAL("efg", transformer.Normalize(input)); input = "aaa"; BOOST_CHECK_EQUAL("bg", transformer.Normalize(input)); input = "cac"; BOOST_CHECK_EQUAL("dgd", transformer.Normalize(input)); input = "dcac"; BOOST_CHECK_EQUAL("ddgd", transformer.Normalize(input)); } BOOST_AUTO_TEST_CASE(NormalizePartialAtEnd) { std::vector<std::pair<std::string, std::string>> test_data = {{"aa", "x"}, {"aabc", "y"}}; testing::TempDictionary dictionary(&test_data); boost::shared_ptr<dictionary::Dictionary> d = boost::make_shared<dictionary::Dictionary>(dictionary.GetFsa()); auto transformer = FsaTransform(d); std::string input = "aab"; BOOST_CHECK_EQUAL("xb", transformer.Normalize(input)); } BOOST_AUTO_TEST_SUITE_END() } // namespace transform } // namespace keyvi
#!/usr/bin/python3 # Copyright (C) 2017 Infineon Technologies & pmdtechnologies ag # # THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY # KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A # PARTICULAR PURPOSE. """This sample shows how to shows how to capture image data. It uses Python's numpy and matplotlib to process and display the data. """ import sys import tensorflow as tf import argparse #import cv2 from random import * import time import queue from sample_camera_info import print_camera_info from roypy_sample_utils import CameraOpener, add_camera_opener_options from roypy_platform_utils import PlatformHelper from utils import label_map_util from utils import visualization_utils_color as vis_util from utils import vis_depth_util from utils.model_util import TensorflowFaceDetector import roypy import numpy as np import matplotlib.pyplot as plt print('Setting up paths') # Path to frozen detection graph. This is the actual model that is used for the object detection. PATH_TO_CKPT = 'frozen_inference_graph.pb' # List of the strings that is used to add correct label for each box. PATH_TO_LABELS = 'seed_label_map.pbtxt' NUM_CLASSES = 2 print('Loading labelmaps') label_map = label_map_util.load_labelmap(PATH_TO_LABELS) categories = label_map_util.convert_label_map_to_categories(label_map, max_num_classes=NUM_CLASSES, use_display_name=True) category_index = label_map_util.create_category_index(categories) tDetector = TensorflowFaceDetector(PATH_TO_CKPT) class MyListener(roypy.IDepthDataListener): def __init__(self, q, q2): super(MyListener, self).__init__() self.queue = q self.queue2 = q2 def onNewData(self, data): zvalues = [] gvalues = [] for i in range(data.getNumPoints()): zvalues.append(data.getZ(i)) gvalues.append(data.getGrayValue(i)) zarray = np.asarray(zvalues) garray = np.asarray(gvalues) p = zarray.reshape (-1, data.width) print(p) self.queue.put(p) p = garray.reshape (-1, data.width) self.queue2.put(p) def paint (self, data, data2): """Called in the main thread, with data containing one of the items that was added to the queue in onNewData. """ # create a figure and show the raw data #cmap1 = Colormap plt.figure(1) plt.subplot(211) plt.imshow(data) plt.subplot(212) plt.imshow(data2, cmap="gray") plt.show(block = False) plt.draw() # this pause is needed to ensure the drawing for # some backends plt.pause(0.001) def main (): platformhelper = PlatformHelper() parser = argparse.ArgumentParser (usage = __doc__) add_camera_opener_options (parser) parser.add_argument ("--seconds", type=int, default=15, help="duration to capture data") options = parser.parse_args() opener = CameraOpener (options) cam = opener.open_camera () cam.setUseCase("MODE_5_45FPS_500") cam.setExposureTime(80) print_camera_info (cam) print("isConnected", cam.isConnected()) print("getFrameRate", cam.getFrameRate()) # we will use this queue to synchronize the callback with the main # thread, as drawing should happen in the main thread q = queue.Queue() q2 = queue.Queue() l = MyListener(q, q2) cam.registerDataListener(l) cam.startCapture() # create a loop that will run for a time (default 15 seconds) process_event_queue (q, q2, l, options.seconds) cam.stopCapture() def process_event_queue (q, q2, painter, seconds): # create a loop that will run for the given amount of time t_end = time.time() + seconds while time.time() < t_end: try: # try to retrieve an item from the queue. # this will block until an item can be retrieved # or the timeout of 1 second is hit item = q.get(True, 1) item2 = q2.get(True, 1) (boxes, scores, classes, num_detections) = tDetector.run(item2) # Draws bounding boxes vis_util.visualize_boxes_and_labels_on_image_array( item2, np.squeeze(boxes), np.squeeze(classes).astype(np.int32), np.squeeze(scores), category_index, use_normalized_coordinates=True, line_thickness=4) # Draws the depth information vis_depth_util.apply_depth_to_boxes(item2, np.squeeze(boxes), np.squeeze(scores), depth_frame) except queue.Empty: # this will be thrown when the timeout is hit break else: painter.paint (item, item2) if (__name__ == "__main__"): main()
/- Copyright (c) 2021 Jakob von Raumer. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Jakob von Raumer -/ import linear_algebra.contraction import linear_algebra.finite_dimensional import linear_algebra.dual /-! # The coevaluation map on finite dimensional vector spaces Given a finite dimensional vector space `V` over a field `K` this describes the canonical linear map from `K` to `V ⊗ dual K V` which corresponds to the identity function on `V`. ## Tags coevaluation, dual module, tensor product ## Future work * Prove that this is independent of the choice of basis on `V`. -/ noncomputable theory section coevaluation open tensor_product finite_dimensional open_locale tensor_product big_operators universes u v variables (K : Type u) [field K] variables (V : Type v) [add_comm_group V] [module K V] [finite_dimensional K V] /-- The coevaluation map is a linear map from a field `K` to a finite dimensional vector space `V`. -/ def coevaluation : K →ₗ[K] V ⊗[K] (module.dual K V) := let bV := basis.of_vector_space K V in (basis.singleton unit K).constr K $ λ _, ∑ (i : basis.of_vector_space_index K V), bV i ⊗ₜ[K] bV.coord i lemma coevaluation_apply_one : (coevaluation K V) (1 : K) = let bV := basis.of_vector_space K V in ∑ (i : basis.of_vector_space_index K V), bV i ⊗ₜ[K] bV.coord i := begin simp only [coevaluation, id], rw [(basis.singleton unit K).constr_apply_fintype K], simp only [fintype.univ_punit, finset.sum_const, one_smul, basis.singleton_repr, basis.equiv_fun_apply,basis.coe_of_vector_space, one_nsmul, finset.card_singleton], end open tensor_product /-- This lemma corresponds to one of the coherence laws for duals in rigid categories, see `category_theory.monoidal.rigid`. -/ lemma contract_left_assoc_coevaluation : ((contract_left K V).rtensor _) ∘ₗ (tensor_product.assoc K _ _ _).symm.to_linear_map ∘ₗ ((coevaluation K V).ltensor (module.dual K V)) = (tensor_product.lid K _).symm.to_linear_map ∘ₗ (tensor_product.rid K _).to_linear_map := begin letI := classical.dec_eq (basis.of_vector_space_index K V), apply tensor_product.ext, apply (basis.of_vector_space K V).dual_basis.ext, intro j, apply linear_map.ext_ring, rw [linear_map.compr₂_apply, linear_map.compr₂_apply, tensor_product.mk_apply], simp only [linear_map.coe_comp, function.comp_app, linear_equiv.coe_to_linear_map], rw [rid_tmul, one_smul, lid_symm_apply], simp only [linear_equiv.coe_to_linear_map, linear_map.ltensor_tmul, coevaluation_apply_one], rw [tensor_product.tmul_sum, linear_equiv.map_sum], simp only [assoc_symm_tmul], rw [linear_map.map_sum], simp only [linear_map.rtensor_tmul, contract_left_apply], simp only [basis.coe_dual_basis, basis.coord_apply, basis.repr_self_apply, tensor_product.ite_tmul], rw [finset.sum_ite_eq'], simp only [finset.mem_univ, if_true] end /-- This lemma corresponds to one of the coherence laws for duals in rigid categories, see `category_theory.monoidal.rigid`. -/ lemma contract_left_assoc_coevaluation' : ((contract_left K V).ltensor _) ∘ₗ (tensor_product.assoc K _ _ _).to_linear_map ∘ₗ ((coevaluation K V).rtensor V) = (tensor_product.rid K _).symm.to_linear_map ∘ₗ (tensor_product.lid K _).to_linear_map := begin letI := classical.dec_eq (basis.of_vector_space_index K V), apply tensor_product.ext, apply linear_map.ext_ring, apply (basis.of_vector_space K V).ext, intro j, rw [linear_map.compr₂_apply, linear_map.compr₂_apply, tensor_product.mk_apply], simp only [linear_map.coe_comp, function.comp_app, linear_equiv.coe_to_linear_map], rw [lid_tmul, one_smul, rid_symm_apply], simp only [linear_equiv.coe_to_linear_map, linear_map.rtensor_tmul, coevaluation_apply_one], rw [tensor_product.sum_tmul, linear_equiv.map_sum], simp only [assoc_tmul], rw [linear_map.map_sum], simp only [linear_map.ltensor_tmul, contract_left_apply], simp only [basis.coord_apply, basis.repr_self_apply, tensor_product.tmul_ite], rw [finset.sum_ite_eq], simp only [finset.mem_univ, if_true] end end coevaluation
module Main where import qualified Control.Monad.Random as RndM import qualified Numeric.LinearAlgebra as LA import MachineLearning.Clustering import qualified Data.Vector as V main = do putStrLn "\n=== K-Means Sample Application ===\n" -- Step 1. Data loading. -- Step 1.1 Training Data loading. x <- LA.loadMatrix "linear_regression/data.txt" -- Step 2. Learning let numIters = 25 numClusters = 3 clusterList <- RndM.evalRandIO $ kmeans numIters x numClusters -- Step 3. Display results print $ "Successfully groupped into " ++ show (V.length clusterList) ++ " clusters"
import data.nat.basic variables (u w x x' y y' z : ℕ) (p : ℕ → Prop) example (h₁ : x + 0 = x') (h₂ : y + 0 = y') : x + y + 0 = x' + y' := by {simp at *, simp *}
Require Import ExtLib.Data.Vector. Require Import ExtLib.Structures.Functor. Set Implicit Arguments. Set Strict Implicit. Set Universe Polymorphism. Section poly. Variable typ : Set. Fixpoint polymorphic@{U} (n : nat) (T : Type@{U}) : Type@{U} := match n return Type@{U} with | 0 => T | S n => typ -> polymorphic n T end. Section polymorphicD. Context {T : Type} (TD : T -> Prop). Fixpoint polymorphicD {n} : polymorphic n T -> Prop := match n as n return polymorphic n T -> Prop with | 0 => fun p => TD p | S n => fun p => forall t, polymorphicD (p t) end. End polymorphicD. Fixpoint inst {T} (n : nat) : polymorphic n T -> vector typ n -> T := match n as n return polymorphic n T -> vector typ n -> T with | 0 => fun p _ => p | S n => fun p a => inst (p (Vector.vector_hd a)) (Vector.vector_tl a) end. Theorem inst_sound : forall {T} {n} (y: polymorphic n T) (P : T -> Prop) v, polymorphicD P y -> P (inst y v). Proof. induction n; simpl; eauto. intros; eapply IHn; eauto. Qed. Section make. Context {U : Type}. Fixpoint make_polymorphic n {struct n} : (vector typ n -> U) -> polymorphic n U := match n as n return (vector typ n -> U) -> polymorphic n U with | 0 => fun P => P (Vnil _) | S n' => fun P => fun v => (make_polymorphic (fun V => P (Vcons v V))) end. Theorem inst_make_polymorphic : forall n f v, @inst U n (make_polymorphic f) v = f v. Proof. induction v; simpl; try rewrite IHv; reflexivity. Qed. Theorem polymorphicD_make_polymorphic : forall (UD : U -> Prop) n (p : vector _ n -> _), (forall v, UD (p v)) -> polymorphicD UD (make_polymorphic p). Proof. induction n; simpl; eauto. Qed. End make. End poly. Arguments make_polymorphic {_ _ n} _. Arguments polymorphicD {_ _} _ {n} _. Section fmap_polymorphic. Context {Z : Set} {T U : Type}. Variable f : T -> U. Fixpoint fmap_polymorphic (n : nat) : polymorphic Z n T -> polymorphic Z n U := match n with | 0 => f | S n => fun x y => fmap_polymorphic n (x y) end. End fmap_polymorphic. Instance Functor_polymorphic Z n : Functor (polymorphic Z n) := { fmap := fun T U f => @fmap_polymorphic Z T U f n }. Arguments inst {typ T n} p v : clear implicits, rename. Require Import MirrorCore.Reify.ReifyClass. Section rpolymorphic. Context {T : Set} {U : Type}. Context {r : Reify U}. Fixpoint rpolymorphic n : Command (polymorphic T n U) := match n as n return Command (polymorphic T n U) with | 0 => CCall (reify_scheme U) | S n => Patterns.CPiMeta (rpolymorphic n) end. Global Instance Reify_polymorphic n : Reify (polymorphic T n U) := { reify_scheme := CCall (rpolymorphic n) }. End rpolymorphic. Arguments rpolymorphic _ _ _ _ : clear implicits.
[STATEMENT] lemma Sym_L: "insert (t EQ u) H \<turnstile> A \<Longrightarrow> insert (u EQ t) H \<turnstile> A" [PROOF STATE] proof (prove) goal (1 subgoal): 1. insert (t EQ u) H \<turnstile> A \<Longrightarrow> insert (u EQ t) H \<turnstile> A [PROOF STEP] by (metis Assume Sym Un_empty_left Un_insert_left cut)
theory ExF016 imports Main begin lemma "(\<exists>x. (P x \<longrightarrow> \<not>P(F x))) \<longrightarrow> (\<exists>x. \<not>P x)" proof - { assume a:"\<exists>x. (P x \<longrightarrow> \<not>P(F x))" { assume b:"\<not>(\<exists>x . \<not>P x )" { fix aa assume c:"P aa \<longrightarrow> \<not>P(F aa)" { assume "P aa" with c have "\<not>P (F aa)" by (rule mp) hence "\<exists>x. \<not>P (x)" by (rule exI) with b have False by contradiction } hence "\<not>P aa" by (rule notI) hence "\<exists>x. \<not>P x" by (rule exI) with b have False by contradiction } with a have False by (rule exE) } hence "\<not>\<not>(\<exists>x . \<not>P x )" by (rule notI) hence "\<exists>x . \<not>P x " by (rule notnotD) } thus ?thesis by (rule impI) qed
include("sec_6_2.jl") using PyPlot r = 3 M = 2r ppI = 40 store = Store(α, r+1, M, ppI) N = 5 t, U = FODEdG!(λ, tmax, f, u0, N, r, M, store) τ = FractionalTimeDG.reconstruction_pts(T, r) pcwise_t, pcwise_U = evaluate_pcwise_poly!(U, t, τ[0:r], store) pcwise_u = [ u(t, λ, u0, f, 10, store) for t in pcwise_t ] pcwise_err = pcwise_U - pcwise_u Uhat = reconstruction(U, u0, store) pcwise_t_fine, pcwise_Uhat = evaluate_pcwise_poly!(Uhat, t, ppI, store) pcwise_u_fine = [ u(t, λ, u0, f, 10, store) for t in pcwise_t_fine ] pcwise_rec_err = pcwise_Uhat - pcwise_u_fine pcwise_rec_err[1,1] = NaN a = FractionalTimeDG.Fourier_Legendre_coefs(r, t, store) do s return u(s, λ, u0, f, 10, store) end figure(4) trans_pcwise_t = copy(pcwise_t') trans_pcwise_err = copy(pcwise_err') line0 = semilogy(pcwise_t_fine, abs.(pcwise_rec_err), "k:") line1 = semilogy(trans_pcwise_t[:,1], abs.(trans_pcwise_err[:,1]), "o", markersize=3) line2 = semilogy(trans_pcwise_t[:,2], abs.(trans_pcwise_err[:,2]), "v", markersize=3) line3 = semilogy(trans_pcwise_t[:,3], abs.(trans_pcwise_err[:,3]), "+", markersize=4) line4 = semilogy(trans_pcwise_t[:,4], abs.(trans_pcwise_err[:,4]), "x", markersize=4) legend((line0[1], line1[1], line2[1], line3[1], line4[1]), (L"$\widehat E(t)$", L"$j=0$", L"j=1", L"j=2", L"j=3")) xlabel(L"$t$", size=12) ylabel("Error") grid(true) savefig("fig4.eps")
[STATEMENT] lemma simply_connected_sphere: fixes a :: "'a::euclidean_space" assumes "3 \<le> DIM('a)" shows "simply_connected(sphere a r)" [PROOF STATE] proof (prove) goal (1 subgoal): 1. simply_connected (sphere a r) [PROOF STEP] proof (cases rule: linorder_cases [of r 0]) [PROOF STATE] proof (state) goal (3 subgoals): 1. r < 0 \<Longrightarrow> simply_connected (sphere a r) 2. r = 0 \<Longrightarrow> simply_connected (sphere a r) 3. 0 < r \<Longrightarrow> simply_connected (sphere a r) [PROOF STEP] case less [PROOF STATE] proof (state) this: r < 0 goal (3 subgoals): 1. r < 0 \<Longrightarrow> simply_connected (sphere a r) 2. r = 0 \<Longrightarrow> simply_connected (sphere a r) 3. 0 < r \<Longrightarrow> simply_connected (sphere a r) [PROOF STEP] then [PROOF STATE] proof (chain) picking this: r < 0 [PROOF STEP] show ?thesis [PROOF STATE] proof (prove) using this: r < 0 goal (1 subgoal): 1. simply_connected (sphere a r) [PROOF STEP] by simp [PROOF STATE] proof (state) this: simply_connected (sphere a r) goal (2 subgoals): 1. r = 0 \<Longrightarrow> simply_connected (sphere a r) 2. 0 < r \<Longrightarrow> simply_connected (sphere a r) [PROOF STEP] next [PROOF STATE] proof (state) goal (2 subgoals): 1. r = 0 \<Longrightarrow> simply_connected (sphere a r) 2. 0 < r \<Longrightarrow> simply_connected (sphere a r) [PROOF STEP] case equal [PROOF STATE] proof (state) this: r = 0 goal (2 subgoals): 1. r = 0 \<Longrightarrow> simply_connected (sphere a r) 2. 0 < r \<Longrightarrow> simply_connected (sphere a r) [PROOF STEP] then [PROOF STATE] proof (chain) picking this: r = 0 [PROOF STEP] show ?thesis [PROOF STATE] proof (prove) using this: r = 0 goal (1 subgoal): 1. simply_connected (sphere a r) [PROOF STEP] by (auto simp: convex_imp_simply_connected) [PROOF STATE] proof (state) this: simply_connected (sphere a r) goal (1 subgoal): 1. 0 < r \<Longrightarrow> simply_connected (sphere a r) [PROOF STEP] next [PROOF STATE] proof (state) goal (1 subgoal): 1. 0 < r \<Longrightarrow> simply_connected (sphere a r) [PROOF STEP] case greater [PROOF STATE] proof (state) this: 0 < r goal (1 subgoal): 1. 0 < r \<Longrightarrow> simply_connected (sphere a r) [PROOF STEP] then [PROOF STATE] proof (chain) picking this: 0 < r [PROOF STEP] show ?thesis [PROOF STATE] proof (prove) using this: 0 < r goal (1 subgoal): 1. simply_connected (sphere a r) [PROOF STEP] using simply_connected_sphere_gen [of "cball a r"] assms [PROOF STATE] proof (prove) using this: 0 < r \<lbrakk>convex (cball a r); bounded (cball a r); 3 \<le> aff_dim (cball a r)\<rbrakk> \<Longrightarrow> simply_connected (rel_frontier (cball a r)) 3 \<le> DIM('a) goal (1 subgoal): 1. simply_connected (sphere a r) [PROOF STEP] by (simp add: aff_dim_cball) [PROOF STATE] proof (state) this: simply_connected (sphere a r) goal: No subgoals! [PROOF STEP] qed
lemma split_01_prod: "{0..1::real} \<times> X = ({0..1/2} \<times> X) \<union> ({1/2..1} \<times> X)"
Formal statement is: lemma fract_poly_add [simp]: "fract_poly (p + q) = fract_poly p + fract_poly q" Informal statement is: The fractional part of a sum of two polynomials is the sum of the fractional parts of the polynomials.
using MathProgBase, Ipopt, StatsBase, PyPlot, LaTeXStrings, Base.Iterators.cycle, Clp PyPlot.matplotlib[:rcParams]["figure.autolayout"] = "True" srand(0) PyPlot.matplotlib[:rc]("font", family="serif", serif="Times", size=16) global_width = 3 type RFTL x eta projection end function update(rftl, gradient) rftl.x = rftl.projection(rftl.x + rftl.eta * gradient) end function get_vector(rftl) return rftl.x end function play_sound() if is_apple() run(`say "your program has finished"`) end end function my_show() if is_apple() show() end end function gibbs_sampler(A, b, x) n = size(A)[2] for iter in 1:n * 3 j = rand(1:n) x_copy = x x_copy[j] = 0 max_coord = minimum((b - A * x_copy) ./ A[:, j]) max_coord = min(max_coord, 1) x[j] = rand() * max_coord end return x end function meta_frank_wolfe(dim_lam, X_list, projection, f, gradient, eta, T, K) x0 = zeros(dim_lam) rftl = [RFTL(x0, eta, projection) for k in 1:K] reward = [] for t in 1:T X = X_list[t] v = [get_vector(rftl[k]) for k in 1:K] x = zeros(K + 1, dim_lam) for k in 1:K update(rftl[k], gradient(x[k, :], X)) x[k + 1, :] = x[k, :] + v[k] / K end push!(reward, f(x[K + 1, :], X)) end reward = cumsum(reward) return reward end function frank_wolfe(dim_lam, X, A, b, f, gradient, K) x = zeros(dim_lam) for k in 1:K grad_x = gradient(x, X) sol = linprog(-grad_x, A, '<', b, 0.0, 1.0, ClpSolver()) if sol.status == :Optimal v = sol.sol else error("No solution was found.") end x += v / K end return x end function frank_wolfe2(dim_lam, A, b, gradient, K) x = zeros(dim_lam) for k in 1:K grad_x = gradient(x) sol = linprog(-grad_x, A, '<', b, 0.0, 1.0, ClpSolver()) if sol.status == :Optimal v = sol.sol else error("No solution was found.") end x += v / K end return x end function online_gradient_ascent(dim_lam, X_list, projection, f, gradient, eta, T) x0 = zeros(dim_lam) rftl = RFTL(x0, eta, projection) reward = [] for t in 1:T X = X_list[t] v = get_vector(rftl) push!(reward, f(v, X)) update(rftl, gradient(v, X)) end reward = cumsum(reward) return reward end function online_random(dim_lam, X_list, f, linear_projection, T) reward = [] for t in 1:T X = X_list[t] v = rand(dim_lam) v = linear_projection(v) push!(reward, f(v, X)) end reward = cumsum(reward) return reward end function online_random_gibbs(dim_lam, X_list, f, A, b, T) reward = zeros(T) gibbs_v = zeros(size(A)[2]) for t in 1:T X = X_list[t] for j in 1:100 gibbs_v = gibbs_sampler(A, b, gibbs_v) reward[t] = max(reward[t], f(gibbs_v, X)) end end reward = cumsum(reward) return reward end function generate_projection_function(A, b) n = size(A)[2] function projection(x0) sol = quadprog(-x0, eye(n), A, '<', b, 0.0, 1.0, IpoptSolver(print_level=0)) if sol.status == :Optimal return sol.sol end error("No solution was found.") end return projection end function offline(X_list, f, gradient, A, b, K) T = length(X_list) reward = zeros(T) gradient_cumul = x->sum([gradient(x, params) for params in X_list]) v = frank_wolfe2(size(A)[2], A, b, gradient_cumul, K) for i in 1:T reward[i] = f(v, X_list[i]) end return cumsum(reward) end function experiment_coverage(size_U, n_sets, T, K) function generate_a_param() B = [] for i in 1:n_sets lo = round(Int, size_U * 0.2) hi = round(Int, size_U * 0.8) set_size = rand(lo:hi) push!(B, IntSet(sample(1:size_U, set_size, replace=false))) end w = rand(size_U) * 100 return (B, w) end X_list = [generate_a_param() for i in 1:T] function f_cover(x, params) B = params[1] w = params[2] res = 0 for u in 1:size_U prod = 1 for i in 1:n_sets if u in B[i] prod *= (1 - x[i]) end end res += w[u] * (1 - prod) end return res end function concave_f(x) res = 0 for u in 1:size_U res += w[u] * min(1, sum([x[i] for i in xrange(n_sets) if u in B[i]])) end return res end function partial(x, i, B, w) res = 0 for u in 1:size_U prod = 1 for j in 1:n_sets if j != i && u in B[j] prod *= (1 - x[j]) end end res += w[u] * prod end return res end function gradient_cover(x, params) B = params[1] w = params[2] res = zeros(n_sets) for i in 1:n_sets res[i] = partial(x, i, B, w) end return res end function stochastic_gradient_cover(x, params) B = params[1] w = params[2] function func(S) if isempty(S) return 0 end all_sets = [B[i] for i in S] union_set = reduce(union, all_sets) return sum([w[i] for i in union_set]) end function gradient_i(i) R = [j for j in 1:n_sets if j != i && rand() < x[j]] R_i = vcat(R, [i]) return func(R_i) - func(R) end grad = zeros(n_sets) for i in 1:n_sets grad[i] = gradient_i(i) end return grad end function gradient_concave(x, params) B = params[1] w = params[2] function partial_concave(i) res = 0 for u in 1:size_U if !(u in B[i]) continue end if sum([x[j] for j in 1:n_sets if u in B[j]]) <= 1 res += w[u] end end return res end grad = zeros(n_sets) for i in 1:n_sets grad[i] = partial_concave(i) end return grad end n_constraints = 2 A = rand(n_constraints, n_sets) b = 1.0 linear_projection = generate_projection_function(A, b) reward_offline = offline(X_list, f_cover, gradient_cover, A, b, K) println(reward_offline) function generate_figure_regret() reward_list = [] push!(reward_list, reward_offline - meta_frank_wolfe(n_sets, X_list, linear_projection, f_cover, gradient_cover, 0.1, T, K)) push!(reward_list, reward_offline - meta_frank_wolfe(n_sets, X_list, linear_projection, f_cover, gradient_cover, 0.01, T, K)) push!(reward_list, reward_offline - online_gradient_ascent(n_sets, X_list, linear_projection, f_cover, gradient_cover, 0.1, T)) push!(reward_list, reward_offline - online_gradient_ascent(n_sets, X_list, linear_projection, f_cover, gradient_cover, 0.01, T)) push!(reward_list, reward_offline - online_gradient_ascent(n_sets, X_list, linear_projection, f_cover, gradient_concave, 0.1, T)) push!(reward_list, reward_offline - online_gradient_ascent(n_sets, X_list, linear_projection, f_cover, gradient_concave, 0.01, T)) push!(reward_list, reward_offline - online_random_gibbs(n_sets, X_list, f_cover, A, b, T)) labels = [L"FW ($\eta=0.1$)", L"FW ($\eta=0.01$)", L"GA ($\eta=0.1$)", L"GA ($\eta=0.01$)", L"SurrGA ($\eta=0.1$)", L"SurrGA ($\eta=0.01$)", "OfflApprMax"] marker = cycle((".", ",", "+", "_", "o", "x", "*")) linecycler = cycle(("-", "--", "-.", ":")) println(reward_list) for zipped in zip(reward_list, labels, marker, linecycler) reward, label, marker_iter, line_iter = zipped plot(1:T, reward, label=label, linestyle=line_iter, linewidth=global_width) end ticklabel_format(style="sci", axis="y", scilimits=(0, 0)) legend(loc="best") xlabel("Iteration index") ylabel(L"$(1-1/e)$-Regret") grid() # savefig("coverage_regret_T2.pdf") my_show() end function generate_figure_regret_stochastic() reward_list = [] push!(reward_list, reward_offline - meta_frank_wolfe(n_sets, X_list, linear_projection, f_cover, stochastic_gradient_cover, 0.1, T, K)) push!(reward_list, reward_offline - meta_frank_wolfe(n_sets, X_list, linear_projection, f_cover, stochastic_gradient_cover, 0.01, T, K)) push!(reward_list, reward_offline - online_gradient_ascent(n_sets, X_list, linear_projection, f_cover, stochastic_gradient_cover, 0.1, T)) push!(reward_list, reward_offline - online_gradient_ascent(n_sets, X_list, linear_projection, f_cover, stochastic_gradient_cover, 0.01, T)) push!(reward_list, reward_offline - online_gradient_ascent(n_sets, X_list, linear_projection, f_cover, gradient_concave, 0.1, T)) push!(reward_list, reward_offline - online_gradient_ascent(n_sets, X_list, linear_projection, f_cover, gradient_concave, 0.01, T)) push!(reward_list, reward_offline - online_random_gibbs(n_sets, X_list, f_cover, A, b, T)) labels = [L"FW ($\eta=0.1$)", L"FW ($\eta=0.01$)", L"GA ($\eta=0.1$)", L"GA ($\eta=0.01$)", L"SurrGA ($\eta=0.1$)", L"SurrGA ($\eta=0.01$)", "OfflApprMax"] marker = cycle((".", ",", "+", "_", "o", "x", "*")) linecycler = cycle(("-", "--", "-.", ":")) println(reward_list) for zipped in zip(reward_list, labels, marker, linecycler) reward, label, marker_iter, line_iter = zipped plot(1:T, reward, label=label, linestyle=line_iter, linewidth=global_width) end ticklabel_format(style="sci", axis="y", scilimits=(0, 0)) legend(loc="best") xlabel("Iteration index") ylabel(L"$(1-1/e)$-Regret") grid() # savefig("stoch_coverage_regret_T2.pdf") my_show() end # generate_figure_regret() generate_figure_regret_stochastic() end function experiment_nqp(dim_x, T, K) function generate_a_param(dim_x, alpha=100) return rand(dim_x, dim_x) * (-alpha) end n_constraints = 2 A = rand(n_constraints, dim_x) b = 1.0 linear_projection = generate_projection_function(A, b) function f_nqp(x, H) return ((x / 2 - 1)' * H * x) end function gradient_nqp(x, H) return (H + H') / 2 * x - H' * ones(dim_x) end function generate_figure_regret() all_reward_lists = [] for experiment_iter in 1:1 X_list = [generate_a_param(dim_x) for i in 1:T] reward_offline = offline(X_list, f_nqp, gradient_nqp, A, b, K) reward_list = [] push!(reward_list, reward_offline - meta_frank_wolfe(dim_x, X_list, linear_projection, f_nqp, gradient_nqp, 0.001, T, K)) push!(reward_list, reward_offline - meta_frank_wolfe(dim_x, X_list, linear_projection, f_nqp, gradient_nqp, 0.0008, T, K)) push!(reward_list, reward_offline - online_gradient_ascent(dim_x, X_list, linear_projection, f_nqp, gradient_nqp, 0.001, T)) push!(reward_list, reward_offline - online_gradient_ascent(dim_x, X_list, linear_projection, f_nqp, gradient_nqp, 0.0008, T)) push!(all_reward_lists, reward_list) end all_reward_lists = mean(all_reward_lists) labels = [L"FW ($\eta=0.1$)", L"FW ($\eta=0.01$)", L"GA ($\eta=0.1$)", L"GA ($\eta=0.01$)"] marker = cycle((".", ",", "+", "_", "o", "x", "*")) linecycler = cycle(("-", "--", "-.", ":")) println(all_reward_lists) for zipped in zip(all_reward_lists, labels, marker, linecycler) reward, label, marker_iter, line_iter = zipped plot(1:T, reward, label=label, linestyle=line_iter, linewidth=global_width) end ticklabel_format(style="sci", axis="y", scilimits=(0, 0)) legend(loc="best") xlabel("Iteration index") ylabel(L"$(1-1/e)$-Regret") grid() play_sound() my_show() end function generate_figure_regret_dim(alpha) dim_x_list = 5:5:50 all_reward_lists = [] reward_list = zeros(4, size(dim_x_list)[1]) for experiment_iter in 1:5 for (idx, dim_x) in enumerate(dim_x_list) tic() println("parameter\t", idx, ", ", dim_x) X_list = [generate_a_param(dim_x, alpha) for i in 1:T] A = rand(n_constraints, dim_x) b = 1.0 linear_projection = generate_projection_function(A, b) X_list_sum = sum(X_list) v = frank_wolfe(dim_x, X_list_sum, A, b, f_nqp, gradient_nqp, K) reward_offline = f_nqp(v, X_list_sum) reward_list[:, idx] = reward_offline - [meta_frank_wolfe(dim_x, X_list, linear_projection, f_nqp, gradient_nqp, 0.001, T, K)[end], meta_frank_wolfe(dim_x, X_list, linear_projection, f_nqp, gradient_nqp, 0.0008, T, K)[end], online_gradient_ascent(dim_x, X_list, linear_projection, f_nqp, gradient_nqp, 0.001, T)[end], online_gradient_ascent(dim_x, X_list, linear_projection, f_nqp, gradient_nqp, 0.0008, T)[end]] toc() end push!(all_reward_lists, reward_list) end reward_list = mean(all_reward_lists) reward_list = [reward_list[i, :] for i in 1:size(reward_list)[1]] labels = [L"FW ($\eta=0.1$)", L"FW ($\eta=0.01$)", L"GA ($\eta=0.1$)", L"GA ($\eta=0.01$)"] marker = cycle((".", ",", "+", "_", "o", "x", "*")) linecycler = cycle(("-", "--", "-.", ":")) print(reward_list) for zipped in zip(reward_list, labels, marker, linecycler) reward, label, marker_iter, line_iter = zipped plot(dim_x_list, reward, label=label, linestyle=line_iter, linewidth=global_width) end legend(loc="best") ticklabel_format(style="sci", axis="y", scilimits=(0, 0)) xlabel(L"Dimension of $\mathbf{x}$") ylabel(L"$(1-1/e)$-Regret") grid() play_sound() my_show() end generate_figure_regret() # generate_figure_regret_dim(1) end function experiment_design(dim_lam, dim_x_vectors, T, K) function generate_a_param(dim_lam, dim_x_vectors) mat = randn(dim_x_vectors, dim_lam) return mat end X_list = [generate_a_param(dim_lam, dim_x_vectors) for i in 1:T] n_constraints = 2 A = rand(n_constraints, dim_lam) b = 1.0 linear_projection = generate_projection_function(A, b) offset_constant = 1 multp = 1 function f(lam, X) lam += offset_constant lam *= multp M = 0 for i in 1:dim_lam M += lam[i] * X[:, i] * X[:, i]' end return log(det(M)) end function gradient(lam, X) lam += offset_constant lam *= multp M = 0 for i in 1:dim_lam M += lam[i] * X[:, i] * X[:, i]' end grad = zeros(lam) for i in 1:size(lam)[1] grad[i] = X[:, i]' * inv(M) * X[:, i] end return grad end function gradient_orth(lam, X) return 1 ./ (lam + offset_constant) end function f_a(lam, X) lam += offset_constant M = 0 for i in 1:dim_lam M += lam[i] * X[:, i] * X[:, i]' end return -trace(inv(M)) end function gradient_a(lam, X) lam += offset_constant M = 0 for i in 1:dim_lam M += lam[i] * X[:, i] * X[:, i]' end inv_M = inv(M) grad = zeros(lam) for i in 1:size(lam)[1] grad[i] = norm(inv_M * X[:, i])^2 end return grad end function generate_figure_regret(f, gradient) reward_list = [] reward_offline = offline(X_list, f, gradient, A, b, K) println(reward_offline) push!(reward_list, reward_offline - meta_frank_wolfe(dim_lam, X_list, linear_projection, f, gradient, 0.8, T, K)) push!(reward_list, reward_offline - meta_frank_wolfe(dim_lam, X_list, linear_projection, f, gradient, 1, T, K)) push!(reward_list, reward_offline - online_gradient_ascent(dim_lam, X_list, linear_projection, f, gradient, 0.8, T)) push!(reward_list, reward_offline - online_gradient_ascent(dim_lam, X_list, linear_projection, f, gradient, 1, T)) labels = [L"FW ($\eta=200$)", L"FW ($\eta=100$)", L"GA ($\eta=200$)", L"GA ($\eta=100$)", "OfflApprMax"] marker = cycle((".", ",", "+", "_", "o", "x", "*")) linecycler = cycle(("-", "--", "-.", ":")) print(reward_list) for zipped in zip(reward_list, labels, marker, linecycler) reward, label, marker_iter, line_iter = zipped plot(1:T, reward, label=label, linestyle=line_iter, linewidth=global_width) end ticklabel_format(style="sci", axis="y", scilimits=(0, 0)) legend(loc="best") xlabel("Iteration index") ylabel(L"$(1-1/e)$-Regret") grid() play_sound() my_show() end function generate_figure_regret_K() param_list = 1:20 function f_cum(x) return sum([f(x, params) for params in X_list]) end function gradient_cum(x) return sum([gradient(x, params) for params in X_list]) end v = frank_wolfe2(dim_lam, A, b, gradient_cum, K) reward_offline = f_cum(v) ga1 = online_gradient_ascent(dim_lam, X_list, linear_projection, f, gradient, 0.8, T)[end] ga2 = online_gradient_ascent(dim_lam, X_list, linear_projection, f, gradient, 1, T)[end] reward_list = zeros(4, size(param_list)[1]) for (idx, K) in enumerate(param_list) idx_th_col = reward_offline - [meta_frank_wolfe(dim_lam, X_list, linear_projection, f, gradient, 0.8, T, K)[end], meta_frank_wolfe(dim_lam, X_list, linear_projection, f, gradient, 1, T, K)[end], ga1, ga2] reward_list[:, idx] = idx_th_col end reward_list = [reward_list[i, :] for i in 1:size(reward_list)[1]] labels = [L"FW ($\eta=200$)", L"FW ($\eta=100$)", L"GA ($\eta=200$)", L"GA ($\eta=100$)"] marker = cycle((".", ",", "+", "_", "o", "x", "*")) linecycler = cycle(("-", "--", "-.", ":")) print(reward_list) for zipped in zip(reward_list, labels, marker, linecycler) reward, label, marker_iter, line_iter = zipped plot(param_list, reward, label=label, linestyle=line_iter, linewidth=global_width) end legend(loc="best") ticklabel_format(style="sci", axis="y", scilimits=(0, 0)) xlabel(L"$K$") ylabel(L"$(1-1/e)$-Regret") grid() # savefig("design_regret_K3.pdf") play_sound() my_show() end generate_figure_regret(f, gradient) end experiment_nqp(10, 100, 100) # experiment_design(20, 20, 50, 50) # experiment_coverage(20, 60, 100, 100)
/** * * @file pcunmqr_blgtrd.c * * PLASMA auxiliary routines * PLASMA is a software package provided by Univ. of Tennessee, * Univ. of California Berkeley and Univ. of Colorado Denver * * @version 2.6.0 * @author Azzam Haidar * @date 2011-05-15 * @generated c Tue Jan 7 11:45:13 2014 * **/ #include <lapacke.h> #include <cblas.h> #include "common.h" #undef REAL #define COMPLEX #define E(_m, _n) (E + (_m) + LDE * (_n) ) #define V(_m) (V + (_m)) #define T(_m) (T + (_m)) #define TAU(_m) (TAU + (_m)) /*************************************************************************** * Parallel apply Q2 from bulgechasing matrices - static scheduling * Lower case is treated **/ /* * side == PlasmaLeft: * meaning apply E = Q*E = (q_1*q_2*.....*q_n) * E ==> so * traverse Vs in reverse order (forward) from q_n to q_1 Also * E is splitten by block of col over cores because each apply * consist in a block of row (horizontal block) */ /* * side == PlasmaRight: * meaning apply E = E*Q = E * (q_1*q_2*.....*q_n) ==> so * traverse Vs in normal order (forward) from q_1 to q_n Also * E is splitten by block of row over core because each apply * consist in a block of col (vertical block) */ /***************************************************************************/ void plasma_pcunmqr_blgtrd(plasma_context_t *plasma) { int my_core_id = PLASMA_RANK; int cores_num = plasma->world_size; /*===========================*/ int N, NB, NE, LDE, Vblksiz, WANTZ; PLASMA_enum side; PLASMA_enum trans; PLASMA_Complex32_t *V; PLASMA_Complex32_t *T; PLASMA_Complex32_t *TAU; PLASMA_Complex32_t *E; PLASMA_sequence *sequence; PLASMA_request *request; /*=========================== * local variables *===========================*/ PLASMA_Complex32_t *WORK; int LDT, LDV; int Vm, Vn, mt, nt; int myrow, mycol, blkj, blki; int firstrow, nbcolinvolvd; int blkid, vpos, taupos, tpos; int chunkid, nbchunk, colpercore, corest, corelen, len, col; int coreid, allcoresnb, maxrequiredcores; int lchunkid, rchunkid, halfchunk, nbportion, sw; int LWORK; int standalonework = 0 ; int versionL, versionR; plasma_unpack_args_14(side, trans, N, NB, NE, Vblksiz, WANTZ, V, T, TAU, E, LDE, sequence, request); if (sequence->status != PLASMA_SUCCESS) return; /* Quick return */ if ( N == 0 ) { return; } if ( NB == 0 ) { return; } if ( NE == 0 ) { return; } /* ========================================== * some infor for developer * Initialisation and checking nb of cores * ==========================================*/ /* we have to 2 algo for left (113 114) and 2 algo for right (91 92) * which correspond to versionL versionR. * They ae very similar (detail explained in tech report and matlab code) * however version 114 and 92 improve locality. * while version 113 is used in case WNATZ=1 (construct Q2) which allow * the construction to be done in an optimized way taking into * consideration that the matrix is Identity so making less flops. * */ versionL = 113; versionR = 92; LDT = Vblksiz; LDV = NB+Vblksiz-1; /* use colpercore = N/cores_num; :if i want to split E into * cores_num chunk so I will have large chunk for each core. * However I prefer to split E into chunk of small size where * I guarantee that blas3 occur and the size of chunk remain into * cache, I think it is better. than I will have different chunk of * small size per core and i will do each chunk till the end and * then move to the second one for data locality * * version v1: for each chunck it apply all the V's then move to * the other chunck. the locality here inside each * chunck meaning that thread "t" apply V_k then move * to V_k+1 which overlap with V_k meaning that the * E_k+1 overlap with E_k. so here is the * locality however thread t had to read V_k+1 and * T_k+1 at each apply. note that all thread if they * run at same speed they might reading the same V_k * and T_k at the same time. * * version v2: for each V_k and T_k thread t apply those V_k and * T_k to E_k for all its chunck, then move to V_k+1 * T_k+1 and apply them to E_k+1 on all the chunck, * and so on. the difference is that, thread keep V_k * and T_K while move over the E_k. * both version look like similar in perf. * * THIS IS v1 CODE * */ if(WANTZ==1) colpercore = plasma_ceildiv(NE,2*cores_num); else colpercore = plasma_ceildiv(NE,cores_num); if(colpercore>1000) colpercore = plasma_ceildiv(colpercore,10); else if(colpercore>800) colpercore = plasma_ceildiv(colpercore,8); else if(colpercore>600) colpercore = plasma_ceildiv(colpercore,6); else if(colpercore>400) colpercore = plasma_ceildiv(colpercore,4); else if(colpercore>200) colpercore = plasma_ceildiv(colpercore,2); if(colpercore>200) colpercore=120; if(colpercore<30) colpercore=32; /*colpercore = N make the code sequential running on thread=0;*/ nbchunk = plasma_ceildiv(NE, colpercore); allcoresnb = cores_num; maxrequiredcores = nbchunk; if( maxrequiredcores < 1 ) maxrequiredcores = 1; if(allcoresnb > maxrequiredcores) allcoresnb = maxrequiredcores; #if defined (ENABLE_DEBUG) if(my_core_id==0) printf(" APPLY Q_v1 parallel with threads %d nbchunk %d colpercore %d N %d NB %d Vblksiz %d SIDE %c TRANS %c versionL %d versionR %d WANTZ %d \n", cores_num,nbchunk,colpercore,N,NB,Vblksiz,lapack_const(side),lapack_const(trans),versionL,versionR,WANTZ); #endif /* ========================================= * case NB = 1 special case. * just make the element real for complex * ========================================= */ if ( NB == 1 ) { /* NOTE in CASE USED STANDALONE FUNCTION * In COMPLEX matrix Z need to be scaled by the TAU * generated during the make off-diagonal elements real */ /* * In case where the first stage has been done we are sure * that all element of E are real so no need to go through * NB=1. However in case where this function need to be used * for only band matrices meaning only stage2 has been called * then it require to make all off-diagonal elements real and * so remove the return from here and from the bulgechasing * function */ if(WANTZ==1){ PLASMA_Complex32_t zone = 1.0; memset(E, 0, LDE*N*sizeof(PLASMA_Complex32_t)); for(sw=0; sw<NE; sw++) E[sw+sw*LDE] = zone; } if(standalonework==0){ return; } else{ #ifdef COMPLEX for (chunkid = 0; chunkid<nbchunk; chunkid++) { coreid = chunkid%allcoresnb; corest = chunkid*colpercore; corelen = min(colpercore, (NE-(chunkid*colpercore))); if( my_core_id==coreid ){ if( side==PlasmaLeft ){ for (mycol =1; mycol<NE; mycol++){ cblas_cscal(corelen, TAU(mycol), E(mycol, corest), LDE); } }else{ PLASMA_Complex32_t ztmp; /*Upper case need to be checked*/ for (mycol = corest; mycol<corest+corelen; mycol++){ ztmp = conjf(*TAU(mycol)); cblas_cscal(N, &ztmp, E(0,mycol), 1); } } } } #endif return; } } /* ========================================= * case NB >1 main code * ========================================= */ LWORK = 2*colpercore*max(Vblksiz,64); WORK = (PLASMA_Complex32_t*) plasma_private_alloc(plasma, LWORK, PlasmaComplexFloat); /* WANTZ = 1 meaning E is IDENTITY so form Q using optimized update. * So we use the reverse order from small q to large one, * so from q_n to q_1 so Left update to Identity. * Use version 113 because in 114 we need to update the whole matrix and not in icreasing order. * WANTZ = 2 meaning E is a full matrix and need to be updated from Left or Right so use normal update * */ if ( WANTZ==1 ) { versionL = 113; halfchunk = plasma_ceildiv(nbchunk,2); for (lchunkid = 0; lchunkid<halfchunk; lchunkid++) { rchunkid = (nbchunk-1) - lchunkid; nbportion = lchunkid == rchunkid ? 1 : 2; /* sw is the switch between left and right side chunk * it is used to have same load distribution of work */ for (sw = 0; sw<nbportion; sw++) { chunkid = sw == 0 ? lchunkid : rchunkid; coreid = lchunkid%allcoresnb; corest = chunkid*colpercore; corelen = min(colpercore, (NE-(chunkid*colpercore))); if( my_core_id == coreid ) { /* * Version 113: * loop over the block_col (nt) and for each find the * number of tiles (mt) in this block_col. then loop over mt, find * the size of the V's(Vm,Vn) and apply it to the corresponding * portion of E. */ nt = plasma_ceildiv((N-1),Vblksiz); for (blkj=nt-1; blkj>=0; blkj--) { /* the index of the first row on the top of block (blkj) */ firstrow = blkj * Vblksiz + 1; /*find the number of tile for this block */ if( blkj == nt-1 ) mt = plasma_ceildiv( N - firstrow, NB); else mt = plasma_ceildiv( N - (firstrow+1), NB); /*loop over the tiles find the size of the Vs and apply it */ for (blki=mt; blki>0; blki--) { /*calculate the size of each losange of Vs= (Vm,Vn)*/ myrow = firstrow + (mt-blki)*NB; mycol = blkj*Vblksiz; Vm = min( NB+Vblksiz-1, N-myrow); if( ( blkj == nt-1 ) && ( blki == mt ) ){ Vn = min (Vblksiz, Vm); } else { Vn = min (Vblksiz, Vm-1); } /*calculate the pointer to the Vs and the Ts. * Note that Vs and Ts have special storage done * by the bulgechasing function*/ findVTpos(N,NB,Vblksiz,mycol,myrow, &vpos, &taupos, &tpos, &blkid); if((Vm>0)&&(Vn>0)){ col = max(mycol,corest); len = corelen - (col-corest); if(side==PlasmaLeft){ if( len > 0 ) CORE_clarfb_gemm( side, trans, PlasmaForward, PlasmaColumnwise, Vm, len, Vn, V(vpos), LDV, T(tpos), LDT, E(myrow,col), LDE, WORK, len); } else{ if( len > 0 ) CORE_clarfb_gemm( side, trans, PlasmaForward, PlasmaColumnwise, len, Vm, Vn, V(vpos), LDV, T(tpos), LDT, E(col, myrow), LDE, WORK, len); } } } } } /* END my_core_id=coreid */ } /* END of sw */ } /* END loop over the chunk */ } /* END if WANTZ=1 */ else{ /* * WANTZ != 1 */ for (chunkid = 0; chunkid<nbchunk; chunkid++) { coreid = chunkid%allcoresnb; corest = chunkid*colpercore; corelen = min(colpercore, (NE-(chunkid*colpercore))); if(corelen < 0) corelen = 0; if( my_core_id == coreid ) { /* * PlasmaLeft */ //if( side == PlasmaLeft ) { if( versionL == 113 ) { /* * Version 113: * loop over the block_col (nt) and for each find the * number of tiles (mt) in this block_col. then loop over mt, find * the size of the V's(Vm,Vn) and apply it to the corresponding * portion of E. */ if( versionL == 113 ) { nt = plasma_ceildiv((N-1),Vblksiz); for (blkj=nt-1; blkj>=0; blkj--) { /* the index of the first row on the top of block (blkj) */ firstrow = blkj * Vblksiz + 1; /*find the number of tile for this block */ if( blkj == nt-1 ) mt = plasma_ceildiv( N - firstrow, NB); else mt = plasma_ceildiv( N - (firstrow+1), NB); /*loop over the tiles find the size of the Vs and apply it */ for (blki=mt; blki>0; blki--) { /*calculate the size of each losange of Vs= (Vm,Vn)*/ myrow = firstrow + (mt-blki)*NB; mycol = blkj*Vblksiz; Vm = min( NB+Vblksiz-1, N-myrow); if( ( blkj == nt-1 ) && ( blki == mt ) ){ Vn = min (Vblksiz, Vm); } else { Vn = min (Vblksiz, Vm-1); } /*calculate the pointer to the Vs and the Ts. * Note that Vs and Ts have special storage done * by the bulgechasing function*/ findVTpos(N,NB,Vblksiz,mycol,myrow, &vpos, &taupos, &tpos, &blkid); if((Vm>0)&&(Vn>0)){ if( side == PlasmaLeft ){ CORE_clarfb_gemm( PlasmaLeft, trans, PlasmaForward, PlasmaColumnwise, Vm, corelen, Vn, V(vpos), LDV, T(tpos), LDT, E(myrow,corest), LDE, WORK, corelen); }else{ CORE_clarfb_gemm( PlasmaRight, trans, PlasmaForward, PlasmaColumnwise, corelen, Vm, Vn, V(vpos), LDV, T(tpos), LDT, E(corest, myrow), LDE, WORK, corelen); } } } } } /* * Version 114: * loop over the block_row (mt) and for each find diagonally the * number of tiles (nt) in this block_row. then loop over nt, find * the size of the V's(Vm,Vn) and apply it to the corresponding * portion of E. */ else { mt = plasma_ceildiv((N-1),NB); for (blki = mt; blki>0; blki--) { /* nbcolinvolvd = number of column corresponding to this block_row (blki) */ nbcolinvolvd = min(N-1, blki*NB); /*find the number of tile for this block (diagonal row of tiles) */ nt = plasma_ceildiv(nbcolinvolvd,Vblksiz); /*loop over the tiles find the size of the Vs and apply it */ for (blkj = nt-1; blkj>=0; blkj--) { /* the index of the first row of the first col meaning * the block on the top left (blki) */ firstrow = (mt-blki)*NB+1; /*calculate the size of each losange of Vs= (Vm,Vn)*/ myrow = firstrow + blkj*Vblksiz; mycol = blkj*Vblksiz; Vm = min( NB+Vblksiz-1, N-myrow); if( ( blkj == nt-1 ) && ( blki == mt ) ){ Vn = min (Vblksiz, Vm); }else{ Vn = min (Vblksiz, Vm-1); } /*calculate the pointer to the Vs and the Ts. * Note that Vs and Ts have special storage done * by the bulgechasing function*/ findVTpos(N,NB,Vblksiz,mycol,myrow, &vpos, &taupos, &tpos, &blkid); if((Vm>0)&&(Vn>0)) { CORE_clarfb_gemm( PlasmaLeft, trans, PlasmaForward, PlasmaColumnwise, Vm, corelen, Vn, V(vpos), LDV, T(tpos), LDT, E(myrow,corest), LDE, WORK, corelen); } } } } } /* * PlasmaRight */ else { /* * Version 91: */ if( versionR == 91 ) { nt = plasma_ceildiv((N-1),Vblksiz); for (blkj=0; blkj<nt; blkj++) { /* the index of the first myrow on the top of block (blkj) */ firstrow = blkj * Vblksiz + 1; /*find the number of tile for this block */ if( blkj == nt-1 ) mt = plasma_ceildiv( N - firstrow, NB); else mt = plasma_ceildiv( N - (firstrow+1), NB); /*loop over the tiles find the size of the Vs and apply it */ for (blki=1; blki<=mt; blki++) { /*calculate the size of each losange of Vs= (Vm,Vn)*/ myrow = firstrow + (mt-blki)*NB; Vm = min( NB+Vblksiz-1, N-myrow); if( ( blkj == nt-1 ) && ( blki == mt ) ) { Vn = min (Vblksiz, Vm); }else{ Vn = min (Vblksiz, Vm-1); } /*calculate the pointer to the Vs and the Ts. * Note that Vs and Ts have special storage done * by the bulgechasing function*/ mycol = blkj*Vblksiz; findVTpos(N,NB,Vblksiz,mycol,myrow, &vpos, &taupos, &tpos, &blkid); if((Vm>0)&&(Vn>0)){ CORE_clarfb_gemm( PlasmaRight, trans, PlasmaForward, PlasmaColumnwise, corelen, Vm, Vn, V(vpos), LDV, T(tpos), LDT, E(corest,myrow), LDE, WORK, corelen); } } } } /*trans * Version 92: */ else { mt = plasma_ceildiv((N-1),NB); for (blki = 1; blki<=mt; blki++) { /* nbcolinvolvd = number of column corresponding to this block_row (blki) */ nbcolinvolvd = min(N-1, blki*NB); /*find the number of tile for this block (diagonal row of tiles) */ nt = plasma_ceildiv(nbcolinvolvd,Vblksiz); /*loop over the tiles find the size of the Vs and apply it */ for (blkj = 0; blkj<nt; blkj++) { /* the index of the first row of the first col meaning * the block on the top left (blki) */ firstrow = (mt-blki)*NB+1; /*calculate the size of each losange of Vs= (Vm,Vn)*/ myrow = firstrow + blkj*Vblksiz; mycol = blkj*Vblksiz; Vm = min( NB+Vblksiz-1, N-myrow); if( ( blkj == nt-1 ) && ( blki == mt ) ){ Vn = min (Vblksiz, Vm); }else{ Vn = min (Vblksiz, Vm-1); } /*calculate the pointer to the Vs and the Ts. * Note that Vs and Ts have special storage done * by the bulgechasing function*/ findVTpos(N,NB,Vblksiz,mycol,myrow, &vpos, &taupos, &tpos, &blkid); if((Vm>0)&&(Vn>0)) { CORE_clarfb_gemm( PlasmaRight, trans, PlasmaForward, PlasmaColumnwise, corelen, Vm, Vn, V(vpos), LDV, T(tpos), LDT, E(corest,myrow), LDE, WORK, corelen); } } } } } } /* END my_core_id=coreid */ } /* END loop over the chunk */ } /* END ELSE of WANTZ == 1 */ plasma_private_free(plasma, WORK); } #undef E #undef V #undef T #undef TAU /***************************************************************************/ #undef COMPLEX
inductive Trie (α : Type _) (β : Type _) | mk : α → Option β → List (Trie α β) → Trie α β deriving Inhabited, BEq namespace Trie partial def isWellFormed : Trie α β → Bool | mk _ none [] => false | mk _ _ l => l.all isWellFormed def isTerminus : Trie α β → Bool | mk _ (some _) _ => true | mk _ none _ => false def label : Trie α β → α | mk a _ _ => a def data? : Trie α β → Option β | mk _ b? _ => b? def data : (tr : Trie α β) → tr.isTerminus → β | mk _ (some b) _, _ => b | mk _ none _, h => by dsimp [isTerminus] at h contradiction def find? [DecidableEq α] : Trie α β → α → Option (Trie α β) | mk _ _ l, a => l.find? (·.label = a) instance [DecidableEq α] : GetElem (Trie α β) α (Trie α β) (Option.toBool <| ·.find? ·) where getElem := λ tr a h => match tr.find? a, h with | some tr', _ => tr' | none, h => by dsimp [Option.toBool] at h contradiction def fromList [DecidableEq α] : List ((List α) × β) → Trie α β := fun l => let lg := l.groupBy (λ ⟨l₁, _⟩ ⟨l₂, _⟩ => l₁.head? = l₂.head?) sorry def keyword? [DecidableEq α] (tr : Trie α β) (p : List α) : List α → (List α × List α × Option β) | [] => (p, [], tr.data?) | w :: ws => match tr.find? w with | some tr' => keyword? tr' (p.concat w) ws | none => (p, w :: ws, tr.data?) theorem keyword?.decompose [DecidableEq α] (tr : Trie α β) (p l : List α) : let (k, l', _) := keyword? tr p l p ++ l = k ++ l' := match l with | [] => rfl | w :: ws => by simp [keyword?] cases tr.find? w · rfl · have : p ++ w :: ws = (p.concat w) ++ ws := by rw [List.concat_eq_append, List.append_assoc]; rfl rw [this] apply keyword?.decompose def keyword?.length [DecidableEq α] (tr : Trie α β) (p : List α) : List α → Nat | [] => .zero | w :: ws => match tr.find? w with | some tr' => .succ $ keyword?.length tr' (p.concat w) ws | none => .zero theorem keyword?.eq_drop_length [DecidableEq α] (tr : Trie α β) (p l : List α) : let (_, l', _) := keyword? tr p l l' = l.drop (keyword?.length tr p l) := match l with | [] => rfl | w :: ws => by simp [keyword?, keyword?.length] cases tr.find? w · rfl · dsimp [List.drop] apply keyword?.eq_drop_length def keywords [DecidableEq α] (tr : Trie α β) (l : List α) : List ((List α) × β) := match tr.keyword? [] l with | (kw, l', some b) => (kw, b) :: keywords tr l' | (_, l', none) => keywords tr l' decreasing_by sorry end Trie
import caseI.statement import caseII.statement open flt_regular /-- Statement of Fermat's last theorem for regular primes. -/ def flt_regular.statement : Prop := ∀ ⦃a b c : ℤ⦄ ⦃p : ℕ⦄ [hpri : fact p.prime] (hreg : @is_regular_prime p hpri) (hodd : p ≠ 2) (hprod : a * b * c ≠ 0), a ^ p + b ^ p ≠ c ^ p /-- Fermat's last theorem for regular primes.. -/ theorem flt_regular {a b c : ℤ} {p : ℕ} [fact p.prime] (hreg : is_regular_prime p) (hodd : p ≠ 2) (hprod : a * b * c ≠ 0) : a ^ p + b ^ p ≠ c ^ p := begin by_cases case : ↑p ∣ a * b * c, exact caseII hreg hodd hprod case, exact caseI hreg case end
#include <stdio.h> #include <math.h> #include <sys/types.h> #include <time.h> #include <complex.h> #include <gsl/gsl_rng.h> #include <gsl/gsl_randist.h> #include <gsl/gsl_cdf.h> #include <gsl/gsl_sf_gamma.h> #define FALSE 0 #define TRUE 1 #ifndef M_PI #define M_PI 3.141592653589793238462643383280 /* pi */ #endif #define LN2PI 1.83787706640934548356065947 extern char parameterfilename[50]; extern char parameterlogfilename[50]; #define MBIG 1000000000 #define MSEED 161803398 #define MZ 0 #define FAC (1.0/MBIG) #define MIN(A,B) ((A) < (B) ? (A) : (B)) #define MAX(A,B) ((A) > (B) ? (A) : (B)) enum {NOT_AVAILABLE=0, ABOVE_DETECTION=1, BELOW_DETECTION=2, MEASURED=3}; typedef struct { int n; int m; int **a; } Matrix; void ReadParam( char*, void*, char* ) ; void ExperimentNumber( char*, char* ); void Error( char* ); void FileError( char*, char* ); double ***doublematrix3( int, int, int ); double **doublematrix( int, int ); int **integermatrix( int, int ); uint **uintegermatrix( int, int ); uint *uintegervector( int ); char **charmatrix( int, int ); double *doublevector( int ); int *integervector( int ); char *charvector( int ); void Int_HeapSort(int*, int); void HeapSort( double*, int ); void circmeanvar( double*, int, double*, double* ); void meanvar( double*, int, double*, double* ); void meanvarl( long double*, int, long double*, long double* ); void wmeanvar( long double *x, int n, long double *m, long double *s2 ); double mean( double*, int, int ); int choldc_block(double**, long long); uint binomialRNG(uint, double, const gsl_rng*); void multinomialRNG(uint, const double*, size_t, unsigned int*, const gsl_rng*); int poissonRNG(double, const gsl_rng*); int uniform_intRNG(int, int, const gsl_rng*); double normalRNG(double, double, const gsl_rng*); double betaRNG(double, double, const gsl_rng*); double chisqRNG(double, const gsl_rng*); double scaleinvchisqRNG(double, double, const gsl_rng*); double invgammaRNG(double, double, const gsl_rng*); double gammaRNG(double, double, const gsl_rng*); double uniformRNG(double, double, const gsl_rng*); double paretoRNG(double, double, const gsl_rng*); void dirichlet_multinomialRNG(uint, const double*, size_t, uint*, const gsl_rng*); void dirichletRNG(const double*, size_t, double*, const gsl_rng*); uint beta_binomialRNG(uint, double, double, const gsl_rng*); uint negative_binomialRNG(double, double, const gsl_rng*); uint beta_negative_binomialRNG(uint, double, double, const gsl_rng*); /* Matrix *wishartRNG(int, int, Matrix*, Matrix*, const gsl_rng*); */ /* void MVNRNG(int, Matrix*, Matrix*, Matrix*, const gsl_rng*); */ double poissonCMF(const double, const double, int); double gamma_scalePDF(const double, const double, const double); double betaPDF(const double, const double, const double); double exponentialPDF(const double, const double); double poissonPMF(const double, const double); double geometricPDF(const double, const double); double trnormalPDF(const double, const double, const double); double normalCDF(const double, const double, const double, int); double normalPDF(const double, const double, const double); double binomialPMF(const double, const double, const double); double multinomialPMF(const unsigned int, const double*, const double*); double uniformPDF(const double, const double, const double); double logisticPDF(const double, const double, const double); double betabinomialPMF(const double, const double, const double, const double); /* double MVNPDF(Matrix*, Matrix*, Matrix*, const double, int); */ double identity(double); double logit(double); double invlogit(double); Matrix *MatrixInit(Matrix*, int, int, int*); Matrix *MatrixDestroy(Matrix*); /* Matrix *Matrix_Init(Matrix*, char*, int, int); */ /* Matrix *Matrix_Fill(Matrix*, int, int, ...); */ /* Matrix *Matrix_Destroy(Matrix*); */ /* Matrix *Matrix_Copy(Matrix*, Matrix*); */ /* Matrix *Matrix_Sub_Copy(Matrix*, Matrix*, int); */ /* Matrix *Matrix_Scalar_Multiply(Matrix*, double, Matrix*); */ /* Matrix *Matrix_Multiply(Matrix*, Matrix*, Matrix*); */ /* Matrix *Matrix_Multiply(Matrix*, Matrix*, Matrix*); */ /* Matrix *Matrix_Cholesky(Matrix*, Matrix*); */ /* Matrix *Matrix_Invert(Matrix*, Matrix*); */ /* Matrix *Matrix_Add(Matrix*, Matrix*, Matrix*); */ /* Matrix *Matrix_Add_Diagonal(Matrix*, Matrix*); */ /* Matrix *Matrix_Subtract(Matrix*, Matrix*, Matrix*); */ /* Matrix *Matrix_Transpose(Matrix*, Matrix*); */ /* double Matrix_Log_Determinant(Matrix*, int); */ /* void Matrix_Print(Matrix*); */ double rtnewt(void(*)(double, double*, double*, double*), double, double, double, double*); double rtbis( double (*)(double, double*), double, double, double, int*, double* ); size_t strlen(const char*); char *strncpy(char*, const char*, size_t); char *strcpy(char*, const char*); char *strcat(char*, const char*); char *strchr ( const char*, int ); int strcmp (const char*, const char*); void *calloc(size_t, size_t); void *malloc(size_t); void free(void*); void exit(int); double von_mises_cdf ( double x, double a, double b ); double von_mises_cdf_inv ( double cdf, double a, double b );
% Basic demo for fitting mixture of Gaussians % This demo first simulates a noisy MoG density profile, whose mode % position and width are then estimated using VBA. close all clear all clc %---- simulate noisy data % Choose basic settings for simulations sigma = 1e-1; % precision phi = [5;-1;1;3]; % observation parameters g_fname = @g_Gaussian; % observation function inG.grid = -10:0.1:10; % grid on which the gbf is evaluated inG.input = zeros(length(inG.grid),1); inG.input(50) = 1; % Build simulated observations [gx] = feval(g_fname,[],phi,[],inG); y = gx + sqrt(sigma.^-1)*randn(size(gx)); % display time series of hidden states and observations figure, plot(y','ro') hold on; plot(gx') %---- Invert model on simulated data % Build priors structure priors.muPhi = zeros(4,1); % prior mean on observation params priors.SigmaPhi = 1e0*eye(4); % prior covariance on observation params priors.a_sigma = 1; % Jeffrey's prior priors.b_sigma = 1; % Jeffrey's prior options.priors = priors; % include priors in options structure options.inG = inG; % input structure (grid) dim.n_phi = 4; % nb of observation parameters dim.n_theta = 0; % nb of evolution parameters dim.n = 0; % nb of hidden states % Call inversion routine [posterior,out] = VBA_NLStateSpaceModel(y,[],[],g_fname,dim,options); %---- Display results displayResults(posterior,out,y,[],[],[],phi,[],sigma);
module _ where id : (A B : Set₁) → (A → B) → A → B id _ _ f = f postulate P : (A : Set₁) → A → Set₁ cong : (A B : Set₁) (f : A → B) (x : A) → P A x → P B (f x) A : Set record R₀ (B : Set) : Set₁ where constructor mkR₀ no-eta-equality field proj₁ : Set proj₂ : B record R₁ (_ : Set) : Set₁ where constructor mkR₁ eta-equality field p : R₀ A X : Set X = R₀.proj₁ p record R₂ (r : R₁ A) : Set₁ where constructor mkR₂ eta-equality field g : R₀ (R₁.X r) should-succeed : (r₁ : R₁ A) (r₂ : R₂ r₁) → P (R₂ r₁) r₂ → P (R₀ (R₁.X r₁)) (R₂.g r₂) should-succeed r₁ r₂ = id (P _ _) (P (R₀ (R₁.X r₁)) (R₂.g r₂)) (cong _ _ R₂.g _)
/- The definition of a totally ordered set. -/ class TotalOrder (α : Type _) [LE α] [DecidableRel $ @LE.le α _] where (reflLE : ∀ a : α, a ≤ a) (antisymmLE : ∀ {a b : α}, a ≤ b → b ≤ a → a = b) (transLE : ∀ {a b c : α}, a ≤ b → b ≤ c → a ≤ c) (totalLE : ∀ a b : α, a ≤ b ∨ b ≤ a) namespace TotalOrder def max {α : Type _} [LE α] [DecidableRel $ @LE.le α _] : α → α → α | a, b => if a ≤ b then b else a def min {α : Type _} [LE α] [DecidableRel $ @LE.le α _] : α → α → α | a, b => if a ≤ b then a else b variable {α : Type} [LE α] [DecidableRel $ @LE.le α _] [TotalOrder α] variable {a b x : α} theorem notLE : ¬(a ≤ b) → b ≤ a := λ h : ¬(a ≤ b) => match TotalOrder.totalLE a b with | Or.inl h' => False.elim (h h') | Or.inr h' => h' theorem max_symm : max a b = max b a := by byCases h:(a ≤ b) <;> byCases h':(b ≤ a) <;> simp [max, h, h'] · apply TotalOrder.antisymmLE <;> assumption · apply TotalOrder.antisymmLE <;> (apply notLE ; assumption) @[simp] theorem max_left_le : TotalOrder.max a b ≤ x → a ≤ x := if h:(a ≤ b) then by simp [max, h] intro h' apply TotalOrder.transLE h h' else by simp [max, h] exact id @[simp] theorem max_right_le : max a b ≤ x → b ≤ x := by byCases h:(a ≤ b) <;> simp [max, h] · exact id · intro h' apply TotalOrder.transLE (notLE h) h' theorem min_symm : min a b = min b a := by byCases h:(a ≤ b) <;> byCases h':(b ≤ a) <;> simp [min, h, h'] · apply TotalOrder.antisymmLE <;> assumption · apply TotalOrder.antisymmLE <;> (apply notLE ; assumption) @[simp] theorem min_le_left : x ≤ min a b → x ≤ a := by byCases h:(a ≤ b) <;> simp [min, h] · exact id · intro h' apply TotalOrder.transLE · assumption · apply notLE ; assumption @[simp] theorem min_le_right : x ≤ min a b → x ≤ b := by byCases h:(a ≤ b) <;> simp [min, h] · intro h' exact TotalOrder.transLE h' h · exact id theorem both_le_max_le : a ≤ x → b ≤ x → (max a b) ≤ x := by intro ; intro ; byCases h:(a ≤ b) <;> simp [max, h] <;> assumption theorem le_both_le_min : x ≤ a → x ≤ b → x ≤ (min a b) := by intro ; intro ; byCases h:(a ≤ b) <;> simp [min, h] <;> assumption end TotalOrder
While Wilde had long been famous for dialogue and his use of language , Raby ( 1988 ) argues that he achieved a unity and mastery in Earnest that was unmatched in his other plays , except perhaps Salomé . While his earlier comedies suffer from an unevenness resulting from the thematic clash between the trivial and the serious , Earnest achieves a pitch @-@ perfect style that allows these to dissolve . There are three different registers detectable in the play . The <unk> insouciance of Jack and Algernon — established early with Algernon 's exchange with his manservant — betrays an underlying unity despite their differing attitudes . The formidable pronouncements of Lady Bracknell are as startling for her use of hyperbole and rhetorical extravagance as for her disconcerting opinions . In contrast , the speech of Dr. Chasuble and Miss Prism is distinguished by " pedantic precept " and " idiosyncratic diversion " . Furthermore , the play is full of epigrams and paradoxes . Max Beerbohm described it as littered with " chiselled <unk> — witticisms unrelated to action or character " , of which he found half a dozen to be of the highest order .
[STATEMENT] lemma OrdInd2H: assumes "H \<turnstile> A(i::= Zero)" and "H \<turnstile> All i (OrdP (Var i) IMP A IMP (A(i::= SUCC (Var i))))" shows "insert (OrdP (Var i)) H \<turnstile> A" [PROOF STATE] proof (prove) goal (1 subgoal): 1. insert (OrdP (Var i)) H \<turnstile> A [PROOF STEP] by (metis assms thin1 Assume OrdInd2)
# Cálculo diferencial en varias variables (II) Unha das funcionalindades máis importantes do módulo **Sympy** é as ferramentas das que dispón para o cálculo de derivadas, xa se traten de derivadas ordinarias (para expresións que dependen dunha única variable) como de derivadas parciais (para expresións definidas a partir de varias variables). Nesta práctica, estudaremos como calcular derivadas de forma implícita, usar a regra da cadea tanto usando a matriz xacobiana ou directamente co comando `sp.diff` e a representación de planos tanxentes a un punto dunha superficie ### Obxectivos: - Cálculo de derivadas parciais de forma implícita - Uso da regra da cadea mediante o cálculo da matriz xacobiana - Cálculo e representación gráfica do plano tanxente nun punto dunha superficie Para dispoñer do módulo **Sympy** e importalo para o resto do guión de prácticas, usaremos: ```python import sympy as sp ``` ## Resolución de ecuacións en **Sympy** Ata o de agora, aínda non precisamos calcular a solución de ecuacións (tanto lineais, polinómicas ou non lineais). Para facelo o módulo **Sympy** posúe a ferramenta `sp.solve`. Vexamos o uso desta función para resolver a ecuación $x^2+3x+a=0$ onde $x$ é a variable a calcular e $a$ é un parámetro constante asumido como coñecido: ```python x, a = sp.symbols('x a', real=True) # define as variables simbólicas x e y sol = sp.solve(sp.Eq(x**2+3*x+a,0),x) display(sol) ``` [-sqrt(9 - 4*a)/2 - 3/2, sqrt(9 - 4*a)/2 - 3/2] A mesma función `sp.solve` tamén nos permite resolver sistemas de ecuacións (tanto lineais como non lineais). Por exemplo, se queremos resolver o sistema $$ \left\{ \begin{array} 33x^2+2y=1,\\ x-y =2, \end{array} \right. $$ empregaríase: ```python x, y = sp.symbols('x y', real=True) # define as variables simbólicas x e y sol = sp.solve((sp.Eq(3*x**2+2*y,1),sp.Eq(x-y,2)),(x,y)) display(sol) ``` [(-5/3, -11/3), (1, -1)] ## Derivación implícita Se queremos calcular as derivadas dunha función que depende dunha ou varias variables non temos porque coñecer a súa expresión de forma explícita, pode vir dada implicitamente. Por exemplo, a función $z=f(x,y)$ pode vir determinada pola expresión $z^2x+2yz+xy=3$. Neste caso, non se coñece de forma explícita cal é a expresión de $f$ en termos de $x$ e $y$. A pesar deste incoveniente é posible calcular as derivadas parciais $\partial f/\partial x$ e $\partial f/\partial y$ como segue: ```python x, y = sp.symbols('x y', real=True) # define as variables simbólicas x e y z = sp.Function('f')(x,y) eq = sp.Eq(z**2*x+2*y*z+x*y,3) # Calculo da dereivada implicita con respecto a x eq_dx = sp.Eq(sp.diff(eq.lhs, x),sp.diff(eq.rhs, x)) z_dx = sp.solve(eq_dx, sp.diff(z,x)) display(z_dx) # Calculo da dereivada implicita con respecto a y eq_dy = sp.Eq(sp.diff(eq.lhs, y),sp.diff(eq.rhs, y)) z_dy = sp.solve(eq_dy, sp.diff(z,y)) display(z_dy) ``` [-(y + f(x, y)**2)/(2*x*f(x, y) + 2*y)] [-(x/2 + f(x, y))/(x*f(x, y) + y)] ### **Exercicio 7.1** Calcula as derivadas parciais da función $u=f(x,y,z)$ tendo en conta que $x^2+y^2+z^2+u^2=1$. ```python # O TEU CÓDIGO AQUÍ ``` ## Matriz xacobiana e regra da cadea A regra de derivación ordinaria para a composición de funcións viña dada pola chamda regra da cadea $(f\circ g)'(x)=f'(g(x))g'(x)$. No caso, de funcións de varias variables, formalmente tamén acudiremos á regra da cadea para cálculo multivariable. Por exemplo, se $F:\mathbb{R}^N\to \mathbb{R}$ e $G:\mathbb{R}^{M}\to\mathbb{R}^{N}$ entón, o cálculo do gradiente da composición $F\circ G$ resulta: $$ \nabla(F\circ G)(x_{1},\ldots,x_{M})=(DG(x_{1},\ldots,x_{M}))^{t}(\nabla F)(G(x_{1},\ldots,x_{M})) $$ onde $DG$ é a matriz xacobiana da función $G$. Vexamos como facer este cálculo nun caso particular onde $$ F(x,y)=3x+2y^2\qquad e \qquad G(s,t,r)= \begin{pmatrix} 2s+t^2\\ r^2s \end{pmatrix}. $$ Para implementar este tipo de cálculos matriciais con **Sympy** será útil empregar a clase de obxectos `sp.Matrix` e tamén o uso do método `jacobian` para calcular a matriz xacobiana dunha expresión (ademais tamén teremos en conta que o gradiente dunha función escalar de varias variables é a matriz transposta da matriz xacobiana): ```python x, y, r, s, t = sp.symbols('x y r s t', real=True) # define as variables simbólicas x e y # Definición das expresións de F e G F = sp.Matrix([3*x+2*y**2]) G = sp.Matrix([2*s+t**2, r**2*s]) # Cálculo do gradiente de F gradient_F = F.jacobian([x,y]).transpose() display(gradient_F) # Cálculo da matriz xacobiana de G DG = G.jacobian([s,t,r]) display(DG) # Cálculo do gradiente de F(G) DFoG = DG.transpose()*(gradient_F.subs({x:G[0], y:G[1]})) display(DFoG) ``` $\displaystyle \left[\begin{matrix}3\\4 y\end{matrix}\right]$ $\displaystyle \left[\begin{matrix}2 & 2 t & 0\\r^{2} & 0 & 2 r s\end{matrix}\right]$ $\displaystyle \left[\begin{matrix}4 r^{4} s + 6\\6 t\\8 r^{3} s^{2}\end{matrix}\right]$ Para comprobar que os cálculo feitos anteriormente son correctos, tamén é posible calcular primeiro a composición de funcións e despois calcular as derivadas parciais usado a función `jacobian`. Tanto dunha forma como doutra o resultado debe ser idéntico. Nesta forma de proceder, usaremos a implementación do gradiente revisada na práctica anterior: ```python def gradient(expr, varlist): return [sp.diff(expr,var) for var in varlist] # cálculo do gradiente almacenado nunha lista ``` E agora definimos dúas funcións con `sp.Lambda` e calculamos a composición para despois calcular o gradiente. > ** Nota **: a composición de funcións debe facerse con coidado xa que a función `G` devolve unha lista e para extraer cada un dos elementos da lista e pasalos como argumento da función `F` débese empregar o operador `*` ```python # Definición das funcións F = sp.Lambda((x,y),3*x+2*y**2) G = sp.Lambda((s,t,r),(2*s+t**2,r**2*s)) display('Avaliacion de G como unha lista de expresions:', G(s,t,r)) display('Avaliacion de G duas expresions independentes:', *G(s,t,r)) # Cálculo da composición FoG = F(*G(s,t,r)) display('Composicion:', FoG) # Cálculo do gradiente da composición DFoG = gradient(FoG, (s,t,r)) display('Gradiente:',DFoG) ``` 'Avaliacion de G como unha lista de expresions:' $\displaystyle \left( 2 s + t^{2}, \ r^{2} s\right)$ 'Avaliacion de G duas expresions independentes:' $\displaystyle 2 s + t^{2}$ $\displaystyle r^{2} s$ 'Composicion:' $\displaystyle 2 r^{4} s^{2} + 6 s + 3 t^{2}$ 'Gradiente:' [4*r**4*s + 6, 6*t, 8*r**3*s**2] ### **Exercicio 7.2** Emprega a regra da cadea e a composicion de funcións para calcular o gradiente con respecto ás variables $(t,s)$ da función $w=xyz$ con $x=s+t$, $y=s-t$, e $z=st^2$. ```python # O TEU CÓDIGO AQUÍ ``` ## Recta tanxente e normal a unha curva A interpretación xeométrica da derivada ordinaria $f'(x)$ dunha función dunha variable $f(x)$ é clara: $f(x_{0})$ é a pendente da recta tanxente á curva $y=f(x)$ no punto $(x_0,y_0)=(x_0,f(x_{0}))$. Do mesmo xeito, empregando as propiedades do gradiente, se definimos $F(x,y)=y-f(x)$, entón $\nabla F(x_0,y_0)$ é un vector perpendicular á gráfica $y=f(x)$ e polo tanto define o vector director da curva normal á gráfica nese punto. Para a representación gráfica tanto de rectas como de planos, empregaremos **Matplotlib** ```python import numpy as np import matplotlib import matplotlib.pyplot as plt %matplotlib inline ``` Vexamos estas propiedades co exemplo $f(x)=x^2+3$ considerendo o punto $x_0=1$: ```python x, y = sp.symbols('x y', real=True) # define a variable simbólica x f = sp.Lambda(x, x**2+3) x0 = 1; y0=f(x0) # Cálculo da ecuación da recta tanxente df = sp.Lambda(x, sp.diff(f(x),x)) recta_tang = y0+df(x0)*(x-x0) # Cálculo da ecuación da recta normal grad_f = gradient(y-f(x),(x,y)) grad_fun = sp.Lambda((x,y),(grad_f[0],grad_f[1])) u = grad_fun(x0,y0) # vector director da recta normal recta_norm = sp.solve(sp.Eq(u[0]*(y-y0)-u[1]*(x-x0),0),y)[0] ``` Unha vez calculadas as rectas tanxentes e normais, trasladase a información do módulo **Sympy** a **Numpy**, para un uso posterior en **Matplotlib**: ```python F = sp.lambdify(x,f(x),"numpy") # función numpy coa expresión de f(x,y) Recta_tang = sp.lambdify(x,recta_tang,"numpy") # función numpy coa expresión vectorial de grad(f) Recta_norm = sp.lambdify(x,recta_norm,"numpy") # función numpy coa expresión vectorial de grad(f) ``` Agora pódense usar as funcións de **Numpy** para a representación gráfica da función e das rectas tanxentes e normal: ```python # Creación dos puntos onde se avalían as funcións xvec = np.linspace(-2, 2, 100) # Gráfica de sin(x) e cos(x), cunha etiqueta para cada unha plt.plot(xvec, F(xvec), label='f(x)') plt.plot(xvec, Recta_tang(xvec), label='tanxente') plt.plot(xvec, Recta_norm(xvec), label='normal') # Etiquetas dos eixes plt.xlabel('x') plt.ylabel('y') # Engadir a lenda (mostrando as etiquetas dos "plot") plt.legend() # Definir os límites dos eixes x e y plt.xlim(xvec[0], xvec[-1]) plt.ylim(2,6) ax = plt.gca() ax.set_aspect('equal') plt.show() ``` ### **Exercicio 7.3** Calcula e representa graficamente as rectas tanxente e normal da gráfica da función $x-2y^2=1$ no punto $x_0=2$. ```python # O TEU CÓDIGO AQUÍ ``` ## Plano tanxente e recta normal a unha superficie Como xa estudamos nas clases de pizarra, o gradiente dunha función $\nabla f$ é un campo de vectores que sempre é perpendicular ás curvas de nivel dunha función de dúas variables $f(x,y)$. Isto tamén é certo para funcións de tres variables $f(x,y,z)$, onde agora o gradiente $\nabla f(x,y,z)$ será perpendicular ás superficies de nivel. Isto nos permite calcular e representar graficamente tanto rectas normais como planos tanxentes a unha superficie dada. Vexamos estas propiedades co exemplo da superficie $z=x^2+y^2+3$ considerendo o punto $(x_0,y_0)=(1,1/2)$: ```python x, y, z, t = sp.symbols('x y z t', real=True) # define a variable simbólica x f = sp.Lambda((x,y), x**2+y**2+3) x0 = 1; y0=sp.Rational('1/2'); z0=f(x0,y0) # Cálculo da ecuación do plano tanxente grad_f = gradient(z-f(x,y),(x,y,z)) grad_fun = sp.Lambda((x,y,z),(grad_f[0],grad_f[1],grad_f[2])) u = grad_fun(x0,y0,z0) # vector perpendicular a plano plano_tanx = sp.solve(sp.Eq(u[0]*(x-x0)+u[1]*(y-y0)+u[2]*(z-z0),0),z)[0] # Cálculo da ecuación vectorial da recta normal recta_norm = sp.Lambda(t,(x0+t*u[0], y0+t*u[1], z0+t*u[2])) ``` Unha vez calculadas as rectas tanxentes e normais, trasladase a información do módulo **Sympy** a **Numpy**, para un uso posterior en **Matplotlib**: ```python F = sp.lambdify((x,y),f(x,y),"numpy") # función numpy coa expresión de f(x,y) Plano_tanx = sp.lambdify((x,y),plano_tanx,"numpy") # función numpy coa expresión vectorial de grad(f) Recta_norm = sp.lambdify(t,recta_norm(t),"numpy") # función numpy coa expresión vectorial de grad(f) ``` Agora pódense usar as funcións de **Numpy** para a representación gráfica da función e das rectas tanxentes e normal: ```python from mpl_toolkits.mplot3d import axes3d # Nube de puntos para representar a superficie e o plano N = 50 x = np.linspace(-2, 2, N) y = np.linspace(-2, 2, N) X, Y = np.meshgrid(x, y) Fval = F(X,Y) Pval = Plano_tanx(X,Y) # Conxunto de puntos para representar a recta normal tvec = np.linspace(-2, 2, 100) Rval = Recta_norm(tvec) # Creación da figura 3D fig = plt.figure() ax = plt.axes(projection="3d") # Representación da superficie z=F(x,y) surf_F = ax.plot_surface(X, Y, Fval) surf_Plano = ax.plot_surface(X, Y, Pval) recta = ax.plot3D(*Rval) # Etiquetas dos eixes ax.set_xlabel('x') ax.set_ylabel('y') ax.set_zlabel('z') # Punto de vista do observador: elevación, ángulo azimutal ax.view_init(elev=10, azim=-100) ax.auto_scale_xyz([-2,2],[-2,2],[-5,10]) plt.show() ``` ### **Exercicio 7.4** Calcula e representa graficamente o plano tanxente e a recta normal da gráfica da función $x^2+y^2+z^2=1$ no punto $(x_0,y_0,z_0)=(1,1,1)/\sqrt{3}$. ```python # O TEU CÓDIGO AQUÍ ```
How Do We Build New Marketing Capabilities? MarketFrames transforms traditional marketing organizations using proprietary and proven organization design frameworks, experts, methods, and tools. Our services build essential new capabilities by addressing targeted problem areas or systemic improvements. Fill short-term gaps with essential operating services. We help clients identify, create, and sustain the change needed to successfully transform and operate winning marketing organizations.
module Prelude.Smashed where open import Prelude.Equality open import Prelude.Unit open import Prelude.Empty open import Prelude.Nat.Core open import Prelude.Function open import Prelude.Ord record Smashed {a} (A : Set a) : Set a where field smashed : ∀ {x y : A} → x ≡ y open Smashed {{...}} public {-# DISPLAY Smashed.smashed _ = smashed #-} instance Smash⊤ : Smashed ⊤ smashed {{Smash⊤}} = refl Smash⊥ : Smashed ⊥ smashed {{Smash⊥}} {} Smash≡ : ∀ {a} {A : Set a} {a b : A} → Smashed (a ≡ b) smashed {{Smash≡}} {x = refl} {refl} = refl -- Can't be instance, since this would interfere with the ⊤ and ⊥ instances. SmashNonZero : ∀ {n : Nat} → Smashed (NonZero n) SmashNonZero {zero} = it SmashNonZero {suc n} = it
[GOAL] α : Type u_1 τ : ℝ inst✝¹ : Inhabited α inst✝ : MetricSpace α i : Fin (0 + 1) hi : i < last 0 ⊢ (fun x => 1) i ≤ dist (default i) (default (last 0)) ∧ (fun x => 1) (last 0) ≤ τ * (fun x => 1) i [PROOFSTEP] rw [Subsingleton.elim (α := Fin 1) i (last 0)] at hi [GOAL] α : Type u_1 τ : ℝ inst✝¹ : Inhabited α inst✝ : MetricSpace α i : Fin (0 + 1) hi : last 0 < last 0 ⊢ (fun x => 1) i ≤ dist (default i) (default (last 0)) ∧ (fun x => 1) (last 0) ≤ τ * (fun x => 1) i [PROOFSTEP] exact (lt_irrefl _ hi).elim [GOAL] α : Type u_1 τ : ℝ inst✝¹ : Inhabited α inst✝ : MetricSpace α i : Fin (0 + 1) hi : i < last 0 ⊢ dist (default i) (default (last 0)) ≤ (fun x => 1) i + (fun x => 1) (last 0) [PROOFSTEP] rw [Subsingleton.elim (α := Fin 1) i (last 0)] at hi [GOAL] α : Type u_1 τ : ℝ inst✝¹ : Inhabited α inst✝ : MetricSpace α i : Fin (0 + 1) hi : last 0 < last 0 ⊢ dist (default i) (default (last 0)) ≤ (fun x => 1) i + (fun x => 1) (last 0) [PROOFSTEP] exact (lt_irrefl _ hi).elim [GOAL] α : Type u_1 inst✝ : MetricSpace α N : ℕ τ : ℝ a : SatelliteConfig α N τ i : Fin (Nat.succ N) ⊢ dist (c a i) (c a (last N)) ≤ r a i + r a (last N) [PROOFSTEP] rcases lt_or_le i (last N) with (H | H) [GOAL] case inl α : Type u_1 inst✝ : MetricSpace α N : ℕ τ : ℝ a : SatelliteConfig α N τ i : Fin (Nat.succ N) H : i < last N ⊢ dist (c a i) (c a (last N)) ≤ r a i + r a (last N) [PROOFSTEP] exact a.inter i H [GOAL] case inr α : Type u_1 inst✝ : MetricSpace α N : ℕ τ : ℝ a : SatelliteConfig α N τ i : Fin (Nat.succ N) H : last N ≤ i ⊢ dist (c a i) (c a (last N)) ≤ r a i + r a (last N) [PROOFSTEP] have I : i = last N := top_le_iff.1 H [GOAL] case inr α : Type u_1 inst✝ : MetricSpace α N : ℕ τ : ℝ a : SatelliteConfig α N τ i : Fin (Nat.succ N) H : last N ≤ i I : i = last N ⊢ dist (c a i) (c a (last N)) ≤ r a i + r a (last N) [PROOFSTEP] have := (a.rpos (last N)).le [GOAL] case inr α : Type u_1 inst✝ : MetricSpace α N : ℕ τ : ℝ a : SatelliteConfig α N τ i : Fin (Nat.succ N) H : last N ≤ i I : i = last N this : 0 ≤ r a (last N) ⊢ dist (c a i) (c a (last N)) ≤ r a i + r a (last N) [PROOFSTEP] simp only [I, add_nonneg this this, dist_self] [GOAL] α : Type u_1 inst✝ : MetricSpace α N : ℕ τ : ℝ a : SatelliteConfig α N τ i : Fin (Nat.succ N) h : 1 ≤ τ ⊢ r a (last N) ≤ τ * r a i [PROOFSTEP] rcases lt_or_le i (last N) with (H | H) [GOAL] case inl α : Type u_1 inst✝ : MetricSpace α N : ℕ τ : ℝ a : SatelliteConfig α N τ i : Fin (Nat.succ N) h : 1 ≤ τ H : i < last N ⊢ r a (last N) ≤ τ * r a i [PROOFSTEP] exact (a.hlast i H).2 [GOAL] case inr α : Type u_1 inst✝ : MetricSpace α N : ℕ τ : ℝ a : SatelliteConfig α N τ i : Fin (Nat.succ N) h : 1 ≤ τ H : last N ≤ i ⊢ r a (last N) ≤ τ * r a i [PROOFSTEP] have : i = last N := top_le_iff.1 H [GOAL] case inr α : Type u_1 inst✝ : MetricSpace α N : ℕ τ : ℝ a : SatelliteConfig α N τ i : Fin (Nat.succ N) h : 1 ≤ τ H : last N ≤ i this : i = last N ⊢ r a (last N) ≤ τ * r a i [PROOFSTEP] rw [this] [GOAL] case inr α : Type u_1 inst✝ : MetricSpace α N : ℕ τ : ℝ a : SatelliteConfig α N τ i : Fin (Nat.succ N) h : 1 ≤ τ H : last N ≤ i this : i = last N ⊢ r a (last N) ≤ τ * r a (last N) [PROOFSTEP] exact le_mul_of_one_le_left (a.rpos _).le h [GOAL] a✝ : Ordinal.{u} i : Ordinal.{u} := a✝ j : { j // j < i } ⊢ (invImage (fun a => a) Ordinal.wellFoundedRelation).1 (↑j) a✝ [PROOFSTEP] exact j.2 [GOAL] a✝ : Ordinal.{u} i : Ordinal.{u} := a✝ j : { j // j < i } ⊢ (invImage (fun a => a) Ordinal.wellFoundedRelation).1 (↑j) a✝ [PROOFSTEP] exact j.2 [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α ⊢ Monotone (iUnionUpTo p) [PROOFSTEP] intro i j hij [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i j : Ordinal.{u} hij : i ≤ j ⊢ iUnionUpTo p i ≤ iUnionUpTo p j [PROOFSTEP] simp only [iUnionUpTo] [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i j : Ordinal.{u} hij : i ≤ j ⊢ ⋃ (j : { j // j < i }), ball (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ≤ ⋃ (j_1 : { j_1 // j_1 < j }), ball (BallPackage.c p.toBallPackage (index p ↑j_1)) (BallPackage.r p.toBallPackage (index p ↑j_1)) [PROOFSTEP] exact iUnion_mono' fun r => ⟨⟨r, r.2.trans_le hij⟩, Subset.rfl⟩ [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α a✝ : Ordinal.{u} i : Ordinal.{u} := a✝ j : { j // j < i } x✝ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ⊢ (invImage (fun a => a) Ordinal.wellFoundedRelation).1 (↑j) a✝ [PROOFSTEP] exact j.2 [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α ⊢ Set.Nonempty {i | ¬∃ b, ¬BallPackage.c p.toBallPackage b ∈ iUnionUpTo p i ∧ R p i ≤ p.τ * BallPackage.r p.toBallPackage b} [PROOFSTEP] by_contra h [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α h : ¬Set.Nonempty {i | ¬∃ b, ¬BallPackage.c p.toBallPackage b ∈ iUnionUpTo p i ∧ R p i ≤ p.τ * BallPackage.r p.toBallPackage b} ⊢ False [PROOFSTEP] suffices H : Function.Injective p.index [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α h : ¬Set.Nonempty {i | ¬∃ b, ¬BallPackage.c p.toBallPackage b ∈ iUnionUpTo p i ∧ R p i ≤ p.τ * BallPackage.r p.toBallPackage b} H : Function.Injective (index p) ⊢ False case H α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α h : ¬Set.Nonempty {i | ¬∃ b, ¬BallPackage.c p.toBallPackage b ∈ iUnionUpTo p i ∧ R p i ≤ p.τ * BallPackage.r p.toBallPackage b} ⊢ Function.Injective (index p) [PROOFSTEP] exact not_injective_of_ordinal p.index H [GOAL] case H α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α h : ¬Set.Nonempty {i | ¬∃ b, ¬BallPackage.c p.toBallPackage b ∈ iUnionUpTo p i ∧ R p i ≤ p.τ * BallPackage.r p.toBallPackage b} ⊢ Function.Injective (index p) [PROOFSTEP] intro x y hxy [GOAL] case H α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α h : ¬Set.Nonempty {i | ¬∃ b, ¬BallPackage.c p.toBallPackage b ∈ iUnionUpTo p i ∧ R p i ≤ p.τ * BallPackage.r p.toBallPackage b} x y : Ordinal.{u} hxy : index p x = index p y ⊢ x = y [PROOFSTEP] wlog x_le_y : x ≤ y generalizing x y [GOAL] case H.inr α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α h : ¬Set.Nonempty {i | ¬∃ b, ¬BallPackage.c p.toBallPackage b ∈ iUnionUpTo p i ∧ R p i ≤ p.τ * BallPackage.r p.toBallPackage b} x y : Ordinal.{u} hxy : index p x = index p y this : ∀ ⦃x y : Ordinal.{u}⦄, index p x = index p y → x ≤ y → x = y x_le_y : ¬x ≤ y ⊢ x = y [PROOFSTEP] exact (this hxy.symm (le_of_not_le x_le_y)).symm [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α h : ¬Set.Nonempty {i | ¬∃ b, ¬BallPackage.c p.toBallPackage b ∈ iUnionUpTo p i ∧ R p i ≤ p.τ * BallPackage.r p.toBallPackage b} x y : Ordinal.{u} hxy : index p x = index p y x_le_y : x ≤ y ⊢ x = y [PROOFSTEP] rcases eq_or_lt_of_le x_le_y with (rfl | H) [GOAL] case inl α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α h : ¬Set.Nonempty {i | ¬∃ b, ¬BallPackage.c p.toBallPackage b ∈ iUnionUpTo p i ∧ R p i ≤ p.τ * BallPackage.r p.toBallPackage b} x : Ordinal.{u} hxy : index p x = index p x x_le_y : x ≤ x ⊢ x = x [PROOFSTEP] rfl [GOAL] case inr α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α h : ¬Set.Nonempty {i | ¬∃ b, ¬BallPackage.c p.toBallPackage b ∈ iUnionUpTo p i ∧ R p i ≤ p.τ * BallPackage.r p.toBallPackage b} x y : Ordinal.{u} hxy : index p x = index p y x_le_y : x ≤ y H : x < y ⊢ x = y [PROOFSTEP] simp only [nonempty_def, not_exists, exists_prop, not_and, not_lt, not_le, mem_setOf_eq, not_forall] at h [GOAL] case inr α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α x y : Ordinal.{u} hxy : index p x = index p y x_le_y : x ≤ y H : x < y h : ∀ (x : Ordinal.{u}), ∃ x_1, ¬BallPackage.c p.toBallPackage x_1 ∈ iUnionUpTo p x ∧ R p x ≤ p.τ * BallPackage.r p.toBallPackage x_1 ⊢ x = y [PROOFSTEP] specialize h y [GOAL] case inr α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α x y : Ordinal.{u} hxy : index p x = index p y x_le_y : x ≤ y H : x < y h : ∃ x, ¬BallPackage.c p.toBallPackage x ∈ iUnionUpTo p y ∧ R p y ≤ p.τ * BallPackage.r p.toBallPackage x ⊢ x = y [PROOFSTEP] have A : p.c (p.index y) ∉ p.iUnionUpTo y := by have : p.index y = Classical.epsilon fun b : β => p.c b ∉ p.iUnionUpTo y ∧ p.R y ≤ p.τ * p.r b := by rw [TauPackage.index]; rfl rw [this] exact (Classical.epsilon_spec h).1 [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α x y : Ordinal.{u} hxy : index p x = index p y x_le_y : x ≤ y H : x < y h : ∃ x, ¬BallPackage.c p.toBallPackage x ∈ iUnionUpTo p y ∧ R p y ≤ p.τ * BallPackage.r p.toBallPackage x ⊢ ¬BallPackage.c p.toBallPackage (index p y) ∈ iUnionUpTo p y [PROOFSTEP] have : p.index y = Classical.epsilon fun b : β => p.c b ∉ p.iUnionUpTo y ∧ p.R y ≤ p.τ * p.r b := by rw [TauPackage.index]; rfl [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α x y : Ordinal.{u} hxy : index p x = index p y x_le_y : x ≤ y H : x < y h : ∃ x, ¬BallPackage.c p.toBallPackage x ∈ iUnionUpTo p y ∧ R p y ≤ p.τ * BallPackage.r p.toBallPackage x ⊢ index p y = Classical.epsilon fun b => ¬BallPackage.c p.toBallPackage b ∈ iUnionUpTo p y ∧ R p y ≤ p.τ * BallPackage.r p.toBallPackage b [PROOFSTEP] rw [TauPackage.index] [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α x y : Ordinal.{u} hxy : index p x = index p y x_le_y : x ≤ y H : x < y h : ∃ x, ¬BallPackage.c p.toBallPackage x ∈ iUnionUpTo p y ∧ R p y ≤ p.τ * BallPackage.r p.toBallPackage x ⊢ (Classical.epsilon fun b => ¬BallPackage.c p.toBallPackage b ∈ ⋃ (j : { j // j < y }), ball (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∧ ⨆ (b : { b // ¬BallPackage.c p.toBallPackage b ∈ ⋃ (j : { j // j < y }), ball (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) }), BallPackage.r p.toBallPackage ↑b ≤ p.τ * BallPackage.r p.toBallPackage b) = Classical.epsilon fun b => ¬BallPackage.c p.toBallPackage b ∈ iUnionUpTo p y ∧ R p y ≤ p.τ * BallPackage.r p.toBallPackage b [PROOFSTEP] rfl [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α x y : Ordinal.{u} hxy : index p x = index p y x_le_y : x ≤ y H : x < y h : ∃ x, ¬BallPackage.c p.toBallPackage x ∈ iUnionUpTo p y ∧ R p y ≤ p.τ * BallPackage.r p.toBallPackage x this : index p y = Classical.epsilon fun b => ¬BallPackage.c p.toBallPackage b ∈ iUnionUpTo p y ∧ R p y ≤ p.τ * BallPackage.r p.toBallPackage b ⊢ ¬BallPackage.c p.toBallPackage (index p y) ∈ iUnionUpTo p y [PROOFSTEP] rw [this] [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α x y : Ordinal.{u} hxy : index p x = index p y x_le_y : x ≤ y H : x < y h : ∃ x, ¬BallPackage.c p.toBallPackage x ∈ iUnionUpTo p y ∧ R p y ≤ p.τ * BallPackage.r p.toBallPackage x this : index p y = Classical.epsilon fun b => ¬BallPackage.c p.toBallPackage b ∈ iUnionUpTo p y ∧ R p y ≤ p.τ * BallPackage.r p.toBallPackage b ⊢ ¬BallPackage.c p.toBallPackage (Classical.epsilon fun b => ¬BallPackage.c p.toBallPackage b ∈ iUnionUpTo p y ∧ R p y ≤ p.τ * BallPackage.r p.toBallPackage b) ∈ iUnionUpTo p y [PROOFSTEP] exact (Classical.epsilon_spec h).1 [GOAL] case inr α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α x y : Ordinal.{u} hxy : index p x = index p y x_le_y : x ≤ y H : x < y h : ∃ x, ¬BallPackage.c p.toBallPackage x ∈ iUnionUpTo p y ∧ R p y ≤ p.τ * BallPackage.r p.toBallPackage x A : ¬BallPackage.c p.toBallPackage (index p y) ∈ iUnionUpTo p y ⊢ x = y [PROOFSTEP] simp only [iUnionUpTo, not_exists, exists_prop, mem_iUnion, mem_closedBall, not_and, not_le, Subtype.exists, Subtype.coe_mk] at A [GOAL] case inr α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α x y : Ordinal.{u} hxy : index p x = index p y x_le_y : x ≤ y H : x < y h : ∃ x, ¬BallPackage.c p.toBallPackage x ∈ iUnionUpTo p y ∧ R p y ≤ p.τ * BallPackage.r p.toBallPackage x A : ∀ (x : Ordinal.{u}), x < y → ¬BallPackage.c p.toBallPackage (index p y) ∈ ball (BallPackage.c p.toBallPackage (index p x)) (BallPackage.r p.toBallPackage (index p x)) ⊢ x = y [PROOFSTEP] specialize A x H [GOAL] case inr α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α x y : Ordinal.{u} hxy : index p x = index p y x_le_y : x ≤ y H : x < y h : ∃ x, ¬BallPackage.c p.toBallPackage x ∈ iUnionUpTo p y ∧ R p y ≤ p.τ * BallPackage.r p.toBallPackage x A : ¬BallPackage.c p.toBallPackage (index p y) ∈ ball (BallPackage.c p.toBallPackage (index p x)) (BallPackage.r p.toBallPackage (index p x)) ⊢ x = y [PROOFSTEP] simp [hxy] at A [GOAL] case inr α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α x y : Ordinal.{u} hxy : index p x = index p y x_le_y : x ≤ y H : x < y h : ∃ x, ¬BallPackage.c p.toBallPackage x ∈ iUnionUpTo p y ∧ R p y ≤ p.τ * BallPackage.r p.toBallPackage x A : BallPackage.r p.toBallPackage (index p y) ≤ 0 ⊢ x = y [PROOFSTEP] exact (lt_irrefl _ ((p.rpos (p.index y)).trans_le A)).elim [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α x : β ⊢ BallPackage.c p.toBallPackage x ∈ iUnionUpTo p (lastStep p) [PROOFSTEP] have A : ∀ z : β, p.c z ∈ p.iUnionUpTo p.lastStep ∨ p.τ * p.r z < p.R p.lastStep := by have : p.lastStep ∈ {i | ¬∃ b : β, p.c b ∉ p.iUnionUpTo i ∧ p.R i ≤ p.τ * p.r b} := csInf_mem p.lastStep_nonempty simpa only [not_exists, mem_setOf_eq, not_and_or, not_le, not_not_mem] [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α x : β ⊢ ∀ (z : β), BallPackage.c p.toBallPackage z ∈ iUnionUpTo p (lastStep p) ∨ p.τ * BallPackage.r p.toBallPackage z < R p (lastStep p) [PROOFSTEP] have : p.lastStep ∈ {i | ¬∃ b : β, p.c b ∉ p.iUnionUpTo i ∧ p.R i ≤ p.τ * p.r b} := csInf_mem p.lastStep_nonempty [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α x : β this : lastStep p ∈ {i | ¬∃ b, ¬BallPackage.c p.toBallPackage b ∈ iUnionUpTo p i ∧ R p i ≤ p.τ * BallPackage.r p.toBallPackage b} ⊢ ∀ (z : β), BallPackage.c p.toBallPackage z ∈ iUnionUpTo p (lastStep p) ∨ p.τ * BallPackage.r p.toBallPackage z < R p (lastStep p) [PROOFSTEP] simpa only [not_exists, mem_setOf_eq, not_and_or, not_le, not_not_mem] [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α x : β A : ∀ (z : β), BallPackage.c p.toBallPackage z ∈ iUnionUpTo p (lastStep p) ∨ p.τ * BallPackage.r p.toBallPackage z < R p (lastStep p) ⊢ BallPackage.c p.toBallPackage x ∈ iUnionUpTo p (lastStep p) [PROOFSTEP] by_contra h [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α x : β A : ∀ (z : β), BallPackage.c p.toBallPackage z ∈ iUnionUpTo p (lastStep p) ∨ p.τ * BallPackage.r p.toBallPackage z < R p (lastStep p) h : ¬BallPackage.c p.toBallPackage x ∈ iUnionUpTo p (lastStep p) ⊢ False [PROOFSTEP] rcases A x with (H | H) [GOAL] case inl α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α x : β A : ∀ (z : β), BallPackage.c p.toBallPackage z ∈ iUnionUpTo p (lastStep p) ∨ p.τ * BallPackage.r p.toBallPackage z < R p (lastStep p) h : ¬BallPackage.c p.toBallPackage x ∈ iUnionUpTo p (lastStep p) H : BallPackage.c p.toBallPackage x ∈ iUnionUpTo p (lastStep p) ⊢ False [PROOFSTEP] exact h H [GOAL] case inr α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α x : β A : ∀ (z : β), BallPackage.c p.toBallPackage z ∈ iUnionUpTo p (lastStep p) ∨ p.τ * BallPackage.r p.toBallPackage z < R p (lastStep p) h : ¬BallPackage.c p.toBallPackage x ∈ iUnionUpTo p (lastStep p) H : p.τ * BallPackage.r p.toBallPackage x < R p (lastStep p) ⊢ False [PROOFSTEP] have Rpos : 0 < p.R p.lastStep := by apply lt_trans (mul_pos (_root_.zero_lt_one.trans p.one_lt_tau) (p.rpos _)) H [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α x : β A : ∀ (z : β), BallPackage.c p.toBallPackage z ∈ iUnionUpTo p (lastStep p) ∨ p.τ * BallPackage.r p.toBallPackage z < R p (lastStep p) h : ¬BallPackage.c p.toBallPackage x ∈ iUnionUpTo p (lastStep p) H : p.τ * BallPackage.r p.toBallPackage x < R p (lastStep p) ⊢ 0 < R p (lastStep p) [PROOFSTEP] apply lt_trans (mul_pos (_root_.zero_lt_one.trans p.one_lt_tau) (p.rpos _)) H [GOAL] case inr α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α x : β A : ∀ (z : β), BallPackage.c p.toBallPackage z ∈ iUnionUpTo p (lastStep p) ∨ p.τ * BallPackage.r p.toBallPackage z < R p (lastStep p) h : ¬BallPackage.c p.toBallPackage x ∈ iUnionUpTo p (lastStep p) H : p.τ * BallPackage.r p.toBallPackage x < R p (lastStep p) Rpos : 0 < R p (lastStep p) ⊢ False [PROOFSTEP] have B : p.τ⁻¹ * p.R p.lastStep < p.R p.lastStep := by conv_rhs => rw [← one_mul (p.R p.lastStep)] exact mul_lt_mul (inv_lt_one p.one_lt_tau) le_rfl Rpos zero_le_one [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α x : β A : ∀ (z : β), BallPackage.c p.toBallPackage z ∈ iUnionUpTo p (lastStep p) ∨ p.τ * BallPackage.r p.toBallPackage z < R p (lastStep p) h : ¬BallPackage.c p.toBallPackage x ∈ iUnionUpTo p (lastStep p) H : p.τ * BallPackage.r p.toBallPackage x < R p (lastStep p) Rpos : 0 < R p (lastStep p) ⊢ p.τ⁻¹ * R p (lastStep p) < R p (lastStep p) [PROOFSTEP] conv_rhs => rw [← one_mul (p.R p.lastStep)] [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α x : β A : ∀ (z : β), BallPackage.c p.toBallPackage z ∈ iUnionUpTo p (lastStep p) ∨ p.τ * BallPackage.r p.toBallPackage z < R p (lastStep p) h : ¬BallPackage.c p.toBallPackage x ∈ iUnionUpTo p (lastStep p) H : p.τ * BallPackage.r p.toBallPackage x < R p (lastStep p) Rpos : 0 < R p (lastStep p) | R p (lastStep p) [PROOFSTEP] rw [← one_mul (p.R p.lastStep)] [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α x : β A : ∀ (z : β), BallPackage.c p.toBallPackage z ∈ iUnionUpTo p (lastStep p) ∨ p.τ * BallPackage.r p.toBallPackage z < R p (lastStep p) h : ¬BallPackage.c p.toBallPackage x ∈ iUnionUpTo p (lastStep p) H : p.τ * BallPackage.r p.toBallPackage x < R p (lastStep p) Rpos : 0 < R p (lastStep p) | R p (lastStep p) [PROOFSTEP] rw [← one_mul (p.R p.lastStep)] [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α x : β A : ∀ (z : β), BallPackage.c p.toBallPackage z ∈ iUnionUpTo p (lastStep p) ∨ p.τ * BallPackage.r p.toBallPackage z < R p (lastStep p) h : ¬BallPackage.c p.toBallPackage x ∈ iUnionUpTo p (lastStep p) H : p.τ * BallPackage.r p.toBallPackage x < R p (lastStep p) Rpos : 0 < R p (lastStep p) | R p (lastStep p) [PROOFSTEP] rw [← one_mul (p.R p.lastStep)] [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α x : β A : ∀ (z : β), BallPackage.c p.toBallPackage z ∈ iUnionUpTo p (lastStep p) ∨ p.τ * BallPackage.r p.toBallPackage z < R p (lastStep p) h : ¬BallPackage.c p.toBallPackage x ∈ iUnionUpTo p (lastStep p) H : p.τ * BallPackage.r p.toBallPackage x < R p (lastStep p) Rpos : 0 < R p (lastStep p) ⊢ p.τ⁻¹ * R p (lastStep p) < 1 * R p (lastStep p) [PROOFSTEP] exact mul_lt_mul (inv_lt_one p.one_lt_tau) le_rfl Rpos zero_le_one [GOAL] case inr α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α x : β A : ∀ (z : β), BallPackage.c p.toBallPackage z ∈ iUnionUpTo p (lastStep p) ∨ p.τ * BallPackage.r p.toBallPackage z < R p (lastStep p) h : ¬BallPackage.c p.toBallPackage x ∈ iUnionUpTo p (lastStep p) H : p.τ * BallPackage.r p.toBallPackage x < R p (lastStep p) Rpos : 0 < R p (lastStep p) B : p.τ⁻¹ * R p (lastStep p) < R p (lastStep p) ⊢ False [PROOFSTEP] obtain ⟨y, hy1, hy2⟩ : ∃ y : β, p.c y ∉ p.iUnionUpTo p.lastStep ∧ p.τ⁻¹ * p.R p.lastStep < p.r y := by have := exists_lt_of_lt_csSup ?_ B · simpa only [exists_prop, mem_range, exists_exists_and_eq_and, Subtype.exists, Subtype.coe_mk] rw [← image_univ, nonempty_image_iff] exact ⟨⟨_, h⟩, mem_univ _⟩ [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α x : β A : ∀ (z : β), BallPackage.c p.toBallPackage z ∈ iUnionUpTo p (lastStep p) ∨ p.τ * BallPackage.r p.toBallPackage z < R p (lastStep p) h : ¬BallPackage.c p.toBallPackage x ∈ iUnionUpTo p (lastStep p) H : p.τ * BallPackage.r p.toBallPackage x < R p (lastStep p) Rpos : 0 < R p (lastStep p) B : p.τ⁻¹ * R p (lastStep p) < R p (lastStep p) ⊢ ∃ y, ¬BallPackage.c p.toBallPackage y ∈ iUnionUpTo p (lastStep p) ∧ p.τ⁻¹ * R p (lastStep p) < BallPackage.r p.toBallPackage y [PROOFSTEP] have := exists_lt_of_lt_csSup ?_ B [GOAL] case refine_2 α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α x : β A : ∀ (z : β), BallPackage.c p.toBallPackage z ∈ iUnionUpTo p (lastStep p) ∨ p.τ * BallPackage.r p.toBallPackage z < R p (lastStep p) h : ¬BallPackage.c p.toBallPackage x ∈ iUnionUpTo p (lastStep p) H : p.τ * BallPackage.r p.toBallPackage x < R p (lastStep p) Rpos : 0 < R p (lastStep p) B : p.τ⁻¹ * R p (lastStep p) < R p (lastStep p) this : ∃ a, (a ∈ range fun b => BallPackage.r p.toBallPackage ↑b) ∧ p.τ⁻¹ * R p (lastStep p) < a ⊢ ∃ y, ¬BallPackage.c p.toBallPackage y ∈ iUnionUpTo p (lastStep p) ∧ p.τ⁻¹ * R p (lastStep p) < BallPackage.r p.toBallPackage y [PROOFSTEP] simpa only [exists_prop, mem_range, exists_exists_and_eq_and, Subtype.exists, Subtype.coe_mk] [GOAL] case refine_1 α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α x : β A : ∀ (z : β), BallPackage.c p.toBallPackage z ∈ iUnionUpTo p (lastStep p) ∨ p.τ * BallPackage.r p.toBallPackage z < R p (lastStep p) h : ¬BallPackage.c p.toBallPackage x ∈ iUnionUpTo p (lastStep p) H : p.τ * BallPackage.r p.toBallPackage x < R p (lastStep p) Rpos : 0 < R p (lastStep p) B : p.τ⁻¹ * R p (lastStep p) < R p (lastStep p) ⊢ Set.Nonempty (range fun b => BallPackage.r p.toBallPackage ↑b) [PROOFSTEP] rw [← image_univ, nonempty_image_iff] [GOAL] case refine_1 α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α x : β A : ∀ (z : β), BallPackage.c p.toBallPackage z ∈ iUnionUpTo p (lastStep p) ∨ p.τ * BallPackage.r p.toBallPackage z < R p (lastStep p) h : ¬BallPackage.c p.toBallPackage x ∈ iUnionUpTo p (lastStep p) H : p.τ * BallPackage.r p.toBallPackage x < R p (lastStep p) Rpos : 0 < R p (lastStep p) B : p.τ⁻¹ * R p (lastStep p) < R p (lastStep p) ⊢ Set.Nonempty univ [PROOFSTEP] exact ⟨⟨_, h⟩, mem_univ _⟩ [GOAL] case inr.intro.intro α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α x : β A : ∀ (z : β), BallPackage.c p.toBallPackage z ∈ iUnionUpTo p (lastStep p) ∨ p.τ * BallPackage.r p.toBallPackage z < R p (lastStep p) h : ¬BallPackage.c p.toBallPackage x ∈ iUnionUpTo p (lastStep p) H : p.τ * BallPackage.r p.toBallPackage x < R p (lastStep p) Rpos : 0 < R p (lastStep p) B : p.τ⁻¹ * R p (lastStep p) < R p (lastStep p) y : β hy1 : ¬BallPackage.c p.toBallPackage y ∈ iUnionUpTo p (lastStep p) hy2 : p.τ⁻¹ * R p (lastStep p) < BallPackage.r p.toBallPackage y ⊢ False [PROOFSTEP] rcases A y with (Hy | Hy) [GOAL] case inr.intro.intro.inl α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α x : β A : ∀ (z : β), BallPackage.c p.toBallPackage z ∈ iUnionUpTo p (lastStep p) ∨ p.τ * BallPackage.r p.toBallPackage z < R p (lastStep p) h : ¬BallPackage.c p.toBallPackage x ∈ iUnionUpTo p (lastStep p) H : p.τ * BallPackage.r p.toBallPackage x < R p (lastStep p) Rpos : 0 < R p (lastStep p) B : p.τ⁻¹ * R p (lastStep p) < R p (lastStep p) y : β hy1 : ¬BallPackage.c p.toBallPackage y ∈ iUnionUpTo p (lastStep p) hy2 : p.τ⁻¹ * R p (lastStep p) < BallPackage.r p.toBallPackage y Hy : BallPackage.c p.toBallPackage y ∈ iUnionUpTo p (lastStep p) ⊢ False [PROOFSTEP] exact hy1 Hy [GOAL] case inr.intro.intro.inr α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α x : β A : ∀ (z : β), BallPackage.c p.toBallPackage z ∈ iUnionUpTo p (lastStep p) ∨ p.τ * BallPackage.r p.toBallPackage z < R p (lastStep p) h : ¬BallPackage.c p.toBallPackage x ∈ iUnionUpTo p (lastStep p) H : p.τ * BallPackage.r p.toBallPackage x < R p (lastStep p) Rpos : 0 < R p (lastStep p) B : p.τ⁻¹ * R p (lastStep p) < R p (lastStep p) y : β hy1 : ¬BallPackage.c p.toBallPackage y ∈ iUnionUpTo p (lastStep p) hy2 : p.τ⁻¹ * R p (lastStep p) < BallPackage.r p.toBallPackage y Hy : p.τ * BallPackage.r p.toBallPackage y < R p (lastStep p) ⊢ False [PROOFSTEP] rw [← div_eq_inv_mul] at hy2 [GOAL] case inr.intro.intro.inr α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α x : β A : ∀ (z : β), BallPackage.c p.toBallPackage z ∈ iUnionUpTo p (lastStep p) ∨ p.τ * BallPackage.r p.toBallPackage z < R p (lastStep p) h : ¬BallPackage.c p.toBallPackage x ∈ iUnionUpTo p (lastStep p) H : p.τ * BallPackage.r p.toBallPackage x < R p (lastStep p) Rpos : 0 < R p (lastStep p) B : p.τ⁻¹ * R p (lastStep p) < R p (lastStep p) y : β hy1 : ¬BallPackage.c p.toBallPackage y ∈ iUnionUpTo p (lastStep p) hy2 : R p (lastStep p) / p.τ < BallPackage.r p.toBallPackage y Hy : p.τ * BallPackage.r p.toBallPackage y < R p (lastStep p) ⊢ False [PROOFSTEP] have := (div_le_iff' (_root_.zero_lt_one.trans p.one_lt_tau)).1 hy2.le [GOAL] case inr.intro.intro.inr α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α x : β A : ∀ (z : β), BallPackage.c p.toBallPackage z ∈ iUnionUpTo p (lastStep p) ∨ p.τ * BallPackage.r p.toBallPackage z < R p (lastStep p) h : ¬BallPackage.c p.toBallPackage x ∈ iUnionUpTo p (lastStep p) H : p.τ * BallPackage.r p.toBallPackage x < R p (lastStep p) Rpos : 0 < R p (lastStep p) B : p.τ⁻¹ * R p (lastStep p) < R p (lastStep p) y : β hy1 : ¬BallPackage.c p.toBallPackage y ∈ iUnionUpTo p (lastStep p) hy2 : R p (lastStep p) / p.τ < BallPackage.r p.toBallPackage y Hy : p.τ * BallPackage.r p.toBallPackage y < R p (lastStep p) this : R p (lastStep p) ≤ p.τ * BallPackage.r p.toBallPackage y ⊢ False [PROOFSTEP] exact lt_irrefl _ (Hy.trans_le this) [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i : Ordinal.{u} hi : i < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) ⊢ color p i < N [PROOFSTEP] induction' i using Ordinal.induction with i IH [GOAL] case h α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p ⊢ color p i < N [PROOFSTEP] let A : Set ℕ := ⋃ (j : { j // j < i }) (_ : (closedBall (p.c (p.index j)) (p.r (p.index j)) ∩ closedBall (p.c (p.index i)) (p.r (p.index i))).Nonempty), {p.color j} [GOAL] case h α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} ⊢ color p i < N [PROOFSTEP] have color_i : p.color i = sInf (univ \ A) := by rw [color] [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} ⊢ color p i = sInf (univ \ A) [PROOFSTEP] rw [color] [GOAL] case h α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) ⊢ color p i < N [PROOFSTEP] rw [color_i] [GOAL] case h α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) ⊢ sInf (univ \ A) < N [PROOFSTEP] have N_mem : N ∈ univ \ A := by simp only [not_exists, true_and_iff, exists_prop, mem_iUnion, mem_singleton_iff, mem_closedBall, not_and, mem_univ, mem_diff, Subtype.exists, Subtype.coe_mk] intro j ji _ exact (IH j ji (ji.trans hi)).ne' [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) ⊢ N ∈ univ \ A [PROOFSTEP] simp only [not_exists, true_and_iff, exists_prop, mem_iUnion, mem_singleton_iff, mem_closedBall, not_and, mem_univ, mem_diff, Subtype.exists, Subtype.coe_mk] [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) ⊢ ∀ (x : Ordinal.{u}), x < i → Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p x)) (BallPackage.r p.toBallPackage (index p x)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) → ¬N = color p x [PROOFSTEP] intro j ji _ [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) j : Ordinal.{u} ji : j < i a✝ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p j)) (BallPackage.r p.toBallPackage (index p j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ⊢ ¬N = color p j [PROOFSTEP] exact (IH j ji (ji.trans hi)).ne' [GOAL] case h α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A ⊢ sInf (univ \ A) < N [PROOFSTEP] suffices sInf (univ \ A) ≠ N by rcases(csInf_le (OrderBot.bddBelow (univ \ A)) N_mem).lt_or_eq with (H | H) · exact H · exact (this H).elim [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A this : sInf (univ \ A) ≠ N ⊢ sInf (univ \ A) < N [PROOFSTEP] rcases(csInf_le (OrderBot.bddBelow (univ \ A)) N_mem).lt_or_eq with (H | H) [GOAL] case inl α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A this : sInf (univ \ A) ≠ N H : sInf (univ \ A) < N ⊢ sInf (univ \ A) < N [PROOFSTEP] exact H [GOAL] case inr α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A this : sInf (univ \ A) ≠ N H : sInf (univ \ A) = N ⊢ sInf (univ \ A) < N [PROOFSTEP] exact (this H).elim [GOAL] case h α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A ⊢ sInf (univ \ A) ≠ N [PROOFSTEP] intro Inf_eq_N [GOAL] case h α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N ⊢ False [PROOFSTEP] have : ∀ k, k < N → ∃ j, j < i ∧ (closedBall (p.c (p.index j)) (p.r (p.index j)) ∩ closedBall (p.c (p.index i)) (p.r (p.index i))).Nonempty ∧ k = p.color j := by intro k hk rw [← Inf_eq_N] at hk have : k ∈ A := by simpa only [true_and_iff, mem_univ, Classical.not_not, mem_diff] using Nat.not_mem_of_lt_sInf hk simp [and_assoc, -exists_and_left] at this simpa only [exists_prop, mem_iUnion, mem_singleton_iff, mem_closedBall, Subtype.exists, Subtype.coe_mk] [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N ⊢ ∀ (k : ℕ), k < N → ∃ j, j < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p j)) (BallPackage.r p.toBallPackage (index p j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p j [PROOFSTEP] intro k hk [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N k : ℕ hk : k < N ⊢ ∃ j, j < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p j)) (BallPackage.r p.toBallPackage (index p j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p j [PROOFSTEP] rw [← Inf_eq_N] at hk [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N k : ℕ hk : k < sInf (univ \ A) ⊢ ∃ j, j < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p j)) (BallPackage.r p.toBallPackage (index p j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p j [PROOFSTEP] have : k ∈ A := by simpa only [true_and_iff, mem_univ, Classical.not_not, mem_diff] using Nat.not_mem_of_lt_sInf hk [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N k : ℕ hk : k < sInf (univ \ A) ⊢ k ∈ A [PROOFSTEP] simpa only [true_and_iff, mem_univ, Classical.not_not, mem_diff] using Nat.not_mem_of_lt_sInf hk [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N k : ℕ hk : k < sInf (univ \ A) this : k ∈ A ⊢ ∃ j, j < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p j)) (BallPackage.r p.toBallPackage (index p j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p j [PROOFSTEP] simp [and_assoc, -exists_and_left] at this [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N k : ℕ hk : k < sInf (univ \ A) this : ∃ a, a < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p a)) (BallPackage.r p.toBallPackage (index p a)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p a ⊢ ∃ j, j < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p j)) (BallPackage.r p.toBallPackage (index p j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p j [PROOFSTEP] simpa only [exists_prop, mem_iUnion, mem_singleton_iff, mem_closedBall, Subtype.exists, Subtype.coe_mk] [GOAL] case h α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N this : ∀ (k : ℕ), k < N → ∃ j, j < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p j)) (BallPackage.r p.toBallPackage (index p j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p j ⊢ False [PROOFSTEP] choose! g hg using this [GOAL] case h α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) ⊢ False [PROOFSTEP] let G : ℕ → Ordinal := fun n => if n = N then i else g n [GOAL] case h α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n ⊢ False [PROOFSTEP] have color_G : ∀ n, n ≤ N → p.color (G n) = n := by intro n hn rcases hn.eq_or_lt with (rfl | H) · simp only; simp only [color_i, Inf_eq_N, if_true, eq_self_iff_true] · simp only; simp only [H.ne, (hg n H).right.right.symm, if_false] [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n ⊢ ∀ (n : ℕ), n ≤ N → color p (G n) = n [PROOFSTEP] intro n hn [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n n : ℕ hn : n ≤ N ⊢ color p (G n) = n [PROOFSTEP] rcases hn.eq_or_lt with (rfl | H) [GOAL] case inl α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p i : Ordinal.{u} hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) g : ℕ → Ordinal.{u} n : ℕ hN : IsEmpty (SatelliteConfig α n p.τ) IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < n N_mem : n ∈ univ \ A Inf_eq_N : sInf (univ \ A) = n hg : ∀ (k : ℕ), k < n → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n_1 => if n_1 = n then i else g n_1 hn : n ≤ n ⊢ color p (G n) = n [PROOFSTEP] simp only [GOAL] case inl α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p i : Ordinal.{u} hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) g : ℕ → Ordinal.{u} n : ℕ hN : IsEmpty (SatelliteConfig α n p.τ) IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < n N_mem : n ∈ univ \ A Inf_eq_N : sInf (univ \ A) = n hg : ∀ (k : ℕ), k < n → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n_1 => if n_1 = n then i else g n_1 hn : n ≤ n ⊢ color p (if True then i else g n) = n [PROOFSTEP] simp only [color_i, Inf_eq_N, if_true, eq_self_iff_true] [GOAL] case inr α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n n : ℕ hn : n ≤ N H : n < N ⊢ color p (G n) = n [PROOFSTEP] simp only [GOAL] case inr α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n n : ℕ hn : n ≤ N H : n < N ⊢ color p (if n = N then i else g n) = n [PROOFSTEP] simp only [H.ne, (hg n H).right.right.symm, if_false] [GOAL] case h α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n ⊢ False [PROOFSTEP] have G_lt_last : ∀ n, n ≤ N → G n < p.lastStep := by intro n hn rcases hn.eq_or_lt with (rfl | H) · simp only; simp only [hi, if_true, eq_self_iff_true] · simp only; simp only [H.ne, (hg n H).left.trans hi, if_false] [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n ⊢ ∀ (n : ℕ), n ≤ N → G n < lastStep p [PROOFSTEP] intro n hn [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n n : ℕ hn : n ≤ N ⊢ G n < lastStep p [PROOFSTEP] rcases hn.eq_or_lt with (rfl | H) [GOAL] case inl α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p i : Ordinal.{u} hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) g : ℕ → Ordinal.{u} n : ℕ hN : IsEmpty (SatelliteConfig α n p.τ) IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < n N_mem : n ∈ univ \ A Inf_eq_N : sInf (univ \ A) = n hg : ∀ (k : ℕ), k < n → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n_1 => if n_1 = n then i else g n_1 color_G : ∀ (n_1 : ℕ), n_1 ≤ n → color p (G n_1) = n_1 hn : n ≤ n ⊢ G n < lastStep p [PROOFSTEP] simp only [GOAL] case inl α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p i : Ordinal.{u} hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) g : ℕ → Ordinal.{u} n : ℕ hN : IsEmpty (SatelliteConfig α n p.τ) IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < n N_mem : n ∈ univ \ A Inf_eq_N : sInf (univ \ A) = n hg : ∀ (k : ℕ), k < n → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n_1 => if n_1 = n then i else g n_1 color_G : ∀ (n_1 : ℕ), n_1 ≤ n → color p (G n_1) = n_1 hn : n ≤ n ⊢ (if True then i else g n) < lastStep p [PROOFSTEP] simp only [hi, if_true, eq_self_iff_true] [GOAL] case inr α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n n : ℕ hn : n ≤ N H : n < N ⊢ G n < lastStep p [PROOFSTEP] simp only [GOAL] case inr α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n n : ℕ hn : n ≤ N H : n < N ⊢ (if n = N then i else g n) < lastStep p [PROOFSTEP] simp only [H.ne, (hg n H).left.trans hi, if_false] [GOAL] case h α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p ⊢ False [PROOFSTEP] have fGn : ∀ n, n ≤ N → p.c (p.index (G n)) ∉ p.iUnionUpTo (G n) ∧ p.R (G n) ≤ p.τ * p.r (p.index (G n)) := by intro n hn have : p.index (G n) = Classical.epsilon fun t => p.c t ∉ p.iUnionUpTo (G n) ∧ p.R (G n) ≤ p.τ * p.r t := by rw [index]; rfl rw [this] have : ∃ t, p.c t ∉ p.iUnionUpTo (G n) ∧ p.R (G n) ≤ p.τ * p.r t := by simpa only [not_exists, exists_prop, not_and, not_lt, not_le, mem_setOf_eq, not_forall] using not_mem_of_lt_csInf (G_lt_last n hn) (OrderBot.bddBelow _) exact Classical.epsilon_spec this [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p ⊢ ∀ (n : ℕ), n ≤ N → ¬BallPackage.c p.toBallPackage (index p (G n)) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G n)) [PROOFSTEP] intro n hn [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p n : ℕ hn : n ≤ N ⊢ ¬BallPackage.c p.toBallPackage (index p (G n)) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G n)) [PROOFSTEP] have : p.index (G n) = Classical.epsilon fun t => p.c t ∉ p.iUnionUpTo (G n) ∧ p.R (G n) ≤ p.τ * p.r t := by rw [index]; rfl [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p n : ℕ hn : n ≤ N ⊢ index p (G n) = Classical.epsilon fun t => ¬BallPackage.c p.toBallPackage t ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage t [PROOFSTEP] rw [index] [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p n : ℕ hn : n ≤ N ⊢ (Classical.epsilon fun b => ¬BallPackage.c p.toBallPackage b ∈ ⋃ (j : { j // j < G n }), ball (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∧ ⨆ (b : { b // ¬BallPackage.c p.toBallPackage b ∈ ⋃ (j : { j // j < G n }), ball (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) }), BallPackage.r p.toBallPackage ↑b ≤ p.τ * BallPackage.r p.toBallPackage b) = Classical.epsilon fun t => ¬BallPackage.c p.toBallPackage t ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage t [PROOFSTEP] rfl [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p n : ℕ hn : n ≤ N this : index p (G n) = Classical.epsilon fun t => ¬BallPackage.c p.toBallPackage t ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage t ⊢ ¬BallPackage.c p.toBallPackage (index p (G n)) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G n)) [PROOFSTEP] rw [this] [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p n : ℕ hn : n ≤ N this : index p (G n) = Classical.epsilon fun t => ¬BallPackage.c p.toBallPackage t ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage t ⊢ ¬BallPackage.c p.toBallPackage (Classical.epsilon fun t => ¬BallPackage.c p.toBallPackage t ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage t) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (Classical.epsilon fun t => ¬BallPackage.c p.toBallPackage t ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage t) [PROOFSTEP] have : ∃ t, p.c t ∉ p.iUnionUpTo (G n) ∧ p.R (G n) ≤ p.τ * p.r t := by simpa only [not_exists, exists_prop, not_and, not_lt, not_le, mem_setOf_eq, not_forall] using not_mem_of_lt_csInf (G_lt_last n hn) (OrderBot.bddBelow _) [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p n : ℕ hn : n ≤ N this : index p (G n) = Classical.epsilon fun t => ¬BallPackage.c p.toBallPackage t ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage t ⊢ ∃ t, ¬BallPackage.c p.toBallPackage t ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage t [PROOFSTEP] simpa only [not_exists, exists_prop, not_and, not_lt, not_le, mem_setOf_eq, not_forall] using not_mem_of_lt_csInf (G_lt_last n hn) (OrderBot.bddBelow _) [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p n : ℕ hn : n ≤ N this✝ : index p (G n) = Classical.epsilon fun t => ¬BallPackage.c p.toBallPackage t ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage t this : ∃ t, ¬BallPackage.c p.toBallPackage t ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage t ⊢ ¬BallPackage.c p.toBallPackage (Classical.epsilon fun t => ¬BallPackage.c p.toBallPackage t ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage t) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (Classical.epsilon fun t => ¬BallPackage.c p.toBallPackage t ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage t) [PROOFSTEP] exact Classical.epsilon_spec this [GOAL] case h α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p fGn : ∀ (n : ℕ), n ≤ N → ¬BallPackage.c p.toBallPackage (index p (G n)) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G n)) ⊢ False [PROOFSTEP] have Gab : ∀ a b : Fin (Nat.succ N), G a < G b → p.r (p.index (G a)) ≤ dist (p.c (p.index (G a))) (p.c (p.index (G b))) ∧ p.r (p.index (G b)) ≤ p.τ * p.r (p.index (G a)) := by intro a b G_lt have ha : (a : ℕ) ≤ N := Nat.lt_succ_iff.1 a.2 have hb : (b : ℕ) ≤ N := Nat.lt_succ_iff.1 b.2 constructor · have := (fGn b hb).1 simp only [iUnionUpTo, not_exists, exists_prop, mem_iUnion, mem_closedBall, not_and, not_le, Subtype.exists, Subtype.coe_mk] at this simpa only [dist_comm, mem_ball, not_lt] using this (G a) G_lt · apply le_trans _ (fGn a ha).2 have B : p.c (p.index (G b)) ∉ p.iUnionUpTo (G a) := by intro H; exact (fGn b hb).1 (p.monotone_iUnionUpTo G_lt.le H) let b' : { t // p.c t ∉ p.iUnionUpTo (G a) } := ⟨p.index (G b), B⟩ apply @le_ciSup _ _ _ (fun t : { t // p.c t ∉ p.iUnionUpTo (G a) } => p.r t) _ b' refine' ⟨p.r_bound, fun t ht => _⟩ simp only [exists_prop, mem_range, Subtype.exists, Subtype.coe_mk] at ht rcases ht with ⟨u, hu⟩ rw [← hu.2] exact p.r_le _ -- therefore, one may use them to construct a satellite configuration with `N+1` points [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p fGn : ∀ (n : ℕ), n ≤ N → ¬BallPackage.c p.toBallPackage (index p (G n)) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G n)) ⊢ ∀ (a b : Fin (Nat.succ N)), G ↑a < G ↑b → BallPackage.r p.toBallPackage (index p (G ↑a)) ≤ dist (BallPackage.c p.toBallPackage (index p (G ↑a))) (BallPackage.c p.toBallPackage (index p (G ↑b))) ∧ BallPackage.r p.toBallPackage (index p (G ↑b)) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G ↑a)) [PROOFSTEP] intro a b G_lt [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p fGn : ∀ (n : ℕ), n ≤ N → ¬BallPackage.c p.toBallPackage (index p (G n)) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G n)) a b : Fin (Nat.succ N) G_lt : G ↑a < G ↑b ⊢ BallPackage.r p.toBallPackage (index p (G ↑a)) ≤ dist (BallPackage.c p.toBallPackage (index p (G ↑a))) (BallPackage.c p.toBallPackage (index p (G ↑b))) ∧ BallPackage.r p.toBallPackage (index p (G ↑b)) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G ↑a)) [PROOFSTEP] have ha : (a : ℕ) ≤ N := Nat.lt_succ_iff.1 a.2 [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p fGn : ∀ (n : ℕ), n ≤ N → ¬BallPackage.c p.toBallPackage (index p (G n)) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G n)) a b : Fin (Nat.succ N) G_lt : G ↑a < G ↑b ha : ↑a ≤ N ⊢ BallPackage.r p.toBallPackage (index p (G ↑a)) ≤ dist (BallPackage.c p.toBallPackage (index p (G ↑a))) (BallPackage.c p.toBallPackage (index p (G ↑b))) ∧ BallPackage.r p.toBallPackage (index p (G ↑b)) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G ↑a)) [PROOFSTEP] have hb : (b : ℕ) ≤ N := Nat.lt_succ_iff.1 b.2 [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p fGn : ∀ (n : ℕ), n ≤ N → ¬BallPackage.c p.toBallPackage (index p (G n)) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G n)) a b : Fin (Nat.succ N) G_lt : G ↑a < G ↑b ha : ↑a ≤ N hb : ↑b ≤ N ⊢ BallPackage.r p.toBallPackage (index p (G ↑a)) ≤ dist (BallPackage.c p.toBallPackage (index p (G ↑a))) (BallPackage.c p.toBallPackage (index p (G ↑b))) ∧ BallPackage.r p.toBallPackage (index p (G ↑b)) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G ↑a)) [PROOFSTEP] constructor [GOAL] case left α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p fGn : ∀ (n : ℕ), n ≤ N → ¬BallPackage.c p.toBallPackage (index p (G n)) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G n)) a b : Fin (Nat.succ N) G_lt : G ↑a < G ↑b ha : ↑a ≤ N hb : ↑b ≤ N ⊢ BallPackage.r p.toBallPackage (index p (G ↑a)) ≤ dist (BallPackage.c p.toBallPackage (index p (G ↑a))) (BallPackage.c p.toBallPackage (index p (G ↑b))) [PROOFSTEP] have := (fGn b hb).1 [GOAL] case left α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p fGn : ∀ (n : ℕ), n ≤ N → ¬BallPackage.c p.toBallPackage (index p (G n)) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G n)) a b : Fin (Nat.succ N) G_lt : G ↑a < G ↑b ha : ↑a ≤ N hb : ↑b ≤ N this : ¬BallPackage.c p.toBallPackage (index p (G ↑b)) ∈ iUnionUpTo p (G ↑b) ⊢ BallPackage.r p.toBallPackage (index p (G ↑a)) ≤ dist (BallPackage.c p.toBallPackage (index p (G ↑a))) (BallPackage.c p.toBallPackage (index p (G ↑b))) [PROOFSTEP] simp only [iUnionUpTo, not_exists, exists_prop, mem_iUnion, mem_closedBall, not_and, not_le, Subtype.exists, Subtype.coe_mk] at this [GOAL] case left α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p fGn : ∀ (n : ℕ), n ≤ N → ¬BallPackage.c p.toBallPackage (index p (G n)) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G n)) a b : Fin (Nat.succ N) G_lt : G ↑a < G ↑b ha : ↑a ≤ N hb : ↑b ≤ N this : ∀ (x : Ordinal.{u}), (x < if ↑b = N then i else g ↑b) → ¬BallPackage.c p.toBallPackage (index p (if ↑b = N then i else g ↑b)) ∈ ball (BallPackage.c p.toBallPackage (index p x)) (BallPackage.r p.toBallPackage (index p x)) ⊢ BallPackage.r p.toBallPackage (index p (G ↑a)) ≤ dist (BallPackage.c p.toBallPackage (index p (G ↑a))) (BallPackage.c p.toBallPackage (index p (G ↑b))) [PROOFSTEP] simpa only [dist_comm, mem_ball, not_lt] using this (G a) G_lt [GOAL] case right α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p fGn : ∀ (n : ℕ), n ≤ N → ¬BallPackage.c p.toBallPackage (index p (G n)) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G n)) a b : Fin (Nat.succ N) G_lt : G ↑a < G ↑b ha : ↑a ≤ N hb : ↑b ≤ N ⊢ BallPackage.r p.toBallPackage (index p (G ↑b)) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G ↑a)) [PROOFSTEP] apply le_trans _ (fGn a ha).2 [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p fGn : ∀ (n : ℕ), n ≤ N → ¬BallPackage.c p.toBallPackage (index p (G n)) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G n)) a b : Fin (Nat.succ N) G_lt : G ↑a < G ↑b ha : ↑a ≤ N hb : ↑b ≤ N ⊢ BallPackage.r p.toBallPackage (index p (G ↑b)) ≤ R p (G ↑a) [PROOFSTEP] have B : p.c (p.index (G b)) ∉ p.iUnionUpTo (G a) := by intro H; exact (fGn b hb).1 (p.monotone_iUnionUpTo G_lt.le H) [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p fGn : ∀ (n : ℕ), n ≤ N → ¬BallPackage.c p.toBallPackage (index p (G n)) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G n)) a b : Fin (Nat.succ N) G_lt : G ↑a < G ↑b ha : ↑a ≤ N hb : ↑b ≤ N ⊢ ¬BallPackage.c p.toBallPackage (index p (G ↑b)) ∈ iUnionUpTo p (G ↑a) [PROOFSTEP] intro H [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p fGn : ∀ (n : ℕ), n ≤ N → ¬BallPackage.c p.toBallPackage (index p (G n)) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G n)) a b : Fin (Nat.succ N) G_lt : G ↑a < G ↑b ha : ↑a ≤ N hb : ↑b ≤ N H : BallPackage.c p.toBallPackage (index p (G ↑b)) ∈ iUnionUpTo p (G ↑a) ⊢ False [PROOFSTEP] exact (fGn b hb).1 (p.monotone_iUnionUpTo G_lt.le H) [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p fGn : ∀ (n : ℕ), n ≤ N → ¬BallPackage.c p.toBallPackage (index p (G n)) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G n)) a b : Fin (Nat.succ N) G_lt : G ↑a < G ↑b ha : ↑a ≤ N hb : ↑b ≤ N B : ¬BallPackage.c p.toBallPackage (index p (G ↑b)) ∈ iUnionUpTo p (G ↑a) ⊢ BallPackage.r p.toBallPackage (index p (G ↑b)) ≤ R p (G ↑a) [PROOFSTEP] let b' : { t // p.c t ∉ p.iUnionUpTo (G a) } := ⟨p.index (G b), B⟩ [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p fGn : ∀ (n : ℕ), n ≤ N → ¬BallPackage.c p.toBallPackage (index p (G n)) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G n)) a b : Fin (Nat.succ N) G_lt : G ↑a < G ↑b ha : ↑a ≤ N hb : ↑b ≤ N B : ¬BallPackage.c p.toBallPackage (index p (G ↑b)) ∈ iUnionUpTo p (G ↑a) b' : { t // ¬BallPackage.c p.toBallPackage t ∈ iUnionUpTo p (G ↑a) } := { val := index p (G ↑b), property := B } ⊢ BallPackage.r p.toBallPackage (index p (G ↑b)) ≤ R p (G ↑a) [PROOFSTEP] apply @le_ciSup _ _ _ (fun t : { t // p.c t ∉ p.iUnionUpTo (G a) } => p.r t) _ b' [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p fGn : ∀ (n : ℕ), n ≤ N → ¬BallPackage.c p.toBallPackage (index p (G n)) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G n)) a b : Fin (Nat.succ N) G_lt : G ↑a < G ↑b ha : ↑a ≤ N hb : ↑b ≤ N B : ¬BallPackage.c p.toBallPackage (index p (G ↑b)) ∈ iUnionUpTo p (G ↑a) b' : { t // ¬BallPackage.c p.toBallPackage t ∈ iUnionUpTo p (G ↑a) } := { val := index p (G ↑b), property := B } ⊢ BddAbove (range fun t => BallPackage.r p.toBallPackage ↑t) [PROOFSTEP] refine' ⟨p.r_bound, fun t ht => _⟩ [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p fGn : ∀ (n : ℕ), n ≤ N → ¬BallPackage.c p.toBallPackage (index p (G n)) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G n)) a b : Fin (Nat.succ N) G_lt : G ↑a < G ↑b ha : ↑a ≤ N hb : ↑b ≤ N B : ¬BallPackage.c p.toBallPackage (index p (G ↑b)) ∈ iUnionUpTo p (G ↑a) b' : { t // ¬BallPackage.c p.toBallPackage t ∈ iUnionUpTo p (G ↑a) } := { val := index p (G ↑b), property := B } t : ℝ ht : t ∈ range fun t => BallPackage.r p.toBallPackage ↑t ⊢ t ≤ p.r_bound [PROOFSTEP] simp only [exists_prop, mem_range, Subtype.exists, Subtype.coe_mk] at ht [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p fGn : ∀ (n : ℕ), n ≤ N → ¬BallPackage.c p.toBallPackage (index p (G n)) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G n)) a b : Fin (Nat.succ N) G_lt : G ↑a < G ↑b ha : ↑a ≤ N hb : ↑b ≤ N B : ¬BallPackage.c p.toBallPackage (index p (G ↑b)) ∈ iUnionUpTo p (G ↑a) b' : { t // ¬BallPackage.c p.toBallPackage t ∈ iUnionUpTo p (G ↑a) } := { val := index p (G ↑b), property := B } t : ℝ ht : ∃ a_1, ¬BallPackage.c p.toBallPackage a_1 ∈ iUnionUpTo p (if ↑a = N then i else g ↑a) ∧ BallPackage.r p.toBallPackage a_1 = t ⊢ t ≤ p.r_bound [PROOFSTEP] rcases ht with ⟨u, hu⟩ [GOAL] case intro α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p fGn : ∀ (n : ℕ), n ≤ N → ¬BallPackage.c p.toBallPackage (index p (G n)) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G n)) a b : Fin (Nat.succ N) G_lt : G ↑a < G ↑b ha : ↑a ≤ N hb : ↑b ≤ N B : ¬BallPackage.c p.toBallPackage (index p (G ↑b)) ∈ iUnionUpTo p (G ↑a) b' : { t // ¬BallPackage.c p.toBallPackage t ∈ iUnionUpTo p (G ↑a) } := { val := index p (G ↑b), property := B } t : ℝ u : β hu : ¬BallPackage.c p.toBallPackage u ∈ iUnionUpTo p (if ↑a = N then i else g ↑a) ∧ BallPackage.r p.toBallPackage u = t ⊢ t ≤ p.r_bound [PROOFSTEP] rw [← hu.2] [GOAL] case intro α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p fGn : ∀ (n : ℕ), n ≤ N → ¬BallPackage.c p.toBallPackage (index p (G n)) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G n)) a b : Fin (Nat.succ N) G_lt : G ↑a < G ↑b ha : ↑a ≤ N hb : ↑b ≤ N B : ¬BallPackage.c p.toBallPackage (index p (G ↑b)) ∈ iUnionUpTo p (G ↑a) b' : { t // ¬BallPackage.c p.toBallPackage t ∈ iUnionUpTo p (G ↑a) } := { val := index p (G ↑b), property := B } t : ℝ u : β hu : ¬BallPackage.c p.toBallPackage u ∈ iUnionUpTo p (if ↑a = N then i else g ↑a) ∧ BallPackage.r p.toBallPackage u = t ⊢ BallPackage.r p.toBallPackage u ≤ p.r_bound [PROOFSTEP] exact p.r_le _ -- therefore, one may use them to construct a satellite configuration with `N+1` points [GOAL] case h α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p fGn : ∀ (n : ℕ), n ≤ N → ¬BallPackage.c p.toBallPackage (index p (G n)) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G n)) Gab : ∀ (a b : Fin (Nat.succ N)), G ↑a < G ↑b → BallPackage.r p.toBallPackage (index p (G ↑a)) ≤ dist (BallPackage.c p.toBallPackage (index p (G ↑a))) (BallPackage.c p.toBallPackage (index p (G ↑b))) ∧ BallPackage.r p.toBallPackage (index p (G ↑b)) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G ↑a)) ⊢ False [PROOFSTEP] let sc : SatelliteConfig α N p.τ := { c := fun k => p.c (p.index (G k)) r := fun k => p.r (p.index (G k)) rpos := fun k => p.rpos (p.index (G k)) h := by intro a b a_ne_b wlog G_le : G a ≤ G b generalizing a b · exact (this b a a_ne_b.symm (le_of_not_le G_le)).symm have G_lt : G a < G b := by rcases G_le.lt_or_eq with (H | H); · exact H have A : (a : ℕ) ≠ b := Fin.val_injective.ne a_ne_b rw [← color_G a (Nat.lt_succ_iff.1 a.2), ← color_G b (Nat.lt_succ_iff.1 b.2), H] at A exact (A rfl).elim exact Or.inl (Gab a b G_lt) hlast := by intro a ha have I : (a : ℕ) < N := ha have : G a < G (Fin.last N) := by dsimp; simp [I.ne, (hg a I).1] exact Gab _ _ this inter := by intro a ha have I : (a : ℕ) < N := ha have J : G (Fin.last N) = i := by dsimp; simp only [if_true, eq_self_iff_true] have K : G a = g a := by dsimp; simp [I.ne, (hg a I).1] convert dist_le_add_of_nonempty_closedBall_inter_closedBall (hg _ I).2.1 } -- this is a contradiction [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p fGn : ∀ (n : ℕ), n ≤ N → ¬BallPackage.c p.toBallPackage (index p (G n)) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G n)) Gab : ∀ (a b : Fin (Nat.succ N)), G ↑a < G ↑b → BallPackage.r p.toBallPackage (index p (G ↑a)) ≤ dist (BallPackage.c p.toBallPackage (index p (G ↑a))) (BallPackage.c p.toBallPackage (index p (G ↑b))) ∧ BallPackage.r p.toBallPackage (index p (G ↑b)) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G ↑a)) ⊢ ∀ (i j : Fin (Nat.succ N)), i ≠ j → (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) i ≤ dist ((fun k => BallPackage.c p.toBallPackage (index p (G ↑k))) i) ((fun k => BallPackage.c p.toBallPackage (index p (G ↑k))) j) ∧ (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) j ≤ p.τ * (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) i ∨ (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) j ≤ dist ((fun k => BallPackage.c p.toBallPackage (index p (G ↑k))) j) ((fun k => BallPackage.c p.toBallPackage (index p (G ↑k))) i) ∧ (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) i ≤ p.τ * (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) j [PROOFSTEP] intro a b a_ne_b [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p fGn : ∀ (n : ℕ), n ≤ N → ¬BallPackage.c p.toBallPackage (index p (G n)) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G n)) Gab : ∀ (a b : Fin (Nat.succ N)), G ↑a < G ↑b → BallPackage.r p.toBallPackage (index p (G ↑a)) ≤ dist (BallPackage.c p.toBallPackage (index p (G ↑a))) (BallPackage.c p.toBallPackage (index p (G ↑b))) ∧ BallPackage.r p.toBallPackage (index p (G ↑b)) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G ↑a)) a b : Fin (Nat.succ N) a_ne_b : a ≠ b ⊢ (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) a ≤ dist ((fun k => BallPackage.c p.toBallPackage (index p (G ↑k))) a) ((fun k => BallPackage.c p.toBallPackage (index p (G ↑k))) b) ∧ (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) b ≤ p.τ * (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) a ∨ (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) b ≤ dist ((fun k => BallPackage.c p.toBallPackage (index p (G ↑k))) b) ((fun k => BallPackage.c p.toBallPackage (index p (G ↑k))) a) ∧ (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) a ≤ p.τ * (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) b [PROOFSTEP] wlog G_le : G a ≤ G b generalizing a b [GOAL] case inr α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p fGn : ∀ (n : ℕ), n ≤ N → ¬BallPackage.c p.toBallPackage (index p (G n)) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G n)) Gab : ∀ (a b : Fin (Nat.succ N)), G ↑a < G ↑b → BallPackage.r p.toBallPackage (index p (G ↑a)) ≤ dist (BallPackage.c p.toBallPackage (index p (G ↑a))) (BallPackage.c p.toBallPackage (index p (G ↑b))) ∧ BallPackage.r p.toBallPackage (index p (G ↑b)) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G ↑a)) a b : Fin (Nat.succ N) a_ne_b : a ≠ b this : ∀ (a b : Fin (Nat.succ N)), a ≠ b → G ↑a ≤ G ↑b → (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) a ≤ dist ((fun k => BallPackage.c p.toBallPackage (index p (G ↑k))) a) ((fun k => BallPackage.c p.toBallPackage (index p (G ↑k))) b) ∧ (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) b ≤ p.τ * (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) a ∨ (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) b ≤ dist ((fun k => BallPackage.c p.toBallPackage (index p (G ↑k))) b) ((fun k => BallPackage.c p.toBallPackage (index p (G ↑k))) a) ∧ (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) a ≤ p.τ * (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) b G_le : ¬G ↑a ≤ G ↑b ⊢ (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) a ≤ dist ((fun k => BallPackage.c p.toBallPackage (index p (G ↑k))) a) ((fun k => BallPackage.c p.toBallPackage (index p (G ↑k))) b) ∧ (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) b ≤ p.τ * (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) a ∨ (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) b ≤ dist ((fun k => BallPackage.c p.toBallPackage (index p (G ↑k))) b) ((fun k => BallPackage.c p.toBallPackage (index p (G ↑k))) a) ∧ (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) a ≤ p.τ * (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) b [PROOFSTEP] exact (this b a a_ne_b.symm (le_of_not_le G_le)).symm [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p fGn : ∀ (n : ℕ), n ≤ N → ¬BallPackage.c p.toBallPackage (index p (G n)) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G n)) Gab : ∀ (a b : Fin (Nat.succ N)), G ↑a < G ↑b → BallPackage.r p.toBallPackage (index p (G ↑a)) ≤ dist (BallPackage.c p.toBallPackage (index p (G ↑a))) (BallPackage.c p.toBallPackage (index p (G ↑b))) ∧ BallPackage.r p.toBallPackage (index p (G ↑b)) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G ↑a)) a b : Fin (Nat.succ N) a_ne_b : a ≠ b G_le : G ↑a ≤ G ↑b ⊢ (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) a ≤ dist ((fun k => BallPackage.c p.toBallPackage (index p (G ↑k))) a) ((fun k => BallPackage.c p.toBallPackage (index p (G ↑k))) b) ∧ (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) b ≤ p.τ * (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) a ∨ (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) b ≤ dist ((fun k => BallPackage.c p.toBallPackage (index p (G ↑k))) b) ((fun k => BallPackage.c p.toBallPackage (index p (G ↑k))) a) ∧ (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) a ≤ p.τ * (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) b [PROOFSTEP] have G_lt : G a < G b := by rcases G_le.lt_or_eq with (H | H); · exact H have A : (a : ℕ) ≠ b := Fin.val_injective.ne a_ne_b rw [← color_G a (Nat.lt_succ_iff.1 a.2), ← color_G b (Nat.lt_succ_iff.1 b.2), H] at A exact (A rfl).elim [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p fGn : ∀ (n : ℕ), n ≤ N → ¬BallPackage.c p.toBallPackage (index p (G n)) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G n)) Gab : ∀ (a b : Fin (Nat.succ N)), G ↑a < G ↑b → BallPackage.r p.toBallPackage (index p (G ↑a)) ≤ dist (BallPackage.c p.toBallPackage (index p (G ↑a))) (BallPackage.c p.toBallPackage (index p (G ↑b))) ∧ BallPackage.r p.toBallPackage (index p (G ↑b)) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G ↑a)) a b : Fin (Nat.succ N) a_ne_b : a ≠ b G_le : G ↑a ≤ G ↑b ⊢ G ↑a < G ↑b [PROOFSTEP] rcases G_le.lt_or_eq with (H | H) [GOAL] case inl α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p fGn : ∀ (n : ℕ), n ≤ N → ¬BallPackage.c p.toBallPackage (index p (G n)) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G n)) Gab : ∀ (a b : Fin (Nat.succ N)), G ↑a < G ↑b → BallPackage.r p.toBallPackage (index p (G ↑a)) ≤ dist (BallPackage.c p.toBallPackage (index p (G ↑a))) (BallPackage.c p.toBallPackage (index p (G ↑b))) ∧ BallPackage.r p.toBallPackage (index p (G ↑b)) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G ↑a)) a b : Fin (Nat.succ N) a_ne_b : a ≠ b G_le : G ↑a ≤ G ↑b H : G ↑a < G ↑b ⊢ G ↑a < G ↑b [PROOFSTEP] exact H [GOAL] case inr α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p fGn : ∀ (n : ℕ), n ≤ N → ¬BallPackage.c p.toBallPackage (index p (G n)) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G n)) Gab : ∀ (a b : Fin (Nat.succ N)), G ↑a < G ↑b → BallPackage.r p.toBallPackage (index p (G ↑a)) ≤ dist (BallPackage.c p.toBallPackage (index p (G ↑a))) (BallPackage.c p.toBallPackage (index p (G ↑b))) ∧ BallPackage.r p.toBallPackage (index p (G ↑b)) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G ↑a)) a b : Fin (Nat.succ N) a_ne_b : a ≠ b G_le : G ↑a ≤ G ↑b H : G ↑a = G ↑b ⊢ G ↑a < G ↑b [PROOFSTEP] have A : (a : ℕ) ≠ b := Fin.val_injective.ne a_ne_b [GOAL] case inr α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A✝ : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A✝) N_mem : N ∈ univ \ A✝ Inf_eq_N : sInf (univ \ A✝) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p fGn : ∀ (n : ℕ), n ≤ N → ¬BallPackage.c p.toBallPackage (index p (G n)) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G n)) Gab : ∀ (a b : Fin (Nat.succ N)), G ↑a < G ↑b → BallPackage.r p.toBallPackage (index p (G ↑a)) ≤ dist (BallPackage.c p.toBallPackage (index p (G ↑a))) (BallPackage.c p.toBallPackage (index p (G ↑b))) ∧ BallPackage.r p.toBallPackage (index p (G ↑b)) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G ↑a)) a b : Fin (Nat.succ N) a_ne_b : a ≠ b G_le : G ↑a ≤ G ↑b H : G ↑a = G ↑b A : ↑a ≠ ↑b ⊢ G ↑a < G ↑b [PROOFSTEP] rw [← color_G a (Nat.lt_succ_iff.1 a.2), ← color_G b (Nat.lt_succ_iff.1 b.2), H] at A [GOAL] case inr α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A✝ : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A✝) N_mem : N ∈ univ \ A✝ Inf_eq_N : sInf (univ \ A✝) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p fGn : ∀ (n : ℕ), n ≤ N → ¬BallPackage.c p.toBallPackage (index p (G n)) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G n)) Gab : ∀ (a b : Fin (Nat.succ N)), G ↑a < G ↑b → BallPackage.r p.toBallPackage (index p (G ↑a)) ≤ dist (BallPackage.c p.toBallPackage (index p (G ↑a))) (BallPackage.c p.toBallPackage (index p (G ↑b))) ∧ BallPackage.r p.toBallPackage (index p (G ↑b)) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G ↑a)) a b : Fin (Nat.succ N) a_ne_b : a ≠ b G_le : G ↑a ≤ G ↑b H : G ↑a = G ↑b A : color p (G ↑b) ≠ color p (G ↑b) ⊢ G ↑a < G ↑b [PROOFSTEP] exact (A rfl).elim [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p fGn : ∀ (n : ℕ), n ≤ N → ¬BallPackage.c p.toBallPackage (index p (G n)) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G n)) Gab : ∀ (a b : Fin (Nat.succ N)), G ↑a < G ↑b → BallPackage.r p.toBallPackage (index p (G ↑a)) ≤ dist (BallPackage.c p.toBallPackage (index p (G ↑a))) (BallPackage.c p.toBallPackage (index p (G ↑b))) ∧ BallPackage.r p.toBallPackage (index p (G ↑b)) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G ↑a)) a b : Fin (Nat.succ N) a_ne_b : a ≠ b G_le : G ↑a ≤ G ↑b G_lt : G ↑a < G ↑b ⊢ (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) a ≤ dist ((fun k => BallPackage.c p.toBallPackage (index p (G ↑k))) a) ((fun k => BallPackage.c p.toBallPackage (index p (G ↑k))) b) ∧ (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) b ≤ p.τ * (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) a ∨ (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) b ≤ dist ((fun k => BallPackage.c p.toBallPackage (index p (G ↑k))) b) ((fun k => BallPackage.c p.toBallPackage (index p (G ↑k))) a) ∧ (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) a ≤ p.τ * (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) b [PROOFSTEP] exact Or.inl (Gab a b G_lt) [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p fGn : ∀ (n : ℕ), n ≤ N → ¬BallPackage.c p.toBallPackage (index p (G n)) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G n)) Gab : ∀ (a b : Fin (Nat.succ N)), G ↑a < G ↑b → BallPackage.r p.toBallPackage (index p (G ↑a)) ≤ dist (BallPackage.c p.toBallPackage (index p (G ↑a))) (BallPackage.c p.toBallPackage (index p (G ↑b))) ∧ BallPackage.r p.toBallPackage (index p (G ↑b)) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G ↑a)) ⊢ ∀ (i : Fin (N + 1)), i < last N → (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) i ≤ dist ((fun k => BallPackage.c p.toBallPackage (index p (G ↑k))) i) ((fun k => BallPackage.c p.toBallPackage (index p (G ↑k))) (last N)) ∧ (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) (last N) ≤ p.τ * (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) i [PROOFSTEP] intro a ha [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p fGn : ∀ (n : ℕ), n ≤ N → ¬BallPackage.c p.toBallPackage (index p (G n)) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G n)) Gab : ∀ (a b : Fin (Nat.succ N)), G ↑a < G ↑b → BallPackage.r p.toBallPackage (index p (G ↑a)) ≤ dist (BallPackage.c p.toBallPackage (index p (G ↑a))) (BallPackage.c p.toBallPackage (index p (G ↑b))) ∧ BallPackage.r p.toBallPackage (index p (G ↑b)) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G ↑a)) a : Fin (N + 1) ha : a < last N ⊢ (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) a ≤ dist ((fun k => BallPackage.c p.toBallPackage (index p (G ↑k))) a) ((fun k => BallPackage.c p.toBallPackage (index p (G ↑k))) (last N)) ∧ (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) (last N) ≤ p.τ * (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) a [PROOFSTEP] have I : (a : ℕ) < N := ha [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p fGn : ∀ (n : ℕ), n ≤ N → ¬BallPackage.c p.toBallPackage (index p (G n)) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G n)) Gab : ∀ (a b : Fin (Nat.succ N)), G ↑a < G ↑b → BallPackage.r p.toBallPackage (index p (G ↑a)) ≤ dist (BallPackage.c p.toBallPackage (index p (G ↑a))) (BallPackage.c p.toBallPackage (index p (G ↑b))) ∧ BallPackage.r p.toBallPackage (index p (G ↑b)) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G ↑a)) a : Fin (N + 1) ha : a < last N I : ↑a < N ⊢ (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) a ≤ dist ((fun k => BallPackage.c p.toBallPackage (index p (G ↑k))) a) ((fun k => BallPackage.c p.toBallPackage (index p (G ↑k))) (last N)) ∧ (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) (last N) ≤ p.τ * (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) a [PROOFSTEP] have : G a < G (Fin.last N) := by dsimp; simp [I.ne, (hg a I).1] [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p fGn : ∀ (n : ℕ), n ≤ N → ¬BallPackage.c p.toBallPackage (index p (G n)) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G n)) Gab : ∀ (a b : Fin (Nat.succ N)), G ↑a < G ↑b → BallPackage.r p.toBallPackage (index p (G ↑a)) ≤ dist (BallPackage.c p.toBallPackage (index p (G ↑a))) (BallPackage.c p.toBallPackage (index p (G ↑b))) ∧ BallPackage.r p.toBallPackage (index p (G ↑b)) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G ↑a)) a : Fin (N + 1) ha : a < last N I : ↑a < N ⊢ G ↑a < G ↑(last N) [PROOFSTEP] dsimp [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p fGn : ∀ (n : ℕ), n ≤ N → ¬BallPackage.c p.toBallPackage (index p (G n)) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G n)) Gab : ∀ (a b : Fin (Nat.succ N)), G ↑a < G ↑b → BallPackage.r p.toBallPackage (index p (G ↑a)) ≤ dist (BallPackage.c p.toBallPackage (index p (G ↑a))) (BallPackage.c p.toBallPackage (index p (G ↑b))) ∧ BallPackage.r p.toBallPackage (index p (G ↑b)) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G ↑a)) a : Fin (N + 1) ha : a < last N I : ↑a < N ⊢ (if ↑a = N then i else g ↑a) < if N = N then i else g N [PROOFSTEP] simp [I.ne, (hg a I).1] [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p fGn : ∀ (n : ℕ), n ≤ N → ¬BallPackage.c p.toBallPackage (index p (G n)) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G n)) Gab : ∀ (a b : Fin (Nat.succ N)), G ↑a < G ↑b → BallPackage.r p.toBallPackage (index p (G ↑a)) ≤ dist (BallPackage.c p.toBallPackage (index p (G ↑a))) (BallPackage.c p.toBallPackage (index p (G ↑b))) ∧ BallPackage.r p.toBallPackage (index p (G ↑b)) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G ↑a)) a : Fin (N + 1) ha : a < last N I : ↑a < N this : G ↑a < G ↑(last N) ⊢ (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) a ≤ dist ((fun k => BallPackage.c p.toBallPackage (index p (G ↑k))) a) ((fun k => BallPackage.c p.toBallPackage (index p (G ↑k))) (last N)) ∧ (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) (last N) ≤ p.τ * (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) a [PROOFSTEP] exact Gab _ _ this [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p fGn : ∀ (n : ℕ), n ≤ N → ¬BallPackage.c p.toBallPackage (index p (G n)) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G n)) Gab : ∀ (a b : Fin (Nat.succ N)), G ↑a < G ↑b → BallPackage.r p.toBallPackage (index p (G ↑a)) ≤ dist (BallPackage.c p.toBallPackage (index p (G ↑a))) (BallPackage.c p.toBallPackage (index p (G ↑b))) ∧ BallPackage.r p.toBallPackage (index p (G ↑b)) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G ↑a)) ⊢ ∀ (i : Fin (N + 1)), i < last N → dist ((fun k => BallPackage.c p.toBallPackage (index p (G ↑k))) i) ((fun k => BallPackage.c p.toBallPackage (index p (G ↑k))) (last N)) ≤ (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) i + (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) (last N) [PROOFSTEP] intro a ha [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p fGn : ∀ (n : ℕ), n ≤ N → ¬BallPackage.c p.toBallPackage (index p (G n)) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G n)) Gab : ∀ (a b : Fin (Nat.succ N)), G ↑a < G ↑b → BallPackage.r p.toBallPackage (index p (G ↑a)) ≤ dist (BallPackage.c p.toBallPackage (index p (G ↑a))) (BallPackage.c p.toBallPackage (index p (G ↑b))) ∧ BallPackage.r p.toBallPackage (index p (G ↑b)) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G ↑a)) a : Fin (N + 1) ha : a < last N ⊢ dist ((fun k => BallPackage.c p.toBallPackage (index p (G ↑k))) a) ((fun k => BallPackage.c p.toBallPackage (index p (G ↑k))) (last N)) ≤ (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) a + (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) (last N) [PROOFSTEP] have I : (a : ℕ) < N := ha [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p fGn : ∀ (n : ℕ), n ≤ N → ¬BallPackage.c p.toBallPackage (index p (G n)) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G n)) Gab : ∀ (a b : Fin (Nat.succ N)), G ↑a < G ↑b → BallPackage.r p.toBallPackage (index p (G ↑a)) ≤ dist (BallPackage.c p.toBallPackage (index p (G ↑a))) (BallPackage.c p.toBallPackage (index p (G ↑b))) ∧ BallPackage.r p.toBallPackage (index p (G ↑b)) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G ↑a)) a : Fin (N + 1) ha : a < last N I : ↑a < N ⊢ dist ((fun k => BallPackage.c p.toBallPackage (index p (G ↑k))) a) ((fun k => BallPackage.c p.toBallPackage (index p (G ↑k))) (last N)) ≤ (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) a + (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) (last N) [PROOFSTEP] have J : G (Fin.last N) = i := by dsimp; simp only [if_true, eq_self_iff_true] [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p fGn : ∀ (n : ℕ), n ≤ N → ¬BallPackage.c p.toBallPackage (index p (G n)) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G n)) Gab : ∀ (a b : Fin (Nat.succ N)), G ↑a < G ↑b → BallPackage.r p.toBallPackage (index p (G ↑a)) ≤ dist (BallPackage.c p.toBallPackage (index p (G ↑a))) (BallPackage.c p.toBallPackage (index p (G ↑b))) ∧ BallPackage.r p.toBallPackage (index p (G ↑b)) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G ↑a)) a : Fin (N + 1) ha : a < last N I : ↑a < N ⊢ G ↑(last N) = i [PROOFSTEP] dsimp [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p fGn : ∀ (n : ℕ), n ≤ N → ¬BallPackage.c p.toBallPackage (index p (G n)) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G n)) Gab : ∀ (a b : Fin (Nat.succ N)), G ↑a < G ↑b → BallPackage.r p.toBallPackage (index p (G ↑a)) ≤ dist (BallPackage.c p.toBallPackage (index p (G ↑a))) (BallPackage.c p.toBallPackage (index p (G ↑b))) ∧ BallPackage.r p.toBallPackage (index p (G ↑b)) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G ↑a)) a : Fin (N + 1) ha : a < last N I : ↑a < N ⊢ (if N = N then i else g N) = i [PROOFSTEP] simp only [if_true, eq_self_iff_true] [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p fGn : ∀ (n : ℕ), n ≤ N → ¬BallPackage.c p.toBallPackage (index p (G n)) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G n)) Gab : ∀ (a b : Fin (Nat.succ N)), G ↑a < G ↑b → BallPackage.r p.toBallPackage (index p (G ↑a)) ≤ dist (BallPackage.c p.toBallPackage (index p (G ↑a))) (BallPackage.c p.toBallPackage (index p (G ↑b))) ∧ BallPackage.r p.toBallPackage (index p (G ↑b)) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G ↑a)) a : Fin (N + 1) ha : a < last N I : ↑a < N J : G ↑(last N) = i ⊢ dist ((fun k => BallPackage.c p.toBallPackage (index p (G ↑k))) a) ((fun k => BallPackage.c p.toBallPackage (index p (G ↑k))) (last N)) ≤ (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) a + (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) (last N) [PROOFSTEP] have K : G a = g a := by dsimp; simp [I.ne, (hg a I).1] [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p fGn : ∀ (n : ℕ), n ≤ N → ¬BallPackage.c p.toBallPackage (index p (G n)) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G n)) Gab : ∀ (a b : Fin (Nat.succ N)), G ↑a < G ↑b → BallPackage.r p.toBallPackage (index p (G ↑a)) ≤ dist (BallPackage.c p.toBallPackage (index p (G ↑a))) (BallPackage.c p.toBallPackage (index p (G ↑b))) ∧ BallPackage.r p.toBallPackage (index p (G ↑b)) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G ↑a)) a : Fin (N + 1) ha : a < last N I : ↑a < N J : G ↑(last N) = i ⊢ G ↑a = g ↑a [PROOFSTEP] dsimp [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p fGn : ∀ (n : ℕ), n ≤ N → ¬BallPackage.c p.toBallPackage (index p (G n)) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G n)) Gab : ∀ (a b : Fin (Nat.succ N)), G ↑a < G ↑b → BallPackage.r p.toBallPackage (index p (G ↑a)) ≤ dist (BallPackage.c p.toBallPackage (index p (G ↑a))) (BallPackage.c p.toBallPackage (index p (G ↑b))) ∧ BallPackage.r p.toBallPackage (index p (G ↑b)) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G ↑a)) a : Fin (N + 1) ha : a < last N I : ↑a < N J : G ↑(last N) = i ⊢ (if ↑a = N then i else g ↑a) = g ↑a [PROOFSTEP] simp [I.ne, (hg a I).1] [GOAL] α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p fGn : ∀ (n : ℕ), n ≤ N → ¬BallPackage.c p.toBallPackage (index p (G n)) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G n)) Gab : ∀ (a b : Fin (Nat.succ N)), G ↑a < G ↑b → BallPackage.r p.toBallPackage (index p (G ↑a)) ≤ dist (BallPackage.c p.toBallPackage (index p (G ↑a))) (BallPackage.c p.toBallPackage (index p (G ↑b))) ∧ BallPackage.r p.toBallPackage (index p (G ↑b)) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G ↑a)) a : Fin (N + 1) ha : a < last N I : ↑a < N J : G ↑(last N) = i K : G ↑a = g ↑a ⊢ dist ((fun k => BallPackage.c p.toBallPackage (index p (G ↑k))) a) ((fun k => BallPackage.c p.toBallPackage (index p (G ↑k))) (last N)) ≤ (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) a + (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) (last N) [PROOFSTEP] convert dist_le_add_of_nonempty_closedBall_inter_closedBall (hg _ I).2.1 [GOAL] case h α : Type u_1 inst✝¹ : MetricSpace α β : Type u inst✝ : Nonempty β p : TauPackage β α i✝ : Ordinal.{u} hi✝ : i✝ < lastStep p N : ℕ hN : IsEmpty (SatelliteConfig α N p.τ) i : Ordinal.{u} IH : ∀ (k : Ordinal.{u}), k < i → k < lastStep p → color p k < N hi : i < lastStep p A : Set ℕ := ⋃ (j : { j // j < i }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i)))), {color p ↑j} color_i : color p i = sInf (univ \ A) N_mem : N ∈ univ \ A Inf_eq_N : sInf (univ \ A) = N g : ℕ → Ordinal.{u} hg : ∀ (k : ℕ), k < N → g k < i ∧ Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p (g k))) (BallPackage.r p.toBallPackage (index p (g k))) ∩ closedBall (BallPackage.c p.toBallPackage (index p i)) (BallPackage.r p.toBallPackage (index p i))) ∧ k = color p (g k) G : ℕ → Ordinal.{u} := fun n => if n = N then i else g n color_G : ∀ (n : ℕ), n ≤ N → color p (G n) = n G_lt_last : ∀ (n : ℕ), n ≤ N → G n < lastStep p fGn : ∀ (n : ℕ), n ≤ N → ¬BallPackage.c p.toBallPackage (index p (G n)) ∈ iUnionUpTo p (G n) ∧ R p (G n) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G n)) Gab : ∀ (a b : Fin (Nat.succ N)), G ↑a < G ↑b → BallPackage.r p.toBallPackage (index p (G ↑a)) ≤ dist (BallPackage.c p.toBallPackage (index p (G ↑a))) (BallPackage.c p.toBallPackage (index p (G ↑b))) ∧ BallPackage.r p.toBallPackage (index p (G ↑b)) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G ↑a)) sc : SatelliteConfig α N p.τ := { c := fun k => BallPackage.c p.toBallPackage (index p (G ↑k)), r := fun k => BallPackage.r p.toBallPackage (index p (G ↑k)), rpos := (_ : ∀ (k : Fin (Nat.succ N)), 0 < BallPackage.r p.toBallPackage (index p (G ↑k))), h := (_ : ∀ (a b : Fin (Nat.succ N)), a ≠ b → (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) a ≤ dist ((fun k => BallPackage.c p.toBallPackage (index p (G ↑k))) a) ((fun k => BallPackage.c p.toBallPackage (index p (G ↑k))) b) ∧ (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) b ≤ p.τ * (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) a ∨ (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) b ≤ dist ((fun k => BallPackage.c p.toBallPackage (index p (G ↑k))) b) ((fun k => BallPackage.c p.toBallPackage (index p (G ↑k))) a) ∧ (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) a ≤ p.τ * (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) b), hlast := (_ : ∀ (a : Fin (N + 1)), a < last N → BallPackage.r p.toBallPackage (index p (G ↑a)) ≤ dist (BallPackage.c p.toBallPackage (index p (G ↑a))) (BallPackage.c p.toBallPackage (index p (G ↑(last N)))) ∧ BallPackage.r p.toBallPackage (index p (G ↑(last N))) ≤ p.τ * BallPackage.r p.toBallPackage (index p (G ↑a))), inter := (_ : ∀ (a : Fin (N + 1)), a < last N → dist ((fun k => BallPackage.c p.toBallPackage (index p (G ↑k))) a) ((fun k => BallPackage.c p.toBallPackage (index p (G ↑k))) (last N)) ≤ (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) a + (fun k => BallPackage.r p.toBallPackage (index p (G ↑k))) (last N)) } ⊢ False [PROOFSTEP] exact hN.false sc [GOAL] α : Type u_1 inst✝ : MetricSpace α β : Type u N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) q : BallPackage β α ⊢ ∃ s, (∀ (i : Fin N), PairwiseDisjoint (s i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j)) ∧ range q.c ⊆ ⋃ (i : Fin N) (j : β) (_ : j ∈ s i), ball (BallPackage.c q j) (BallPackage.r q j) [PROOFSTEP] cases isEmpty_or_nonempty β [GOAL] case inl α : Type u_1 inst✝ : MetricSpace α β : Type u N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) q : BallPackage β α h✝ : IsEmpty β ⊢ ∃ s, (∀ (i : Fin N), PairwiseDisjoint (s i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j)) ∧ range q.c ⊆ ⋃ (i : Fin N) (j : β) (_ : j ∈ s i), ball (BallPackage.c q j) (BallPackage.r q j) [PROOFSTEP] refine' ⟨fun _ => ∅, fun _ => pairwiseDisjoint_empty, _⟩ [GOAL] case inl α : Type u_1 inst✝ : MetricSpace α β : Type u N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) q : BallPackage β α h✝ : IsEmpty β ⊢ range q.c ⊆ ⋃ (i : Fin N) (j : β) (_ : j ∈ (fun x => ∅) i), ball (BallPackage.c q j) (BallPackage.r q j) [PROOFSTEP] rw [← image_univ, eq_empty_of_isEmpty (univ : Set β)] [GOAL] case inl α : Type u_1 inst✝ : MetricSpace α β : Type u N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) q : BallPackage β α h✝ : IsEmpty β ⊢ q.c '' ∅ ⊆ ⋃ (i : Fin N) (j : β) (_ : j ∈ (fun x => ∅) i), ball (BallPackage.c q j) (BallPackage.r q j) [PROOFSTEP] simp -- Now, assume `β` is nonempty. [GOAL] case inr α : Type u_1 inst✝ : MetricSpace α β : Type u N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) q : BallPackage β α h✝ : Nonempty β ⊢ ∃ s, (∀ (i : Fin N), PairwiseDisjoint (s i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j)) ∧ range q.c ⊆ ⋃ (i : Fin N) (j : β) (_ : j ∈ s i), ball (BallPackage.c q j) (BallPackage.r q j) [PROOFSTEP] let p : TauPackage β α := { q with τ one_lt_tau := hτ } -- we use for `s i` the balls of color `i`. [GOAL] case inr α : Type u_1 inst✝ : MetricSpace α β : Type u N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) q : BallPackage β α h✝ : Nonempty β p : TauPackage β α := { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } ⊢ ∃ s, (∀ (i : Fin N), PairwiseDisjoint (s i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j)) ∧ range q.c ⊆ ⋃ (i : Fin N) (j : β) (_ : j ∈ s i), ball (BallPackage.c q j) (BallPackage.r q j) [PROOFSTEP] let s := fun i : Fin N => ⋃ (k : Ordinal.{u}) (_ : k < p.lastStep) (_ : p.color k = i), ({p.index k} : Set β) [GOAL] case inr α : Type u_1 inst✝ : MetricSpace α β : Type u N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) q : BallPackage β α h✝ : Nonempty β p : TauPackage β α := { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } s : Fin N → Set β := fun i => ⋃ (k : Ordinal.{u}) (_ : k < lastStep p) (_ : color p k = ↑i), {index p k} ⊢ ∃ s, (∀ (i : Fin N), PairwiseDisjoint (s i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j)) ∧ range q.c ⊆ ⋃ (i : Fin N) (j : β) (_ : j ∈ s i), ball (BallPackage.c q j) (BallPackage.r q j) [PROOFSTEP] refine' ⟨s, fun i => _, _⟩ [GOAL] case inr.refine'_1 α : Type u_1 inst✝ : MetricSpace α β : Type u N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) q : BallPackage β α h✝ : Nonempty β p : TauPackage β α := { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } s : Fin N → Set β := fun i => ⋃ (k : Ordinal.{u}) (_ : k < lastStep p) (_ : color p k = ↑i), {index p k} i : Fin N ⊢ PairwiseDisjoint (s i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) [PROOFSTEP] intro x hx y hy x_ne_y [GOAL] case inr.refine'_1 α : Type u_1 inst✝ : MetricSpace α β : Type u N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) q : BallPackage β α h✝ : Nonempty β p : TauPackage β α := { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } s : Fin N → Set β := fun i => ⋃ (k : Ordinal.{u}) (_ : k < lastStep p) (_ : color p k = ↑i), {index p k} i : Fin N x : β hx : x ∈ s i y : β hy : y ∈ s i x_ne_y : x ≠ y ⊢ (Disjoint on fun j => closedBall (BallPackage.c q j) (BallPackage.r q j)) x y [PROOFSTEP] obtain ⟨jx, jx_lt, jxi, rfl⟩ : ∃ jx : Ordinal, jx < p.lastStep ∧ p.color jx = i ∧ x = p.index jx := by simpa only [exists_prop, mem_iUnion, mem_singleton_iff] using hx [GOAL] α : Type u_1 inst✝ : MetricSpace α β : Type u N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) q : BallPackage β α h✝ : Nonempty β p : TauPackage β α := { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } s : Fin N → Set β := fun i => ⋃ (k : Ordinal.{u}) (_ : k < lastStep p) (_ : color p k = ↑i), {index p k} i : Fin N x : β hx : x ∈ s i y : β hy : y ∈ s i x_ne_y : x ≠ y ⊢ ∃ jx, jx < lastStep p ∧ color p jx = ↑i ∧ x = index p jx [PROOFSTEP] simpa only [exists_prop, mem_iUnion, mem_singleton_iff] using hx [GOAL] case inr.refine'_1.intro.intro.intro α : Type u_1 inst✝ : MetricSpace α β : Type u N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) q : BallPackage β α h✝ : Nonempty β p : TauPackage β α := { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } s : Fin N → Set β := fun i => ⋃ (k : Ordinal.{u}) (_ : k < lastStep p) (_ : color p k = ↑i), {index p k} i : Fin N y : β hy : y ∈ s i jx : Ordinal.{u} jx_lt : jx < lastStep p jxi : color p jx = ↑i hx : index p jx ∈ s i x_ne_y : index p jx ≠ y ⊢ (Disjoint on fun j => closedBall (BallPackage.c q j) (BallPackage.r q j)) (index p jx) y [PROOFSTEP] obtain ⟨jy, jy_lt, jyi, rfl⟩ : ∃ jy : Ordinal, jy < p.lastStep ∧ p.color jy = i ∧ y = p.index jy := by simpa only [exists_prop, mem_iUnion, mem_singleton_iff] using hy [GOAL] α : Type u_1 inst✝ : MetricSpace α β : Type u N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) q : BallPackage β α h✝ : Nonempty β p : TauPackage β α := { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } s : Fin N → Set β := fun i => ⋃ (k : Ordinal.{u}) (_ : k < lastStep p) (_ : color p k = ↑i), {index p k} i : Fin N y : β hy : y ∈ s i jx : Ordinal.{u} jx_lt : jx < lastStep p jxi : color p jx = ↑i hx : index p jx ∈ s i x_ne_y : index p jx ≠ y ⊢ ∃ jy, jy < lastStep p ∧ color p jy = ↑i ∧ y = index p jy [PROOFSTEP] simpa only [exists_prop, mem_iUnion, mem_singleton_iff] using hy [GOAL] case inr.refine'_1.intro.intro.intro.intro.intro.intro α : Type u_1 inst✝ : MetricSpace α β : Type u N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) q : BallPackage β α h✝ : Nonempty β p : TauPackage β α := { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } s : Fin N → Set β := fun i => ⋃ (k : Ordinal.{u}) (_ : k < lastStep p) (_ : color p k = ↑i), {index p k} i : Fin N jx : Ordinal.{u} jx_lt : jx < lastStep p jxi : color p jx = ↑i hx : index p jx ∈ s i jy : Ordinal.{u} jy_lt : jy < lastStep p jyi : color p jy = ↑i hy : index p jy ∈ s i x_ne_y : index p jx ≠ index p jy ⊢ (Disjoint on fun j => closedBall (BallPackage.c q j) (BallPackage.r q j)) (index p jx) (index p jy) [PROOFSTEP] wlog jxy : jx ≤ jy generalizing jx jy [GOAL] case inr.refine'_1.intro.intro.intro.intro.intro.intro.inr α : Type u_1 inst✝ : MetricSpace α β : Type u N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) q : BallPackage β α h✝ : Nonempty β p : TauPackage β α := { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } s : Fin N → Set β := fun i => ⋃ (k : Ordinal.{u}) (_ : k < lastStep p) (_ : color p k = ↑i), {index p k} i : Fin N jx : Ordinal.{u} jx_lt : jx < lastStep p jxi : color p jx = ↑i hx : index p jx ∈ s i jy : Ordinal.{u} jy_lt : jy < lastStep p jyi : color p jy = ↑i hy : index p jy ∈ s i x_ne_y : index p jx ≠ index p jy this : ∀ (jx : Ordinal.{u}), jx < lastStep p → color p jx = ↑i → index p jx ∈ s i → ∀ (jy : Ordinal.{u}), jy < lastStep p → color p jy = ↑i → index p jy ∈ s i → index p jx ≠ index p jy → jx ≤ jy → (Disjoint on fun j => closedBall (BallPackage.c q j) (BallPackage.r q j)) (index p jx) (index p jy) jxy : ¬jx ≤ jy ⊢ (Disjoint on fun j => closedBall (BallPackage.c q j) (BallPackage.r q j)) (index p jx) (index p jy) [PROOFSTEP] exact (this jy jy_lt jyi hy jx jx_lt jxi hx x_ne_y.symm (le_of_not_le jxy)).symm [GOAL] α : Type u_1 inst✝ : MetricSpace α β : Type u N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) q : BallPackage β α h✝ : Nonempty β p : TauPackage β α := { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } s : Fin N → Set β := fun i => ⋃ (k : Ordinal.{u}) (_ : k < lastStep p) (_ : color p k = ↑i), {index p k} i : Fin N jx : Ordinal.{u} jx_lt : jx < lastStep p jxi : color p jx = ↑i hx : index p jx ∈ s i jy : Ordinal.{u} jy_lt : jy < lastStep p jyi : color p jy = ↑i hy : index p jy ∈ s i x_ne_y : index p jx ≠ index p jy jxy : jx ≤ jy ⊢ (Disjoint on fun j => closedBall (BallPackage.c q j) (BallPackage.r q j)) (index p jx) (index p jy) [PROOFSTEP] replace jxy : jx < jy [GOAL] case jxy α : Type u_1 inst✝ : MetricSpace α β : Type u N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) q : BallPackage β α h✝ : Nonempty β p : TauPackage β α := { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } s : Fin N → Set β := fun i => ⋃ (k : Ordinal.{u}) (_ : k < lastStep p) (_ : color p k = ↑i), {index p k} i : Fin N jx : Ordinal.{u} jx_lt : jx < lastStep p jxi : color p jx = ↑i hx : index p jx ∈ s i jy : Ordinal.{u} jy_lt : jy < lastStep p jyi : color p jy = ↑i hy : index p jy ∈ s i x_ne_y : index p jx ≠ index p jy jxy : jx ≤ jy ⊢ jx < jy [PROOFSTEP] rcases lt_or_eq_of_le jxy with (H | rfl) [GOAL] case jxy.inl α : Type u_1 inst✝ : MetricSpace α β : Type u N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) q : BallPackage β α h✝ : Nonempty β p : TauPackage β α := { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } s : Fin N → Set β := fun i => ⋃ (k : Ordinal.{u}) (_ : k < lastStep p) (_ : color p k = ↑i), {index p k} i : Fin N jx : Ordinal.{u} jx_lt : jx < lastStep p jxi : color p jx = ↑i hx : index p jx ∈ s i jy : Ordinal.{u} jy_lt : jy < lastStep p jyi : color p jy = ↑i hy : index p jy ∈ s i x_ne_y : index p jx ≠ index p jy jxy : jx ≤ jy H : jx < jy ⊢ jx < jy [PROOFSTEP] {exact H } [GOAL] case jxy.inl α : Type u_1 inst✝ : MetricSpace α β : Type u N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) q : BallPackage β α h✝ : Nonempty β p : TauPackage β α := { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } s : Fin N → Set β := fun i => ⋃ (k : Ordinal.{u}) (_ : k < lastStep p) (_ : color p k = ↑i), {index p k} i : Fin N jx : Ordinal.{u} jx_lt : jx < lastStep p jxi : color p jx = ↑i hx : index p jx ∈ s i jy : Ordinal.{u} jy_lt : jy < lastStep p jyi : color p jy = ↑i hy : index p jy ∈ s i x_ne_y : index p jx ≠ index p jy jxy : jx ≤ jy H : jx < jy ⊢ jx < jy [PROOFSTEP] exact H [GOAL] case jxy.inr α : Type u_1 inst✝ : MetricSpace α β : Type u N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) q : BallPackage β α h✝ : Nonempty β p : TauPackage β α := { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } s : Fin N → Set β := fun i => ⋃ (k : Ordinal.{u}) (_ : k < lastStep p) (_ : color p k = ↑i), {index p k} i : Fin N jx : Ordinal.{u} jx_lt : jx < lastStep p jxi : color p jx = ↑i hx : index p jx ∈ s i jy_lt : jx < lastStep p jyi : color p jx = ↑i hy : index p jx ∈ s i x_ne_y : index p jx ≠ index p jx jxy : jx ≤ jx ⊢ jx < jx [PROOFSTEP] {exact (x_ne_y rfl).elim } [GOAL] case jxy.inr α : Type u_1 inst✝ : MetricSpace α β : Type u N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) q : BallPackage β α h✝ : Nonempty β p : TauPackage β α := { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } s : Fin N → Set β := fun i => ⋃ (k : Ordinal.{u}) (_ : k < lastStep p) (_ : color p k = ↑i), {index p k} i : Fin N jx : Ordinal.{u} jx_lt : jx < lastStep p jxi : color p jx = ↑i hx : index p jx ∈ s i jy_lt : jx < lastStep p jyi : color p jx = ↑i hy : index p jx ∈ s i x_ne_y : index p jx ≠ index p jx jxy : jx ≤ jx ⊢ jx < jx [PROOFSTEP] exact (x_ne_y rfl).elim [GOAL] α : Type u_1 inst✝ : MetricSpace α β : Type u N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) q : BallPackage β α h✝ : Nonempty β p : TauPackage β α := { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } s : Fin N → Set β := fun i => ⋃ (k : Ordinal.{u}) (_ : k < lastStep p) (_ : color p k = ↑i), {index p k} i : Fin N jx : Ordinal.{u} jx_lt : jx < lastStep p jxi : color p jx = ↑i hx : index p jx ∈ s i jy : Ordinal.{u} jy_lt : jy < lastStep p jyi : color p jy = ↑i hy : index p jy ∈ s i x_ne_y : index p jx ≠ index p jy jxy : jx < jy ⊢ (Disjoint on fun j => closedBall (BallPackage.c q j) (BallPackage.r q j)) (index p jx) (index p jy) [PROOFSTEP] let A : Set ℕ := ⋃ (j : { j // j < jy }) (_ : (closedBall (p.c (p.index j)) (p.r (p.index j)) ∩ closedBall (p.c (p.index jy)) (p.r (p.index jy))).Nonempty), {p.color j} [GOAL] α : Type u_1 inst✝ : MetricSpace α β : Type u N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) q : BallPackage β α h✝ : Nonempty β p : TauPackage β α := { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } s : Fin N → Set β := fun i => ⋃ (k : Ordinal.{u}) (_ : k < lastStep p) (_ : color p k = ↑i), {index p k} i : Fin N jx : Ordinal.{u} jx_lt : jx < lastStep p jxi : color p jx = ↑i hx : index p jx ∈ s i jy : Ordinal.{u} jy_lt : jy < lastStep p jyi : color p jy = ↑i hy : index p jy ∈ s i x_ne_y : index p jx ≠ index p jy jxy : jx < jy A : Set ℕ := ⋃ (j : { j // j < jy }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p jy)) (BallPackage.r p.toBallPackage (index p jy)))), {color p ↑j} ⊢ (Disjoint on fun j => closedBall (BallPackage.c q j) (BallPackage.r q j)) (index p jx) (index p jy) [PROOFSTEP] have color_j : p.color jy = sInf (univ \ A) := by rw [TauPackage.color] [GOAL] α : Type u_1 inst✝ : MetricSpace α β : Type u N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) q : BallPackage β α h✝ : Nonempty β p : TauPackage β α := { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } s : Fin N → Set β := fun i => ⋃ (k : Ordinal.{u}) (_ : k < lastStep p) (_ : color p k = ↑i), {index p k} i : Fin N jx : Ordinal.{u} jx_lt : jx < lastStep p jxi : color p jx = ↑i hx : index p jx ∈ s i jy : Ordinal.{u} jy_lt : jy < lastStep p jyi : color p jy = ↑i hy : index p jy ∈ s i x_ne_y : index p jx ≠ index p jy jxy : jx < jy A : Set ℕ := ⋃ (j : { j // j < jy }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p jy)) (BallPackage.r p.toBallPackage (index p jy)))), {color p ↑j} ⊢ color p jy = sInf (univ \ A) [PROOFSTEP] rw [TauPackage.color] [GOAL] α : Type u_1 inst✝ : MetricSpace α β : Type u N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) q : BallPackage β α h✝ : Nonempty β p : TauPackage β α := { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } s : Fin N → Set β := fun i => ⋃ (k : Ordinal.{u}) (_ : k < lastStep p) (_ : color p k = ↑i), {index p k} i : Fin N jx : Ordinal.{u} jx_lt : jx < lastStep p jxi : color p jx = ↑i hx : index p jx ∈ s i jy : Ordinal.{u} jy_lt : jy < lastStep p jyi : color p jy = ↑i hy : index p jy ∈ s i x_ne_y : index p jx ≠ index p jy jxy : jx < jy A : Set ℕ := ⋃ (j : { j // j < jy }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p jy)) (BallPackage.r p.toBallPackage (index p jy)))), {color p ↑j} color_j : color p jy = sInf (univ \ A) ⊢ (Disjoint on fun j => closedBall (BallPackage.c q j) (BallPackage.r q j)) (index p jx) (index p jy) [PROOFSTEP] have h : p.color jy ∈ univ \ A := by rw [color_j] apply csInf_mem refine' ⟨N, _⟩ simp only [not_exists, true_and_iff, exists_prop, mem_iUnion, mem_singleton_iff, not_and, mem_univ, mem_diff, Subtype.exists, Subtype.coe_mk] intro k hk _ exact (p.color_lt (hk.trans jy_lt) hN).ne' [GOAL] α : Type u_1 inst✝ : MetricSpace α β : Type u N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) q : BallPackage β α h✝ : Nonempty β p : TauPackage β α := { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } s : Fin N → Set β := fun i => ⋃ (k : Ordinal.{u}) (_ : k < lastStep p) (_ : color p k = ↑i), {index p k} i : Fin N jx : Ordinal.{u} jx_lt : jx < lastStep p jxi : color p jx = ↑i hx : index p jx ∈ s i jy : Ordinal.{u} jy_lt : jy < lastStep p jyi : color p jy = ↑i hy : index p jy ∈ s i x_ne_y : index p jx ≠ index p jy jxy : jx < jy A : Set ℕ := ⋃ (j : { j // j < jy }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p jy)) (BallPackage.r p.toBallPackage (index p jy)))), {color p ↑j} color_j : color p jy = sInf (univ \ A) ⊢ color p jy ∈ univ \ A [PROOFSTEP] rw [color_j] [GOAL] α : Type u_1 inst✝ : MetricSpace α β : Type u N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) q : BallPackage β α h✝ : Nonempty β p : TauPackage β α := { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } s : Fin N → Set β := fun i => ⋃ (k : Ordinal.{u}) (_ : k < lastStep p) (_ : color p k = ↑i), {index p k} i : Fin N jx : Ordinal.{u} jx_lt : jx < lastStep p jxi : color p jx = ↑i hx : index p jx ∈ s i jy : Ordinal.{u} jy_lt : jy < lastStep p jyi : color p jy = ↑i hy : index p jy ∈ s i x_ne_y : index p jx ≠ index p jy jxy : jx < jy A : Set ℕ := ⋃ (j : { j // j < jy }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p jy)) (BallPackage.r p.toBallPackage (index p jy)))), {color p ↑j} color_j : color p jy = sInf (univ \ A) ⊢ sInf (univ \ A) ∈ univ \ A [PROOFSTEP] apply csInf_mem [GOAL] case hs α : Type u_1 inst✝ : MetricSpace α β : Type u N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) q : BallPackage β α h✝ : Nonempty β p : TauPackage β α := { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } s : Fin N → Set β := fun i => ⋃ (k : Ordinal.{u}) (_ : k < lastStep p) (_ : color p k = ↑i), {index p k} i : Fin N jx : Ordinal.{u} jx_lt : jx < lastStep p jxi : color p jx = ↑i hx : index p jx ∈ s i jy : Ordinal.{u} jy_lt : jy < lastStep p jyi : color p jy = ↑i hy : index p jy ∈ s i x_ne_y : index p jx ≠ index p jy jxy : jx < jy A : Set ℕ := ⋃ (j : { j // j < jy }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p jy)) (BallPackage.r p.toBallPackage (index p jy)))), {color p ↑j} color_j : color p jy = sInf (univ \ A) ⊢ Set.Nonempty (univ \ A) [PROOFSTEP] refine' ⟨N, _⟩ [GOAL] case hs α : Type u_1 inst✝ : MetricSpace α β : Type u N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) q : BallPackage β α h✝ : Nonempty β p : TauPackage β α := { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } s : Fin N → Set β := fun i => ⋃ (k : Ordinal.{u}) (_ : k < lastStep p) (_ : color p k = ↑i), {index p k} i : Fin N jx : Ordinal.{u} jx_lt : jx < lastStep p jxi : color p jx = ↑i hx : index p jx ∈ s i jy : Ordinal.{u} jy_lt : jy < lastStep p jyi : color p jy = ↑i hy : index p jy ∈ s i x_ne_y : index p jx ≠ index p jy jxy : jx < jy A : Set ℕ := ⋃ (j : { j // j < jy }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p jy)) (BallPackage.r p.toBallPackage (index p jy)))), {color p ↑j} color_j : color p jy = sInf (univ \ A) ⊢ N ∈ univ \ A [PROOFSTEP] simp only [not_exists, true_and_iff, exists_prop, mem_iUnion, mem_singleton_iff, not_and, mem_univ, mem_diff, Subtype.exists, Subtype.coe_mk] [GOAL] case hs α : Type u_1 inst✝ : MetricSpace α β : Type u N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) q : BallPackage β α h✝ : Nonempty β p : TauPackage β α := { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } s : Fin N → Set β := fun i => ⋃ (k : Ordinal.{u}) (_ : k < lastStep p) (_ : color p k = ↑i), {index p k} i : Fin N jx : Ordinal.{u} jx_lt : jx < lastStep p jxi : color p jx = ↑i hx : index p jx ∈ s i jy : Ordinal.{u} jy_lt : jy < lastStep p jyi : color p jy = ↑i hy : index p jy ∈ s i x_ne_y : index p jx ≠ index p jy jxy : jx < jy A : Set ℕ := ⋃ (j : { j // j < jy }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p jy)) (BallPackage.r p.toBallPackage (index p jy)))), {color p ↑j} color_j : color p jy = sInf (univ \ A) ⊢ ∀ (x : Ordinal.{u}), x < jy → Set.Nonempty (closedBall (BallPackage.c q (index { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } x)) (BallPackage.r q (index { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } x)) ∩ closedBall (BallPackage.c q (index { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } jy)) (BallPackage.r q (index { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } jy))) → ¬N = color { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } x [PROOFSTEP] intro k hk _ [GOAL] case hs α : Type u_1 inst✝ : MetricSpace α β : Type u N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) q : BallPackage β α h✝ : Nonempty β p : TauPackage β α := { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } s : Fin N → Set β := fun i => ⋃ (k : Ordinal.{u}) (_ : k < lastStep p) (_ : color p k = ↑i), {index p k} i : Fin N jx : Ordinal.{u} jx_lt : jx < lastStep p jxi : color p jx = ↑i hx : index p jx ∈ s i jy : Ordinal.{u} jy_lt : jy < lastStep p jyi : color p jy = ↑i hy : index p jy ∈ s i x_ne_y : index p jx ≠ index p jy jxy : jx < jy A : Set ℕ := ⋃ (j : { j // j < jy }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p jy)) (BallPackage.r p.toBallPackage (index p jy)))), {color p ↑j} color_j : color p jy = sInf (univ \ A) k : Ordinal.{u} hk : k < jy a✝ : Set.Nonempty (closedBall (BallPackage.c q (index { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } k)) (BallPackage.r q (index { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } k)) ∩ closedBall (BallPackage.c q (index { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } jy)) (BallPackage.r q (index { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } jy))) ⊢ ¬N = color { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } k [PROOFSTEP] exact (p.color_lt (hk.trans jy_lt) hN).ne' [GOAL] α : Type u_1 inst✝ : MetricSpace α β : Type u N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) q : BallPackage β α h✝ : Nonempty β p : TauPackage β α := { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } s : Fin N → Set β := fun i => ⋃ (k : Ordinal.{u}) (_ : k < lastStep p) (_ : color p k = ↑i), {index p k} i : Fin N jx : Ordinal.{u} jx_lt : jx < lastStep p jxi : color p jx = ↑i hx : index p jx ∈ s i jy : Ordinal.{u} jy_lt : jy < lastStep p jyi : color p jy = ↑i hy : index p jy ∈ s i x_ne_y : index p jx ≠ index p jy jxy : jx < jy A : Set ℕ := ⋃ (j : { j // j < jy }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p jy)) (BallPackage.r p.toBallPackage (index p jy)))), {color p ↑j} color_j : color p jy = sInf (univ \ A) h : color p jy ∈ univ \ A ⊢ (Disjoint on fun j => closedBall (BallPackage.c q j) (BallPackage.r q j)) (index p jx) (index p jy) [PROOFSTEP] simp only [not_exists, true_and_iff, exists_prop, mem_iUnion, mem_singleton_iff, not_and, mem_univ, mem_diff, Subtype.exists, Subtype.coe_mk] at h [GOAL] α : Type u_1 inst✝ : MetricSpace α β : Type u N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) q : BallPackage β α h✝ : Nonempty β p : TauPackage β α := { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } s : Fin N → Set β := fun i => ⋃ (k : Ordinal.{u}) (_ : k < lastStep p) (_ : color p k = ↑i), {index p k} i : Fin N jx : Ordinal.{u} jx_lt : jx < lastStep p jxi : color p jx = ↑i hx : index p jx ∈ s i jy : Ordinal.{u} jy_lt : jy < lastStep p jyi : color p jy = ↑i hy : index p jy ∈ s i x_ne_y : index p jx ≠ index p jy jxy : jx < jy A : Set ℕ := ⋃ (j : { j // j < jy }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p jy)) (BallPackage.r p.toBallPackage (index p jy)))), {color p ↑j} color_j : color p jy = sInf (univ \ A) h : ∀ (x : Ordinal.{u}), x < jy → Set.Nonempty (closedBall (BallPackage.c q (index { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } x)) (BallPackage.r q (index { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } x)) ∩ closedBall (BallPackage.c q (index { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } jy)) (BallPackage.r q (index { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } jy))) → ¬color { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } jy = color { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } x ⊢ (Disjoint on fun j => closedBall (BallPackage.c q j) (BallPackage.r q j)) (index p jx) (index p jy) [PROOFSTEP] specialize h jx jxy [GOAL] α : Type u_1 inst✝ : MetricSpace α β : Type u N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) q : BallPackage β α h✝ : Nonempty β p : TauPackage β α := { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } s : Fin N → Set β := fun i => ⋃ (k : Ordinal.{u}) (_ : k < lastStep p) (_ : color p k = ↑i), {index p k} i : Fin N jx : Ordinal.{u} jx_lt : jx < lastStep p jxi : color p jx = ↑i hx : index p jx ∈ s i jy : Ordinal.{u} jy_lt : jy < lastStep p jyi : color p jy = ↑i hy : index p jy ∈ s i x_ne_y : index p jx ≠ index p jy jxy : jx < jy A : Set ℕ := ⋃ (j : { j // j < jy }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p jy)) (BallPackage.r p.toBallPackage (index p jy)))), {color p ↑j} color_j : color p jy = sInf (univ \ A) h : Set.Nonempty (closedBall (BallPackage.c q (index { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } jx)) (BallPackage.r q (index { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } jx)) ∩ closedBall (BallPackage.c q (index { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } jy)) (BallPackage.r q (index { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } jy))) → ¬color { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } jy = color { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } jx ⊢ (Disjoint on fun j => closedBall (BallPackage.c q j) (BallPackage.r q j)) (index p jx) (index p jy) [PROOFSTEP] contrapose! h [GOAL] α : Type u_1 inst✝ : MetricSpace α β : Type u N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) q : BallPackage β α h✝ : Nonempty β p : TauPackage β α := { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } s : Fin N → Set β := fun i => ⋃ (k : Ordinal.{u}) (_ : k < lastStep p) (_ : color p k = ↑i), {index p k} i : Fin N jx : Ordinal.{u} jx_lt : jx < lastStep p jxi : color p jx = ↑i hx : index p jx ∈ s i jy : Ordinal.{u} jy_lt : jy < lastStep p jyi : color p jy = ↑i hy : index p jy ∈ s i x_ne_y : index p jx ≠ index p jy jxy : jx < jy A : Set ℕ := ⋃ (j : { j // j < jy }) (_ : Set.Nonempty (closedBall (BallPackage.c p.toBallPackage (index p ↑j)) (BallPackage.r p.toBallPackage (index p ↑j)) ∩ closedBall (BallPackage.c p.toBallPackage (index p jy)) (BallPackage.r p.toBallPackage (index p jy)))), {color p ↑j} color_j : color p jy = sInf (univ \ A) h : ¬(Disjoint on fun j => closedBall (BallPackage.c q j) (BallPackage.r q j)) (index { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } jx) (index { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } jy) ⊢ Set.Nonempty (closedBall (BallPackage.c q (index { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } jx)) (BallPackage.r q (index { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } jx)) ∩ closedBall (BallPackage.c q (index { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } jy)) (BallPackage.r q (index { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } jy))) ∧ color { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } jy = color { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } jx [PROOFSTEP] simpa only [jxi, jyi, and_true_iff, eq_self_iff_true, ← not_disjoint_iff_nonempty_inter] using h [GOAL] case inr.refine'_2 α : Type u_1 inst✝ : MetricSpace α β : Type u N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) q : BallPackage β α h✝ : Nonempty β p : TauPackage β α := { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } s : Fin N → Set β := fun i => ⋃ (k : Ordinal.{u}) (_ : k < lastStep p) (_ : color p k = ↑i), {index p k} ⊢ range q.c ⊆ ⋃ (i : Fin N) (j : β) (_ : j ∈ s i), ball (BallPackage.c q j) (BallPackage.r q j) [PROOFSTEP] refine' range_subset_iff.2 fun b => _ [GOAL] case inr.refine'_2 α : Type u_1 inst✝ : MetricSpace α β : Type u N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) q : BallPackage β α h✝ : Nonempty β p : TauPackage β α := { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } s : Fin N → Set β := fun i => ⋃ (k : Ordinal.{u}) (_ : k < lastStep p) (_ : color p k = ↑i), {index p k} b : β ⊢ BallPackage.c q b ∈ ⋃ (i : Fin N) (j : β) (_ : j ∈ s i), ball (BallPackage.c q j) (BallPackage.r q j) [PROOFSTEP] obtain ⟨a, ha⟩ : ∃ a : Ordinal, a < p.lastStep ∧ dist (p.c b) (p.c (p.index a)) < p.r (p.index a) := by simpa only [iUnionUpTo, exists_prop, mem_iUnion, mem_ball, Subtype.exists, Subtype.coe_mk] using p.mem_iUnionUpTo_lastStep b [GOAL] α : Type u_1 inst✝ : MetricSpace α β : Type u N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) q : BallPackage β α h✝ : Nonempty β p : TauPackage β α := { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } s : Fin N → Set β := fun i => ⋃ (k : Ordinal.{u}) (_ : k < lastStep p) (_ : color p k = ↑i), {index p k} b : β ⊢ ∃ a, a < lastStep p ∧ dist (BallPackage.c p.toBallPackage b) (BallPackage.c p.toBallPackage (index p a)) < BallPackage.r p.toBallPackage (index p a) [PROOFSTEP] simpa only [iUnionUpTo, exists_prop, mem_iUnion, mem_ball, Subtype.exists, Subtype.coe_mk] using p.mem_iUnionUpTo_lastStep b [GOAL] case inr.refine'_2.intro α : Type u_1 inst✝ : MetricSpace α β : Type u N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) q : BallPackage β α h✝ : Nonempty β p : TauPackage β α := { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } s : Fin N → Set β := fun i => ⋃ (k : Ordinal.{u}) (_ : k < lastStep p) (_ : color p k = ↑i), {index p k} b : β a : Ordinal.{u} ha : a < lastStep p ∧ dist (BallPackage.c p.toBallPackage b) (BallPackage.c p.toBallPackage (index p a)) < BallPackage.r p.toBallPackage (index p a) ⊢ BallPackage.c q b ∈ ⋃ (i : Fin N) (j : β) (_ : j ∈ s i), ball (BallPackage.c q j) (BallPackage.r q j) [PROOFSTEP] simp only [exists_prop, mem_iUnion, mem_ball, mem_singleton_iff, biUnion_and', exists_eq_left, iUnion_exists, exists_and_left] [GOAL] case inr.refine'_2.intro α : Type u_1 inst✝ : MetricSpace α β : Type u N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) q : BallPackage β α h✝ : Nonempty β p : TauPackage β α := { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } s : Fin N → Set β := fun i => ⋃ (k : Ordinal.{u}) (_ : k < lastStep p) (_ : color p k = ↑i), {index p k} b : β a : Ordinal.{u} ha : a < lastStep p ∧ dist (BallPackage.c p.toBallPackage b) (BallPackage.c p.toBallPackage (index p a)) < BallPackage.r p.toBallPackage (index p a) ⊢ ∃ i i_1, color { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } i_1 = ↑i ∧ i_1 < lastStep { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } ∧ dist (BallPackage.c q b) (BallPackage.c q (index { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } i_1)) < BallPackage.r q (index { toBallPackage := { c := q.c, r := q.r, rpos := (_ : ∀ (b : β), 0 < BallPackage.r q b), r_bound := q.r_bound, r_le := (_ : ∀ (b : β), BallPackage.r q b ≤ q.r_bound) }, τ := τ, one_lt_tau := hτ } i_1) [PROOFSTEP] exact ⟨⟨p.color a, p.color_lt ha.1 hN⟩, a, rfl, ha⟩ [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 ⊢ ∃ t, ↑t ⊆ s ∧ ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x)) ≤ ↑N / (↑N + 1) * ↑↑μ s ∧ PairwiseDisjoint ↑t fun x => closedBall x (r x) [PROOFSTEP] rcases le_or_lt (μ s) 0 with (hμs | hμs) [GOAL] case inl α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : ↑↑μ s ≤ 0 ⊢ ∃ t, ↑t ⊆ s ∧ ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x)) ≤ ↑N / (↑N + 1) * ↑↑μ s ∧ PairwiseDisjoint ↑t fun x => closedBall x (r x) [PROOFSTEP] have : μ s = 0 := le_bot_iff.1 hμs [GOAL] case inl α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : ↑↑μ s ≤ 0 this : ↑↑μ s = 0 ⊢ ∃ t, ↑t ⊆ s ∧ ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x)) ≤ ↑N / (↑N + 1) * ↑↑μ s ∧ PairwiseDisjoint ↑t fun x => closedBall x (r x) [PROOFSTEP] refine' ⟨∅, by simp only [Finset.coe_empty, empty_subset], _, _⟩ [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : ↑↑μ s ≤ 0 this : ↑↑μ s = 0 ⊢ ↑∅ ⊆ s [PROOFSTEP] simp only [Finset.coe_empty, empty_subset] [GOAL] case inl.refine'_1 α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : ↑↑μ s ≤ 0 this : ↑↑μ s = 0 ⊢ ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ ∅), closedBall x (r x)) ≤ ↑N / (↑N + 1) * ↑↑μ s [PROOFSTEP] simp only [this, Finset.not_mem_empty, diff_empty, iUnion_false, iUnion_empty, nonpos_iff_eq_zero, mul_zero] [GOAL] case inl.refine'_2 α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : ↑↑μ s ≤ 0 this : ↑↑μ s = 0 ⊢ PairwiseDisjoint ↑∅ fun x => closedBall x (r x) [PROOFSTEP] simp only [Finset.coe_empty, pairwiseDisjoint_empty] [GOAL] case inr α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s ⊢ ∃ t, ↑t ⊆ s ∧ ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x)) ≤ ↑N / (↑N + 1) * ↑↑μ s ∧ PairwiseDisjoint ↑t fun x => closedBall x (r x) [PROOFSTEP] cases isEmpty_or_nonempty α [GOAL] case inr.inl α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : IsEmpty α ⊢ ∃ t, ↑t ⊆ s ∧ ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x)) ≤ ↑N / (↑N + 1) * ↑↑μ s ∧ PairwiseDisjoint ↑t fun x => closedBall x (r x) [PROOFSTEP] simp only [eq_empty_of_isEmpty s, measure_empty] at hμs [GOAL] case inr.inl α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 h✝ : IsEmpty α hμs : 0 < 0 ⊢ ∃ t, ↑t ⊆ s ∧ ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x)) ≤ ↑N / (↑N + 1) * ↑↑μ s ∧ PairwiseDisjoint ↑t fun x => closedBall x (r x) [PROOFSTEP] exact (lt_irrefl _ hμs).elim [GOAL] case inr.inr α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α ⊢ ∃ t, ↑t ⊆ s ∧ ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x)) ≤ ↑N / (↑N + 1) * ↑↑μ s ∧ PairwiseDisjoint ↑t fun x => closedBall x (r x) [PROOFSTEP] have Npos : N ≠ 0 := by rintro rfl inhabit α exact not_isEmpty_of_nonempty _ hN [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α ⊢ N ≠ 0 [PROOFSTEP] rintro rfl [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ τ : ℝ hτ : 1 < τ s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α hN : IsEmpty (SatelliteConfig α 0 τ) ⊢ False [PROOFSTEP] inhabit α [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ τ : ℝ hτ : 1 < τ s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α hN : IsEmpty (SatelliteConfig α 0 τ) inhabited_h : Inhabited α ⊢ False [PROOFSTEP] exact not_isEmpty_of_nonempty _ hN [GOAL] case inr.inr α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 ⊢ ∃ t, ↑t ⊆ s ∧ ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x)) ≤ ↑N / (↑N + 1) * ↑↑μ s ∧ PairwiseDisjoint ↑t fun x => closedBall x (r x) [PROOFSTEP] obtain ⟨o, so, omeas, μo⟩ : ∃ o : Set α, s ⊆ o ∧ MeasurableSet o ∧ μ o = μ s := exists_measurable_superset μ s [GOAL] case inr.inr.intro.intro.intro α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s ⊢ ∃ t, ↑t ⊆ s ∧ ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x)) ≤ ↑N / (↑N + 1) * ↑↑μ s ∧ PairwiseDisjoint ↑t fun x => closedBall x (r x) [PROOFSTEP] let a : BallPackage s α := { c := fun x => x r := fun x => r x rpos := fun x => rpos x x.2 r_bound := 1 r_le := fun x => rle x x.2 } [GOAL] case inr.inr.intro.intro.intro α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } ⊢ ∃ t, ↑t ⊆ s ∧ ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x)) ≤ ↑N / (↑N + 1) * ↑↑μ s ∧ PairwiseDisjoint ↑t fun x => closedBall x (r x) [PROOFSTEP] rcases exist_disjoint_covering_families hτ hN a with ⟨u, hu, hu'⟩ [GOAL] case inr.inr.intro.intro.intro.intro.intro α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) ⊢ ∃ t, ↑t ⊆ s ∧ ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x)) ≤ ↑N / (↑N + 1) * ↑↑μ s ∧ PairwiseDisjoint ↑t fun x => closedBall x (r x) [PROOFSTEP] have u_count : ∀ i, (u i).Countable := by intro i refine' (hu i).countable_of_nonempty_interior fun j _ => _ have : (ball (j : α) (r j)).Nonempty := nonempty_ball.2 (a.rpos _) exact this.mono ball_subset_interior_closedBall [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) ⊢ ∀ (i : Fin N), Set.Countable (u i) [PROOFSTEP] intro i [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) i : Fin N ⊢ Set.Countable (u i) [PROOFSTEP] refine' (hu i).countable_of_nonempty_interior fun j _ => _ [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) i : Fin N j : ↑s x✝ : j ∈ u i ⊢ Set.Nonempty (interior (closedBall (BallPackage.c a j) (BallPackage.r a j))) [PROOFSTEP] have : (ball (j : α) (r j)).Nonempty := nonempty_ball.2 (a.rpos _) [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) i : Fin N j : ↑s x✝ : j ∈ u i this : Set.Nonempty (ball (↑j) (r ↑j)) ⊢ Set.Nonempty (interior (closedBall (BallPackage.c a j) (BallPackage.r a j))) [PROOFSTEP] exact this.mono ball_subset_interior_closedBall [GOAL] case inr.inr.intro.intro.intro.intro.intro α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) ⊢ ∃ t, ↑t ⊆ s ∧ ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x)) ≤ ↑N / (↑N + 1) * ↑↑μ s ∧ PairwiseDisjoint ↑t fun x => closedBall x (r x) [PROOFSTEP] let v : Fin N → Set α := fun i => ⋃ (x : s) (_ : x ∈ u i), closedBall x (r x) [GOAL] case inr.inr.intro.intro.intro.intro.intro α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) ⊢ ∃ t, ↑t ⊆ s ∧ ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x)) ≤ ↑N / (↑N + 1) * ↑↑μ s ∧ PairwiseDisjoint ↑t fun x => closedBall x (r x) [PROOFSTEP] have A : s = ⋃ i : Fin N, s ∩ v i := by refine' Subset.antisymm _ (iUnion_subset fun i => inter_subset_left _ _) intro x hx obtain ⟨i, y, hxy, h'⟩ : ∃ (i : Fin N) (i_1 : ↥s), i_1 ∈ u i ∧ x ∈ ball (↑i_1) (r ↑i_1) := by have : x ∈ range a.c := by simpa only [Subtype.range_coe_subtype, setOf_mem_eq] simpa only [mem_iUnion, bex_def] using hu' this refine' mem_iUnion.2 ⟨i, ⟨hx, _⟩⟩ simp only [exists_prop, mem_iUnion, SetCoe.exists, exists_and_right, Subtype.coe_mk] exact ⟨y, ⟨y.2, by simpa only [Subtype.coe_eta]⟩, ball_subset_closedBall h'⟩ [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) ⊢ s = ⋃ (i : Fin N), s ∩ v i [PROOFSTEP] refine' Subset.antisymm _ (iUnion_subset fun i => inter_subset_left _ _) [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) ⊢ s ⊆ ⋃ (i : Fin N), s ∩ v i [PROOFSTEP] intro x hx [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) x : α hx : x ∈ s ⊢ x ∈ ⋃ (i : Fin N), s ∩ v i [PROOFSTEP] obtain ⟨i, y, hxy, h'⟩ : ∃ (i : Fin N) (i_1 : ↥s), i_1 ∈ u i ∧ x ∈ ball (↑i_1) (r ↑i_1) := by have : x ∈ range a.c := by simpa only [Subtype.range_coe_subtype, setOf_mem_eq] simpa only [mem_iUnion, bex_def] using hu' this [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) x : α hx : x ∈ s ⊢ ∃ i i_1, i_1 ∈ u i ∧ x ∈ ball (↑i_1) (r ↑i_1) [PROOFSTEP] have : x ∈ range a.c := by simpa only [Subtype.range_coe_subtype, setOf_mem_eq] [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) x : α hx : x ∈ s ⊢ x ∈ range a.c [PROOFSTEP] simpa only [Subtype.range_coe_subtype, setOf_mem_eq] [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) x : α hx : x ∈ s this : x ∈ range a.c ⊢ ∃ i i_1, i_1 ∈ u i ∧ x ∈ ball (↑i_1) (r ↑i_1) [PROOFSTEP] simpa only [mem_iUnion, bex_def] using hu' this [GOAL] case intro.intro.intro α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) x : α hx : x ∈ s i : Fin N y : ↑s hxy : y ∈ u i h' : x ∈ ball (↑y) (r ↑y) ⊢ x ∈ ⋃ (i : Fin N), s ∩ v i [PROOFSTEP] refine' mem_iUnion.2 ⟨i, ⟨hx, _⟩⟩ [GOAL] case intro.intro.intro α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) x : α hx : x ∈ s i : Fin N y : ↑s hxy : y ∈ u i h' : x ∈ ball (↑y) (r ↑y) ⊢ x ∈ v i [PROOFSTEP] simp only [exists_prop, mem_iUnion, SetCoe.exists, exists_and_right, Subtype.coe_mk] [GOAL] case intro.intro.intro α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) x : α hx : x ∈ s i : Fin N y : ↑s hxy : y ∈ u i h' : x ∈ ball (↑y) (r ↑y) ⊢ ∃ x_1, (∃ x, { val := x_1, property := (_ : x_1 ∈ s) } ∈ u i) ∧ x ∈ closedBall x_1 (r x_1) [PROOFSTEP] exact ⟨y, ⟨y.2, by simpa only [Subtype.coe_eta]⟩, ball_subset_closedBall h'⟩ [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) x : α hx : x ∈ s i : Fin N y : ↑s hxy : y ∈ u i h' : x ∈ ball (↑y) (r ↑y) ⊢ { val := ↑y, property := (_ : ↑y ∈ s) } ∈ u i [PROOFSTEP] simpa only [Subtype.coe_eta] [GOAL] case inr.inr.intro.intro.intro.intro.intro α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i ⊢ ∃ t, ↑t ⊆ s ∧ ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x)) ≤ ↑N / (↑N + 1) * ↑↑μ s ∧ PairwiseDisjoint ↑t fun x => closedBall x (r x) [PROOFSTEP] have S : ∑ _i : Fin N, μ s / N ≤ ∑ i, μ (s ∩ v i) := calc ∑ _i : Fin N, μ s / N = μ s := by simp only [Finset.card_fin, Finset.sum_const, nsmul_eq_mul] rw [ENNReal.mul_div_cancel'] · simp only [Npos, Ne.def, Nat.cast_eq_zero, not_false_iff] · exact ENNReal.nat_ne_top _ _ ≤ ∑ i, μ (s ∩ v i) := by conv_lhs => rw [A] apply measure_iUnion_fintype_le [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i ⊢ ∑ _i : Fin N, ↑↑μ s / ↑N = ↑↑μ s [PROOFSTEP] simp only [Finset.card_fin, Finset.sum_const, nsmul_eq_mul] [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i ⊢ ↑N * (↑↑μ s / ↑N) = ↑↑μ s [PROOFSTEP] rw [ENNReal.mul_div_cancel'] [GOAL] case h0 α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i ⊢ ↑N ≠ 0 [PROOFSTEP] simp only [Npos, Ne.def, Nat.cast_eq_zero, not_false_iff] [GOAL] case hI α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i ⊢ ↑N ≠ ⊤ [PROOFSTEP] exact ENNReal.nat_ne_top _ [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i ⊢ ↑↑μ s ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) [PROOFSTEP] conv_lhs => rw [A] [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i | ↑↑μ s [PROOFSTEP] rw [A] [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i | ↑↑μ s [PROOFSTEP] rw [A] [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i | ↑↑μ s [PROOFSTEP] rw [A] [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i ⊢ ↑↑μ (⋃ (i : Fin N), s ∩ v i) ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) [PROOFSTEP] apply measure_iUnion_fintype_le [GOAL] case inr.inr.intro.intro.intro.intro.intro α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) ⊢ ∃ t, ↑t ⊆ s ∧ ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x)) ≤ ↑N / (↑N + 1) * ↑↑μ s ∧ PairwiseDisjoint ↑t fun x => closedBall x (r x) [PROOFSTEP] obtain ⟨i, -, hi⟩ : ∃ (i : Fin N), i ∈ Finset.univ ∧ μ s / N ≤ μ (s ∩ v i) := by apply ENNReal.exists_le_of_sum_le _ S exact ⟨⟨0, bot_lt_iff_ne_bot.2 Npos⟩, Finset.mem_univ _⟩ [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) ⊢ ∃ i, i ∈ Finset.univ ∧ ↑↑μ s / ↑N ≤ ↑↑μ (s ∩ v i) [PROOFSTEP] apply ENNReal.exists_le_of_sum_le _ S [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) ⊢ Finset.Nonempty Finset.univ [PROOFSTEP] exact ⟨⟨0, bot_lt_iff_ne_bot.2 Npos⟩, Finset.mem_univ _⟩ [GOAL] case inr.inr.intro.intro.intro.intro.intro.intro.intro α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / ↑N ≤ ↑↑μ (s ∩ v i) ⊢ ∃ t, ↑t ⊆ s ∧ ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x)) ≤ ↑N / (↑N + 1) * ↑↑μ s ∧ PairwiseDisjoint ↑t fun x => closedBall x (r x) [PROOFSTEP] replace hi : μ s / (N + 1) < μ (s ∩ v i) [GOAL] case hi α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / ↑N ≤ ↑↑μ (s ∩ v i) ⊢ ↑↑μ s / (↑N + 1) < ↑↑μ (s ∩ v i) [PROOFSTEP] apply lt_of_lt_of_le _ hi [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / ↑N ≤ ↑↑μ (s ∩ v i) ⊢ ↑↑μ s / (↑N + 1) < ↑↑μ s / ↑N [PROOFSTEP] apply (ENNReal.mul_lt_mul_left hμs.ne' (measure_lt_top μ s).ne).2 [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / ↑N ≤ ↑↑μ (s ∩ v i) ⊢ (↑N + 1)⁻¹ < (↑N)⁻¹ [PROOFSTEP] rw [ENNReal.inv_lt_inv] [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / ↑N ≤ ↑↑μ (s ∩ v i) ⊢ ↑N < ↑N + 1 [PROOFSTEP] conv_lhs => rw [← add_zero (N : ℝ≥0∞)] [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / ↑N ≤ ↑↑μ (s ∩ v i) | ↑N [PROOFSTEP] rw [← add_zero (N : ℝ≥0∞)] [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / ↑N ≤ ↑↑μ (s ∩ v i) | ↑N [PROOFSTEP] rw [← add_zero (N : ℝ≥0∞)] [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / ↑N ≤ ↑↑μ (s ∩ v i) | ↑N [PROOFSTEP] rw [← add_zero (N : ℝ≥0∞)] [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / ↑N ≤ ↑↑μ (s ∩ v i) ⊢ ↑N + 0 < ↑N + 1 [PROOFSTEP] exact ENNReal.add_lt_add_left (ENNReal.nat_ne_top N) zero_lt_one [GOAL] case inr.inr.intro.intro.intro.intro.intro.intro.intro α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / (↑N + 1) < ↑↑μ (s ∩ v i) ⊢ ∃ t, ↑t ⊆ s ∧ ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x)) ≤ ↑N / (↑N + 1) * ↑↑μ s ∧ PairwiseDisjoint ↑t fun x => closedBall x (r x) [PROOFSTEP] have B : μ (o ∩ v i) = ∑' x : u i, μ (o ∩ closedBall x (r x)) := by have : o ∩ v i = ⋃ (x : s) (_ : x ∈ u i), o ∩ closedBall x (r x) := by simp only [inter_iUnion] rw [this, measure_biUnion (u_count i)] · exact (hu i).mono fun k => inter_subset_right _ _ · exact fun b _ => omeas.inter measurableSet_closedBall [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / (↑N + 1) < ↑↑μ (s ∩ v i) ⊢ ↑↑μ (o ∩ v i) = ∑' (x : ↑(u i)), ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) [PROOFSTEP] have : o ∩ v i = ⋃ (x : s) (_ : x ∈ u i), o ∩ closedBall x (r x) := by simp only [inter_iUnion] [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / (↑N + 1) < ↑↑μ (s ∩ v i) ⊢ o ∩ v i = ⋃ (x : ↑s) (_ : x ∈ u i), o ∩ closedBall (↑x) (r ↑x) [PROOFSTEP] simp only [inter_iUnion] [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / (↑N + 1) < ↑↑μ (s ∩ v i) this : o ∩ v i = ⋃ (x : ↑s) (_ : x ∈ u i), o ∩ closedBall (↑x) (r ↑x) ⊢ ↑↑μ (o ∩ v i) = ∑' (x : ↑(u i)), ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) [PROOFSTEP] rw [this, measure_biUnion (u_count i)] [GOAL] case hd α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / (↑N + 1) < ↑↑μ (s ∩ v i) this : o ∩ v i = ⋃ (x : ↑s) (_ : x ∈ u i), o ∩ closedBall (↑x) (r ↑x) ⊢ PairwiseDisjoint (u i) fun x => o ∩ closedBall (↑x) (r ↑x) [PROOFSTEP] exact (hu i).mono fun k => inter_subset_right _ _ [GOAL] case h α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / (↑N + 1) < ↑↑μ (s ∩ v i) this : o ∩ v i = ⋃ (x : ↑s) (_ : x ∈ u i), o ∩ closedBall (↑x) (r ↑x) ⊢ ∀ (b : ↑s), b ∈ u i → MeasurableSet (o ∩ closedBall (↑b) (r ↑b)) [PROOFSTEP] exact fun b _ => omeas.inter measurableSet_closedBall [GOAL] case inr.inr.intro.intro.intro.intro.intro.intro.intro α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / (↑N + 1) < ↑↑μ (s ∩ v i) B : ↑↑μ (o ∩ v i) = ∑' (x : ↑(u i)), ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) ⊢ ∃ t, ↑t ⊆ s ∧ ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x)) ≤ ↑N / (↑N + 1) * ↑↑μ s ∧ PairwiseDisjoint ↑t fun x => closedBall x (r x) [PROOFSTEP] obtain ⟨w, hw⟩ : ∃ w : Finset (u i), μ s / (N + 1) < ∑ x : u i in w, μ (o ∩ closedBall (x : α) (r (x : α))) := by have C : HasSum (fun x : u i => μ (o ∩ closedBall x (r x))) (μ (o ∩ v i)) := by rw [B]; exact ENNReal.summable.hasSum have : μ s / (N + 1) < μ (o ∩ v i) := hi.trans_le (measure_mono (inter_subset_inter_left _ so)) exact ((tendsto_order.1 C).1 _ this).exists [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / (↑N + 1) < ↑↑μ (s ∩ v i) B : ↑↑μ (o ∩ v i) = ∑' (x : ↑(u i)), ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) ⊢ ∃ w, ↑↑μ s / (↑N + 1) < ∑ x in w, ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) [PROOFSTEP] have C : HasSum (fun x : u i => μ (o ∩ closedBall x (r x))) (μ (o ∩ v i)) := by rw [B]; exact ENNReal.summable.hasSum [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / (↑N + 1) < ↑↑μ (s ∩ v i) B : ↑↑μ (o ∩ v i) = ∑' (x : ↑(u i)), ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) ⊢ HasSum (fun x => ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x))) (↑↑μ (o ∩ v i)) [PROOFSTEP] rw [B] [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / (↑N + 1) < ↑↑μ (s ∩ v i) B : ↑↑μ (o ∩ v i) = ∑' (x : ↑(u i)), ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) ⊢ HasSum (fun x => ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x))) (∑' (x : ↑(u i)), ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x))) [PROOFSTEP] exact ENNReal.summable.hasSum [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / (↑N + 1) < ↑↑μ (s ∩ v i) B : ↑↑μ (o ∩ v i) = ∑' (x : ↑(u i)), ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) C : HasSum (fun x => ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x))) (↑↑μ (o ∩ v i)) ⊢ ∃ w, ↑↑μ s / (↑N + 1) < ∑ x in w, ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) [PROOFSTEP] have : μ s / (N + 1) < μ (o ∩ v i) := hi.trans_le (measure_mono (inter_subset_inter_left _ so)) [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / (↑N + 1) < ↑↑μ (s ∩ v i) B : ↑↑μ (o ∩ v i) = ∑' (x : ↑(u i)), ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) C : HasSum (fun x => ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x))) (↑↑μ (o ∩ v i)) this : ↑↑μ s / (↑N + 1) < ↑↑μ (o ∩ v i) ⊢ ∃ w, ↑↑μ s / (↑N + 1) < ∑ x in w, ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) [PROOFSTEP] exact ((tendsto_order.1 C).1 _ this).exists [GOAL] case inr.inr.intro.intro.intro.intro.intro.intro.intro.intro α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / (↑N + 1) < ↑↑μ (s ∩ v i) B : ↑↑μ (o ∩ v i) = ∑' (x : ↑(u i)), ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) w : Finset ↑(u i) hw : ↑↑μ s / (↑N + 1) < ∑ x in w, ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) ⊢ ∃ t, ↑t ⊆ s ∧ ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x)) ≤ ↑N / (↑N + 1) * ↑↑μ s ∧ PairwiseDisjoint ↑t fun x => closedBall x (r x) [PROOFSTEP] refine' ⟨Finset.image (fun x : u i => x) w, _, _, _⟩ -- show that the finset is included in `s`. [GOAL] case inr.inr.intro.intro.intro.intro.intro.intro.intro.intro.refine'_1 α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / (↑N + 1) < ↑↑μ (s ∩ v i) B : ↑↑μ (o ∩ v i) = ∑' (x : ↑(u i)), ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) w : Finset ↑(u i) hw : ↑↑μ s / (↑N + 1) < ∑ x in w, ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) ⊢ ↑(Finset.image (fun x => ↑↑x) w) ⊆ s [PROOFSTEP] simp only [image_subset_iff, Finset.coe_image] [GOAL] case inr.inr.intro.intro.intro.intro.intro.intro.intro.intro.refine'_1 α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / (↑N + 1) < ↑↑μ (s ∩ v i) B : ↑↑μ (o ∩ v i) = ∑' (x : ↑(u i)), ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) w : Finset ↑(u i) hw : ↑↑μ s / (↑N + 1) < ∑ x in w, ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) ⊢ ↑w ⊆ (fun x => ↑↑x) ⁻¹' s [PROOFSTEP] intro y _ [GOAL] case inr.inr.intro.intro.intro.intro.intro.intro.intro.intro.refine'_1 α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / (↑N + 1) < ↑↑μ (s ∩ v i) B : ↑↑μ (o ∩ v i) = ∑' (x : ↑(u i)), ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) w : Finset ↑(u i) hw : ↑↑μ s / (↑N + 1) < ∑ x in w, ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) y : ↑(u i) a✝ : y ∈ ↑w ⊢ y ∈ (fun x => ↑↑x) ⁻¹' s [PROOFSTEP] simp only [Subtype.coe_prop, mem_preimage] -- show that it covers a large enough proportion of `s`. For measure computations, we do not -- use `s` (which might not be measurable), but its measurable superset `o`. Since their measures -- are the same, this does not spoil the estimates [GOAL] case inr.inr.intro.intro.intro.intro.intro.intro.intro.intro.refine'_2 α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / (↑N + 1) < ↑↑μ (s ∩ v i) B : ↑↑μ (o ∩ v i) = ∑' (x : ↑(u i)), ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) w : Finset ↑(u i) hw : ↑↑μ s / (↑N + 1) < ∑ x in w, ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) ⊢ ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ Finset.image (fun x => ↑↑x) w), closedBall x (r x)) ≤ ↑N / (↑N + 1) * ↑↑μ s [PROOFSTEP] suffices H : μ (o \ ⋃ x ∈ w, closedBall (↑x) (r ↑x)) ≤ N / (N + 1) * μ s [GOAL] case inr.inr.intro.intro.intro.intro.intro.intro.intro.intro.refine'_2 α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / (↑N + 1) < ↑↑μ (s ∩ v i) B : ↑↑μ (o ∩ v i) = ∑' (x : ↑(u i)), ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) w : Finset ↑(u i) hw : ↑↑μ s / (↑N + 1) < ∑ x in w, ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) H : ↑↑μ (o \ ⋃ (x : ↑(u i)) (_ : x ∈ w), closedBall (↑↑x) (r ↑↑x)) ≤ ↑N / (↑N + 1) * ↑↑μ s ⊢ ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ Finset.image (fun x => ↑↑x) w), closedBall x (r x)) ≤ ↑N / (↑N + 1) * ↑↑μ s [PROOFSTEP] rw [Finset.set_biUnion_finset_image] [GOAL] case inr.inr.intro.intro.intro.intro.intro.intro.intro.intro.refine'_2 α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / (↑N + 1) < ↑↑μ (s ∩ v i) B : ↑↑μ (o ∩ v i) = ∑' (x : ↑(u i)), ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) w : Finset ↑(u i) hw : ↑↑μ s / (↑N + 1) < ∑ x in w, ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) H : ↑↑μ (o \ ⋃ (x : ↑(u i)) (_ : x ∈ w), closedBall (↑↑x) (r ↑↑x)) ≤ ↑N / (↑N + 1) * ↑↑μ s ⊢ ↑↑μ (s \ ⋃ (y : ↑(u i)) (_ : y ∈ w), closedBall (↑↑y) (r ↑↑y)) ≤ ↑N / (↑N + 1) * ↑↑μ s [PROOFSTEP] exact le_trans (measure_mono (diff_subset_diff so (Subset.refl _))) H [GOAL] case H α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / (↑N + 1) < ↑↑μ (s ∩ v i) B : ↑↑μ (o ∩ v i) = ∑' (x : ↑(u i)), ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) w : Finset ↑(u i) hw : ↑↑μ s / (↑N + 1) < ∑ x in w, ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) ⊢ ↑↑μ (o \ ⋃ (x : ↑(u i)) (_ : x ∈ w), closedBall (↑↑x) (r ↑↑x)) ≤ ↑N / (↑N + 1) * ↑↑μ s [PROOFSTEP] rw [← diff_inter_self_eq_diff, measure_diff_le_iff_le_add _ (inter_subset_right _ _) (measure_lt_top μ _).ne] [GOAL] case H α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / (↑N + 1) < ↑↑μ (s ∩ v i) B : ↑↑μ (o ∩ v i) = ∑' (x : ↑(u i)), ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) w : Finset ↑(u i) hw : ↑↑μ s / (↑N + 1) < ∑ x in w, ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) ⊢ ↑↑μ o ≤ ↑↑μ ((⋃ (x : ↑(u i)) (_ : x ∈ w), closedBall (↑↑x) (r ↑↑x)) ∩ o) + ↑N / (↑N + 1) * ↑↑μ s α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / (↑N + 1) < ↑↑μ (s ∩ v i) B : ↑↑μ (o ∩ v i) = ∑' (x : ↑(u i)), ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) w : Finset ↑(u i) hw : ↑↑μ s / (↑N + 1) < ∑ x in w, ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) ⊢ MeasurableSet ((⋃ (x : ↑(u i)) (_ : x ∈ w), closedBall (↑↑x) (r ↑↑x)) ∩ o) [PROOFSTEP] swap [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / (↑N + 1) < ↑↑μ (s ∩ v i) B : ↑↑μ (o ∩ v i) = ∑' (x : ↑(u i)), ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) w : Finset ↑(u i) hw : ↑↑μ s / (↑N + 1) < ∑ x in w, ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) ⊢ MeasurableSet ((⋃ (x : ↑(u i)) (_ : x ∈ w), closedBall (↑↑x) (r ↑↑x)) ∩ o) [PROOFSTEP] apply MeasurableSet.inter _ omeas [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / (↑N + 1) < ↑↑μ (s ∩ v i) B : ↑↑μ (o ∩ v i) = ∑' (x : ↑(u i)), ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) w : Finset ↑(u i) hw : ↑↑μ s / (↑N + 1) < ∑ x in w, ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) ⊢ MeasurableSet (⋃ (x : ↑(u i)) (_ : x ∈ w), closedBall (↑↑x) (r ↑↑x)) [PROOFSTEP] haveI : Encodable (u i) := (u_count i).toEncodable [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / (↑N + 1) < ↑↑μ (s ∩ v i) B : ↑↑μ (o ∩ v i) = ∑' (x : ↑(u i)), ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) w : Finset ↑(u i) hw : ↑↑μ s / (↑N + 1) < ∑ x in w, ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) this : Encodable ↑(u i) ⊢ MeasurableSet (⋃ (x : ↑(u i)) (_ : x ∈ w), closedBall (↑↑x) (r ↑↑x)) [PROOFSTEP] exact MeasurableSet.iUnion fun b => MeasurableSet.iUnion fun _ => measurableSet_closedBall [GOAL] case H α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / (↑N + 1) < ↑↑μ (s ∩ v i) B : ↑↑μ (o ∩ v i) = ∑' (x : ↑(u i)), ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) w : Finset ↑(u i) hw : ↑↑μ s / (↑N + 1) < ∑ x in w, ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) ⊢ ↑↑μ o ≤ ↑↑μ ((⋃ (x : ↑(u i)) (_ : x ∈ w), closedBall (↑↑x) (r ↑↑x)) ∩ o) + ↑N / (↑N + 1) * ↑↑μ s [PROOFSTEP] calc μ o = 1 / (N + 1) * μ s + N / (N + 1) * μ s := by rw [μo, ← add_mul, ENNReal.div_add_div_same, add_comm, ENNReal.div_self, one_mul] <;> simp _ ≤ μ ((⋃ x ∈ w, closedBall (↑x) (r ↑x)) ∩ o) + N / (N + 1) * μ s := by refine' add_le_add _ le_rfl rw [div_eq_mul_inv, one_mul, mul_comm, ← div_eq_mul_inv] apply hw.le.trans (le_of_eq _) rw [← Finset.set_biUnion_coe, inter_comm _ o, inter_iUnion₂, Finset.set_biUnion_coe, measure_biUnion_finset] · have : (w : Set (u i)).PairwiseDisjoint fun b : u i => closedBall (b : α) (r (b : α)) := by intro k _ l _ hkl; exact hu i k.2 l.2 (Subtype.val_injective.ne hkl) exact this.mono fun k => inter_subset_right _ _ · intro b _ apply omeas.inter measurableSet_closedBall [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / (↑N + 1) < ↑↑μ (s ∩ v i) B : ↑↑μ (o ∩ v i) = ∑' (x : ↑(u i)), ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) w : Finset ↑(u i) hw : ↑↑μ s / (↑N + 1) < ∑ x in w, ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) ⊢ ↑↑μ o = 1 / (↑N + 1) * ↑↑μ s + ↑N / (↑N + 1) * ↑↑μ s [PROOFSTEP] rw [μo, ← add_mul, ENNReal.div_add_div_same, add_comm, ENNReal.div_self, one_mul] [GOAL] case h0 α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / (↑N + 1) < ↑↑μ (s ∩ v i) B : ↑↑μ (o ∩ v i) = ∑' (x : ↑(u i)), ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) w : Finset ↑(u i) hw : ↑↑μ s / (↑N + 1) < ∑ x in w, ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) ⊢ ↑N + 1 ≠ 0 [PROOFSTEP] simp [GOAL] case hI α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / (↑N + 1) < ↑↑μ (s ∩ v i) B : ↑↑μ (o ∩ v i) = ∑' (x : ↑(u i)), ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) w : Finset ↑(u i) hw : ↑↑μ s / (↑N + 1) < ∑ x in w, ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) ⊢ ↑N + 1 ≠ ⊤ [PROOFSTEP] simp [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / (↑N + 1) < ↑↑μ (s ∩ v i) B : ↑↑μ (o ∩ v i) = ∑' (x : ↑(u i)), ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) w : Finset ↑(u i) hw : ↑↑μ s / (↑N + 1) < ∑ x in w, ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) ⊢ 1 / (↑N + 1) * ↑↑μ s + ↑N / (↑N + 1) * ↑↑μ s ≤ ↑↑μ ((⋃ (x : ↑(u i)) (_ : x ∈ w), closedBall (↑↑x) (r ↑↑x)) ∩ o) + ↑N / (↑N + 1) * ↑↑μ s [PROOFSTEP] refine' add_le_add _ le_rfl [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / (↑N + 1) < ↑↑μ (s ∩ v i) B : ↑↑μ (o ∩ v i) = ∑' (x : ↑(u i)), ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) w : Finset ↑(u i) hw : ↑↑μ s / (↑N + 1) < ∑ x in w, ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) ⊢ 1 / (↑N + 1) * ↑↑μ s ≤ ↑↑μ ((⋃ (x : ↑(u i)) (_ : x ∈ w), closedBall (↑↑x) (r ↑↑x)) ∩ o) [PROOFSTEP] rw [div_eq_mul_inv, one_mul, mul_comm, ← div_eq_mul_inv] [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / (↑N + 1) < ↑↑μ (s ∩ v i) B : ↑↑μ (o ∩ v i) = ∑' (x : ↑(u i)), ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) w : Finset ↑(u i) hw : ↑↑μ s / (↑N + 1) < ∑ x in w, ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) ⊢ ↑↑μ s / (↑N + 1) ≤ ↑↑μ ((⋃ (x : ↑(u i)) (_ : x ∈ w), closedBall (↑↑x) (r ↑↑x)) ∩ o) [PROOFSTEP] apply hw.le.trans (le_of_eq _) [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / (↑N + 1) < ↑↑μ (s ∩ v i) B : ↑↑μ (o ∩ v i) = ∑' (x : ↑(u i)), ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) w : Finset ↑(u i) hw : ↑↑μ s / (↑N + 1) < ∑ x in w, ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) ⊢ ∑ x in w, ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) = ↑↑μ ((⋃ (x : ↑(u i)) (_ : x ∈ w), closedBall (↑↑x) (r ↑↑x)) ∩ o) [PROOFSTEP] rw [← Finset.set_biUnion_coe, inter_comm _ o, inter_iUnion₂, Finset.set_biUnion_coe, measure_biUnion_finset] [GOAL] case hd α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / (↑N + 1) < ↑↑μ (s ∩ v i) B : ↑↑μ (o ∩ v i) = ∑' (x : ↑(u i)), ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) w : Finset ↑(u i) hw : ↑↑μ s / (↑N + 1) < ∑ x in w, ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) ⊢ PairwiseDisjoint ↑w fun x => o ∩ closedBall (↑↑x) (r ↑↑x) [PROOFSTEP] have : (w : Set (u i)).PairwiseDisjoint fun b : u i => closedBall (b : α) (r (b : α)) := by intro k _ l _ hkl; exact hu i k.2 l.2 (Subtype.val_injective.ne hkl) [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / (↑N + 1) < ↑↑μ (s ∩ v i) B : ↑↑μ (o ∩ v i) = ∑' (x : ↑(u i)), ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) w : Finset ↑(u i) hw : ↑↑μ s / (↑N + 1) < ∑ x in w, ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) ⊢ PairwiseDisjoint ↑w fun b => closedBall (↑↑b) (r ↑↑b) [PROOFSTEP] intro k _ l _ hkl [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / (↑N + 1) < ↑↑μ (s ∩ v i) B : ↑↑μ (o ∩ v i) = ∑' (x : ↑(u i)), ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) w : Finset ↑(u i) hw : ↑↑μ s / (↑N + 1) < ∑ x in w, ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) k : ↑(u i) a✝¹ : k ∈ ↑w l : ↑(u i) a✝ : l ∈ ↑w hkl : k ≠ l ⊢ (Disjoint on fun b => closedBall (↑↑b) (r ↑↑b)) k l [PROOFSTEP] exact hu i k.2 l.2 (Subtype.val_injective.ne hkl) [GOAL] case hd α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / (↑N + 1) < ↑↑μ (s ∩ v i) B : ↑↑μ (o ∩ v i) = ∑' (x : ↑(u i)), ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) w : Finset ↑(u i) hw : ↑↑μ s / (↑N + 1) < ∑ x in w, ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) this : PairwiseDisjoint ↑w fun b => closedBall (↑↑b) (r ↑↑b) ⊢ PairwiseDisjoint ↑w fun x => o ∩ closedBall (↑↑x) (r ↑↑x) [PROOFSTEP] exact this.mono fun k => inter_subset_right _ _ [GOAL] case hm α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / (↑N + 1) < ↑↑μ (s ∩ v i) B : ↑↑μ (o ∩ v i) = ∑' (x : ↑(u i)), ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) w : Finset ↑(u i) hw : ↑↑μ s / (↑N + 1) < ∑ x in w, ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) ⊢ ∀ (b : ↑(u i)), b ∈ w → MeasurableSet (o ∩ closedBall (↑↑b) (r ↑↑b)) [PROOFSTEP] intro b _ [GOAL] case hm α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / (↑N + 1) < ↑↑μ (s ∩ v i) B : ↑↑μ (o ∩ v i) = ∑' (x : ↑(u i)), ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) w : Finset ↑(u i) hw : ↑↑μ s / (↑N + 1) < ∑ x in w, ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) b : ↑(u i) a✝ : b ∈ w ⊢ MeasurableSet (o ∩ closedBall (↑↑b) (r ↑↑b)) [PROOFSTEP] apply omeas.inter measurableSet_closedBall [GOAL] case inr.inr.intro.intro.intro.intro.intro.intro.intro.intro.refine'_3 α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / (↑N + 1) < ↑↑μ (s ∩ v i) B : ↑↑μ (o ∩ v i) = ∑' (x : ↑(u i)), ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) w : Finset ↑(u i) hw : ↑↑μ s / (↑N + 1) < ∑ x in w, ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) ⊢ PairwiseDisjoint ↑(Finset.image (fun x => ↑↑x) w) fun x => closedBall x (r x) [PROOFSTEP] intro k hk l hl hkl [GOAL] case inr.inr.intro.intro.intro.intro.intro.intro.intro.intro.refine'_3 α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / (↑N + 1) < ↑↑μ (s ∩ v i) B : ↑↑μ (o ∩ v i) = ∑' (x : ↑(u i)), ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) w : Finset ↑(u i) hw : ↑↑μ s / (↑N + 1) < ∑ x in w, ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) k : α hk : k ∈ ↑(Finset.image (fun x => ↑↑x) w) l : α hl : l ∈ ↑(Finset.image (fun x => ↑↑x) w) hkl : k ≠ l ⊢ (Disjoint on fun x => closedBall x (r x)) k l [PROOFSTEP] obtain ⟨k', _, rfl⟩ : ∃ k' : u i, k' ∈ w ∧ ↑k' = k := by simpa only [mem_image, Finset.mem_coe, Finset.coe_image] using hk [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / (↑N + 1) < ↑↑μ (s ∩ v i) B : ↑↑μ (o ∩ v i) = ∑' (x : ↑(u i)), ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) w : Finset ↑(u i) hw : ↑↑μ s / (↑N + 1) < ∑ x in w, ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) k : α hk : k ∈ ↑(Finset.image (fun x => ↑↑x) w) l : α hl : l ∈ ↑(Finset.image (fun x => ↑↑x) w) hkl : k ≠ l ⊢ ∃ k', k' ∈ w ∧ ↑↑k' = k [PROOFSTEP] simpa only [mem_image, Finset.mem_coe, Finset.coe_image] using hk [GOAL] case inr.inr.intro.intro.intro.intro.intro.intro.intro.intro.refine'_3.intro.intro α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / (↑N + 1) < ↑↑μ (s ∩ v i) B : ↑↑μ (o ∩ v i) = ∑' (x : ↑(u i)), ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) w : Finset ↑(u i) hw : ↑↑μ s / (↑N + 1) < ∑ x in w, ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) l : α hl : l ∈ ↑(Finset.image (fun x => ↑↑x) w) k' : ↑(u i) left✝ : k' ∈ w hk : ↑↑k' ∈ ↑(Finset.image (fun x => ↑↑x) w) hkl : ↑↑k' ≠ l ⊢ (Disjoint on fun x => closedBall x (r x)) (↑↑k') l [PROOFSTEP] obtain ⟨l', _, rfl⟩ : ∃ l' : u i, l' ∈ w ∧ ↑l' = l := by simpa only [mem_image, Finset.mem_coe, Finset.coe_image] using hl [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / (↑N + 1) < ↑↑μ (s ∩ v i) B : ↑↑μ (o ∩ v i) = ∑' (x : ↑(u i)), ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) w : Finset ↑(u i) hw : ↑↑μ s / (↑N + 1) < ∑ x in w, ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) l : α hl : l ∈ ↑(Finset.image (fun x => ↑↑x) w) k' : ↑(u i) left✝ : k' ∈ w hk : ↑↑k' ∈ ↑(Finset.image (fun x => ↑↑x) w) hkl : ↑↑k' ≠ l ⊢ ∃ l', l' ∈ w ∧ ↑↑l' = l [PROOFSTEP] simpa only [mem_image, Finset.mem_coe, Finset.coe_image] using hl [GOAL] case inr.inr.intro.intro.intro.intro.intro.intro.intro.intro.refine'_3.intro.intro.intro.intro α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / (↑N + 1) < ↑↑μ (s ∩ v i) B : ↑↑μ (o ∩ v i) = ∑' (x : ↑(u i)), ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) w : Finset ↑(u i) hw : ↑↑μ s / (↑N + 1) < ∑ x in w, ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) k' : ↑(u i) left✝¹ : k' ∈ w hk : ↑↑k' ∈ ↑(Finset.image (fun x => ↑↑x) w) l' : ↑(u i) left✝ : l' ∈ w hl : ↑↑l' ∈ ↑(Finset.image (fun x => ↑↑x) w) hkl : ↑↑k' ≠ ↑↑l' ⊢ (Disjoint on fun x => closedBall x (r x)) ↑↑k' ↑↑l' [PROOFSTEP] have k'nel' : (k' : s) ≠ l' := by intro h; rw [h] at hkl ; exact hkl rfl [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / (↑N + 1) < ↑↑μ (s ∩ v i) B : ↑↑μ (o ∩ v i) = ∑' (x : ↑(u i)), ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) w : Finset ↑(u i) hw : ↑↑μ s / (↑N + 1) < ∑ x in w, ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) k' : ↑(u i) left✝¹ : k' ∈ w hk : ↑↑k' ∈ ↑(Finset.image (fun x => ↑↑x) w) l' : ↑(u i) left✝ : l' ∈ w hl : ↑↑l' ∈ ↑(Finset.image (fun x => ↑↑x) w) hkl : ↑↑k' ≠ ↑↑l' ⊢ ↑k' ≠ ↑l' [PROOFSTEP] intro h [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / (↑N + 1) < ↑↑μ (s ∩ v i) B : ↑↑μ (o ∩ v i) = ∑' (x : ↑(u i)), ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) w : Finset ↑(u i) hw : ↑↑μ s / (↑N + 1) < ∑ x in w, ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) k' : ↑(u i) left✝¹ : k' ∈ w hk : ↑↑k' ∈ ↑(Finset.image (fun x => ↑↑x) w) l' : ↑(u i) left✝ : l' ∈ w hl : ↑↑l' ∈ ↑(Finset.image (fun x => ↑↑x) w) hkl : ↑↑k' ≠ ↑↑l' h : ↑k' = ↑l' ⊢ False [PROOFSTEP] rw [h] at hkl [GOAL] α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / (↑N + 1) < ↑↑μ (s ∩ v i) B : ↑↑μ (o ∩ v i) = ∑' (x : ↑(u i)), ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) w : Finset ↑(u i) hw : ↑↑μ s / (↑N + 1) < ∑ x in w, ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) k' : ↑(u i) left✝¹ : k' ∈ w hk : ↑↑k' ∈ ↑(Finset.image (fun x => ↑↑x) w) l' : ↑(u i) left✝ : l' ∈ w hl : ↑↑l' ∈ ↑(Finset.image (fun x => ↑↑x) w) hkl : ↑↑l' ≠ ↑↑l' h : ↑k' = ↑l' ⊢ False [PROOFSTEP] exact hkl rfl [GOAL] case inr.inr.intro.intro.intro.intro.intro.intro.intro.intro.refine'_3.intro.intro.intro.intro α : Type u_1 inst✝⁴ : MetricSpace α β : Type u inst✝³ : SecondCountableTopology α inst✝² : MeasurableSpace α inst✝¹ : OpensMeasurableSpace α μ : Measure α inst✝ : IsFiniteMeasure μ N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) s : Set α r : α → ℝ rpos : ∀ (x : α), x ∈ s → 0 < r x rle : ∀ (x : α), x ∈ s → r x ≤ 1 hμs : 0 < ↑↑μ s h✝ : Nonempty α Npos : N ≠ 0 o : Set α so : s ⊆ o omeas : MeasurableSet o μo : ↑↑μ o = ↑↑μ s a : BallPackage (↑s) α := { c := fun x => ↑x, r := fun x => r ↑x, rpos := (_ : ∀ (x : ↑s), 0 < r ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s), r ↑x ≤ 1) } u : Fin N → Set ↑s hu : ∀ (i : Fin N), PairwiseDisjoint (u i) fun j => closedBall (BallPackage.c a j) (BallPackage.r a j) hu' : range a.c ⊆ ⋃ (i : Fin N) (j : ↑s) (_ : j ∈ u i), ball (BallPackage.c a j) (BallPackage.r a j) u_count : ∀ (i : Fin N), Set.Countable (u i) v : Fin N → Set α := fun i => ⋃ (x : ↑s) (_ : x ∈ u i), closedBall (↑x) (r ↑x) A : s = ⋃ (i : Fin N), s ∩ v i S : ∑ _i : Fin N, ↑↑μ s / ↑N ≤ ∑ i : Fin N, ↑↑μ (s ∩ v i) i : Fin N hi : ↑↑μ s / (↑N + 1) < ↑↑μ (s ∩ v i) B : ↑↑μ (o ∩ v i) = ∑' (x : ↑(u i)), ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) w : Finset ↑(u i) hw : ↑↑μ s / (↑N + 1) < ∑ x in w, ↑↑μ (o ∩ closedBall (↑↑x) (r ↑↑x)) k' : ↑(u i) left✝¹ : k' ∈ w hk : ↑↑k' ∈ ↑(Finset.image (fun x => ↑↑x) w) l' : ↑(u i) left✝ : l' ∈ w hl : ↑↑l' ∈ ↑(Finset.image (fun x => ↑↑x) w) hkl : ↑↑k' ≠ ↑↑l' k'nel' : ↑k' ≠ ↑l' ⊢ (Disjoint on fun x => closedBall x (r x)) ↑↑k' ↑↑l' [PROOFSTEP] exact hu i k'.2 l'.2 k'nel' [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) ⊢ ∃ t, Set.Countable t ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ (∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) = 0 ∧ PairwiseDisjoint t fun p => closedBall p.fst p.snd [PROOFSTEP] rcases HasBesicovitchCovering.no_satelliteConfig (α := α) with ⟨N, τ, hτ, hN⟩ /- Introduce a property `P` on finsets saying that we have a nice disjoint covering of a subset of `s` by admissible balls. -/ [GOAL] case intro.intro.intro α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) ⊢ ∃ t, Set.Countable t ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ (∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) = 0 ∧ PairwiseDisjoint t fun p => closedBall p.fst p.snd [PROOFSTEP] let P : Finset (α × ℝ) → Prop := fun t => ((t : Set (α × ℝ)).PairwiseDisjoint fun p => closedBall p.1 p.2) ∧ (∀ p : α × ℝ, p ∈ t → p.1 ∈ s) ∧ ∀ p : α × ℝ, p ∈ t → p.2 ∈ f p.1 /- Given a finite good covering of a subset `s`, one can find a larger finite good covering, covering additionally a proportion at least `1/(N+1)` of leftover points. This follows from `exist_finset_disjoint_balls_large_measure` applied to balls not intersecting the initial covering. -/ [GOAL] case intro.intro.intro α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst ⊢ ∃ t, Set.Countable t ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ (∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) = 0 ∧ PairwiseDisjoint t fun p => closedBall p.fst p.snd [PROOFSTEP] have : ∀ t : Finset (α × ℝ), P t → ∃ u : Finset (α × ℝ), t ⊆ u ∧ P u ∧ μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u), closedBall p.1 p.2) ≤ N / (N + 1) * μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.1 p.2) := by intro t ht set B := ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.1 p.2 with hB have B_closed : IsClosed B := isClosed_biUnion (Finset.finite_toSet _) fun i _ => isClosed_ball set s' := s \ B have : ∀ x ∈ s', ∃ r ∈ f x ∩ Ioo 0 1, Disjoint B (closedBall x r) := by intro x hx have xs : x ∈ s := ((mem_diff x).1 hx).1 rcases eq_empty_or_nonempty B with (hB | hB) · rcases hf x xs 1 zero_lt_one with ⟨r, hr, h'r⟩ exact ⟨r, ⟨hr, h'r⟩, by simp only [hB, empty_disjoint]⟩ · let r := infDist x B have : 0 < min r 1 := lt_min ((B_closed.not_mem_iff_infDist_pos hB).1 ((mem_diff x).1 hx).2) zero_lt_one rcases hf x xs _ this with ⟨r, hr, h'r⟩ refine' ⟨r, ⟨hr, ⟨h'r.1, h'r.2.trans_le (min_le_right _ _)⟩⟩, _⟩ rw [disjoint_comm] exact disjoint_closedBall_of_lt_infDist (h'r.2.trans_le (min_le_left _ _)) choose! r hr using this obtain ⟨v, vs', hμv, hv⟩ : ∃ v : Finset α, ↑v ⊆ s' ∧ μ (s' \ ⋃ x ∈ v, closedBall x (r x)) ≤ N / (N + 1) * μ s' ∧ (v : Set α).PairwiseDisjoint fun x : α => closedBall x (r x) := haveI rI : ∀ x ∈ s', r x ∈ Ioo (0 : ℝ) 1 := fun x hx => (hr x hx).1.2 exist_finset_disjoint_balls_large_measure μ hτ hN s' r (fun x hx => (rI x hx).1) fun x hx => (rI x hx).2.le refine' ⟨t ∪ Finset.image (fun x => (x, r x)) v, Finset.subset_union_left _ _, ⟨_, _, _⟩, _⟩ · simp only [Finset.coe_union, pairwiseDisjoint_union, ht.1, true_and_iff, Finset.coe_image] constructor · intro p hp q hq hpq rcases(mem_image _ _ _).1 hp with ⟨p', p'v, rfl⟩ rcases(mem_image _ _ _).1 hq with ⟨q', q'v, rfl⟩ refine' hv p'v q'v fun hp'q' => _ rw [hp'q'] at hpq exact hpq rfl · intro p hp q hq hpq rcases(mem_image _ _ _).1 hq with ⟨q', q'v, rfl⟩ apply disjoint_of_subset_left _ (hr q' (vs' q'v)).2 rw [hB, ← Finset.set_biUnion_coe] exact subset_biUnion_of_mem (u := fun x : α × ℝ => closedBall x.1 x.2) hp · intro p hp rcases Finset.mem_union.1 hp with (h'p | h'p) · exact ht.2.1 p h'p · rcases Finset.mem_image.1 h'p with ⟨p', p'v, rfl⟩ exact ((mem_diff _).1 (vs' (Finset.mem_coe.2 p'v))).1 · intro p hp rcases Finset.mem_union.1 hp with (h'p | h'p) · exact ht.2.2 p h'p · rcases Finset.mem_image.1 h'p with ⟨p', p'v, rfl⟩ exact (hr p' (vs' p'v)).1.1 · convert hμv using 2 rw [Finset.set_biUnion_union, ← diff_diff, Finset.set_biUnion_finset_image] /- Define `F` associating to a finite good covering the above enlarged good covering, covering a proportion `1/(N+1)` of leftover points. Iterating `F`, one will get larger and larger good coverings, missing in the end only a measure-zero set. -/ [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst ⊢ ∀ (t : Finset (α × ℝ)), P t → ∃ u, t ⊆ u ∧ P u ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) [PROOFSTEP] intro t ht [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst t : Finset (α × ℝ) ht : P t ⊢ ∃ u, t ⊆ u ∧ P u ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) [PROOFSTEP] set B := ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.1 p.2 with hB [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst t : Finset (α × ℝ) ht : P t B : Set α := ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd hB : B = ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd ⊢ ∃ u, t ⊆ u ∧ P u ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ B) [PROOFSTEP] have B_closed : IsClosed B := isClosed_biUnion (Finset.finite_toSet _) fun i _ => isClosed_ball [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst t : Finset (α × ℝ) ht : P t B : Set α := ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd hB : B = ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd B_closed : IsClosed B ⊢ ∃ u, t ⊆ u ∧ P u ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ B) [PROOFSTEP] set s' := s \ B [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst t : Finset (α × ℝ) ht : P t B : Set α := ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd hB : B = ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd B_closed : IsClosed B s' : Set α := s \ B ⊢ ∃ u, t ⊆ u ∧ P u ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ s' [PROOFSTEP] have : ∀ x ∈ s', ∃ r ∈ f x ∩ Ioo 0 1, Disjoint B (closedBall x r) := by intro x hx have xs : x ∈ s := ((mem_diff x).1 hx).1 rcases eq_empty_or_nonempty B with (hB | hB) · rcases hf x xs 1 zero_lt_one with ⟨r, hr, h'r⟩ exact ⟨r, ⟨hr, h'r⟩, by simp only [hB, empty_disjoint]⟩ · let r := infDist x B have : 0 < min r 1 := lt_min ((B_closed.not_mem_iff_infDist_pos hB).1 ((mem_diff x).1 hx).2) zero_lt_one rcases hf x xs _ this with ⟨r, hr, h'r⟩ refine' ⟨r, ⟨hr, ⟨h'r.1, h'r.2.trans_le (min_le_right _ _)⟩⟩, _⟩ rw [disjoint_comm] exact disjoint_closedBall_of_lt_infDist (h'r.2.trans_le (min_le_left _ _)) [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst t : Finset (α × ℝ) ht : P t B : Set α := ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd hB : B = ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd B_closed : IsClosed B s' : Set α := s \ B ⊢ ∀ (x : α), x ∈ s' → ∃ r, r ∈ f x ∩ Ioo 0 1 ∧ Disjoint B (closedBall x r) [PROOFSTEP] intro x hx [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst t : Finset (α × ℝ) ht : P t B : Set α := ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd hB : B = ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd B_closed : IsClosed B s' : Set α := s \ B x : α hx : x ∈ s' ⊢ ∃ r, r ∈ f x ∩ Ioo 0 1 ∧ Disjoint B (closedBall x r) [PROOFSTEP] have xs : x ∈ s := ((mem_diff x).1 hx).1 [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst t : Finset (α × ℝ) ht : P t B : Set α := ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd hB : B = ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd B_closed : IsClosed B s' : Set α := s \ B x : α hx : x ∈ s' xs : x ∈ s ⊢ ∃ r, r ∈ f x ∩ Ioo 0 1 ∧ Disjoint B (closedBall x r) [PROOFSTEP] rcases eq_empty_or_nonempty B with (hB | hB) [GOAL] case inl α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst t : Finset (α × ℝ) ht : P t B : Set α := ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd hB✝ : B = ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd B_closed : IsClosed B s' : Set α := s \ B x : α hx : x ∈ s' xs : x ∈ s hB : B = ∅ ⊢ ∃ r, r ∈ f x ∩ Ioo 0 1 ∧ Disjoint B (closedBall x r) [PROOFSTEP] rcases hf x xs 1 zero_lt_one with ⟨r, hr, h'r⟩ [GOAL] case inl.intro.intro α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst t : Finset (α × ℝ) ht : P t B : Set α := ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd hB✝ : B = ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd B_closed : IsClosed B s' : Set α := s \ B x : α hx : x ∈ s' xs : x ∈ s hB : B = ∅ r : ℝ hr : r ∈ f x h'r : r ∈ Ioo 0 1 ⊢ ∃ r, r ∈ f x ∩ Ioo 0 1 ∧ Disjoint B (closedBall x r) [PROOFSTEP] exact ⟨r, ⟨hr, h'r⟩, by simp only [hB, empty_disjoint]⟩ [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst t : Finset (α × ℝ) ht : P t B : Set α := ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd hB✝ : B = ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd B_closed : IsClosed B s' : Set α := s \ B x : α hx : x ∈ s' xs : x ∈ s hB : B = ∅ r : ℝ hr : r ∈ f x h'r : r ∈ Ioo 0 1 ⊢ Disjoint B (closedBall x r) [PROOFSTEP] simp only [hB, empty_disjoint] [GOAL] case inr α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst t : Finset (α × ℝ) ht : P t B : Set α := ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd hB✝ : B = ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd B_closed : IsClosed B s' : Set α := s \ B x : α hx : x ∈ s' xs : x ∈ s hB : Set.Nonempty B ⊢ ∃ r, r ∈ f x ∩ Ioo 0 1 ∧ Disjoint B (closedBall x r) [PROOFSTEP] let r := infDist x B [GOAL] case inr α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst t : Finset (α × ℝ) ht : P t B : Set α := ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd hB✝ : B = ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd B_closed : IsClosed B s' : Set α := s \ B x : α hx : x ∈ s' xs : x ∈ s hB : Set.Nonempty B r : ℝ := infDist x B ⊢ ∃ r, r ∈ f x ∩ Ioo 0 1 ∧ Disjoint B (closedBall x r) [PROOFSTEP] have : 0 < min r 1 := lt_min ((B_closed.not_mem_iff_infDist_pos hB).1 ((mem_diff x).1 hx).2) zero_lt_one [GOAL] case inr α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst t : Finset (α × ℝ) ht : P t B : Set α := ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd hB✝ : B = ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd B_closed : IsClosed B s' : Set α := s \ B x : α hx : x ∈ s' xs : x ∈ s hB : Set.Nonempty B r : ℝ := infDist x B this : 0 < min r 1 ⊢ ∃ r, r ∈ f x ∩ Ioo 0 1 ∧ Disjoint B (closedBall x r) [PROOFSTEP] rcases hf x xs _ this with ⟨r, hr, h'r⟩ [GOAL] case inr.intro.intro α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst t : Finset (α × ℝ) ht : P t B : Set α := ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd hB✝ : B = ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd B_closed : IsClosed B s' : Set α := s \ B x : α hx : x ∈ s' xs : x ∈ s hB : Set.Nonempty B r✝ : ℝ := infDist x B this : 0 < min r✝ 1 r : ℝ hr : r ∈ f x h'r : r ∈ Ioo 0 (min r✝ 1) ⊢ ∃ r, r ∈ f x ∩ Ioo 0 1 ∧ Disjoint B (closedBall x r) [PROOFSTEP] refine' ⟨r, ⟨hr, ⟨h'r.1, h'r.2.trans_le (min_le_right _ _)⟩⟩, _⟩ [GOAL] case inr.intro.intro α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst t : Finset (α × ℝ) ht : P t B : Set α := ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd hB✝ : B = ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd B_closed : IsClosed B s' : Set α := s \ B x : α hx : x ∈ s' xs : x ∈ s hB : Set.Nonempty B r✝ : ℝ := infDist x B this : 0 < min r✝ 1 r : ℝ hr : r ∈ f x h'r : r ∈ Ioo 0 (min r✝ 1) ⊢ Disjoint B (closedBall x r) [PROOFSTEP] rw [disjoint_comm] [GOAL] case inr.intro.intro α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst t : Finset (α × ℝ) ht : P t B : Set α := ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd hB✝ : B = ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd B_closed : IsClosed B s' : Set α := s \ B x : α hx : x ∈ s' xs : x ∈ s hB : Set.Nonempty B r✝ : ℝ := infDist x B this : 0 < min r✝ 1 r : ℝ hr : r ∈ f x h'r : r ∈ Ioo 0 (min r✝ 1) ⊢ Disjoint (closedBall x r) B [PROOFSTEP] exact disjoint_closedBall_of_lt_infDist (h'r.2.trans_le (min_le_left _ _)) [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst t : Finset (α × ℝ) ht : P t B : Set α := ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd hB : B = ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd B_closed : IsClosed B s' : Set α := s \ B this : ∀ (x : α), x ∈ s' → ∃ r, r ∈ f x ∩ Ioo 0 1 ∧ Disjoint B (closedBall x r) ⊢ ∃ u, t ⊆ u ∧ P u ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ s' [PROOFSTEP] choose! r hr using this [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst t : Finset (α × ℝ) ht : P t B : Set α := ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd hB : B = ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd B_closed : IsClosed B s' : Set α := s \ B r : α → ℝ hr : ∀ (x : α), x ∈ s' → r x ∈ f x ∩ Ioo 0 1 ∧ Disjoint B (closedBall x (r x)) ⊢ ∃ u, t ⊆ u ∧ P u ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ s' [PROOFSTEP] obtain ⟨v, vs', hμv, hv⟩ : ∃ v : Finset α, ↑v ⊆ s' ∧ μ (s' \ ⋃ x ∈ v, closedBall x (r x)) ≤ N / (N + 1) * μ s' ∧ (v : Set α).PairwiseDisjoint fun x : α => closedBall x (r x) := haveI rI : ∀ x ∈ s', r x ∈ Ioo (0 : ℝ) 1 := fun x hx => (hr x hx).1.2 exist_finset_disjoint_balls_large_measure μ hτ hN s' r (fun x hx => (rI x hx).1) fun x hx => (rI x hx).2.le [GOAL] case intro.intro.intro α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst t : Finset (α × ℝ) ht : P t B : Set α := ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd hB : B = ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd B_closed : IsClosed B s' : Set α := s \ B r : α → ℝ hr : ∀ (x : α), x ∈ s' → r x ∈ f x ∩ Ioo 0 1 ∧ Disjoint B (closedBall x (r x)) v : Finset α vs' : ↑v ⊆ s' hμv : ↑↑μ (s' \ ⋃ (x : α) (_ : x ∈ v), closedBall x (r x)) ≤ ↑N / (↑N + 1) * ↑↑μ s' hv : PairwiseDisjoint ↑v fun x => closedBall x (r x) ⊢ ∃ u, t ⊆ u ∧ P u ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ s' [PROOFSTEP] refine' ⟨t ∪ Finset.image (fun x => (x, r x)) v, Finset.subset_union_left _ _, ⟨_, _, _⟩, _⟩ [GOAL] case intro.intro.intro.refine'_1 α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst t : Finset (α × ℝ) ht : P t B : Set α := ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd hB : B = ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd B_closed : IsClosed B s' : Set α := s \ B r : α → ℝ hr : ∀ (x : α), x ∈ s' → r x ∈ f x ∩ Ioo 0 1 ∧ Disjoint B (closedBall x (r x)) v : Finset α vs' : ↑v ⊆ s' hμv : ↑↑μ (s' \ ⋃ (x : α) (_ : x ∈ v), closedBall x (r x)) ≤ ↑N / (↑N + 1) * ↑↑μ s' hv : PairwiseDisjoint ↑v fun x => closedBall x (r x) ⊢ PairwiseDisjoint ↑(t ∪ Finset.image (fun x => (x, r x)) v) fun p => closedBall p.fst p.snd [PROOFSTEP] simp only [Finset.coe_union, pairwiseDisjoint_union, ht.1, true_and_iff, Finset.coe_image] [GOAL] case intro.intro.intro.refine'_1 α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst t : Finset (α × ℝ) ht : P t B : Set α := ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd hB : B = ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd B_closed : IsClosed B s' : Set α := s \ B r : α → ℝ hr : ∀ (x : α), x ∈ s' → r x ∈ f x ∩ Ioo 0 1 ∧ Disjoint B (closedBall x (r x)) v : Finset α vs' : ↑v ⊆ s' hμv : ↑↑μ (s' \ ⋃ (x : α) (_ : x ∈ v), closedBall x (r x)) ≤ ↑N / (↑N + 1) * ↑↑μ s' hv : PairwiseDisjoint ↑v fun x => closedBall x (r x) ⊢ (PairwiseDisjoint ((fun x => (x, r x)) '' ↑v) fun p => closedBall p.fst p.snd) ∧ ∀ ⦃i : α × ℝ⦄, i ∈ ↑t → ∀ ⦃j : α × ℝ⦄, j ∈ (fun x => (x, r x)) '' ↑v → i ≠ j → Disjoint (closedBall i.fst i.snd) (closedBall j.fst j.snd) [PROOFSTEP] constructor [GOAL] case intro.intro.intro.refine'_1.left α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst t : Finset (α × ℝ) ht : P t B : Set α := ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd hB : B = ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd B_closed : IsClosed B s' : Set α := s \ B r : α → ℝ hr : ∀ (x : α), x ∈ s' → r x ∈ f x ∩ Ioo 0 1 ∧ Disjoint B (closedBall x (r x)) v : Finset α vs' : ↑v ⊆ s' hμv : ↑↑μ (s' \ ⋃ (x : α) (_ : x ∈ v), closedBall x (r x)) ≤ ↑N / (↑N + 1) * ↑↑μ s' hv : PairwiseDisjoint ↑v fun x => closedBall x (r x) ⊢ PairwiseDisjoint ((fun x => (x, r x)) '' ↑v) fun p => closedBall p.fst p.snd [PROOFSTEP] intro p hp q hq hpq [GOAL] case intro.intro.intro.refine'_1.left α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst t : Finset (α × ℝ) ht : P t B : Set α := ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd hB : B = ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd B_closed : IsClosed B s' : Set α := s \ B r : α → ℝ hr : ∀ (x : α), x ∈ s' → r x ∈ f x ∩ Ioo 0 1 ∧ Disjoint B (closedBall x (r x)) v : Finset α vs' : ↑v ⊆ s' hμv : ↑↑μ (s' \ ⋃ (x : α) (_ : x ∈ v), closedBall x (r x)) ≤ ↑N / (↑N + 1) * ↑↑μ s' hv : PairwiseDisjoint ↑v fun x => closedBall x (r x) p : α × ℝ hp : p ∈ (fun x => (x, r x)) '' ↑v q : α × ℝ hq : q ∈ (fun x => (x, r x)) '' ↑v hpq : p ≠ q ⊢ (Disjoint on fun p => closedBall p.fst p.snd) p q [PROOFSTEP] rcases(mem_image _ _ _).1 hp with ⟨p', p'v, rfl⟩ [GOAL] case intro.intro.intro.refine'_1.left.intro.intro α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst t : Finset (α × ℝ) ht : P t B : Set α := ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd hB : B = ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd B_closed : IsClosed B s' : Set α := s \ B r : α → ℝ hr : ∀ (x : α), x ∈ s' → r x ∈ f x ∩ Ioo 0 1 ∧ Disjoint B (closedBall x (r x)) v : Finset α vs' : ↑v ⊆ s' hμv : ↑↑μ (s' \ ⋃ (x : α) (_ : x ∈ v), closedBall x (r x)) ≤ ↑N / (↑N + 1) * ↑↑μ s' hv : PairwiseDisjoint ↑v fun x => closedBall x (r x) q : α × ℝ hq : q ∈ (fun x => (x, r x)) '' ↑v p' : α p'v : p' ∈ ↑v hp : (p', r p') ∈ (fun x => (x, r x)) '' ↑v hpq : (p', r p') ≠ q ⊢ (Disjoint on fun p => closedBall p.fst p.snd) (p', r p') q [PROOFSTEP] rcases(mem_image _ _ _).1 hq with ⟨q', q'v, rfl⟩ [GOAL] case intro.intro.intro.refine'_1.left.intro.intro.intro.intro α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst t : Finset (α × ℝ) ht : P t B : Set α := ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd hB : B = ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd B_closed : IsClosed B s' : Set α := s \ B r : α → ℝ hr : ∀ (x : α), x ∈ s' → r x ∈ f x ∩ Ioo 0 1 ∧ Disjoint B (closedBall x (r x)) v : Finset α vs' : ↑v ⊆ s' hμv : ↑↑μ (s' \ ⋃ (x : α) (_ : x ∈ v), closedBall x (r x)) ≤ ↑N / (↑N + 1) * ↑↑μ s' hv : PairwiseDisjoint ↑v fun x => closedBall x (r x) p' : α p'v : p' ∈ ↑v hp : (p', r p') ∈ (fun x => (x, r x)) '' ↑v q' : α q'v : q' ∈ ↑v hq : (q', r q') ∈ (fun x => (x, r x)) '' ↑v hpq : (p', r p') ≠ (q', r q') ⊢ (Disjoint on fun p => closedBall p.fst p.snd) (p', r p') (q', r q') [PROOFSTEP] refine' hv p'v q'v fun hp'q' => _ [GOAL] case intro.intro.intro.refine'_1.left.intro.intro.intro.intro α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst t : Finset (α × ℝ) ht : P t B : Set α := ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd hB : B = ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd B_closed : IsClosed B s' : Set α := s \ B r : α → ℝ hr : ∀ (x : α), x ∈ s' → r x ∈ f x ∩ Ioo 0 1 ∧ Disjoint B (closedBall x (r x)) v : Finset α vs' : ↑v ⊆ s' hμv : ↑↑μ (s' \ ⋃ (x : α) (_ : x ∈ v), closedBall x (r x)) ≤ ↑N / (↑N + 1) * ↑↑μ s' hv : PairwiseDisjoint ↑v fun x => closedBall x (r x) p' : α p'v : p' ∈ ↑v hp : (p', r p') ∈ (fun x => (x, r x)) '' ↑v q' : α q'v : q' ∈ ↑v hq : (q', r q') ∈ (fun x => (x, r x)) '' ↑v hpq : (p', r p') ≠ (q', r q') hp'q' : p' = (q', r q').fst ⊢ False [PROOFSTEP] rw [hp'q'] at hpq [GOAL] case intro.intro.intro.refine'_1.left.intro.intro.intro.intro α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst t : Finset (α × ℝ) ht : P t B : Set α := ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd hB : B = ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd B_closed : IsClosed B s' : Set α := s \ B r : α → ℝ hr : ∀ (x : α), x ∈ s' → r x ∈ f x ∩ Ioo 0 1 ∧ Disjoint B (closedBall x (r x)) v : Finset α vs' : ↑v ⊆ s' hμv : ↑↑μ (s' \ ⋃ (x : α) (_ : x ∈ v), closedBall x (r x)) ≤ ↑N / (↑N + 1) * ↑↑μ s' hv : PairwiseDisjoint ↑v fun x => closedBall x (r x) p' : α p'v : p' ∈ ↑v hp : (p', r p') ∈ (fun x => (x, r x)) '' ↑v q' : α q'v : q' ∈ ↑v hq : (q', r q') ∈ (fun x => (x, r x)) '' ↑v hpq : ((q', r q').fst, r (q', r q').fst) ≠ (q', r q') hp'q' : p' = (q', r q').fst ⊢ False [PROOFSTEP] exact hpq rfl [GOAL] case intro.intro.intro.refine'_1.right α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst t : Finset (α × ℝ) ht : P t B : Set α := ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd hB : B = ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd B_closed : IsClosed B s' : Set α := s \ B r : α → ℝ hr : ∀ (x : α), x ∈ s' → r x ∈ f x ∩ Ioo 0 1 ∧ Disjoint B (closedBall x (r x)) v : Finset α vs' : ↑v ⊆ s' hμv : ↑↑μ (s' \ ⋃ (x : α) (_ : x ∈ v), closedBall x (r x)) ≤ ↑N / (↑N + 1) * ↑↑μ s' hv : PairwiseDisjoint ↑v fun x => closedBall x (r x) ⊢ ∀ ⦃i : α × ℝ⦄, i ∈ ↑t → ∀ ⦃j : α × ℝ⦄, j ∈ (fun x => (x, r x)) '' ↑v → i ≠ j → Disjoint (closedBall i.fst i.snd) (closedBall j.fst j.snd) [PROOFSTEP] intro p hp q hq hpq [GOAL] case intro.intro.intro.refine'_1.right α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst t : Finset (α × ℝ) ht : P t B : Set α := ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd hB : B = ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd B_closed : IsClosed B s' : Set α := s \ B r : α → ℝ hr : ∀ (x : α), x ∈ s' → r x ∈ f x ∩ Ioo 0 1 ∧ Disjoint B (closedBall x (r x)) v : Finset α vs' : ↑v ⊆ s' hμv : ↑↑μ (s' \ ⋃ (x : α) (_ : x ∈ v), closedBall x (r x)) ≤ ↑N / (↑N + 1) * ↑↑μ s' hv : PairwiseDisjoint ↑v fun x => closedBall x (r x) p : α × ℝ hp : p ∈ ↑t q : α × ℝ hq : q ∈ (fun x => (x, r x)) '' ↑v hpq : p ≠ q ⊢ Disjoint (closedBall p.fst p.snd) (closedBall q.fst q.snd) [PROOFSTEP] rcases(mem_image _ _ _).1 hq with ⟨q', q'v, rfl⟩ [GOAL] case intro.intro.intro.refine'_1.right.intro.intro α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst t : Finset (α × ℝ) ht : P t B : Set α := ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd hB : B = ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd B_closed : IsClosed B s' : Set α := s \ B r : α → ℝ hr : ∀ (x : α), x ∈ s' → r x ∈ f x ∩ Ioo 0 1 ∧ Disjoint B (closedBall x (r x)) v : Finset α vs' : ↑v ⊆ s' hμv : ↑↑μ (s' \ ⋃ (x : α) (_ : x ∈ v), closedBall x (r x)) ≤ ↑N / (↑N + 1) * ↑↑μ s' hv : PairwiseDisjoint ↑v fun x => closedBall x (r x) p : α × ℝ hp : p ∈ ↑t q' : α q'v : q' ∈ ↑v hq : (q', r q') ∈ (fun x => (x, r x)) '' ↑v hpq : p ≠ (q', r q') ⊢ Disjoint (closedBall p.fst p.snd) (closedBall (q', r q').fst (q', r q').snd) [PROOFSTEP] apply disjoint_of_subset_left _ (hr q' (vs' q'v)).2 [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst t : Finset (α × ℝ) ht : P t B : Set α := ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd hB : B = ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd B_closed : IsClosed B s' : Set α := s \ B r : α → ℝ hr : ∀ (x : α), x ∈ s' → r x ∈ f x ∩ Ioo 0 1 ∧ Disjoint B (closedBall x (r x)) v : Finset α vs' : ↑v ⊆ s' hμv : ↑↑μ (s' \ ⋃ (x : α) (_ : x ∈ v), closedBall x (r x)) ≤ ↑N / (↑N + 1) * ↑↑μ s' hv : PairwiseDisjoint ↑v fun x => closedBall x (r x) p : α × ℝ hp : p ∈ ↑t q' : α q'v : q' ∈ ↑v hq : (q', r q') ∈ (fun x => (x, r x)) '' ↑v hpq : p ≠ (q', r q') ⊢ closedBall p.fst p.snd ⊆ B [PROOFSTEP] rw [hB, ← Finset.set_biUnion_coe] [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst t : Finset (α × ℝ) ht : P t B : Set α := ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd hB : B = ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd B_closed : IsClosed B s' : Set α := s \ B r : α → ℝ hr : ∀ (x : α), x ∈ s' → r x ∈ f x ∩ Ioo 0 1 ∧ Disjoint B (closedBall x (r x)) v : Finset α vs' : ↑v ⊆ s' hμv : ↑↑μ (s' \ ⋃ (x : α) (_ : x ∈ v), closedBall x (r x)) ≤ ↑N / (↑N + 1) * ↑↑μ s' hv : PairwiseDisjoint ↑v fun x => closedBall x (r x) p : α × ℝ hp : p ∈ ↑t q' : α q'v : q' ∈ ↑v hq : (q', r q') ∈ (fun x => (x, r x)) '' ↑v hpq : p ≠ (q', r q') ⊢ closedBall p.fst p.snd ⊆ ⋃ (x : α × ℝ) (_ : x ∈ ↑t), closedBall x.fst x.snd [PROOFSTEP] exact subset_biUnion_of_mem (u := fun x : α × ℝ => closedBall x.1 x.2) hp [GOAL] case intro.intro.intro.refine'_2 α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst t : Finset (α × ℝ) ht : P t B : Set α := ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd hB : B = ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd B_closed : IsClosed B s' : Set α := s \ B r : α → ℝ hr : ∀ (x : α), x ∈ s' → r x ∈ f x ∩ Ioo 0 1 ∧ Disjoint B (closedBall x (r x)) v : Finset α vs' : ↑v ⊆ s' hμv : ↑↑μ (s' \ ⋃ (x : α) (_ : x ∈ v), closedBall x (r x)) ≤ ↑N / (↑N + 1) * ↑↑μ s' hv : PairwiseDisjoint ↑v fun x => closedBall x (r x) ⊢ ∀ (p : α × ℝ), p ∈ t ∪ Finset.image (fun x => (x, r x)) v → p.fst ∈ s [PROOFSTEP] intro p hp [GOAL] case intro.intro.intro.refine'_2 α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst t : Finset (α × ℝ) ht : P t B : Set α := ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd hB : B = ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd B_closed : IsClosed B s' : Set α := s \ B r : α → ℝ hr : ∀ (x : α), x ∈ s' → r x ∈ f x ∩ Ioo 0 1 ∧ Disjoint B (closedBall x (r x)) v : Finset α vs' : ↑v ⊆ s' hμv : ↑↑μ (s' \ ⋃ (x : α) (_ : x ∈ v), closedBall x (r x)) ≤ ↑N / (↑N + 1) * ↑↑μ s' hv : PairwiseDisjoint ↑v fun x => closedBall x (r x) p : α × ℝ hp : p ∈ t ∪ Finset.image (fun x => (x, r x)) v ⊢ p.fst ∈ s [PROOFSTEP] rcases Finset.mem_union.1 hp with (h'p | h'p) [GOAL] case intro.intro.intro.refine'_2.inl α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst t : Finset (α × ℝ) ht : P t B : Set α := ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd hB : B = ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd B_closed : IsClosed B s' : Set α := s \ B r : α → ℝ hr : ∀ (x : α), x ∈ s' → r x ∈ f x ∩ Ioo 0 1 ∧ Disjoint B (closedBall x (r x)) v : Finset α vs' : ↑v ⊆ s' hμv : ↑↑μ (s' \ ⋃ (x : α) (_ : x ∈ v), closedBall x (r x)) ≤ ↑N / (↑N + 1) * ↑↑μ s' hv : PairwiseDisjoint ↑v fun x => closedBall x (r x) p : α × ℝ hp : p ∈ t ∪ Finset.image (fun x => (x, r x)) v h'p : p ∈ t ⊢ p.fst ∈ s [PROOFSTEP] exact ht.2.1 p h'p [GOAL] case intro.intro.intro.refine'_2.inr α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst t : Finset (α × ℝ) ht : P t B : Set α := ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd hB : B = ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd B_closed : IsClosed B s' : Set α := s \ B r : α → ℝ hr : ∀ (x : α), x ∈ s' → r x ∈ f x ∩ Ioo 0 1 ∧ Disjoint B (closedBall x (r x)) v : Finset α vs' : ↑v ⊆ s' hμv : ↑↑μ (s' \ ⋃ (x : α) (_ : x ∈ v), closedBall x (r x)) ≤ ↑N / (↑N + 1) * ↑↑μ s' hv : PairwiseDisjoint ↑v fun x => closedBall x (r x) p : α × ℝ hp : p ∈ t ∪ Finset.image (fun x => (x, r x)) v h'p : p ∈ Finset.image (fun x => (x, r x)) v ⊢ p.fst ∈ s [PROOFSTEP] rcases Finset.mem_image.1 h'p with ⟨p', p'v, rfl⟩ [GOAL] case intro.intro.intro.refine'_2.inr.intro.intro α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst t : Finset (α × ℝ) ht : P t B : Set α := ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd hB : B = ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd B_closed : IsClosed B s' : Set α := s \ B r : α → ℝ hr : ∀ (x : α), x ∈ s' → r x ∈ f x ∩ Ioo 0 1 ∧ Disjoint B (closedBall x (r x)) v : Finset α vs' : ↑v ⊆ s' hμv : ↑↑μ (s' \ ⋃ (x : α) (_ : x ∈ v), closedBall x (r x)) ≤ ↑N / (↑N + 1) * ↑↑μ s' hv : PairwiseDisjoint ↑v fun x => closedBall x (r x) p' : α p'v : p' ∈ v hp : (p', r p') ∈ t ∪ Finset.image (fun x => (x, r x)) v h'p : (p', r p') ∈ Finset.image (fun x => (x, r x)) v ⊢ (p', r p').fst ∈ s [PROOFSTEP] exact ((mem_diff _).1 (vs' (Finset.mem_coe.2 p'v))).1 [GOAL] case intro.intro.intro.refine'_3 α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst t : Finset (α × ℝ) ht : P t B : Set α := ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd hB : B = ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd B_closed : IsClosed B s' : Set α := s \ B r : α → ℝ hr : ∀ (x : α), x ∈ s' → r x ∈ f x ∩ Ioo 0 1 ∧ Disjoint B (closedBall x (r x)) v : Finset α vs' : ↑v ⊆ s' hμv : ↑↑μ (s' \ ⋃ (x : α) (_ : x ∈ v), closedBall x (r x)) ≤ ↑N / (↑N + 1) * ↑↑μ s' hv : PairwiseDisjoint ↑v fun x => closedBall x (r x) ⊢ ∀ (p : α × ℝ), p ∈ t ∪ Finset.image (fun x => (x, r x)) v → p.snd ∈ f p.fst [PROOFSTEP] intro p hp [GOAL] case intro.intro.intro.refine'_3 α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst t : Finset (α × ℝ) ht : P t B : Set α := ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd hB : B = ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd B_closed : IsClosed B s' : Set α := s \ B r : α → ℝ hr : ∀ (x : α), x ∈ s' → r x ∈ f x ∩ Ioo 0 1 ∧ Disjoint B (closedBall x (r x)) v : Finset α vs' : ↑v ⊆ s' hμv : ↑↑μ (s' \ ⋃ (x : α) (_ : x ∈ v), closedBall x (r x)) ≤ ↑N / (↑N + 1) * ↑↑μ s' hv : PairwiseDisjoint ↑v fun x => closedBall x (r x) p : α × ℝ hp : p ∈ t ∪ Finset.image (fun x => (x, r x)) v ⊢ p.snd ∈ f p.fst [PROOFSTEP] rcases Finset.mem_union.1 hp with (h'p | h'p) [GOAL] case intro.intro.intro.refine'_3.inl α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst t : Finset (α × ℝ) ht : P t B : Set α := ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd hB : B = ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd B_closed : IsClosed B s' : Set α := s \ B r : α → ℝ hr : ∀ (x : α), x ∈ s' → r x ∈ f x ∩ Ioo 0 1 ∧ Disjoint B (closedBall x (r x)) v : Finset α vs' : ↑v ⊆ s' hμv : ↑↑μ (s' \ ⋃ (x : α) (_ : x ∈ v), closedBall x (r x)) ≤ ↑N / (↑N + 1) * ↑↑μ s' hv : PairwiseDisjoint ↑v fun x => closedBall x (r x) p : α × ℝ hp : p ∈ t ∪ Finset.image (fun x => (x, r x)) v h'p : p ∈ t ⊢ p.snd ∈ f p.fst [PROOFSTEP] exact ht.2.2 p h'p [GOAL] case intro.intro.intro.refine'_3.inr α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst t : Finset (α × ℝ) ht : P t B : Set α := ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd hB : B = ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd B_closed : IsClosed B s' : Set α := s \ B r : α → ℝ hr : ∀ (x : α), x ∈ s' → r x ∈ f x ∩ Ioo 0 1 ∧ Disjoint B (closedBall x (r x)) v : Finset α vs' : ↑v ⊆ s' hμv : ↑↑μ (s' \ ⋃ (x : α) (_ : x ∈ v), closedBall x (r x)) ≤ ↑N / (↑N + 1) * ↑↑μ s' hv : PairwiseDisjoint ↑v fun x => closedBall x (r x) p : α × ℝ hp : p ∈ t ∪ Finset.image (fun x => (x, r x)) v h'p : p ∈ Finset.image (fun x => (x, r x)) v ⊢ p.snd ∈ f p.fst [PROOFSTEP] rcases Finset.mem_image.1 h'p with ⟨p', p'v, rfl⟩ [GOAL] case intro.intro.intro.refine'_3.inr.intro.intro α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst t : Finset (α × ℝ) ht : P t B : Set α := ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd hB : B = ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd B_closed : IsClosed B s' : Set α := s \ B r : α → ℝ hr : ∀ (x : α), x ∈ s' → r x ∈ f x ∩ Ioo 0 1 ∧ Disjoint B (closedBall x (r x)) v : Finset α vs' : ↑v ⊆ s' hμv : ↑↑μ (s' \ ⋃ (x : α) (_ : x ∈ v), closedBall x (r x)) ≤ ↑N / (↑N + 1) * ↑↑μ s' hv : PairwiseDisjoint ↑v fun x => closedBall x (r x) p' : α p'v : p' ∈ v hp : (p', r p') ∈ t ∪ Finset.image (fun x => (x, r x)) v h'p : (p', r p') ∈ Finset.image (fun x => (x, r x)) v ⊢ (p', r p').snd ∈ f (p', r p').fst [PROOFSTEP] exact (hr p' (vs' p'v)).1.1 [GOAL] case intro.intro.intro.refine'_4 α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst t : Finset (α × ℝ) ht : P t B : Set α := ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd hB : B = ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd B_closed : IsClosed B s' : Set α := s \ B r : α → ℝ hr : ∀ (x : α), x ∈ s' → r x ∈ f x ∩ Ioo 0 1 ∧ Disjoint B (closedBall x (r x)) v : Finset α vs' : ↑v ⊆ s' hμv : ↑↑μ (s' \ ⋃ (x : α) (_ : x ∈ v), closedBall x (r x)) ≤ ↑N / (↑N + 1) * ↑↑μ s' hv : PairwiseDisjoint ↑v fun x => closedBall x (r x) ⊢ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t ∪ Finset.image (fun x => (x, r x)) v), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ s' [PROOFSTEP] convert hμv using 2 [GOAL] case h.e'_3.h.e'_3 α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst t : Finset (α × ℝ) ht : P t B : Set α := ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd hB : B = ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd B_closed : IsClosed B s' : Set α := s \ B r : α → ℝ hr : ∀ (x : α), x ∈ s' → r x ∈ f x ∩ Ioo 0 1 ∧ Disjoint B (closedBall x (r x)) v : Finset α vs' : ↑v ⊆ s' hμv : ↑↑μ (s' \ ⋃ (x : α) (_ : x ∈ v), closedBall x (r x)) ≤ ↑N / (↑N + 1) * ↑↑μ s' hv : PairwiseDisjoint ↑v fun x => closedBall x (r x) ⊢ s \ ⋃ (p : α × ℝ) (_ : p ∈ t ∪ Finset.image (fun x => (x, r x)) v), closedBall p.fst p.snd = s' \ ⋃ (x : α) (_ : x ∈ v), closedBall x (r x) [PROOFSTEP] rw [Finset.set_biUnion_union, ← diff_diff, Finset.set_biUnion_finset_image] /- Define `F` associating to a finite good covering the above enlarged good covering, covering a proportion `1/(N+1)` of leftover points. Iterating `F`, one will get larger and larger good coverings, missing in the end only a measure-zero set. -/ [GOAL] case intro.intro.intro α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst this : ∀ (t : Finset (α × ℝ)), P t → ∃ u, t ⊆ u ∧ P u ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) ⊢ ∃ t, Set.Countable t ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ (∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) = 0 ∧ PairwiseDisjoint t fun p => closedBall p.fst p.snd [PROOFSTEP] choose! F hF using this [GOAL] case intro.intro.intro α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst F : Finset (α × ℝ) → Finset (α × ℝ) hF : ∀ (t : Finset (α × ℝ)), P t → t ⊆ F t ∧ P (F t) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ F t), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) ⊢ ∃ t, Set.Countable t ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ (∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) = 0 ∧ PairwiseDisjoint t fun p => closedBall p.fst p.snd [PROOFSTEP] let u n := F^[n] ∅ [GOAL] case intro.intro.intro α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst F : Finset (α × ℝ) → Finset (α × ℝ) hF : ∀ (t : Finset (α × ℝ)), P t → t ⊆ F t ∧ P (F t) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ F t), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) u : ℕ → Finset (α × ℝ) := fun n => F^[n] ∅ ⊢ ∃ t, Set.Countable t ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ (∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) = 0 ∧ PairwiseDisjoint t fun p => closedBall p.fst p.snd [PROOFSTEP] have u_succ : ∀ n : ℕ, u n.succ = F (u n) := fun n => by simp only [Function.comp_apply, Function.iterate_succ'] [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst F : Finset (α × ℝ) → Finset (α × ℝ) hF : ∀ (t : Finset (α × ℝ)), P t → t ⊆ F t ∧ P (F t) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ F t), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) u : ℕ → Finset (α × ℝ) := fun n => F^[n] ∅ n : ℕ ⊢ u (Nat.succ n) = F (u n) [PROOFSTEP] simp only [Function.comp_apply, Function.iterate_succ'] [GOAL] case intro.intro.intro α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst F : Finset (α × ℝ) → Finset (α × ℝ) hF : ∀ (t : Finset (α × ℝ)), P t → t ⊆ F t ∧ P (F t) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ F t), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) u : ℕ → Finset (α × ℝ) := fun n => F^[n] ∅ u_succ : ∀ (n : ℕ), u (Nat.succ n) = F (u n) ⊢ ∃ t, Set.Countable t ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ (∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) = 0 ∧ PairwiseDisjoint t fun p => closedBall p.fst p.snd [PROOFSTEP] have Pu : ∀ n, P (u n) := by intro n induction' n with n IH · simp only [Prod.forall, id.def, Function.iterate_zero, Nat.zero_eq] simp only [Finset.not_mem_empty, IsEmpty.forall_iff, Finset.coe_empty, forall₂_true_iff, and_self_iff, pairwiseDisjoint_empty] · rw [u_succ] exact (hF (u n) IH).2.1 [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst F : Finset (α × ℝ) → Finset (α × ℝ) hF : ∀ (t : Finset (α × ℝ)), P t → t ⊆ F t ∧ P (F t) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ F t), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) u : ℕ → Finset (α × ℝ) := fun n => F^[n] ∅ u_succ : ∀ (n : ℕ), u (Nat.succ n) = F (u n) ⊢ ∀ (n : ℕ), P (u n) [PROOFSTEP] intro n [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst F : Finset (α × ℝ) → Finset (α × ℝ) hF : ∀ (t : Finset (α × ℝ)), P t → t ⊆ F t ∧ P (F t) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ F t), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) u : ℕ → Finset (α × ℝ) := fun n => F^[n] ∅ u_succ : ∀ (n : ℕ), u (Nat.succ n) = F (u n) n : ℕ ⊢ P (u n) [PROOFSTEP] induction' n with n IH [GOAL] case zero α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst F : Finset (α × ℝ) → Finset (α × ℝ) hF : ∀ (t : Finset (α × ℝ)), P t → t ⊆ F t ∧ P (F t) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ F t), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) u : ℕ → Finset (α × ℝ) := fun n => F^[n] ∅ u_succ : ∀ (n : ℕ), u (Nat.succ n) = F (u n) ⊢ P (u Nat.zero) [PROOFSTEP] simp only [Prod.forall, id.def, Function.iterate_zero, Nat.zero_eq] [GOAL] case zero α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst F : Finset (α × ℝ) → Finset (α × ℝ) hF : ∀ (t : Finset (α × ℝ)), P t → t ⊆ F t ∧ P (F t) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ F t), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) u : ℕ → Finset (α × ℝ) := fun n => F^[n] ∅ u_succ : ∀ (n : ℕ), u (Nat.succ n) = F (u n) ⊢ (PairwiseDisjoint ↑∅ fun p => closedBall p.fst p.snd) ∧ (∀ (a : α) (b : ℝ), (a, b) ∈ ∅ → a ∈ s) ∧ ∀ (a : α) (b : ℝ), (a, b) ∈ ∅ → b ∈ f a [PROOFSTEP] simp only [Finset.not_mem_empty, IsEmpty.forall_iff, Finset.coe_empty, forall₂_true_iff, and_self_iff, pairwiseDisjoint_empty] [GOAL] case succ α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst F : Finset (α × ℝ) → Finset (α × ℝ) hF : ∀ (t : Finset (α × ℝ)), P t → t ⊆ F t ∧ P (F t) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ F t), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) u : ℕ → Finset (α × ℝ) := fun n => F^[n] ∅ u_succ : ∀ (n : ℕ), u (Nat.succ n) = F (u n) n : ℕ IH : P (u n) ⊢ P (u (Nat.succ n)) [PROOFSTEP] rw [u_succ] [GOAL] case succ α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst F : Finset (α × ℝ) → Finset (α × ℝ) hF : ∀ (t : Finset (α × ℝ)), P t → t ⊆ F t ∧ P (F t) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ F t), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) u : ℕ → Finset (α × ℝ) := fun n => F^[n] ∅ u_succ : ∀ (n : ℕ), u (Nat.succ n) = F (u n) n : ℕ IH : P (u n) ⊢ P (F (u n)) [PROOFSTEP] exact (hF (u n) IH).2.1 [GOAL] case intro.intro.intro α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst F : Finset (α × ℝ) → Finset (α × ℝ) hF : ∀ (t : Finset (α × ℝ)), P t → t ⊆ F t ∧ P (F t) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ F t), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) u : ℕ → Finset (α × ℝ) := fun n => F^[n] ∅ u_succ : ∀ (n : ℕ), u (Nat.succ n) = F (u n) Pu : ∀ (n : ℕ), P (u n) ⊢ ∃ t, Set.Countable t ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ (∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) = 0 ∧ PairwiseDisjoint t fun p => closedBall p.fst p.snd [PROOFSTEP] refine' ⟨⋃ n, u n, countable_iUnion fun n => (u n).countable_toSet, _, _, _, _⟩ [GOAL] case intro.intro.intro.refine'_1 α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst F : Finset (α × ℝ) → Finset (α × ℝ) hF : ∀ (t : Finset (α × ℝ)), P t → t ⊆ F t ∧ P (F t) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ F t), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) u : ℕ → Finset (α × ℝ) := fun n => F^[n] ∅ u_succ : ∀ (n : ℕ), u (Nat.succ n) = F (u n) Pu : ∀ (n : ℕ), P (u n) ⊢ ∀ (p : α × ℝ), p ∈ ⋃ (n : ℕ), ↑(u n) → p.fst ∈ s [PROOFSTEP] intro p hp [GOAL] case intro.intro.intro.refine'_1 α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst F : Finset (α × ℝ) → Finset (α × ℝ) hF : ∀ (t : Finset (α × ℝ)), P t → t ⊆ F t ∧ P (F t) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ F t), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) u : ℕ → Finset (α × ℝ) := fun n => F^[n] ∅ u_succ : ∀ (n : ℕ), u (Nat.succ n) = F (u n) Pu : ∀ (n : ℕ), P (u n) p : α × ℝ hp : p ∈ ⋃ (n : ℕ), ↑(u n) ⊢ p.fst ∈ s [PROOFSTEP] rcases mem_iUnion.1 hp with ⟨n, hn⟩ [GOAL] case intro.intro.intro.refine'_1.intro α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst F : Finset (α × ℝ) → Finset (α × ℝ) hF : ∀ (t : Finset (α × ℝ)), P t → t ⊆ F t ∧ P (F t) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ F t), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) u : ℕ → Finset (α × ℝ) := fun n => F^[n] ∅ u_succ : ∀ (n : ℕ), u (Nat.succ n) = F (u n) Pu : ∀ (n : ℕ), P (u n) p : α × ℝ hp : p ∈ ⋃ (n : ℕ), ↑(u n) n : ℕ hn : p ∈ ↑(u n) ⊢ p.fst ∈ s [PROOFSTEP] exact (Pu n).2.1 p (Finset.mem_coe.1 hn) [GOAL] case intro.intro.intro.refine'_2 α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst F : Finset (α × ℝ) → Finset (α × ℝ) hF : ∀ (t : Finset (α × ℝ)), P t → t ⊆ F t ∧ P (F t) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ F t), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) u : ℕ → Finset (α × ℝ) := fun n => F^[n] ∅ u_succ : ∀ (n : ℕ), u (Nat.succ n) = F (u n) Pu : ∀ (n : ℕ), P (u n) ⊢ ∀ (p : α × ℝ), p ∈ ⋃ (n : ℕ), ↑(u n) → p.snd ∈ f p.fst [PROOFSTEP] intro p hp [GOAL] case intro.intro.intro.refine'_2 α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst F : Finset (α × ℝ) → Finset (α × ℝ) hF : ∀ (t : Finset (α × ℝ)), P t → t ⊆ F t ∧ P (F t) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ F t), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) u : ℕ → Finset (α × ℝ) := fun n => F^[n] ∅ u_succ : ∀ (n : ℕ), u (Nat.succ n) = F (u n) Pu : ∀ (n : ℕ), P (u n) p : α × ℝ hp : p ∈ ⋃ (n : ℕ), ↑(u n) ⊢ p.snd ∈ f p.fst [PROOFSTEP] rcases mem_iUnion.1 hp with ⟨n, hn⟩ [GOAL] case intro.intro.intro.refine'_2.intro α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst F : Finset (α × ℝ) → Finset (α × ℝ) hF : ∀ (t : Finset (α × ℝ)), P t → t ⊆ F t ∧ P (F t) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ F t), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) u : ℕ → Finset (α × ℝ) := fun n => F^[n] ∅ u_succ : ∀ (n : ℕ), u (Nat.succ n) = F (u n) Pu : ∀ (n : ℕ), P (u n) p : α × ℝ hp : p ∈ ⋃ (n : ℕ), ↑(u n) n : ℕ hn : p ∈ ↑(u n) ⊢ p.snd ∈ f p.fst [PROOFSTEP] exact (Pu n).2.2 p (Finset.mem_coe.1 hn) [GOAL] case intro.intro.intro.refine'_3 α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst F : Finset (α × ℝ) → Finset (α × ℝ) hF : ∀ (t : Finset (α × ℝ)), P t → t ⊆ F t ∧ P (F t) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ F t), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) u : ℕ → Finset (α × ℝ) := fun n => F^[n] ∅ u_succ : ∀ (n : ℕ), u (Nat.succ n) = F (u n) Pu : ∀ (n : ℕ), P (u n) ⊢ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ ⋃ (n : ℕ), ↑(u n)), closedBall p.fst p.snd) = 0 [PROOFSTEP] have A : ∀ n, μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ ⋃ n : ℕ, (u n : Set (α × ℝ))), closedBall p.fst p.snd) ≤ μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) := by intro n apply measure_mono apply diff_subset_diff (Subset.refl _) exact biUnion_subset_biUnion_left (subset_iUnion (fun i => (u i : Set (α × ℝ))) n) [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst F : Finset (α × ℝ) → Finset (α × ℝ) hF : ∀ (t : Finset (α × ℝ)), P t → t ⊆ F t ∧ P (F t) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ F t), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) u : ℕ → Finset (α × ℝ) := fun n => F^[n] ∅ u_succ : ∀ (n : ℕ), u (Nat.succ n) = F (u n) Pu : ∀ (n : ℕ), P (u n) ⊢ ∀ (n : ℕ), ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ ⋃ (n : ℕ), ↑(u n)), closedBall p.fst p.snd) ≤ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) [PROOFSTEP] intro n [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst F : Finset (α × ℝ) → Finset (α × ℝ) hF : ∀ (t : Finset (α × ℝ)), P t → t ⊆ F t ∧ P (F t) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ F t), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) u : ℕ → Finset (α × ℝ) := fun n => F^[n] ∅ u_succ : ∀ (n : ℕ), u (Nat.succ n) = F (u n) Pu : ∀ (n : ℕ), P (u n) n : ℕ ⊢ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ ⋃ (n : ℕ), ↑(u n)), closedBall p.fst p.snd) ≤ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) [PROOFSTEP] apply measure_mono [GOAL] case h α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst F : Finset (α × ℝ) → Finset (α × ℝ) hF : ∀ (t : Finset (α × ℝ)), P t → t ⊆ F t ∧ P (F t) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ F t), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) u : ℕ → Finset (α × ℝ) := fun n => F^[n] ∅ u_succ : ∀ (n : ℕ), u (Nat.succ n) = F (u n) Pu : ∀ (n : ℕ), P (u n) n : ℕ ⊢ s \ ⋃ (p : α × ℝ) (_ : p ∈ ⋃ (n : ℕ), ↑(u n)), closedBall p.fst p.snd ⊆ s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd [PROOFSTEP] apply diff_subset_diff (Subset.refl _) [GOAL] case h α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst F : Finset (α × ℝ) → Finset (α × ℝ) hF : ∀ (t : Finset (α × ℝ)), P t → t ⊆ F t ∧ P (F t) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ F t), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) u : ℕ → Finset (α × ℝ) := fun n => F^[n] ∅ u_succ : ∀ (n : ℕ), u (Nat.succ n) = F (u n) Pu : ∀ (n : ℕ), P (u n) n : ℕ ⊢ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd ⊆ ⋃ (p : α × ℝ) (_ : p ∈ ⋃ (n : ℕ), ↑(u n)), closedBall p.fst p.snd [PROOFSTEP] exact biUnion_subset_biUnion_left (subset_iUnion (fun i => (u i : Set (α × ℝ))) n) [GOAL] case intro.intro.intro.refine'_3 α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst F : Finset (α × ℝ) → Finset (α × ℝ) hF : ∀ (t : Finset (α × ℝ)), P t → t ⊆ F t ∧ P (F t) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ F t), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) u : ℕ → Finset (α × ℝ) := fun n => F^[n] ∅ u_succ : ∀ (n : ℕ), u (Nat.succ n) = F (u n) Pu : ∀ (n : ℕ), P (u n) A : ∀ (n : ℕ), ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ ⋃ (n : ℕ), ↑(u n)), closedBall p.fst p.snd) ≤ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) ⊢ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ ⋃ (n : ℕ), ↑(u n)), closedBall p.fst p.snd) = 0 [PROOFSTEP] have B : ∀ n, μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) ≤ (N / (N + 1) : ℝ≥0∞) ^ n * μ s := by intro n induction' n with n IH · simp only [le_refl, diff_empty, one_mul, iUnion_false, iUnion_empty, pow_zero, Nat.zero_eq, Function.iterate_zero, id.def, Finset.not_mem_empty] calc μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n.succ), closedBall p.fst p.snd) ≤ N / (N + 1) * μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) := by rw [u_succ]; exact (hF (u n) (Pu n)).2.2 _ ≤ (N / (N + 1) : ℝ≥0∞) ^ n.succ * μ s := by rw [pow_succ, mul_assoc]; exact mul_le_mul_left' IH _ [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst F : Finset (α × ℝ) → Finset (α × ℝ) hF : ∀ (t : Finset (α × ℝ)), P t → t ⊆ F t ∧ P (F t) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ F t), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) u : ℕ → Finset (α × ℝ) := fun n => F^[n] ∅ u_succ : ∀ (n : ℕ), u (Nat.succ n) = F (u n) Pu : ∀ (n : ℕ), P (u n) A : ∀ (n : ℕ), ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ ⋃ (n : ℕ), ↑(u n)), closedBall p.fst p.snd) ≤ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) ⊢ ∀ (n : ℕ), ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) ≤ (↑N / (↑N + 1)) ^ n * ↑↑μ s [PROOFSTEP] intro n [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst F : Finset (α × ℝ) → Finset (α × ℝ) hF : ∀ (t : Finset (α × ℝ)), P t → t ⊆ F t ∧ P (F t) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ F t), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) u : ℕ → Finset (α × ℝ) := fun n => F^[n] ∅ u_succ : ∀ (n : ℕ), u (Nat.succ n) = F (u n) Pu : ∀ (n : ℕ), P (u n) A : ∀ (n : ℕ), ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ ⋃ (n : ℕ), ↑(u n)), closedBall p.fst p.snd) ≤ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) n : ℕ ⊢ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) ≤ (↑N / (↑N + 1)) ^ n * ↑↑μ s [PROOFSTEP] induction' n with n IH [GOAL] case zero α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst F : Finset (α × ℝ) → Finset (α × ℝ) hF : ∀ (t : Finset (α × ℝ)), P t → t ⊆ F t ∧ P (F t) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ F t), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) u : ℕ → Finset (α × ℝ) := fun n => F^[n] ∅ u_succ : ∀ (n : ℕ), u (Nat.succ n) = F (u n) Pu : ∀ (n : ℕ), P (u n) A : ∀ (n : ℕ), ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ ⋃ (n : ℕ), ↑(u n)), closedBall p.fst p.snd) ≤ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) ⊢ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u Nat.zero), closedBall p.fst p.snd) ≤ (↑N / (↑N + 1)) ^ Nat.zero * ↑↑μ s [PROOFSTEP] simp only [le_refl, diff_empty, one_mul, iUnion_false, iUnion_empty, pow_zero, Nat.zero_eq, Function.iterate_zero, id.def, Finset.not_mem_empty] [GOAL] case succ α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst F : Finset (α × ℝ) → Finset (α × ℝ) hF : ∀ (t : Finset (α × ℝ)), P t → t ⊆ F t ∧ P (F t) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ F t), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) u : ℕ → Finset (α × ℝ) := fun n => F^[n] ∅ u_succ : ∀ (n : ℕ), u (Nat.succ n) = F (u n) Pu : ∀ (n : ℕ), P (u n) A : ∀ (n : ℕ), ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ ⋃ (n : ℕ), ↑(u n)), closedBall p.fst p.snd) ≤ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) n : ℕ IH : ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) ≤ (↑N / (↑N + 1)) ^ n * ↑↑μ s ⊢ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u (Nat.succ n)), closedBall p.fst p.snd) ≤ (↑N / (↑N + 1)) ^ Nat.succ n * ↑↑μ s [PROOFSTEP] calc μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n.succ), closedBall p.fst p.snd) ≤ N / (N + 1) * μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) := by rw [u_succ]; exact (hF (u n) (Pu n)).2.2 _ ≤ (N / (N + 1) : ℝ≥0∞) ^ n.succ * μ s := by rw [pow_succ, mul_assoc]; exact mul_le_mul_left' IH _ [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst F : Finset (α × ℝ) → Finset (α × ℝ) hF : ∀ (t : Finset (α × ℝ)), P t → t ⊆ F t ∧ P (F t) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ F t), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) u : ℕ → Finset (α × ℝ) := fun n => F^[n] ∅ u_succ : ∀ (n : ℕ), u (Nat.succ n) = F (u n) Pu : ∀ (n : ℕ), P (u n) A : ∀ (n : ℕ), ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ ⋃ (n : ℕ), ↑(u n)), closedBall p.fst p.snd) ≤ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) n : ℕ IH : ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) ≤ (↑N / (↑N + 1)) ^ n * ↑↑μ s ⊢ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u (Nat.succ n)), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) [PROOFSTEP] rw [u_succ] [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst F : Finset (α × ℝ) → Finset (α × ℝ) hF : ∀ (t : Finset (α × ℝ)), P t → t ⊆ F t ∧ P (F t) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ F t), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) u : ℕ → Finset (α × ℝ) := fun n => F^[n] ∅ u_succ : ∀ (n : ℕ), u (Nat.succ n) = F (u n) Pu : ∀ (n : ℕ), P (u n) A : ∀ (n : ℕ), ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ ⋃ (n : ℕ), ↑(u n)), closedBall p.fst p.snd) ≤ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) n : ℕ IH : ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) ≤ (↑N / (↑N + 1)) ^ n * ↑↑μ s ⊢ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ F (u n)), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) [PROOFSTEP] exact (hF (u n) (Pu n)).2.2 [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst F : Finset (α × ℝ) → Finset (α × ℝ) hF : ∀ (t : Finset (α × ℝ)), P t → t ⊆ F t ∧ P (F t) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ F t), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) u : ℕ → Finset (α × ℝ) := fun n => F^[n] ∅ u_succ : ∀ (n : ℕ), u (Nat.succ n) = F (u n) Pu : ∀ (n : ℕ), P (u n) A : ∀ (n : ℕ), ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ ⋃ (n : ℕ), ↑(u n)), closedBall p.fst p.snd) ≤ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) n : ℕ IH : ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) ≤ (↑N / (↑N + 1)) ^ n * ↑↑μ s ⊢ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) ≤ (↑N / (↑N + 1)) ^ Nat.succ n * ↑↑μ s [PROOFSTEP] rw [pow_succ, mul_assoc] [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst F : Finset (α × ℝ) → Finset (α × ℝ) hF : ∀ (t : Finset (α × ℝ)), P t → t ⊆ F t ∧ P (F t) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ F t), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) u : ℕ → Finset (α × ℝ) := fun n => F^[n] ∅ u_succ : ∀ (n : ℕ), u (Nat.succ n) = F (u n) Pu : ∀ (n : ℕ), P (u n) A : ∀ (n : ℕ), ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ ⋃ (n : ℕ), ↑(u n)), closedBall p.fst p.snd) ≤ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) n : ℕ IH : ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) ≤ (↑N / (↑N + 1)) ^ n * ↑↑μ s ⊢ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ((↑N / (↑N + 1)) ^ n * ↑↑μ s) [PROOFSTEP] exact mul_le_mul_left' IH _ [GOAL] case intro.intro.intro.refine'_3 α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst F : Finset (α × ℝ) → Finset (α × ℝ) hF : ∀ (t : Finset (α × ℝ)), P t → t ⊆ F t ∧ P (F t) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ F t), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) u : ℕ → Finset (α × ℝ) := fun n => F^[n] ∅ u_succ : ∀ (n : ℕ), u (Nat.succ n) = F (u n) Pu : ∀ (n : ℕ), P (u n) A : ∀ (n : ℕ), ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ ⋃ (n : ℕ), ↑(u n)), closedBall p.fst p.snd) ≤ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) B : ∀ (n : ℕ), ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) ≤ (↑N / (↑N + 1)) ^ n * ↑↑μ s ⊢ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ ⋃ (n : ℕ), ↑(u n)), closedBall p.fst p.snd) = 0 [PROOFSTEP] have C : Tendsto (fun n : ℕ => ((N : ℝ≥0∞) / (N + 1)) ^ n * μ s) atTop (𝓝 (0 * μ s)) := by apply ENNReal.Tendsto.mul_const _ (Or.inr (measure_lt_top μ s).ne) apply ENNReal.tendsto_pow_atTop_nhds_0_of_lt_1 rw [ENNReal.div_lt_iff, one_mul] · conv_lhs => rw [← add_zero (N : ℝ≥0∞)] exact ENNReal.add_lt_add_left (ENNReal.nat_ne_top N) zero_lt_one · simp only [true_or_iff, add_eq_zero_iff, Ne.def, not_false_iff, one_ne_zero, and_false_iff] · simp only [ENNReal.nat_ne_top, Ne.def, not_false_iff, or_true_iff] [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst F : Finset (α × ℝ) → Finset (α × ℝ) hF : ∀ (t : Finset (α × ℝ)), P t → t ⊆ F t ∧ P (F t) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ F t), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) u : ℕ → Finset (α × ℝ) := fun n => F^[n] ∅ u_succ : ∀ (n : ℕ), u (Nat.succ n) = F (u n) Pu : ∀ (n : ℕ), P (u n) A : ∀ (n : ℕ), ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ ⋃ (n : ℕ), ↑(u n)), closedBall p.fst p.snd) ≤ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) B : ∀ (n : ℕ), ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) ≤ (↑N / (↑N + 1)) ^ n * ↑↑μ s ⊢ Tendsto (fun n => (↑N / (↑N + 1)) ^ n * ↑↑μ s) atTop (𝓝 (0 * ↑↑μ s)) [PROOFSTEP] apply ENNReal.Tendsto.mul_const _ (Or.inr (measure_lt_top μ s).ne) [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst F : Finset (α × ℝ) → Finset (α × ℝ) hF : ∀ (t : Finset (α × ℝ)), P t → t ⊆ F t ∧ P (F t) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ F t), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) u : ℕ → Finset (α × ℝ) := fun n => F^[n] ∅ u_succ : ∀ (n : ℕ), u (Nat.succ n) = F (u n) Pu : ∀ (n : ℕ), P (u n) A : ∀ (n : ℕ), ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ ⋃ (n : ℕ), ↑(u n)), closedBall p.fst p.snd) ≤ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) B : ∀ (n : ℕ), ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) ≤ (↑N / (↑N + 1)) ^ n * ↑↑μ s ⊢ Tendsto (fun x => (↑N / (↑N + 1)) ^ x) atTop (𝓝 0) [PROOFSTEP] apply ENNReal.tendsto_pow_atTop_nhds_0_of_lt_1 [GOAL] case hr α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst F : Finset (α × ℝ) → Finset (α × ℝ) hF : ∀ (t : Finset (α × ℝ)), P t → t ⊆ F t ∧ P (F t) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ F t), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) u : ℕ → Finset (α × ℝ) := fun n => F^[n] ∅ u_succ : ∀ (n : ℕ), u (Nat.succ n) = F (u n) Pu : ∀ (n : ℕ), P (u n) A : ∀ (n : ℕ), ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ ⋃ (n : ℕ), ↑(u n)), closedBall p.fst p.snd) ≤ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) B : ∀ (n : ℕ), ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) ≤ (↑N / (↑N + 1)) ^ n * ↑↑μ s ⊢ ↑N / (↑N + 1) < 1 [PROOFSTEP] rw [ENNReal.div_lt_iff, one_mul] [GOAL] case hr α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst F : Finset (α × ℝ) → Finset (α × ℝ) hF : ∀ (t : Finset (α × ℝ)), P t → t ⊆ F t ∧ P (F t) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ F t), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) u : ℕ → Finset (α × ℝ) := fun n => F^[n] ∅ u_succ : ∀ (n : ℕ), u (Nat.succ n) = F (u n) Pu : ∀ (n : ℕ), P (u n) A : ∀ (n : ℕ), ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ ⋃ (n : ℕ), ↑(u n)), closedBall p.fst p.snd) ≤ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) B : ∀ (n : ℕ), ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) ≤ (↑N / (↑N + 1)) ^ n * ↑↑μ s ⊢ ↑N < ↑N + 1 [PROOFSTEP] conv_lhs => rw [← add_zero (N : ℝ≥0∞)] [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst F : Finset (α × ℝ) → Finset (α × ℝ) hF : ∀ (t : Finset (α × ℝ)), P t → t ⊆ F t ∧ P (F t) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ F t), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) u : ℕ → Finset (α × ℝ) := fun n => F^[n] ∅ u_succ : ∀ (n : ℕ), u (Nat.succ n) = F (u n) Pu : ∀ (n : ℕ), P (u n) A : ∀ (n : ℕ), ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ ⋃ (n : ℕ), ↑(u n)), closedBall p.fst p.snd) ≤ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) B : ∀ (n : ℕ), ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) ≤ (↑N / (↑N + 1)) ^ n * ↑↑μ s | ↑N [PROOFSTEP] rw [← add_zero (N : ℝ≥0∞)] [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst F : Finset (α × ℝ) → Finset (α × ℝ) hF : ∀ (t : Finset (α × ℝ)), P t → t ⊆ F t ∧ P (F t) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ F t), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) u : ℕ → Finset (α × ℝ) := fun n => F^[n] ∅ u_succ : ∀ (n : ℕ), u (Nat.succ n) = F (u n) Pu : ∀ (n : ℕ), P (u n) A : ∀ (n : ℕ), ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ ⋃ (n : ℕ), ↑(u n)), closedBall p.fst p.snd) ≤ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) B : ∀ (n : ℕ), ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) ≤ (↑N / (↑N + 1)) ^ n * ↑↑μ s | ↑N [PROOFSTEP] rw [← add_zero (N : ℝ≥0∞)] [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst F : Finset (α × ℝ) → Finset (α × ℝ) hF : ∀ (t : Finset (α × ℝ)), P t → t ⊆ F t ∧ P (F t) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ F t), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) u : ℕ → Finset (α × ℝ) := fun n => F^[n] ∅ u_succ : ∀ (n : ℕ), u (Nat.succ n) = F (u n) Pu : ∀ (n : ℕ), P (u n) A : ∀ (n : ℕ), ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ ⋃ (n : ℕ), ↑(u n)), closedBall p.fst p.snd) ≤ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) B : ∀ (n : ℕ), ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) ≤ (↑N / (↑N + 1)) ^ n * ↑↑μ s | ↑N [PROOFSTEP] rw [← add_zero (N : ℝ≥0∞)] [GOAL] case hr α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst F : Finset (α × ℝ) → Finset (α × ℝ) hF : ∀ (t : Finset (α × ℝ)), P t → t ⊆ F t ∧ P (F t) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ F t), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) u : ℕ → Finset (α × ℝ) := fun n => F^[n] ∅ u_succ : ∀ (n : ℕ), u (Nat.succ n) = F (u n) Pu : ∀ (n : ℕ), P (u n) A : ∀ (n : ℕ), ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ ⋃ (n : ℕ), ↑(u n)), closedBall p.fst p.snd) ≤ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) B : ∀ (n : ℕ), ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) ≤ (↑N / (↑N + 1)) ^ n * ↑↑μ s ⊢ ↑N + 0 < ↑N + 1 [PROOFSTEP] exact ENNReal.add_lt_add_left (ENNReal.nat_ne_top N) zero_lt_one [GOAL] case hr.h0 α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst F : Finset (α × ℝ) → Finset (α × ℝ) hF : ∀ (t : Finset (α × ℝ)), P t → t ⊆ F t ∧ P (F t) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ F t), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) u : ℕ → Finset (α × ℝ) := fun n => F^[n] ∅ u_succ : ∀ (n : ℕ), u (Nat.succ n) = F (u n) Pu : ∀ (n : ℕ), P (u n) A : ∀ (n : ℕ), ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ ⋃ (n : ℕ), ↑(u n)), closedBall p.fst p.snd) ≤ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) B : ∀ (n : ℕ), ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) ≤ (↑N / (↑N + 1)) ^ n * ↑↑μ s ⊢ ↑N + 1 ≠ 0 ∨ ↑N ≠ 0 [PROOFSTEP] simp only [true_or_iff, add_eq_zero_iff, Ne.def, not_false_iff, one_ne_zero, and_false_iff] [GOAL] case hr.ht α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst F : Finset (α × ℝ) → Finset (α × ℝ) hF : ∀ (t : Finset (α × ℝ)), P t → t ⊆ F t ∧ P (F t) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ F t), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) u : ℕ → Finset (α × ℝ) := fun n => F^[n] ∅ u_succ : ∀ (n : ℕ), u (Nat.succ n) = F (u n) Pu : ∀ (n : ℕ), P (u n) A : ∀ (n : ℕ), ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ ⋃ (n : ℕ), ↑(u n)), closedBall p.fst p.snd) ≤ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) B : ∀ (n : ℕ), ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) ≤ (↑N / (↑N + 1)) ^ n * ↑↑μ s ⊢ ↑N + 1 ≠ ⊤ ∨ ↑N ≠ ⊤ [PROOFSTEP] simp only [ENNReal.nat_ne_top, Ne.def, not_false_iff, or_true_iff] [GOAL] case intro.intro.intro.refine'_3 α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst F : Finset (α × ℝ) → Finset (α × ℝ) hF : ∀ (t : Finset (α × ℝ)), P t → t ⊆ F t ∧ P (F t) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ F t), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) u : ℕ → Finset (α × ℝ) := fun n => F^[n] ∅ u_succ : ∀ (n : ℕ), u (Nat.succ n) = F (u n) Pu : ∀ (n : ℕ), P (u n) A : ∀ (n : ℕ), ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ ⋃ (n : ℕ), ↑(u n)), closedBall p.fst p.snd) ≤ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) B : ∀ (n : ℕ), ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) ≤ (↑N / (↑N + 1)) ^ n * ↑↑μ s C : Tendsto (fun n => (↑N / (↑N + 1)) ^ n * ↑↑μ s) atTop (𝓝 (0 * ↑↑μ s)) ⊢ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ ⋃ (n : ℕ), ↑(u n)), closedBall p.fst p.snd) = 0 [PROOFSTEP] rw [zero_mul] at C [GOAL] case intro.intro.intro.refine'_3 α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst F : Finset (α × ℝ) → Finset (α × ℝ) hF : ∀ (t : Finset (α × ℝ)), P t → t ⊆ F t ∧ P (F t) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ F t), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) u : ℕ → Finset (α × ℝ) := fun n => F^[n] ∅ u_succ : ∀ (n : ℕ), u (Nat.succ n) = F (u n) Pu : ∀ (n : ℕ), P (u n) A : ∀ (n : ℕ), ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ ⋃ (n : ℕ), ↑(u n)), closedBall p.fst p.snd) ≤ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) B : ∀ (n : ℕ), ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) ≤ (↑N / (↑N + 1)) ^ n * ↑↑μ s C : Tendsto (fun n => (↑N / (↑N + 1)) ^ n * ↑↑μ s) atTop (𝓝 0) ⊢ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ ⋃ (n : ℕ), ↑(u n)), closedBall p.fst p.snd) = 0 [PROOFSTEP] apply le_bot_iff.1 [GOAL] case intro.intro.intro.refine'_3 α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst F : Finset (α × ℝ) → Finset (α × ℝ) hF : ∀ (t : Finset (α × ℝ)), P t → t ⊆ F t ∧ P (F t) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ F t), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) u : ℕ → Finset (α × ℝ) := fun n => F^[n] ∅ u_succ : ∀ (n : ℕ), u (Nat.succ n) = F (u n) Pu : ∀ (n : ℕ), P (u n) A : ∀ (n : ℕ), ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ ⋃ (n : ℕ), ↑(u n)), closedBall p.fst p.snd) ≤ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) B : ∀ (n : ℕ), ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ u n), closedBall p.fst p.snd) ≤ (↑N / (↑N + 1)) ^ n * ↑↑μ s C : Tendsto (fun n => (↑N / (↑N + 1)) ^ n * ↑↑μ s) atTop (𝓝 0) ⊢ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ ⋃ (n : ℕ), ↑(u n)), closedBall p.fst p.snd) ≤ ⊥ [PROOFSTEP] exact le_of_tendsto_of_tendsto' tendsto_const_nhds C fun n => (A n).trans (B n) [GOAL] case intro.intro.intro.refine'_4 α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst F : Finset (α × ℝ) → Finset (α × ℝ) hF : ∀ (t : Finset (α × ℝ)), P t → t ⊆ F t ∧ P (F t) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ F t), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) u : ℕ → Finset (α × ℝ) := fun n => F^[n] ∅ u_succ : ∀ (n : ℕ), u (Nat.succ n) = F (u n) Pu : ∀ (n : ℕ), P (u n) ⊢ PairwiseDisjoint (⋃ (n : ℕ), ↑(u n)) fun p => closedBall p.fst p.snd [PROOFSTEP] refine' (pairwiseDisjoint_iUnion _).2 fun n => (Pu n).1 [GOAL] case intro.intro.intro.refine'_4 α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst F : Finset (α × ℝ) → Finset (α × ℝ) hF : ∀ (t : Finset (α × ℝ)), P t → t ⊆ F t ∧ P (F t) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ F t), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) u : ℕ → Finset (α × ℝ) := fun n => F^[n] ∅ u_succ : ∀ (n : ℕ), u (Nat.succ n) = F (u n) Pu : ∀ (n : ℕ), P (u n) ⊢ Directed (fun x x_1 => x ⊆ x_1) fun n => ↑(u n) [PROOFSTEP] apply (monotone_nat_of_le_succ fun n => ?_).directed_le [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst F : Finset (α × ℝ) → Finset (α × ℝ) hF : ∀ (t : Finset (α × ℝ)), P t → t ⊆ F t ∧ P (F t) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ F t), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) u : ℕ → Finset (α × ℝ) := fun n => F^[n] ∅ u_succ : ∀ (n : ℕ), u (Nat.succ n) = F (u n) Pu : ∀ (n : ℕ), P (u n) n : ℕ ⊢ ↑(u n) ≤ ↑(u (n + 1)) [PROOFSTEP] rw [← Nat.succ_eq_add_one, u_succ] [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : IsFiniteMeasure μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) N : ℕ τ : ℝ hτ : 1 < τ hN : IsEmpty (SatelliteConfig α N τ) P : Finset (α × ℝ) → Prop := fun t => (PairwiseDisjoint ↑t fun p => closedBall p.fst p.snd) ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst F : Finset (α × ℝ) → Finset (α × ℝ) hF : ∀ (t : Finset (α × ℝ)), P t → t ⊆ F t ∧ P (F t) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ F t), closedBall p.fst p.snd) ≤ ↑N / (↑N + 1) * ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) u : ℕ → Finset (α × ℝ) := fun n => F^[n] ∅ u_succ : ∀ (n : ℕ), u (Nat.succ n) = F (u n) Pu : ∀ (n : ℕ), P (u n) n : ℕ ⊢ ↑(u n) ≤ ↑(F (u n)) [PROOFSTEP] exact (hF (u n) (Pu n)).1 [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) ⊢ ∃ t, Set.Countable t ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ (∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) = 0 ∧ PairwiseDisjoint t fun p => closedBall p.fst p.snd [PROOFSTEP] rcases exists_absolutelyContinuous_isFiniteMeasure μ with ⟨ν, hν, hμν⟩ [GOAL] case intro.intro α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) ν : Measure α hν : IsFiniteMeasure ν hμν : μ ≪ ν ⊢ ∃ t, Set.Countable t ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ (∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) = 0 ∧ PairwiseDisjoint t fun p => closedBall p.fst p.snd [PROOFSTEP] rcases exists_disjoint_closedBall_covering_ae_of_finiteMeasure_aux ν f s hf with ⟨t, t_count, ts, tr, tν, tdisj⟩ [GOAL] case intro.intro.intro.intro.intro.intro.intro α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) ν : Measure α hν : IsFiniteMeasure ν hμν : μ ≪ ν t : Set (α × ℝ) t_count : Set.Countable t ts : ∀ (p : α × ℝ), p ∈ t → p.fst ∈ s tr : ∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst tν : ↑↑ν (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) = 0 tdisj : PairwiseDisjoint t fun p => closedBall p.fst p.snd ⊢ ∃ t, Set.Countable t ∧ (∀ (p : α × ℝ), p ∈ t → p.fst ∈ s) ∧ (∀ (p : α × ℝ), p ∈ t → p.snd ∈ f p.fst) ∧ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ t), closedBall p.fst p.snd) = 0 ∧ PairwiseDisjoint t fun p => closedBall p.fst p.snd [PROOFSTEP] exact ⟨t, t_count, ts, tr, hμν tν, tdisj⟩ [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) R : α → ℝ hR : ∀ (x : α), x ∈ s → 0 < R x ⊢ ∃ t r, Set.Countable t ∧ t ⊆ s ∧ (∀ (x : α), x ∈ t → r x ∈ f x ∩ Ioo 0 (R x)) ∧ ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x)) = 0 ∧ PairwiseDisjoint t fun x => closedBall x (r x) [PROOFSTEP] let g x := f x ∩ Ioo 0 (R x) [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) R : α → ℝ hR : ∀ (x : α), x ∈ s → 0 < R x g : α → Set ℝ := fun x => f x ∩ Ioo 0 (R x) ⊢ ∃ t r, Set.Countable t ∧ t ⊆ s ∧ (∀ (x : α), x ∈ t → r x ∈ f x ∩ Ioo 0 (R x)) ∧ ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x)) = 0 ∧ PairwiseDisjoint t fun x => closedBall x (r x) [PROOFSTEP] have hg : ∀ x ∈ s, ∀ δ > 0, (g x ∩ Ioo 0 δ).Nonempty := by intro x hx δ δpos rcases hf x hx (min δ (R x)) (lt_min δpos (hR x hx)) with ⟨r, hr⟩ exact ⟨r, ⟨⟨hr.1, hr.2.1, hr.2.2.trans_le (min_le_right _ _)⟩, ⟨hr.2.1, hr.2.2.trans_le (min_le_left _ _)⟩⟩⟩ [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) R : α → ℝ hR : ∀ (x : α), x ∈ s → 0 < R x g : α → Set ℝ := fun x => f x ∩ Ioo 0 (R x) ⊢ ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) [PROOFSTEP] intro x hx δ δpos [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) R : α → ℝ hR : ∀ (x : α), x ∈ s → 0 < R x g : α → Set ℝ := fun x => f x ∩ Ioo 0 (R x) x : α hx : x ∈ s δ : ℝ δpos : δ > 0 ⊢ Set.Nonempty (g x ∩ Ioo 0 δ) [PROOFSTEP] rcases hf x hx (min δ (R x)) (lt_min δpos (hR x hx)) with ⟨r, hr⟩ [GOAL] case intro α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) R : α → ℝ hR : ∀ (x : α), x ∈ s → 0 < R x g : α → Set ℝ := fun x => f x ∩ Ioo 0 (R x) x : α hx : x ∈ s δ : ℝ δpos : δ > 0 r : ℝ hr : r ∈ f x ∩ Ioo 0 (min δ (R x)) ⊢ Set.Nonempty (g x ∩ Ioo 0 δ) [PROOFSTEP] exact ⟨r, ⟨⟨hr.1, hr.2.1, hr.2.2.trans_le (min_le_right _ _)⟩, ⟨hr.2.1, hr.2.2.trans_le (min_le_left _ _)⟩⟩⟩ [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) R : α → ℝ hR : ∀ (x : α), x ∈ s → 0 < R x g : α → Set ℝ := fun x => f x ∩ Ioo 0 (R x) hg : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) ⊢ ∃ t r, Set.Countable t ∧ t ⊆ s ∧ (∀ (x : α), x ∈ t → r x ∈ f x ∩ Ioo 0 (R x)) ∧ ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x)) = 0 ∧ PairwiseDisjoint t fun x => closedBall x (r x) [PROOFSTEP] rcases exists_disjoint_closedBall_covering_ae_aux μ g s hg with ⟨v, v_count, vs, vg, μv, v_disj⟩ [GOAL] case intro.intro.intro.intro.intro α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) R : α → ℝ hR : ∀ (x : α), x ∈ s → 0 < R x g : α → Set ℝ := fun x => f x ∩ Ioo 0 (R x) hg : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) v : Set (α × ℝ) v_count : Set.Countable v vs : ∀ (p : α × ℝ), p ∈ v → p.fst ∈ s vg : ∀ (p : α × ℝ), p ∈ v → p.snd ∈ g p.fst μv : ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ v), closedBall p.fst p.snd) = 0 v_disj : PairwiseDisjoint v fun p => closedBall p.fst p.snd ⊢ ∃ t r, Set.Countable t ∧ t ⊆ s ∧ (∀ (x : α), x ∈ t → r x ∈ f x ∩ Ioo 0 (R x)) ∧ ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x)) = 0 ∧ PairwiseDisjoint t fun x => closedBall x (r x) [PROOFSTEP] let t := Prod.fst '' v [GOAL] case intro.intro.intro.intro.intro α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) R : α → ℝ hR : ∀ (x : α), x ∈ s → 0 < R x g : α → Set ℝ := fun x => f x ∩ Ioo 0 (R x) hg : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) v : Set (α × ℝ) v_count : Set.Countable v vs : ∀ (p : α × ℝ), p ∈ v → p.fst ∈ s vg : ∀ (p : α × ℝ), p ∈ v → p.snd ∈ g p.fst μv : ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ v), closedBall p.fst p.snd) = 0 v_disj : PairwiseDisjoint v fun p => closedBall p.fst p.snd t : Set α := Prod.fst '' v ⊢ ∃ t r, Set.Countable t ∧ t ⊆ s ∧ (∀ (x : α), x ∈ t → r x ∈ f x ∩ Ioo 0 (R x)) ∧ ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x)) = 0 ∧ PairwiseDisjoint t fun x => closedBall x (r x) [PROOFSTEP] have : ∀ x ∈ t, ∃ r : ℝ, (x, r) ∈ v := by intro x hx rcases(mem_image _ _ _).1 hx with ⟨⟨p, q⟩, hp, rfl⟩ exact ⟨q, hp⟩ [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) R : α → ℝ hR : ∀ (x : α), x ∈ s → 0 < R x g : α → Set ℝ := fun x => f x ∩ Ioo 0 (R x) hg : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) v : Set (α × ℝ) v_count : Set.Countable v vs : ∀ (p : α × ℝ), p ∈ v → p.fst ∈ s vg : ∀ (p : α × ℝ), p ∈ v → p.snd ∈ g p.fst μv : ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ v), closedBall p.fst p.snd) = 0 v_disj : PairwiseDisjoint v fun p => closedBall p.fst p.snd t : Set α := Prod.fst '' v ⊢ ∀ (x : α), x ∈ t → ∃ r, (x, r) ∈ v [PROOFSTEP] intro x hx [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) R : α → ℝ hR : ∀ (x : α), x ∈ s → 0 < R x g : α → Set ℝ := fun x => f x ∩ Ioo 0 (R x) hg : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) v : Set (α × ℝ) v_count : Set.Countable v vs : ∀ (p : α × ℝ), p ∈ v → p.fst ∈ s vg : ∀ (p : α × ℝ), p ∈ v → p.snd ∈ g p.fst μv : ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ v), closedBall p.fst p.snd) = 0 v_disj : PairwiseDisjoint v fun p => closedBall p.fst p.snd t : Set α := Prod.fst '' v x : α hx : x ∈ t ⊢ ∃ r, (x, r) ∈ v [PROOFSTEP] rcases(mem_image _ _ _).1 hx with ⟨⟨p, q⟩, hp, rfl⟩ [GOAL] case intro.mk.intro α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) R : α → ℝ hR : ∀ (x : α), x ∈ s → 0 < R x g : α → Set ℝ := fun x => f x ∩ Ioo 0 (R x) hg : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) v : Set (α × ℝ) v_count : Set.Countable v vs : ∀ (p : α × ℝ), p ∈ v → p.fst ∈ s vg : ∀ (p : α × ℝ), p ∈ v → p.snd ∈ g p.fst μv : ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ v), closedBall p.fst p.snd) = 0 v_disj : PairwiseDisjoint v fun p => closedBall p.fst p.snd t : Set α := Prod.fst '' v p : α q : ℝ hp : (p, q) ∈ v hx : (p, q).fst ∈ t ⊢ ∃ r, ((p, q).fst, r) ∈ v [PROOFSTEP] exact ⟨q, hp⟩ [GOAL] case intro.intro.intro.intro.intro α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) R : α → ℝ hR : ∀ (x : α), x ∈ s → 0 < R x g : α → Set ℝ := fun x => f x ∩ Ioo 0 (R x) hg : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) v : Set (α × ℝ) v_count : Set.Countable v vs : ∀ (p : α × ℝ), p ∈ v → p.fst ∈ s vg : ∀ (p : α × ℝ), p ∈ v → p.snd ∈ g p.fst μv : ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ v), closedBall p.fst p.snd) = 0 v_disj : PairwiseDisjoint v fun p => closedBall p.fst p.snd t : Set α := Prod.fst '' v this : ∀ (x : α), x ∈ t → ∃ r, (x, r) ∈ v ⊢ ∃ t r, Set.Countable t ∧ t ⊆ s ∧ (∀ (x : α), x ∈ t → r x ∈ f x ∩ Ioo 0 (R x)) ∧ ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x)) = 0 ∧ PairwiseDisjoint t fun x => closedBall x (r x) [PROOFSTEP] choose! r hr using this [GOAL] case intro.intro.intro.intro.intro α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) R : α → ℝ hR : ∀ (x : α), x ∈ s → 0 < R x g : α → Set ℝ := fun x => f x ∩ Ioo 0 (R x) hg : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) v : Set (α × ℝ) v_count : Set.Countable v vs : ∀ (p : α × ℝ), p ∈ v → p.fst ∈ s vg : ∀ (p : α × ℝ), p ∈ v → p.snd ∈ g p.fst μv : ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ v), closedBall p.fst p.snd) = 0 v_disj : PairwiseDisjoint v fun p => closedBall p.fst p.snd t : Set α := Prod.fst '' v r : α → ℝ hr : ∀ (x : α), x ∈ t → (x, r x) ∈ v ⊢ ∃ t r, Set.Countable t ∧ t ⊆ s ∧ (∀ (x : α), x ∈ t → r x ∈ f x ∩ Ioo 0 (R x)) ∧ ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x)) = 0 ∧ PairwiseDisjoint t fun x => closedBall x (r x) [PROOFSTEP] have im_t : (fun x => (x, r x)) '' t = v := by have I : ∀ p : α × ℝ, p ∈ v → 0 ≤ p.2 := fun p hp => (vg p hp).2.1.le apply Subset.antisymm · simp only [image_subset_iff] rintro ⟨x, p⟩ hxp simp only [mem_preimage] exact hr _ (mem_image_of_mem _ hxp) · rintro ⟨x, p⟩ hxp have hxrx : (x, r x) ∈ v := hr _ (mem_image_of_mem _ hxp) have : p = r x := by by_contra h have A : (x, p) ≠ (x, r x) := by simpa only [true_and_iff, Prod.mk.inj_iff, eq_self_iff_true, Ne.def] using h have H := v_disj hxp hxrx A contrapose H rw [not_disjoint_iff_nonempty_inter] refine' ⟨x, by simp (config := { proj := false }) [I _ hxp, I _ hxrx]⟩ rw [this] apply mem_image_of_mem exact mem_image_of_mem _ hxp [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) R : α → ℝ hR : ∀ (x : α), x ∈ s → 0 < R x g : α → Set ℝ := fun x => f x ∩ Ioo 0 (R x) hg : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) v : Set (α × ℝ) v_count : Set.Countable v vs : ∀ (p : α × ℝ), p ∈ v → p.fst ∈ s vg : ∀ (p : α × ℝ), p ∈ v → p.snd ∈ g p.fst μv : ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ v), closedBall p.fst p.snd) = 0 v_disj : PairwiseDisjoint v fun p => closedBall p.fst p.snd t : Set α := Prod.fst '' v r : α → ℝ hr : ∀ (x : α), x ∈ t → (x, r x) ∈ v ⊢ (fun x => (x, r x)) '' t = v [PROOFSTEP] have I : ∀ p : α × ℝ, p ∈ v → 0 ≤ p.2 := fun p hp => (vg p hp).2.1.le [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) R : α → ℝ hR : ∀ (x : α), x ∈ s → 0 < R x g : α → Set ℝ := fun x => f x ∩ Ioo 0 (R x) hg : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) v : Set (α × ℝ) v_count : Set.Countable v vs : ∀ (p : α × ℝ), p ∈ v → p.fst ∈ s vg : ∀ (p : α × ℝ), p ∈ v → p.snd ∈ g p.fst μv : ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ v), closedBall p.fst p.snd) = 0 v_disj : PairwiseDisjoint v fun p => closedBall p.fst p.snd t : Set α := Prod.fst '' v r : α → ℝ hr : ∀ (x : α), x ∈ t → (x, r x) ∈ v I : ∀ (p : α × ℝ), p ∈ v → 0 ≤ p.snd ⊢ (fun x => (x, r x)) '' t = v [PROOFSTEP] apply Subset.antisymm [GOAL] case h₁ α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) R : α → ℝ hR : ∀ (x : α), x ∈ s → 0 < R x g : α → Set ℝ := fun x => f x ∩ Ioo 0 (R x) hg : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) v : Set (α × ℝ) v_count : Set.Countable v vs : ∀ (p : α × ℝ), p ∈ v → p.fst ∈ s vg : ∀ (p : α × ℝ), p ∈ v → p.snd ∈ g p.fst μv : ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ v), closedBall p.fst p.snd) = 0 v_disj : PairwiseDisjoint v fun p => closedBall p.fst p.snd t : Set α := Prod.fst '' v r : α → ℝ hr : ∀ (x : α), x ∈ t → (x, r x) ∈ v I : ∀ (p : α × ℝ), p ∈ v → 0 ≤ p.snd ⊢ (fun x => (x, r x)) '' t ⊆ v [PROOFSTEP] simp only [image_subset_iff] [GOAL] case h₁ α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) R : α → ℝ hR : ∀ (x : α), x ∈ s → 0 < R x g : α → Set ℝ := fun x => f x ∩ Ioo 0 (R x) hg : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) v : Set (α × ℝ) v_count : Set.Countable v vs : ∀ (p : α × ℝ), p ∈ v → p.fst ∈ s vg : ∀ (p : α × ℝ), p ∈ v → p.snd ∈ g p.fst μv : ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ v), closedBall p.fst p.snd) = 0 v_disj : PairwiseDisjoint v fun p => closedBall p.fst p.snd t : Set α := Prod.fst '' v r : α → ℝ hr : ∀ (x : α), x ∈ t → (x, r x) ∈ v I : ∀ (p : α × ℝ), p ∈ v → 0 ≤ p.snd ⊢ v ⊆ Prod.fst ⁻¹' ((fun x => (x, r x)) ⁻¹' v) [PROOFSTEP] rintro ⟨x, p⟩ hxp [GOAL] case h₁.mk α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) R : α → ℝ hR : ∀ (x : α), x ∈ s → 0 < R x g : α → Set ℝ := fun x => f x ∩ Ioo 0 (R x) hg : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) v : Set (α × ℝ) v_count : Set.Countable v vs : ∀ (p : α × ℝ), p ∈ v → p.fst ∈ s vg : ∀ (p : α × ℝ), p ∈ v → p.snd ∈ g p.fst μv : ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ v), closedBall p.fst p.snd) = 0 v_disj : PairwiseDisjoint v fun p => closedBall p.fst p.snd t : Set α := Prod.fst '' v r : α → ℝ hr : ∀ (x : α), x ∈ t → (x, r x) ∈ v I : ∀ (p : α × ℝ), p ∈ v → 0 ≤ p.snd x : α p : ℝ hxp : (x, p) ∈ v ⊢ (x, p) ∈ Prod.fst ⁻¹' ((fun x => (x, r x)) ⁻¹' v) [PROOFSTEP] simp only [mem_preimage] [GOAL] case h₁.mk α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) R : α → ℝ hR : ∀ (x : α), x ∈ s → 0 < R x g : α → Set ℝ := fun x => f x ∩ Ioo 0 (R x) hg : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) v : Set (α × ℝ) v_count : Set.Countable v vs : ∀ (p : α × ℝ), p ∈ v → p.fst ∈ s vg : ∀ (p : α × ℝ), p ∈ v → p.snd ∈ g p.fst μv : ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ v), closedBall p.fst p.snd) = 0 v_disj : PairwiseDisjoint v fun p => closedBall p.fst p.snd t : Set α := Prod.fst '' v r : α → ℝ hr : ∀ (x : α), x ∈ t → (x, r x) ∈ v I : ∀ (p : α × ℝ), p ∈ v → 0 ≤ p.snd x : α p : ℝ hxp : (x, p) ∈ v ⊢ (x, r x) ∈ v [PROOFSTEP] exact hr _ (mem_image_of_mem _ hxp) [GOAL] case h₂ α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) R : α → ℝ hR : ∀ (x : α), x ∈ s → 0 < R x g : α → Set ℝ := fun x => f x ∩ Ioo 0 (R x) hg : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) v : Set (α × ℝ) v_count : Set.Countable v vs : ∀ (p : α × ℝ), p ∈ v → p.fst ∈ s vg : ∀ (p : α × ℝ), p ∈ v → p.snd ∈ g p.fst μv : ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ v), closedBall p.fst p.snd) = 0 v_disj : PairwiseDisjoint v fun p => closedBall p.fst p.snd t : Set α := Prod.fst '' v r : α → ℝ hr : ∀ (x : α), x ∈ t → (x, r x) ∈ v I : ∀ (p : α × ℝ), p ∈ v → 0 ≤ p.snd ⊢ v ⊆ (fun x => (x, r x)) '' t [PROOFSTEP] rintro ⟨x, p⟩ hxp [GOAL] case h₂.mk α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) R : α → ℝ hR : ∀ (x : α), x ∈ s → 0 < R x g : α → Set ℝ := fun x => f x ∩ Ioo 0 (R x) hg : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) v : Set (α × ℝ) v_count : Set.Countable v vs : ∀ (p : α × ℝ), p ∈ v → p.fst ∈ s vg : ∀ (p : α × ℝ), p ∈ v → p.snd ∈ g p.fst μv : ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ v), closedBall p.fst p.snd) = 0 v_disj : PairwiseDisjoint v fun p => closedBall p.fst p.snd t : Set α := Prod.fst '' v r : α → ℝ hr : ∀ (x : α), x ∈ t → (x, r x) ∈ v I : ∀ (p : α × ℝ), p ∈ v → 0 ≤ p.snd x : α p : ℝ hxp : (x, p) ∈ v ⊢ (x, p) ∈ (fun x => (x, r x)) '' t [PROOFSTEP] have hxrx : (x, r x) ∈ v := hr _ (mem_image_of_mem _ hxp) [GOAL] case h₂.mk α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) R : α → ℝ hR : ∀ (x : α), x ∈ s → 0 < R x g : α → Set ℝ := fun x => f x ∩ Ioo 0 (R x) hg : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) v : Set (α × ℝ) v_count : Set.Countable v vs : ∀ (p : α × ℝ), p ∈ v → p.fst ∈ s vg : ∀ (p : α × ℝ), p ∈ v → p.snd ∈ g p.fst μv : ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ v), closedBall p.fst p.snd) = 0 v_disj : PairwiseDisjoint v fun p => closedBall p.fst p.snd t : Set α := Prod.fst '' v r : α → ℝ hr : ∀ (x : α), x ∈ t → (x, r x) ∈ v I : ∀ (p : α × ℝ), p ∈ v → 0 ≤ p.snd x : α p : ℝ hxp : (x, p) ∈ v hxrx : (x, r x) ∈ v ⊢ (x, p) ∈ (fun x => (x, r x)) '' t [PROOFSTEP] have : p = r x := by by_contra h have A : (x, p) ≠ (x, r x) := by simpa only [true_and_iff, Prod.mk.inj_iff, eq_self_iff_true, Ne.def] using h have H := v_disj hxp hxrx A contrapose H rw [not_disjoint_iff_nonempty_inter] refine' ⟨x, by simp (config := { proj := false }) [I _ hxp, I _ hxrx]⟩ [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) R : α → ℝ hR : ∀ (x : α), x ∈ s → 0 < R x g : α → Set ℝ := fun x => f x ∩ Ioo 0 (R x) hg : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) v : Set (α × ℝ) v_count : Set.Countable v vs : ∀ (p : α × ℝ), p ∈ v → p.fst ∈ s vg : ∀ (p : α × ℝ), p ∈ v → p.snd ∈ g p.fst μv : ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ v), closedBall p.fst p.snd) = 0 v_disj : PairwiseDisjoint v fun p => closedBall p.fst p.snd t : Set α := Prod.fst '' v r : α → ℝ hr : ∀ (x : α), x ∈ t → (x, r x) ∈ v I : ∀ (p : α × ℝ), p ∈ v → 0 ≤ p.snd x : α p : ℝ hxp : (x, p) ∈ v hxrx : (x, r x) ∈ v ⊢ p = r x [PROOFSTEP] by_contra h [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) R : α → ℝ hR : ∀ (x : α), x ∈ s → 0 < R x g : α → Set ℝ := fun x => f x ∩ Ioo 0 (R x) hg : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) v : Set (α × ℝ) v_count : Set.Countable v vs : ∀ (p : α × ℝ), p ∈ v → p.fst ∈ s vg : ∀ (p : α × ℝ), p ∈ v → p.snd ∈ g p.fst μv : ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ v), closedBall p.fst p.snd) = 0 v_disj : PairwiseDisjoint v fun p => closedBall p.fst p.snd t : Set α := Prod.fst '' v r : α → ℝ hr : ∀ (x : α), x ∈ t → (x, r x) ∈ v I : ∀ (p : α × ℝ), p ∈ v → 0 ≤ p.snd x : α p : ℝ hxp : (x, p) ∈ v hxrx : (x, r x) ∈ v h : ¬p = r x ⊢ False [PROOFSTEP] have A : (x, p) ≠ (x, r x) := by simpa only [true_and_iff, Prod.mk.inj_iff, eq_self_iff_true, Ne.def] using h [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) R : α → ℝ hR : ∀ (x : α), x ∈ s → 0 < R x g : α → Set ℝ := fun x => f x ∩ Ioo 0 (R x) hg : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) v : Set (α × ℝ) v_count : Set.Countable v vs : ∀ (p : α × ℝ), p ∈ v → p.fst ∈ s vg : ∀ (p : α × ℝ), p ∈ v → p.snd ∈ g p.fst μv : ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ v), closedBall p.fst p.snd) = 0 v_disj : PairwiseDisjoint v fun p => closedBall p.fst p.snd t : Set α := Prod.fst '' v r : α → ℝ hr : ∀ (x : α), x ∈ t → (x, r x) ∈ v I : ∀ (p : α × ℝ), p ∈ v → 0 ≤ p.snd x : α p : ℝ hxp : (x, p) ∈ v hxrx : (x, r x) ∈ v h : ¬p = r x ⊢ (x, p) ≠ (x, r x) [PROOFSTEP] simpa only [true_and_iff, Prod.mk.inj_iff, eq_self_iff_true, Ne.def] using h [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) R : α → ℝ hR : ∀ (x : α), x ∈ s → 0 < R x g : α → Set ℝ := fun x => f x ∩ Ioo 0 (R x) hg : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) v : Set (α × ℝ) v_count : Set.Countable v vs : ∀ (p : α × ℝ), p ∈ v → p.fst ∈ s vg : ∀ (p : α × ℝ), p ∈ v → p.snd ∈ g p.fst μv : ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ v), closedBall p.fst p.snd) = 0 v_disj : PairwiseDisjoint v fun p => closedBall p.fst p.snd t : Set α := Prod.fst '' v r : α → ℝ hr : ∀ (x : α), x ∈ t → (x, r x) ∈ v I : ∀ (p : α × ℝ), p ∈ v → 0 ≤ p.snd x : α p : ℝ hxp : (x, p) ∈ v hxrx : (x, r x) ∈ v h : ¬p = r x A : (x, p) ≠ (x, r x) ⊢ False [PROOFSTEP] have H := v_disj hxp hxrx A [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) R : α → ℝ hR : ∀ (x : α), x ∈ s → 0 < R x g : α → Set ℝ := fun x => f x ∩ Ioo 0 (R x) hg : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) v : Set (α × ℝ) v_count : Set.Countable v vs : ∀ (p : α × ℝ), p ∈ v → p.fst ∈ s vg : ∀ (p : α × ℝ), p ∈ v → p.snd ∈ g p.fst μv : ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ v), closedBall p.fst p.snd) = 0 v_disj : PairwiseDisjoint v fun p => closedBall p.fst p.snd t : Set α := Prod.fst '' v r : α → ℝ hr : ∀ (x : α), x ∈ t → (x, r x) ∈ v I : ∀ (p : α × ℝ), p ∈ v → 0 ≤ p.snd x : α p : ℝ hxp : (x, p) ∈ v hxrx : (x, r x) ∈ v h : ¬p = r x A : (x, p) ≠ (x, r x) H : (Disjoint on fun p => closedBall p.fst p.snd) (x, p) (x, r x) ⊢ False [PROOFSTEP] contrapose H [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) R : α → ℝ hR : ∀ (x : α), x ∈ s → 0 < R x g : α → Set ℝ := fun x => f x ∩ Ioo 0 (R x) hg : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) v : Set (α × ℝ) v_count : Set.Countable v vs : ∀ (p : α × ℝ), p ∈ v → p.fst ∈ s vg : ∀ (p : α × ℝ), p ∈ v → p.snd ∈ g p.fst μv : ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ v), closedBall p.fst p.snd) = 0 v_disj : PairwiseDisjoint v fun p => closedBall p.fst p.snd t : Set α := Prod.fst '' v r : α → ℝ hr : ∀ (x : α), x ∈ t → (x, r x) ∈ v I : ∀ (p : α × ℝ), p ∈ v → 0 ≤ p.snd x : α p : ℝ hxp : (x, p) ∈ v hxrx : (x, r x) ∈ v h : ¬p = r x A : (x, p) ≠ (x, r x) H : ¬False ⊢ ¬(Disjoint on fun p => closedBall p.fst p.snd) (x, p) (x, r x) [PROOFSTEP] rw [not_disjoint_iff_nonempty_inter] [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) R : α → ℝ hR : ∀ (x : α), x ∈ s → 0 < R x g : α → Set ℝ := fun x => f x ∩ Ioo 0 (R x) hg : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) v : Set (α × ℝ) v_count : Set.Countable v vs : ∀ (p : α × ℝ), p ∈ v → p.fst ∈ s vg : ∀ (p : α × ℝ), p ∈ v → p.snd ∈ g p.fst μv : ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ v), closedBall p.fst p.snd) = 0 v_disj : PairwiseDisjoint v fun p => closedBall p.fst p.snd t : Set α := Prod.fst '' v r : α → ℝ hr : ∀ (x : α), x ∈ t → (x, r x) ∈ v I : ∀ (p : α × ℝ), p ∈ v → 0 ≤ p.snd x : α p : ℝ hxp : (x, p) ∈ v hxrx : (x, r x) ∈ v h : ¬p = r x A : (x, p) ≠ (x, r x) H : ¬False ⊢ Set.Nonempty ((fun p => closedBall p.fst p.snd) (x, p) ∩ (fun p => closedBall p.fst p.snd) (x, r x)) [PROOFSTEP] refine' ⟨x, by simp (config := { proj := false }) [I _ hxp, I _ hxrx]⟩ [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) R : α → ℝ hR : ∀ (x : α), x ∈ s → 0 < R x g : α → Set ℝ := fun x => f x ∩ Ioo 0 (R x) hg : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) v : Set (α × ℝ) v_count : Set.Countable v vs : ∀ (p : α × ℝ), p ∈ v → p.fst ∈ s vg : ∀ (p : α × ℝ), p ∈ v → p.snd ∈ g p.fst μv : ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ v), closedBall p.fst p.snd) = 0 v_disj : PairwiseDisjoint v fun p => closedBall p.fst p.snd t : Set α := Prod.fst '' v r : α → ℝ hr : ∀ (x : α), x ∈ t → (x, r x) ∈ v I : ∀ (p : α × ℝ), p ∈ v → 0 ≤ p.snd x : α p : ℝ hxp : (x, p) ∈ v hxrx : (x, r x) ∈ v h : ¬p = r x A : (x, p) ≠ (x, r x) H : ¬False ⊢ x ∈ (fun p => closedBall p.fst p.snd) (x, p) ∩ (fun p => closedBall p.fst p.snd) (x, r x) [PROOFSTEP] simp (config := { proj := false }) [I _ hxp, I _ hxrx] [GOAL] case h₂.mk α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) R : α → ℝ hR : ∀ (x : α), x ∈ s → 0 < R x g : α → Set ℝ := fun x => f x ∩ Ioo 0 (R x) hg : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) v : Set (α × ℝ) v_count : Set.Countable v vs : ∀ (p : α × ℝ), p ∈ v → p.fst ∈ s vg : ∀ (p : α × ℝ), p ∈ v → p.snd ∈ g p.fst μv : ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ v), closedBall p.fst p.snd) = 0 v_disj : PairwiseDisjoint v fun p => closedBall p.fst p.snd t : Set α := Prod.fst '' v r : α → ℝ hr : ∀ (x : α), x ∈ t → (x, r x) ∈ v I : ∀ (p : α × ℝ), p ∈ v → 0 ≤ p.snd x : α p : ℝ hxp : (x, p) ∈ v hxrx : (x, r x) ∈ v this : p = r x ⊢ (x, p) ∈ (fun x => (x, r x)) '' t [PROOFSTEP] rw [this] [GOAL] case h₂.mk α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) R : α → ℝ hR : ∀ (x : α), x ∈ s → 0 < R x g : α → Set ℝ := fun x => f x ∩ Ioo 0 (R x) hg : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) v : Set (α × ℝ) v_count : Set.Countable v vs : ∀ (p : α × ℝ), p ∈ v → p.fst ∈ s vg : ∀ (p : α × ℝ), p ∈ v → p.snd ∈ g p.fst μv : ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ v), closedBall p.fst p.snd) = 0 v_disj : PairwiseDisjoint v fun p => closedBall p.fst p.snd t : Set α := Prod.fst '' v r : α → ℝ hr : ∀ (x : α), x ∈ t → (x, r x) ∈ v I : ∀ (p : α × ℝ), p ∈ v → 0 ≤ p.snd x : α p : ℝ hxp : (x, p) ∈ v hxrx : (x, r x) ∈ v this : p = r x ⊢ (x, r x) ∈ (fun x => (x, r x)) '' t [PROOFSTEP] apply mem_image_of_mem [GOAL] case h₂.mk.h α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) R : α → ℝ hR : ∀ (x : α), x ∈ s → 0 < R x g : α → Set ℝ := fun x => f x ∩ Ioo 0 (R x) hg : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) v : Set (α × ℝ) v_count : Set.Countable v vs : ∀ (p : α × ℝ), p ∈ v → p.fst ∈ s vg : ∀ (p : α × ℝ), p ∈ v → p.snd ∈ g p.fst μv : ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ v), closedBall p.fst p.snd) = 0 v_disj : PairwiseDisjoint v fun p => closedBall p.fst p.snd t : Set α := Prod.fst '' v r : α → ℝ hr : ∀ (x : α), x ∈ t → (x, r x) ∈ v I : ∀ (p : α × ℝ), p ∈ v → 0 ≤ p.snd x : α p : ℝ hxp : (x, p) ∈ v hxrx : (x, r x) ∈ v this : p = r x ⊢ x ∈ t [PROOFSTEP] exact mem_image_of_mem _ hxp [GOAL] case intro.intro.intro.intro.intro α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) R : α → ℝ hR : ∀ (x : α), x ∈ s → 0 < R x g : α → Set ℝ := fun x => f x ∩ Ioo 0 (R x) hg : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) v : Set (α × ℝ) v_count : Set.Countable v vs : ∀ (p : α × ℝ), p ∈ v → p.fst ∈ s vg : ∀ (p : α × ℝ), p ∈ v → p.snd ∈ g p.fst μv : ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ v), closedBall p.fst p.snd) = 0 v_disj : PairwiseDisjoint v fun p => closedBall p.fst p.snd t : Set α := Prod.fst '' v r : α → ℝ hr : ∀ (x : α), x ∈ t → (x, r x) ∈ v im_t : (fun x => (x, r x)) '' t = v ⊢ ∃ t r, Set.Countable t ∧ t ⊆ s ∧ (∀ (x : α), x ∈ t → r x ∈ f x ∩ Ioo 0 (R x)) ∧ ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x)) = 0 ∧ PairwiseDisjoint t fun x => closedBall x (r x) [PROOFSTEP] refine' ⟨t, r, v_count.image _, _, _, _, _⟩ [GOAL] case intro.intro.intro.intro.intro.refine'_1 α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) R : α → ℝ hR : ∀ (x : α), x ∈ s → 0 < R x g : α → Set ℝ := fun x => f x ∩ Ioo 0 (R x) hg : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) v : Set (α × ℝ) v_count : Set.Countable v vs : ∀ (p : α × ℝ), p ∈ v → p.fst ∈ s vg : ∀ (p : α × ℝ), p ∈ v → p.snd ∈ g p.fst μv : ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ v), closedBall p.fst p.snd) = 0 v_disj : PairwiseDisjoint v fun p => closedBall p.fst p.snd t : Set α := Prod.fst '' v r : α → ℝ hr : ∀ (x : α), x ∈ t → (x, r x) ∈ v im_t : (fun x => (x, r x)) '' t = v ⊢ t ⊆ s [PROOFSTEP] intro x hx [GOAL] case intro.intro.intro.intro.intro.refine'_1 α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) R : α → ℝ hR : ∀ (x : α), x ∈ s → 0 < R x g : α → Set ℝ := fun x => f x ∩ Ioo 0 (R x) hg : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) v : Set (α × ℝ) v_count : Set.Countable v vs : ∀ (p : α × ℝ), p ∈ v → p.fst ∈ s vg : ∀ (p : α × ℝ), p ∈ v → p.snd ∈ g p.fst μv : ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ v), closedBall p.fst p.snd) = 0 v_disj : PairwiseDisjoint v fun p => closedBall p.fst p.snd t : Set α := Prod.fst '' v r : α → ℝ hr : ∀ (x : α), x ∈ t → (x, r x) ∈ v im_t : (fun x => (x, r x)) '' t = v x : α hx : x ∈ t ⊢ x ∈ s [PROOFSTEP] rcases(mem_image _ _ _).1 hx with ⟨⟨p, q⟩, hp, rfl⟩ [GOAL] case intro.intro.intro.intro.intro.refine'_1.intro.mk.intro α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) R : α → ℝ hR : ∀ (x : α), x ∈ s → 0 < R x g : α → Set ℝ := fun x => f x ∩ Ioo 0 (R x) hg : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) v : Set (α × ℝ) v_count : Set.Countable v vs : ∀ (p : α × ℝ), p ∈ v → p.fst ∈ s vg : ∀ (p : α × ℝ), p ∈ v → p.snd ∈ g p.fst μv : ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ v), closedBall p.fst p.snd) = 0 v_disj : PairwiseDisjoint v fun p => closedBall p.fst p.snd t : Set α := Prod.fst '' v r : α → ℝ hr : ∀ (x : α), x ∈ t → (x, r x) ∈ v im_t : (fun x => (x, r x)) '' t = v p : α q : ℝ hp : (p, q) ∈ v hx : (p, q).fst ∈ t ⊢ (p, q).fst ∈ s [PROOFSTEP] exact vs _ hp [GOAL] case intro.intro.intro.intro.intro.refine'_2 α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) R : α → ℝ hR : ∀ (x : α), x ∈ s → 0 < R x g : α → Set ℝ := fun x => f x ∩ Ioo 0 (R x) hg : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) v : Set (α × ℝ) v_count : Set.Countable v vs : ∀ (p : α × ℝ), p ∈ v → p.fst ∈ s vg : ∀ (p : α × ℝ), p ∈ v → p.snd ∈ g p.fst μv : ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ v), closedBall p.fst p.snd) = 0 v_disj : PairwiseDisjoint v fun p => closedBall p.fst p.snd t : Set α := Prod.fst '' v r : α → ℝ hr : ∀ (x : α), x ∈ t → (x, r x) ∈ v im_t : (fun x => (x, r x)) '' t = v ⊢ ∀ (x : α), x ∈ t → r x ∈ f x ∩ Ioo 0 (R x) [PROOFSTEP] intro x hx [GOAL] case intro.intro.intro.intro.intro.refine'_2 α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) R : α → ℝ hR : ∀ (x : α), x ∈ s → 0 < R x g : α → Set ℝ := fun x => f x ∩ Ioo 0 (R x) hg : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) v : Set (α × ℝ) v_count : Set.Countable v vs : ∀ (p : α × ℝ), p ∈ v → p.fst ∈ s vg : ∀ (p : α × ℝ), p ∈ v → p.snd ∈ g p.fst μv : ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ v), closedBall p.fst p.snd) = 0 v_disj : PairwiseDisjoint v fun p => closedBall p.fst p.snd t : Set α := Prod.fst '' v r : α → ℝ hr : ∀ (x : α), x ∈ t → (x, r x) ∈ v im_t : (fun x => (x, r x)) '' t = v x : α hx : x ∈ t ⊢ r x ∈ f x ∩ Ioo 0 (R x) [PROOFSTEP] rcases(mem_image _ _ _).1 hx with ⟨⟨p, q⟩, _, rfl⟩ [GOAL] case intro.intro.intro.intro.intro.refine'_2.intro.mk.intro α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) R : α → ℝ hR : ∀ (x : α), x ∈ s → 0 < R x g : α → Set ℝ := fun x => f x ∩ Ioo 0 (R x) hg : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) v : Set (α × ℝ) v_count : Set.Countable v vs : ∀ (p : α × ℝ), p ∈ v → p.fst ∈ s vg : ∀ (p : α × ℝ), p ∈ v → p.snd ∈ g p.fst μv : ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ v), closedBall p.fst p.snd) = 0 v_disj : PairwiseDisjoint v fun p => closedBall p.fst p.snd t : Set α := Prod.fst '' v r : α → ℝ hr : ∀ (x : α), x ∈ t → (x, r x) ∈ v im_t : (fun x => (x, r x)) '' t = v p : α q : ℝ left✝ : (p, q) ∈ v hx : (p, q).fst ∈ t ⊢ r (p, q).fst ∈ f (p, q).fst ∩ Ioo 0 (R (p, q).fst) [PROOFSTEP] exact vg _ (hr _ hx) [GOAL] case intro.intro.intro.intro.intro.refine'_3 α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) R : α → ℝ hR : ∀ (x : α), x ∈ s → 0 < R x g : α → Set ℝ := fun x => f x ∩ Ioo 0 (R x) hg : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) v : Set (α × ℝ) v_count : Set.Countable v vs : ∀ (p : α × ℝ), p ∈ v → p.fst ∈ s vg : ∀ (p : α × ℝ), p ∈ v → p.snd ∈ g p.fst μv : ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ v), closedBall p.fst p.snd) = 0 v_disj : PairwiseDisjoint v fun p => closedBall p.fst p.snd t : Set α := Prod.fst '' v r : α → ℝ hr : ∀ (x : α), x ∈ t → (x, r x) ∈ v im_t : (fun x => (x, r x)) '' t = v ⊢ ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x)) = 0 [PROOFSTEP] have : ⋃ (x : α) (_ : x ∈ t), closedBall x (r x) = ⋃ (p : α × ℝ) (_ : p ∈ (fun x => (x, r x)) '' t), closedBall p.1 p.2 := by conv_rhs => rw [biUnion_image] [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) R : α → ℝ hR : ∀ (x : α), x ∈ s → 0 < R x g : α → Set ℝ := fun x => f x ∩ Ioo 0 (R x) hg : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) v : Set (α × ℝ) v_count : Set.Countable v vs : ∀ (p : α × ℝ), p ∈ v → p.fst ∈ s vg : ∀ (p : α × ℝ), p ∈ v → p.snd ∈ g p.fst μv : ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ v), closedBall p.fst p.snd) = 0 v_disj : PairwiseDisjoint v fun p => closedBall p.fst p.snd t : Set α := Prod.fst '' v r : α → ℝ hr : ∀ (x : α), x ∈ t → (x, r x) ∈ v im_t : (fun x => (x, r x)) '' t = v ⊢ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x) = ⋃ (p : α × ℝ) (_ : p ∈ (fun x => (x, r x)) '' t), closedBall p.fst p.snd [PROOFSTEP] conv_rhs => rw [biUnion_image] [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) R : α → ℝ hR : ∀ (x : α), x ∈ s → 0 < R x g : α → Set ℝ := fun x => f x ∩ Ioo 0 (R x) hg : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) v : Set (α × ℝ) v_count : Set.Countable v vs : ∀ (p : α × ℝ), p ∈ v → p.fst ∈ s vg : ∀ (p : α × ℝ), p ∈ v → p.snd ∈ g p.fst μv : ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ v), closedBall p.fst p.snd) = 0 v_disj : PairwiseDisjoint v fun p => closedBall p.fst p.snd t : Set α := Prod.fst '' v r : α → ℝ hr : ∀ (x : α), x ∈ t → (x, r x) ∈ v im_t : (fun x => (x, r x)) '' t = v | ⋃ (p : α × ℝ) (_ : p ∈ (fun x => (x, r x)) '' t), closedBall p.fst p.snd [PROOFSTEP] rw [biUnion_image] [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) R : α → ℝ hR : ∀ (x : α), x ∈ s → 0 < R x g : α → Set ℝ := fun x => f x ∩ Ioo 0 (R x) hg : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) v : Set (α × ℝ) v_count : Set.Countable v vs : ∀ (p : α × ℝ), p ∈ v → p.fst ∈ s vg : ∀ (p : α × ℝ), p ∈ v → p.snd ∈ g p.fst μv : ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ v), closedBall p.fst p.snd) = 0 v_disj : PairwiseDisjoint v fun p => closedBall p.fst p.snd t : Set α := Prod.fst '' v r : α → ℝ hr : ∀ (x : α), x ∈ t → (x, r x) ∈ v im_t : (fun x => (x, r x)) '' t = v | ⋃ (p : α × ℝ) (_ : p ∈ (fun x => (x, r x)) '' t), closedBall p.fst p.snd [PROOFSTEP] rw [biUnion_image] [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) R : α → ℝ hR : ∀ (x : α), x ∈ s → 0 < R x g : α → Set ℝ := fun x => f x ∩ Ioo 0 (R x) hg : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) v : Set (α × ℝ) v_count : Set.Countable v vs : ∀ (p : α × ℝ), p ∈ v → p.fst ∈ s vg : ∀ (p : α × ℝ), p ∈ v → p.snd ∈ g p.fst μv : ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ v), closedBall p.fst p.snd) = 0 v_disj : PairwiseDisjoint v fun p => closedBall p.fst p.snd t : Set α := Prod.fst '' v r : α → ℝ hr : ∀ (x : α), x ∈ t → (x, r x) ∈ v im_t : (fun x => (x, r x)) '' t = v | ⋃ (p : α × ℝ) (_ : p ∈ (fun x => (x, r x)) '' t), closedBall p.fst p.snd [PROOFSTEP] rw [biUnion_image] [GOAL] case intro.intro.intro.intro.intro.refine'_3 α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) R : α → ℝ hR : ∀ (x : α), x ∈ s → 0 < R x g : α → Set ℝ := fun x => f x ∩ Ioo 0 (R x) hg : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) v : Set (α × ℝ) v_count : Set.Countable v vs : ∀ (p : α × ℝ), p ∈ v → p.fst ∈ s vg : ∀ (p : α × ℝ), p ∈ v → p.snd ∈ g p.fst μv : ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ v), closedBall p.fst p.snd) = 0 v_disj : PairwiseDisjoint v fun p => closedBall p.fst p.snd t : Set α := Prod.fst '' v r : α → ℝ hr : ∀ (x : α), x ∈ t → (x, r x) ∈ v im_t : (fun x => (x, r x)) '' t = v this : ⋃ (x : α) (_ : x ∈ t), closedBall x (r x) = ⋃ (p : α × ℝ) (_ : p ∈ (fun x => (x, r x)) '' t), closedBall p.fst p.snd ⊢ ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x)) = 0 [PROOFSTEP] rw [this, im_t] [GOAL] case intro.intro.intro.intro.intro.refine'_3 α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) R : α → ℝ hR : ∀ (x : α), x ∈ s → 0 < R x g : α → Set ℝ := fun x => f x ∩ Ioo 0 (R x) hg : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) v : Set (α × ℝ) v_count : Set.Countable v vs : ∀ (p : α × ℝ), p ∈ v → p.fst ∈ s vg : ∀ (p : α × ℝ), p ∈ v → p.snd ∈ g p.fst μv : ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ v), closedBall p.fst p.snd) = 0 v_disj : PairwiseDisjoint v fun p => closedBall p.fst p.snd t : Set α := Prod.fst '' v r : α → ℝ hr : ∀ (x : α), x ∈ t → (x, r x) ∈ v im_t : (fun x => (x, r x)) '' t = v this : ⋃ (x : α) (_ : x ∈ t), closedBall x (r x) = ⋃ (p : α × ℝ) (_ : p ∈ (fun x => (x, r x)) '' t), closedBall p.fst p.snd ⊢ ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ v), closedBall p.fst p.snd) = 0 [PROOFSTEP] exact μv [GOAL] case intro.intro.intro.intro.intro.refine'_4 α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) R : α → ℝ hR : ∀ (x : α), x ∈ s → 0 < R x g : α → Set ℝ := fun x => f x ∩ Ioo 0 (R x) hg : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) v : Set (α × ℝ) v_count : Set.Countable v vs : ∀ (p : α × ℝ), p ∈ v → p.fst ∈ s vg : ∀ (p : α × ℝ), p ∈ v → p.snd ∈ g p.fst μv : ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ v), closedBall p.fst p.snd) = 0 v_disj : PairwiseDisjoint v fun p => closedBall p.fst p.snd t : Set α := Prod.fst '' v r : α → ℝ hr : ∀ (x : α), x ∈ t → (x, r x) ∈ v im_t : (fun x => (x, r x)) '' t = v ⊢ PairwiseDisjoint t fun x => closedBall x (r x) [PROOFSTEP] have A : InjOn (fun x : α => (x, r x)) t := by simp (config := { contextual := true }) only [InjOn, Prod.mk.inj_iff, imp_true_iff, eq_self_iff_true] [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) R : α → ℝ hR : ∀ (x : α), x ∈ s → 0 < R x g : α → Set ℝ := fun x => f x ∩ Ioo 0 (R x) hg : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) v : Set (α × ℝ) v_count : Set.Countable v vs : ∀ (p : α × ℝ), p ∈ v → p.fst ∈ s vg : ∀ (p : α × ℝ), p ∈ v → p.snd ∈ g p.fst μv : ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ v), closedBall p.fst p.snd) = 0 v_disj : PairwiseDisjoint v fun p => closedBall p.fst p.snd t : Set α := Prod.fst '' v r : α → ℝ hr : ∀ (x : α), x ∈ t → (x, r x) ∈ v im_t : (fun x => (x, r x)) '' t = v ⊢ InjOn (fun x => (x, r x)) t [PROOFSTEP] simp (config := { contextual := true }) only [InjOn, Prod.mk.inj_iff, imp_true_iff, eq_self_iff_true] [GOAL] case intro.intro.intro.intro.intro.refine'_4 α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) R : α → ℝ hR : ∀ (x : α), x ∈ s → 0 < R x g : α → Set ℝ := fun x => f x ∩ Ioo 0 (R x) hg : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) v : Set (α × ℝ) v_count : Set.Countable v vs : ∀ (p : α × ℝ), p ∈ v → p.fst ∈ s vg : ∀ (p : α × ℝ), p ∈ v → p.snd ∈ g p.fst μv : ↑↑μ (s \ ⋃ (p : α × ℝ) (_ : p ∈ v), closedBall p.fst p.snd) = 0 v_disj : PairwiseDisjoint v fun p => closedBall p.fst p.snd t : Set α := Prod.fst '' v r : α → ℝ hr : ∀ (x : α), x ∈ t → (x, r x) ∈ v im_t : (fun x => (x, r x)) '' t = v A : InjOn (fun x => (x, r x)) t ⊢ PairwiseDisjoint t fun x => closedBall x (r x) [PROOFSTEP] rwa [← im_t, A.pairwiseDisjoint_image] at v_disj [GOAL] α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) ⊢ ∃ t r, Set.Countable t ∧ t ⊆ s ∧ (∀ (x : α), x ∈ t → r x ∈ f x) ∧ s ⊆ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x) ∧ ∑' (x : ↑t), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ↑↑μ s + ε [PROOFSTEP] obtain ⟨u, su, u_open, μu⟩ : ∃ U, U ⊇ s ∧ IsOpen U ∧ μ U ≤ μ s + ε / 2 := Set.exists_isOpen_le_add _ _ (by simpa only [or_false_iff, Ne.def, ENNReal.div_eq_zero_iff, ENNReal.one_ne_top] using hε) [GOAL] α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) ⊢ ε / 2 ≠ 0 [PROOFSTEP] simpa only [or_false_iff, Ne.def, ENNReal.div_eq_zero_iff, ENNReal.one_ne_top] using hε [GOAL] case intro.intro.intro α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 ⊢ ∃ t r, Set.Countable t ∧ t ⊆ s ∧ (∀ (x : α), x ∈ t → r x ∈ f x) ∧ s ⊆ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x) ∧ ∑' (x : ↑t), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ↑↑μ s + ε [PROOFSTEP] have : ∀ x ∈ s, ∃ R > 0, ball x R ⊆ u := fun x hx => Metric.mem_nhds_iff.1 (u_open.mem_nhds (su hx)) [GOAL] case intro.intro.intro α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 this : ∀ (x : α), x ∈ s → ∃ R, R > 0 ∧ ball x R ⊆ u ⊢ ∃ t r, Set.Countable t ∧ t ⊆ s ∧ (∀ (x : α), x ∈ t → r x ∈ f x) ∧ s ⊆ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x) ∧ ∑' (x : ↑t), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ↑↑μ s + ε [PROOFSTEP] choose! R hR using this [GOAL] case intro.intro.intro α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u ⊢ ∃ t r, Set.Countable t ∧ t ⊆ s ∧ (∀ (x : α), x ∈ t → r x ∈ f x) ∧ s ⊆ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x) ∧ ∑' (x : ↑t), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ↑↑μ s + ε [PROOFSTEP] obtain ⟨t0, r0, t0_count, t0s, hr0, μt0, t0_disj⟩ : ∃ (t0 : Set α) (r0 : α → ℝ), t0.Countable ∧ t0 ⊆ s ∧ (∀ x ∈ t0, r0 x ∈ f x ∩ Ioo 0 (R x)) ∧ μ (s \ ⋃ x ∈ t0, closedBall x (r0 x)) = 0 ∧ t0.PairwiseDisjoint fun x => closedBall x (r0 x) := exists_disjoint_closedBall_covering_ae μ f s hf R fun x hx => (hR x hx).1 -- we have constructed an almost everywhere covering of `s` by disjoint balls. Let `s'` be the -- remaining set. [GOAL] case intro.intro.intro.intro.intro.intro.intro.intro.intro α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) ⊢ ∃ t r, Set.Countable t ∧ t ⊆ s ∧ (∀ (x : α), x ∈ t → r x ∈ f x) ∧ s ⊆ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x) ∧ ∑' (x : ↑t), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ↑↑μ s + ε [PROOFSTEP] let s' := s \ ⋃ x ∈ t0, closedBall x (r0 x) [GOAL] case intro.intro.intro.intro.intro.intro.intro.intro.intro α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) ⊢ ∃ t r, Set.Countable t ∧ t ⊆ s ∧ (∀ (x : α), x ∈ t → r x ∈ f x) ∧ s ⊆ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x) ∧ ∑' (x : ↑t), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ↑↑μ s + ε [PROOFSTEP] have s's : s' ⊆ s := diff_subset _ _ [GOAL] case intro.intro.intro.intro.intro.intro.intro.intro.intro α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s ⊢ ∃ t r, Set.Countable t ∧ t ⊆ s ∧ (∀ (x : α), x ∈ t → r x ∈ f x) ∧ s ⊆ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x) ∧ ∑' (x : ↑t), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ↑↑μ s + ε [PROOFSTEP] obtain ⟨N, τ, hτ, H⟩ : ∃ N τ, 1 < τ ∧ IsEmpty (Besicovitch.SatelliteConfig α N τ) := HasBesicovitchCovering.no_satelliteConfig [GOAL] case intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) ⊢ ∃ t r, Set.Countable t ∧ t ⊆ s ∧ (∀ (x : α), x ∈ t → r x ∈ f x) ∧ s ⊆ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x) ∧ ∑' (x : ↑t), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ↑↑μ s + ε [PROOFSTEP] obtain ⟨v, s'v, v_open, μv⟩ : ∃ v, v ⊇ s' ∧ IsOpen v ∧ μ v ≤ μ s' + ε / 2 / N := Set.exists_isOpen_le_add _ _ (by simp only [hε, ENNReal.nat_ne_top, WithTop.mul_eq_top_iff, Ne.def, ENNReal.div_eq_zero_iff, ENNReal.one_ne_top, not_false_iff, and_false_iff, false_and_iff, or_self_iff]) [GOAL] α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) ⊢ ε / 2 / ↑N ≠ 0 [PROOFSTEP] simp only [hε, ENNReal.nat_ne_top, WithTop.mul_eq_top_iff, Ne.def, ENNReal.div_eq_zero_iff, ENNReal.one_ne_top, not_false_iff, and_false_iff, false_and_iff, or_self_iff] [GOAL] case intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N ⊢ ∃ t r, Set.Countable t ∧ t ⊆ s ∧ (∀ (x : α), x ∈ t → r x ∈ f x) ∧ s ⊆ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x) ∧ ∑' (x : ↑t), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ↑↑μ s + ε [PROOFSTEP] have : ∀ x ∈ s', ∃ r1 ∈ f x ∩ Ioo (0 : ℝ) 1, closedBall x r1 ⊆ v := by intro x hx rcases Metric.mem_nhds_iff.1 (v_open.mem_nhds (s'v hx)) with ⟨r, rpos, hr⟩ rcases hf x (s's hx) (min r 1) (lt_min rpos zero_lt_one) with ⟨R', hR'⟩ exact ⟨R', ⟨hR'.1, hR'.2.1, hR'.2.2.trans_le (min_le_right _ _)⟩, Subset.trans (closedBall_subset_ball (hR'.2.2.trans_le (min_le_left _ _))) hr⟩ [GOAL] α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N ⊢ ∀ (x : α), x ∈ s' → ∃ r1, r1 ∈ f x ∩ Ioo 0 1 ∧ closedBall x r1 ⊆ v [PROOFSTEP] intro x hx [GOAL] α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N x : α hx : x ∈ s' ⊢ ∃ r1, r1 ∈ f x ∩ Ioo 0 1 ∧ closedBall x r1 ⊆ v [PROOFSTEP] rcases Metric.mem_nhds_iff.1 (v_open.mem_nhds (s'v hx)) with ⟨r, rpos, hr⟩ [GOAL] case intro.intro α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N x : α hx : x ∈ s' r : ℝ rpos : r > 0 hr : ball x r ⊆ v ⊢ ∃ r1, r1 ∈ f x ∩ Ioo 0 1 ∧ closedBall x r1 ⊆ v [PROOFSTEP] rcases hf x (s's hx) (min r 1) (lt_min rpos zero_lt_one) with ⟨R', hR'⟩ [GOAL] case intro.intro.intro α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N x : α hx : x ∈ s' r : ℝ rpos : r > 0 hr : ball x r ⊆ v R' : ℝ hR' : R' ∈ f x ∩ Ioo 0 (min r 1) ⊢ ∃ r1, r1 ∈ f x ∩ Ioo 0 1 ∧ closedBall x r1 ⊆ v [PROOFSTEP] exact ⟨R', ⟨hR'.1, hR'.2.1, hR'.2.2.trans_le (min_le_right _ _)⟩, Subset.trans (closedBall_subset_ball (hR'.2.2.trans_le (min_le_left _ _))) hr⟩ [GOAL] case intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N this : ∀ (x : α), x ∈ s' → ∃ r1, r1 ∈ f x ∩ Ioo 0 1 ∧ closedBall x r1 ⊆ v ⊢ ∃ t r, Set.Countable t ∧ t ⊆ s ∧ (∀ (x : α), x ∈ t → r x ∈ f x) ∧ s ⊆ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x) ∧ ∑' (x : ↑t), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ↑↑μ s + ε [PROOFSTEP] choose! r1 hr1 using this [GOAL] case intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v ⊢ ∃ t r, Set.Countable t ∧ t ⊆ s ∧ (∀ (x : α), x ∈ t → r x ∈ f x) ∧ s ⊆ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x) ∧ ∑' (x : ↑t), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ↑↑μ s + ε [PROOFSTEP] let q : BallPackage s' α := { c := fun x => x r := fun x => r1 x rpos := fun x => (hr1 x.1 x.2).1.2.1 r_bound := 1 r_le := fun x => (hr1 x.1 x.2).1.2.2.le } -- by Besicovitch, we cover `s'` with at most `N` families of disjoint balls, all included in -- a suitable neighborhood `v` of `s'`. [GOAL] case intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } ⊢ ∃ t r, Set.Countable t ∧ t ⊆ s ∧ (∀ (x : α), x ∈ t → r x ∈ f x) ∧ s ⊆ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x) ∧ ∑' (x : ↑t), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ↑↑μ s + ε [PROOFSTEP] obtain ⟨S, S_disj, hS⟩ : ∃ S : Fin N → Set s', (∀ i : Fin N, (S i).PairwiseDisjoint fun j => closedBall (q.c j) (q.r j)) ∧ range q.c ⊆ ⋃ i : Fin N, ⋃ j ∈ S i, ball (q.c j) (q.r j) := exist_disjoint_covering_families hτ H q [GOAL] case intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) ⊢ ∃ t r, Set.Countable t ∧ t ⊆ s ∧ (∀ (x : α), x ∈ t → r x ∈ f x) ∧ s ⊆ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x) ∧ ∑' (x : ↑t), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ↑↑μ s + ε [PROOFSTEP] have S_count : ∀ i, (S i).Countable := by intro i apply (S_disj i).countable_of_nonempty_interior fun j _ => ?_ have : (ball (j : α) (r1 j)).Nonempty := nonempty_ball.2 (q.rpos _) exact this.mono ball_subset_interior_closedBall [GOAL] α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) ⊢ ∀ (i : Fin N), Set.Countable (S i) [PROOFSTEP] intro i [GOAL] α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) i : Fin N ⊢ Set.Countable (S i) [PROOFSTEP] apply (S_disj i).countable_of_nonempty_interior fun j _ => ?_ [GOAL] α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) i : Fin N j : ↑s' x✝ : j ∈ S i ⊢ Set.Nonempty (interior (closedBall (BallPackage.c q j) (BallPackage.r q j))) [PROOFSTEP] have : (ball (j : α) (r1 j)).Nonempty := nonempty_ball.2 (q.rpos _) [GOAL] α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) i : Fin N j : ↑s' x✝ : j ∈ S i this : Set.Nonempty (ball (↑j) (r1 ↑j)) ⊢ Set.Nonempty (interior (closedBall (BallPackage.c q j) (BallPackage.r q j))) [PROOFSTEP] exact this.mono ball_subset_interior_closedBall [GOAL] case intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) ⊢ ∃ t r, Set.Countable t ∧ t ⊆ s ∧ (∀ (x : α), x ∈ t → r x ∈ f x) ∧ s ⊆ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x) ∧ ∑' (x : ↑t), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ↑↑μ s + ε [PROOFSTEP] let r x := if x ∈ s' then r1 x else r0 x [GOAL] case intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x ⊢ ∃ t r, Set.Countable t ∧ t ⊆ s ∧ (∀ (x : α), x ∈ t → r x ∈ f x) ∧ s ⊆ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x) ∧ ∑' (x : ↑t), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ↑↑μ s + ε [PROOFSTEP] have r_t0 : ∀ x ∈ t0, r x = r0 x := by intro x hx have : ¬x ∈ s' := by simp only [not_exists, exists_prop, mem_iUnion, mem_closedBall, not_and, not_lt, not_le, mem_diff, not_forall] intro _ refine' ⟨x, hx, _⟩ rw [dist_self] exact (hr0 x hx).2.1.le simp only [if_neg this] -- the desired covering set is given by the union of the families constructed in the first and -- second steps. [GOAL] α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x ⊢ ∀ (x : α), x ∈ t0 → r x = r0 x [PROOFSTEP] intro x hx [GOAL] α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x x : α hx : x ∈ t0 ⊢ r x = r0 x [PROOFSTEP] have : ¬x ∈ s' := by simp only [not_exists, exists_prop, mem_iUnion, mem_closedBall, not_and, not_lt, not_le, mem_diff, not_forall] intro _ refine' ⟨x, hx, _⟩ rw [dist_self] exact (hr0 x hx).2.1.le [GOAL] α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x x : α hx : x ∈ t0 ⊢ ¬x ∈ s' [PROOFSTEP] simp only [not_exists, exists_prop, mem_iUnion, mem_closedBall, not_and, not_lt, not_le, mem_diff, not_forall] [GOAL] α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x x : α hx : x ∈ t0 ⊢ x ∈ s → ∃ x_1, x_1 ∈ t0 ∧ dist x x_1 ≤ r0 x_1 [PROOFSTEP] intro _ [GOAL] α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x x : α hx : x ∈ t0 a✝ : x ∈ s ⊢ ∃ x_1, x_1 ∈ t0 ∧ dist x x_1 ≤ r0 x_1 [PROOFSTEP] refine' ⟨x, hx, _⟩ [GOAL] α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x x : α hx : x ∈ t0 a✝ : x ∈ s ⊢ dist x x ≤ r0 x [PROOFSTEP] rw [dist_self] [GOAL] α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x x : α hx : x ∈ t0 a✝ : x ∈ s ⊢ 0 ≤ r0 x [PROOFSTEP] exact (hr0 x hx).2.1.le [GOAL] α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x x : α hx : x ∈ t0 this : ¬x ∈ s' ⊢ r x = r0 x [PROOFSTEP] simp only [if_neg this] -- the desired covering set is given by the union of the families constructed in the first and -- second steps. [GOAL] case intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x ⊢ ∃ t r, Set.Countable t ∧ t ⊆ s ∧ (∀ (x : α), x ∈ t → r x ∈ f x) ∧ s ⊆ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x) ∧ ∑' (x : ↑t), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ↑↑μ s + ε [PROOFSTEP] refine' ⟨t0 ∪ ⋃ i : Fin N, ((↑) : s' → α) '' S i, r, _, _, _, _, _⟩ -- it remains to check that they have the desired properties [GOAL] case intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.refine'_1 α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x ⊢ Set.Countable (t0 ∪ ⋃ (i : Fin N), Subtype.val '' S i) [PROOFSTEP] exact t0_count.union (countable_iUnion fun i => (S_count i).image _) [GOAL] case intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.refine'_2 α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x ⊢ t0 ∪ ⋃ (i : Fin N), Subtype.val '' S i ⊆ s [PROOFSTEP] simp only [t0s, true_and_iff, union_subset_iff, image_subset_iff, iUnion_subset_iff] [GOAL] case intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.refine'_2 α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x ⊢ ∀ (i : Fin N), S i ⊆ (fun a => ↑a) ⁻¹' s [PROOFSTEP] intro i x _ [GOAL] case intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.refine'_2 α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x i : Fin N x : { x // x ∈ s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) } a✝ : x ∈ S i ⊢ x ∈ (fun a => ↑a) ⁻¹' s [PROOFSTEP] exact s's x.2 [GOAL] case intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.refine'_3 α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x ⊢ ∀ (x : α), x ∈ t0 ∪ ⋃ (i : Fin N), Subtype.val '' S i → r x ∈ f x [PROOFSTEP] intro x hx [GOAL] case intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.refine'_3 α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x x : α hx : x ∈ t0 ∪ ⋃ (i : Fin N), Subtype.val '' S i ⊢ r x ∈ f x [PROOFSTEP] cases hx with | inl hx => rw [r_t0 x hx] exact (hr0 _ hx).1 | inr hx => have h'x : x ∈ s' := by simp only [mem_iUnion, mem_image] at hx rcases hx with ⟨i, y, _, rfl⟩ exact y.2 simp only [if_pos h'x, (hr1 x h'x).1.1] [GOAL] case intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.refine'_3 α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x x : α hx : x ∈ t0 ∪ ⋃ (i : Fin N), Subtype.val '' S i ⊢ r x ∈ f x [PROOFSTEP] cases hx with | inl hx => rw [r_t0 x hx] exact (hr0 _ hx).1 | inr hx => have h'x : x ∈ s' := by simp only [mem_iUnion, mem_image] at hx rcases hx with ⟨i, y, _, rfl⟩ exact y.2 simp only [if_pos h'x, (hr1 x h'x).1.1] [GOAL] case intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.refine'_3.inl α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x x : α hx : x ∈ t0 ⊢ r x ∈ f x [PROOFSTEP] | inl hx => rw [r_t0 x hx] exact (hr0 _ hx).1 [GOAL] case intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.refine'_3.inl α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x x : α hx : x ∈ t0 ⊢ r x ∈ f x [PROOFSTEP] rw [r_t0 x hx] [GOAL] case intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.refine'_3.inl α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x x : α hx : x ∈ t0 ⊢ r0 x ∈ f x [PROOFSTEP] exact (hr0 _ hx).1 [GOAL] case intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.refine'_3.inr α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x x : α hx : x ∈ ⋃ (i : Fin N), Subtype.val '' S i ⊢ r x ∈ f x [PROOFSTEP] | inr hx => have h'x : x ∈ s' := by simp only [mem_iUnion, mem_image] at hx rcases hx with ⟨i, y, _, rfl⟩ exact y.2 simp only [if_pos h'x, (hr1 x h'x).1.1] [GOAL] case intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.refine'_3.inr α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x x : α hx : x ∈ ⋃ (i : Fin N), Subtype.val '' S i ⊢ r x ∈ f x [PROOFSTEP] have h'x : x ∈ s' := by simp only [mem_iUnion, mem_image] at hx rcases hx with ⟨i, y, _, rfl⟩ exact y.2 [GOAL] α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x x : α hx : x ∈ ⋃ (i : Fin N), Subtype.val '' S i ⊢ x ∈ s' [PROOFSTEP] simp only [mem_iUnion, mem_image] at hx [GOAL] α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x x : α hx : ∃ i x_1, x_1 ∈ S i ∧ ↑x_1 = x ⊢ x ∈ s' [PROOFSTEP] rcases hx with ⟨i, y, _, rfl⟩ [GOAL] case intro.intro.intro α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x i : Fin N y : { x // x ∈ s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) } left✝ : y ∈ S i ⊢ ↑y ∈ s' [PROOFSTEP] exact y.2 [GOAL] case intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.refine'_3.inr α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x x : α hx : x ∈ ⋃ (i : Fin N), Subtype.val '' S i h'x : x ∈ s' ⊢ r x ∈ f x [PROOFSTEP] simp only [if_pos h'x, (hr1 x h'x).1.1] [GOAL] case intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.refine'_4 α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x ⊢ s ⊆ ⋃ (x : α) (_ : x ∈ t0 ∪ ⋃ (i : Fin N), Subtype.val '' S i), closedBall x (r x) [PROOFSTEP] intro x hx [GOAL] case intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.refine'_4 α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x x : α hx : x ∈ s ⊢ x ∈ ⋃ (x : α) (_ : x ∈ t0 ∪ ⋃ (i : Fin N), Subtype.val '' S i), closedBall x (r x) [PROOFSTEP] by_cases h'x : x ∈ s' [GOAL] case pos α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x x : α hx : x ∈ s h'x : x ∈ s' ⊢ x ∈ ⋃ (x : α) (_ : x ∈ t0 ∪ ⋃ (i : Fin N), Subtype.val '' S i), closedBall x (r x) [PROOFSTEP] obtain ⟨i, y, ySi, xy⟩ : ∃ (i : Fin N) (y : ↥s'), y ∈ S i ∧ x ∈ ball (y : α) (r1 y) := by have A : x ∈ range q.c := by simpa only [not_exists, exists_prop, mem_iUnion, mem_closedBall, not_and, not_le, mem_setOf_eq, Subtype.range_coe_subtype, mem_diff] using h'x simpa only [mem_iUnion, mem_image, bex_def] using hS A [GOAL] α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x x : α hx : x ∈ s h'x : x ∈ s' ⊢ ∃ i y, y ∈ S i ∧ x ∈ ball (↑y) (r1 ↑y) [PROOFSTEP] have A : x ∈ range q.c := by simpa only [not_exists, exists_prop, mem_iUnion, mem_closedBall, not_and, not_le, mem_setOf_eq, Subtype.range_coe_subtype, mem_diff] using h'x [GOAL] α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x x : α hx : x ∈ s h'x : x ∈ s' ⊢ x ∈ range q.c [PROOFSTEP] simpa only [not_exists, exists_prop, mem_iUnion, mem_closedBall, not_and, not_le, mem_setOf_eq, Subtype.range_coe_subtype, mem_diff] using h'x [GOAL] α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x x : α hx : x ∈ s h'x : x ∈ s' A : x ∈ range q.c ⊢ ∃ i y, y ∈ S i ∧ x ∈ ball (↑y) (r1 ↑y) [PROOFSTEP] simpa only [mem_iUnion, mem_image, bex_def] using hS A [GOAL] case pos.intro.intro.intro α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x x : α hx : x ∈ s h'x : x ∈ s' i : Fin N y : ↑s' ySi : y ∈ S i xy : x ∈ ball (↑y) (r1 ↑y) ⊢ x ∈ ⋃ (x : α) (_ : x ∈ t0 ∪ ⋃ (i : Fin N), Subtype.val '' S i), closedBall x (r x) [PROOFSTEP] refine' mem_iUnion₂.2 ⟨y, Or.inr _, _⟩ [GOAL] case pos.intro.intro.intro.refine'_1 α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x x : α hx : x ∈ s h'x : x ∈ s' i : Fin N y : ↑s' ySi : y ∈ S i xy : x ∈ ball (↑y) (r1 ↑y) ⊢ ↑y ∈ ⋃ (i : Fin N), Subtype.val '' S i [PROOFSTEP] simp only [mem_iUnion, mem_image] [GOAL] case pos.intro.intro.intro.refine'_1 α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x x : α hx : x ∈ s h'x : x ∈ s' i : Fin N y : ↑s' ySi : y ∈ S i xy : x ∈ ball (↑y) (r1 ↑y) ⊢ ∃ i x, x ∈ S i ∧ ↑x = ↑y [PROOFSTEP] exact ⟨i, y, ySi, rfl⟩ [GOAL] case pos.intro.intro.intro.refine'_2 α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x x : α hx : x ∈ s h'x : x ∈ s' i : Fin N y : ↑s' ySi : y ∈ S i xy : x ∈ ball (↑y) (r1 ↑y) ⊢ x ∈ closedBall (↑y) (r ↑y) [PROOFSTEP] have : (y : α) ∈ s' := y.2 [GOAL] case pos.intro.intro.intro.refine'_2 α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x x : α hx : x ∈ s h'x : x ∈ s' i : Fin N y : ↑s' ySi : y ∈ S i xy : x ∈ ball (↑y) (r1 ↑y) this : ↑y ∈ s' ⊢ x ∈ closedBall (↑y) (r ↑y) [PROOFSTEP] simp only [if_pos this] [GOAL] case pos.intro.intro.intro.refine'_2 α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x x : α hx : x ∈ s h'x : x ∈ s' i : Fin N y : ↑s' ySi : y ∈ S i xy : x ∈ ball (↑y) (r1 ↑y) this : ↑y ∈ s' ⊢ x ∈ closedBall (↑y) (r1 ↑y) [PROOFSTEP] exact ball_subset_closedBall xy [GOAL] case neg α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x x : α hx : x ∈ s h'x : ¬x ∈ s' ⊢ x ∈ ⋃ (x : α) (_ : x ∈ t0 ∪ ⋃ (i : Fin N), Subtype.val '' S i), closedBall x (r x) [PROOFSTEP] obtain ⟨y, yt0, hxy⟩ : ∃ y : α, y ∈ t0 ∧ x ∈ closedBall y (r0 y) := by simpa [hx, -mem_closedBall] using h'x [GOAL] α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x x : α hx : x ∈ s h'x : ¬x ∈ s' ⊢ ∃ y, y ∈ t0 ∧ x ∈ closedBall y (r0 y) [PROOFSTEP] simpa [hx, -mem_closedBall] using h'x [GOAL] case neg.intro.intro α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x x : α hx : x ∈ s h'x : ¬x ∈ s' y : α yt0 : y ∈ t0 hxy : x ∈ closedBall y (r0 y) ⊢ x ∈ ⋃ (x : α) (_ : x ∈ t0 ∪ ⋃ (i : Fin N), Subtype.val '' S i), closedBall x (r x) [PROOFSTEP] refine' mem_iUnion₂.2 ⟨y, Or.inl yt0, _⟩ [GOAL] case neg.intro.intro α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x x : α hx : x ∈ s h'x : ¬x ∈ s' y : α yt0 : y ∈ t0 hxy : x ∈ closedBall y (r0 y) ⊢ x ∈ closedBall y (r y) [PROOFSTEP] rwa [r_t0 _ yt0] -- the only nontrivial property is the measure control, which we check now [GOAL] case intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.refine'_5 α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x ⊢ ∑' (x : ↑(t0 ∪ ⋃ (i : Fin N), Subtype.val '' S i)), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ↑↑μ s + ε [PROOFSTEP] have A : (∑' x : t0, μ (closedBall x (r x))) ≤ μ s + ε / 2 := calc (∑' x : t0, μ (closedBall x (r x))) = ∑' x : t0, μ (closedBall x (r0 x)) := by congr 1; ext x; rw [r_t0 x x.2] _ = μ (⋃ x : t0, closedBall x (r0 x)) := by haveI : Encodable t0 := t0_count.toEncodable rw [measure_iUnion] · exact (pairwise_subtype_iff_pairwise_set _ _).2 t0_disj · exact fun i => measurableSet_closedBall _ ≤ μ u := by apply measure_mono simp only [SetCoe.forall, Subtype.coe_mk, iUnion_subset_iff] intro x hx apply Subset.trans (closedBall_subset_ball (hr0 x hx).2.2) (hR x (t0s hx)).2 _ ≤ μ s + ε / 2 := μu [GOAL] α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x ⊢ ∑' (x : ↑t0), ↑↑μ (closedBall (↑x) (r ↑x)) = ∑' (x : ↑t0), ↑↑μ (closedBall (↑x) (r0 ↑x)) [PROOFSTEP] congr 1 [GOAL] case e_f α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x ⊢ (fun x => ↑↑μ (closedBall (↑x) (r ↑x))) = fun x => ↑↑μ (closedBall (↑x) (r0 ↑x)) [PROOFSTEP] ext x [GOAL] case e_f.h α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x x : ↑t0 ⊢ ↑↑μ (closedBall (↑x) (r ↑x)) = ↑↑μ (closedBall (↑x) (r0 ↑x)) [PROOFSTEP] rw [r_t0 x x.2] [GOAL] α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x ⊢ ∑' (x : ↑t0), ↑↑μ (closedBall (↑x) (r0 ↑x)) = ↑↑μ (⋃ (x : ↑t0), closedBall (↑x) (r0 ↑x)) [PROOFSTEP] haveI : Encodable t0 := t0_count.toEncodable [GOAL] α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x this : Encodable ↑t0 ⊢ ∑' (x : ↑t0), ↑↑μ (closedBall (↑x) (r0 ↑x)) = ↑↑μ (⋃ (x : ↑t0), closedBall (↑x) (r0 ↑x)) [PROOFSTEP] rw [measure_iUnion] [GOAL] case hn α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x this : Encodable ↑t0 ⊢ Pairwise (Disjoint on fun x => closedBall (↑x) (r0 ↑x)) [PROOFSTEP] exact (pairwise_subtype_iff_pairwise_set _ _).2 t0_disj [GOAL] case h α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x this : Encodable ↑t0 ⊢ ∀ (i : ↑t0), MeasurableSet (closedBall (↑i) (r0 ↑i)) [PROOFSTEP] exact fun i => measurableSet_closedBall [GOAL] α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x ⊢ ↑↑μ (⋃ (x : ↑t0), closedBall (↑x) (r0 ↑x)) ≤ ↑↑μ u [PROOFSTEP] apply measure_mono [GOAL] case h α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x ⊢ ⋃ (x : ↑t0), closedBall (↑x) (r0 ↑x) ⊆ u [PROOFSTEP] simp only [SetCoe.forall, Subtype.coe_mk, iUnion_subset_iff] [GOAL] case h α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x ⊢ ∀ (x : α), x ∈ t0 → closedBall x (r0 x) ⊆ u [PROOFSTEP] intro x hx [GOAL] case h α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x x : α hx : x ∈ t0 ⊢ closedBall x (r0 x) ⊆ u [PROOFSTEP] apply Subset.trans (closedBall_subset_ball (hr0 x hx).2.2) (hR x (t0s hx)).2 [GOAL] case intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.refine'_5 α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x A : ∑' (x : ↑t0), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ↑↑μ s + ε / 2 ⊢ ∑' (x : ↑(t0 ∪ ⋃ (i : Fin N), Subtype.val '' S i)), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ↑↑μ s + ε [PROOFSTEP] have B : ∀ i : Fin N, (∑' x : ((↑) : s' → α) '' S i, μ (closedBall x (r x))) ≤ ε / 2 / N := fun i => calc (∑' x : ((↑) : s' → α) '' S i, μ (closedBall x (r x))) = ∑' x : S i, μ (closedBall x (r x)) := by have : InjOn ((↑) : s' → α) (S i) := Subtype.val_injective.injOn _ let F : S i ≃ ((↑) : s' → α) '' S i := this.bijOn_image.equiv _ exact (F.tsum_eq fun x => μ (closedBall x (r x))).symm _ = ∑' x : S i, μ (closedBall x (r1 x)) := by congr 1; ext x; have : (x : α) ∈ s' := x.1.2; simp only [if_pos this] _ = μ (⋃ x : S i, closedBall x (r1 x)) := by haveI : Encodable (S i) := (S_count i).toEncodable rw [measure_iUnion] · exact (pairwise_subtype_iff_pairwise_set _ _).2 (S_disj i) · exact fun i => measurableSet_closedBall _ ≤ μ v := by apply measure_mono simp only [SetCoe.forall, Subtype.coe_mk, iUnion_subset_iff] intro x xs' _ exact (hr1 x xs').2 _ ≤ ε / 2 / N := by have : μ s' = 0 := μt0; rwa [this, zero_add] at μv [GOAL] α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x A : ∑' (x : ↑t0), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ↑↑μ s + ε / 2 i : Fin N ⊢ ∑' (x : ↑(Subtype.val '' S i)), ↑↑μ (closedBall (↑x) (r ↑x)) = ∑' (x : ↑(S i)), ↑↑μ (closedBall (↑↑x) (r ↑↑x)) [PROOFSTEP] have : InjOn ((↑) : s' → α) (S i) := Subtype.val_injective.injOn _ [GOAL] α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x A : ∑' (x : ↑t0), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ↑↑μ s + ε / 2 i : Fin N this : InjOn Subtype.val (S i) ⊢ ∑' (x : ↑(Subtype.val '' S i)), ↑↑μ (closedBall (↑x) (r ↑x)) = ∑' (x : ↑(S i)), ↑↑μ (closedBall (↑↑x) (r ↑↑x)) [PROOFSTEP] let F : S i ≃ ((↑) : s' → α) '' S i := this.bijOn_image.equiv _ [GOAL] α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x A : ∑' (x : ↑t0), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ↑↑μ s + ε / 2 i : Fin N this : InjOn Subtype.val (S i) F : ↑(S i) ≃ ↑(Subtype.val '' S i) := BijOn.equiv Subtype.val (_ : BijOn Subtype.val (S i) (Subtype.val '' S i)) ⊢ ∑' (x : ↑(Subtype.val '' S i)), ↑↑μ (closedBall (↑x) (r ↑x)) = ∑' (x : ↑(S i)), ↑↑μ (closedBall (↑↑x) (r ↑↑x)) [PROOFSTEP] exact (F.tsum_eq fun x => μ (closedBall x (r x))).symm [GOAL] α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x A : ∑' (x : ↑t0), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ↑↑μ s + ε / 2 i : Fin N ⊢ ∑' (x : ↑(S i)), ↑↑μ (closedBall (↑↑x) (r ↑↑x)) = ∑' (x : ↑(S i)), ↑↑μ (closedBall (↑↑x) (r1 ↑↑x)) [PROOFSTEP] congr 1 [GOAL] case e_f α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x A : ∑' (x : ↑t0), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ↑↑μ s + ε / 2 i : Fin N ⊢ (fun x => ↑↑μ (closedBall (↑↑x) (r ↑↑x))) = fun x => ↑↑μ (closedBall (↑↑x) (r1 ↑↑x)) [PROOFSTEP] ext x [GOAL] case e_f.h α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x A : ∑' (x : ↑t0), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ↑↑μ s + ε / 2 i : Fin N x : ↑(S i) ⊢ ↑↑μ (closedBall (↑↑x) (r ↑↑x)) = ↑↑μ (closedBall (↑↑x) (r1 ↑↑x)) [PROOFSTEP] have : (x : α) ∈ s' := x.1.2 [GOAL] case e_f.h α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x A : ∑' (x : ↑t0), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ↑↑μ s + ε / 2 i : Fin N x : ↑(S i) this : ↑↑x ∈ s' ⊢ ↑↑μ (closedBall (↑↑x) (r ↑↑x)) = ↑↑μ (closedBall (↑↑x) (r1 ↑↑x)) [PROOFSTEP] simp only [if_pos this] [GOAL] α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x A : ∑' (x : ↑t0), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ↑↑μ s + ε / 2 i : Fin N ⊢ ∑' (x : ↑(S i)), ↑↑μ (closedBall (↑↑x) (r1 ↑↑x)) = ↑↑μ (⋃ (x : ↑(S i)), closedBall (↑↑x) (r1 ↑↑x)) [PROOFSTEP] haveI : Encodable (S i) := (S_count i).toEncodable [GOAL] α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x A : ∑' (x : ↑t0), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ↑↑μ s + ε / 2 i : Fin N this : Encodable ↑(S i) ⊢ ∑' (x : ↑(S i)), ↑↑μ (closedBall (↑↑x) (r1 ↑↑x)) = ↑↑μ (⋃ (x : ↑(S i)), closedBall (↑↑x) (r1 ↑↑x)) [PROOFSTEP] rw [measure_iUnion] [GOAL] case hn α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x A : ∑' (x : ↑t0), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ↑↑μ s + ε / 2 i : Fin N this : Encodable ↑(S i) ⊢ Pairwise (Disjoint on fun x => closedBall (↑↑x) (r1 ↑↑x)) [PROOFSTEP] exact (pairwise_subtype_iff_pairwise_set _ _).2 (S_disj i) [GOAL] case h α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x A : ∑' (x : ↑t0), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ↑↑μ s + ε / 2 i : Fin N this : Encodable ↑(S i) ⊢ ∀ (i_1 : ↑(S i)), MeasurableSet (closedBall (↑↑i_1) (r1 ↑↑i_1)) [PROOFSTEP] exact fun i => measurableSet_closedBall [GOAL] α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x A : ∑' (x : ↑t0), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ↑↑μ s + ε / 2 i : Fin N ⊢ ↑↑μ (⋃ (x : ↑(S i)), closedBall (↑↑x) (r1 ↑↑x)) ≤ ↑↑μ v [PROOFSTEP] apply measure_mono [GOAL] case h α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x A : ∑' (x : ↑t0), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ↑↑μ s + ε / 2 i : Fin N ⊢ ⋃ (x : ↑(S i)), closedBall (↑↑x) (r1 ↑↑x) ⊆ v [PROOFSTEP] simp only [SetCoe.forall, Subtype.coe_mk, iUnion_subset_iff] [GOAL] case h α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x A : ∑' (x : ↑t0), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ↑↑μ s + ε / 2 i : Fin N ⊢ ∀ (x : α) (h : x ∈ s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)), { val := x, property := h } ∈ S i → closedBall x (r1 x) ⊆ v [PROOFSTEP] intro x xs' _ [GOAL] case h α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x A : ∑' (x : ↑t0), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ↑↑μ s + ε / 2 i : Fin N x : α xs' : x ∈ s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) h✝ : { val := x, property := xs' } ∈ S i ⊢ closedBall x (r1 x) ⊆ v [PROOFSTEP] exact (hr1 x xs').2 [GOAL] α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x A : ∑' (x : ↑t0), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ↑↑μ s + ε / 2 i : Fin N ⊢ ↑↑μ v ≤ ε / 2 / ↑N [PROOFSTEP] have : μ s' = 0 := μt0 [GOAL] α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x A : ∑' (x : ↑t0), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ↑↑μ s + ε / 2 i : Fin N this : ↑↑μ s' = 0 ⊢ ↑↑μ v ≤ ε / 2 / ↑N [PROOFSTEP] rwa [this, zero_add] at μv [GOAL] case intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.refine'_5 α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x A : ∑' (x : ↑t0), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ↑↑μ s + ε / 2 B : ∀ (i : Fin N), ∑' (x : ↑(Subtype.val '' S i)), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ε / 2 / ↑N ⊢ ∑' (x : ↑(t0 ∪ ⋃ (i : Fin N), Subtype.val '' S i)), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ↑↑μ s + ε [PROOFSTEP] calc (∑' x : ↥(t0 ∪ ⋃ i : Fin N, ((↑) : s' → α) '' S i), μ (closedBall x (r x))) ≤ (∑' x : t0, μ (closedBall x (r x))) + ∑' x : ⋃ i : Fin N, ((↑) : s' → α) '' S i, μ (closedBall x (r x)) := ENNReal.tsum_union_le (fun x => μ (closedBall x (r x))) _ _ _ ≤ (∑' x : t0, μ (closedBall x (r x))) + ∑ i : Fin N, ∑' x : ((↑) : s' → α) '' S i, μ (closedBall x (r x)) := (add_le_add le_rfl (ENNReal.tsum_iUnion_le (fun x => μ (closedBall x (r x))) _)) _ ≤ μ s + ε / 2 + ∑ i : Fin N, ε / 2 / N := by refine' add_le_add A _ refine' Finset.sum_le_sum _ intro i _ exact B i _ ≤ μ s + ε / 2 + ε / 2 := by refine' add_le_add le_rfl _ simp only [Finset.card_fin, Finset.sum_const, nsmul_eq_mul, ENNReal.mul_div_le] _ = μ s + ε := by rw [add_assoc, ENNReal.add_halves] [GOAL] α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x A : ∑' (x : ↑t0), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ↑↑μ s + ε / 2 B : ∀ (i : Fin N), ∑' (x : ↑(Subtype.val '' S i)), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ε / 2 / ↑N ⊢ ∑' (x : ↑t0), ↑↑μ (closedBall (↑x) (r ↑x)) + ∑ i : Fin N, ∑' (x : ↑(Subtype.val '' S i)), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ↑↑μ s + ε / 2 + ∑ i : Fin N, ε / 2 / ↑N [PROOFSTEP] refine' add_le_add A _ [GOAL] α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x A : ∑' (x : ↑t0), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ↑↑μ s + ε / 2 B : ∀ (i : Fin N), ∑' (x : ↑(Subtype.val '' S i)), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ε / 2 / ↑N ⊢ ∑ i : Fin N, ∑' (x : ↑(Subtype.val '' S i)), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ∑ i : Fin N, ε / 2 / ↑N [PROOFSTEP] refine' Finset.sum_le_sum _ [GOAL] α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x A : ∑' (x : ↑t0), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ↑↑μ s + ε / 2 B : ∀ (i : Fin N), ∑' (x : ↑(Subtype.val '' S i)), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ε / 2 / ↑N ⊢ ∀ (i : Fin N), i ∈ Finset.univ → ∑' (x : ↑(Subtype.val '' S i)), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ε / 2 / ↑N [PROOFSTEP] intro i _ [GOAL] α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x A : ∑' (x : ↑t0), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ↑↑μ s + ε / 2 B : ∀ (i : Fin N), ∑' (x : ↑(Subtype.val '' S i)), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ε / 2 / ↑N i : Fin N a✝ : i ∈ Finset.univ ⊢ ∑' (x : ↑(Subtype.val '' S i)), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ε / 2 / ↑N [PROOFSTEP] exact B i [GOAL] α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x A : ∑' (x : ↑t0), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ↑↑μ s + ε / 2 B : ∀ (i : Fin N), ∑' (x : ↑(Subtype.val '' S i)), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ε / 2 / ↑N ⊢ ↑↑μ s + ε / 2 + ∑ i : Fin N, ε / 2 / ↑N ≤ ↑↑μ s + ε / 2 + ε / 2 [PROOFSTEP] refine' add_le_add le_rfl _ [GOAL] α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x A : ∑' (x : ↑t0), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ↑↑μ s + ε / 2 B : ∀ (i : Fin N), ∑' (x : ↑(Subtype.val '' S i)), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ε / 2 / ↑N ⊢ ∑ i : Fin N, ε / 2 / ↑N ≤ ε / 2 [PROOFSTEP] simp only [Finset.card_fin, Finset.sum_const, nsmul_eq_mul, ENNReal.mul_div_le] [GOAL] α : Type u_1 inst✝⁶ : MetricSpace α β : Type u inst✝⁵ : SecondCountableTopology α inst✝⁴ : MeasurableSpace α inst✝³ : OpensMeasurableSpace α inst✝² : HasBesicovitchCovering α μ : Measure α inst✝¹ : SigmaFinite μ inst✝ : Measure.OuterRegular μ ε : ℝ≥0∞ hε : ε ≠ 0 f : α → Set ℝ s : Set α hf : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (f x ∩ Ioo 0 δ) u : Set α su : u ⊇ s u_open : IsOpen u μu : ↑↑μ u ≤ ↑↑μ s + ε / 2 R : α → ℝ hR : ∀ (x : α), x ∈ s → R x > 0 ∧ ball x (R x) ⊆ u t0 : Set α r0 : α → ℝ t0_count : Set.Countable t0 t0s : t0 ⊆ s hr0 : ∀ (x : α), x ∈ t0 → r0 x ∈ f x ∩ Ioo 0 (R x) μt0 : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x)) = 0 t0_disj : PairwiseDisjoint t0 fun x => closedBall x (r0 x) s' : Set α := s \ ⋃ (x : α) (_ : x ∈ t0), closedBall x (r0 x) s's : s' ⊆ s N : ℕ τ : ℝ hτ : 1 < τ H : IsEmpty (SatelliteConfig α N τ) v : Set α s'v : v ⊇ s' v_open : IsOpen v μv : ↑↑μ v ≤ ↑↑μ s' + ε / 2 / ↑N r1 : α → ℝ hr1 : ∀ (x : α), x ∈ s' → r1 x ∈ f x ∩ Ioo 0 1 ∧ closedBall x (r1 x) ⊆ v q : BallPackage (↑s') α := { c := fun x => ↑x, r := fun x => r1 ↑x, rpos := (_ : ∀ (x : ↑s'), 0 < r1 ↑x), r_bound := 1, r_le := (_ : ∀ (x : ↑s'), r1 ↑x ≤ 1) } S : Fin N → Set ↑s' S_disj : ∀ (i : Fin N), PairwiseDisjoint (S i) fun j => closedBall (BallPackage.c q j) (BallPackage.r q j) hS : range q.c ⊆ ⋃ (i : Fin N) (j : ↑s') (_ : j ∈ S i), ball (BallPackage.c q j) (BallPackage.r q j) S_count : ∀ (i : Fin N), Set.Countable (S i) r : α → ℝ := fun x => if x ∈ s' then r1 x else r0 x r_t0 : ∀ (x : α), x ∈ t0 → r x = r0 x A : ∑' (x : ↑t0), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ↑↑μ s + ε / 2 B : ∀ (i : Fin N), ∑' (x : ↑(Subtype.val '' S i)), ↑↑μ (closedBall (↑x) (r ↑x)) ≤ ε / 2 / ↑N ⊢ ↑↑μ s + ε / 2 + ε / 2 = ↑↑μ s + ε [PROOFSTEP] rw [add_assoc, ENNReal.add_halves] [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ ⊢ ∀ (x : α) (a : Set α), a ∈ (fun x => (fun r => closedBall x r) '' Ioi 0) x → MeasurableSet a [PROOFSTEP] intro x y hy [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ x : α y : Set α hy : y ∈ (fun x => (fun r => closedBall x r) '' Ioi 0) x ⊢ MeasurableSet y [PROOFSTEP] obtain ⟨r, _, rfl⟩ : ∃ r : ℝ, 0 < r ∧ closedBall x r = y := by simpa only [mem_image, mem_Ioi] using hy [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ x : α y : Set α hy : y ∈ (fun x => (fun r => closedBall x r) '' Ioi 0) x ⊢ ∃ r, 0 < r ∧ closedBall x r = y [PROOFSTEP] simpa only [mem_image, mem_Ioi] using hy [GOAL] case intro.intro α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ x : α r : ℝ left✝ : 0 < r hy : closedBall x r ∈ (fun x => (fun r => closedBall x r) '' Ioi 0) x ⊢ MeasurableSet (closedBall x r) [PROOFSTEP] exact isClosed_ball.measurableSet [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ ⊢ ∀ (x : α) (y : Set α), y ∈ (fun x => (fun r => closedBall x r) '' Ioi 0) x → Set.Nonempty (interior y) [PROOFSTEP] intro x y hy [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ x : α y : Set α hy : y ∈ (fun x => (fun r => closedBall x r) '' Ioi 0) x ⊢ Set.Nonempty (interior y) [PROOFSTEP] obtain ⟨r, rpos, rfl⟩ : ∃ r : ℝ, 0 < r ∧ closedBall x r = y := by simpa only [mem_image, mem_Ioi] using hy [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ x : α y : Set α hy : y ∈ (fun x => (fun r => closedBall x r) '' Ioi 0) x ⊢ ∃ r, 0 < r ∧ closedBall x r = y [PROOFSTEP] simpa only [mem_image, mem_Ioi] using hy [GOAL] case intro.intro α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ x : α r : ℝ rpos : 0 < r hy : closedBall x r ∈ (fun x => (fun r => closedBall x r) '' Ioi 0) x ⊢ Set.Nonempty (interior (closedBall x r)) [PROOFSTEP] simp only [Nonempty.mono ball_subset_interior_closedBall, rpos, nonempty_ball] [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ ⊢ ∀ (s : Set α) (f : α → Set (Set α)), (∀ (x : α), x ∈ s → f x ⊆ (fun x => (fun r => closedBall x r) '' Ioi 0) x) → (∀ (x : α), x ∈ s → ∀ (ε : ℝ), ε > 0 → ∃ a, a ∈ f x ∧ a ⊆ closedBall x ε) → ∃ t, (∀ (p : α × Set α), p ∈ t → p.fst ∈ s) ∧ (PairwiseDisjoint t fun p => p.snd) ∧ (∀ (p : α × Set α), p ∈ t → p.snd ∈ f p.fst) ∧ ↑↑μ (s \ ⋃ (p : α × Set α) (_ : p ∈ t), p.snd) = 0 [PROOFSTEP] intro s f fsubset ffine [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ s : Set α f : α → Set (Set α) fsubset : ∀ (x : α), x ∈ s → f x ⊆ (fun x => (fun r => closedBall x r) '' Ioi 0) x ffine : ∀ (x : α), x ∈ s → ∀ (ε : ℝ), ε > 0 → ∃ a, a ∈ f x ∧ a ⊆ closedBall x ε ⊢ ∃ t, (∀ (p : α × Set α), p ∈ t → p.fst ∈ s) ∧ (PairwiseDisjoint t fun p => p.snd) ∧ (∀ (p : α × Set α), p ∈ t → p.snd ∈ f p.fst) ∧ ↑↑μ (s \ ⋃ (p : α × Set α) (_ : p ∈ t), p.snd) = 0 [PROOFSTEP] let g : α → Set ℝ := fun x => {r | 0 < r ∧ closedBall x r ∈ f x} [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ s : Set α f : α → Set (Set α) fsubset : ∀ (x : α), x ∈ s → f x ⊆ (fun x => (fun r => closedBall x r) '' Ioi 0) x ffine : ∀ (x : α), x ∈ s → ∀ (ε : ℝ), ε > 0 → ∃ a, a ∈ f x ∧ a ⊆ closedBall x ε g : α → Set ℝ := fun x => {r | 0 < r ∧ closedBall x r ∈ f x} ⊢ ∃ t, (∀ (p : α × Set α), p ∈ t → p.fst ∈ s) ∧ (PairwiseDisjoint t fun p => p.snd) ∧ (∀ (p : α × Set α), p ∈ t → p.snd ∈ f p.fst) ∧ ↑↑μ (s \ ⋃ (p : α × Set α) (_ : p ∈ t), p.snd) = 0 [PROOFSTEP] have A : ∀ x ∈ s, ∀ δ > 0, (g x ∩ Ioo 0 δ).Nonempty := by intro x xs δ δpos obtain ⟨t, tf, ht⟩ : ∃ (t : Set α), t ∈ f x ∧ t ⊆ closedBall x (δ / 2) := ffine x xs (δ / 2) (half_pos δpos) obtain ⟨r, rpos, rfl⟩ : ∃ r : ℝ, 0 < r ∧ closedBall x r = t := by simpa using fsubset x xs tf rcases le_total r (δ / 2) with (H | H) · exact ⟨r, ⟨rpos, tf⟩, ⟨rpos, H.trans_lt (half_lt_self δpos)⟩⟩ · have : closedBall x r = closedBall x (δ / 2) := Subset.antisymm ht (closedBall_subset_closedBall H) rw [this] at tf refine' ⟨δ / 2, ⟨half_pos δpos, tf⟩, ⟨half_pos δpos, half_lt_self δpos⟩⟩ [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ s : Set α f : α → Set (Set α) fsubset : ∀ (x : α), x ∈ s → f x ⊆ (fun x => (fun r => closedBall x r) '' Ioi 0) x ffine : ∀ (x : α), x ∈ s → ∀ (ε : ℝ), ε > 0 → ∃ a, a ∈ f x ∧ a ⊆ closedBall x ε g : α → Set ℝ := fun x => {r | 0 < r ∧ closedBall x r ∈ f x} ⊢ ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) [PROOFSTEP] intro x xs δ δpos [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ s : Set α f : α → Set (Set α) fsubset : ∀ (x : α), x ∈ s → f x ⊆ (fun x => (fun r => closedBall x r) '' Ioi 0) x ffine : ∀ (x : α), x ∈ s → ∀ (ε : ℝ), ε > 0 → ∃ a, a ∈ f x ∧ a ⊆ closedBall x ε g : α → Set ℝ := fun x => {r | 0 < r ∧ closedBall x r ∈ f x} x : α xs : x ∈ s δ : ℝ δpos : δ > 0 ⊢ Set.Nonempty (g x ∩ Ioo 0 δ) [PROOFSTEP] obtain ⟨t, tf, ht⟩ : ∃ (t : Set α), t ∈ f x ∧ t ⊆ closedBall x (δ / 2) := ffine x xs (δ / 2) (half_pos δpos) [GOAL] case intro.intro α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ s : Set α f : α → Set (Set α) fsubset : ∀ (x : α), x ∈ s → f x ⊆ (fun x => (fun r => closedBall x r) '' Ioi 0) x ffine : ∀ (x : α), x ∈ s → ∀ (ε : ℝ), ε > 0 → ∃ a, a ∈ f x ∧ a ⊆ closedBall x ε g : α → Set ℝ := fun x => {r | 0 < r ∧ closedBall x r ∈ f x} x : α xs : x ∈ s δ : ℝ δpos : δ > 0 t : Set α tf : t ∈ f x ht : t ⊆ closedBall x (δ / 2) ⊢ Set.Nonempty (g x ∩ Ioo 0 δ) [PROOFSTEP] obtain ⟨r, rpos, rfl⟩ : ∃ r : ℝ, 0 < r ∧ closedBall x r = t := by simpa using fsubset x xs tf [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ s : Set α f : α → Set (Set α) fsubset : ∀ (x : α), x ∈ s → f x ⊆ (fun x => (fun r => closedBall x r) '' Ioi 0) x ffine : ∀ (x : α), x ∈ s → ∀ (ε : ℝ), ε > 0 → ∃ a, a ∈ f x ∧ a ⊆ closedBall x ε g : α → Set ℝ := fun x => {r | 0 < r ∧ closedBall x r ∈ f x} x : α xs : x ∈ s δ : ℝ δpos : δ > 0 t : Set α tf : t ∈ f x ht : t ⊆ closedBall x (δ / 2) ⊢ ∃ r, 0 < r ∧ closedBall x r = t [PROOFSTEP] simpa using fsubset x xs tf [GOAL] case intro.intro.intro.intro α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ s : Set α f : α → Set (Set α) fsubset : ∀ (x : α), x ∈ s → f x ⊆ (fun x => (fun r => closedBall x r) '' Ioi 0) x ffine : ∀ (x : α), x ∈ s → ∀ (ε : ℝ), ε > 0 → ∃ a, a ∈ f x ∧ a ⊆ closedBall x ε g : α → Set ℝ := fun x => {r | 0 < r ∧ closedBall x r ∈ f x} x : α xs : x ∈ s δ : ℝ δpos : δ > 0 r : ℝ rpos : 0 < r tf : closedBall x r ∈ f x ht : closedBall x r ⊆ closedBall x (δ / 2) ⊢ Set.Nonempty (g x ∩ Ioo 0 δ) [PROOFSTEP] rcases le_total r (δ / 2) with (H | H) [GOAL] case intro.intro.intro.intro.inl α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ s : Set α f : α → Set (Set α) fsubset : ∀ (x : α), x ∈ s → f x ⊆ (fun x => (fun r => closedBall x r) '' Ioi 0) x ffine : ∀ (x : α), x ∈ s → ∀ (ε : ℝ), ε > 0 → ∃ a, a ∈ f x ∧ a ⊆ closedBall x ε g : α → Set ℝ := fun x => {r | 0 < r ∧ closedBall x r ∈ f x} x : α xs : x ∈ s δ : ℝ δpos : δ > 0 r : ℝ rpos : 0 < r tf : closedBall x r ∈ f x ht : closedBall x r ⊆ closedBall x (δ / 2) H : r ≤ δ / 2 ⊢ Set.Nonempty (g x ∩ Ioo 0 δ) [PROOFSTEP] exact ⟨r, ⟨rpos, tf⟩, ⟨rpos, H.trans_lt (half_lt_self δpos)⟩⟩ [GOAL] case intro.intro.intro.intro.inr α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ s : Set α f : α → Set (Set α) fsubset : ∀ (x : α), x ∈ s → f x ⊆ (fun x => (fun r => closedBall x r) '' Ioi 0) x ffine : ∀ (x : α), x ∈ s → ∀ (ε : ℝ), ε > 0 → ∃ a, a ∈ f x ∧ a ⊆ closedBall x ε g : α → Set ℝ := fun x => {r | 0 < r ∧ closedBall x r ∈ f x} x : α xs : x ∈ s δ : ℝ δpos : δ > 0 r : ℝ rpos : 0 < r tf : closedBall x r ∈ f x ht : closedBall x r ⊆ closedBall x (δ / 2) H : δ / 2 ≤ r ⊢ Set.Nonempty (g x ∩ Ioo 0 δ) [PROOFSTEP] have : closedBall x r = closedBall x (δ / 2) := Subset.antisymm ht (closedBall_subset_closedBall H) [GOAL] case intro.intro.intro.intro.inr α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ s : Set α f : α → Set (Set α) fsubset : ∀ (x : α), x ∈ s → f x ⊆ (fun x => (fun r => closedBall x r) '' Ioi 0) x ffine : ∀ (x : α), x ∈ s → ∀ (ε : ℝ), ε > 0 → ∃ a, a ∈ f x ∧ a ⊆ closedBall x ε g : α → Set ℝ := fun x => {r | 0 < r ∧ closedBall x r ∈ f x} x : α xs : x ∈ s δ : ℝ δpos : δ > 0 r : ℝ rpos : 0 < r tf : closedBall x r ∈ f x ht : closedBall x r ⊆ closedBall x (δ / 2) H : δ / 2 ≤ r this : closedBall x r = closedBall x (δ / 2) ⊢ Set.Nonempty (g x ∩ Ioo 0 δ) [PROOFSTEP] rw [this] at tf [GOAL] case intro.intro.intro.intro.inr α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ s : Set α f : α → Set (Set α) fsubset : ∀ (x : α), x ∈ s → f x ⊆ (fun x => (fun r => closedBall x r) '' Ioi 0) x ffine : ∀ (x : α), x ∈ s → ∀ (ε : ℝ), ε > 0 → ∃ a, a ∈ f x ∧ a ⊆ closedBall x ε g : α → Set ℝ := fun x => {r | 0 < r ∧ closedBall x r ∈ f x} x : α xs : x ∈ s δ : ℝ δpos : δ > 0 r : ℝ rpos : 0 < r tf : closedBall x (δ / 2) ∈ f x ht : closedBall x r ⊆ closedBall x (δ / 2) H : δ / 2 ≤ r this : closedBall x r = closedBall x (δ / 2) ⊢ Set.Nonempty (g x ∩ Ioo 0 δ) [PROOFSTEP] refine' ⟨δ / 2, ⟨half_pos δpos, tf⟩, ⟨half_pos δpos, half_lt_self δpos⟩⟩ [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ s : Set α f : α → Set (Set α) fsubset : ∀ (x : α), x ∈ s → f x ⊆ (fun x => (fun r => closedBall x r) '' Ioi 0) x ffine : ∀ (x : α), x ∈ s → ∀ (ε : ℝ), ε > 0 → ∃ a, a ∈ f x ∧ a ⊆ closedBall x ε g : α → Set ℝ := fun x => {r | 0 < r ∧ closedBall x r ∈ f x} A : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) ⊢ ∃ t, (∀ (p : α × Set α), p ∈ t → p.fst ∈ s) ∧ (PairwiseDisjoint t fun p => p.snd) ∧ (∀ (p : α × Set α), p ∈ t → p.snd ∈ f p.fst) ∧ ↑↑μ (s \ ⋃ (p : α × Set α) (_ : p ∈ t), p.snd) = 0 [PROOFSTEP] obtain ⟨t, r, _, ts, tg, μt, tdisj⟩ : ∃ (t : Set α) (r : α → ℝ), t.Countable ∧ t ⊆ s ∧ (∀ x ∈ t, r x ∈ g x ∩ Ioo 0 1) ∧ μ (s \ ⋃ x ∈ t, closedBall x (r x)) = 0 ∧ t.PairwiseDisjoint fun x => closedBall x (r x) := exists_disjoint_closedBall_covering_ae μ g s A (fun _ => 1) fun _ _ => zero_lt_one [GOAL] case intro.intro.intro.intro.intro.intro α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ s : Set α f : α → Set (Set α) fsubset : ∀ (x : α), x ∈ s → f x ⊆ (fun x => (fun r => closedBall x r) '' Ioi 0) x ffine : ∀ (x : α), x ∈ s → ∀ (ε : ℝ), ε > 0 → ∃ a, a ∈ f x ∧ a ⊆ closedBall x ε g : α → Set ℝ := fun x => {r | 0 < r ∧ closedBall x r ∈ f x} A : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) t : Set α r : α → ℝ left✝ : Set.Countable t ts : t ⊆ s tg : ∀ (x : α), x ∈ t → r x ∈ g x ∩ Ioo 0 1 μt : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x)) = 0 tdisj : PairwiseDisjoint t fun x => closedBall x (r x) ⊢ ∃ t, (∀ (p : α × Set α), p ∈ t → p.fst ∈ s) ∧ (PairwiseDisjoint t fun p => p.snd) ∧ (∀ (p : α × Set α), p ∈ t → p.snd ∈ f p.fst) ∧ ↑↑μ (s \ ⋃ (p : α × Set α) (_ : p ∈ t), p.snd) = 0 [PROOFSTEP] let F : α → α × Set α := fun x => (x, closedBall x (r x)) [GOAL] case intro.intro.intro.intro.intro.intro α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ s : Set α f : α → Set (Set α) fsubset : ∀ (x : α), x ∈ s → f x ⊆ (fun x => (fun r => closedBall x r) '' Ioi 0) x ffine : ∀ (x : α), x ∈ s → ∀ (ε : ℝ), ε > 0 → ∃ a, a ∈ f x ∧ a ⊆ closedBall x ε g : α → Set ℝ := fun x => {r | 0 < r ∧ closedBall x r ∈ f x} A : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) t : Set α r : α → ℝ left✝ : Set.Countable t ts : t ⊆ s tg : ∀ (x : α), x ∈ t → r x ∈ g x ∩ Ioo 0 1 μt : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x)) = 0 tdisj : PairwiseDisjoint t fun x => closedBall x (r x) F : α → α × Set α := fun x => (x, closedBall x (r x)) ⊢ ∃ t, (∀ (p : α × Set α), p ∈ t → p.fst ∈ s) ∧ (PairwiseDisjoint t fun p => p.snd) ∧ (∀ (p : α × Set α), p ∈ t → p.snd ∈ f p.fst) ∧ ↑↑μ (s \ ⋃ (p : α × Set α) (_ : p ∈ t), p.snd) = 0 [PROOFSTEP] refine' ⟨F '' t, _, _, _, _⟩ [GOAL] case intro.intro.intro.intro.intro.intro.refine'_1 α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ s : Set α f : α → Set (Set α) fsubset : ∀ (x : α), x ∈ s → f x ⊆ (fun x => (fun r => closedBall x r) '' Ioi 0) x ffine : ∀ (x : α), x ∈ s → ∀ (ε : ℝ), ε > 0 → ∃ a, a ∈ f x ∧ a ⊆ closedBall x ε g : α → Set ℝ := fun x => {r | 0 < r ∧ closedBall x r ∈ f x} A : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) t : Set α r : α → ℝ left✝ : Set.Countable t ts : t ⊆ s tg : ∀ (x : α), x ∈ t → r x ∈ g x ∩ Ioo 0 1 μt : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x)) = 0 tdisj : PairwiseDisjoint t fun x => closedBall x (r x) F : α → α × Set α := fun x => (x, closedBall x (r x)) ⊢ ∀ (p : α × Set α), p ∈ F '' t → p.fst ∈ s [PROOFSTEP] rintro - ⟨x, hx, rfl⟩ [GOAL] case intro.intro.intro.intro.intro.intro.refine'_1.intro.intro α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ s : Set α f : α → Set (Set α) fsubset : ∀ (x : α), x ∈ s → f x ⊆ (fun x => (fun r => closedBall x r) '' Ioi 0) x ffine : ∀ (x : α), x ∈ s → ∀ (ε : ℝ), ε > 0 → ∃ a, a ∈ f x ∧ a ⊆ closedBall x ε g : α → Set ℝ := fun x => {r | 0 < r ∧ closedBall x r ∈ f x} A : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) t : Set α r : α → ℝ left✝ : Set.Countable t ts : t ⊆ s tg : ∀ (x : α), x ∈ t → r x ∈ g x ∩ Ioo 0 1 μt : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x)) = 0 tdisj : PairwiseDisjoint t fun x => closedBall x (r x) F : α → α × Set α := fun x => (x, closedBall x (r x)) x : α hx : x ∈ t ⊢ (F x).fst ∈ s [PROOFSTEP] exact ts hx [GOAL] case intro.intro.intro.intro.intro.intro.refine'_2 α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ s : Set α f : α → Set (Set α) fsubset : ∀ (x : α), x ∈ s → f x ⊆ (fun x => (fun r => closedBall x r) '' Ioi 0) x ffine : ∀ (x : α), x ∈ s → ∀ (ε : ℝ), ε > 0 → ∃ a, a ∈ f x ∧ a ⊆ closedBall x ε g : α → Set ℝ := fun x => {r | 0 < r ∧ closedBall x r ∈ f x} A : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) t : Set α r : α → ℝ left✝ : Set.Countable t ts : t ⊆ s tg : ∀ (x : α), x ∈ t → r x ∈ g x ∩ Ioo 0 1 μt : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x)) = 0 tdisj : PairwiseDisjoint t fun x => closedBall x (r x) F : α → α × Set α := fun x => (x, closedBall x (r x)) ⊢ PairwiseDisjoint (F '' t) fun p => p.snd [PROOFSTEP] rintro p ⟨x, hx, rfl⟩ q ⟨y, hy, rfl⟩ hxy [GOAL] case intro.intro.intro.intro.intro.intro.refine'_2.intro.intro.intro.intro α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ s : Set α f : α → Set (Set α) fsubset : ∀ (x : α), x ∈ s → f x ⊆ (fun x => (fun r => closedBall x r) '' Ioi 0) x ffine : ∀ (x : α), x ∈ s → ∀ (ε : ℝ), ε > 0 → ∃ a, a ∈ f x ∧ a ⊆ closedBall x ε g : α → Set ℝ := fun x => {r | 0 < r ∧ closedBall x r ∈ f x} A : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) t : Set α r : α → ℝ left✝ : Set.Countable t ts : t ⊆ s tg : ∀ (x : α), x ∈ t → r x ∈ g x ∩ Ioo 0 1 μt : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x)) = 0 tdisj : PairwiseDisjoint t fun x => closedBall x (r x) F : α → α × Set α := fun x => (x, closedBall x (r x)) x : α hx : x ∈ t y : α hy : y ∈ t hxy : F x ≠ F y ⊢ (Disjoint on fun p => p.snd) (F x) (F y) [PROOFSTEP] exact tdisj hx hy (ne_of_apply_ne F hxy) [GOAL] case intro.intro.intro.intro.intro.intro.refine'_3 α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ s : Set α f : α → Set (Set α) fsubset : ∀ (x : α), x ∈ s → f x ⊆ (fun x => (fun r => closedBall x r) '' Ioi 0) x ffine : ∀ (x : α), x ∈ s → ∀ (ε : ℝ), ε > 0 → ∃ a, a ∈ f x ∧ a ⊆ closedBall x ε g : α → Set ℝ := fun x => {r | 0 < r ∧ closedBall x r ∈ f x} A : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) t : Set α r : α → ℝ left✝ : Set.Countable t ts : t ⊆ s tg : ∀ (x : α), x ∈ t → r x ∈ g x ∩ Ioo 0 1 μt : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x)) = 0 tdisj : PairwiseDisjoint t fun x => closedBall x (r x) F : α → α × Set α := fun x => (x, closedBall x (r x)) ⊢ ∀ (p : α × Set α), p ∈ F '' t → p.snd ∈ f p.fst [PROOFSTEP] rintro - ⟨x, hx, rfl⟩ [GOAL] case intro.intro.intro.intro.intro.intro.refine'_3.intro.intro α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ s : Set α f : α → Set (Set α) fsubset : ∀ (x : α), x ∈ s → f x ⊆ (fun x => (fun r => closedBall x r) '' Ioi 0) x ffine : ∀ (x : α), x ∈ s → ∀ (ε : ℝ), ε > 0 → ∃ a, a ∈ f x ∧ a ⊆ closedBall x ε g : α → Set ℝ := fun x => {r | 0 < r ∧ closedBall x r ∈ f x} A : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) t : Set α r : α → ℝ left✝ : Set.Countable t ts : t ⊆ s tg : ∀ (x : α), x ∈ t → r x ∈ g x ∩ Ioo 0 1 μt : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x)) = 0 tdisj : PairwiseDisjoint t fun x => closedBall x (r x) F : α → α × Set α := fun x => (x, closedBall x (r x)) x : α hx : x ∈ t ⊢ (F x).snd ∈ f (F x).fst [PROOFSTEP] exact (tg x hx).1.2 [GOAL] case intro.intro.intro.intro.intro.intro.refine'_4 α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ s : Set α f : α → Set (Set α) fsubset : ∀ (x : α), x ∈ s → f x ⊆ (fun x => (fun r => closedBall x r) '' Ioi 0) x ffine : ∀ (x : α), x ∈ s → ∀ (ε : ℝ), ε > 0 → ∃ a, a ∈ f x ∧ a ⊆ closedBall x ε g : α → Set ℝ := fun x => {r | 0 < r ∧ closedBall x r ∈ f x} A : ∀ (x : α), x ∈ s → ∀ (δ : ℝ), δ > 0 → Set.Nonempty (g x ∩ Ioo 0 δ) t : Set α r : α → ℝ left✝ : Set.Countable t ts : t ⊆ s tg : ∀ (x : α), x ∈ t → r x ∈ g x ∩ Ioo 0 1 μt : ↑↑μ (s \ ⋃ (x : α) (_ : x ∈ t), closedBall x (r x)) = 0 tdisj : PairwiseDisjoint t fun x => closedBall x (r x) F : α → α × Set α := fun x => (x, closedBall x (r x)) ⊢ ↑↑μ (s \ ⋃ (p : α × Set α) (_ : p ∈ F '' t), p.snd) = 0 [PROOFSTEP] rwa [biUnion_image] [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ x : α ⊢ Tendsto (fun r => closedBall x r) (𝓝[Ioi 0] 0) (VitaliFamily.filterAt (Besicovitch.vitaliFamily μ) x) [PROOFSTEP] intro s hs [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ x : α s : Set (Set α) hs : s ∈ VitaliFamily.filterAt (Besicovitch.vitaliFamily μ) x ⊢ s ∈ map (fun r => closedBall x r) (𝓝[Ioi 0] 0) [PROOFSTEP] simp only [mem_map] [GOAL] α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ x : α s : Set (Set α) hs : s ∈ VitaliFamily.filterAt (Besicovitch.vitaliFamily μ) x ⊢ (fun r => closedBall x r) ⁻¹' s ∈ 𝓝[Ioi 0] 0 [PROOFSTEP] obtain ⟨ε, εpos, hε⟩ : ∃ (ε : ℝ), ε > 0 ∧ ∀ a : Set α, a ∈ (Besicovitch.vitaliFamily μ).setsAt x → a ⊆ closedBall x ε → a ∈ s := (VitaliFamily.mem_filterAt_iff _).1 hs [GOAL] case intro.intro α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ x : α s : Set (Set α) hs : s ∈ VitaliFamily.filterAt (Besicovitch.vitaliFamily μ) x ε : ℝ εpos : ε > 0 hε : ∀ (a : Set α), a ∈ VitaliFamily.setsAt (Besicovitch.vitaliFamily μ) x → a ⊆ closedBall x ε → a ∈ s ⊢ (fun r => closedBall x r) ⁻¹' s ∈ 𝓝[Ioi 0] 0 [PROOFSTEP] have : Ioc (0 : ℝ) ε ∈ 𝓝[>] (0 : ℝ) := Ioc_mem_nhdsWithin_Ioi ⟨le_rfl, εpos⟩ [GOAL] case intro.intro α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ x : α s : Set (Set α) hs : s ∈ VitaliFamily.filterAt (Besicovitch.vitaliFamily μ) x ε : ℝ εpos : ε > 0 hε : ∀ (a : Set α), a ∈ VitaliFamily.setsAt (Besicovitch.vitaliFamily μ) x → a ⊆ closedBall x ε → a ∈ s this : Ioc 0 ε ∈ 𝓝[Ioi 0] 0 ⊢ (fun r => closedBall x r) ⁻¹' s ∈ 𝓝[Ioi 0] 0 [PROOFSTEP] filter_upwards [this] with _ hr [GOAL] case h α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ x : α s : Set (Set α) hs : s ∈ VitaliFamily.filterAt (Besicovitch.vitaliFamily μ) x ε : ℝ εpos : ε > 0 hε : ∀ (a : Set α), a ∈ VitaliFamily.setsAt (Besicovitch.vitaliFamily μ) x → a ⊆ closedBall x ε → a ∈ s this : Ioc 0 ε ∈ 𝓝[Ioi 0] 0 a✝ : ℝ hr : a✝ ∈ Ioc 0 ε ⊢ a✝ ∈ (fun r => closedBall x r) ⁻¹' s [PROOFSTEP] apply hε [GOAL] case h.a α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ x : α s : Set (Set α) hs : s ∈ VitaliFamily.filterAt (Besicovitch.vitaliFamily μ) x ε : ℝ εpos : ε > 0 hε : ∀ (a : Set α), a ∈ VitaliFamily.setsAt (Besicovitch.vitaliFamily μ) x → a ⊆ closedBall x ε → a ∈ s this : Ioc 0 ε ∈ 𝓝[Ioi 0] 0 a✝ : ℝ hr : a✝ ∈ Ioc 0 ε ⊢ (fun r => closedBall x r) a✝ ∈ VitaliFamily.setsAt (Besicovitch.vitaliFamily μ) x [PROOFSTEP] exact mem_image_of_mem _ hr.1 [GOAL] case h.a α : Type u_1 inst✝⁵ : MetricSpace α β : Type u inst✝⁴ : SecondCountableTopology α inst✝³ : MeasurableSpace α inst✝² : OpensMeasurableSpace α inst✝¹ : HasBesicovitchCovering α μ : Measure α inst✝ : SigmaFinite μ x : α s : Set (Set α) hs : s ∈ VitaliFamily.filterAt (Besicovitch.vitaliFamily μ) x ε : ℝ εpos : ε > 0 hε : ∀ (a : Set α), a ∈ VitaliFamily.setsAt (Besicovitch.vitaliFamily μ) x → a ⊆ closedBall x ε → a ∈ s this : Ioc 0 ε ∈ 𝓝[Ioi 0] 0 a✝ : ℝ hr : a✝ ∈ Ioc 0 ε ⊢ (fun r => closedBall x r) a✝ ⊆ closedBall x ε [PROOFSTEP] exact closedBall_subset_closedBall hr.2 [GOAL] α : Type u_1 inst✝¹¹ : MetricSpace α β : Type u inst✝¹⁰ : SecondCountableTopology α inst✝⁹ : MeasurableSpace α inst✝⁸ : OpensMeasurableSpace α inst✝⁷ : HasBesicovitchCovering α inst✝⁶ : MetricSpace β inst✝⁵ : MeasurableSpace β inst✝⁴ : BorelSpace β inst✝³ : SecondCountableTopology β inst✝² : HasBesicovitchCovering β ρ μ : Measure β inst✝¹ : IsLocallyFiniteMeasure μ inst✝ : IsLocallyFiniteMeasure ρ ⊢ ∀ᵐ (x : β) ∂μ, Tendsto (fun r => ↑↑ρ (closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 (Measure.rnDeriv ρ μ x)) [PROOFSTEP] filter_upwards [VitaliFamily.ae_tendsto_rnDeriv (Besicovitch.vitaliFamily μ) ρ] with x hx [GOAL] case h α : Type u_1 inst✝¹¹ : MetricSpace α β : Type u inst✝¹⁰ : SecondCountableTopology α inst✝⁹ : MeasurableSpace α inst✝⁸ : OpensMeasurableSpace α inst✝⁷ : HasBesicovitchCovering α inst✝⁶ : MetricSpace β inst✝⁵ : MeasurableSpace β inst✝⁴ : BorelSpace β inst✝³ : SecondCountableTopology β inst✝² : HasBesicovitchCovering β ρ μ : Measure β inst✝¹ : IsLocallyFiniteMeasure μ inst✝ : IsLocallyFiniteMeasure ρ x : β hx : Tendsto (fun a => ↑↑ρ a / ↑↑μ a) (VitaliFamily.filterAt (Besicovitch.vitaliFamily μ) x) (𝓝 (Measure.rnDeriv ρ μ x)) ⊢ Tendsto (fun r => ↑↑ρ (closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 (Measure.rnDeriv ρ μ x)) [PROOFSTEP] exact hx.comp (tendsto_filterAt μ x) [GOAL] α : Type u_1 inst✝¹⁰ : MetricSpace α β : Type u inst✝⁹ : SecondCountableTopology α inst✝⁸ : MeasurableSpace α inst✝⁷ : OpensMeasurableSpace α inst✝⁶ : HasBesicovitchCovering α inst✝⁵ : MetricSpace β inst✝⁴ : MeasurableSpace β inst✝³ : BorelSpace β inst✝² : SecondCountableTopology β inst✝¹ : HasBesicovitchCovering β μ : Measure β inst✝ : IsLocallyFiniteMeasure μ s : Set β hs : MeasurableSet s ⊢ ∀ᵐ (x : β) ∂μ, Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 (indicator s 1 x)) [PROOFSTEP] filter_upwards [VitaliFamily.ae_tendsto_measure_inter_div_of_measurableSet (Besicovitch.vitaliFamily μ) hs] [GOAL] case h α : Type u_1 inst✝¹⁰ : MetricSpace α β : Type u inst✝⁹ : SecondCountableTopology α inst✝⁸ : MeasurableSpace α inst✝⁷ : OpensMeasurableSpace α inst✝⁶ : HasBesicovitchCovering α inst✝⁵ : MetricSpace β inst✝⁴ : MeasurableSpace β inst✝³ : BorelSpace β inst✝² : SecondCountableTopology β inst✝¹ : HasBesicovitchCovering β μ : Measure β inst✝ : IsLocallyFiniteMeasure μ s : Set β hs : MeasurableSet s ⊢ ∀ (a : β), Tendsto (fun a => ↑↑μ (s ∩ a) / ↑↑μ a) (VitaliFamily.filterAt (Besicovitch.vitaliFamily μ) a) (𝓝 (indicator s 1 a)) → Tendsto (fun r => ↑↑μ (s ∩ closedBall a r) / ↑↑μ (closedBall a r)) (𝓝[Ioi 0] 0) (𝓝 (indicator s 1 a)) [PROOFSTEP] intro x hx [GOAL] case h α : Type u_1 inst✝¹⁰ : MetricSpace α β : Type u inst✝⁹ : SecondCountableTopology α inst✝⁸ : MeasurableSpace α inst✝⁷ : OpensMeasurableSpace α inst✝⁶ : HasBesicovitchCovering α inst✝⁵ : MetricSpace β inst✝⁴ : MeasurableSpace β inst✝³ : BorelSpace β inst✝² : SecondCountableTopology β inst✝¹ : HasBesicovitchCovering β μ : Measure β inst✝ : IsLocallyFiniteMeasure μ s : Set β hs : MeasurableSet s x : β hx : Tendsto (fun a => ↑↑μ (s ∩ a) / ↑↑μ a) (VitaliFamily.filterAt (Besicovitch.vitaliFamily μ) x) (𝓝 (indicator s 1 x)) ⊢ Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 (indicator s 1 x)) [PROOFSTEP] exact hx.comp (tendsto_filterAt μ x) [GOAL] α : Type u_1 inst✝¹⁰ : MetricSpace α β : Type u inst✝⁹ : SecondCountableTopology α inst✝⁸ : MeasurableSpace α inst✝⁷ : OpensMeasurableSpace α inst✝⁶ : HasBesicovitchCovering α inst✝⁵ : MetricSpace β inst✝⁴ : MeasurableSpace β inst✝³ : BorelSpace β inst✝² : SecondCountableTopology β inst✝¹ : HasBesicovitchCovering β μ : Measure β inst✝ : IsLocallyFiniteMeasure μ s : Set β ⊢ ∀ᵐ (x : β) ∂Measure.restrict μ s, Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1) [PROOFSTEP] filter_upwards [VitaliFamily.ae_tendsto_measure_inter_div (Besicovitch.vitaliFamily μ) s] with x hx using hx.comp (tendsto_filterAt μ x)
% TEST_MAXWELL_CUBE_H_DRCHLT: data function for Dirichlet boundary condition. function h = test_maxwell_cube_h_drchlt (x, y, z, ind) h = zeros ([3, size(x)]); switch (ind) case 1 h(2,:,:) = -exp(z) .* cos(x); h(3,:,:) = exp(x) .* cos(y); case 2 h(2,:,:) = exp(z) .* cos(x); h(3,:,:) = -exp(x) .* cos(y); case 3 h(1,:,:) = exp(z) .* cos(x); h(3,:,:) = -sin(y) .* z; case 4 h(1,:,:) = -exp(z) .* cos(x); h(3,:,:) = sin(y) .* z; case 5 h(1,:,:) = -exp(x) .* cos(y); h(2,:,:) = sin(y) .* z; case 6 h(1,:,:) = exp(x) .* cos(y); h(2,:,:) = -sin(y) .* z; otherwise error ('h_drchlt: unknown reference number') end end
/- Copyright (c) 2019 Zhouhang Zhou. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Zhouhang Zhou, Frédéric Dupuis, Heather Macbeth -/ import analysis.convex.basic import analysis.inner_product_space.basic import analysis.normed_space.is_R_or_C /-! # The orthogonal projection Given a nonempty complete subspace `K` of an inner product space `E`, this file constructs `orthogonal_projection K : E →L[𝕜] K`, the orthogonal projection of `E` onto `K`. This map satisfies: for any point `u` in `E`, the point `v = orthogonal_projection K u` in `K` minimizes the distance `∥u - v∥` to `u`. Also a linear isometry equivalence `reflection K : E ≃ₗᵢ[𝕜] E` is constructed, by choosing, for each `u : E`, the point `reflection K u` to satisfy `u + (reflection K u) = 2 • orthogonal_projection K u`. Basic API for `orthogonal_projection` and `reflection` is developed. Next, the orthogonal projection is used to prove a series of more subtle lemmas about the the orthogonal complement of complete subspaces of `E` (the orthogonal complement itself was defined in `analysis.inner_product_space.basic`); the lemma `submodule.sup_orthogonal_of_is_complete`, stating that for a complete subspace `K` of `E` we have `K ⊔ Kᗮ = ⊤`, is a typical example. The last section covers orthonormal bases, Hilbert bases, etc. The lemma `maximal_orthonormal_iff_dense_span`, whose proof requires the theory on the orthogonal complement developed earlier in this file, states that an orthonormal set in an inner product space is maximal, if and only if its span is dense (i.e., iff it is Hilbert basis, although we do not make that definition). Various consequences are stated, including that if `E` is finite-dimensional then a maximal orthonormal set is a basis (`maximal_orthonormal_iff_basis_of_finite_dimensional`). ## References The orthogonal projection construction is adapted from * [Clément & Martin, *The Lax-Milgram Theorem. A detailed proof to be formalized in Coq*] * [Clément & Martin, *A Coq formal proof of the Lax–Milgram theorem*] The Coq code is available at the following address: <http://www.lri.fr/~sboldo/elfic/index.html> -/ noncomputable theory open is_R_or_C real filter open_locale big_operators topological_space variables {𝕜 E F : Type*} [is_R_or_C 𝕜] variables [inner_product_space 𝕜 E] [inner_product_space ℝ F] local notation `⟪`x`, `y`⟫` := @inner 𝕜 E _ x y local notation `absR` := has_abs.abs /-! ### Orthogonal projection in inner product spaces -/ /-- Existence of minimizers Let `u` be a point in a real inner product space, and let `K` be a nonempty complete convex subset. Then there exists a (unique) `v` in `K` that minimizes the distance `∥u - v∥` to `u`. -/ -- FIXME this monolithic proof causes a deterministic timeout with `-T50000` -- It should be broken in a sequence of more manageable pieces, -- perhaps with individual statements for the three steps below. theorem exists_norm_eq_infi_of_complete_convex {K : set F} (ne : K.nonempty) (h₁ : is_complete K) (h₂ : convex ℝ K) : ∀ u : F, ∃ v ∈ K, ∥u - v∥ = ⨅ w : K, ∥u - w∥ := assume u, begin let δ := ⨅ w : K, ∥u - w∥, letI : nonempty K := ne.to_subtype, have zero_le_δ : 0 ≤ δ := le_cinfi (λ _, norm_nonneg _), have δ_le : ∀ w : K, δ ≤ ∥u - w∥, from cinfi_le ⟨0, set.forall_range_iff.2 $ λ _, norm_nonneg _⟩, have δ_le' : ∀ w ∈ K, δ ≤ ∥u - w∥ := assume w hw, δ_le ⟨w, hw⟩, -- Step 1: since `δ` is the infimum, can find a sequence `w : ℕ → K` in `K` -- such that `∥u - w n∥ < δ + 1 / (n + 1)` (which implies `∥u - w n∥ --> δ`); -- maybe this should be a separate lemma have exists_seq : ∃ w : ℕ → K, ∀ n, ∥u - w n∥ < δ + 1 / (n + 1), { have hδ : ∀n:ℕ, δ < δ + 1 / (n + 1), from λ n, lt_add_of_le_of_pos (le_refl _) nat.one_div_pos_of_nat, have h := λ n, exists_lt_of_cinfi_lt (hδ n), let w : ℕ → K := λ n, classical.some (h n), exact ⟨w, λ n, classical.some_spec (h n)⟩ }, rcases exists_seq with ⟨w, hw⟩, have norm_tendsto : tendsto (λ n, ∥u - w n∥) at_top (nhds δ), { have h : tendsto (λ n:ℕ, δ) at_top (nhds δ) := tendsto_const_nhds, have h' : tendsto (λ n:ℕ, δ + 1 / (n + 1)) at_top (nhds δ), { convert h.add tendsto_one_div_add_at_top_nhds_0_nat, simp only [add_zero] }, exact tendsto_of_tendsto_of_tendsto_of_le_of_le h h' (λ x, δ_le _) (λ x, le_of_lt (hw _)) }, -- Step 2: Prove that the sequence `w : ℕ → K` is a Cauchy sequence have seq_is_cauchy : cauchy_seq (λ n, ((w n):F)), { rw cauchy_seq_iff_le_tendsto_0, -- splits into three goals let b := λ n:ℕ, (8 * δ * (1/(n+1)) + 4 * (1/(n+1)) * (1/(n+1))), use (λn, sqrt (b n)), split, -- first goal : `∀ (n : ℕ), 0 ≤ sqrt (b n)` assume n, exact sqrt_nonneg _, split, -- second goal : `∀ (n m N : ℕ), N ≤ n → N ≤ m → dist ↑(w n) ↑(w m) ≤ sqrt (b N)` assume p q N hp hq, let wp := ((w p):F), let wq := ((w q):F), let a := u - wq, let b := u - wp, let half := 1 / (2:ℝ), let div := 1 / ((N:ℝ) + 1), have : 4 * ∥u - half • (wq + wp)∥ * ∥u - half • (wq + wp)∥ + ∥wp - wq∥ * ∥wp - wq∥ = 2 * (∥a∥ * ∥a∥ + ∥b∥ * ∥b∥) := calc 4 * ∥u - half•(wq + wp)∥ * ∥u - half•(wq + wp)∥ + ∥wp - wq∥ * ∥wp - wq∥ = (2*∥u - half•(wq + wp)∥) * (2 * ∥u - half•(wq + wp)∥) + ∥wp-wq∥*∥wp-wq∥ : by ring ... = (absR ((2:ℝ)) * ∥u - half•(wq + wp)∥) * (absR ((2:ℝ)) * ∥u - half•(wq+wp)∥) + ∥wp-wq∥*∥wp-wq∥ : by { rw _root_.abs_of_nonneg, exact zero_le_two } ... = ∥(2:ℝ) • (u - half • (wq + wp))∥ * ∥(2:ℝ) • (u - half • (wq + wp))∥ + ∥wp-wq∥ * ∥wp-wq∥ : by simp [norm_smul] ... = ∥a + b∥ * ∥a + b∥ + ∥a - b∥ * ∥a - b∥ : begin rw [smul_sub, smul_smul, mul_one_div_cancel (_root_.two_ne_zero : (2 : ℝ) ≠ 0), ← one_add_one_eq_two, add_smul], simp only [one_smul], have eq₁ : wp - wq = a - b, from (sub_sub_sub_cancel_left _ _ _).symm, have eq₂ : u + u - (wq + wp) = a + b, show u + u - (wq + wp) = (u - wq) + (u - wp), abel, rw [eq₁, eq₂], end ... = 2 * (∥a∥ * ∥a∥ + ∥b∥ * ∥b∥) : parallelogram_law_with_norm, have eq : δ ≤ ∥u - half • (wq + wp)∥, { rw smul_add, apply δ_le', apply h₂, repeat {exact subtype.mem _}, repeat {exact le_of_lt one_half_pos}, exact add_halves 1 }, have eq₁ : 4 * δ * δ ≤ 4 * ∥u - half • (wq + wp)∥ * ∥u - half • (wq + wp)∥, { mono, mono, norm_num, apply mul_nonneg, norm_num, exact norm_nonneg _ }, have eq₂ : ∥a∥ * ∥a∥ ≤ (δ + div) * (δ + div) := mul_self_le_mul_self (norm_nonneg _) (le_trans (le_of_lt $ hw q) (add_le_add_left (nat.one_div_le_one_div hq) _)), have eq₂' : ∥b∥ * ∥b∥ ≤ (δ + div) * (δ + div) := mul_self_le_mul_self (norm_nonneg _) (le_trans (le_of_lt $ hw p) (add_le_add_left (nat.one_div_le_one_div hp) _)), rw dist_eq_norm, apply nonneg_le_nonneg_of_sq_le_sq, { exact sqrt_nonneg _ }, rw mul_self_sqrt, calc ∥wp - wq∥ * ∥wp - wq∥ = 2 * (∥a∥*∥a∥ + ∥b∥*∥b∥) - 4 * ∥u - half • (wq+wp)∥ * ∥u - half • (wq+wp)∥ : by { rw ← this, simp } ... ≤ 2 * (∥a∥ * ∥a∥ + ∥b∥ * ∥b∥) - 4 * δ * δ : sub_le_sub_left eq₁ _ ... ≤ 2 * ((δ + div) * (δ + div) + (δ + div) * (δ + div)) - 4 * δ * δ : sub_le_sub_right (mul_le_mul_of_nonneg_left (add_le_add eq₂ eq₂') (by norm_num)) _ ... = 8 * δ * div + 4 * div * div : by ring, exact add_nonneg (mul_nonneg (mul_nonneg (by norm_num) zero_le_δ) (le_of_lt nat.one_div_pos_of_nat)) (mul_nonneg (mul_nonneg (by norm_num) nat.one_div_pos_of_nat.le) nat.one_div_pos_of_nat.le), -- third goal : `tendsto (λ (n : ℕ), sqrt (b n)) at_top (𝓝 0)` apply tendsto.comp, { convert continuous_sqrt.continuous_at, exact sqrt_zero.symm }, have eq₁ : tendsto (λ (n : ℕ), 8 * δ * (1 / (n + 1))) at_top (nhds (0:ℝ)), { convert (@tendsto_const_nhds _ _ _ (8 * δ) _).mul tendsto_one_div_add_at_top_nhds_0_nat, simp only [mul_zero] }, have : tendsto (λ (n : ℕ), (4:ℝ) * (1 / (n + 1))) at_top (nhds (0:ℝ)), { convert (@tendsto_const_nhds _ _ _ (4:ℝ) _).mul tendsto_one_div_add_at_top_nhds_0_nat, simp only [mul_zero] }, have eq₂ : tendsto (λ (n : ℕ), (4:ℝ) * (1 / (n + 1)) * (1 / (n + 1))) at_top (nhds (0:ℝ)), { convert this.mul tendsto_one_div_add_at_top_nhds_0_nat, simp only [mul_zero] }, convert eq₁.add eq₂, simp only [add_zero] }, -- Step 3: By completeness of `K`, let `w : ℕ → K` converge to some `v : K`. -- Prove that it satisfies all requirements. rcases cauchy_seq_tendsto_of_is_complete h₁ (λ n, _) seq_is_cauchy with ⟨v, hv, w_tendsto⟩, use v, use hv, have h_cont : continuous (λ v, ∥u - v∥) := continuous.comp continuous_norm (continuous.sub continuous_const continuous_id), have : tendsto (λ n, ∥u - w n∥) at_top (nhds ∥u - v∥), convert (tendsto.comp h_cont.continuous_at w_tendsto), exact tendsto_nhds_unique this norm_tendsto, exact subtype.mem _ end /-- Characterization of minimizers for the projection on a convex set in a real inner product space. -/ theorem norm_eq_infi_iff_real_inner_le_zero {K : set F} (h : convex ℝ K) {u : F} {v : F} (hv : v ∈ K) : ∥u - v∥ = (⨅ w : K, ∥u - w∥) ↔ ∀ w ∈ K, ⟪u - v, w - v⟫_ℝ ≤ 0 := iff.intro begin assume eq w hw, let δ := ⨅ w : K, ∥u - w∥, let p := ⟪u - v, w - v⟫_ℝ, let q := ∥w - v∥^2, letI : nonempty K := ⟨⟨v, hv⟩⟩, have zero_le_δ : 0 ≤ δ, apply le_cinfi, intro, exact norm_nonneg _, have δ_le : ∀ w : K, δ ≤ ∥u - w∥, assume w, apply cinfi_le, use (0:ℝ), rintros _ ⟨_, rfl⟩, exact norm_nonneg _, have δ_le' : ∀ w ∈ K, δ ≤ ∥u - w∥ := assume w hw, δ_le ⟨w, hw⟩, have : ∀θ:ℝ, 0 < θ → θ ≤ 1 → 2 * p ≤ θ * q, assume θ hθ₁ hθ₂, have : ∥u - v∥^2 ≤ ∥u - v∥^2 - 2 * θ * ⟪u - v, w - v⟫_ℝ + θ*θ*∥w - v∥^2 := calc ∥u - v∥^2 ≤ ∥u - (θ•w + (1-θ)•v)∥^2 : begin simp only [sq], apply mul_self_le_mul_self (norm_nonneg _), rw [eq], apply δ_le', apply h hw hv, exacts [le_of_lt hθ₁, sub_nonneg.2 hθ₂, add_sub_cancel'_right _ _], end ... = ∥(u - v) - θ • (w - v)∥^2 : begin have : u - (θ•w + (1-θ)•v) = (u - v) - θ • (w - v), { rw [smul_sub, sub_smul, one_smul], simp only [sub_eq_add_neg, add_comm, add_left_comm, add_assoc, neg_add_rev] }, rw this end ... = ∥u - v∥^2 - 2 * θ * inner (u - v) (w - v) + θ*θ*∥w - v∥^2 : begin rw [norm_sub_sq, inner_smul_right, norm_smul], simp only [sq], show ∥u-v∥*∥u-v∥-2*(θ*inner(u-v)(w-v))+absR (θ)*∥w-v∥*(absR (θ)*∥w-v∥)= ∥u-v∥*∥u-v∥-2*θ*inner(u-v)(w-v)+θ*θ*(∥w-v∥*∥w-v∥), rw abs_of_pos hθ₁, ring end, have eq₁ : ∥u-v∥^2-2*θ*inner(u-v)(w-v)+θ*θ*∥w-v∥^2=∥u-v∥^2+(θ*θ*∥w-v∥^2-2*θ*inner(u-v)(w-v)), by abel, rw [eq₁, le_add_iff_nonneg_right] at this, have eq₂ : θ*θ*∥w-v∥^2-2*θ*inner(u-v)(w-v)=θ*(θ*∥w-v∥^2-2*inner(u-v)(w-v)), ring, rw eq₂ at this, have := le_of_sub_nonneg (nonneg_of_mul_nonneg_left this hθ₁), exact this, by_cases hq : q = 0, { rw hq at this, have : p ≤ 0, have := this (1:ℝ) (by norm_num) (by norm_num), linarith, exact this }, { have q_pos : 0 < q, apply lt_of_le_of_ne, exact sq_nonneg _, intro h, exact hq h.symm, by_contradiction hp, rw not_le at hp, let θ := min (1:ℝ) (p / q), have eq₁ : θ*q ≤ p := calc θ*q ≤ (p/q) * q : mul_le_mul_of_nonneg_right (min_le_right _ _) (sq_nonneg _) ... = p : div_mul_cancel _ hq, have : 2 * p ≤ p := calc 2 * p ≤ θ*q : by { refine this θ (lt_min (by norm_num) (div_pos hp q_pos)) (by norm_num) } ... ≤ p : eq₁, linarith } end begin assume h, letI : nonempty K := ⟨⟨v, hv⟩⟩, apply le_antisymm, { apply le_cinfi, assume w, apply nonneg_le_nonneg_of_sq_le_sq (norm_nonneg _), have := h w w.2, calc ∥u - v∥ * ∥u - v∥ ≤ ∥u - v∥ * ∥u - v∥ - 2 * inner (u - v) ((w:F) - v) : by linarith ... ≤ ∥u - v∥^2 - 2 * inner (u - v) ((w:F) - v) + ∥(w:F) - v∥^2 : by { rw sq, refine le_add_of_nonneg_right _, exact sq_nonneg _ } ... = ∥(u - v) - (w - v)∥^2 : norm_sub_sq.symm ... = ∥u - w∥ * ∥u - w∥ : by { have : (u - v) - (w - v) = u - w, abel, rw [this, sq] } }, { show (⨅ (w : K), ∥u - w∥) ≤ (λw:K, ∥u - w∥) ⟨v, hv⟩, apply cinfi_le, use 0, rintros y ⟨z, rfl⟩, exact norm_nonneg _ } end variables (K : submodule 𝕜 E) /-- Existence of projections on complete subspaces. Let `u` be a point in an inner product space, and let `K` be a nonempty complete subspace. Then there exists a (unique) `v` in `K` that minimizes the distance `∥u - v∥` to `u`. This point `v` is usually called the orthogonal projection of `u` onto `K`. -/ theorem exists_norm_eq_infi_of_complete_subspace (h : is_complete (↑K : set E)) : ∀ u : E, ∃ v ∈ K, ∥u - v∥ = ⨅ w : (K : set E), ∥u - w∥ := begin letI : inner_product_space ℝ E := inner_product_space.is_R_or_C_to_real 𝕜 E, letI : module ℝ E := restrict_scalars.module ℝ 𝕜 E, letI : is_scalar_tower ℝ 𝕜 E := restrict_scalars.is_scalar_tower _ _ _, let K' : submodule ℝ E := submodule.restrict_scalars ℝ K, exact exists_norm_eq_infi_of_complete_convex ⟨0, K'.zero_mem⟩ h K'.convex end /-- Characterization of minimizers in the projection on a subspace, in the real case. Let `u` be a point in a real inner product space, and let `K` be a nonempty subspace. Then point `v` minimizes the distance `∥u - v∥` over points in `K` if and only if for all `w ∈ K`, `⟪u - v, w⟫ = 0` (i.e., `u - v` is orthogonal to the subspace `K`). This is superceded by `norm_eq_infi_iff_inner_eq_zero` that gives the same conclusion over any `is_R_or_C` field. -/ theorem norm_eq_infi_iff_real_inner_eq_zero (K : submodule ℝ F) {u : F} {v : F} (hv : v ∈ K) : ∥u - v∥ = (⨅ w : (↑K : set F), ∥u - w∥) ↔ ∀ w ∈ K, ⟪u - v, w⟫_ℝ = 0 := iff.intro begin assume h, have h : ∀ w ∈ K, ⟪u - v, w - v⟫_ℝ ≤ 0, { rwa [norm_eq_infi_iff_real_inner_le_zero] at h, exacts [K.convex, hv] }, assume w hw, have le : ⟪u - v, w⟫_ℝ ≤ 0, let w' := w + v, have : w' ∈ K := submodule.add_mem _ hw hv, have h₁ := h w' this, have h₂ : w' - v = w, simp only [add_neg_cancel_right, sub_eq_add_neg], rw h₂ at h₁, exact h₁, have ge : ⟪u - v, w⟫_ℝ ≥ 0, let w'' := -w + v, have : w'' ∈ K := submodule.add_mem _ (submodule.neg_mem _ hw) hv, have h₁ := h w'' this, have h₂ : w'' - v = -w, simp only [neg_inj, add_neg_cancel_right, sub_eq_add_neg], rw [h₂, inner_neg_right] at h₁, linarith, exact le_antisymm le ge end begin assume h, have : ∀ w ∈ K, ⟪u - v, w - v⟫_ℝ ≤ 0, assume w hw, let w' := w - v, have : w' ∈ K := submodule.sub_mem _ hw hv, have h₁ := h w' this, exact le_of_eq h₁, rwa norm_eq_infi_iff_real_inner_le_zero, exacts [submodule.convex _, hv] end /-- Characterization of minimizers in the projection on a subspace. Let `u` be a point in an inner product space, and let `K` be a nonempty subspace. Then point `v` minimizes the distance `∥u - v∥` over points in `K` if and only if for all `w ∈ K`, `⟪u - v, w⟫ = 0` (i.e., `u - v` is orthogonal to the subspace `K`) -/ theorem norm_eq_infi_iff_inner_eq_zero {u : E} {v : E} (hv : v ∈ K) : ∥u - v∥ = (⨅ w : (↑K : set E), ∥u - w∥) ↔ ∀ w ∈ K, ⟪u - v, w⟫ = 0 := begin letI : inner_product_space ℝ E := inner_product_space.is_R_or_C_to_real 𝕜 E, letI : module ℝ E := restrict_scalars.module ℝ 𝕜 E, letI : is_scalar_tower ℝ 𝕜 E := restrict_scalars.is_scalar_tower _ _ _, let K' : submodule ℝ E := K.restrict_scalars ℝ, split, { assume H, have A : ∀ w ∈ K, re ⟪u - v, w⟫ = 0 := (norm_eq_infi_iff_real_inner_eq_zero K' hv).1 H, assume w hw, apply ext, { simp [A w hw] }, { symmetry, calc im (0 : 𝕜) = 0 : im.map_zero ... = re ⟪u - v, (-I) • w⟫ : (A _ (K.smul_mem (-I) hw)).symm ... = re ((-I) * ⟪u - v, w⟫) : by rw inner_smul_right ... = im ⟪u - v, w⟫ : by simp } }, { assume H, have : ∀ w ∈ K', ⟪u - v, w⟫_ℝ = 0, { assume w hw, rw [real_inner_eq_re_inner, H w hw], exact zero_re' }, exact (norm_eq_infi_iff_real_inner_eq_zero K' hv).2 this } end section orthogonal_projection variables [complete_space K] /-- The orthogonal projection onto a complete subspace, as an unbundled function. This definition is only intended for use in setting up the bundled version `orthogonal_projection` and should not be used once that is defined. -/ def orthogonal_projection_fn (v : E) := (exists_norm_eq_infi_of_complete_subspace K (complete_space_coe_iff_is_complete.mp ‹_›) v).some variables {K} /-- The unbundled orthogonal projection is in the given subspace. This lemma is only intended for use in setting up the bundled version and should not be used once that is defined. -/ lemma orthogonal_projection_fn_mem (v : E) : orthogonal_projection_fn K v ∈ K := (exists_norm_eq_infi_of_complete_subspace K (complete_space_coe_iff_is_complete.mp ‹_›) v).some_spec.some /-- The characterization of the unbundled orthogonal projection. This lemma is only intended for use in setting up the bundled version and should not be used once that is defined. -/ lemma orthogonal_projection_fn_inner_eq_zero (v : E) : ∀ w ∈ K, ⟪v - orthogonal_projection_fn K v, w⟫ = 0 := begin rw ←norm_eq_infi_iff_inner_eq_zero K (orthogonal_projection_fn_mem v), exact (exists_norm_eq_infi_of_complete_subspace K (complete_space_coe_iff_is_complete.mp ‹_›) v).some_spec.some_spec end /-- The unbundled orthogonal projection is the unique point in `K` with the orthogonality property. This lemma is only intended for use in setting up the bundled version and should not be used once that is defined. -/ lemma eq_orthogonal_projection_fn_of_mem_of_inner_eq_zero {u v : E} (hvm : v ∈ K) (hvo : ∀ w ∈ K, ⟪u - v, w⟫ = 0) : orthogonal_projection_fn K u = v := begin rw [←sub_eq_zero, ←inner_self_eq_zero], have hvs : orthogonal_projection_fn K u - v ∈ K := submodule.sub_mem K (orthogonal_projection_fn_mem u) hvm, have huo : ⟪u - orthogonal_projection_fn K u, orthogonal_projection_fn K u - v⟫ = 0 := orthogonal_projection_fn_inner_eq_zero u _ hvs, have huv : ⟪u - v, orthogonal_projection_fn K u - v⟫ = 0 := hvo _ hvs, have houv : ⟪(u - v) - (u - orthogonal_projection_fn K u), orthogonal_projection_fn K u - v⟫ = 0, { rw [inner_sub_left, huo, huv, sub_zero] }, rwa sub_sub_sub_cancel_left at houv end variables (K) lemma orthogonal_projection_fn_norm_sq (v : E) : ∥v∥ * ∥v∥ = ∥v - (orthogonal_projection_fn K v)∥ * ∥v - (orthogonal_projection_fn K v)∥ + ∥orthogonal_projection_fn K v∥ * ∥orthogonal_projection_fn K v∥ := begin set p := orthogonal_projection_fn K v, have h' : ⟪v - p, p⟫ = 0, { exact orthogonal_projection_fn_inner_eq_zero _ _ (orthogonal_projection_fn_mem v) }, convert norm_add_sq_eq_norm_sq_add_norm_sq_of_inner_eq_zero (v - p) p h' using 2; simp, end /-- The orthogonal projection onto a complete subspace. -/ def orthogonal_projection : E →L[𝕜] K := linear_map.mk_continuous { to_fun := λ v, ⟨orthogonal_projection_fn K v, orthogonal_projection_fn_mem v⟩, map_add' := λ x y, begin have hm : orthogonal_projection_fn K x + orthogonal_projection_fn K y ∈ K := submodule.add_mem K (orthogonal_projection_fn_mem x) (orthogonal_projection_fn_mem y), have ho : ∀ w ∈ K, ⟪x + y - (orthogonal_projection_fn K x + orthogonal_projection_fn K y), w⟫ = 0, { intros w hw, rw [add_sub_comm, inner_add_left, orthogonal_projection_fn_inner_eq_zero _ w hw, orthogonal_projection_fn_inner_eq_zero _ w hw, add_zero] }, ext, simp [eq_orthogonal_projection_fn_of_mem_of_inner_eq_zero hm ho] end, map_smul' := λ c x, begin have hm : c • orthogonal_projection_fn K x ∈ K := submodule.smul_mem K _ (orthogonal_projection_fn_mem x), have ho : ∀ w ∈ K, ⟪c • x - c • orthogonal_projection_fn K x, w⟫ = 0, { intros w hw, rw [←smul_sub, inner_smul_left, orthogonal_projection_fn_inner_eq_zero _ w hw, mul_zero] }, ext, simp [eq_orthogonal_projection_fn_of_mem_of_inner_eq_zero hm ho] end } 1 (λ x, begin simp only [one_mul, linear_map.coe_mk], refine le_of_pow_le_pow 2 (norm_nonneg _) (by norm_num) _, change ∥orthogonal_projection_fn K x∥ ^ 2 ≤ ∥x∥ ^ 2, nlinarith [orthogonal_projection_fn_norm_sq K x] end) variables {K} @[simp] lemma orthogonal_projection_fn_eq (v : E) : orthogonal_projection_fn K v = (orthogonal_projection K v : E) := rfl /-- The characterization of the orthogonal projection. -/ @[simp] lemma orthogonal_projection_inner_eq_zero (v : E) : ∀ w ∈ K, ⟪v - orthogonal_projection K v, w⟫ = 0 := orthogonal_projection_fn_inner_eq_zero v /-- The difference of `v` from its orthogonal projection onto `K` is in `Kᗮ`. -/ @[simp] lemma sub_orthogonal_projection_mem_orthogonal (v : E) : v - orthogonal_projection K v ∈ Kᗮ := begin intros w hw, rw inner_eq_zero_sym, exact orthogonal_projection_inner_eq_zero _ _ hw end /-- The orthogonal projection is the unique point in `K` with the orthogonality property. -/ lemma eq_orthogonal_projection_of_mem_of_inner_eq_zero {u v : E} (hvm : v ∈ K) (hvo : ∀ w ∈ K, ⟪u - v, w⟫ = 0) : (orthogonal_projection K u : E) = v := eq_orthogonal_projection_fn_of_mem_of_inner_eq_zero hvm hvo /-- The orthogonal projections onto equal subspaces are coerced back to the same point in `E`. -/ lemma eq_orthogonal_projection_of_eq_submodule {K' : submodule 𝕜 E} [complete_space K'] (h : K = K') (u : E) : (orthogonal_projection K u : E) = (orthogonal_projection K' u : E) := begin change orthogonal_projection_fn K u = orthogonal_projection_fn K' u, congr, exact h end /-- The orthogonal projection sends elements of `K` to themselves. -/ @[simp] lemma orthogonal_projection_mem_subspace_eq_self (v : K) : orthogonal_projection K v = v := by { ext, apply eq_orthogonal_projection_of_mem_of_inner_eq_zero; simp } /-- A point equals its orthogonal projection if and only if it lies in the subspace. -/ lemma orthogonal_projection_eq_self_iff {v : E} : (orthogonal_projection K v : E) = v ↔ v ∈ K := begin refine ⟨λ h, _, λ h, eq_orthogonal_projection_of_mem_of_inner_eq_zero h _⟩, { rw ← h, simp }, { simp } end lemma linear_isometry.map_orthogonal_projection {E E' : Type*} [inner_product_space 𝕜 E] [inner_product_space 𝕜 E'] (f : E →ₗᵢ[𝕜] E') (p : submodule 𝕜 E) [complete_space p] (x : E) : f (orthogonal_projection p x) = orthogonal_projection (p.map f.to_linear_map) (f x) := begin refine (eq_orthogonal_projection_of_mem_of_inner_eq_zero (submodule.apply_coe_mem_map _ _) $ λ y hy, _).symm, rcases hy with ⟨x', hx', rfl : f x' = y⟩, rw [f.coe_to_linear_map, ← f.map_sub, f.inner_map_map, orthogonal_projection_inner_eq_zero x x' hx'] end /-- Orthogonal projection onto the `submodule.map` of a subspace. -/ lemma orthogonal_projection_map_apply {E E' : Type*} [inner_product_space 𝕜 E] [inner_product_space 𝕜 E'] (f : E ≃ₗᵢ[𝕜] E') (p : submodule 𝕜 E) [complete_space p] (x : E') : (orthogonal_projection (p.map (f.to_linear_equiv : E →ₗ[𝕜] E')) x : E') = f (orthogonal_projection p (f.symm x)) := by simpa only [f.coe_to_linear_isometry, f.apply_symm_apply] using (f.to_linear_isometry.map_orthogonal_projection p (f.symm x)).symm /-- The orthogonal projection onto the trivial submodule is the zero map. -/ @[simp] lemma orthogonal_projection_bot : orthogonal_projection (⊥ : submodule 𝕜 E) = 0 := by ext variables (K) /-- The orthogonal projection has norm `≤ 1`. -/ lemma orthogonal_projection_norm_le : ∥orthogonal_projection K∥ ≤ 1 := linear_map.mk_continuous_norm_le _ (by norm_num) _ variables (𝕜) lemma smul_orthogonal_projection_singleton {v : E} (w : E) : (∥v∥ ^ 2 : 𝕜) • (orthogonal_projection (𝕜 ∙ v) w : E) = ⟪v, w⟫ • v := begin suffices : ↑(orthogonal_projection (𝕜 ∙ v) ((∥v∥ ^ 2 : 𝕜) • w)) = ⟪v, w⟫ • v, { simpa using this }, apply eq_orthogonal_projection_of_mem_of_inner_eq_zero, { rw submodule.mem_span_singleton, use ⟪v, w⟫ }, { intros x hx, obtain ⟨c, rfl⟩ := submodule.mem_span_singleton.mp hx, have hv : ↑∥v∥ ^ 2 = ⟪v, v⟫ := by { norm_cast, simp [norm_sq_eq_inner] }, simp [inner_sub_left, inner_smul_left, inner_smul_right, ring_equiv.map_div, mul_comm, hv, inner_product_space.conj_sym, hv] } end /-- Formula for orthogonal projection onto a single vector. -/ lemma orthogonal_projection_singleton {v : E} (w : E) : (orthogonal_projection (𝕜 ∙ v) w : E) = (⟪v, w⟫ / ∥v∥ ^ 2) • v := begin by_cases hv : v = 0, { rw [hv, eq_orthogonal_projection_of_eq_submodule submodule.span_zero_singleton], { simp }, { apply_instance } }, have hv' : ∥v∥ ≠ 0 := ne_of_gt (norm_pos_iff.mpr hv), have key : ((∥v∥ ^ 2 : 𝕜)⁻¹ * ∥v∥ ^ 2) • ↑(orthogonal_projection (𝕜 ∙ v) w) = ((∥v∥ ^ 2 : 𝕜)⁻¹ * ⟪v, w⟫) • v, { simp [mul_smul, smul_orthogonal_projection_singleton 𝕜 w] }, convert key; field_simp [hv'] end /-- Formula for orthogonal projection onto a single unit vector. -/ lemma orthogonal_projection_unit_singleton {v : E} (hv : ∥v∥ = 1) (w : E) : (orthogonal_projection (𝕜 ∙ v) w : E) = ⟪v, w⟫ • v := by { rw ← smul_orthogonal_projection_singleton 𝕜 w, simp [hv] } end orthogonal_projection section reflection variables {𝕜} (K) [complete_space K] /-- Auxiliary definition for `reflection`: the reflection as a linear equivalence. -/ def reflection_linear_equiv : E ≃ₗ[𝕜] E := linear_equiv.of_involutive (bit0 (K.subtype.comp (orthogonal_projection K).to_linear_map) - linear_map.id) (λ x, by simp [bit0]) /-- Reflection in a complete subspace of an inner product space. The word "reflection" is sometimes understood to mean specifically reflection in a codimension-one subspace, and sometimes more generally to cover operations such as reflection in a point. The definition here, of reflection in a subspace, is a more general sense of the word that includes both those common cases. -/ def reflection : E ≃ₗᵢ[𝕜] E := { norm_map' := begin intros x, let w : K := orthogonal_projection K x, let v := x - w, have : ⟪v, w⟫ = 0 := orthogonal_projection_inner_eq_zero x w w.2, convert norm_sub_eq_norm_add this using 2, { rw [linear_equiv.coe_mk, reflection_linear_equiv, linear_equiv.to_fun_eq_coe, linear_equiv.coe_of_involutive, linear_map.sub_apply, linear_map.id_apply, bit0, linear_map.add_apply, linear_map.comp_apply, submodule.subtype_apply, continuous_linear_map.to_linear_map_eq_coe, continuous_linear_map.coe_coe], dsimp [w, v], abel, }, { simp only [add_sub_cancel'_right, eq_self_iff_true], } end, ..reflection_linear_equiv K } variables {K} /-- The result of reflecting. -/ lemma reflection_apply (p : E) : reflection K p = bit0 ↑(orthogonal_projection K p) - p := rfl /-- Reflection is its own inverse. -/ @[simp] lemma reflection_symm : (reflection K).symm = reflection K := rfl variables (K) /-- Reflecting twice in the same subspace. -/ @[simp] lemma reflection_reflection (p : E) : reflection K (reflection K p) = p := (reflection K).left_inv p /-- Reflection is involutive. -/ lemma reflection_involutive : function.involutive (reflection K) := reflection_reflection K /-- Reflection is involutive. -/ @[simp] lemma reflection_trans_reflection : (reflection K).trans (reflection K) = linear_isometry_equiv.refl 𝕜 E := linear_isometry_equiv.ext $ reflection_involutive K variables {K} /-- A point is its own reflection if and only if it is in the subspace. -/ lemma reflection_eq_self_iff (x : E) : reflection K x = x ↔ x ∈ K := begin rw [←orthogonal_projection_eq_self_iff, reflection_apply, sub_eq_iff_eq_add', ← two_smul 𝕜, ← two_smul' 𝕜], refine (smul_right_injective E _).eq_iff, exact two_ne_zero end lemma reflection_mem_subspace_eq_self {x : E} (hx : x ∈ K) : reflection K x = x := (reflection_eq_self_iff x).mpr hx /-- Reflection in the `submodule.map` of a subspace. -/ lemma reflection_map_apply {E E' : Type*} [inner_product_space 𝕜 E] [inner_product_space 𝕜 E'] (f : E ≃ₗᵢ[𝕜] E') (K : submodule 𝕜 E) [complete_space K] (x : E') : reflection (K.map (f.to_linear_equiv : E →ₗ[𝕜] E')) x = f (reflection K (f.symm x)) := by simp [bit0, reflection_apply, orthogonal_projection_map_apply f K x] /-- Reflection in the `submodule.map` of a subspace. -/ lemma reflection_map {E E' : Type*} [inner_product_space 𝕜 E] [inner_product_space 𝕜 E'] (f : E ≃ₗᵢ[𝕜] E') (K : submodule 𝕜 E) [complete_space K] : reflection (K.map (f.to_linear_equiv : E →ₗ[𝕜] E')) = f.symm.trans ((reflection K).trans f) := linear_isometry_equiv.ext $ reflection_map_apply f K /-- Reflection through the trivial subspace {0} is just negation. -/ @[simp] lemma reflection_bot : reflection (⊥ : submodule 𝕜 E) = linear_isometry_equiv.neg 𝕜 := by ext; simp [reflection_apply] end reflection section orthogonal /-- If `K₁` is complete and contained in `K₂`, `K₁` and `K₁ᗮ ⊓ K₂` span `K₂`. -/ lemma submodule.sup_orthogonal_inf_of_complete_space {K₁ K₂ : submodule 𝕜 E} (h : K₁ ≤ K₂) [complete_space K₁] : K₁ ⊔ (K₁ᗮ ⊓ K₂) = K₂ := begin ext x, rw submodule.mem_sup, let v : K₁ := orthogonal_projection K₁ x, have hvm : x - v ∈ K₁ᗮ := sub_orthogonal_projection_mem_orthogonal x, split, { rintro ⟨y, hy, z, hz, rfl⟩, exact K₂.add_mem (h hy) hz.2 }, { exact λ hx, ⟨v, v.prop, x - v, ⟨hvm, K₂.sub_mem hx (h v.prop)⟩, add_sub_cancel'_right _ _⟩ } end variables {K} /-- If `K` is complete, `K` and `Kᗮ` span the whole space. -/ lemma submodule.sup_orthogonal_of_complete_space [complete_space K] : K ⊔ Kᗮ = ⊤ := begin convert submodule.sup_orthogonal_inf_of_complete_space (le_top : K ≤ ⊤), simp end variables (K) /-- If `K` is complete, any `v` in `E` can be expressed as a sum of elements of `K` and `Kᗮ`. -/ lemma submodule.exists_sum_mem_mem_orthogonal [complete_space K] (v : E) : ∃ (y ∈ K) (z ∈ Kᗮ), v = y + z := begin have h_mem : v ∈ K ⊔ Kᗮ := by simp [submodule.sup_orthogonal_of_complete_space], obtain ⟨y, hy, z, hz, hyz⟩ := submodule.mem_sup.mp h_mem, exact ⟨y, hy, z, hz, hyz.symm⟩ end /-- If `K` is complete, then the orthogonal complement of its orthogonal complement is itself. -/ @[simp] lemma submodule.orthogonal_orthogonal [complete_space K] : Kᗮᗮ = K := begin ext v, split, { obtain ⟨y, hy, z, hz, rfl⟩ := K.exists_sum_mem_mem_orthogonal v, intros hv, have hz' : z = 0, { have hyz : ⟪z, y⟫ = 0 := by simp [hz y hy, inner_eq_zero_sym], simpa [inner_add_right, hyz] using hv z hz }, simp [hy, hz'] }, { intros hv w hw, rw inner_eq_zero_sym, exact hw v hv } end lemma submodule.orthogonal_orthogonal_eq_closure [complete_space E] : Kᗮᗮ = K.topological_closure := begin refine le_antisymm _ _, { convert submodule.orthogonal_orthogonal_monotone K.submodule_topological_closure, haveI : complete_space K.topological_closure := K.is_closed_topological_closure.complete_space_coe, rw K.topological_closure.orthogonal_orthogonal }, { exact K.topological_closure_minimal K.le_orthogonal_orthogonal Kᗮ.is_closed_orthogonal } end variables {K} /-- If `K` is complete, `K` and `Kᗮ` are complements of each other. -/ lemma submodule.is_compl_orthogonal_of_complete_space [complete_space K] : is_compl K Kᗮ := ⟨K.orthogonal_disjoint, le_of_eq submodule.sup_orthogonal_of_complete_space.symm⟩ @[simp] lemma submodule.orthogonal_eq_bot_iff [complete_space (K : set E)] : Kᗮ = ⊥ ↔ K = ⊤ := begin refine ⟨_, λ h, by rw [h, submodule.top_orthogonal_eq_bot] ⟩, intro h, have : K ⊔ Kᗮ = ⊤ := submodule.sup_orthogonal_of_complete_space, rwa [h, sup_comm, bot_sup_eq] at this, end /-- A point in `K` with the orthogonality property (here characterized in terms of `Kᗮ`) must be the orthogonal projection. -/ lemma eq_orthogonal_projection_of_mem_orthogonal [complete_space K] {u v : E} (hv : v ∈ K) (hvo : u - v ∈ Kᗮ) : (orthogonal_projection K u : E) = v := eq_orthogonal_projection_fn_of_mem_of_inner_eq_zero hv (λ w, inner_eq_zero_sym.mp ∘ (hvo w)) /-- A point in `K` with the orthogonality property (here characterized in terms of `Kᗮ`) must be the orthogonal projection. -/ lemma eq_orthogonal_projection_of_mem_orthogonal' [complete_space K] {u v z : E} (hv : v ∈ K) (hz : z ∈ Kᗮ) (hu : u = v + z) : (orthogonal_projection K u : E) = v := eq_orthogonal_projection_of_mem_orthogonal hv (by simpa [hu]) /-- The orthogonal projection onto `K` of an element of `Kᗮ` is zero. -/ lemma orthogonal_projection_mem_subspace_orthogonal_complement_eq_zero [complete_space K] {v : E} (hv : v ∈ Kᗮ) : orthogonal_projection K v = 0 := by { ext, convert eq_orthogonal_projection_of_mem_orthogonal _ _; simp [hv] } /-- The reflection in `K` of an element of `Kᗮ` is its negation. -/ lemma reflection_mem_subspace_orthogonal_complement_eq_neg [complete_space K] {v : E} (hv : v ∈ Kᗮ) : reflection K v = - v := by simp [reflection_apply, orthogonal_projection_mem_subspace_orthogonal_complement_eq_zero hv] /-- The orthogonal projection onto `Kᗮ` of an element of `K` is zero. -/ lemma orthogonal_projection_mem_subspace_orthogonal_precomplement_eq_zero [complete_space E] {v : E} (hv : v ∈ K) : orthogonal_projection Kᗮ v = 0 := orthogonal_projection_mem_subspace_orthogonal_complement_eq_zero (K.le_orthogonal_orthogonal hv) /-- The reflection in `Kᗮ` of an element of `K` is its negation. -/ lemma reflection_mem_subspace_orthogonal_precomplement_eq_neg [complete_space E] {v : E} (hv : v ∈ K) : reflection Kᗮ v = -v := reflection_mem_subspace_orthogonal_complement_eq_neg (K.le_orthogonal_orthogonal hv) /-- The orthogonal projection onto `(𝕜 ∙ v)ᗮ` of `v` is zero. -/ lemma orthogonal_projection_orthogonal_complement_singleton_eq_zero [complete_space E] (v : E) : orthogonal_projection (𝕜 ∙ v)ᗮ v = 0 := orthogonal_projection_mem_subspace_orthogonal_precomplement_eq_zero (submodule.mem_span_singleton_self v) /-- The reflection in `(𝕜 ∙ v)ᗮ` of `v` is `-v`. -/ lemma reflection_orthogonal_complement_singleton_eq_neg [complete_space E] (v : E) : reflection (𝕜 ∙ v)ᗮ v = -v := reflection_mem_subspace_orthogonal_precomplement_eq_neg (submodule.mem_span_singleton_self v) lemma reflection_sub [complete_space F] {v w : F} (h : ∥v∥ = ∥w∥) : reflection (ℝ ∙ (v - w))ᗮ v = w := begin set R : F ≃ₗᵢ[ℝ] F := reflection (ℝ ∙ (v - w))ᗮ, suffices : R v + R v = w + w, { apply smul_right_injective F (by norm_num : (2:ℝ) ≠ 0), simpa [two_smul] using this }, have h₁ : R (v - w) = -(v - w) := reflection_orthogonal_complement_singleton_eq_neg (v - w), have h₂ : R (v + w) = v + w, { apply reflection_mem_subspace_eq_self, apply mem_orthogonal_singleton_of_inner_left, rw real_inner_add_sub_eq_zero_iff, exact h }, convert congr_arg2 (+) h₂ h₁ using 1, { simp }, { abel } end variables (K) /-- In a complete space `E`, a vector splits as the sum of its orthogonal projections onto a complete submodule `K` and onto the orthogonal complement of `K`.-/ lemma eq_sum_orthogonal_projection_self_orthogonal_complement [complete_space E] [complete_space K] (w : E) : w = (orthogonal_projection K w : E) + (orthogonal_projection Kᗮ w : E) := begin obtain ⟨y, hy, z, hz, hwyz⟩ := K.exists_sum_mem_mem_orthogonal w, convert hwyz, { exact eq_orthogonal_projection_of_mem_orthogonal' hy hz hwyz }, { rw add_comm at hwyz, refine eq_orthogonal_projection_of_mem_orthogonal' hz _ hwyz, simp [hy] } end /-- In a complete space `E`, the projection maps onto a complete subspace `K` and its orthogonal complement sum to the identity. -/ lemma id_eq_sum_orthogonal_projection_self_orthogonal_complement [complete_space E] [complete_space K] : continuous_linear_map.id 𝕜 E = K.subtypeL.comp (orthogonal_projection K) + Kᗮ.subtypeL.comp (orthogonal_projection Kᗮ) := by { ext w, exact eq_sum_orthogonal_projection_self_orthogonal_complement K w } /-- The orthogonal projection is self-adjoint. -/ lemma inner_orthogonal_projection_left_eq_right [complete_space E] [complete_space K] (u v : E) : ⟪↑(orthogonal_projection K u), v⟫ = ⟪u, orthogonal_projection K v⟫ := begin nth_rewrite 0 eq_sum_orthogonal_projection_self_orthogonal_complement K v, nth_rewrite 1 eq_sum_orthogonal_projection_self_orthogonal_complement K u, rw [inner_add_left, inner_add_right, submodule.inner_right_of_mem_orthogonal (submodule.coe_mem (orthogonal_projection K u)) (submodule.coe_mem (orthogonal_projection Kᗮ v)), submodule.inner_left_of_mem_orthogonal (submodule.coe_mem (orthogonal_projection K v)) (submodule.coe_mem (orthogonal_projection Kᗮ u))], end open finite_dimensional /-- Given a finite-dimensional subspace `K₂`, and a subspace `K₁` containined in it, the dimensions of `K₁` and the intersection of its orthogonal subspace with `K₂` add to that of `K₂`. -/ lemma submodule.finrank_add_inf_finrank_orthogonal {K₁ K₂ : submodule 𝕜 E} [finite_dimensional 𝕜 K₂] (h : K₁ ≤ K₂) : finrank 𝕜 K₁ + finrank 𝕜 (K₁ᗮ ⊓ K₂ : submodule 𝕜 E) = finrank 𝕜 K₂ := begin haveI := submodule.finite_dimensional_of_le h, have hd := submodule.dim_sup_add_dim_inf_eq K₁ (K₁ᗮ ⊓ K₂), rw [←inf_assoc, (submodule.orthogonal_disjoint K₁).eq_bot, bot_inf_eq, finrank_bot, submodule.sup_orthogonal_inf_of_complete_space h] at hd, rw add_zero at hd, exact hd.symm end /-- Given a finite-dimensional subspace `K₂`, and a subspace `K₁` containined in it, the dimensions of `K₁` and the intersection of its orthogonal subspace with `K₂` add to that of `K₂`. -/ lemma submodule.finrank_add_inf_finrank_orthogonal' {K₁ K₂ : submodule 𝕜 E} [finite_dimensional 𝕜 K₂] (h : K₁ ≤ K₂) {n : ℕ} (h_dim : finrank 𝕜 K₁ + n = finrank 𝕜 K₂) : finrank 𝕜 (K₁ᗮ ⊓ K₂ : submodule 𝕜 E) = n := by { rw ← add_right_inj (finrank 𝕜 K₁), simp [submodule.finrank_add_inf_finrank_orthogonal h, h_dim] } /-- Given a finite-dimensional space `E` and subspace `K`, the dimensions of `K` and `Kᗮ` add to that of `E`. -/ lemma submodule.finrank_add_finrank_orthogonal [finite_dimensional 𝕜 E] (K : submodule 𝕜 E) : finrank 𝕜 K + finrank 𝕜 Kᗮ = finrank 𝕜 E := begin convert submodule.finrank_add_inf_finrank_orthogonal (le_top : K ≤ ⊤) using 1, { rw inf_top_eq }, { simp } end /-- Given a finite-dimensional space `E` and subspace `K`, the dimensions of `K` and `Kᗮ` add to that of `E`. -/ lemma submodule.finrank_add_finrank_orthogonal' [finite_dimensional 𝕜 E] {K : submodule 𝕜 E} {n : ℕ} (h_dim : finrank 𝕜 K + n = finrank 𝕜 E) : finrank 𝕜 Kᗮ = n := by { rw ← add_right_inj (finrank 𝕜 K), simp [submodule.finrank_add_finrank_orthogonal, h_dim] } local attribute [instance] fact_finite_dimensional_of_finrank_eq_succ /-- In a finite-dimensional inner product space, the dimension of the orthogonal complement of the span of a nonzero vector is one less than the dimension of the space. -/ lemma finrank_orthogonal_span_singleton {n : ℕ} [_i : fact (finrank 𝕜 E = n + 1)] {v : E} (hv : v ≠ 0) : finrank 𝕜 (𝕜 ∙ v)ᗮ = n := submodule.finrank_add_finrank_orthogonal' $ by simp [finrank_span_singleton hv, _i.elim, add_comm] /-- An element `φ` of the orthogonal group of `F` can be factored as a product of reflections, and specifically at most as many reflections as the dimension of the complement of the fixed subspace of `φ`. -/ lemma linear_isometry_equiv.reflections_generate_dim_aux [finite_dimensional ℝ F] {n : ℕ} (φ : F ≃ₗᵢ[ℝ] F) (hn : finrank ℝ (continuous_linear_map.id ℝ F - φ.to_continuous_linear_equiv).kerᗮ ≤ n) : ∃ l : list F, l.length ≤ n ∧ φ = (l.map (λ v, reflection (ℝ ∙ v)ᗮ)).prod := begin -- We prove this by strong induction on `n`, the dimension of the orthogonal complement of the -- fixed subspace of the endomorphism `φ` induction n with n IH generalizing φ, { -- Base case: `n = 0`, the fixed subspace is the whole space, so `φ = id` refine ⟨[], rfl.le, _⟩, have : (continuous_linear_map.id ℝ F - φ.to_continuous_linear_equiv).ker = ⊤, { rwa [nat.le_zero_iff, finrank_eq_zero, submodule.orthogonal_eq_bot_iff] at hn }, symmetry, ext x, simpa [sub_eq_zero] using congr_arg (λ f : F →ₗ[ℝ] F, f x) (linear_map.ker_eq_top.mp this) }, { -- Inductive step. Let `W` be the fixed subspace of `φ`. We suppose its complement to have -- dimension at most n + 1. let W := (continuous_linear_map.id ℝ F - φ.to_continuous_linear_equiv).ker, have hW : ∀ w ∈ W, φ w = w := λ w hw, (sub_eq_zero.mp hw).symm, by_cases hn' : finrank ℝ Wᗮ ≤ n, { obtain ⟨V, hV₁, hV₂⟩ := IH φ hn', exact ⟨V, hV₁.trans n.le_succ, hV₂⟩ }, -- Take a nonzero element `v` of the orthogonal complement of `W`. haveI : nontrivial Wᗮ := nontrivial_of_finrank_pos (by linarith [zero_le n] : 0 < finrank ℝ Wᗮ), obtain ⟨v, hv⟩ := exists_ne (0 : Wᗮ), have hφv : φ v ∈ Wᗮ, { intros w hw, rw [← hW w hw, linear_isometry_equiv.inner_map_map], exact v.prop w hw }, have hv' : (v:F) ∉ W, { intros h, exact hv ((submodule.mem_left_iff_eq_zero_of_disjoint W.orthogonal_disjoint).mp h) }, -- Let `ρ` be the reflection in `v - φ v`; this is designed to swap `v` and `φ v` let x : F := v - φ v, let ρ := reflection (ℝ ∙ x)ᗮ, -- Notation: Let `V` be the fixed subspace of `φ.trans ρ` let V := (continuous_linear_map.id ℝ F - (φ.trans ρ).to_continuous_linear_equiv).ker, have hV : ∀ w, ρ (φ w) = w → w ∈ V, { intros w hw, change w - ρ (φ w) = 0, rw [sub_eq_zero, hw] }, -- Everything fixed by `φ` is fixed by `φ.trans ρ` have H₂V : W ≤ V, { intros w hw, apply hV, rw hW w hw, refine reflection_mem_subspace_eq_self _, apply mem_orthogonal_singleton_of_inner_left, exact submodule.sub_mem _ v.prop hφv _ hw }, -- `v` is also fixed by `φ.trans ρ` have H₁V : (v : F) ∈ V, { apply hV, have : ρ v = φ v := reflection_sub (by simp), simp [← this, ρ] }, -- By dimension-counting, the complement of the fixed subspace of `φ.trans ρ` has dimension at -- most `n` have : finrank ℝ Vᗮ ≤ n, { change finrank ℝ Wᗮ ≤ n + 1 at hn, have : finrank ℝ W + 1 ≤ finrank ℝ V := submodule.finrank_lt_finrank_of_lt (set_like.lt_iff_le_and_exists.2 ⟨H₂V, v, H₁V, hv'⟩), have : finrank ℝ V + finrank ℝ Vᗮ = finrank ℝ F := V.finrank_add_finrank_orthogonal, have : finrank ℝ W + finrank ℝ Wᗮ = finrank ℝ F := W.finrank_add_finrank_orthogonal, linarith }, -- So apply the inductive hypothesis to `φ.trans ρ` obtain ⟨l, hl, hφl⟩ := IH (φ.trans ρ) this, -- Prepend `ρ` to the factorization into reflections obtained for `φ.trans ρ`; this gives a -- factorization into reflections for `φ`. refine ⟨x :: l, _, _⟩, { simp [hl, nat.succ_le_succ] }, have := congr_arg (λ ψ, linear_isometry_equiv.trans ψ ρ) hφl, convert this using 1, { simp [← linear_isometry_equiv.trans_assoc φ ρ ρ] }, { change _ = _ * _, simp } } end /-- The orthogonal group of `F` is generated by reflections; specifically each element `φ` of the orthogonal group is a product of at most as many reflections as the dimension of `F`. Special case of the **Cartan–Dieudonné theorem**. -/ lemma linear_isometry_equiv.reflections_generate_dim [finite_dimensional ℝ F] (φ : F ≃ₗᵢ[ℝ] F) : ∃ l : list F, l.length ≤ finrank ℝ F ∧ φ = (l.map (λ v, reflection (ℝ ∙ v)ᗮ)).prod := let ⟨l, hl₁, hl₂⟩ := φ.reflections_generate_dim_aux le_rfl in ⟨l, hl₁.trans (submodule.finrank_le _), hl₂⟩ /-- The orthogonal group of `F` is generated by reflections. -/ lemma linear_isometry_equiv.reflections_generate [finite_dimensional ℝ F] : subgroup.closure (set.range (λ v : F, reflection (ℝ ∙ v)ᗮ)) = ⊤ := begin rw subgroup.eq_top_iff', intros φ, rcases φ.reflections_generate_dim with ⟨l, _, rfl⟩, apply (subgroup.closure _).list_prod_mem, intros x hx, rcases list.mem_map.mp hx with ⟨a, _, hax⟩, exact subgroup.subset_closure ⟨a, hax⟩, end end orthogonal section orthogonal_family variables {ι : Type*} /-- An orthogonal family of subspaces of `E` satisfies `direct_sum.submodule_is_internal` (that is, they provide an internal direct sum decomposition of `E`) if and only if their span has trivial orthogonal complement. -/ lemma orthogonal_family.submodule_is_internal_iff [decidable_eq ι] [finite_dimensional 𝕜 E] {V : ι → submodule 𝕜 E} (hV : orthogonal_family 𝕜 V) : direct_sum.submodule_is_internal V ↔ (supr V)ᗮ = ⊥ := by simp only [direct_sum.submodule_is_internal_iff_independent_and_supr_eq_top, hV.independent, true_and, submodule.orthogonal_eq_bot_iff] end orthogonal_family section orthonormal_basis /-! ### Existence of Hilbert basis, orthonormal basis, etc. -/ variables {𝕜 E} {v : set E} open finite_dimensional submodule set /-- An orthonormal set in an `inner_product_space` is maximal, if and only if the orthogonal complement of its span is empty. -/ lemma maximal_orthonormal_iff_orthogonal_complement_eq_bot (hv : orthonormal 𝕜 (coe : v → E)) : (∀ u ⊇ v, orthonormal 𝕜 (coe : u → E) → u = v) ↔ (span 𝕜 v)ᗮ = ⊥ := begin rw submodule.eq_bot_iff, split, { contrapose!, -- ** direction 1: nonempty orthogonal complement implies nonmaximal rintros ⟨x, hx', hx⟩, -- take a nonzero vector and normalize it let e := (∥x∥⁻¹ : 𝕜) • x, have he : ∥e∥ = 1 := by simp [e, norm_smul_inv_norm hx], have he' : e ∈ (span 𝕜 v)ᗮ := smul_mem' _ _ hx', have he'' : e ∉ v, { intros hev, have : e = 0, { have : e ∈ (span 𝕜 v) ⊓ (span 𝕜 v)ᗮ := ⟨subset_span hev, he'⟩, simpa [(span 𝕜 v).inf_orthogonal_eq_bot] using this }, have : e ≠ 0 := hv.ne_zero ⟨e, hev⟩, contradiction }, -- put this together with `v` to provide a candidate orthonormal basis for the whole space refine ⟨v.insert e, v.subset_insert e, ⟨_, _⟩, (v.ne_insert_of_not_mem he'').symm⟩, { -- show that the elements of `v.insert e` have unit length rintros ⟨a, ha'⟩, cases eq_or_mem_of_mem_insert ha' with ha ha, { simp [ha, he] }, { exact hv.1 ⟨a, ha⟩ } }, { -- show that the elements of `v.insert e` are orthogonal have h_end : ∀ a ∈ v, ⟪a, e⟫ = 0, { intros a ha, exact he' a (submodule.subset_span ha) }, rintros ⟨a, ha'⟩, cases eq_or_mem_of_mem_insert ha' with ha ha, { rintros ⟨b, hb'⟩ hab', have hb : b ∈ v, { refine mem_of_mem_insert_of_ne hb' _, intros hbe', apply hab', simp [ha, hbe'] }, rw inner_eq_zero_sym, simpa [ha] using h_end b hb }, rintros ⟨b, hb'⟩ hab', cases eq_or_mem_of_mem_insert hb' with hb hb, { simpa [hb] using h_end a ha }, have : (⟨a, ha⟩ : v) ≠ ⟨b, hb⟩, { intros hab'', apply hab', simpa using hab'' }, exact hv.2 this } }, { -- ** direction 2: empty orthogonal complement implies maximal simp only [subset.antisymm_iff], rintros h u (huv : v ⊆ u) hu, refine ⟨_, huv⟩, intros x hxu, refine ((mt (h x)) (hu.ne_zero ⟨x, hxu⟩)).imp_symm _, intros hxv y hy, have hxv' : (⟨x, hxu⟩ : u) ∉ (coe ⁻¹' v : set u) := by simp [huv, hxv], obtain ⟨l, hl, rfl⟩ : ∃ l ∈ finsupp.supported 𝕜 𝕜 (coe ⁻¹' v : set u), (finsupp.total ↥u E 𝕜 coe) l = y, { rw ← finsupp.mem_span_image_iff_total, simp [huv, inter_eq_self_of_subset_left, hy] }, exact hu.inner_finsupp_eq_zero hxv' hl } end /-- An orthonormal set in an `inner_product_space` is maximal, if and only if the closure of its span is the whole space. -/ lemma maximal_orthonormal_iff_dense_span [complete_space E] (hv : orthonormal 𝕜 (coe : v → E)) : (∀ u ⊇ v, orthonormal 𝕜 (coe : u → E) → u = v) ↔ (span 𝕜 v).topological_closure = ⊤ := by rw [maximal_orthonormal_iff_orthogonal_complement_eq_bot hv, ← submodule.orthogonal_eq_top_iff, (span 𝕜 v).orthogonal_orthogonal_eq_closure] /-- Any orthonormal subset can be extended to an orthonormal set whose span is dense. -/ lemma exists_subset_is_orthonormal_dense_span [complete_space E] (hv : orthonormal 𝕜 (coe : v → E)) : ∃ u ⊇ v, orthonormal 𝕜 (coe : u → E) ∧ (span 𝕜 u).topological_closure = ⊤ := begin obtain ⟨u, hus, hu, hu_max⟩ := exists_maximal_orthonormal hv, rw maximal_orthonormal_iff_dense_span hu at hu_max, exact ⟨u, hus, hu, hu_max⟩ end variables (𝕜 E) /-- An inner product space admits an orthonormal set whose span is dense. -/ lemma exists_is_orthonormal_dense_span [complete_space E] : ∃ u : set E, orthonormal 𝕜 (coe : u → E) ∧ (span 𝕜 u).topological_closure = ⊤ := let ⟨u, hus, hu, hu_max⟩ := exists_subset_is_orthonormal_dense_span (orthonormal_empty 𝕜 E) in ⟨u, hu, hu_max⟩ variables {𝕜 E} section finite_dimensional variables [finite_dimensional 𝕜 E] /-- An orthonormal set in a finite-dimensional `inner_product_space` is maximal, if and only if it is a basis. -/ lemma maximal_orthonormal_iff_basis_of_finite_dimensional (hv : orthonormal 𝕜 (coe : v → E)) : (∀ u ⊇ v, orthonormal 𝕜 (coe : u → E) → u = v) ↔ ∃ b : basis v 𝕜 E, ⇑b = coe := begin rw maximal_orthonormal_iff_orthogonal_complement_eq_bot hv, have hv_compl : is_complete (span 𝕜 v : set E) := (span 𝕜 v).complete_of_finite_dimensional, rw submodule.orthogonal_eq_bot_iff, have hv_coe : range (coe : v → E) = v := by simp, split, { refine λ h, ⟨basis.mk hv.linear_independent _, basis.coe_mk _ _⟩, convert h }, { rintros ⟨h, coe_h⟩, rw [← h.span_eq, coe_h, hv_coe] } end /-- In a finite-dimensional `inner_product_space`, any orthonormal subset can be extended to an orthonormal basis. -/ lemma exists_subset_is_orthonormal_basis (hv : orthonormal 𝕜 (coe : v → E)) : ∃ (u ⊇ v) (b : basis u 𝕜 E), orthonormal 𝕜 b ∧ ⇑b = coe := begin obtain ⟨u, hus, hu, hu_max⟩ := exists_maximal_orthonormal hv, obtain ⟨b, hb⟩ := (maximal_orthonormal_iff_basis_of_finite_dimensional hu).mp hu_max, exact ⟨u, hus, b, by rwa hb, hb⟩ end variables (𝕜 E) /-- Index for an arbitrary orthonormal basis on a finite-dimensional `inner_product_space`. -/ def orthonormal_basis_index : set E := classical.some (exists_subset_is_orthonormal_basis (orthonormal_empty 𝕜 E)) /-- A finite-dimensional `inner_product_space` has an orthonormal basis. -/ def orthonormal_basis : basis (orthonormal_basis_index 𝕜 E) 𝕜 E := (exists_subset_is_orthonormal_basis (orthonormal_empty 𝕜 E)).some_spec.some_spec.some lemma orthonormal_basis_orthonormal : orthonormal 𝕜 (orthonormal_basis 𝕜 E) := (exists_subset_is_orthonormal_basis (orthonormal_empty 𝕜 E)).some_spec.some_spec.some_spec.1 @[simp] lemma coe_orthonormal_basis : ⇑(orthonormal_basis 𝕜 E) = coe := (exists_subset_is_orthonormal_basis (orthonormal_empty 𝕜 E)).some_spec.some_spec.some_spec.2 instance : fintype (orthonormal_basis_index 𝕜 E) := @is_noetherian.fintype_basis_index _ _ _ _ _ _ _ (is_noetherian.iff_fg.2 infer_instance) (orthonormal_basis 𝕜 E) variables {𝕜 E} /-- An `n`-dimensional `inner_product_space` has an orthonormal basis indexed by `fin n`. -/ def fin_orthonormal_basis {n : ℕ} (hn : finrank 𝕜 E = n) : basis (fin n) 𝕜 E := have h : fintype.card (orthonormal_basis_index 𝕜 E) = n, by rw [← finrank_eq_card_basis (orthonormal_basis 𝕜 E), hn], (orthonormal_basis 𝕜 E).reindex (fintype.equiv_fin_of_card_eq h) lemma fin_orthonormal_basis_orthonormal {n : ℕ} (hn : finrank 𝕜 E = n) : orthonormal 𝕜 (fin_orthonormal_basis hn) := suffices orthonormal 𝕜 (orthonormal_basis _ _ ∘ equiv.symm _), by { simp only [fin_orthonormal_basis, basis.coe_reindex], assumption }, -- why doesn't simpa work? (orthonormal_basis_orthonormal 𝕜 E).comp _ (equiv.injective _) section subordinate_orthonormal_basis open direct_sum variables {n : ℕ} (hn : finrank 𝕜 E = n) {ι : Type*} [fintype ι] [decidable_eq ι] {V : ι → submodule 𝕜 E} (hV : submodule_is_internal V) /-- Exhibit a bijection between `fin n` and the index set of a certain basis of an `n`-dimensional inner product space `E`. This should not be accessed directly, but only via the subsequent API. -/ @[irreducible] def direct_sum.submodule_is_internal.sigma_orthonormal_basis_index_equiv : (Σ i, orthonormal_basis_index 𝕜 (V i)) ≃ fin n := let b := hV.collected_basis (λ i, orthonormal_basis 𝕜 (V i)) in fintype.equiv_fin_of_card_eq $ (finite_dimensional.finrank_eq_card_basis b).symm.trans hn /-- An `n`-dimensional `inner_product_space` equipped with a decomposition as an internal direct sum has an orthonormal basis indexed by `fin n` and subordinate to that direct sum. -/ @[irreducible] def direct_sum.submodule_is_internal.subordinate_orthonormal_basis : basis (fin n) 𝕜 E := (hV.collected_basis (λ i, orthonormal_basis 𝕜 (V i))).reindex (hV.sigma_orthonormal_basis_index_equiv hn) /-- An `n`-dimensional `inner_product_space` equipped with a decomposition as an internal direct sum has an orthonormal basis indexed by `fin n` and subordinate to that direct sum. This function provides the mapping by which it is subordinate. -/ def direct_sum.submodule_is_internal.subordinate_orthonormal_basis_index (a : fin n) : ι := ((hV.sigma_orthonormal_basis_index_equiv hn).symm a).1 /-- The basis constructed in `orthogonal_family.subordinate_orthonormal_basis` is orthonormal. -/ lemma direct_sum.submodule_is_internal.subordinate_orthonormal_basis_orthonormal (hV' : orthogonal_family 𝕜 V) : orthonormal 𝕜 (hV.subordinate_orthonormal_basis hn) := begin simp only [direct_sum.submodule_is_internal.subordinate_orthonormal_basis, basis.coe_reindex], have : orthonormal 𝕜 (hV.collected_basis (λ i, orthonormal_basis 𝕜 (V i))) := hV.collected_basis_orthonormal hV' (λ i, orthonormal_basis_orthonormal 𝕜 (V i)), exact this.comp _ (equiv.injective _), end /-- The basis constructed in `orthogonal_family.subordinate_orthonormal_basis` is subordinate to the `orthogonal_family` in question. -/ lemma direct_sum.submodule_is_internal.subordinate_orthonormal_basis_subordinate (a : fin n) : hV.subordinate_orthonormal_basis hn a ∈ V (hV.subordinate_orthonormal_basis_index hn a) := by simpa only [direct_sum.submodule_is_internal.subordinate_orthonormal_basis, basis.coe_reindex] using hV.collected_basis_mem (λ i, orthonormal_basis 𝕜 (V i)) ((hV.sigma_orthonormal_basis_index_equiv hn).symm a) attribute [irreducible] direct_sum.submodule_is_internal.subordinate_orthonormal_basis_index end subordinate_orthonormal_basis end finite_dimensional end orthonormal_basis
#' Line segments parameterised by location, direction and distance #' #' This is a polar parameterisation of [geom_segment()]. It is #' useful when you have variables that describe direction and distance. #' The angles start from east and increase counterclockwise. #' #' @eval rd_aesthetics("geom", "spoke") #' @inheritParams layer #' @inheritParams geom_segment #' @export #' @examples #' df <- expand.grid(x = 1:10, y=1:10) #' df$angle <- runif(100, 0, 2*pi) #' df$speed <- runif(100, 0, sqrt(0.1 * df$x)) #' #' ggplot(df, aes(x, y)) + #' geom_point() + #' geom_spoke(aes(angle = angle), radius = 0.5) #' #' ggplot(df, aes(x, y)) + #' geom_point() + #' geom_spoke(aes(angle = angle, radius = speed)) geom_spoke <- function(mapping = NULL, data = NULL, stat = "identity", position = "identity", ..., na.rm = FALSE, show.legend = NA, inherit.aes = TRUE) { layer( data = data, mapping = mapping, geom = GeomSpoke, stat = stat, position = position, show.legend = show.legend, inherit.aes = inherit.aes, params = list( na.rm = na.rm, ... ) ) } #' @export #' @rdname geom_spoke #' @usage NULL stat_spoke <- function(...) { message("stat_spoke is deprecated, please use geom_spoke") geom_spoke(...) } #' @rdname ggplot2-ggproto #' @format NULL #' @usage NULL #' @export GeomSpoke <- ggproto("GeomSpoke", GeomSegment, setup_data = function(data, params) { data$radius <- data$radius %||% params$radius data$angle <- data$angle %||% params$angle transform(data, xend = x + cos(angle) * radius, yend = y + sin(angle) * radius ) }, required_aes = c("x", "y", "angle", "radius") )
lemma borel_integrable_compact: fixes f :: "'a::euclidean_space \<Rightarrow> 'b::{banach, second_countable_topology}" assumes "compact S" "continuous_on S f" shows "integrable lborel (\<lambda>x. indicator S x *\<^sub>R f x)"
= = Set list = =
A set $S$ is closed if and only if every limit point of $S$ is in $S$.
/- Copyright (c) 2018 Mario Carneiro. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Author: Mario Carneiro The partial recursive functions are defined similarly to the primitive recursive functions, but now all functions are partial, implemented using the `roption` monad, and there is an additional operation, called μ-recursion, which performs unbounded minimization. -/ import computability.primrec data.pfun open encodable denumerable roption namespace nat section rfind parameter (p : ℕ →. bool) private def lbp (m n : ℕ) : Prop := m = n + 1 ∧ ∀ k ≤ n, ff ∈ p k parameter (H : ∃ n, tt ∈ p n ∧ ∀ k < n, (p k).dom) private def wf_lbp : well_founded lbp := ⟨let ⟨n, pn⟩ := H in begin suffices : ∀m k, n ≤ k + m → acc (lbp p) k, { from λa, this _ _ (nat.le_add_left _ _) }, intros m k kn, induction m with m IH generalizing k; refine ⟨_, λ y r, _⟩; rcases r with ⟨rfl, a⟩, { injection mem_unique pn.1 (a _ kn) }, { exact IH _ (by rw nat.add_right_comm; exact kn) } end⟩ def rfind_x : {n // tt ∈ p n ∧ ∀m < n, ff ∈ p m} := suffices ∀ k, (∀n < k, ff ∈ p n) → {n // tt ∈ p n ∧ ∀m < n, ff ∈ p m}, from this 0 (λ n, (nat.not_lt_zero _).elim), @well_founded.fix _ _ lbp wf_lbp begin intros m IH al, have pm : (p m).dom, { rcases H with ⟨n, h₁, h₂⟩, rcases lt_trichotomy m n with h₃|h₃|h₃, { exact h₂ _ h₃ }, { rw h₃, exact h₁.fst }, { injection mem_unique h₁ (al _ h₃) } }, cases e : (p m).get pm, { suffices, exact IH _ ⟨rfl, this⟩ (λ n h, this _ (le_of_lt_succ h)), intros n h, cases lt_or_eq_of_le h with h h, { exact al _ h }, { rw h, exact ⟨_, e⟩ } }, { exact ⟨m, ⟨_, e⟩, al⟩ } end end rfind def rfind (p : ℕ →. bool) : roption ℕ := ⟨_, λ h, (rfind_x p h).1⟩ theorem rfind_spec {p : ℕ →. bool} {n : ℕ} (h : n ∈ rfind p) : tt ∈ p n := h.snd ▸ (rfind_x p h.fst).2.1 theorem rfind_min {p : ℕ →. bool} {n : ℕ} (h : n ∈ rfind p) : ∀ {m : ℕ}, m < n → ff ∈ p m := h.snd ▸ (rfind_x p h.fst).2.2 @[simp] theorem rfind_dom {p : ℕ →. bool} : (rfind p).dom ↔ ∃ n, tt ∈ p n ∧ ∀ {m : ℕ}, m < n → (p m).dom := iff.rfl @[simp] theorem rfind_dom' {p : ℕ →. bool} : (rfind p).dom ↔ ∃ n, tt ∈ p n ∧ ∀ {m : ℕ}, m ≤ n → (p m).dom := exists_congr $ λ n, and_congr_right $ λ pn, ⟨λ H m h, (eq_or_lt_of_le h).elim (λ e, e.symm ▸ pn.fst) (H _), λ H m h, H (le_of_lt h)⟩ @[simp] theorem mem_rfind {p : ℕ →. bool} {n : ℕ} : n ∈ rfind p ↔ tt ∈ p n ∧ ∀ {m : ℕ}, m < n → ff ∈ p m := ⟨λ h, ⟨rfind_spec h, @rfind_min _ _ h⟩, λ ⟨h₁, h₂⟩, let ⟨m, hm⟩ := dom_iff_mem.1 $ (@rfind_dom p).2 ⟨_, h₁, λ m mn, (h₂ mn).fst⟩ in begin rcases lt_trichotomy m n with h|h|h, { injection mem_unique (h₂ h) (rfind_spec hm) }, { rwa ← h }, { injection mem_unique h₁ (rfind_min hm h) }, end⟩ theorem rfind_min' {p : ℕ → bool} {m : ℕ} (pm : p m) : ∃ n ∈ rfind p, n ≤ m := have tt ∈ (p : ℕ →. bool) m, from ⟨trivial, pm⟩, let ⟨n, hn⟩ := dom_iff_mem.1 $ (@rfind_dom p).2 ⟨m, this, λ k h, ⟨⟩⟩ in ⟨n, hn, not_lt.1 $ λ h, by injection mem_unique this (rfind_min hn h)⟩ theorem rfind_zero_none (p : ℕ →. bool) (p0 : p 0 = none) : rfind p = none := eq_none_iff.2 $ λ a h, let ⟨n, h₁, h₂⟩ := rfind_dom'.1 h.fst in (p0 ▸ h₂ (zero_le _) : (@roption.none bool).dom) def rfind_opt {α} (f : ℕ → option α) : roption α := (rfind (λ n, (f n).is_some)).bind (λ n, f n) theorem rfind_opt_spec {α} {f : ℕ → option α} {a} (h : a ∈ rfind_opt f) : ∃ n, a ∈ f n := let ⟨n, h₁, h₂⟩ := mem_bind_iff.1 h in ⟨n, mem_coe.1 h₂⟩ theorem rfind_opt_dom {α} {f : ℕ → option α} : (rfind_opt f).dom ↔ ∃ n a, a ∈ f n := ⟨λ h, (rfind_opt_spec ⟨h, rfl⟩).imp (λ n h, ⟨_, h⟩), λ h, begin have h' : ∃ n, (f n).is_some := h.imp (λ n, option.is_some_iff_exists.2), have s := nat.find_spec h', have fd : (rfind (λ n, (f n).is_some)).dom := ⟨nat.find h', by simpa using s.symm, λ _ _, trivial⟩, refine ⟨fd, _⟩, have := rfind_spec (get_mem fd), simp at this ⊢, cases option.is_some_iff_exists.1 this.symm with a e, rw e, trivial end⟩ theorem rfind_opt_mono {α} {f : ℕ → option α} (H : ∀ {a m n}, m ≤ n → a ∈ f m → a ∈ f n) {a} : a ∈ rfind_opt f ↔ ∃ n, a ∈ f n := ⟨rfind_opt_spec, λ ⟨n, h⟩, begin have h' := rfind_opt_dom.2 ⟨_, _, h⟩, cases rfind_opt_spec ⟨h', rfl⟩ with k hk, have := (H (le_max_left _ _) h).symm.trans (H (le_max_right _ _) hk), simp at this, simp [this, get_mem] end⟩ inductive partrec : (ℕ →. ℕ) → Prop | zero : partrec (pure 0) | succ : partrec succ | left : partrec (λ n, n.unpair.1) | right : partrec (λ n, n.unpair.2) | pair {f g} : partrec f → partrec g → partrec (λ n, mkpair <$> f n <*> g n) | comp {f g} : partrec f → partrec g → partrec (λ n, g n >>= f) | prec {f g} : partrec f → partrec g → partrec (unpaired (λ a n, n.elim (f a) (λ y IH, do i ← IH, g (mkpair a (mkpair y i))))) | rfind {f} : partrec f → partrec (λ a, rfind (λ n, (λ m, m = 0) <$> f (mkpair a n))) namespace partrec theorem of_eq {f g : ℕ →. ℕ} (hf : partrec f) (H : ∀ n, f n = g n) : partrec g := (funext H : f = g) ▸ hf theorem of_eq_tot {f : ℕ →. ℕ} {g : ℕ → ℕ} (hf : partrec f) (H : ∀ n, g n ∈ f n) : partrec g := hf.of_eq (λ n, eq_some_iff.2 (H n)) theorem of_primrec {f : ℕ → ℕ} (hf : primrec f) : partrec f := begin induction hf, case nat.primrec.zero { exact zero }, case nat.primrec.succ { exact succ }, case nat.primrec.left { exact left }, case nat.primrec.right { exact right }, case nat.primrec.pair : f g hf hg pf pg { refine (pf.pair pg).of_eq_tot (λ n, _), simp [has_seq.seq] }, case nat.primrec.comp : f g hf hg pf pg { refine (pf.comp pg).of_eq_tot (λ n, _), simp }, case nat.primrec.prec : f g hf hg pf pg { refine (pf.prec pg).of_eq_tot (λ n, _), simp, induction n.unpair.2 with m IH, {simp}, simp, exact ⟨_, IH, rfl⟩ }, end protected theorem some : partrec some := of_primrec primrec.id theorem none : partrec (λ n, none) := (of_primrec (nat.primrec.const 1)).rfind.of_eq $ λ n, eq_none_iff.2 $ λ a ⟨h, e⟩, by simpa using h theorem prec' {f g h} (hf : partrec f) (hg : partrec g) (hh : partrec h) : partrec (λ a, (f a).bind (λ n, n.elim (g a) (λ y IH, do i ← IH, h (mkpair a (mkpair y i))))) := ((prec hg hh).comp (pair partrec.some hf)).of_eq $ λ a, ext $ λ s, by simp [(<*>)]; exact ⟨λ ⟨n, h₁, h₂⟩, ⟨_, ⟨_, h₁, rfl⟩, by simpa using h₂⟩, λ ⟨_, ⟨n, h₁, rfl⟩, h₂⟩, ⟨_, h₁, by simpa using h₂⟩⟩ theorem ppred : partrec (λ n, ppred n) := have primrec₂ (λ n m, if n = nat.succ m then 0 else 1), from (primrec.ite (@@primrec_rel.comp _ _ _ _ _ _ _ primrec.eq primrec.fst (_root_.primrec.succ.comp primrec.snd)) (_root_.primrec.const 0) (_root_.primrec.const 1)).to₂, (of_primrec (primrec₂.unpaired'.2 this)).rfind.of_eq $ λ n, begin cases n; simp, { exact eq_none_iff.2 (λ a ⟨⟨m, h, _⟩, _⟩, by simpa [show 0 ≠ m.succ, by intro h; injection h] using h) }, { refine eq_some_iff.2 _, simp, intros m h, simp [ne_of_gt h] } end end partrec end nat def partrec {α σ} [primcodable α] [primcodable σ] (f : α →. σ) := nat.partrec (λ n, roption.bind (decode α n) (λ a, (f a).map encode)) def partrec₂ {α β σ} [primcodable α] [primcodable β] [primcodable σ] (f : α → β →. σ) := partrec (λ p : α × β, f p.1 p.2) def computable {α σ} [primcodable α] [primcodable σ] (f : α → σ) := partrec (f : α →. σ) def computable₂ {α β σ} [primcodable α] [primcodable β] [primcodable σ] (f : α → β → σ) := computable (λ p : α × β, f p.1 p.2) theorem primrec.to_comp {α σ} [primcodable α] [primcodable σ] {f : α → σ} (hf : primrec f) : computable f := (nat.partrec.ppred.comp (nat.partrec.of_primrec hf)).of_eq $ λ n, by simp; cases decode α n; simp theorem primrec₂.to_comp {α β σ} [primcodable α] [primcodable β] [primcodable σ] {f : α → β → σ} (hf : primrec₂ f) : computable₂ f := hf.to_comp theorem computable.part {α σ} [primcodable α] [primcodable σ] {f : α → σ} (hf : computable f) : partrec (f : α →. σ) := hf theorem computable₂.part {α β σ} [primcodable α] [primcodable β] [primcodable σ] {f : α → β → σ} (hf : computable₂ f) : partrec₂ (λ a, (f a : β →. σ)) := hf namespace computable variables {α : Type*} {β : Type*} {γ : Type*} {σ : Type*} variables [primcodable α] [primcodable β] [primcodable γ] [primcodable σ] theorem of_eq {f g : α → σ} (hf : computable f) (H : ∀ n, f n = g n) : computable g := (funext H : f = g) ▸ hf theorem const (s : σ) : computable (λ a : α, s) := (primrec.const _).to_comp theorem of_option {f : α → option β} (hf : computable f) : partrec (λ a, (f a : roption β)) := (nat.partrec.ppred.comp hf).of_eq $ λ n, begin cases decode α n with a; simp, cases f a with b; simp end theorem to₂ {f : α × β → σ} (hf : computable f) : computable₂ (λ a b, f (a, b)) := hf.of_eq $ λ ⟨a, b⟩, rfl protected theorem id : computable (@id α) := primrec.id.to_comp theorem fst : computable (@prod.fst α β) := primrec.fst.to_comp theorem snd : computable (@prod.snd α β) := primrec.snd.to_comp theorem pair {f : α → β} {g : α → γ} (hf : computable f) (hg : computable g) : computable (λ a, (f a, g a)) := (hf.pair hg).of_eq $ λ n, by cases decode α n; simp [(<*>)] theorem unpair : computable nat.unpair := primrec.unpair.to_comp theorem succ : computable nat.succ := primrec.succ.to_comp theorem pred : computable nat.pred := primrec.pred.to_comp theorem nat_bodd : computable nat.bodd := primrec.nat_bodd.to_comp theorem nat_div2 : computable nat.div2 := primrec.nat_div2.to_comp theorem sum_inl : computable (@sum.inl α β) := primrec.sum_inl.to_comp theorem sum_inr : computable (@sum.inr α β) := primrec.sum_inr.to_comp theorem list_cons : computable₂ (@list.cons α) := primrec.list_cons.to_comp theorem list_reverse : computable (@list.reverse α) := primrec.list_reverse.to_comp theorem list_nth : computable₂ (@list.nth α) := primrec.list_nth.to_comp theorem list_append : computable₂ ((++) : list α → list α → list α) := primrec.list_append.to_comp theorem list_concat : computable₂ (λ l (a:α), l ++ [a]) := primrec.list_concat.to_comp theorem list_length : computable (@list.length α) := primrec.list_length.to_comp theorem vector_cons {n} : computable₂ (@vector.cons α n) := primrec.vector_cons.to_comp theorem vector_to_list {n} : computable (@vector.to_list α n) := primrec.vector_to_list.to_comp theorem vector_length {n} : computable (@vector.length α n) := primrec.vector_length.to_comp theorem vector_head {n} : computable (@vector.head α n) := primrec.vector_head.to_comp theorem vector_tail {n} : computable (@vector.tail α n) := primrec.vector_tail.to_comp theorem vector_nth {n} : computable₂ (@vector.nth α n) := primrec.vector_nth.to_comp theorem vector_nth' {n} : computable (@vector.nth α n) := primrec.vector_nth'.to_comp theorem vector_of_fn' {n} : computable (@vector.of_fn α n) := primrec.vector_of_fn'.to_comp theorem fin_app {n} : computable₂ (@id (fin n → σ)) := primrec.fin_app.to_comp protected theorem encode : computable (@encode α _) := primrec.encode.to_comp protected theorem decode : computable (decode α) := primrec.decode.to_comp protected theorem of_nat (α) [denumerable α] : computable (of_nat α) := (primrec.of_nat _).to_comp theorem encode_iff {f : α → σ} : computable (λ a, encode (f a)) ↔ computable f := iff.rfl theorem option_some : computable (@option.some α) := primrec.option_some.to_comp end computable namespace partrec variables {α : Type*} {β : Type*} {γ : Type*} {σ : Type*} variables [primcodable α] [primcodable β] [primcodable γ] [primcodable σ] open computable theorem of_eq {f g : α →. σ} (hf : partrec f) (H : ∀ n, f n = g n) : partrec g := (funext H : f = g) ▸ hf theorem of_eq_tot {f : α →. σ} {g : α → σ} (hf : partrec f) (H : ∀ n, g n ∈ f n) : computable g := hf.of_eq (λ a, eq_some_iff.2 (H a)) theorem none : partrec (λ a : α, @roption.none σ) := nat.partrec.none.of_eq $ λ n, by cases decode α n; simp protected theorem some : partrec (@roption.some α) := computable.id theorem const' (s : roption σ) : partrec (λ a : α, s) := by haveI := classical.dec s.dom; exact (of_option (const (to_option s))).of_eq (λ a, of_to_option s) protected theorem bind {f : α →. β} {g : α → β →. σ} (hf : partrec f) (hg : partrec₂ g) : partrec (λ a, (f a).bind (g a)) := (hg.comp (nat.partrec.some.pair hf)).of_eq $ λ n, by simp [(<*>)]; cases e : decode α n with a; simp [e, encodek] theorem map {f : α →. β} {g : α → β → σ} (hf : partrec f) (hg : computable₂ g) : partrec (λ a, (f a).map (g a)) := by simpa [bind_some_eq_map] using @@partrec.bind _ _ _ (λ a b, roption.some (g a b)) hf hg theorem to₂ {f : α × β →. σ} (hf : partrec f) : partrec₂ (λ a b, f (a, b)) := hf.of_eq $ λ ⟨a, b⟩, rfl theorem nat_elim {f : α → ℕ} {g : α →. σ} {h : α → ℕ × σ →. σ} (hf : computable f) (hg : partrec g) (hh : partrec₂ h) : partrec (λ a, (f a).elim (g a) (λ y IH, IH.bind (λ i, h a (y, i)))) := (nat.partrec.prec' hf hg hh).of_eq $ λ n, begin cases e : decode α n with a; simp [e], induction f a with m IH; simp, rw [IH, bind_map], congr, funext s, simp [encodek] end theorem comp {f : β →. σ} {g : α → β} (hf : partrec f) (hg : computable g) : partrec (λ a, f (g a)) := (hf.comp hg).of_eq $ λ n, by simp; cases e : decode α n with a; simp [e, encodek] theorem nat_iff {f : ℕ →. ℕ} : partrec f ↔ nat.partrec f := by simp [partrec, map_id'] theorem map_encode_iff {f : α →. σ} : partrec (λ a, (f a).map encode) ↔ partrec f := iff.rfl end partrec namespace partrec₂ variables {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} {σ : Type*} variables [primcodable α] [primcodable β] [primcodable γ] [primcodable δ] [primcodable σ] theorem unpaired {f : ℕ → ℕ →. α} : partrec (nat.unpaired f) ↔ partrec₂ f := ⟨λ h, by simpa using h.comp primrec₂.mkpair.to_comp, λ h, h.comp primrec.unpair.to_comp⟩ theorem unpaired' {f : ℕ → ℕ →. ℕ} : nat.partrec (nat.unpaired f) ↔ partrec₂ f := partrec.nat_iff.symm.trans unpaired theorem comp {f : β → γ →. σ} {g : α → β} {h : α → γ} (hf : partrec₂ f) (hg : computable g) (hh : computable h) : partrec (λ a, f (g a) (h a)) := hf.comp (hg.pair hh) theorem comp₂ {f : γ → δ →. σ} {g : α → β → γ} {h : α → β → δ} (hf : partrec₂ f) (hg : computable₂ g) (hh : computable₂ h) : partrec₂ (λ a b, f (g a b) (h a b)) := hf.comp hg hh end partrec₂ namespace computable variables {α : Type*} {β : Type*} {γ : Type*} {σ : Type*} variables [primcodable α] [primcodable β] [primcodable γ] [primcodable σ] theorem comp {f : β → σ} {g : α → β} (hf : computable f) (hg : computable g) : computable (λ a, f (g a)) := hf.comp hg theorem comp₂ {f : γ → σ} {g : α → β → γ} (hf : computable f) (hg : computable₂ g) : computable₂ (λ a b, f (g a b)) := hf.comp hg end computable namespace computable₂ variables {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} {σ : Type*} variables [primcodable α] [primcodable β] [primcodable γ] [primcodable δ] [primcodable σ] theorem comp {f : β → γ → σ} {g : α → β} {h : α → γ} (hf : computable₂ f) (hg : computable g) (hh : computable h) : computable (λ a, f (g a) (h a)) := hf.comp (hg.pair hh) theorem comp₂ {f : γ → δ → σ} {g : α → β → γ} {h : α → β → δ} (hf : computable₂ f) (hg : computable₂ g) (hh : computable₂ h) : computable₂ (λ a b, f (g a b) (h a b)) := hf.comp hg hh end computable₂ namespace partrec variables {α : Type*} {β : Type*} {γ : Type*} {σ : Type*} variables [primcodable α] [primcodable β] [primcodable γ] [primcodable σ] open computable theorem rfind {p : α → ℕ →. bool} (hp : partrec₂ p) : partrec (λ a, nat.rfind (p a)) := (nat.partrec.rfind $ hp.map ((primrec.dom_bool (λ b, cond b 0 1)) .comp primrec.snd).to₂.to_comp).of_eq $ λ n, begin cases e : decode α n with a; simp [e, nat.rfind_zero_none, map_id'], congr, funext n, simp [roption.map_map, (∘)], apply map_id' (λ b, _), cases b; refl end theorem rfind_opt {f : α → ℕ → option σ} (hf : computable₂ f) : partrec (λ a, nat.rfind_opt (f a)) := (rfind (primrec.option_is_some.to_comp.comp hf).part.to₂).bind (of_option hf) theorem nat_cases_right {f : α → ℕ} {g : α → σ} {h : α → ℕ →. σ} (hf : computable f) (hg : computable g) (hh : partrec₂ h) : partrec (λ a, (f a).cases (some (g a)) (h a)) := (nat_elim hf hg (hh.comp fst (pred.comp $ hf.comp fst)).to₂).of_eq $ λ a, begin simp, cases f a; simp, refine ext (λ b, ⟨λ H, _, λ H, _⟩), { rcases mem_bind_iff.1 H with ⟨c, h₁, h₂⟩, exact h₂ }, { have : ∀ m, (nat.elim (roption.some (g a)) (λ y IH, IH.bind (λ _, h a n)) m).dom, { intro, induction m; simp [*, H.fst] }, exact ⟨⟨this n, H.fst⟩, H.snd⟩ } end theorem bind_decode2_iff {f : α →. σ} : partrec f ↔ nat.partrec (λ n, roption.bind (decode2 α n) (λ a, (f a).map encode)) := ⟨λ hf, nat_iff.1 $ (of_option primrec.decode2.to_comp).bind $ (map hf (computable.encode.comp snd).to₂).comp snd, λ h, map_encode_iff.1 $ by simpa [encodek2] using (nat_iff.2 h).comp (@computable.encode α _)⟩ theorem vector_m_of_fn : ∀ {n} {f : fin n → α →. σ}, (∀ i, partrec (f i)) → partrec (λ (a : α), vector.m_of_fn (λ i, f i a)) | 0 f hf := const _ | (n+1) f hf := by simp [vector.m_of_fn]; exact (hf 0).bind (partrec.bind ((vector_m_of_fn (λ i, hf i.succ)).comp fst) (primrec.vector_cons.to_comp.comp (snd.comp fst) snd)) end partrec @[simp] theorem vector.m_of_fn_roption_some {α n} : ∀ (f : fin n → α), vector.m_of_fn (λ i, roption.some (f i)) = roption.some (vector.of_fn f) := vector.m_of_fn_pure namespace computable variables {α : Type*} {β : Type*} {γ : Type*} {σ : Type*} variables [primcodable α] [primcodable β] [primcodable γ] [primcodable σ] theorem option_some_iff {f : α → σ} : computable (λ a, some (f a)) ↔ computable f := ⟨λ h, encode_iff.1 $ primrec.pred.to_comp.comp $ encode_iff.2 h, option_some.comp⟩ theorem bind_decode_iff {f : α → β → option σ} : computable₂ (λ a n, (decode β n).bind (f a)) ↔ computable₂ f := ⟨λ hf, nat.partrec.of_eq (((partrec.nat_iff.2 (nat.partrec.ppred.comp $ nat.partrec.of_primrec $ primcodable.prim β)).comp snd).bind (computable.comp hf fst).to₂.part) $ λ n, by simp; cases decode α n.unpair.1; simp; cases decode β n.unpair.2; simp, λ hf, begin have : partrec (λ a : α × ℕ, (encode (decode β a.2)).cases (some option.none) (λ n, roption.map (f a.1) (decode β n))) := partrec.nat_cases_right (primrec.encdec.to_comp.comp snd) (const none) ((of_option (computable.decode.comp snd)).map (hf.comp (fst.comp $ fst.comp fst) snd).to₂), refine this.of_eq (λ a, _), simp, cases decode β a.2; simp [encodek] end⟩ theorem map_decode_iff {f : α → β → σ} : computable₂ (λ a n, (decode β n).map (f a)) ↔ computable₂ f := bind_decode_iff.trans option_some_iff theorem nat_elim {f : α → ℕ} {g : α → σ} {h : α → ℕ × σ → σ} (hf : computable f) (hg : computable g) (hh : computable₂ h) : computable (λ a, (f a).elim (g a) (λ y IH, h a (y, IH))) := (partrec.nat_elim hf hg hh.part).of_eq $ λ a, by simp; induction f a; simp * theorem nat_cases {f : α → ℕ} {g : α → σ} {h : α → ℕ → σ} (hf : computable f) (hg : computable g) (hh : computable₂ h) : computable (λ a, (f a).cases (g a) (h a)) := nat_elim hf hg (hh.comp fst $ fst.comp snd).to₂ theorem cond {c : α → bool} {f : α → σ} {g : α → σ} (hc : computable c) (hf : computable f) (hg : computable g) : computable (λ a, cond (c a) (f a) (g a)) := (nat_cases (encode_iff.2 hc) hg (hf.comp fst).to₂).of_eq $ λ a, by cases c a; refl theorem option_cases {o : α → option β} {f : α → σ} {g : α → β → σ} (ho : computable o) (hf : computable f) (hg : computable₂ g) : @computable _ σ _ _ (λ a, option.cases_on (o a) (f a) (g a)) := option_some_iff.1 $ (nat_cases (encode_iff.2 ho) (option_some_iff.2 hf) (map_decode_iff.2 hg)).of_eq $ λ a, by cases o a; simp [encodek]; refl theorem option_bind {f : α → option β} {g : α → β → option σ} (hf : computable f) (hg : computable₂ g) : computable (λ a, (f a).bind (g a)) := (option_cases hf (const option.none) hg).of_eq $ λ a, by cases f a; refl theorem option_map {f : α → option β} {g : α → β → σ} (hf : computable f) (hg : computable₂ g) : computable (λ a, (f a).map (g a)) := option_bind hf (option_some.comp₂ hg) theorem sum_cases {f : α → β ⊕ γ} {g : α → β → σ} {h : α → γ → σ} (hf : computable f) (hg : computable₂ g) (hh : computable₂ h) : @computable _ σ _ _ (λ a, sum.cases_on (f a) (g a) (h a)) := option_some_iff.1 $ (cond (nat_bodd.comp $ encode_iff.2 hf) (option_map (computable.decode.comp $ nat_div2.comp $ encode_iff.2 hf) hh) (option_map (computable.decode.comp $ nat_div2.comp $ encode_iff.2 hf) hg)).of_eq $ λ a, by cases f a with b c; simp [nat.div2_bit, nat.bodd_bit, encodek]; refl theorem nat_strong_rec (f : α → ℕ → σ) {g : α → list σ → option σ} (hg : computable₂ g) (H : ∀ a n, g a ((list.range n).map (f a)) = some (f a n)) : computable₂ f := suffices computable₂ (λ a n, (list.range n).map (f a)), from option_some_iff.1 $ (list_nth.comp (this.comp fst (succ.comp snd)) snd).to₂.of_eq $ λ a, by simp [list.nth_range (nat.lt_succ_self a.2)]; refl, option_some_iff.1 $ (nat_elim snd (const (option.some [])) (to₂ $ option_bind (snd.comp snd) $ to₂ $ option_map (hg.comp (fst.comp $ fst.comp fst) snd) (to₂ $ list_concat.comp (snd.comp fst) snd))).of_eq $ λ a, begin simp, induction a.2 with n IH, {refl}, simp [IH, H, list.range_concat] end theorem list_of_fn : ∀ {n} {f : fin n → α → σ}, (∀ i, computable (f i)) → computable (λ a, list.of_fn (λ i, f i a)) | 0 f hf := const [] | (n+1) f hf := by simp [list.of_fn_succ]; exact list_cons.comp (hf 0) (list_of_fn (λ i, hf i.succ)) theorem vector_of_fn {n} {f : fin n → α → σ} (hf : ∀ i, computable (f i)) : computable (λ a, vector.of_fn (λ i, f i a)) := (partrec.vector_m_of_fn hf).of_eq $ λ a, by simp end computable namespace partrec variables {α : Type*} {β : Type*} {γ : Type*} {σ : Type*} variables [primcodable α] [primcodable β] [primcodable γ] [primcodable σ] open computable theorem option_some_iff {f : α →. σ} : partrec (λ a, (f a).map option.some) ↔ partrec f := ⟨λ h, (nat.partrec.ppred.comp h).of_eq $ λ n, by simp [roption.bind_assoc, bind_some_eq_map], λ hf, hf.map (option_some.comp snd).to₂⟩ theorem option_cases_right {o : α → option β} {f : α → σ} {g : α → β →. σ} (ho : computable o) (hf : computable f) (hg : partrec₂ g) : @partrec _ σ _ _ (λ a, option.cases_on (o a) (some (f a)) (g a)) := have partrec (λ (a : α), nat.cases (roption.some (f a)) (λ n, roption.bind (decode β n) (g a)) (encode (o a))) := nat_cases_right (encode_iff.2 ho) hf.part $ ((@computable.decode β _).comp snd).of_option.bind (hg.comp (fst.comp fst) snd).to₂, this.of_eq $ λ a, by cases o a with b; simp [encodek] theorem sum_cases_right {f : α → β ⊕ γ} {g : α → β → σ} {h : α → γ →. σ} (hf : computable f) (hg : computable₂ g) (hh : partrec₂ h) : @partrec _ σ _ _ (λ a, sum.cases_on (f a) (λ b, some (g a b)) (h a)) := have partrec (λ a, (option.cases_on (sum.cases_on (f a) (λ b, option.none) option.some : option γ) (some (sum.cases_on (f a) (λ b, some (g a b)) (λ c, option.none))) (λ c, (h a c).map option.some) : roption (option σ))) := option_cases_right (sum_cases hf (const option.none).to₂ (option_some.comp snd).to₂) (sum_cases hf (option_some.comp hg) (const option.none).to₂) (option_some_iff.2 hh), option_some_iff.1 $ this.of_eq $ λ a, by cases f a; simp theorem sum_cases_left {f : α → β ⊕ γ} {g : α → β →. σ} {h : α → γ → σ} (hf : computable f) (hg : partrec₂ g) (hh : computable₂ h) : @partrec _ σ _ _ (λ a, sum.cases_on (f a) (g a) (λ c, some (h a c))) := (sum_cases_right (sum_cases hf (sum_inr.comp snd).to₂ (sum_inl.comp snd).to₂) hh hg).of_eq $ λ a, by cases f a; simp private lemma fix_aux {f : α →. σ ⊕ α} (hf : partrec f) (a : α) (b : σ) : let F : α → ℕ →. σ ⊕ α := λ a n, n.elim (some (sum.inr a)) $ λ y IH, IH.bind $ λ s, sum.cases_on s (λ _, roption.some s) f in (∃ (n : ℕ), ((∃ (b' : σ), sum.inl b' ∈ F a n) ∧ ∀ {m : ℕ}, m < n → (∃ (b : α), sum.inr b ∈ F a m)) ∧ sum.inl b ∈ F a n) ↔ b ∈ pfun.fix f a := begin intro, refine ⟨λ h, _, λ h, _⟩, { rcases h with ⟨n, ⟨_x, h₁⟩, h₂⟩, have : ∀ m a' (_: sum.inr a' ∈ F a m) (_: b ∈ pfun.fix f a'), b ∈ pfun.fix f a, { intros m a' am ba, induction m with m IH generalizing a'; simp [F] at am, { rwa ← am }, rcases am with ⟨a₂, am₂, fa₂⟩, exact IH _ am₂ (pfun.mem_fix_iff.2 (or.inr ⟨_, fa₂, ba⟩)) }, cases n; simp [F] at h₂, {cases h₂}, rcases h₂ with h₂ | ⟨a', am', fa'⟩, { cases h₁ (nat.lt_succ_self _) with a' h, injection mem_unique h h₂ }, { exact this _ _ am' (pfun.mem_fix_iff.2 (or.inl fa')) } }, { suffices : ∀ a' (_: b ∈ pfun.fix f a') k (_: sum.inr a' ∈ F a k), ∃ n, sum.inl b ∈ F a n ∧ ∀ (m < n) (_ : k ≤ m), ∃ a₂, sum.inr a₂ ∈ F a m, { rcases this _ h 0 (by simp [F]) with ⟨n, hn₁, hn₂⟩, exact ⟨_, ⟨⟨_, hn₁⟩, λ m mn, hn₂ m mn (nat.zero_le _)⟩, hn₁⟩ }, intros a₁ h₁, apply pfun.fix_induction h₁, intros a₂ h₂ IH k hk, rcases pfun.mem_fix_iff.1 h₂ with h₂ | ⟨a₃, am₃, fa₃⟩, { refine ⟨k.succ, _, λ m mk km, ⟨a₂, _⟩⟩, { simp [F], exact or.inr ⟨_, hk, h₂⟩ }, { rwa le_antisymm (nat.le_of_lt_succ mk) km } }, { rcases IH _ fa₃ am₃ k.succ _ with ⟨n, hn₁, hn₂⟩, { refine ⟨n, hn₁, λ m mn km, _⟩, cases lt_or_eq_of_le km with km km, { exact hn₂ _ mn km }, { exact km ▸ ⟨_, hk⟩ } }, { simp [F], exact ⟨_, hk, am₃⟩ } } } end theorem fix {f : α →. σ ⊕ α} (hf : partrec f) : partrec (pfun.fix f) := let F : α → ℕ →. σ ⊕ α := λ a n, n.elim (some (sum.inr a)) $ λ y IH, IH.bind $ λ s, sum.cases_on s (λ _, roption.some s) f in have hF : partrec₂ F := partrec.nat_elim snd (sum_inr.comp fst).part (sum_cases_right (snd.comp snd) (snd.comp $ snd.comp fst).to₂ (hf.comp snd).to₂).to₂, let p := λ a n, @roption.map _ bool (λ s, sum.cases_on s (λ_, tt) (λ _, ff)) (F a n) in have hp : partrec₂ p := hF.map ((sum_cases computable.id (const tt).to₂ (const ff).to₂).comp snd).to₂, (hp.rfind.bind (hF.bind (sum_cases_right snd snd.to₂ none.to₂).to₂).to₂).of_eq $ λ a, ext $ λ b, by simp; apply fix_aux hf end partrec
## Table 11.5, DeGroot (4th ed.) boiling.pt <- read.csv(file = "dados_ponto_fervura.csv") head(boiling.pt) ## Ajustando o modelo linmod <- lm(pressao ~ pt_fervura, data = boiling.pt) summary(linmod) ### plotting code taken from https://rstudio-pubs-static.s3.amazonaws.com/71339_d0b8346f41314979bc394448c5d60d86.html temp_var <- predict(linmod, interval = "prediction") new_df <- cbind(boiling.pt, temp_var) library(ggplot2) p0 <- ggplot(new_df, aes(pt_fervura, pressao))+ geom_point() + scale_x_continuous("Ponto de fervura da água (ºF)") + scale_y_continuous("Pressão atmosférica (inHG)") + theme_bw(base_size = 16) p0 p1 <- p0 + geom_line(aes(y = lwr), color = "red", linetype = "dashed")+ geom_line(aes(y = upr), color = "red", linetype = "dashed")+ geom_smooth(method=lm, se = TRUE) + theme_bw(base_size = 16) p1
lemma emeasure_sup_measure': assumes sets_eq[simp]: "sets B = sets A" and [simp, intro]: "X \<in> sets A" shows "emeasure (sup_measure' A B) X = (SUP Y\<in>sets A. emeasure A (X \<inter> Y) + emeasure B (X \<inter> - Y))" (is "_ = ?S X")
From discprob.basic Require Import base order nify. From discprob.prob Require Import prob countable finite stochastic_order. From discprob.rec Require Import karp. From mathcomp Require Import ssreflect ssrbool ssrfun eqtype ssrnat seq div choice fintype. From mathcomp Require Import tuple finfun bigop prime binomial finset. Require Import Reals Fourier FunctionalExtensionality. Require Import Psatz. Require Import Coq.omega.Omega. Require Import Ranalysis5. Global Set Bullet Behavior "Strict Subproofs". Lemma Rlt_plus_reg a b a' b': a + b < a' + b' → (a < a') ∨ (b < b'). Proof. intros. destruct (Rlt_dec a a') as [|?%Rnot_lt_ge]; first by auto. destruct (Rlt_dec b b') as [|?%Rnot_lt_ge]; first by auto. fourier. Qed. Section lemma31_simplex. Variable A: finType. Variable B: eqType. Variable Ω: distrib A. Variable X: rvar Ω [eqType of B * B]. Variable size: B → R. Variable g: R → R. Variable f: R → R. Variable x c: R. Hypothesis xgt : x > 0. Hypothesis cgt : c > 0. Hypothesis Xrange11: ∀ r, r \in img X → 0 ≤ size (fst r). Hypothesis Xrange21: ∀ r, r \in img X → 0 ≤ size (snd r). Hypothesis Xrange12: ∀ r, r \in img X → size (fst r) ≤ x. Hypothesis Xrange22: ∀ r, r \in img X → size (snd r) ≤ x. Hypothesis grange1: ∀ r, r \in img X → 0 ≤ g (size (fst r)). Hypothesis grange2: ∀ r, r \in img X → 0 ≤ g (size (snd r)). Hypothesis grange_sum: ∀ r, r \in img X → g (size (fst r)) + g (size (snd r)) ≤ g x. Hypothesis f0: f 0 = 0. Hypothesis frange1: ∀ x, 0 ≤ f x. Variable z : R. Hypothesis zgt1 : z ≥ 1. Hypothesis frange2: ∀ y, y ≥ c → f y = z. Hypothesis fnondec: ∀ y y', (y ≤ y') ∧ (0 < y ∧ y ≤ c) ∧ (0 < y' ∧ y' ≤ c) → (f y / y) ≤ (f y' / y'). Lemma min_xc_gt: Rmin x c > 0. Proof. by apply Rmin_case. Qed. Lemma min_xc_neq0: Rmin x c ≠ 0. Proof. eapply Rlt_not_eq'. apply min_xc_gt. Qed. Lemma fmono_aux y y': 0 ≤ y → y ≤ y' → y' ≤ c → f y ≤ f y'. Proof. intros Hge0 Hle Hlec. inversion Hge0; last first. { subst. rewrite f0; eauto. } assert (f y / y ≤ f y' / y') as Hdiv. { eapply fnondec. repeat split; eauto; try fourier. } apply (Rmult_le_reg_r (/ y')). { apply Rinv_0_lt_compat; fourier. } transitivity (f y / y); last by auto. rewrite /Rdiv. apply Rmult_le_compat; auto; try fourier. * left. apply Rinv_0_lt_compat; fourier. * apply Rinv_le_contravar; fourier. Qed. Lemma fmono y y': 0 ≤ y → y ≤ y' → f y ≤ f y'. Proof. intros Hge0 Hle. destruct (Rle_dec y' c) as [?|Hgt%Rnot_le_gt]; first apply fmono_aux; eauto. destruct (Rle_dec y c) as [?|Hgt'%Rnot_le_gt]. - rewrite (frange2 y'); last fourier. rewrite -(frange2 c); last fourier. apply fmono_aux; auto; fourier. - rewrite (frange2 y'); last fourier. rewrite (frange2 y); last fourier. reflexivity. Qed. Lemma lemma31_simplex: Ex (rvar_comp X (λ r, (g (size (fst r))) * f (size (fst r)) + (g (size (snd r))) * f (size (snd r)))) ≤ (Ex (rvar_comp X (λ r, Rmax (size (fst r)) (size (snd r))))) * (g x * f (Rmin x c) / (Rmin x c)). Proof. rewrite /Rdiv Rmult_comm. rewrite ?Ex_fin_pt. rewrite big_distrr//=. apply (Rle_bigr) => r Hin. - rewrite -?Rmult_assoc. apply (Rmult_le_compat_r (rvar_dist X r)); first by (auto using Rge_le, pmf_pos). etransitivity. { apply Rplus_le_compat; apply Rmult_le_compat_l. - apply grange1, img_alt. exists r. auto. - apply (fmono _ (Rmax (size (fst (X r))) (size (snd (X r))))). * apply Xrange11, img_alt. exists r. auto. * apply Rmax_l. - apply grange2, img_alt. exists r. auto. - apply (fmono _ (Rmax (size (fst (X r))) (size (snd (X r))))). * apply Xrange21, img_alt. exists r. auto. * apply Rmax_r. } rewrite -Rmult_plus_distr_r. rewrite ?Rmult_assoc. apply Rmult_le_compat; eauto. { - replace 0 with (0 + 0) by field. apply Rplus_le_compat. * apply grange1, img_alt. exists r. auto. * apply grange2, img_alt. exists r. auto. } { apply grange_sum, img_alt. exists r. auto. } set (y := Rmax (size (fst (X r))) (size (snd (X r)))). rewrite -?/y. assert (y ≤ x). { rewrite /y. apply Rmax_case. * apply Xrange12, img_alt; eauto. * apply Xrange22, img_alt; eauto. } assert (g y ≤ g x). { assert (0 ≤ (g (size ((fst (X r)))))); first apply grange1, img_alt; eauto. assert (0 ≤ (g (size ((snd (X r)))))); first apply grange2, img_alt; eauto. rewrite /y; transitivity (g (size (X r).1) + g (size (X r).2)). - apply Rmax_case; fourier. - apply grange_sum, img_alt; eauto. } assert (0 ≤ y) as [Hgt|HX0]. { rewrite /y; apply Rmax_case; [ eapply Xrange11 | eapply Xrange21]; apply img_alt; exists r; eauto. } * apply (Rmult_le_reg_r (Rdiv 1 y)). apply Rdiv_lt_0_compat; fourier. transitivity (f (Rmin x c) / (Rmin x c)); last first. *** apply Req_le. field; split. **** by apply Rlt_not_eq'. **** apply min_xc_neq0. *** rewrite -Rmult_assoc. rewrite Rmult_1_r. destruct (Rlt_or_le y c). **** eapply fnondec; repeat split; auto; try fourier. { apply Rmin_case; fourier. } { apply Rmin_case; fourier. } { apply Rmin_r. } **** assert (Rmin x c = c) as ->. { apply Rmin_right. fourier. } rewrite frange2; last fourier. rewrite frange2; last fourier. rewrite /Rdiv. apply Rmult_le_compat; try fourier. { apply Rlt_le. apply Rinv_0_lt_compat. fourier. } eapply Rinv_le_contravar; fourier. * rewrite -HX0 f0 Rmult_0_r. fourier. Qed. End lemma31_simplex. Section span_bound_sec. Variable X: eqType. Variable size: X → R. Variable g: R → R. Variable A B : X → finType. Variable ΩT: ∀ x, distrib (A x). Variable Ωh: ∀ x, distrib (B x). Variable T: ∀ x: X, rrvar (ΩT x). Variable h: ∀ x: X, rvar (Ωh x) [eqType of X * X]%type. Variable P: X → Prop. Variable a: R → R. Variable m: R → R. Variable u u': R → R. Variable d: R. Hypothesis umin: R. Hypothesis umin_non_neg: 0 ≤ umin. Hypothesis umin_lb: ∀ x, x > d → umin ≤ u x - a x. Variable u_mono: ∀ x y, x ≤ y → u x ≤ u y. Variable u_strict_inc: ∀ x y, x ≥ d → x < y → u x < u y. Variable u'_mono: ∀ x y, x ≤ y → u' x ≤ u' y. Variable u'_pos: ∀ x, u' x > 0. Variable u'u: ∀ x, (* d < x → *) x ≤ u' (u x). Variable u'_inv_above: ∀ z, d < z → u' (u z) = z. Variable u_inv_above: ∀ z, umin < z → u (u' z) = z. Variable ud_umin: u d = umin. Variable m_bound_Eh: ∀ x, Ex (rvar_comp (h x) (λ x, Rmax (size (fst x)) (size (snd x)))) ≤ m (size x). Variable u_cont: ∀ x, d < x → continuity_pt u x. Variable a_cont: ∀ x, d < x → continuity_pt a x. Hypothesis T_non_neg: ∀ x n, (T x) n ≥ 0. Hypothesis Trec: ∀ x r, P x → size x > d → pr_gt (T x) r ≤ \big[Rplus/0]_(x' : imgT (h x)) (pr_eq (h x) (sval x') * pr_gt (rvar_comp (rvar_pair (T (fst (sval x'))) (T (snd (sval x')))) (fun xy => Rmax (fst xy) (snd xy))) (r - a (size x))). (* Hypothesis Trec: ∀ x r, pr (T x) r = \rsum_(x' <- img (h x)) (pr (h x) x') * pr (comp_rv (pair_rv (T (fst x')) (T (snd x'))) (fun xy => Rmax (fst xy) (snd xy))) (r - a (size x)). *) Hypothesis urec: ∀ x, x > d → u x ≥ a x + u (m x). Hypothesis hP: ∀ x n, P x → P (fst ((h x) n)) ∧ P (snd ((h x) n)). (* Hypothesis hrange_sum: ∀ x n, size (fst ((h x) n)) + size (snd ((h x) n)) ≤ size x. *) Hypothesis hgrange_sum: ∀ x n, size x > d → g (size (fst ((h x) n))) + g (size (snd ((h x) n))) ≤ g (size x). (* FIXME: 11, 21 follow from sum And 12 22 *) Hypothesis hrange11: ∀ x n, size (fst ((h x) n)) ≤ size x. Hypothesis hrange21: ∀ x n, size (snd ((h x) n)) ≤ size x. Hypothesis hrange12: ∀ x n, d < size x → 0 ≤ size (fst ((h x) n)). Hypothesis hrange22: ∀ x n, d < size x → 0 ≤ size (snd ((h x) n)). Hypothesis alower: ∀ x, x ≤ d → a x = 0. Hypothesis a_nonneg: ∀ x, a x ≥ 0. Hypothesis a_mono: Rmono a. Hypothesis a_pos: ∀ x, d < x → 0 < a x. Hypothesis mnondec: ∀ y y', 0 < y → y ≤ y' → (m y / y) ≤ (m y' / y'). Hypothesis d_non_neg: 0 ≤ d. Hypothesis mpos: ∀ x, 0 ≤ x → 0 ≤ m x. Definition Bn (nx: nat * X) : finType := B (snd nx). Definition Ωn (nx: nat * X) := Ωh (snd nx). Definition hpath (φ: nat → bool) (nx: nat * X) : rvar (Ωn nx) [eqType of nat * X]. destruct nx as (n, x). apply mkRvar. intros i. exact (match (φ n) with | true => (S n, fst ((h x) i)) | false => (S n, snd ((h x) i)) end). Defined. (* Definition Krecfun φ (i: nat) r x : R := Krec _ (λ x, size (snd x)) _ (hpath φ) a umin i r x. *) (* This could be weakend; I think what's needed is to say it in the limit it's bounded above by 2^-n *) Hypothesis hinf_0: ∀ a, ∃ n, ∀ φ, pr_gt (rvar_comp (recN_rvar (hpath φ) (O, a) n) (λ x, size (snd x))) d = 0. Hypothesis Tbelow: ∀ x e, size x ≤ d → (T x) e ≤ umin. Hypothesis gd: ∀ x, x > d → g x ≥ 1. Hypothesis gpos: ∀ x, 0 ≤ x → 0 ≤ g x. Hypothesis g_mono: Rmono g. Definition K r z := pr (rvar_dist (T z)) (λ n, Rgt_dec ((T z) n) r). Lemma umin_lb_simple: ∀ x, x ≥ d → umin ≤ u x. Proof. rewrite /Rge => x [Hgt|Heq]. - transitivity (u x - a x); first auto. assert (a x > 0) by (apply a_pos; auto). fourier. - subst. reflexivity. Qed. Lemma K_alt4 r z: P z → size z > d → K r z ≤ \big[Rplus/0]_(i : imgT (h z)) ((pr_eq (h z) (sval i) * ((K (r - (a (size z))) (fst (sval i))) + (K (r - (a (size z))) (snd (sval i)))))). Proof. rewrite {1}/K. etransitivity. { etransitivity; first apply Trec; last reflexivity; auto. } apply Rle_bigr. intros (x'&Hin) _. set (Trecpair := rvar_comp (rvar_pair (T x'.1) (T x'.2)) (λ xy, Rmax (fst xy) (snd xy))); rewrite -/Trecpair. apply Rmult_le_compat_l; first by (rewrite /pr_eq; apply Rge_le, ge_pr_0). set (pred_combined := (fun x: (A (fst x')) * A (snd x') => Rgt_dec (Rmax ((T x'.1) x.1) (T x'.2 x.2)) (r - a (size z))) : pred (A (fst x') * A (snd x'))). set (predA := (fun x: (A (fst x')) * A (snd x') => Rgt_dec (T (fst x') (fst x)) (r - a (size z))) : pred (A (fst x') * A (snd x'))). set (predB := (fun x: (A (fst x')) * A (snd x') => Rgt_dec (T (snd x') (snd x)) (r - a (size z))) : pred (A (fst x') * A (snd x'))). assert (Heq: pred_combined =i predU predA predB). { intros y. rewrite /in_mem//=/pred_combined/predA/predB/predU. apply Rmax_case_strong => Hcase; destruct (Rgt_dec) as [Hgt|Hnotgt] => //=; try nra; destruct (Rgt_dec) as [Hgt'|Hnotgt'] => //=; try nra; rewrite //= in Hgt', Hnotgt, Hcase; nra. } rewrite /pr_gt. rewrite (pr_eq_pred _ _ _ Heq). etransitivity; first apply pr_union_le. rewrite /K/Trecpair//=. apply Rplus_le_compat; right. - rewrite /predA. by rewrite (rvar_pair_marginal1 (T (fst x')) (T (snd x')) ((λ x, Rgt_dec ((T x'.1) x) (r - a (size z))))). - rewrite /predB. by rewrite (rvar_pair_marginal2 (T (fst x')) (T (snd x')) ((λ x, Rgt_dec ((T x'.2) x) (r - a (size z))))). Qed. Definition K0 r (z: X) := if (Rlt_dec r umin) then 1 else 0. Fixpoint Krec i r x := match i with | 0 => K0 r x | S i' => Rmin 1 (Ex (rvar_comp (h x) (fun x' => Krec i' (r - a (size x)) (fst x') + Krec i' (r - a (size x)) (snd x')))) end. Definition round r x := Rceil ((r - u x) / a x). Definition D r x := if Rle_dec r umin then 1 else if Rle_dec x d then 0 else if Rle_dec r (u x) then Rmax 1 (g (u' r)) else (m x / x)^(Z.to_nat (round r x)) * (g(x) * x / (u' (r - a(x) * IZR (round r x)))). Definition Dalt r x := if Rle_dec r umin then 1 else if Rle_dec x d then 0 else if Rlt_dec r (u x) then Rmax 1 (g (u' r)) else (m x / x)^(Z.to_nat (round r x)) * (g(x) * x / (u' (r - a(x) * IZR (round r x)))). Lemma D_Dalt_equiv r x: D r x = Dalt r x. Proof. rewrite /Dalt /D. destruct (Rle_dec) as [?|Hgt] => //=. apply Rnot_le_gt in Hgt. destruct (Rle_dec) as [?|Hgt'] => //=. apply Rnot_le_gt in Hgt'. destruct (Rle_dec) as [Hle|?] => //=. - inversion Hle as [Hlt|Heq]. * destruct (Rlt_dec) => //=. * subst. destruct (Rlt_dec) => //=. assert (round (u x) x = 0%Z) as ->. { rewrite /round. rewrite -Rceil_0. f_equal. rewrite Rminus_diag_eq // /Rdiv Rmult_0_l //. } rewrite //= Rmult_0_r /Rminus Ropp_0 Rplus_0_r u'_inv_above //=. rewrite /Rdiv Rmult_1_l. rewrite Rmax_right; first field. ** apply Rgt_not_eq; nra. ** apply Rge_le, gd; fourier. - destruct (Rlt_dec) => //=. intros. exfalso. nra. Qed. Lemma K_0 r z: r < 0 → K r z = 1. Proof. intros Hlt. rewrite /K /pr. rewrite -(pmf_sum1_Series (rvar_dist (T z))). rewrite ?SeriesC_fin_big. eapply eq_big; auto. intros x Hin. destruct (Rgt_dec) as [?|Hngt] => //=. exfalso; apply Hngt. eapply Rlt_le_trans; eauto. apply Rge_le, T_non_neg. Qed. Lemma K_unfold r x: P x → size x > d → K r x ≤ Ex (rvar_comp (h x) (fun x' => K (r - a (size x)) (fst x') + K (r - a (size x)) (snd x'))). Proof. intros; etransitivity; first apply K_alt4; auto. rewrite Ex_fin_comp. right; apply eq_bigr => ??. by rewrite Rmult_comm. Qed. Lemma Krec_non_decS: ∀ (i: nat) r x, Krec i r x ≤ Krec (S i) r x. Proof. induction i as [|i'] => r x. - rewrite /Krec. rewrite Ex_fin_pt //= /K0. destruct (Rlt_dec) as [H|H]; rewrite //= /rvar_comp //=. * destruct Rlt_dec as [|Hfalse]. ** apply Rmin_case_strong; intros; first nra. rewrite //=. rewrite -big_distrr //=. rewrite -SeriesC_fin_big pmf_sum1_Series. nra. ** exfalso. eapply Hfalse. specialize (a_nonneg (size x)). nra. * destruct Rlt_dec as [|]. ** apply Rmin_case_strong; intros; first fourier. rewrite //=. rewrite -big_distrr //=. rewrite -SeriesC_fin_big pmf_sum1_Series. nra. ** apply Rmin_case_strong; intros; first fourier. rewrite //=. rewrite -big_distrr //=. rewrite -SeriesC_fin_big pmf_sum1_Series. nra. - rewrite /Krec -/Krec. apply Rle_min_compat_l. rewrite ?Ex_fin_pt. apply (Rle_bigr) => i hin. rewrite //=. etransitivity. * apply Rmult_le_compat_r. { apply Rge_le, pmf_pos. } { apply Rplus_le_compat; eapply IHi'. } * rewrite //= ?Ex_fin_pt /rvar_comp //=; reflexivity. Qed. Lemma Krec_non_dec (i i': nat) r x: (i ≤ i')%nat → Krec i r x ≤ Krec i' r x. Proof. induction 1; first reflexivity. etransitivity; [ apply IHle | apply Krec_non_decS ]. Qed. Lemma Krec_bound0 r x i: 0 ≤ Krec i r x. Proof. revert r x. induction i => r x. - rewrite //=. rewrite /K0. destruct Rlt_dec => //=; nra. - rewrite /Krec -/Krec Ex_fin_pt /rvar_comp //=. apply Rmin_case; first fourier. apply Rle_big0 => ??. rewrite -[a in a ≤ _](Rmult_0_l 0). apply Rmult_le_compat; try fourier. * replace 0 with (R0 + R0) by rewrite Rplus_0_l //=. apply Rplus_le_compat; eauto. * apply Rge_le, pmf_pos. Qed. Lemma Krec0_bound01 r x: 0 ≤ Krec 0 r x ∧ Krec 0 r x ≤ 1. Proof. revert r x. rewrite //= /K0. split; destruct Rlt_dec => //=; nra. Qed. Lemma Krec_bound01 r x i: 0 ≤ Krec i r x ∧ Krec i r x ≤ 1. Proof. revert r x. induction i => r x; (split; first (apply Krec_bound0; rewrite //=)). - rewrite //=/K0. destruct Rlt_dec => //=; nra. - rewrite /Krec -/Krec Ex_fin_pt /rvar_comp //=. apply Rmin_l. Qed. Lemma Krec_bound r x: bound (fun v => ∃ i, Krec i r x = v). Proof. rewrite /bound /is_upper_bound. exists 1 => v [i <-]. edestruct Krec_bound01; eauto. Qed. Definition Krec_sup (r: R) x : R := proj1_sig (completeness (fun v => ∃ i, Krec i r x = v) (Krec_bound r x) (ex_intro _ (Krec 0 r x) (ex_intro _ O erefl))). Lemma Krec_sup_is_lub r x: is_lub (fun v => ∃ i, Krec i r x = v) (Krec_sup r x). Proof. rewrite /Krec_sup //=. by destruct (completeness _). Qed. Lemma K_Krec_leq_below i r x: size x ≤ d → K r x ≤ Krec i r x. Proof. revert r x. induction i as [| i'] => r x Hle. - rewrite /K /Krec /K0 //=. destruct (Rlt_dec). + rewrite /is_left. apply pr_le_1. + rewrite /pr//=. right. rewrite SeriesC_fin_big. eapply big1 => b ?. rewrite //=. destruct (Rgt_dec) as [?|Hnlt] => //=; try nra. specialize (Tbelow _ b Hle). exfalso. destruct (T x); simpl in *. nra. - etransitivity; first eapply IHi'; eauto. apply Krec_non_decS. Qed. Lemma K_Krec_bounded_gap i r x: K r x ≤ Krec i r x + 1. Proof. transitivity 1; first apply pr_le_1. specialize (Krec_bound0 r x i) =>?. fourier. Qed. Definition recN_a {i: nat} φ x (b: @recN_space _ _ _ (hpath φ) x i) : R. revert x b. induction i. - intros x ?. exact 0. - intros x (b&b'). exact (a (size (snd x)) + IHi ((hpath φ x) b) b'). Defined. Lemma Rge_not_gt_eq x y: x >= y → (¬ x > y) → x = y. Proof. nra. Qed. Lemma Rge_not_eq_gt x y: x >= y → (¬ x = y) → x > y. Proof. nra. Qed. Lemma pr_gt_path_shift: ∀ k φ b r j x, pr_gt (rvar_comp (recN_rvar (hpath φ) (j, x) k) (λ x, size (snd x))) r= pr_gt (rvar_comp (recN_rvar (hpath (λ n, match n with | O => b | S n' => φ n' end)) (S j, x) k) (λ x, size (snd x))) r. Proof. induction k; intros. - rewrite //=. - rewrite ?recN_pr_gt. rewrite /index_enum. rewrite [@Finite.enum]unlock //=. rewrite (img_fin_big' _ (λ i, (pr_eq _ i * pr_gt (rvar_comp (recN_rvar _ i _) _) _)) (λ x, true)). rewrite (img_fin_big' _ (λ i, (pr_eq _ i * pr_gt (rvar_comp (recN_rvar _ i _) _) _)) (λ x, true)). eapply (sum_reidx_map _ _ _ _ (λ x, (S (fst x), snd x))); auto. * intros (?&?) Hin; f_equal. ** rewrite /pr_eq/pr ?SeriesC_fin_big. apply eq_big => //=. intros ? _. destruct (φ j); auto. ** rewrite //=. * rewrite //=. intros (n&x'). rewrite ?img_alt'. intros (i&Hin) _. split; auto. exists i. move: Hin. rewrite //=. case: ifP; intros; inversion Hin; subst; f_equal; auto; omega. * rewrite //=. intros (n&x') Hin _ Hfalse. apply Rmult_eq_0_compat. right. rewrite /pr_gt. apply Rge_not_gt_eq; first apply ge_pr_0. intros Hgt. apply Rlt_gt, pr_img_gt in Hgt as (r'&Hgt&Himg). apply img_alt in Himg as (i&Himg). apply img_alt' in Hin as (i'&Himg'). rewrite //= in Himg, Himg'. contradiction (Hfalse). move: Himg'. case: ifP => ? [? ?]. ** exists (S j, x'). rewrite img_alt'. repeat split; auto. *** eexists; f_equal; eauto. *** f_equal; rewrite //=; try congruence; try omega. ** exists (S j, x'). rewrite img_alt'. repeat split; auto. *** eexists; f_equal; eauto. *** f_equal; rewrite //=; try congruence; try omega. * rewrite /img. apply undup_uniq. * rewrite /img. apply undup_uniq. * intros (?&?) (?&?). rewrite //= => _. inversion 1. subst; done. Qed. Lemma Krec_le_K_non_zero_path r x i: P x → Krec i r x < K r x → ∃ φ, pr_gt (rvar_comp (recN_rvar (hpath φ) (O, x) i) (λ x, size (snd x))) d > 0. Proof. revert r x. induction i => r x HP Hlt. - destruct (Rle_dec (size x) d) as [Hlt2|Hnlt]. * exfalso. apply Rlt_not_le in Hlt. apply Hlt. by apply K_Krec_leq_below. * exists (fun x => true). rewrite /pr_gt /pr //=. apply Rnot_le_gt in Hnlt. destruct (Rgt_dec) => //=. rewrite SeriesC_fin_big. rewrite /index_enum. rewrite (eq_bigl predT). ** rewrite /index_enum {1}[@Finite.enum]unlock big_seq1 //=. fourier. ** intros ?. rewrite /in_mem//=. - destruct (Rle_dec (size x) d) as [Hlt2|Hnlt%Rnot_le_gt]. { exfalso. apply Rlt_not_le in Hlt. apply Hlt. by apply K_Krec_leq_below. } rewrite /Krec -/Krec in Hlt. move: Hlt. apply Rmin_case. { intros Hfalse%Rlt_not_le. contradiction Hfalse. rewrite /K. apply pr_le_1. } intros Hlt. eapply Rlt_le_trans in Hlt; last apply K_alt4; auto. rewrite Ex_fin_comp in Hlt. rewrite /index_enum [@Finite.enum]unlock //= in Hlt. rewrite (img_fin_big' _ (λ i, (pr_eq _ i * (Krec _ _ (fst i) + Krec _ _ (snd i)))) (λ x, true)) in Hlt. rewrite (img_fin_big' _ (λ i, (pr_eq _ i * (K _ (fst i) + K _ (snd i)))) (λ x, true)) in Hlt. apply Rlt_big_inv in Hlt as (b&Hin&_&Hlt). assert (pr_eq (h x) b > 0) as HPrb. { rewrite /pr_eq; apply Rge_not_eq_gt; first apply (ge_pr_0). intros Heq. rewrite /pr_eq ?Heq in Hlt. nra. } apply Rmult_lt_reg_l in Hlt; last auto. apply Rlt_plus_reg in Hlt as [Hlt1|Hlt2]. * assert (P (fst b)) as HPb. { rewrite img_alt' in Hin *. intros (n&<-). eapply hP. eauto. } edestruct (IHi _ _ HPb Hlt1) as (φ&Hpr). exists (λ n, match n with | O => true | S n' => φ n' end). rewrite recN_pr_gt => //=. rewrite /index_enum. rewrite [@Finite.enum]unlock //=. rewrite (img_fin_big' _ (λ i, (pr_eq _ i * pr_gt (rvar_comp (recN_rvar _ i _) _) _)) (λ x, true)). eapply (Rle_lt_trans); first (right; symmetry; apply big1; reflexivity). eapply Rlt_bigr. ** intros; apply Rmult_le_pos; apply Rge_le, ge_pr_0. ** rewrite //=. exists (S O, fst b); repeat split. *** apply img_alt'. apply img_alt' in Hin. destruct Hin as (s&Heq). exists s. rewrite Heq. done. *** rewrite //=. apply Rmult_lt_0_compat. **** eapply Rlt_le_trans; first apply HPrb. rewrite /pr_eq /pr ?SeriesC_fin_big /index_enum /Bn /=. rewrite -?big_mkcondr. apply Rle_bigr'; try nra. ***** intros ?. move /andP => [_ Heq]. move /eqP in Heq; subst. split; try nra. apply /andP; split; auto. rewrite //= in Hpr. rewrite /Ωn//=. nra. ***** intros. apply Rge_le, pmf_pos. **** eapply Rlt_le_trans; first apply Hpr. right. apply pr_gt_path_shift. * assert (P (snd b)) as HPb. { rewrite img_alt' in Hin *. intros (n&<-). eapply hP. eauto. } edestruct (IHi _ _ HPb Hlt2) as (φ&Hpr). exists (λ n, match n with | O => false | S n' => φ n' end). rewrite recN_pr_gt => //=. rewrite /index_enum. rewrite [@Finite.enum]unlock //=. rewrite (img_fin_big' _ (λ i, (pr_eq _ i * pr_gt (rvar_comp (recN_rvar _ i _) _) _)) (λ x, true)). eapply (Rle_lt_trans); first (right; symmetry; apply big1; reflexivity). eapply Rlt_bigr. ** intros; apply Rmult_le_pos; apply Rge_le, ge_pr_0. ** exists (S O, (snd b)). repeat split. *** apply img_alt'. apply img_alt' in Hin. destruct Hin as (s&Heq). exists s. rewrite Heq. done. *** rewrite //=. apply Rmult_lt_0_compat. **** eapply Rlt_le_trans; first apply HPrb. rewrite /pr_eq /pr /index_enum /Bn /= ?SeriesC_fin_big. rewrite -?big_mkcondr. apply Rle_bigr'; try nra. ***** intros ?. move /andP => [_ Heq]. move /eqP in Heq; subst. split; try nra. apply /andP; split; auto. rewrite /Ωn //=. reflexivity. ***** intros. apply Rge_le, pmf_pos. **** eapply Rlt_le_trans; first apply Hpr. right. apply pr_gt_path_shift. Qed. Lemma K_le_supKrec r x: P x → K r x ≤ Krec_sup r x. Proof. intros HP. apply Rnot_gt_le. intros Hgt. destruct (hinf_0 x) as [n Hpath0]. destruct (Krec_sup_is_lub r x) as [Hub _]. specialize (Hub (Krec n r x)). edestruct (Krec_le_K_non_zero_path r x n) as (φbad&Hbad); auto. { eapply (Rle_lt_trans _ (Krec_sup r x)); auto. apply Hub. eauto. } specialize (Hpath0 φbad). fourier. Qed. Lemma D0_aux r x: 0 < x → 0 ≤ ((m x) / x) ^ Z.to_nat (round r x) * (g(x) * x / u' (r - a x * IZR (round r x))). Proof. intros Hlt. eapply Rmult_pos. * eapply pow_le. rewrite /Rdiv. eapply Rle_mult_inv_pos; eauto. apply mpos. fourier. * rewrite /round //=. eapply Rle_mult_inv_pos. ** apply Rmult_le_pos; eauto. *** eapply gpos; fourier. *** fourier. ** eapply u'_pos. Qed. Lemma D0 r x: 0 ≤ D r x. Proof. rewrite /D. destruct (Rle_dec) => //=; intros; try nra. destruct (Rle_dec) => //=; intros; try nra. destruct (Rle_dec) => //=; intros; try nra. intros. { transitivity 1; first fourier. apply Rmax_l. } apply D0_aux. nra. Qed. Lemma uu'_adjoint x y: (* d < x → *) umin < y → x ≤ u' y ↔ u x ≤ y. Proof. split. - intros ?%u_mono. transitivity (u (u' y)); eauto. right. by rewrite u_inv_above. - transitivity (u' (u x)); eauto. Qed. Lemma uu'_adjointrl x y: umin < y → x ≤ u' y → u x ≤ y. Proof. eapply uu'_adjoint. Qed. Lemma uu'_adjointlr x y: (* d < x → *) u x ≤ y → x ≤ u' y. Proof. transitivity (u' (u x)); eauto. Qed. Lemma uu': ∀ x, umin < x → u (u' x) ≤ x. Proof. intros. apply uu'_adjointrl; auto; reflexivity. Qed. Definition kD := karp.D a m u u' d umin. Lemma D_karpD r x: r > umin → (0 ≤ x ∧ x ≤ (u' r)) → D r x = g(x) * kD r x. Proof. intros Hr (?&Hrange). rewrite D_Dalt_equiv. rewrite /kD. erewrite karp.D_Dalt_equiv; eauto. rewrite /Dalt /karp.Dalt. destruct (Rle_dec); first nra. rewrite /is_left. destruct (Rle_dec); first nra. rewrite /is_left. destruct (Rlt_dec). { intros. apply uu'_adjointrl in Hrange; last fourier. apply Rle_not_gt in Hrange. nra. } rewrite /karp.round/round. field; apply Rgt_not_eq, u'_pos. Qed. Lemma D_karpD' r x: r > umin → (0 ≤ x) → D r x ≤ g x * kD r x. Proof. intros Hr ?. rewrite D_Dalt_equiv. rewrite /kD. erewrite karp.D_Dalt_equiv; eauto. rewrite /Dalt /karp.Dalt. destruct (Rle_dec) as [|?]; first nra. rewrite /is_left. destruct (Rle_dec) as [|Hled]; first nra. rewrite /is_left. destruct (Rlt_dec) as [Hr'%Rlt_le|?]. { intros. rewrite Rmult_1_r. apply u'_mono in Hr'. rewrite u'_inv_above in Hr'; eauto; try nra. apply Rmax_case_strong; intros. * apply Rge_le, gd. nra. * apply g_mono; eauto. } rewrite /karp.round/round. right. field; apply Rgt_not_eq, u'_pos. Qed. Lemma D_karpD'' r x: g x > 1 → D r x ≤ g x * kD r x. Proof. intros Hgt. rewrite D_Dalt_equiv. rewrite /kD. erewrite karp.D_Dalt_equiv; eauto. rewrite /Dalt /karp.Dalt. destruct (Rle_dec) as [|?] => //=; first by nra. rewrite /is_left. destruct (Rle_dec) as [|Hled] => //=; first by nra. rewrite /is_left. destruct (Rlt_dec) as [Hr'%Rlt_le|?]. { intros. rewrite Rmult_1_r. apply u'_mono in Hr'. rewrite u'_inv_above in Hr'; eauto; try nra. apply Rmax_case_strong; intros. * apply Rge_le, gd. nra. * apply g_mono; eauto. } rewrite /karp.round/round. right. field; apply Rgt_not_eq, u'_pos. Qed. Lemma Rmin_le_right x y z: y ≤ z → Rmin x y ≤ z. Proof. intros. apply Rmin_case_strong; intros; fourier. Qed. Lemma Rceil_1 x: (0 < x) → (x ≤ 1) → Rceil x = 1%Z. Proof. intros Hgt Hle. rewrite /Rceil. move: Hgt. case: ifP. - apply Int_part_mono in Hle. replace (Int_part 1) with 1%Z in Hle; last first. { replace 1 with (IZR 1) by auto. rewrite Int_part_IZR //=. } move /eqP => Heq. rewrite {1}(Int_frac_decompose x) Heq. destruct (Z_le_dec (Int_part x) 0) as [l|nl]. * apply IZR_le in l. replace (IZR 0) with 0 in l by auto. intros; fourier. * intros. omega. - move /eqP => Hnfp0 Hgt. assert (Int_part x = 1 ∨ Int_part x = 0)%Z as [?|?]. { apply Rlt_le in Hgt. apply Int_part_mono in Hgt. replace (Int_part 0) with 0%Z in Hgt; last first. { replace 0 with (IZR 0) by auto. rewrite Int_part_IZR //=. } apply Int_part_mono in Hle. replace (Int_part 1) with 1%Z in Hle; last first. { replace 1 with (IZR 1) by auto. rewrite Int_part_IZR //=. } assert (Int_part x = 1 ∨ Int_part x = 0)%Z as [?|?] by omega; omega. } * exfalso. rewrite {1}(Int_frac_decompose x) in Hle. destruct (base_fp x) as [Hge0 ?]. inversion Hge0; last by nra. rewrite H in Hle. replace (IZR 1) with 1 in Hle by auto. fourier. * omega. Qed. Lemma Krec_le_D: ∀ i r x, Krec i r x ≤ D r (size x). Proof. induction i => r x. - rewrite /K /D. destruct (Rle_dec) as [|Hgtmin]; first by (edestruct Krec0_bound01; eauto). rewrite /is_left. destruct (Rle_dec) as [Hge|Hnge]. { right. rewrite //= /K0 //=. destruct (Rlt_dec) => //=; try nra. } rewrite /is_left. destruct (Rle_dec) as [Hge|Hnge']. { edestruct (Krec_bound01 r x O); eauto. transitivity 1; first nra. apply Rmax_l. } rewrite //= /K0. destruct (Rlt_dec) as [|Hnlt]. { intros. exfalso; eapply Hgtmin. fourier. } eapply D0_aux. nra. - rewrite /K /D. destruct (Rle_dec) as [|Hgtmin]; first (clear IHi; edestruct Krec_bound01; eauto). destruct (Rle_dec) as [Hge|Hnge]. { clear IHi. right. revert r x Hgtmin Hge. induction (S i). * rewrite //= /K0 //=. intros. destruct Rlt_dec; last reflexivity. exfalso; eapply Hgtmin. nra. * intros. rewrite /Krec -/Krec Ex_fin_pt /rvar_comp //=. rewrite alower; last fourier. rewrite Rminus_0_r. etransitivity; last (apply (Rmin_right)); f_equal; try nra. eapply big1 => b ?. rewrite ?IHn //=; auto; try nra. ** transitivity (size x) => //. ** transitivity (size x) => //. } rewrite /is_left. destruct (Rle_dec) as [Hge|Hnge']. { clear IHi; transitivity 1; last apply Rmax_l. edestruct Krec_bound01; eauto. } assert (r - a (size x) > umin) as Hgt. { apply Rgt_ge_trans with (r2 := u (size x) - a (size x)); first by nra. apply /Rle_ge/umin_lb. nra. } destruct (Rge_dec d (u' (r - a (size x)))) as [Hge|Hlt]; [| apply Rnot_ge_lt in Hlt]. { exfalso. apply Rge_le in Hge. apply u_mono in Hge. rewrite u_inv_above //= in Hge. fourier. } rewrite /Krec -/Krec. transitivity (Ex (rvar_comp (h x) (λ x', (g (size (fst x'))) * kD (r - a (size x)) (size (fst x')) + (g (size (snd x'))) * kD (r - a (size x)) (size (snd x'))))). { apply Rmin_le_right. rewrite ?Ex_fin_pt //=. apply Rle_bigr => z ?. * apply Rmult_le_compat_r. apply Rge_le, pmf_pos. apply Rplus_le_compat. ** etransitivity; last apply D_karpD'; eauto. eapply hrange12. nra. ** etransitivity; last apply D_karpD'; eauto. eapply hrange22. nra. } etransitivity. { eapply lemma31_simplex with (g := g) (size := size) (X := h x) (c := u' (r - a (size x))) (f := (λ z, kD (r - a (size x)) z)) (x := size x) (z := 1). * nra. * apply u'_pos. * intros p. rewrite img_alt. intros (n&?). subst. eapply hrange12. nra. * intros p. rewrite img_alt. intros (n&?). subst. eapply hrange22. nra. * intros p. rewrite img_alt. intros (n&?). subst. eauto. * intros p. rewrite img_alt. intros (n&?). subst. eauto. * intros p. rewrite img_alt. intros (n&?). subst. eapply gpos, hrange12. nra. * intros p. rewrite img_alt. intros (n&?). subst. eapply gpos, hrange22. nra. * intros p. rewrite img_alt. intros (n&?). subst. eauto. eapply hgrange_sum. nra. * rewrite /kD/karp.D. repeat (destruct (Rle_dec); rewrite /is_left; try nra). * rewrite /kD; apply karp.D0; eauto. * fourier. * intros y Hley. rewrite /kD/karp.D. repeat (destruct (Rle_dec); rewrite /is_left; try nra). apply Rge_le, u_mono in Hley. rewrite u_inv_above // in Hley. * intros. eapply karp.Dnondec; eauto. } rewrite /Rdiv ?Rmult_assoc. etransitivity. { apply Rmult_le_compat_r; last (apply m_bound_Eh). apply Rmult_le_pos. - apply gpos. nra. - apply Rle_mult_inv_pos; auto. * rewrite /kD. apply karp.D0; eauto. * apply Rmin_case; nra. } assert (round r (size x) = 1 + round (r - a (size x)) (size x))%Z as Hplus. { rewrite /round. rewrite Zplus_comm -Rceil_plus_1; f_equal. field. apply Rgt_not_eq. apply a_pos. nra. } assert (Hrgt0: (round r (size x) > 0)%Z). { rewrite /round. rewrite -Rceil_0. apply Z.lt_gt, Rceil_mono_strict. apply frac_part_0. apply Rdiv_lt_0_compat. - nra. - apply a_pos. nra. } assert (0 <= round (r - a (size x)) (size x))%Z by omega. apply Rmin_case_strong. * rewrite Hplus. intros Hminl. rewrite /kD. erewrite karp.D_Dalt_equiv; eauto. rewrite /karp.Dalt //. destruct (Rle_dec); rewrite /is_left; first nra. destruct (Rle_dec); rewrite /is_left; first nra. destruct (Rlt_dec). { move: Hminl. move /uu'_adjointrl/Rle_ge/Rge_not_lt. nra. } right. rewrite Z2Nat.inj_add; try omega. rewrite plus_IZR. replace (IZR 1) with 1 by auto. rewrite //=. rewrite Rmult_plus_distr_l Rmult_1_r. rewrite /Rminus. rewrite Ropp_plus_distr. rewrite Rplus_assoc. rewrite /round/karp.round. rewrite /Rdiv. field. split. ** apply Rgt_not_eq, u'_pos. ** apply Rgt_not_eq. nra. * intros Hminr. rewrite /kD. erewrite karp.D_Dalt_equiv; eauto. rewrite /karp.Dalt //. destruct (Rle_dec); rewrite /is_left; first nra. destruct (Rle_dec); rewrite /is_left; first nra. destruct (Rlt_dec) as [Hbad|]. { move: Hbad. rewrite u_inv_above; nra. } right. symmetry. assert (round (r - a (size x)) (u' (r - a (size x))) = 0)%Z as Hround0'. { rewrite /round -Rceil_0. f_equal. rewrite u_inv_above /Rdiv; last done. apply Rmult_eq_0_compat_r; ring. } rewrite /karp.round. rewrite /round in Hround0'. rewrite Hround0'. rewrite //= Rmult_0_r Rminus_0_r Rmult_1_l /Rdiv Rinv_r; last by apply Rgt_not_eq, u'_pos. rewrite Rmult_1_l. assert (round r (size x) = 1)%Z as ->. { rewrite /round. apply Rceil_positive_le1. - move: Hrgt0. rewrite /round. done. - apply (Rmult_le_reg_r (a (size x))). * apply a_pos. nra. * rewrite Rmult_1_l /Rdiv Rmult_assoc Rinv_l. ** rewrite Rmult_1_r. apply u_mono in Hminr. rewrite u_inv_above in Hminr; nra. ** apply Rgt_not_eq, a_pos. nra. } replace (IZR 1) with 1 by auto. rewrite //= ?Rmult_1_r. field; split. ** apply Rgt_not_eq, u'_pos. ** nra. Qed. Theorem span_bound r x: P x → K r x ≤ D r (size x). Proof. transitivity (Krec_sup r x). - apply K_le_supKrec; auto. - apply (proj2 (Krec_sup_is_lub r x)). intros ? (i&<-); apply Krec_le_D. Qed. Theorem span_bound_simple w x: g (size x) > 1 → size x > d → P x → pr_gt (T x) (u (size x) + INR w * a (size x)) ≤ g (size x) * (m (size x) / size x) ^ w. Proof. set (r := u (size x) + INR w * a (size x)). transitivity (D r (size x)). - apply span_bound; auto. - rewrite /D/r. destruct (Rle_dec) as [Hle|?]. { rewrite //=. destruct w; first by (rewrite //=; nra). assert (umin <= u (size x)) by (apply umin_lb_simple; nra). assert (a (size x) > 0) by (apply a_pos; nra). specialize (pos_INR w). intros. rewrite S_INR in Hle. exfalso. nra. } rewrite //=. destruct Rle_dec => //=; try nra; []. destruct Rle_dec as [Hle|?]. { intros. rewrite //=. destruct w. { replace (INR 0) with 0 by auto. rewrite Rmult_0_l Rplus_0_r. rewrite u'_inv_above; last nra. apply Rmax_case_strong; nra. } assert (umin <= u (size x)) by (apply umin_lb_simple; nra). assert (a (size x) > 0) by (apply a_pos; nra). specialize (pos_INR w). intros. exfalso. rewrite S_INR in Hle. exfalso. nra. } rewrite //=. assert (round (u (size x) + INR w * a (size x)) (size x) = Z_of_nat w) as Hround. { rewrite /round. assert ((u (size x) + INR w * a (size x) - u (size x)) / a (size x)= INR w) as ->. { field. specialize (a_pos (size x)). nra. } rewrite INR_IZR_INZ Rceil_IZR. done. } rewrite Hround //=. rewrite INR_IZR_INZ. rewrite (Rmult_comm (IZR _)). assert (u (size x) + a (size x) * IZR (Z.of_nat w) - a (size x) * IZR (Z.of_nat w) = u (size x)) as -> by field. rewrite u'_inv_above; last by nra. rewrite /Rdiv. rewrite (Rmult_assoc (g (size x))). rewrite Rinv_r; last by nra. rewrite Rmult_1_r. rewrite Nat2Z.id. nra. Qed. End span_bound_sec.
data InfIO: Type where Do: IO a -> (a -> Inf InfIO) -> InfIO (>>=) : IO a -> (a -> Inf InfIO) -> InfIO (>>=) = Do data Fuel = Dry | More (Lazy Fuel) partial forever: Fuel forever = More forever total run: Fuel -> InfIO -> IO() run Dry y = putStrLn "Out of fuel" run (More fuel) (Do action cont) = do res <- action run fuel (cont res) total totalRepl : (prompt: String) -> (action: String -> String) -> InfIO totalRepl prompt action = do input <- getLine putStr ((action input) ++ prompt) totalRepl prompt action partial main : IO() main = run forever (totalRepl "\n: " toUpper)
State Before: F : Type u K : Type v L : Type w inst✝² : CommRing K inst✝¹ : Field L inst✝ : Field F i : K →+* L f : K[X] hf : degree (map i f) = 1 g✝ : L[X] hg : Irreducible g✝ x✝ : g✝ ∣ map i f p : L[X] hp : map i f = g✝ * p ⊢ degree g✝ = 1 State After: F : Type u K : Type v L : Type w inst✝² : CommRing K inst✝¹ : Field L inst✝ : Field F i : K →+* L f : K[X] hf : degree (map i f) = 1 g✝ : L[X] hg : Irreducible g✝ x✝ : g✝ ∣ map i f p : L[X] hp : map i f = g✝ * p this : degree (map i f) = degree (g✝ * p) ⊢ degree g✝ = 1 Tactic: have := congr_arg degree hp State Before: F : Type u K : Type v L : Type w inst✝² : CommRing K inst✝¹ : Field L inst✝ : Field F i : K →+* L f : K[X] hf : degree (map i f) = 1 g✝ : L[X] hg : Irreducible g✝ x✝ : g✝ ∣ map i f p : L[X] hp : map i f = g✝ * p this : degree (map i f) = degree (g✝ * p) ⊢ degree g✝ = 1 State After: F : Type u K : Type v L : Type w inst✝² : CommRing K inst✝¹ : Field L inst✝ : Field F i : K →+* L f : K[X] hf : degree (map i f) = 1 g✝ : L[X] hg : Irreducible g✝ x✝ : g✝ ∣ map i f p : L[X] hp : map i f = g✝ * p this : degree g✝ = 1 ∧ degree p = 0 ⊢ degree g✝ = 1 Tactic: simp [Nat.WithBot.add_eq_one_iff, hf, @eq_comm (WithBot ℕ) 1, mt isUnit_iff_degree_eq_zero.2 hg.1] at this State Before: F : Type u K : Type v L : Type w inst✝² : CommRing K inst✝¹ : Field L inst✝ : Field F i : K →+* L f : K[X] hf : degree (map i f) = 1 g✝ : L[X] hg : Irreducible g✝ x✝ : g✝ ∣ map i f p : L[X] hp : map i f = g✝ * p this : degree g✝ = 1 ∧ degree p = 0 ⊢ degree g✝ = 1 State After: no goals Tactic: tauto
# import pandas as pd from pandas import isnull from numpy import sum def count_missing(vec): """Count the number of missing values in a vector """ null_vec = isnull(vec) return sum(null_vec)
Inductive list (X:Type) : Type := | nil | cons (x : X) (l : list X). Arguments nil {X}. Arguments cons {X}. Fixpoint app {X : Type} (l1 l2 : list X) : list X := match l1 with | nil => l2 | cons h t => cons h (app t l2) end. Fixpoint rev {X:Type} (l:list X) : list X := match l with | nil => nil | cons h t => app (rev t) (cons h nil) end. Fixpoint length {X : Type} (l : list X) : nat := match l with | nil => 0 | cons _ l' => S (length l') end. Notation "x :: y" := (cons x y) (at level 60, right associativity). Notation "[ ]" := nil. Notation "[ x ; .. ; y ]" := (cons x .. (cons y []) ..). Notation "x ++ y" := (app x y) (at level 60, right associativity). Inductive prod (X Y : Type) : Type := | pair (x : X) (y : Y). Arguments pair {X} {Y}. Notation "( x , y )" := (pair x y). Notation "X * Y" := (prod X Y) : type_scope. Fixpoint even (n:nat) : bool := match n with | O => true | S O => false | S (S n') => even n' end. Fixpoint eqb (n m : nat) : bool := match n with | O => match m with | O => true | S m' => false end | S n' => match m with | O => false | S m' => eqb n' m' end end. Notation "x =? y" := (eqb x y) (at level 70) : nat_scope. Fixpoint map {X Y : Type} (f : X -> Y) (l : list X) : list Y := match l with | [] => [] | h :: t => (f h) :: (map f t) end. (* additional lemma *) Lemma map_distrib : forall (X Y : Type) (f : X -> Y) (l1 l2 : list X), map f (l1 ++ l2) = map f l1 ++ map f l2. Proof. intros X Y f l1 l2. induction l1 as [| n l1' IHl1']. - simpl. reflexivity. - simpl. rewrite -> IHl1'. reflexivity. Qed. (* Exercise *) Theorem map_rev : forall (X Y : Type) (f : X -> Y) (l : list X), map f (rev l) = rev (map f l). Proof. intros X Y f l. induction l as [| n l' IHl']. - simpl. reflexivity. - simpl. rewrite -> map_distrib. rewrite -> IHl'. simpl. reflexivity. Qed.
[STATEMENT] lemma Disj_IF: "\<forall>A. Disj (\<I> A) (\<F> A)" [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<forall>A w. (\<I> \<^bold>\<sqinter> \<F>) A w = \<^bold>\<bottom> w [PROOF STEP] by (simp add: Cl_der_def Fr_der_def2 dual_def dual_der2 conn)
State Before: p : ℕ hp : Fact (Nat.Prime p) q : ℚ_[p] f : CauSeq ℚ (padicNorm p) hf : Quotient.mk equiv f ≠ 0 this : ¬f ≈ 0 n : ℤ hn : PadicSeq.norm f = ↑p ^ (-n) ⊢ ‖Quotient.mk equiv f‖ = ↑(↑p ^ (-n)) State After: p : ℕ hp : Fact (Nat.Prime p) q : ℚ_[p] f : CauSeq ℚ (padicNorm p) hf : Quotient.mk equiv f ≠ 0 this : ¬f ≈ 0 n : ℤ hn : PadicSeq.norm f = ↑p ^ (-n) ⊢ ‖Quotient.mk equiv f‖ = ↑(PadicSeq.norm f) Tactic: rw [← hn] State Before: p : ℕ hp : Fact (Nat.Prime p) q : ℚ_[p] f : CauSeq ℚ (padicNorm p) hf : Quotient.mk equiv f ≠ 0 this : ¬f ≈ 0 n : ℤ hn : PadicSeq.norm f = ↑p ^ (-n) ⊢ ‖Quotient.mk equiv f‖ = ↑(PadicSeq.norm f) State After: no goals Tactic: rfl
mutable struct Spmat{VTI<:AbstractVector, VTF<:AbstractVector} colptr::VTI rowval::VTI nzval::VTF # create 2 Spmats from complex matrix function Spmat{VTI, VTF}(mat::SparseMatrixCSC{Complex{Float64}, Int}) where {VTI, VTF} matreal = new(VTI(mat.colptr), VTI(mat.rowval), VTF(real.(mat.nzval))) matimag = new(VTI(mat.colptr), VTI(mat.rowval), VTF(imag.(mat.nzval))) return matreal, matimag end # copy constructor function Spmat{VTI, VTF}(mat) where {VTI, VTF} return new(VTI(mat.colptr), VTI(mat.rowval), VTF(mat.nzval)) end end
Require Import Progress. Require Import Preservation. Inductive multi_step : term -> term -> Prop := | multi_step_refl e : multi_step e e | multi_step_trans e e' e'' (SingleStep : step e e') (MultiStep : multi_step e' e'') : multi_step e e''. Hint Constructors multi_step : linear. Corollary soundness : forall E e e' t, is_empty E -> E |- e ~: t -> multi_step e e' -> (exists e'', step e' e'') \/ value e'. Proof with eboom. intros E e e' t Empty WT Steps. induction Steps. Case "zero steps". eapply progress... Case "one or more steps". apply IHSteps. eapply preservation... Qed.
# Decision Lens API # # No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # # OpenAPI spec version: 1.0 # # Generated by: https://github.com/swagger-api/swagger-codegen.git #' NotificationsMessagePayload Class #' #' @field activities #' @field portfolioId #' #' @importFrom R6 R6Class #' @importFrom jsonlite fromJSON toJSON #' @export NotificationsMessagePayload <- R6::R6Class( 'NotificationsMessagePayload', public = list( `activities` = NULL, `portfolioId` = NULL, initialize = function(`activities`, `portfolioId`){ if (!missing(`activities`)) { stopifnot(is.list(`activities`), length(`activities`) != 0) lapply(`activities`, function(x) stopifnot(R6::is.R6(x))) self$`activities` <- `activities` } if (!missing(`portfolioId`)) { stopifnot(is.character(`portfolioId`), length(`portfolioId`) == 1) self$`portfolioId` <- `portfolioId` } }, toJSON = function() { NotificationsMessagePayloadObject <- list() if (!is.null(self$`activities`)) { NotificationsMessagePayloadObject[['activities']] <- lapply(self$`activities`, function(x) x$toJSON()) } if (!is.null(self$`portfolioId`)) { NotificationsMessagePayloadObject[['portfolioId']] <- self$`portfolioId` } NotificationsMessagePayloadObject }, fromJSON = function(NotificationsMessagePayloadJson) { NotificationsMessagePayloadObject <- dlensFromJSON(NotificationsMessagePayloadJson) if (!is.null(NotificationsMessagePayloadObject$`activities`)) { self$`activities` <- lapply(NotificationsMessagePayloadObject$`activities`, function(x) { activitiesObject <- Activity$new() activitiesObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE)) activitiesObject }) } if (!is.null(NotificationsMessagePayloadObject$`portfolioId`)) { self$`portfolioId` <- NotificationsMessagePayloadObject$`portfolioId` } }, toJSONString = function() { sprintf( '{ "activities": [%s], "portfolioId": %s }', lapply(self$`activities`, function(x) paste(x$toJSON(), sep=",")), self$`portfolioId` ) }, fromJSONString = function(NotificationsMessagePayloadJson) { NotificationsMessagePayloadObject <- dlensFromJSON(NotificationsMessagePayloadJson) self$`activities` <- lapply(NotificationsMessagePayloadObject$`activities`, function(x) Activity$new()$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE))) self$`portfolioId` <- NotificationsMessagePayloadObject$`portfolioId` } ) )
\section{Extracurricular} \begin{itemize}[leftmargin=0.15in, label={}] \small{\item{ \textbf{Hobbies}{: %s} \\ \textbf{Certifications \& Courses}{: %s} \\ }} \end{itemize} \vspace{-16pt}
program xcon3 c c This is the main program of the XCON3 code. Configuration c identification, the copyright statement, legal disclaimers, c and similar statements are contained in XCON3/aaaxc3.f, the c lead-off subroutine in the XCON3 source code. A short description c of this program is also contained in that subroutine. c c----------------------------------------------------------------------- c implicit none c c----------------------------------------------------------------------- c include 'xcon3/x3op7.h' c include 'eqlib/eqlj8.h' include 'eqlib/eqlo8.h' c c----------------------------------------------------------------------- c integer ietpar,iktpar,jetpar,nbtpar,netpar,nodbpa,nopgpa,noprpa, $ noptpa,nsqpar,ntitpa,nxicpa,nxmdpa,nxtipa,nxtpar c parameter(ietpar = 10,iktpar = 20,jetpar = 3,nbtpar = 250) parameter(netpar = 12,ntitpa = 100,nxmdpa = 40,nxtpar = 50) parameter(nodbpa = 20,nopgpa = 20,noprpa = 20,noptpa = 20) c parameter(nsqpar = nbtpar,nxtipa = nxtpar,nxicpa = iktpar*nxtpar) c integer ietmax,iktmax,jetmax,nbtmax,netmax,nodbmx,nopgmx,noprmx, $ noptmx,nsqmax,ntitmx,nxicmx,nxmdmx,nxtimx,nxtmax c c----------------------------------------------------------------------- c integer newin,ninpt,ninpts,noutpt,nttyo c integer iodb(nodbpa),iopg(nopgpa),iopr(noprpa),iopt(noptpa), $ jflagb(nsqpar),jflgi(nbtpar),jgext(netpar),jgexti(netpar), $ jxmod(nxmdpa),kxmod(nxmdpa),ncmpri(2,nxtipa),ncompb(nxtpar), $ ngexrt(jetpar,netpar),ngexti(jetpar,netpar) c integer itermx,jpres3,net,neti,nprob,ntitl,nxcon,nxmod integer nsq,nxtb integer nbti,nobswt,nsbswt,nxti c integer i,icount,iebal3,irdxc3,itdsf3,j,jfli,j2,ik,iktb,k,kl,n, $ nb,nerr,nmax,nn,nobsw,nr1,nr2,ns,ntest,nx,nxi,nxic c integer ilnobl c logical qend,qex,qgexsh,qrderr,qxcon,q8bchk,q8beta c character*80 utitl(ntitpa) character*56 ugexr(ietpar,jetpar,netpar) character*48 uxmod(nxmdpa) character*48 ucospi(nbtpar),uobsw(2,nbtpar),usbsw(2,nbtpar), $ uspeci(nbtpar) character*24 ugexmo(netpar),ugexp(netpar),ugexpi(netpar), $ ugexsi(ietpar,jetpar,netpar),usoli(nxtipa),umemi(nxicpa) character*24 ubasis(nsqpar),umemb(iktpar,nxtpar),uphas1(nsqpar), $ uphas2(nsqpar),usolb(nxtpar),uspecb(nsqpar),uxmd24(nxmdpa) character*8 ugexj(jetpar,netpar),ugexji(jetpar,netpar), $ uhfgex(ietpar,jetpar,netpar),uvfgex(ietpar,jetpar,netpar), $ uxkgex(ietpar,jetpar,netpar) c character*80 uline character*24 uacion,ublk24,uebal,uredox,ustr,ustr1,ux24 character*8 uplatc,uplatm,ustelu,ustxc3,uveelu,uvexc3 character*8 uv character*3 uoldv,uoldvd,unewv character*1 uoldf,unewf,ux1 c real*8 apresh(5,2) real*8 cspb(nsqpar),xbarb(iktpar,nxtpar) real*8 covali(nbtpar),xbari(nxicpa) real*8 cgexj(jetpar,netpar),cgexpi(netpar), $ egexsi(ietpar,jetpar,netpar),mwtges(netpar), $ tgexp(netpar),xgexsi(ietpar,jetpar,netpar), $ xhfgex(ietpar,jetpar,netpar),xlkgex(ietpar,jetpar,netpar), $ xvfgex(ietpar,jetpar,netpar),xlkmod(nxmdpa),zgexj(jetpar,netpar) c real*8 ehi,epstst,fep,fo2lgi,pei,presh,press,rho,scamas,tempc, $ tdspkg,tdspl,tolbt,toldl,tolsat,tolspf c real*8 verold,vernew c c----------------------------------------------------------------------- c c BEGIN_MACHINE_DEPENDENT_CODE c c On some systems, a BLOCK DATA subroutine must be declared in an c EXTERNAL statement to assure proper loading. On some other c systems, this is not necessary, but neither it is not harmful. c On yet some other systems, the EXTERNAL statement below may c cause a problem. If so, try commenting it out. If you still c have trouble, consult your local system documentation or c experiment to find out how to correctly handle a BLOCK DATA c subroutine on your system. The EXTERNAL statement below should c not cause a problem if you are using a compiler which is fully c compliant with the Fortran 90 standard. However, there is c no guarantee that it will be adequate to assure correct loading c of the BLOCK DATA subroutine. c external bkdxc3 c c END_MACHINE_DEPENDENT_CODE c c----------------------------------------------------------------------- c data noutpt /0/ c data ublk24 /' '/ c data apresh(1,1) / 1.013200000E+00/, $ apresh(2,1) / 0./,apresh(3,1) / 0./, $ apresh(4,1) / 0./,apresh(5,1) / 0./, $ apresh(1,2) /-4.345000000E-01/, $ apresh(2,2) / 7.632333333E-03/, $ apresh(3,2) / 5.514000000E-05/, $ apresh(4,2) /-1.263733333E-06/, $ apresh(5,2) / 1.396800000E-08/ c data epstst /1.e-12/ c c----------------------------------------------------------------------- c c BEGIN_MACHINE_DEPENDENT_CODE c c Define the console device number. c c The following works on UNIX, PC, and VAX machines. c data nttyo /6/ c c BEGIN_MAC_DEPENDENT_CODE c c data nttyo /9/ c c END_MAC_DEPENDENT_CODE c c END_MACHINE_DEPENDENT_CODE c c----------------------------------------------------------------------- c data ninpt /9/,ninpts /10/,newin /11/,nxcon /12/ c c----------------------------------------------------------------------- c c Get configuration identification data. c call aaaxc3(ustxc3,uvexc3) call aaaelu(ustelu,uveelu) call platfd(uplatc,uplatm) c c* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * c c Set dimensioning variables. c ietmax = ietpar iktmax = iktpar jetmax = jetpar nbtmax = nbtpar netmax = netpar nodbmx = nodbpa nopgmx = nopgpa noprmx = noprpa noptmx = noptpa nsqmax = nsqpar ntitmx = ntitpa nxicmx = nxicpa nxmdmx = nxmdpa nxtimx = nxtipa nxtmax = nxtpar c c* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * c c Does the INPUT file (the old input file) exist? c inquire(file="input",exist=qex) if (.not.qex) then write (nttyo,1000) 1000 format(' * Error- (XCON3/xcon3) The INPUT file (the old input', $ ' file).',/7x,"doesn't exist. Check the name that was", $ ' specified.') go to 999 endif c c Open the old input file. c open(ninpt,file='input',status='old',err=700) go to 710 c 700 write (nttyo,1010) 1010 format(" * Error - (XCON3/xcon3) Can't open the INPUT file (the", $ ' old input file).') go to 999 c 710 continue c c* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * c c Determine the old input file format. c W = compact c D = menu-style c k = 0 kl = 0 ntest = 10 uoldf = 'W' do n = 1,100 read (ninpt,1060) ux1 1060 format(a1) if (ux1(1:1) .ne. 'c') kl = kl + 1 if (ux1(1:1) .eq. '|') k = k + 1 if (kl .ge. ntest) then if (k .ge. ntest) uoldf = 'D' go to 810 endif enddo 810 continue rewind(ninpt) c c* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * c c Does the INPUTS file (the stripped input file) exist? c If so, kill it. This file will be used to contain a copy of the c old input file, stripped of comment lines. c inquire(file="inputs",exist=qex) if (qex) then open(ninpts,file='inputs',status='old',err=720) close(ninpts,status='delete') endif c c Open the INPUTS file. c open(ninpts,file='inputs',status='new',err=720) go to 730 c 720 write (nttyo,1020) 1020 format(" * Error - (XCON3/xcon3) Can't open the INPUTS file", $ /7x,'(the stripped old input file).') close(ninpt) go to 999 c c* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * c c Strip comment lines from the input file. Also strip any blank c lines from a "D" format file. c 730 if (uoldf(1:1) .eq. 'W') then do n = 1,10000 read (ninpt,1030,end=750) uline 1030 format(a80) if (uline(1:1) .ne. '*') write (ninpts,1030) uline enddo c write (nttyo,1040) 1040 format(" * Error - (XCON3/xcon3) The old input file is too $ ' long.") close(ninpt) close(ninpts,status='delete') go to 999 c 750 continue elseif (uoldf(1:1) .eq. 'D') then do n = 1,10000 read (ninpt,1030,end=757) uline j2 = ilnobl(uline) if (j2 .gt. 0) then if (uline(1:1).ne.'*' .and. uline(1:1).ne.'c') $ write (ninpts,1030) uline endif enddo c write (nttyo,1040) close(ninpt) close(ninpts,status='delete') go to 999 c 757 continue endif c c Rewind the stripped input file. c rewind(ninpts) c c* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * c c Does the NEWIN file (to be the new input file) exist? c If so, kill it. c inquire(file="newin",exist=qex) if (qex) then open(newin,file='newin',status='old',err=760) close(newin,status='delete') endif c c Open the new input file. c open(newin,file='newin',status='new',err=760) go to 770 c 760 write (nttyo,1050) 1050 format(" * Error - (XCON3/xcon3) Can't open the NEWIN file", $ ' (to be the',/7x,'new input file.)') close(ninpt) close(ninpts,status='delete') go to 999 c 770 continue c c* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * c c Input file formats: c c W = compact c D = menu-style c c uoldf = format of the old file c unewf = format of the new file c unewf = ' ' c c Input file version levels. c '6.0' = version 6.0 (including version 6.1) c '7.0' = version 7.0 (including versions 7.0x and 7.1) c '7.2' = version 7.2 (including versions 7.2a and 7.2b) c '8.0' = version 8.0 c c uoldv = version level of the old file c uoldvd = default version level of the old file c unewv = version level of the new file c uoldv = ' ' uoldvd = ' ' unewv = ' ' c c Set ultimate default values. c uoldvd = '7.0' unewv = '7.2' unewf = 'W' c c* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * c c Does an options file exist? c inquire(file="ixcon",exist=qxcon) if (qxcon) then open(nxcon,file='ixcon',status='old',err=780) go to 790 c 780 write (nttyo,1055) 1055 format(/" * Error - (XCON3/xcon3) Can't open the IXCON options", $ ' file.') close(ninpt) close(ninpts,status='delete') close(newin) go to 999 c c Read the IXCON options file. c 790 call rddixc(nxcon,uoldvd,unewf,unewv) else write (nttyo,1057) 1057 format(/' * Error - (XCON3/xcon3) The IXCON options file', $ " doesn't exist.") close(ninpt) close(ninpts,status='delete') close(newin) go to 999 endif c c* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * c c Determine the old input file version level. c '6.0' = version 6.0 (including version 6.1) c '7.0' = version 7.0 (including versions 7.0x and 7.1) c '7.2' = version 7.2 (including versions 7.2a and 7.2b) c '8.0' = version 8.0 c i = 0 do n = 1,ntitmx + 4 read (ninpts,1030) uline if (uoldf(1:1) .eq. 'W') then if (uline(1:8) .eq. 'endit. ') go to 825 elseif (uoldf(1:1) .eq. 'D') then if (uline(1:8) .eq. '|-------') i = i + 1 if (i .ge. 3) go to 825 endif j = index(uline,'Version level=') if (j .le. 0) j = index(uline,'version level=') if (j .gt. 0) then uv = uline(j + 14:j + 21) go to 840 endif enddo 825 continue c i = 0 rewind(ninpts) do n = 1,ntitmx read (ninpts,1030) uline if (uoldf(1:1) .eq. 'W') then if (uline(1:8) .eq. 'endit. ') go to 835 elseif (uoldf(1:1) .eq. 'D') then if (uline(1:8) .eq. '|-------') i = i + 1 if (i .ge. 3) go to 835 endif j = index(uline,'Version number=') if (j .le. 0) j = index(uline,'version number=') if (j .gt. 0) then uv = uline(j + 15:j + 22) go to 840 endif enddo 835 continue c write (nttyo,1070) 1070 format(/' * Warning - (XCON3/xcon3) The title on the old input', $ /7x,"file doesn't contain a version level tag. If this code is", $ /7x,'unable to determine the correct version level by other', $ /7x,'means, add a version tag by putting "Version level= X.X",', $ /7x,'where "X.X" is the version level, in the title, preferably', $ /7x,'on line 3. If there is more than problem on a single input', $ /7x,'file, the tag need be put only in the title of the first', $ ' problem.') go to 880 c 840 call lejust(uv) c if (uv(1:3) .eq. '6.0') then uoldv = '6.0' elseif (uv(1:1) .eq. '6') then uoldv = '6.0' elseif (uv(1:3) .eq. '7.0') then uoldv = '7.0' elseif (uv(1:3) .eq. '7.1') then uoldv = '7.0' elseif (uv(1:3) .eq. '7.2') then uoldv = '7.2' elseif (uv(1:1) .eq. '7') then uoldv = '7.0' elseif (uv(1:3) .eq. '8.0') then uoldv = '8.0' elseif (uv(1:1) .eq. '8') then uoldv = '8.0' else j2 = ilnobl(uv) write (nttyo,1080) uv(1:j2) 1080 format(/" * Warning - (XCON3/xcon3) Can't determine the", $ /7x,'version level of the old input file. The version level', $ /7x,'is specified by a tag in the title of the first problem', $ /7x,'on the file as "',a,'". This is not a valid version', $ /7x,'level descriptor. Valid descriptors include "6.0", "7.0",', $ /7x,'"7.2", and "8.0". If the code is unable to determine the', $ /7x,'correct version level, replace the invalid descriptor.') endif c 880 if (uoldv(1:3) .eq. ' ') then rewind(ninpts) do n = 1,1000 read (ninpts,1030,end=838) uline j = index(uline,'uacion= ') if (j .gt. 0) then uoldv = '6.0' go to 838 endif enddo 838 continue endif c c If necessary, use the default for the version level of the old c input file. c if (uoldv(1:3) .eq. ' ') then uoldv = uoldvd write (nttyo,1090) uoldvd 1090 format(/' * Warning - (XCON3/xcon3) Taking the default', $ /7x,'value of "',a3,'" for the version level of the old', $ /7x,'input file.') endif c c* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * c c Process the old input file, working from the stripped copy. c rewind(ninpts) q8bchk = .false. q8beta = .false. nprob = 0 100 nprob = nprob + 1 c c* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * c c Zero or null various variables. c call initcb(utitl,ntitmx) c call initiz(iopt,noptmx) call initiz(iopg,nopgmx) call initiz(iopr,noprmx) call initiz(iodb,nodbmx) c call initcb(uxmod,nxmdmx) call initcb(uxmd24,nxmdmx) call initiz(jxmod,nxmdmx) call initiz(kxmod,nxmdmx) call initaz(xlkmod,nxmdmx) c call initcb(uspecb,nsqmax) call initcb(ubasis,nsqmax) call initiz(jflagb,nsqmax) call initaz(cspb,nsqmax) call initcb(uphas1,nsqmax) call initcb(uphas2,nsqmax) c call initcb(usolb,nxtmax) c nmax = iktmax*nxtmax call initcb(umemb,nmax) call initaz(xbarb,nmax) c call initcb(uspeci,nbtmax) call initiz(jflgi,nbtmax) call initaz(covali,nbtmax) call initcb(ucospi,nbtmax) c nmax = 2*nbtmax call initcb(usbsw,nmax) call initcb(uobsw,nmax) c call initcb(usoli,nxtimx) c call initcb(umemi,nxicmx) call initaz(xbari,nxicmx) c nmax = 2*nxtimx call initiz(ncmpri,nmax) c c* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * c c The uacion variable only appears on version level '6.0' input c files. Provide a blank default value. c uacion = ' ' c c* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * c c Read the current problem on the stripped input file. c if (uoldf(1:1) .eq. 'W') then if (uoldv(1:3) .eq. '6.0') then c call rd3w6(cspb,fep,iktmax,iodb,iopg,iopr,iopt,itermx, $ jflagb,jxmod,kxmod,ncompb,ninpts,nodbmx,nopgmx,noprmx,noptmx, $ nsq,nsqmax,ntitl,ntitmx,nttyo,nxmdmx,nxmod,nxtb,nxtmax,qend, $ qrderr,rho,tempc,tdspkg,tdspl,tolbt,toldl,tolsat,uacion, $ ubasis,uebal,umemb,uphas1,uphas2,uredox,usolb,uspecb,utitl, $ xbarb,uxmd24,xlkmod) if (qrderr) go to 990 c elseif (uoldv(1:3) .eq. '7.0') then c call rd3w7(cspb,fep,iktmax,iodb,iopg,iopr,iopt,itermx, $ jflagb,jxmod,kxmod,ncompb,ninpts,nodbmx,nopgmx,noprmx,noptmx, $ nsq,nsqmax,ntitl,ntitmx,nttyo,nxmdmx,nxmod,nxtb,nxtmax,qend, $ qrderr,rho,tempc,tdspkg,tdspl,tolbt,toldl,tolsat,ubasis, $ uebal,umemb,uphas1,uphas2,uredox,usolb,uspecb,utitl,xbarb, $ uxmd24,xlkmod) if (qrderr) go to 990 c elseif (uoldv(1:3) .eq. '7.2') then c c Note: version level 7.2 is identical to version level 7.0 c for this format. c call rd3w7(cspb,fep,iktmax,iodb,iopg,iopr,iopt,itermx, $ jflagb,jxmod,kxmod,ncompb,ninpts,nodbmx,nopgmx,noprmx,noptmx, $ nsq,nsqmax,ntitl,ntitmx,nttyo,nxmdmx,nxmod,nxtb,nxtmax,qend, $ qrderr,rho,tempc,tdspkg,tdspl,tolbt,toldl,tolsat,ubasis, $ uebal,umemb,uphas1,uphas2,uredox,usolb,uspecb,utitl,xbarb, $ uxmd24,xlkmod) if (qrderr) go to 990 c elseif (uoldv(1:3) .eq. '8.0') then c call rd3w8(cgexj,cgexpi,covali,ehi,egexsi,fo2lgi,iebal3, $ ietmax,iodb,iopg,iopr,iopt,irdxc3,itdsf3,itermx,jgext,jetmax, $ jflgi,jgexti,jpres3,kxmod,mwtges,nbti,nbtmax,ncmpri,net,neti, $ netmax,ngexti,ninpts,ngexrt,nobswt,nodbmx,nopgmx,noprmx, $ noptmx,noutpt,nprob,nsbswt,ntitl,ntitmx,nttyo,nxicmx,nxmdmx, $ nxmod,nxti,nxtimx,pei,press,qend,qgexsh,qrderr,rho,scamas, $ tdspkg,tdspl,tempc,tgexp,tolbt,toldl,tolspf,ucospi,uebal, $ ugexj,ugexji,ugexmo,ugexp,ugexpi,ugexr,ugexsi,umemi,uobsw, $ uredox,usbsw,usoli,uspeci,utitl,uhfgex,uvfgex,uxkgex,uxmod, $ xbari,xgexsi,xhfgex,xlkgex,xvfgex,xlkmod,zgexj) if (qrderr) go to 990 c else c write (nttyo,1200) uoldv 1200 format(/' * Error - (XCON3/xcon3) Coding to implement', $ /7x,'reading an input file in "W" format has not been', $ /7x,'implemented for version level "',a3,'."') go to 990 c endif elseif (uoldf(1:1) .eq. 'D') then c if (uoldv(1:3).eq.'8.0' .and. .not.q8bchk) then c c Distinguish 8.0 from 8.0 beta. 8.0 will include the c "Advisory:" and the "Option: on further procesing" strings, c which 8.0 beta will not. Search for these only between c the "Default redox constraint (irdxc3):" line and the c "Alter/Suppress Options | (nxmod)" line. c icount = 0 120 read(ninpts,1030,end=140) uline j2 = index(uline(2:80),'|') - 1 i = index(uline(2:j2),'Default redox constraint (irdxc3):') | if (i .le. 0) go to 120 c 130 read(ninpts,1030,end=140) uline j2 = index(uline(2:80),'|') - 1 i = index(uline(2:j2),'Advisory:') if (i .gt. 0) icount = icount + 1 i = index(uline(2:j2),'Option: on further processing') if (i .gt. 0) icount = icount + 1 i = index(uline(2:j2),'Alter/Suppress Options | (nxmod)') if (i .gt. 0) go to 140 if (icount .lt. 2) go to 130 140 q8beta = icount.lt.2 q8bchk = .true. rewind(ninpts) endif c if (uoldv(1:3) .eq. '6.0') then c write (nttyo,1205) uoldv 1205 format(/' * Error - (XCON3/xcon3) There is no "D" format', $ /7x,'for version level "6.0", hence',"can't read an input", $ /7x,'file in this format for this version level.') go to 990 c elseif (uoldv(1:3) .eq. '7.0') then c call rd3d7(cspb,fep,iktmax,iodb,iopg,iopr,iopt,itermx, $ jflagb,jxmod,kxmod,ncompb,ninpts,nodbmx,nopgmx,noprmx,noptmx, $ nsq,nsqmax,ntitl,ntitmx,nttyo,nxmdmx,nxmod,nxtb,nxtmax,qend, $ qrderr,rho,tempc,tdspkg,tdspl,tolbt,toldl,tolsat,ubasis, $ uebal,umemb,uphas1,uphas2,uredox,usolb,uspecb,utitl,xbarb, $ uxmd24,xlkmod) if (qrderr) go to 990 c elseif (uoldv(1:3) .eq. '7.2') then c c Note: XCON3/rd3d7.f can read a "D" format input file at c version level '7.2' as well as at version level '7.0'. c call rd3d7(cspb,fep,iktmax,iodb,iopg,iopr,iopt,itermx, $ jflagb,jxmod,kxmod,ncompb,ninpts,nodbmx,nopgmx,noprmx,noptmx, $ nsq,nsqmax,ntitl,ntitmx,nttyo,nxmdmx,nxmod,nxtb,nxtmax,qend, $ qrderr,rho,tempc,tdspkg,tdspl,tolbt,toldl,tolsat,ubasis, $ uebal,umemb,uphas1,uphas2,uredox,usolb,uspecb,utitl,xbarb, $ uxmd24,xlkmod) if (qrderr) go to 990 c elseif (uoldv(1:3).eq.'8.0' .and. q8beta) then c call rd3d8b(cgexj,cgexpi,covali,ehi,egexsi,fo2lgi,iebal3, $ ietmax,iodb,iopg,iopr,iopt,irdxc3,itdsf3,itermx,jgext,jetmax, $ jflgi,jgexti,jpres3,kxmod,mwtges,nbti,nbtmax,ncmpri,net,neti, $ netmax,ngexti,ninpts,ngexrt,nobswt,nodbmx,nopgmx,noprmx, $ noptmx,noutpt,nprob,nsbswt,ntitl,ntitmx,nttyo,nxicmx,nxmdmx, $ nxmod,nxti,nxtimx,pei,press,qend,qrderr,rho,scamas,tdspkg, $ tdspl,tempc,tgexp,tolbt,toldl,tolspf,ucospi,uebal,ugexj, $ ugexji,ugexmo,ugexp,ugexpi,ugexr,ugexsi,umemi,uobsw,uredox, $ usbsw,usoli,uspeci,utitl,uhfgex,uvfgex,uxkgex,uxmod,xbari, $ xgexsi,xhfgex,xlkgex,xvfgex,xlkmod,zgexj) if (qrderr) go to 990 c elseif (uoldv(1:3) .eq. '8.0') then c call rd3d8(cgexj,cgexpi,covali,ehi,egexsi,fo2lgi,iebal3, $ ietmax,iodb,iopg,iopr,iopt,irdxc3,itdsf3,itermx,jgext,jetmax, $ jflgi,jgexti,jpres3,kxmod,mwtges,nbti,nbtmax,ncmpri,net,neti, $ netmax,ngexti,ninpts,ngexrt,nobswt,nodbmx,nopgmx,noprmx, $ noptmx,noutpt,nprob,nsbswt,ntitl,ntitmx,nttyo,nxicmx,nxmdmx, $ nxmod,nxti,nxtimx,pei,press,qend,qgexsh,qrderr,rho,scamas, $ tdspkg,tdspl,tempc,tgexp,tolbt,toldl,tolspf,ucospi,uebal, $ ugexj,ugexji,ugexmo,ugexp,ugexpi,ugexr,ugexsi,umemi,uobsw, $ uredox,usbsw,usoli,uspeci,utitl,uhfgex,uvfgex,uxkgex,uxmod, $ xbari,xgexsi,xhfgex,xlkgex,xvfgex,xlkmod,zgexj) if (qrderr) go to 990 c else c write (nttyo,1210) uoldv 1210 format(/' * Error - (XCON3/xcon3) Coding to implement', $ /7x,'reading an input file in "D" format has not been', $ /7x,'implemented for version level "',a3,'."') go to 990 c endif else c write (nttyo,1110) uoldf 1110 format(/' * Error - (XCON3/xcon3) Have unknown format', $ /7x,'specifier "',a1,'" for the old input file.') go to 990 c endif c if (qend) then close(ninpt) close(ninpts,status='delete') close(newin) close(nxcon) go to 999 endif c c* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * c c Make changes in the content of the input file problem. c c Look for the string "Version level= " or Version number= " in the c title. This identifies the version level of the input file. c If present, change it. If not, insert a new line containing c this at the beginning of the title. c do n = 1,ntitl j = index(utitl(n),'Version level=') if (j .eq. 0) j = index(utitl(n),'version level=') if (j .gt. 0) then utitl(n)(j + 14:j + 14) = ' ' utitl(n)(j + 15:j + 17) = unewv utitl(n)(j + 18:80) = ' ' go to 220 endif j = index(utitl(n),'Version number=') if (j .eq. 0) j = index(utitl(n),'version number=') if (j .gt. 0) then utitl(n)(j + 8:j + 14) = 'level= ' utitl(n)(j + 15:j + 17) = unewv utitl(n)(j + 18:80) = ' ' go to 220 endif enddo c if ((ntitl + 1) .gt. ntitmx) then write (nttyo,1115) nprob,ntitmx 1115 format(/" * Error - (XCON3/xcon3) Can't add a version", $ /7x,'level marker to the first input file title of,' $ /7x,'problem ',i2,' because this title already has the', $ /7x,'maximum length of ',i3,' lines.') go to 990 endif c do n = ntitl,1,-1 utitl(n + 1) = utitl(n) enddo ntitl = ntitl + 1 c utitl(1)(1:40) = ' ' utitl(1)(41:80) = ' ' utitl(1)(1:15) = 'Version level= ' utitl(1)(16:18) = unewv utitl(1)(21:27) = '(XCON3)' c 220 continue c c* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * c c Get version levels in floating point format. c c Calling sequence substitutions: c uoldv for ustr c verold for var c call chreal(nttyo,qrderr,uoldv,verold) c c Calling sequence substitutions: c unewv for ustr c vernew for var c call chreal(nttyo,qrderr,unewv,vernew) c c* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * c c Patch up possible incompatibilities between "D" and "W" formats. c The relevant variables here do not appear on EQ6 input files. c if (vernew .lt. 8.0) then if (unewf(1:1) .eq. 'D') then if (uebal(1:5) .eq. 'none ') uebal = ' ' if (uebal(1:5) .eq. 'None ') uebal = ' ' if (uredox(1:5) .eq. 'none ') uredox = ' ' if (uredox(1:5) .eq. 'None ') uredox = ' ' elseif (unewf(1:1) .eq. 'W') then if (uebal(1:5) .eq. 'None ') uebal = 'none' if (uebal(1:1) .eq. ' ') uebal = 'none' if (uredox(1:5) .eq. 'None ') uredox = 'none' if (uredox(1:1) .eq. ' ') uredox = 'none' endif else if (uebal(1:5) .eq. 'none ') uebal = 'None' if (uebal(1:1) .eq. ' ') uebal = 'None' if (uredox(1:5) .eq. 'none ') uredox = 'None' if (uredox(1:1) .eq. ' ') uredox = 'None' endif c c* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * c if (verold.lt.8.0 .and. vernew.ge.8.0) then c c Make translations from pre-Version 8.0 structures to Version 8.0 c and up structures. All pre-Version 8.0 basis switching is mapped c to ordinary basis switching in Version 8.0 and up (none is c mapped to special basis switching). c nerr = 0 c jpres3 = 0 c if (tdspkg .gt. 0.) then itdsf3 = 0 elseif (tdspl .gt. 0.) then itdsf3 = 1 else itdsf3 = 0 endif c j2 = ilnobl(uebal) if (j2 .eq. 0) then iebal3 = 0 elseif (uebal(1:j2) .eq. 'None') then iebal3 = 0 elseif (uebal(1:j2) .eq. 'none') then iebal3 = 0 elseif (uebal(1:j2) .ne. 'pick1.') then iebal3 = 1 else write (nttyo,1608) 1608 format(/" * Error - (XCON3/xcon3) Can't translate this", $ /7x,'pre-version level 8.0 input file to version level', $ /7x,'8.0 or higher because it specifies the option that', $ /7x,'the code is to pick a species for electrical balancing', $ /7x,'(uebal= "pick1."). This option does not exist in', $ /7x,'version level 8.0 or higher. Change the uebal input', $ /7x,'on the old input file to blank or the name of a species', $ /7x,'to balance on.') nerr = nerr + 1 endif c scamas = 1. net = 0 c iopt(11) = iopt(2) iopt(2) = 0 iopt(17) = iopt(3) iopt(3) = 0 irdxc3 = iopt(1) iopt(1) = 0 if (iopt(4) .ge. 2) iopt(4) = 1 c iopr(10) = iopr(9) iopr(9) = iopr(6) iopr(6) = iopr(5) iopr(5) = 0 iopr(3) = iopr(8) iopr(8) = 0 c iodb(3) = iodb(2) iodb(2) = 0 c nbti = nsq nsbswt = 0 nobswt = 0 c if (irdxc3 .eq. -2) then pei = fep elseif (irdxc3 .eq. -1) then ehi = fep elseif (irdxc3 .eq. 0) then fo2lgi = fep endif c j2 = ilnobl(uredox) if (j2 .le. 0) uredox = 'None' j2 = ilnobl(uebal) if (j2 .le. 0) uebal = 'None' c do n = 1,nxmod uxmod(n)(1:24) = uxmd24(n) enddo c do ns = 1,nsq c c Basis species and basis switching. c nb = ns uspeci(nb) = uspecb(ns) jflgi(nb) = jflagb(ns) covali(nb) = cspb(ns) if (uphas2(ns)(1:3) .eq. ' ') then ucospi(nb)(1:24) = uphas1(ns) ucospi(nb)(25:48) = uphas2(ns) else ucospi(nb)(1:24) = uphas2(ns) ucospi(nb)(25:48) = uphas1(ns) endif if (ubasis(ns)(1:3) .ne. ' ') then nobswt = nobswt + 1 uobsw(1,nobswt) = uspecb(ns) uobsw(2,nobswt) = ubasis(ns) endif enddo c do nb = 1,nbti jfli = jflgi(nb) if (jfli.eq.19 .or. jfli.eq.20 .or. jfli.eq.21) $ jflgi(nb) = 25 enddo c do nb = 1,nbti jfli = jflgi(nb) if (jfli .eq. 31) jflgi(nb) = 20 if (jfli .eq. 32) jflgi(nb) = 21 enddo c do nb = 1,nbti jfli = jflgi(nb) if (jfli.ge.4 .and. jfli.le.8) then j2 = ilnobl(uspeci(nb)(1:24)) write (nttyo,1610) jfli,uspeci(nb)(1:j2) 1610 format(/" * Error - (XCON3/xcon3) Can't translate this", $ /7x,'pre-version level 8.0 input file to version level', $ /7x,'8.0 or higher because it employs a jflag value of', $ /7x,i3,' for ',a,'. This jflag option for specifying', $ /7x,'a "free" concentration" is obsolete at the higher', $ /7x,'version level.') nerr = nerr + 1 endif enddo c qgexsh = .false. c nxti = nxtb nxic = 0 do nx = 1,nxtb nxi = nx usoli(nxi) = usolb(nx) iktb = ncompb(nx) ncmpri(1,nxi) = nxic + 1 ncmpri(2,nxi) = nxic + iktb do ik = 1,iktb nxic = nxic + 1 umemi(nxic) = umemb(ik,nx) xbari(nxic) = xbarb(ik,nx) enddo enddo c tolspf = tolsat c if (nerr .gt. 0) stop endif c c* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * c if ((abs(verold - 8.0).le.epstst .and. q8beta) $ .and. vernew.ge.8.0) then c c Make additions if converting from Version 8.0 beta to c Version 8.0 and up. c qgexsh = .false. c endif c c* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * c if (verold.ge.8.0 .and. vernew.lt.8.0) then c c Make translations from Version 8.0 and up structures to c pre-Version 8.0 structures, and vice versa. Special basis c switching in Version 8.0 and up can't be mapped to any c pre-Version 8.0 structure. c nerr = 0 c if (tempc .le. 100.) then presh = apresh(1,1) else presh = 0. do nn = 1,5 n = 6 - nn presh = apresh(n,2) + tempc*presh enddo endif c if (jpres3 .le. 0) then press = 0. elseif (jpres3 .eq. 1) then write (nttyo,1692) 1692 format(/' * Note - (XCON3/xcon3) This version level 8.0', $ /7x,'or higher input file specifies the option to compute', $ /7x,'the pressure from the temperature according to the', $ /7x,'1.013-bar/steam-saturation curve (jpres3 = 1). This', $ /7x,'option does not directly translate to pre-Version 8.0.', $ /7x,'level The pressure at that level implicitly lies on the', $ /7x,'data file reference pressure curve, which may or may', $ /7x,'not coincide with the 1.013-bar/steam-saturation curve.', $ /7x,'To avoid getting this message, change the option on the', $ /7x,'old input file to specify computing the pressure', $ /7x,'according to the data file reference pressure curve', $ /7x,'(jpres3 = 0).') press = 0. elseif (jpres3 .eq. 2) then if (press.gt.0 .and. abs(press - presh).gt.1.e-4) then write (nttyo,1700) press,presh 1700 format(/" * Error - (XCON3/xcon3) Can't translate this", $ /7x,'version level 8.0 or higher input file to a lower', $ /7x,'version level because it specifies a pressure of', $ /7x,f9.4,' bars, which differs from the pre-Version 8', $ /7x,'standard grid pressure of ',f9.4,' bars. To convert', $ /7x,'this input file, set press = 0., which defaults to', $ /7x,'the standard grid pressure.') nerr = nerr + 1 endif else write (nttyo,1702) jpres3 1702 format(/" * Error - (XCON3/xcon3) Can't translate this", $ /7x,'version level 8.0 or higher input file to a lower', $ /7x,'version level because it specifies an unknown', $ /7x,'pressure option (jpres3= ',i2,'.') nerr = nerr + 1 endif c if (itdsf3 .le. 0) then continue elseif (itdsf3 .ge. 1) then continue endif c if (iebal3 .le. 0) then uebal = ' ' else continue endif c if (abs(scamas - 1.0) .gt. 1.e-6) then write (nttyo,1710) scamas 1710 format(/" * Error - (XCON3/xcon3) Can't translate this", $ /7x,'version level 8.0 or higher input file to a lower', $ /7x,'version level because it specifies a scale factor', $ /7x,'of ',1pe11.4,' for the mass of aqueous solution to', $ /7x,'write on the PICKUP file. Pre-version 8 input files', $ /7x,'lack this parameter, effectively assuming a value of', $ ' 1.0.',/7x,'To convert this input file, set scamas = 1.0.') nerr = nerr + 1 endif c if (net .gt. 0) then write (nttyo,1720) net 1720 format(/" * Error - (XCON3/xcon3) Can't translate this", $ /7x,'version level 8.0 or higher input file to a lower', $ /7x,'version level because it defines ',i2,' generic', $ /7x,'ion exchangers.Pre-version 8 input files lack the', $ /7x,'generic ion exchange capability.') nerr = nerr + 1 endif c iopt(2) = iopt(11) iopt(11) = 0 iopt(3) = iopt(17) iopt(17) = 0 iopt(1) = irdxc3 if (iopt(4).ge.1 .and. nxti.gt.0) iopt(4) = 2 c if (iopt(19) .gt. 0) then write (nttyo,1730) 1730 format(/" * Warning - (XCON3/xcon3) Can't translate the", $ /7x,'"Advanced EQ3NR PICKUP File Options" (iopt(19)) option', $ /7x,'specified on this version level 8.0 or higher input', $ /7x,'file to a lower version level because this option does', $ /7x,'not exist at the lower version level.') endif c iopr(5) = iopr(6) iopr(6) = iopr(9) iopr(9) = iopr(10) iopr(10) = 0 iopr(8) = iopr(3) iopr(3) = 0 c iodb(2) = iodb(3) iodb(3) = 0 c if (iopt(1) .eq. -2) then fep = pei elseif (iopt(1) .eq. -1) then fep = ehi elseif (iopt(1) .eq. 0) then fep = fo2lgi endif c cXX do nb = 1,nbti if (jflgi(nb) .eq. 22) then c c Translate the pmH option to a pH option. c This is done at the version 8 level. Additional c translation may follow. c jflgi(nb) = 20 iopg(2) = 1 endif enddo c do nb = 1,nbti if (jflgi(nb) .eq. 23) then c c The pmX option is not translatable. c j2 = ilnobl(uspeci(nb)) write (nttyo,1732) uspeci(nb)(1:j2) 1732 format(/" * Error - (XCON3/xcon3) Can't translate this", $ /7x,'version level 8.0 or higher input file to a lower', $ /7x,'version level because it contains a pmX input for', $ /7x,a,'. The pmX option does not exist at a lower', $ /7x,'version level.') nerr = nerr + 1 endif enddo cXX c nsq = nbti c do nb = 1,nbti c c Basis species. c ns = nb uspecb(ns) = uspeci(nb)(1:24) jflagb(ns) = jflgi(nb) cspb(ns) = covali(nb) if (ucospi(nb)(25:27) .eq. ' ') then uphas1(ns) = ucospi(nb)(1:24) uphas2(ns) = ' ' elseif (ucospi(nb)(25:33) .eq. 'Aqueous solution ') then uphas1(ns) = ucospi(nb)(1:24) uphas2(ns) = ' ' elseif (ucospi(nb)(25:28) .eq. 'Gas ') then uphas1(ns) = ucospi(nb)(1:24) uphas2(ns) = ' ' else uphas2(ns) = ucospi(nb)(1:24) uphas1(ns) = ucospi(nb)(25:48) endif enddo c do ns = 1,nsq if (jflagb(ns) .eq. 19) then jflagb(ns) = 16 cspb(ns) = -cspb(ns) endif enddo c if (unewf(1:1) .eq. 'W') then do ns = 1,nsq if (jflagb(ns) .eq. 20) then jflagb(ns) = 16 cspb(ns) = -cspb(ns) elseif (jflagb(ns) .eq. 21) then uphas1(ns) = 'Cl-' jflagb(ns) = 17 cspb(ns) = -cspb(ns) endif enddo else do ns = 1,nsq if (jflagb(ns) .eq. 20) then jflagb(ns) = 31 elseif (jflagb(ns) .eq. 21) then jflagb(ns) = 32 endif enddo endif c do ns = 1,nsq if (jflagb(ns) .eq. 25) then jflagb(ns) = 19 if (uphas2(ns)(1:24).ne.ublk24(1:24) .and. $ uphas2(ns)(1:24).ne.uphas1(ns)(1:24)) jflagb(ns) = 20 j = index(uphas1(ns),'(g)') if (j .gt. 0) jflagb(ns) = 21 endif enddo c if (nsbswt .gt. 0) then write (nttyo,1740) nsbswt 1740 format(/" * Error - (XCON3/xcon3) Can't translate this", $ /7x,'version level 8.0 or higher input file to a lower', $ /7x,'version level because it contains ',i3,' directives', $ /7x'for special basis switching.') nerr = nerr + 1 endif c do nobsw = 1,nobswt c c Basis switching. c do nb = 1,nbti if (uobsw(1,nobsw)(1:48) .eq. uspeci(nb)(1:48)) then ns = nb ubasis(ns) = uobsw(2,nobsw) go to 244 endif enddo 244 continue enddo c do n = 1,nxmod c uxmd24(n) = uxmod(n)(1:24) c c Set the jxmod value. This is a flag for the type of species: c c 0 = aqueous species c 1 = pure mineral c 2 = gas c 3 = solid solution c c The jxmod array is not used in Version 8.0 and up. It is c not possible to design a perfect logic for determining the c correct value. Here there may be a problem in determining c whether a species is a pure mineral or a solid solution. c Also, in some cases, the Version 8.0 and up option may not c map back to the pre-Version 8.0 format. c if (uxmod(n)(25:40) .eq. 'Aqueous solution') then jxmod(n) = 0 go to 250 endif c if (uxmod(n)(25:28) .eq. 'Gas ') then jxmod(n) = 2 go to 250 endif c if (uxmod(n)(25:48).ne.uxmod(n)(1:24) .and. $ uxmod(n)(25:27).ne.' ') then nerr = nerr + 1 j2 = ilnobl(uxmod(n)) write (nttyo,1117) uxmod(n)(1:j2) 1117 format(/" * Error - (XCON3/xcon3) Can't translate a", $ ' suppress/alter option',/7x,'for "',a,'"', $ /7x,'to pre-Version 8.0 format.') go to 250 endif c i = index(uxmod(n),'(aq)') if (i .gt. 0) then jxmod(n) = 0 go to 250 endif c ux24 = uxmod(n)(1:24) j2 = ilnobl(ux24) if (j2 .gt. 0) then if (ux24(j2:j2).eq.'+' .or. ux24(j2:j2).eq.'-') then jxmod(n) = 0 go to 250 endif endif c i = index(uxmod(n),'(g)') if (i .le. 0) i = index(uxmod(n),'Hydrogen') if (i .le. 0) i = index(uxmod(n),'Oxygen') if (i .le. 0) i = index(uxmod(n),'Nitrogen') if (i .le. 0) i = index(uxmod(n),'Steam') if (i .gt. 0) then jxmod(n) = 2 go to 250 endif c i = index(uxmod(n),'(ss)') if (i .le. 0) i = index(uxmod(n),'-ss') if (i .le. 0) i = index(uxmod(n),'Carbonate-Calcite') if (i .le. 0) i = index(uxmod(n),'Biotite') if (i .le. 0) i = index(uxmod(n),'Olivine') if (i .le. 0) i = index(uxmod(n),'Plagioclase') if (i .le. 0) i = index(uxmod(n),'Orthopyroxene') if (i .le. 0) i = index(uxmod(n),'Smectite-di') if (i .le. 0) i = index(uxmod(n),'Saponite-tri') if (i .gt. 0) then jxmod(n) = 3 go to 250 endif c i = index(uxmod(n),'ite ') if (i .le. 0) i = index(uxmod(n),'ime ') if (i .le. 0) i = index(uxmod(n),'ine ') if (i .le. 0) i = index(uxmod(n),'Quartz') if (i .gt. 0) then jxmod(n) = 1 go to 250 endif c j2 = ilnobl(uxmod(n)) write (nttyo,1119) uxmod(n)(1:j2) 1119 format(/" * Warning - (XCON3/xcon3) Can't unambiguously", $ /7x,'determine what kind of species in an alter/suppress', $ /7x,'option is "',a,'".', $ /7x,'Setting jxmod to 1. Check to see that this is correct', $ /7x,'(0 = aqueous species, 1 = pure mineral,', $ ' 3 = gas species', $ /7x,'3 = solid solution).') jxmod(n) = 1 250 continue enddo c nxtb = nxti do nxi = 1,nxti nx = nxi usolb(nx) = usoli(nxi) nr1 = ncmpri(1,nxi) nr2 = ncmpri(2,nxi) ncompb(nx) = nr2 - nr1 + 1 ik = 0 do nxic = nr1,nr2 ik = ik + 1 umemb(ik,nx) = umemi(nxic) xbarb(ik,nx) = xbari(nxic) enddo enddo c tolsat = tolspf c if (nerr .gt. 0) stop endif c c* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * c if (vernew.lt.8.0 .and. unewf(1:1).eq."D") then c c Map any inputs equivalent to pH to pH, and any inputs equivalent c to pHCl to pHCl, but only if the new input file is to be in "D" c format. Use the hidden jflag values 31 (pH) and 32 (pHCl), which c do not exist in the case of "W" format. c do ns = 1,nsq ustr = uspecb(ns) if (ustr(1:3).eq.'h+ ' .or. ustr(1:3).eq.'H+ ') then if (jflagb(ns) .eq. 16) then jflagb(ns) = 31 cspb(ns) = -cspb(ns) elseif (jflagb(ns) .eq. 17) then ustr1 = uphas1(ns) if (ustr1(1:4).eq.'cl- ' .or. ustr1(1:4).eq.'Cl- ') $ then uphas1(ns) = ' ' jflagb(ns) = 32 cspb(ns) = -cspb(ns) endif endif endif enddo endif c c* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * c if (vernew .ge. 8.0) then c c Map any inputs equivalent to pH to pH, and any inputs equivalent c to pHCl to pHCl. c do nb = 1,nbti ustr = uspeci(nb) if (ustr(1:3) .eq. 'H+ ') then jfli = jflgi(nb) if (jfli .eq. 16) then jflgi(nb) = 20 covali(nb) = -covali(nb) elseif (jfli .eq. 19) then jflgi(nb) = 20 elseif (jfli .eq. 17) then ustr1 = ucospi(nb) if (ustr1(1:4).eq.'Cl- ') then ucospi(nb) = ' ' jflgi(nb) = 21 covali(nb) = -covali(nb) endif endif endif enddo endif c c* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * c c Write the current problem on the new input file. c if (unewf(1:1) .eq. 'W') then if (unewv(1:3) .eq. '6.0') then c call wr3w6(cspb,fep,iktmax,iodb,iopg,iopr,iopt, $ itermx,jflagb,jxmod,kxmod,ncompb,newin,nodbmx,nopgmx, $ noprmx,noptmx,nsq,nsqmax,ntitl,ntitmx,nxmdmx,nxmod, $ nxtb,nxtmax,rho,tempc,tdspkg,tdspl,tolbt,toldl,tolsat, $ uacion,ubasis,uebal,umemb,uphas1,uphas2,uredox,usolb, $ uspecb,utitl,xbarb,uxmd24,xlkmod) c elseif (unewv(1:3) .eq. '7.0') then c call wr3w7(cspb,fep,iktmax,iodb,iopg,iopr,iopt, $ itermx,jflagb,jxmod,kxmod,ncompb,newin,nodbmx,nopgmx, $ noprmx,noptmx,nsq,nsqmax,ntitl,ntitmx,nxmdmx,nxmod, $ nxtb,nxtmax,rho,tempc,tdspkg,tdspl,tolbt,toldl,tolsat, $ ubasis,uebal,umemb,uphas1,uphas2,uredox,usolb,uspecb, $ utitl,xbarb,uxmd24,xlkmod) c elseif (unewv(1:3) .eq. '7.2') then c c Note: version level 7.2 is identical to version level 7.0 c for this format. c call wr3w7(cspb,fep,iktmax,iodb,iopg,iopr,iopt, $ itermx,jflagb,jxmod,kxmod,ncompb,newin,nodbmx,nopgmx, $ noprmx,noptmx,nsq,nsqmax,ntitl,ntitmx,nxmdmx,nxmod, $ nxtb,nxtmax,rho,tempc,tdspkg,tdspl,tolbt,toldl,tolsat, $ ubasis,uebal,umemb,uphas1,uphas2,uredox,usolb,uspecb, $ utitl,xbarb,uxmd24,xlkmod) c elseif (unewv(1:3) .eq. '8.0') then c call wr3w8(cgexj,cgexpi,covali,ehi,egexsi,fo2lgi,iebal3, $ ietmax,iodb,iopg,iopr,iopt,irdxc3,itdsf3,itermx,jgext,jetmax, $ jflgi,jgexti,jpres3,kxmod,mwtges,nbti,nbtmax,ncmpri,net,neti, $ netmax,newin,ngexti,ngexrt,nobswt,nodbmx,nopgmx,noprmx,noptmx, $ nsbswt,ntitl,ntitmx,nttyo,nxicmx,nxmdmx,nxmod,nxti,nxtimx,pei, $ press,qgexsh,rho,scamas,tdspkg,tdspl,tempc,tgexp,tolbt,toldl, $ tolspf,ucospi,uebal,ugexj,ugexji,ugexmo,ugexp,ugexpi,ugexr, $ ugexsi,umemi,uobsw,uredox,usbsw,usoli,uspeci,utitl,uhfgex, $ uvfgex,uxkgex,uxmod,xbari,xgexsi,xhfgex,xlkgex,xvfgex, $ xlkmod,zgexj) c else c write (nttyo,1220) unewv 1220 format(/' * Error - (XCON3/xcon3) Coding to implement', $ /7x,'writing an input file in "W" format has not been', $ /7x,'implemented for version level "',a3,'."') go to 990 c endif elseif (unewf(1:1) .eq. 'D') then if (unewv(1:3) .eq. '6.0') then c write (nttyo,1230) unewv 1230 format(/' * Error - (XCON3/xcon3) There is no "D" format', $ /7x,'for version level "6.0", hence',"can't write an input", $ /7x,'file in this format for this version level.') go to 990 c elseif (unewv(1:3) .eq. '7.0') then c call wr3d7(cspb,fep,iktmax,iodb,iopg,iopr,iopt,itermx, $ jflagb,jxmod,kxmod,ncompb,newin,nodbmx,nopgmx,noprmx,noptmx, $ nsq,nsqmax,ntitl,ntitmx,nttyo,nxmdmx,nxmod,nxtb,nxtmax, $ rho,tempc,tdspkg,tdspl,tolbt,toldl,tolsat,ubasis,uebal, $ umemb,uphas1,uphas2,uredox,usolb,uspecb,utitl,xbarb, $ uxmd24,xlkmod) c elseif (unewv(1:3) .eq. '7.2') then c call wr3d72(cspb,fep,iktmax,iodb,iopg,iopr,iopt,itermx, $ jflagb,jxmod,kxmod,ncompb,newin,nodbmx,nopgmx,noprmx,noptmx, $ nsq,nsqmax,ntitl,ntitmx,nttyo,nxmdmx,nxmod,nxtb,nxtmax, $ rho,tempc,tdspkg,tdspl,tolbt,toldl,tolsat,ubasis,uebal, $ umemb,uphas1,uphas2,uredox,usolb,uspecb,utitl,xbarb, $ uxmd24,xlkmod) c elseif (unewv(1:3) .eq. '8.0') then c call wr3d8(cgexj,cgexpi,covali,ehi,egexsi,fo2lgi,iebal3, $ ietmax,iodb,iopg,iopr,iopt,irdxc3,itdsf3,itermx,jgext,jetmax, $ jflgi,jgexti,jpres3,kxmod,mwtges,nbti,nbtmax,ncmpri,net,neti, $ netmax,newin,ngexti,ngexrt,nobswt,nodbmx,nopgmx,noprmx,noptmx, $ nsbswt,ntitl,ntitmx,nttyo,nxicmx,nxmdmx,nxmod,nxti,nxtimx,pei, $ press,qgexsh,rho,scamas,tdspkg,tdspl,tempc,tgexp,tolbt,toldl, $ tolspf,ucospi,uebal,ugexj,ugexji,ugexmo,ugexp,ugexpi,ugexr, $ ugexsi,umemi,uobsw,uredox,usbsw,usoli,uspeci,utitl,uhfgex, $ uvfgex,uxkgex,uxmod,xbari,xgexsi,xhfgex,xlkgex,xvfgex, $ xlkmod,zgexj) c else c write (nttyo,1240) unewv 1240 format(/' * Error - (XCON3/xcon3) Coding to implement', $ /7x,'writing an input file in "D" format has not been', $ /7x,'implemented for version level "',a3,'."') go to 990 c endif else c write (nttyo,1130) unewf 1130 format(/' * Error - (XCON3/xcon3) Have unknown format', $ /7x,'specifier "',a1,'" for the new input file.') go to 990 c endif c c Go back to do another problem on the same input file. c go to 100 c c* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * c 990 write (nttyo,1140) uoldv 1140 format(/' * Error - (XCON3/xcon3) Have encountered a read', $ /7x,'error while reading the old input file. First check the', $ /7x,'version level. The version level was taken to be "',a3,'".', $ /7x,'If the version level is marked incorrectly in the primary', $ /7x,'title of the first problem, correct this, as the default', $ /7x,'value read from the IXCON file or set in the code itself', $ /7x,'does not override this. If the problem is not due to an', $ /7x,'error in the assumed version level, there is probably a', $ /7x,'format error on the old input file. Check the stripped', $ /7x,'copy of the old input file (INPUTS).') c c Close all files. Don't delete the inputs file. Delete the NEWIN c file, which is not valid. c close(ninpt) close(ninpts) close(newin,status='delete') close(nxcon) c c* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * c 999 continue end
module Network using SHA using Dates using Random include("./Ledger.jl") using .Ledger: Transaction, Blockchain, Block, appendblock, gethash, checkdifficulty mutable struct Node pool::Dict{String,Transaction} blockchain::Blockchain Node() = new(Dict{String,Transaction}(), Blockchain("litcoin")) #Node() = new(Dict{String,Transaction}()) end # Initialize a fixed number of nodes nodes = [Node() for i in 1:10] function getNTransactions(node::Node, n::Int) sorted = sort(collect(values(node.pool)), by=x -> x.fee, rev=true) return sorted[1:min(n, size(sorted, 1))] end function getRandomNode() return nodes[rand(1:size(nodes, 1))] end function addTransaction(node::Node, tx::Transaction) node.pool[tx.signature] = tx end function addBlock(node::Node, parent_hash::String, transactions::Vector{Transaction}, nonce::String) node.blockchain.append_block(parent_hash, transactions, nonce) end function mine() # Select a random Node for getting the blockchain data node = getRandomNode() # Start mining while true # Get transactions to verify transactions = getNTransactions(node, 5) # Get the previous block hash parent_hash = node.blockchain.blocks[1].hash # Mine by trying different nonces max_nonce = 2 ^ 32 mined = false block = 0 for i in 0:max_nonce nonce = randstring(64) block = Block(0, Dates.now(), transactions, parent_hash, nonce) if checkdifficulty(node.blockchain, block) mined = true break end end # If succesful, alert the network if mined accepted = appendblock(node.blockchain, block) if accepted #println("MINED") else println("NOPE") end end # Sleep a while sleep(0.5) end end function transact() # Select a random Node for inserting new transactions node = getRandomNode() while true # Create new transaction tx = Transaction(0, "aki", 0, "marc", 0, "hi", randstring(12), 1) # Add transaction to pool addTransaction(node, tx) # Sleep a while sleep(1) end end function observe() while true n_nodes = size(nodes, 1) n_tx_all = 0 longest_block = 0 for n in nodes n_tx_all += length(n.pool) longest_block = max(longest_block, size(n.blockchain.blocks, 1)) end println("Number of nodes: $(lpad(n_nodes, 7))") println("Number of pooled transactions: $(lpad(n_tx_all, 7))") println("Longest block: $(lpad(longest_block, 7))") # Sleep a while sleep(0.5) run(`clear`) end end end # Init a transaction loop @async Network.transact() # Init an observer loop @async Network.observe() # Init a mining loop @sync @async Network.mine()
The polynomial $1$ is not irreducible.
# # Munk Gyre analytical solution equations # things between #### blocks are the code for checking exact solution in DGmodel test using Pkg Pkg.add("Latexify") using Latexify Pkg.add("Plots") using Plots Pkg.add("PyPlot") pyplot() # Problem parameters # These will come from DG model/problem settings ### τ₀=0.1 # Stress ρ=1000 # density f=1.e-4 # Coriolis β=1.e-11 # Rate of change of Coriolis H=1000 # Depth L_x=1000.e3 # Zonal extent L_y=1000.e3 # Meridional extent Ah=1000. # Viscosity g=10. # Gravity δ_m=(Ah/β)^(1/3) #### # Set up Munk formula per https://mitgcm.readthedocs.io/en/latest/examples/examples.html#model-solution # Build up using expressions to catch typos t1=:( cos((3^0.5*x)/(2*δ_m))+(1)/(3^0.5)*sin((3^0.5*x)/(2*δ_m)) ) display(latexify(t1)) t2=:( 1-exp((-x)/(2*δ_m) ) * $t1 ) display(latexify(t2)) t3=:( π*sin(π*y/L_y) ) display(latexify(t3)) t4=:( τ₀/(ρ*g*H)*(f/β)*(1-x/L_x) ) display(latexify(t4)) tfull=:( ($t4) * ($t3) * ($t2) ) display(latexify(tfull)) display(tfull) # Actual function (a copy paste from display(tfull) line) #### This is formula needed for checking numerical against exact ηfun(x,y)=(((τ₀ / (ρ * g * H)) * (f / β) * (1 - x / L_x)) * (π * sin((π * y) / L_y)) * (1 - exp(-x / (2δ_m)) * (cos((3 ^ 0.5 * x) / (2δ_m)) + (1 / 3 ^ 0.5) * sin((3 ^ 0.5 * x) / (2δ_m))))) #### # Now make a plot to check xvals=collect(0:L_x/100:L_x) yvals=collect(0:L_y/100:L_y) nx=length(xvals) ny=length(yvals) η=zeros(nx,ny) for j=1:ny for i=1:nx η[i,j]=ηfun(xvals[i],yvals[j]) end end p2 = contour(xvals, yvals, η') plot(p2)
function obj = setFuncIndices(obj, index) % Sets indinces of the Nlp Function % % Parameters: % index: the indices of the function @type integer % If an offset is not specified, set it to zero. assert(length(index) == obj.Dimension, ... 'The length of the variable indices must be equal to the dimension of the NlpVariable object.'); if ~isempty(obj.SummandFunctions) arrayfun(@(x) setFuncIndices(x, index), ... obj.SummandFunctions, 'UniformOutput', false); end obj.FuncIndices = index; end
Presenting this stunning brick-built custom colonial situated prominently in one of Avon's premiere neighborhoods. Nestled just beneath local landmark Heublein Tower, the expansive home offers incredible mountain views to the east and equally as fabulous valley views to the west. Receive guests by way of the stately main entry that leads into a large two-story foyer with herringbone wood floors and exquisite grand staircase, flanked by formal living and dining rooms. Enjoy comfortable and spacious living in an open space kitchen and dinette area that leads directly into an abundant family room with sky-scraping coffered ceiling and fireplace with pellet stove insert. The main level of the home features all the things you would expect in a luxury home, complete with library featuring cherry built-ins, butler's pantry with sink, laundry room, two powder rooms, and sun room. The upper level features five bedrooms, a large hall sitting area, four full baths including one Jack-n-Jill, and Au Pair/In-Law possibility. The master suite features an intelligently designed bath, a large walk-in closet, and a private third-story exercise room. An expansive lower level includes a vintage-themed modern theater, billiards room, bar, and a number of other spaces for offices or a den. Benefiting from Avon's award-winning schools, nearby private and public golf courses, riding stables, numerous private schools, and exceptional area dining and shopping, you will love to call this home!
Require Import Bedrock.Platform.Facade.Facade Bedrock.Platform.Facade.DFacade Bedrock.Platform.Cito.StringMap Bedrock.Platform.Cito.SyntaxExpr Bedrock.Memory. Require Import Coq.Strings.String. Notation "A ; B" := (Seq A B) (at level 201, B at level 201, left associativity, format "'[v' A ';' '/' B ']'") : facade_scope. Delimit Scope facade_scope with facade. Definition DummyArgument (s: string) := s. Hint Unfold DummyArgument : MapUtils_unfold_db. Notation "x <- y" := (Assign x y) (at level 90) : facade_scope. Notation "y <- f . g ()" := (Call y (f, g) nil) (at level 90, no associativity, format "y '<-' f '.' g '()'") : facade_scope. Notation "y <- f . g ( x1 , .. , xn )" := (Call y (f, g) (cons x1 .. (cons xn nil) ..)) (at level 90, no associativity, format "y '<-' f '.' g '(' x1 ',' .. ',' xn ')'") : facade_scope. Notation "'call' f . g ()" := (Call (DummyArgument _) (f, g) nil) (at level 90, no associativity, format "call f '.' g '()'") : facade_scope. Notation "'call' f . g ( x1 , .. , xn )" := (Call (DummyArgument _) (f, g) (cons x1 .. (cons xn nil) ..)) (at level 90, no associativity, format "call f '.' g '(' x1 ',' .. ',' xn ')'") : facade_scope. Notation "A < B" := (TestE IL.Lt A B) : facade_scope. Notation "A <= B" := (TestE IL.Le A B) : facade_scope. Notation "A <> B" := (TestE IL.Ne A B) : facade_scope. Notation "A = B" := (TestE IL.Eq A B) : facade_scope. Notation "! x" := (x = 0)%facade (at level 70, no associativity). Notation "A * B" := (Binop IL.Times A B) : facade_scope. Notation "A + B" := (Binop IL.Plus A B) : facade_scope. Notation "A - B" := (Binop IL.Minus A B) : facade_scope. Notation "'__'" := (Skip) : facade_scope. Notation "'While' A B" := (While A B) (at level 200, A at level 0, B at level 1000, format "'[v ' 'While' A '/' B ']'") : facade_scope. Notation "'If' a 'Then' b 'Else' c 'EndIf'" := (DFacade.If a b c) (at level 200, a at level 1000, b at level 1000, c at level 1000, format "'[v' '[v ' 'If' a 'Then' '/' b ']' '/' '[v ' 'Else' '/' c ']' '/' 'EndIf' ']'") : facade_scope.
REBOL [ Title: "MakeDoc 2 - The REBOL Standard Document Formatter" Version: 2.5.7 Copyright: "REBOL Technologies 1999-2005" Author: "Carl Sassenrath" File: %makedoc2.r Date: 10-Mar-2007 ;10-Jan-2005 Purpose: { This is the official MakeDoc document formatter that is used by REBOL Technologies for all documentation. It is the fastest and easiest way to create good looking documentation using any text editor (even ones that do not auto-wrap text). It creates titles, headings, contents, bullets, numbered lists, indented examples, note blocks, and more. For documentation, notes, and other info visit http://www.rebol.net/docs/makedoc.html } Usage: { Create a text document in any editor. Separate each paragraph with a blank line. Run this script and provide your text file. The output file will be the same name with .html following it. If you use REBOL/View the output file will be displayed in your web browser as well. You can also call this script from other scripts (e.g. CGI). These are supported: do %makedoc2.r do/args %makedoc2.r %document.txt do/args %makedoc2.r 'load-only doc: scan-doc read %file.txt set [title out] gen-html/options doc [(options)] write %out.html out } Library: [ level: 'intermediate platform: 'all type: [tool] domain: [html cgi markup] tested-under: none support: none license: 'BSD see-also: none ] ] ; Below you can specify an HTML output template to use for all your docs. ; See the default-template example below as a starting suggestion. template-file: %template.html ; Example: %template.html ; There are three parts to this script: ; 1. The document input scanner. ; 2. The document output formatter (for HTML). ; 3. The code that deals with input and output files. *scanner*: context [ ;-- Debugging: verbose: off debug: func [data] [if verbose [print data]] ;-- Module Variables: text: none para: none code: none title: none left-flag: off opts: [] ;[no-toc no-nums] out: [] ; The output block (static, reused) option: none ;--- Parser rules for the Makedoc text language (top-down): rules: [some commands] commands: [ newline here: (debug ["---PARSE:" copy/part here find here newline]) ;-- Document sections: | ["===" | "-1-"] text-line (emit-section 1) | ["---" | "-2-"] text-line (emit-section 2) | ["+++" | "-3-"] text-line (emit-section 3) | ["..." | "-4-"] text-line (emit-section 4) | "###" to end (emit end none) ; allows notes, comments to follow ;-- Common commands: | #"*" [ [">>" | "**"] text-block (emit bullet3 para) | [">" | "*" ] text-block (emit bullet2 para) | text-block (emit bullet para) ] | #"#" [ ">>" text-block (emit enum3 para) | ">" text-block (emit enum2 para) | text-block (emit enum para) ] | #":" define opt newline (emit define reduce [text para]) ; ">>" reserved ; "<<" reserved ;-- Enter a special section: | #"\" [ "in" (emit indent-in none) | "note" text-line (emit note-in text) | "table" text-line (emit table-in text) | "group" (emit group-in none) | "center" (emit center-in none) | "column" (emit column-in none) ] ;-- Exit a special section: | #"/" [ "in" (emit indent-out none) | "note" (emit note-out none) | "table" (emit table-out none) | "group" (emit group-out none) | "center" (emit center-out none) | "column" (emit column-out none) ] ;-- Extended commands (all begin with "="): | #";" text-block ; comments and hidden paragraphs | #"=" [ #"=" output (emit output trim/auto code) | "image" image | "row" (emit table-row none) | "column" (emit column none) ; (for doc, not tables) | "options" [ any [ spaces copy option [ "toc" | "nums" | "indent" | "no-indent" | "no-toc" | "no-nums" | "no-template" | "no-title" | "old-tags" | "root-images" ] (append opts to-word option) ] ] | "template" some-chars (repend opts ['template as-file text]) ] ;-- Primary implied paragraph types: | example (emit code trim/auto detab code) | paragraph ( either title [emit para para][emit title title: para] ) | skip (debug "???WARN: Unrecognized") ] space: charset " ^-" nochar: charset " ^-^/" chars: complement nochar spaces: [any space] some-chars: [some space copy text some chars] text-line: [any space copy text thru newline] text-block: [any space paragraph opt newline] ; ignore leading space, extra NL !??? paragraph: [copy para some [chars thru newline]] example: [copy code some [indented | some newline indented]] indented: [some space chars thru newline] output: [ some space copy code thru newline any ["==" ["^-" | " "] copy text thru newline (append code text)] ] define: [copy text to " -" 2 skip text-block] image: [ left? any space copy text some chars ( if text/1 = #"%" [remove text] ; remove %file text: as-file text emit image reduce [text pick [left center] left-flag] ) ] left?: [some space "left" (left-flag: on) | none (left-flag: off)] as-file: func [str] [to-file trim str] ;-- Output emitters: emit: func ['word data] [ debug ["===EMIT: " word] if block? word [word: do word] ;???? if string? data [trim/tail data] repend out [word data] ] emit-section: func [num] [ emit [to-word join "sect" num] text title: true ] ;-- Export function to scan doc. Returns format block. set 'scan-doc func [str /options block] [ clear out title: none if options [ if find block 'no-title [title: true] ] emit options opts str: join str "^/^/###" ; makes the parse easier parse/all detab str rules if verbose [ n: 1 foreach [word data] out [ print [word data] if (n: n + 1) > 5 [break] ] ] copy out ] ] ;-- HTML Output Generator ---------------------------------------------------- *html*: context [ ;-- HTML foprmat global option variables: no-nums: ; Do not use numbered sections no-toc: ; Do not generate table of contents no-title: ; Do not generate a title or boilerplate no-indent: ; Do not indent each section no-template: ; Do not use a template HTML page old-tags: ; Allow old markup convention (slower) root-images: ; Images should be located relative to / none toc-levels: 2 ; Levels shown in table of contents image-path: "" ; Path to images set 'gen-html func [ doc [block!] /options opts [block!] /local title template tmp ][ clear out ; (reused) group-count: 0 ; Options still need work!!! no-nums: no-toc: no-title: no-indent: no-template: old-tags: root-images: none set-options opts: any [opts []] set-options select doc 'options if root-images [image-path: %/] ; Template can be provided in =template or in ; options block following 'template. If options ; has 'no-template, then do not use a template. if not no-template [ template: any [select opts 'template select doc 'template template-file] if file? template [template: attempt [read template]] if not template [template: trim/auto default-template] ] ; Emit title and boilerplate: if not no-title [title: emit-boiler doc] ; Emit table of contents: clear-sects if not no-toc [ emit-toc doc clear-sects ] prior-cmd: none forskip doc 2 [ ; If in a table, emit a cell each time. if all [ in-table zero? group-count ; do not emit cell if in group not find [table-out table-row] doc/1 not find [table-in table-row] prior-cmd ][ emit-table-cell ] switch prior-cmd: doc/1 [ para [emit-para doc/2] sect1 [emit-sect 1 doc/2] sect2 [emit-sect 2 doc/2] sect3 [emit-sect 3 doc/2] sect4 [emit-sect 4 doc/2] bullet [emit-item doc doc/1] bullet2 [emit-item doc doc/1] bullet3 [emit-item doc doc/1] enum [emit-item doc doc/1] enum2 [emit-item doc doc/1] enum3 [emit-item doc doc/1] code [doc: emit-code doc] output [doc: emit-code doc] define [emit-def doc] image [emit-image doc/2] table-in [emit-table doc/2] table-out [emit-table-end] table-row [emit-table-row] center-in [emit <center>] center-out [emit </center>] note-in [emit-note doc/2] note-out [emit-note-end] group-in [group-count: group-count + 1] group-out [group-count: max 0 group-count - 1] indent-in [emit <blockquote>] indent-out [emit </blockquote>] column-in [emit {<table border=0 cellpadding=4 width=100%><tr><td valign=top>}] column-out [emit {</td></tr></table>}] column [emit {</td><td valign=top>}] ] ] doc: head doc emit </blockquote> if template [ ; Template variables all begin with $ tmp: copy template ; in case it gets reused replace/all tmp "$title" title replace/all tmp "$date" now/date replace tmp "$content" out out: tmp ] reduce [title out] ] set-options: func [options] [ if none? options [exit] foreach opt [ no-nums no-toc no-indent no-template no-title old-tags root-images ][if find options opt [set opt true]] foreach [opt word] [ nums no-nums toc no-toc indent no-indent ][if find options opt [set word false]] ] ;-- Default HTML Template: default-template: { <html> <!--Page generated by REBOL--> <head> <title>$title</title> <style type="text/css"> html, body, p, td, li {font-family: arial, sans-serif, helvetica; font-size: 10pt;} h1 {font-size: 16pt; Font-Weight: bold;} h2 {font-size: 14pt; color: #2030a0; Font-Weight: bold; width: 100%; border-bottom: 1px solid #c09060;} h3 {font-size: 12pt; color: #2030a0; Font-Weight: bold;} h4 {font-size: 10pt; color: #2030a0; Font-Weight: bold;} h5 {font-size: 10pt; Font-Weight: bold;} tt {font-family: "courier new", monospace, courier; color: darkgreen;} pre {font: bold 10pt "courier new", monospace, console; background-color: #e0e0e0; padding: 16px; border: solid #a0a0a0 1px;} .toc1 {margin-left: 1cm; font-size: 12pt; font-weight: bold;} .toc2 {margin-left: 2cm; font-size: 10pt; Font-Weight: bold; text-decoration: none;} .toc3 {margin-left: 3cm; font-size: 10pt; text-decoration: none;} .toc4 {margin-left: 4cm; font-size: 10pt; color: grey; text-decoration: none;} .output {color: #000080; font-weight: normal;} .note {background-color: #f0e090; width: 100%; padding: 16px; border: solid #a0a0a0 1px;} .tail {color: gray; font-size: 8pt;} </style> </head> <body bgcolor="white"> <table width="660" cellpadding="4" cellspacing="0" border="0"> <tr> <td><a href="http://www.rebol.com"><img src="http://www.rebol.net/graphics/reb-bare.jpg" border=0 alt="REBOL"></a></td> </tr> <tr height="10"><td></td></tr> <tr><td>$content</td></tr><tr> <tr><td><img src="http://www.rebol.net/graphics/reb-tail.jpg" border=0></td></tr> <td align="center"> <span class="tail"><a href="http://www.rebol.com">MakeDoc2 by REBOL</a> - $date</span> </td></tr></table> </body></html> } ;-- HTML Emit Utility Functions: out: make string! 10000 emit: func [data /line] [ ; Primary emit function: insert insert tail out reduce data newline ] wsp: charset " ^-^/" ; whitespace: sp, tab, return emit-end-tag: func [tag] [ ; Emit an end tag from a tag. tag: copy/part tag any [find tag wsp tail tag] insert tag #"/" emit tag ] emit-tag: func [text tag start end] [ ; Used to emit special one-sided tags: while [text: find text tag] [ remove/part text length? tag text: insert text start text: insert any [find text end-char tail text] end ] ] end-char: charset [" " ")" "]" "." "," "^/"] escape-html: func [text][ ; Convert to avoid special HTML chars: foreach [from to] html-codes [replace/all text from to] text ] html-codes: ["&" "&amp;" "<" "&lt;" ">" "&gt;"] emit-lines: func [text] [ ; Emit separate lines in normal font: replace/all text newline <br> emit text ] ;-- HTML Document Formatting Functions: fix-tags: func [text] [ if old-tags [ emit-tag text "<c>" "<tt>" "</tt>" emit-tag text "<w>" "<b><tt>" "</tt></b>" emit-tag text "<s>" "<b><i>" "</i></b>" ] text ] emit-para: func [text] [ ; Emit standard text paragraph: emit [<p> fix-tags text </p>] ] emit-code: func [doc] [ emit <pre> while [ switch doc/1 [ code [emit [escape-html doc/2]] output [emit [<span class="output"> escape-html doc/2 </span>]] ] ][doc: skip doc 2] emit </pre> doc: skip doc -2 ] emit-image: func [spec /local tag] [ ; Emit image. Spec = 'center or default is 'left. emit [ either spec/2 = 'center [<p align="center">][<p>] join {<img src="} [(join image-path spec/1) {">}] </p> ] ] buls: [bullet bullet2 bullet3] enums: [enum enum2 enum3] bul-stack: [] push-bul: func [bul][ if any [empty? bul-stack bul <> last bul-stack][ ;print ['push bul mold bul-stack] append bul-stack bul emit pick [<ul><ol>] found? find buls bul ] ] pop-bul: func [bul /local here][ here: any [find buls bul find enums bul] while [ all [ not empty? bul-stack bul <> last bul-stack any [ not here ; not bullet or enum find next here last bul-stack all [here: find bul-stack bul not tail? here] ] ] ][ ;print ['pop bul mold bul-stack] emit pick [</ul></ol>] found? find buls last bul-stack remove back tail bul-stack ] ] emit-item: func [doc item /local tag][ push-bul item emit [<li> fix-tags doc/2 </li>] pop-bul doc/3 ] emit-def: func [doc] [ ; Emit indented definitions table. Start and end it as necessary. if doc/-2 <> 'define [ emit {<table cellspacing="6" border="0" width="95%">} ] emit [ <tr><td width="20"> "&nbsp;" </td> <td valign="top" width="80"> <b> any [doc/2/1 "&nbsp;"] </b></td> <td valign="top"> fix-tags any [doc/2/2 " "] </td> </tr> ] if doc/3 <> 'define [emit {</table>}] ] emit-note: func [text] [ ; Start a note sidebar, centered on page: emit [<p><fieldset class="fset"><legend> fix-tags text </legend>] ] emit-note-end: does [ ; End a note sidebar. emit </fieldset></p> ] in-table: in-header: false emit-table: does [ in-table: true in-header: true emit {<table border="0" cellspacing="1" cellpadding="4" bgcolor="#505050"> <tr bgcolor="silver"><td><b>} ] emit-table-end: does [ in-table: false emit "</td></tr></table>" ] emit-table-cell: does [ emit pick [{</b></td><td><b>} {</td><td valign="top" bgcolor="white">}] in-header ] emit-table-row: does [ in-header: false emit {</td></tr><tr><td valign="top" bgcolor="white">} ] ;-- Section handling: clear-sects: does [sects: 0.0.0.0] next-section: func [level /local bump mask] [ ; Return next section number. Clear sub numbers. set [bump mask] pick [ [1.0.0.0 1.0.0.0] [0.1.0.0 1.1.0.0] [0.0.1.0 1.1.1.0] [0.0.0.1 1.1.1.1] ] level level: form sects: sects + bump * mask clear find level ".0" level ] make-heading: func [level num str /toc /local lnk][ ; Make a proper heading link or TOC target. ; Determine link target str. Search for [target] in front of heading. either parse str [ "[" copy lnk to "]" s: to end ][ str: next s ; remove link target ][ lnk: join "section-" num ] if not no-nums [str: rejoin [num pick [". " " "] level = 1 str]] rejoin either toc [ [{<a class="toc} level {" href="#} lnk {">} str </a>] ][ [{<h} level + 1 { id="} lnk {">} str {</h} level + 1 {>}] ] ] emit-sect: func [level str /local sn] [ ; Unindent prior level: if all [not no-indent level <= 2 sects/1 > 0] [emit </blockquote>] sn: next-section level emit make-heading level sn str if all [not no-indent level <= 2] [emit <blockquote>] ] emit-toc: func [doc /local w sn] [ ; Output table of contents: emit [<h2> "Contents:" </h2>] foreach [word str] doc [ if w: find [sect1 sect2 sect3 sect4] word [ w: index? w if w <= toc-levels [ sn: next-section w emit [make-heading/toc w sn str <br>] ] ] ] ] emit-boiler: func [doc /local title info temp] [ ; Output top boiler plate: title: any [ select doc 'title select doc 'sect1 "Untitled" ] emit [<h1> title </h1>] foreach [word val] doc [ if word = 'code [ emit {<blockquote><b>} emit-lines val emit {</b></blockquote>} remove/part find doc 'code 2 break ] if not find [title template options] word [break] ] title ] ] do-makedoc: has [in-view? file msg doc] [ in-view?: all [value? 'view? view?] ; Are we using View? ; Get the file name from the script argument: file: system/script/args if any-string? file [file: to-file file] ; makes copy too ; If no file provided, should we do the last file again? if all [ not file exists? %last-file.tmp ][ file: load %last-file.tmp either confirm reform ["Reprocess" file "?"] [ system/script/args: none ][ file: none ] ] ; If no file still, then ask the user for the file name: if not file [ either in-view? [ file: request-file/only ][ file: ask "Filename? " file: all [not empty? trim file to-file file] ] ] ; No file provided: if not file [exit] ; File must exist: if not exists? file [ msg: reform ["Error:" file "does not exist"] either in-view? [alert msg] [ask msg] exit ] ; Save this as the last file processed: save %last-file.tmp file ; Process the file. Returns [title doc] doc: second gen-html scan-doc read file ; Create output file name: append clear find/last file #"." ".html" write file doc if all [in-view? not system/script/args] [browse file] file ; return new file (entire path) ] ; Start process (but caller may request it only be loaded): if system/script/args <> 'load-only [do-makedoc]
{% \thispagestyle{empty}% \small% \vfill% \pdfbookmark[chapter]{Colophon}{colophon}% \section*{Colophon} % \noindent This thesis has been typeset using \LaTeX{} in the Palatino font. \noindent This thesis has been typeset using \LaTeX{}, and compiled using \texttt{pdflatex}. Minion Pro is used as both the text and display typeface. The sans-serif text uses the \textsf{Myriad Pro} typeface, whereas monospaced text is typeset in \texttt{Bitstream Vera Mono}. Line figures and illustrations were predominantly generated using the \href{https://ctan.org/pkg/pgf?lang=en}{Tikz} \LaTeX{} package, \acrshort{fem} data plots using \href{https://www.tecplot.com/}{Tecplot}, and renders using \href{https://www.blender.org/}{Blender}. \mbox{}\vspace{0.5pc}\\ \noindent Several books have influenced the style, typography, and graphic design of this thesis, in particular: \begin{itemize} \item[] Edward Tufte's \textit{Beautiful Evidence} (2006) \item[] Jean-Luc Doumont's \textit{Trees, Maps, and Theorems} (2009) \item[] Robert Bringhurst's \textit{Elements of Typography} (1992) \end{itemize} \vspace{0.75pc}% \mbox{}\\ \noindent\textit{Very Long }\\ \textit{thesis title}\vspace{0.25pc}\\ Author, September 2018 \vspace{1.25pc}\\ \noindent \textcopyright\ Massachusetts Institute of Technology 2018. All rights reserved.\vspace{1pc} \\ }
State Before: α : Type u ι : Sort v t : ι → TopologicalSpace α s : Set α ⊢ IsClosed s ↔ ∀ (i : ι), IsClosed s State After: no goals Tactic: simp [← @isOpen_compl_iff _ (⨆ i, t i), ← @isOpen_compl_iff _ (t _), isOpen_iSup_iff]
US Air Force logs documenting activity at the airport obtained by the Associated Press largely disprove the claim that the US held up aid in favor of military flights . The US military initially did give priority to military units needed to secure the airport , distribute aid , and provide security , but after that , incoming relief flights were cleared or rejected on a first @-@ come , first @-@ served basis . According to a US Air Force Captain who had coordinated flight schedules , nearly all groups sending aid insisted their shipment was urgent . Those flights that were rejected were diverted to the Dominican Republic , where their cargoes were unloaded and taken to Haiti by land .
subsection\<open>ROBDDs and Formulas\<close> theory ROBDD_PPS_Formulas imports "ROBDD.Level_Collapse" "Propositional_Proof_Systems.Sema" begin primrec frm_to_bdd where "frm_to_bdd \<bottom> s = fci s" | "frm_to_bdd (Atom a) s = litci a s" | "frm_to_bdd (Not F) s = do { (n,s) \<leftarrow> frm_to_bdd F s; notci n s }" | "frm_to_bdd (And F G) s = do { (f,s) \<leftarrow> frm_to_bdd F s; (g,s) \<leftarrow> frm_to_bdd G s; andci f g s }" | "frm_to_bdd (Or F G) s = do { (f,s) \<leftarrow> frm_to_bdd F s; (g,s) \<leftarrow> frm_to_bdd G s; orci f g s }" | "frm_to_bdd (Imp F G) s = do { (f,s) \<leftarrow> frm_to_bdd F s; (n,s) \<leftarrow> notci f s; (g,s) \<leftarrow> frm_to_bdd G s; orci n g s }" lemma frm_to_bdd_sep[sep_heap_rules]: " <bdd_relator R s> frm_to_bdd F s <\<lambda>(r,s'). bdd_relator (insert (\<lambda>\<A>. \<A> \<Turnstile> F, r) R) s'>\<^sub>t" by(induction F arbitrary: R s; sep_auto simp add: fun_eq_iff bf_lit_def) theorem "<emp> do { s \<leftarrow> emptyci; (f,s) \<leftarrow> frm_to_bdd F s; tautci f s } <\<lambda>r. \<up>(r \<longleftrightarrow> \<Turnstile> F)>\<^sub>t" by(sep_auto simp add: fun_eq_iff) end
module Group_property import Monoid import Group import congruence %access public export ||| Property 1 - Identity is unique for groups total Group_property_1 : (grp : Type) -> ((*) : grp -> grp -> grp) -> (IsGroup grp (*)) -> (e1 : grp) -> (e2 :grp) -> (IsIdentity grp (*) e1) -> (IsIdentity grp (*) e2) -> (e1 = e2) Group_property_1 grp (*) pf_grp e1 e2 pf1 pf2 = trans (sym(snd (pf2 e1))) (fst (pf1 e2)) ||| Property 2 - Inverse of an element is unique total Group_property_2 : (grp : Type) -> ((*) : grp -> grp -> grp) -> (pfgrp : IsGroup grp (*)) -> (a : grp) -> (b : grp) -> (c : grp) -> (IsInverse grp (*) (fst(snd pfgrp)) a b) -> (IsInverse grp (*) (fst(snd pfgrp)) a c) -> (b = c) Group_property_2 grp (*) pfgrp a b c pfb pfc = let pfAss = fst pfgrp pfid = (fst (snd pfgrp)) in rewrite (sym (fst ((snd pfid) b))) in (rewrite (sym (fst pfc)) in (rewrite (sym (pfAss b a c)) in (rewrite (snd pfb) in (rewrite (snd ((snd pfid) c)) in Refl)))) ||| Property 3 - b = c implies a*b = a*c total Group_property_3 : (grp : Type) -> ((*) : grp -> grp -> grp) -> (pfgrp : IsGroup grp (*)) -> (a : grp) -> (b : grp) -> (c : grp) -> (b = c) -> (a*b = a*c) Group_property_3 grp (*) pfgrp a b c pfEq = cong pfEq ||| Property 4 - a*b = a*c implies b = c total Group_property_4 : (grp : Type) -> ((*) : grp -> grp -> grp) -> (pfgrp : IsGroup grp (*)) -> (a : grp) -> (b : grp) -> (c : grp) -> (a*b = a*c) -> (b = c) Group_property_4 grp (*) pfgrp a b c pfEq = let pfid = (fst (snd (snd pfgrp))) a_inv = fst(Inv_with_pf grp (*) pfgrp a) pf_inv = snd(Inv_with_pf grp (*) pfgrp a) pfAss = fst pfgrp in (rewrite (sym (snd ((snd pfid) b))) in (rewrite (sym (snd ((snd pfid) c))) in (rewrite (sym (snd pf_inv)) in (rewrite (pfAss a_inv a b) in (rewrite (pfAss a_inv a c) in (Group_property_3 grp (*) pfgrp a_inv (a*b) (a*c) pfEq)))))) ||| Property 5 - b = c implies b*a = c*a total Group_property_5 : (grp : Type) -> ((*) : grp -> grp -> grp) -> (pfgrp : IsGroup grp (*)) -> (a : grp) -> (b : grp) -> (c : grp) -> (b = c) -> ( (b*a) = (c*a) ) Group_property_5 grp (*) pfgrp a b c pfEq = (congruence grp grp b c (\x : grp => x*a) pfEq) ||| Property 6 - b*a = c*a implies b = c total Group_property_6 : (grp : Type) -> ((*) : grp -> grp -> grp) -> (pfgrp : IsGroup grp (*)) -> (a : grp) -> (b : grp) -> (c : grp) -> (b*a = c*a) -> (b = c) Group_property_6 grp (*) pfgrp a b c pfEq = let pfid = (fst (snd (snd pfgrp))) a_inv = fst(Inv_with_pf grp (*) pfgrp a) pf_inv = snd(Inv_with_pf grp (*) pfgrp a) pfAss = fst pfgrp in (rewrite (sym (fst ((snd pfid) b))) in (rewrite (sym (fst ((snd pfid) c))) in (rewrite (sym (fst pf_inv)) in (rewrite (sym (pfAss b a a_inv)) in (rewrite (sym (pfAss c a a_inv)) in (Group_property_5 grp (*) pfgrp a_inv (b*a) (c*a) pfEq)))))) ||| Auxilliary proof 1 - Two idenitities mentioned in the definition of the group ||| (one in (fst (snd pfgrp)) another in (fst (snd (snd pfgrp))) are equal. total Group_aux_pf_1 : (grp : Type) -> ((*) : grp -> grp -> grp) -> (pfgrp : (IsGroup grp (*))) -> ( (fst (Group_id grp (*) pfgrp)) = (fst (fst (snd (snd pfgrp)))) ) Group_aux_pf_1 grp (*) pfgrp = let pfid1 = (Group_id grp (*) pfgrp) e1 = (fst pfid1) pf1 = (snd pfid1) pfid2 = (fst (snd (snd pfgrp))) e2 = (fst pfid2) pf2 = (snd pfid2) in (Group_property_1 grp (*) pfgrp e1 e2 pf1 pf2) ||| Property 7 - One sided inverse is two sided inverse total Group_property_7 : (grp : Type) -> ((*) : grp -> grp -> grp) -> (pfgrp : (IsGroup grp (*))) -> (a : grp) -> (b : grp) -> ( (a*b) = (fst (Group_id grp (*) pfgrp)) ) -> (IsInverse grp (*) (Group_id grp (*) pfgrp) a b) Group_property_7 grp (*) pfgrp a b pfEq = let pfid1 = Group_id grp (*) pfgrp -- Identity in IdentityExists pfid2 = fst (snd (snd pfgrp)) -- Identity in InverseExists e1 = (fst pfid1) e2 = (fst pfid2) a_inv = Inv grp (*) pfgrp a a_inv_pf = snd (Inv_with_pf grp (*) pfgrp a) a_inv_pf1 = (fst a_inv_pf) -- Proof that a*a_inv = e2 a_inv_pf2 = (snd a_inv_pf) -- Proof that a_inv*a = e2 pfId_eq = Group_aux_pf_1 grp (*) pfgrp -- proof that e1 = e2 pf1 = trans a_inv_pf1 (sym pfId_eq) -- proof that a*a_inv = e1 pf2 = trans pf1 (sym pfEq) -- proof that a*a_inv = a*b pf3 = Group_property_4 grp (*) pfgrp a a_inv b pf2 -- proof that a_inv b pf4 = trans a_inv_pf2 (sym pfId_eq) -- proof that a_inv*a = e1 pf5 = Group_property_5 grp (*) pfgrp a a_inv b pf3 -- proof that a_inv*a = b*a pf6 = trans (sym pf5) pf4 in (pfEq, pf6)
(** Semántica y Verificación Ejemplo 5 Manuel Soto Romero Luis F. Benítez Lluis Contenido: 1 Definiciones de listas polimórficas 2 Pares Polimórficos 2.1 La función split 3 Opcioes polimórficos 3.1 Función head para listas polimóficas 4 La táctica discriminate 5 Manejo de la hipótesis inductiva 6 Desdoblando definiciones 7 Resumen de téctias (extracto citado del libro) Para acceder rápidamente a la sección deseada buscar la cadena ">n" donde "n" es el número de sección. Material basado en los scripts correspondientes al libro Logical Foundations en Software Foundations- Benjamin C. Pierce, et al. *) Require Import Coq.Arith.PeanoNat. Require Import Bool.Bool. (** >1 Definiciones de listas polimórficas*) Inductive list (X:Type) : Type := | nil | cons (x : X) (l : list X). Arguments nil {X}. Arguments cons {X} _ _. Fixpoint app {X : Type} (l1 l2 : list X) : (list X) := match l1 with | nil => l2 | cons h t => cons h (app t l2) end. Fixpoint rev {X:Type} (l:list X) : list X := match l with | nil => nil | cons h t => app (rev t) (cons h nil) end. Fixpoint length {X : Type} (l : list X) : nat := match l with | nil => 0 | cons _ l' => S (length l') end. Notation "x :: y" := (cons x y) (at level 60, right associativity). Notation "[ ]" := nil. Notation "[ x ; .. ; y ]" := (cons x .. (cons y []) ..). Notation "x ++ y" := (app x y) (at level 60, right associativity). (** >2 Pares Polimórficos *) (* Generalizemos la noción de par *) Inductive prod (X Y : Type) : Type := | pair (x : X) (y : Y). (* Definimos lor argumentos implicitos *) Arguments pair {X} {Y} _ _. (* Definomos la notación usual de par *) Notation "( x , y )" := (pair x y). (* Podemos usar también notación para el producto de tipos*) Notation "X * Y" := (prod X Y) : type_scope. (* La anotación [: type_scope] le dice a Coq que la anotación de tipos sólo aplica en el parsing de tipos, más no para expresiones. Gracias a esta restricción evitamos conflicto con la notación de multiplicación. *) (* Es importante hacer hincapié en que (x,y) representa la notación de expresiones que representan parejas ordenadas y que X*Y representan el producto de tipos. Si x:X y y:Y entonces (x,y):X*Y*) Definition fst {X Y : Type} (p : X * Y) : X := match p with | (x, y) => x end. Definition snd {X Y : Type} (p : X * Y) : Y := match p with | (x, y) => y end. (*Función que combina dos listas en parejas de entradas de cada lista respectivamente *) (* [1,2,3], [4,5,6]=> [(1,4),(2,5),(3,6)]*) Fixpoint combine {X Y : Type} (lx : list X) (ly : list Y) : list (X*Y):= match lx,ly with | [], _ => [] | _, [] => [] | x::tx, y ::ty => (x,y):: (combine tx ty) end. Example test_combine: combine [1;2;3] [4;5;6]=[(1,4);(2,5);(3,6)]. Proof. simpl. reflexivity. Qed. (** >2.1 La función split*) (* La función [split] es la inversa derecha de [combine], desdoblando listas de parejas en una pareja de listas con los elementos respectivos.*) (* [(1,4);(2,5);(3,6)] (1,4) ([2;3],[5;6]) *) Fixpoint split {X Y : Type} (l : list (X*Y)) : (list X) * (list Y):= match l with | [] => ([],[]) | h::t => ((fst h)::fst (split t), (snd h)::snd(split t)) end. Example test_split: split [(1,false);(2,false)] = ([1;2],[false;false]). Proof. reflexivity. Qed. (** >3 Opcioes polimórficos *) (* Hagamos la definición en un módulo pues coq ya posee el tipo opción que buscamos*) Module OptionPlayground. Inductive option (X:Type) : Type := | Some (x : X) | None. Arguments Some {X} _. Arguments None {X}. End OptionPlayground. (* Recordemos que nth-error es una función que devuelve el n-ésimo elemento de una lista. Dado que se puede elegir n ue supere la longitud de la lista, es conveniente que devolvamos un tipo opción para ajustar para este error. *) Fixpoint nth_error {X : Type} (l : list X) (n : nat) : option X := match l with | nil => None | a :: l' => match n with | O => Some a | S n' => nth_error l' n' end end. Example test_nth_error1 : nth_error [4;5;6;7] 0 = Some 4. Proof. reflexivity. Qed. Example test_nth_error2 : nth_error [[1];[2]] 1 = Some [2]. Proof. reflexivity. Qed. Example test_nth_error3 : nth_error [true] 2 = None. Proof. reflexivity. Qed. (** >3.1 Función head para listas polimóficas *) Definition hd_error {X : Type} (l : list X) : option X:= match l with | [] => None | h::t=> Some h end. Check @hd_error : forall X : Type, list X -> option X. Example test_hd_error1 : hd_error [1;2] = Some 1. Proof. reflexivity. Qed. Example test_hd_error2 : hd_error [[1];[2]] = Some [1]. Proof. reflexivity. Qed. (** >4 La táctica discriminate*) (* La táctica [discriminate] sirve para detectar hipótesis inválidas sobre igualdadades. Para que la táctica funcione, es inminente que los términos sean sintácticamente distintos. Por ejemplo cuando se tiene iguadad entre un sucesor y cero [S n = O]. *) Theorem eqb_0_l : forall n, 0 =? n = true -> n = 0. Proof. intros. destruct n. - simpl in H. reflexivity. - simpl in H. discriminate H. Qed. (* El razonamiento lógico a esta solución sigue el principio de explosión que afirma que de cosas falsas se sigue lo que sea. En este caso la falsedad se encarna como igualdades insatisfacibles. *) Theorem discriminate_ex1 : forall (n : nat), S n = O -> 2 + 2 = 5. Proof. intros. discriminate H. Qed. Theorem discriminate_ex2 : forall (n m : nat), false = true -> [n] = [m]. Proof. intros. discriminate H. Qed. Example discriminate_ex3 : forall (X : Type) (x y z : X) (l j : list X), x :: y :: l = [] -> x = z. Proof. intros. discriminate H. Qed. Example inversion_ex : forall (n:nat), S n <=0-> 2+2=5. Proof. intros. inversion H. Qed. (** >5 Manejo de la hipótesis inductiva *) Fixpoint double (n:nat) := match n with | O => O | S n' => S (S (double n')) end. Theorem double_injective_FAILED : forall n m, double n = double m -> n = m. Proof. intros n m. induction n as [| n' IHn']. - (* n = O *) simpl. intros eq. destruct m as [| m'] eqn:E. + (* m = O *) reflexivity. + (* m = S m' *) discriminate eq. - (* n = S n' *) intros eq. destruct m as [| m'] eqn:E. + (* m = O *) discriminate eq. + (* m = S m' *) apply f_equal. Abort. Theorem double_injective : forall n m, double n = double m -> n = m. Proof. intro. induction n. - intros. destruct m. -- reflexivity. -- discriminate H. - intros. destruct m. -- discriminate H. -- apply f_equal. apply IHn. inversion H. reflexivity. Qed. (* intros n. induction n as [| n' IHn']. - (* n = O *) simpl. intros m eq. destruct m as [| m'] eqn:E. + (* m = O *) reflexivity. + (* m = S m' *) discriminate eq. - (* n = S n' *) simpl. intros m eq. destruct m as [| m'] eqn:E. + (* m = O *) discriminate eq. + (* m = S m' *) apply f_equal. apply IHn'. simpl in eq. injection eq as goal. apply goal. Qed. *) (* intro. induction n. - intros. destruct m. -- reflexivity. -- simpl in H. discriminate H. - intros. simpl in H. destruct m. -- simpl in H. discriminate H. -- simpl in H. apply f_equal. apply IHn. injection H. intro. assumption. (* inversion H. reflexivity. *) Qed. *) Theorem eqb_true : forall n m, n =? m = true -> n = m. Proof. intro. induction n. - destruct m. -- intros. reflexivity. -- intros. discriminate H. - destruct m. -- intros. discriminate H. -- intros. apply f_equal. apply IHn. simpl in H. assumption. Qed. (* Hint: usar [plus_n_Sm] *) Check plus_n_Sm. Theorem plus_n_n_injective : forall n m, n + n = m + m -> n = m. Proof. intro. induction n. - intros. simpl in H. destruct m. -- reflexivity. -- simpl in H. discriminate H. - intros. destruct m. -- discriminate H. -- apply f_equal. apply IHn. simpl in H. inversion H. rewrite <-plus_n_Sm in H1. rewrite <-plus_n_Sm in H1. inversion H1. reflexivity. Qed. (* A veces hay que reorganizar las variables para que al generalizar las pruebas salgas adecuadamente*) Theorem double_injective_take2_FAILED : forall n m, double n = double m -> n = m. Proof. intros n m. induction m as [| m' IHm']. - (* m = O *) simpl. intros eq. destruct n as [| n'] eqn:E. + (* n = O *) reflexivity. + (* n = S n' *) discriminate eq. - (* m = S m' *) intros eq. destruct n as [| n'] eqn:E. + (* n = O *) discriminate eq. + (* n = S n' *) apply f_equal. Abort. Theorem double_injective_take2 : forall m n, double n = double m -> n = m. Proof. intros. generalize dependent m. induction n. - intros. destruct m. -- reflexivity. -- discriminate H. - intros. destruct m. -- discriminate H. -- apply f_equal. apply IHn. inversion H. reflexivity. Qed. (* intros n m. generalize dependent n. induction m as [| m' IHm']. - (* m = O *) simpl. intros n eq. destruct n as [| n'] eqn:E. + (* n = O *) reflexivity. + (* n = S n' *) discriminate eq. - (* m = S m' *) intros n eq. destruct n as [| n'] eqn:E. + (* n = O *) discriminate eq. + (* n = S n' *) apply f_equal. apply IHm'. injection eq as goal. apply goal. Qed. *) (* Probemos por inducción sobre l*) Theorem nth_error_after_last: forall (n : nat) (X : Type) (l : list X), length l = n -> nth_error l n = None. Proof. Admitted. (** >6 Desdoblando definiciones *) Require Import Coq.Arith.PeanoNat. Definition square n := n * n. Lemma square_mult : forall n m, square (n * m) = square n * square m. Proof. intros. unfold square. rewrite Nat.mul_assoc. assert (H : n * m * n = n * n * m). { rewrite Nat.mul_comm. apply Nat.mul_assoc. } rewrite H. rewrite Nat.mul_assoc. reflexivity. Qed. (* Algunas tácticas como [apply][simpl] y [reflexivity] simplifican términos cuando se usan, y particularmente desdoblan definiciones de algunas funciones. Por lo que en algunos casos no hace falta desdoblar las deficniciones pues se hace automáticamente *) Definition foo (x: nat) := 5. Fact silly_fact_1 : forall m, foo m + 1 = foo (m + 1) + 1. Proof. intros m. simpl. reflexivity. Qed. (* No obstante, este desdoblamiento no siempre se ejecuta sobretodo si la expresión es algo compleja. *) Definition bar x := match x with | O => 5 | S _ => 5 end. Fact silly_fact_2_FAILED : forall m, bar m + 1 = bar (m + 1) + 1. Proof. intros m. simpl. Abort. (* [simpl] no siempre logra progreso pues la cláusula match impide que se simplifique a su última expresión, ya que la entrada no se puede catalogar en la búsqueda de patrones. Es hasta que se desestructura la entrad que se puede resolver el match y simplificar la expresión*) Fact silly_fact_2 : forall m, bar m + 1 = bar (m + 1) + 1. Proof. intros m. destruct m eqn:E. - simpl. reflexivity. - simpl. reflexivity. Qed. (* Esto funciona pero si alguna parte de la expresión no se puede detectar para caza de patrones puede que requiramos más desestructuración. Otra forma es literalmente desdoblando la definición.*) Fact silly_fact_2' : forall m, bar m + 1 = bar (m + 1) + 1. Proof. Admitted. (* intros m. unfold bar. destruct m eqn:E. - reflexivity. - reflexivity. Qed. *) (** >7 Resumen de téctias (extracto citado del libro) *) (* - [intros]: move hypotheses/variables from goal to context - [reflexivity]: finish the proof (when the goal looks like [e = e]) - [apply]: prove goal using a hypothesis, lemma, or constructor - [apply... in H]: apply a hypothesis, lemma, or constructor to a hypothesis in the context (forward reasoning) - [apply... with...]: explicitly specify values for variables that cannot be determined by pattern matching - [simpl]: simplify computations in the goal - [simpl in H]: ... or a hypothesis - [rewrite]: use an equality hypothesis (or lemma) to rewrite the goal - [rewrite ... in H]: ... or a hypothesis - [symmetry]: changes a goal of the form [t=u] into [u=t] - [symmetry in H]: changes a hypothesis of the form [t=u] into [u=t] - [transitivity y]: prove a goal [x=z] by proving two new subgoals, [x=y] and [y=z] - [unfold]: replace a defined constant by its right-hand side in the goal - [unfold... in H]: ... or a hypothesis - [destruct... as...]: case analysis on values of inductively defined types - [destruct... eqn:...]: specify the name of an equation to be added to the context, recording the result of the case analysis - [induction... as...]: induction on values of inductively defined types - [injection]: reason by injectivity on equalities between values of inductively defined types - [discriminate]: reason by disjointness of constructors on equalities between values of inductively defined types - [assert (H: e)] (or [assert (e) as H]): introduce a "local lemma" [e] and call it [H] - [generalize dependent x]: move the variable [x] (and anything else that depends on it) from the context back to an explicit hypothesis in the goal formula - [f_equal]: change a goal of the form [f x = f y] into [x = y] *)
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE Strict #-} {-# LANGUAGE FlexibleContexts #-} module CPVO.IO.DOS ( showTotPDOS ) where import CPVO.Numeric import CPVO.IO import CPVO.IO.Reader.Ecalj.Common import CPVO.IO.Reader.Ecalj.DOS import qualified Data.Text as T import qualified Data.Text.IO as T import Data.List import Numeric.LinearAlgebra showTotPDOS :: [String] -> IO () showTotPDOS allArgs = do -- (invStat, ymax, xmin, xmax, ctrlAtoms, uniqAtoms, ctrlAtomicAOs,jdTable, cleanedJdHead, foldernya, tailer, colAlign, texFile) <- readHeaderData allArgs Right (invStat, _ , _ , _ , _ , _ , ctrlAtomicAOs,jdTable, cleanedJdHead, foldernya, tailer, _ , texFile) <- readHeaderData allArgs -------------------------------generating DOS data------------------------ totalDOS <- readTotalDOSText tailer foldernya -------------------------------integrating DOS data------------------------ let intgTot = map (\i -> integrateToZero $ totalDOS ¿ [0,i]) $ flipBy invStat [1,2] pdosAtomic <- readPDOS invStat tailer foldernya ctrlAtomicAOs let integratedAtPDOS = integrateAtomicPDOS pdosAtomic putStrLn $ show integratedAtPDOS let rIntgAll' = rendertable $ (:) cleanedJdHead $ nub $ (:) (concat [ ["Total"] , map (showDouble (2::Integer)) $ (\[a,b] -> [a,b,a-b,a+b]) $ intgTot ]) $ map (\(iu,idn,(_,(j,_))) -> j:map (showDouble (2::Integer)) [iu,idn,iu-idn,iu+idn] ) integratedAtPDOS let rIntgAll = unlines [ rIntgAll' , jdTable ] putStrLn rIntgAll {- -------------------------------generating LaTex Representation------------------------ resIntAll' <- markdownToTex rIntgAll let resIntAll = T.replace "\\}" "}" $ T.replace "\\{" "{" $ T.pack $ unlines [ "\\begin{longtable}[]{" ++ colAlign ++ "}" , unlines $ tail $ lines $ T.unpack resIntAll' ] -} T.writeFile texFile $ T.pack rIntgAll putStrLn "====done===="
(* Title: The Standard Redundancy Criterion Author: Jasmin Blanchette <j.c.blanchette at vu.nl>, 2014, 2017 Author: Dmitriy Traytel <traytel at inf.ethz.ch>, 2014 Author: Anders Schlichtkrull <andschl at dtu.dk>, 2017 Maintainer: Anders Schlichtkrull <andschl at dtu.dk> *) section \<open>The Standard Redundancy Criterion\<close> theory Standard_Redundancy imports Proving_Process begin text \<open> This material is based on Section 4.2.2 (``The Standard Redundancy Criterion'') of Bachmair and Ganzinger's chapter. \<close> locale standard_redundancy_criterion = inference_system \<Gamma> for \<Gamma> :: "('a :: wellorder) inference set" begin (* FIXME: Make a definition *) abbreviation redundant_infer :: "'a clause set \<Rightarrow> 'a inference \<Rightarrow> bool" where "redundant_infer N \<gamma> \<equiv> \<exists>DD. set_mset DD \<subseteq> N \<and> (\<forall>I. I \<Turnstile>m DD + side_prems_of \<gamma> \<longrightarrow> I \<Turnstile> concl_of \<gamma>) \<and> (\<forall>D. D \<in># DD \<longrightarrow> D < main_prem_of \<gamma>)" definition Rf :: "'a clause set \<Rightarrow> 'a clause set" where "Rf N = {C. \<exists>DD. set_mset DD \<subseteq> N \<and> (\<forall>I. I \<Turnstile>m DD \<longrightarrow> I \<Turnstile> C) \<and> (\<forall>D. D \<in># DD \<longrightarrow> D < C)}" definition Ri :: "'a clause set \<Rightarrow> 'a inference set" where "Ri N = {\<gamma> \<in> \<Gamma>. redundant_infer N \<gamma>}" lemma tautology_redundant: assumes "Pos A \<in># C" assumes "Neg A \<in># C" shows "C \<in> Rf N" proof - have "set_mset {#} \<subseteq> N \<and> (\<forall>I. I \<Turnstile>m {#} \<longrightarrow> I \<Turnstile> C) \<and> (\<forall>D. D \<in># {#} \<longrightarrow> D < C)" using assms by auto then show "C \<in> Rf N" unfolding Rf_def by blast qed lemma contradiction_Rf: "{#} \<in> N \<Longrightarrow> Rf N = UNIV - {{#}}" unfolding Rf_def by force text \<open> The following results correspond to Lemma 4.5. The lemma \<open>wlog_non_Rf\<close> generalizes the core of the argument. \<close> lemma Rf_mono: "N \<subseteq> N' \<Longrightarrow> Rf N \<subseteq> Rf N'" unfolding Rf_def by auto lemma wlog_non_Rf: assumes ex: "\<exists>DD. set_mset DD \<subseteq> N \<and> (\<forall>I. I \<Turnstile>m DD + CC \<longrightarrow> I \<Turnstile> E) \<and> (\<forall>D'. D' \<in># DD \<longrightarrow> D' < D)" shows "\<exists>DD. set_mset DD \<subseteq> N - Rf N \<and> (\<forall>I. I \<Turnstile>m DD + CC \<longrightarrow> I \<Turnstile> E) \<and> (\<forall>D'. D' \<in># DD \<longrightarrow> D' < D)" proof - from ex obtain DD0 where dd0: "DD0 \<in> {DD. set_mset DD \<subseteq> N \<and> (\<forall>I. I \<Turnstile>m DD + CC \<longrightarrow> I \<Turnstile> E) \<and> (\<forall>D'. D' \<in># DD \<longrightarrow> D' < D)}" by blast have "\<exists>DD. set_mset DD \<subseteq> N \<and> (\<forall>I. I \<Turnstile>m DD + CC \<longrightarrow> I \<Turnstile> E) \<and> (\<forall>D'. D' \<in># DD \<longrightarrow> D' < D) \<and> (\<forall>DD'. set_mset DD' \<subseteq> N \<and> (\<forall>I. I \<Turnstile>m DD' + CC \<longrightarrow> I \<Turnstile> E) \<and> (\<forall>D'. D' \<in># DD' \<longrightarrow> D' < D) \<longrightarrow> DD \<le> DD')" using wf_eq_minimal[THEN iffD1, rule_format, OF wf_less_multiset dd0] unfolding not_le[symmetric] by blast then obtain DD where dd_subs_n: "set_mset DD \<subseteq> N" and ddcc_imp_e: "\<forall>I. I \<Turnstile>m DD + CC \<longrightarrow> I \<Turnstile> E" and dd_lt_d: "\<forall>D'. D' \<in># DD \<longrightarrow> D' < D" and d_min: "\<forall>DD'. set_mset DD' \<subseteq> N \<and> (\<forall>I. I \<Turnstile>m DD' + CC \<longrightarrow> I \<Turnstile> E) \<and> (\<forall>D'. D' \<in># DD' \<longrightarrow> D' < D) \<longrightarrow> DD \<le> DD'" by blast have "\<forall>Da. Da \<in># DD \<longrightarrow> Da \<notin> Rf N" proof clarify fix Da assume da_in_dd: "Da \<in># DD" and da_rf: "Da \<in> Rf N" from da_rf obtain DD' where dd'_subs_n: "set_mset DD' \<subseteq> N" and dd'_imp_da: "\<forall>I. I \<Turnstile>m DD' \<longrightarrow> I \<Turnstile> Da" and dd'_lt_da: "\<forall>D'. D' \<in># DD' \<longrightarrow> D' < Da" unfolding Rf_def by blast define DDa where "DDa = DD - {#Da#} + DD'" have "set_mset DDa \<subseteq> N" unfolding DDa_def using dd_subs_n dd'_subs_n by (meson contra_subsetD in_diffD subsetI union_iff) moreover have "\<forall>I. I \<Turnstile>m DDa + CC \<longrightarrow> I \<Turnstile> E" using dd'_imp_da ddcc_imp_e da_in_dd unfolding DDa_def true_cls_mset_def by (metis in_remove1_mset_neq union_iff) moreover have "\<forall>D'. D' \<in># DDa \<longrightarrow> D' < D" using dd_lt_d dd'_lt_da da_in_dd unfolding DDa_def by (metis insert_DiffM2 order.strict_trans union_iff) moreover have "DDa < DD" unfolding DDa_def by (meson da_in_dd dd'_lt_da mset_lt_single_right_iff single_subset_iff union_le_diff_plus) ultimately show False using d_min unfolding less_eq_multiset_def by (auto intro!: antisym) qed then show ?thesis using dd_subs_n ddcc_imp_e dd_lt_d by auto qed lemma Rf_imp_ex_non_Rf: assumes "C \<in> Rf N" shows "\<exists>CC. set_mset CC \<subseteq> N - Rf N \<and> (\<forall>I. I \<Turnstile>m CC \<longrightarrow> I \<Turnstile> C) \<and> (\<forall>C'. C' \<in># CC \<longrightarrow> C' < C)" using assms by (auto simp: Rf_def intro: wlog_non_Rf[of _ "{#}", simplified]) lemma Rf_subs_Rf_diff_Rf: "Rf N \<subseteq> Rf (N - Rf N)" proof fix C assume c_rf: "C \<in> Rf N" then obtain CC where cc_subs: "set_mset CC \<subseteq> N - Rf N" and cc_imp_c: "\<forall>I. I \<Turnstile>m CC \<longrightarrow> I \<Turnstile> C" and cc_lt_c: "\<forall>C'. C' \<in># CC \<longrightarrow> C' < C" using Rf_imp_ex_non_Rf by blast have "\<forall>D. D \<in># CC \<longrightarrow> D \<notin> Rf N" using cc_subs by (simp add: subset_iff) then have cc_nr: "\<And>C DD. C \<in># CC \<Longrightarrow> set_mset DD \<subseteq> N \<Longrightarrow> \<forall>I. I \<Turnstile>m DD \<longrightarrow> I \<Turnstile> C \<Longrightarrow> \<exists>D. D \<in># DD \<and> ~ D < C" unfolding Rf_def by auto metis have "set_mset CC \<subseteq> N" using cc_subs by auto then have "set_mset CC \<subseteq> N - {C. \<exists>DD. set_mset DD \<subseteq> N \<and> (\<forall>I. I \<Turnstile>m DD \<longrightarrow> I \<Turnstile> C) \<and> (\<forall>D. D \<in># DD \<longrightarrow> D < C)}" using cc_nr by auto then show "C \<in> Rf (N - Rf N)" using cc_imp_c cc_lt_c unfolding Rf_def by auto qed lemma Rf_eq_Rf_diff_Rf: "Rf N = Rf (N - Rf N)" by (metis Diff_subset Rf_mono Rf_subs_Rf_diff_Rf subset_antisym) text \<open> The following results correspond to Lemma 4.6. \<close> lemma Ri_mono: "N \<subseteq> N' \<Longrightarrow> Ri N \<subseteq> Ri N'" unfolding Ri_def by auto lemma Ri_subs_Ri_diff_Rf: "Ri N \<subseteq> Ri (N - Rf N)" proof fix \<gamma> assume \<gamma>_ri: "\<gamma> \<in> Ri N" then obtain CC D E where \<gamma>: "\<gamma> = Infer CC D E" by (cases \<gamma>) have cc: "CC = side_prems_of \<gamma>" and d: "D = main_prem_of \<gamma>" and e: "E = concl_of \<gamma>" unfolding \<gamma> by simp_all obtain DD where "set_mset DD \<subseteq> N" and "\<forall>I. I \<Turnstile>m DD + CC \<longrightarrow> I \<Turnstile> E" and "\<forall>C. C \<in># DD \<longrightarrow> C < D" using \<gamma>_ri unfolding Ri_def cc d e by blast then obtain DD' where "set_mset DD' \<subseteq> N - Rf N" and "\<forall>I. I \<Turnstile>m DD' + CC \<longrightarrow> I \<Turnstile> E" and "\<forall>D'. D' \<in># DD' \<longrightarrow> D' < D" using wlog_non_Rf by atomize_elim blast then show "\<gamma> \<in> Ri (N - Rf N)" using \<gamma>_ri unfolding Ri_def d cc e by blast qed lemma Ri_eq_Ri_diff_Rf: "Ri N = Ri (N - Rf N)" by (metis Diff_subset Ri_mono Ri_subs_Ri_diff_Rf subset_antisym) lemma Ri_subset_\<Gamma>: "Ri N \<subseteq> \<Gamma>" unfolding Ri_def by blast lemma Rf_indep: "N' \<subseteq> Rf N \<Longrightarrow> Rf N \<subseteq> Rf (N - N')" by (metis Diff_cancel Diff_eq_empty_iff Diff_mono Rf_eq_Rf_diff_Rf Rf_mono) lemma Ri_indep: "N' \<subseteq> Rf N \<Longrightarrow> Ri N \<subseteq> Ri (N - N')" by (metis Diff_mono Ri_eq_Ri_diff_Rf Ri_mono order_refl) lemma Rf_model: assumes "I \<Turnstile>s N - Rf N" shows "I \<Turnstile>s N" proof - have "I \<Turnstile>s Rf (N - Rf N)" unfolding true_clss_def by (subst Rf_def, simp add: true_cls_mset_def, metis assms subset_eq true_clss_def) then have "I \<Turnstile>s Rf N" using Rf_subs_Rf_diff_Rf true_clss_mono by blast then show ?thesis using assms by (metis Un_Diff_cancel true_clss_union) qed lemma Rf_sat: "satisfiable (N - Rf N) \<Longrightarrow> satisfiable N" by (metis Rf_model) text \<open> The following corresponds to Theorem 4.7: \<close> sublocale redundancy_criterion \<Gamma> Rf Ri by unfold_locales (rule Ri_subset_\<Gamma>, (elim Rf_mono Ri_mono Rf_indep Ri_indep Rf_sat)+) end locale standard_redundancy_criterion_reductive = standard_redundancy_criterion + reductive_inference_system begin text \<open> The following corresponds to Theorem 4.8: \<close> lemma Ri_effective: assumes in_\<gamma>: "\<gamma> \<in> \<Gamma>" and concl_of_in_n_un_rf_n: "concl_of \<gamma> \<in> N \<union> Rf N" shows "\<gamma> \<in> Ri N" proof - obtain CC D E where \<gamma>: "\<gamma> = Infer CC D E" by (cases \<gamma>) then have cc: "CC = side_prems_of \<gamma>" and d: "D = main_prem_of \<gamma>" and e: "E = concl_of \<gamma>" unfolding \<gamma> by simp_all note e_in_n_un_rf_n = concl_of_in_n_un_rf_n[folded e] { assume "E \<in> N" moreover have "E < D" using \<Gamma>_reductive e d in_\<gamma> by auto ultimately have "set_mset {#E#} \<subseteq> N" and "\<forall>I. I \<Turnstile>m {#E#} + CC \<longrightarrow> I \<Turnstile> E" and "\<forall>D'. D' \<in># {#E#} \<longrightarrow> D' < D" by simp_all then have "redundant_infer N \<gamma>" using cc d e by blast } moreover { assume "E \<in> Rf N" then obtain DD where dd_sset: "set_mset DD \<subseteq> N" and dd_imp_e: "\<forall>I. I \<Turnstile>m DD \<longrightarrow> I \<Turnstile> E" and dd_lt_e: "\<forall>C'. C' \<in># DD \<longrightarrow> C' < E" unfolding Rf_def by blast from dd_lt_e have "\<forall>Da. Da \<in># DD \<longrightarrow> Da < D" using d e in_\<gamma> \<Gamma>_reductive less_trans by blast then have "redundant_infer N \<gamma>" using dd_sset dd_imp_e cc d e by blast } ultimately show "\<gamma> \<in> Ri N" using in_\<gamma> e_in_n_un_rf_n unfolding Ri_def by blast qed sublocale effective_redundancy_criterion \<Gamma> Rf Ri unfolding effective_redundancy_criterion_def by (intro conjI redundancy_criterion_axioms, unfold_locales, rule Ri_effective) lemma contradiction_Rf: "{#} \<in> N \<Longrightarrow> Ri N = \<Gamma>" unfolding Ri_def using \<Gamma>_reductive le_multiset_empty_right by (force intro: exI[of _ "{#{#}#}"] le_multiset_empty_left) end locale standard_redundancy_criterion_counterex_reducing = standard_redundancy_criterion + counterex_reducing_inference_system begin text \<open> The following result corresponds to Theorem 4.9. \<close> lemma saturated_upto_complete_if: assumes satur: "saturated_upto N" and unsat: "\<not> satisfiable N" shows "{#} \<in> N" proof (rule ccontr) assume ec_ni_n: "{#} \<notin> N" define M where "M = N - Rf N" have ec_ni_m: "{#} \<notin> M" unfolding M_def using ec_ni_n by fast have "I_of M \<Turnstile>s M" proof (rule ccontr) assume "\<not> I_of M \<Turnstile>s M" then obtain D where d_in_m: "D \<in> M" and d_cex: "\<not> I_of M \<Turnstile> D" and d_min: "\<And>C. C \<in> M \<Longrightarrow> C < D \<Longrightarrow> I_of M \<Turnstile> C" using ex_min_counterex by meson then obtain \<gamma> CC E where \<gamma>: "\<gamma> = Infer CC D E" and cc_subs_m: "set_mset CC \<subseteq> M" and cc_true: "I_of M \<Turnstile>m CC" and \<gamma>_in: "\<gamma> \<in> \<Gamma>" and e_cex: "\<not> I_of M \<Turnstile> E" and e_lt_d: "E < D" using \<Gamma>_counterex_reducing[OF ec_ni_m] not_less by metis have cc: "CC = side_prems_of \<gamma>" and d: "D = main_prem_of \<gamma>" and e: "E = concl_of \<gamma>" unfolding \<gamma> by simp_all have "\<gamma> \<in> Ri N" by (rule subsetD[OF satur[unfolded saturated_upto_def inferences_from_def infer_from_def]]) (simp add: \<gamma>_in d_in_m cc_subs_m cc[symmetric] d[symmetric] M_def[symmetric]) then have "\<gamma> \<in> Ri M" unfolding M_def using Ri_indep by fast then obtain DD where dd_subs_m: "set_mset DD \<subseteq> M" and dd_cc_imp_d: "\<forall>I. I \<Turnstile>m DD + CC \<longrightarrow> I \<Turnstile> E" and dd_lt_d: "\<forall>C. C \<in># DD \<longrightarrow> C < D" unfolding Ri_def cc d e by blast from dd_subs_m dd_lt_d have "I_of M \<Turnstile>m DD" using d_min unfolding true_cls_mset_def by (metis contra_subsetD) then have "I_of M \<Turnstile> E" using dd_cc_imp_d cc_true by auto then show False using e_cex by auto qed then have "I_of M \<Turnstile>s N" using M_def Rf_model by blast then show False using unsat by blast qed theorem saturated_upto_complete: assumes "saturated_upto N" shows "\<not> satisfiable N \<longleftrightarrow> {#} \<in> N" using assms saturated_upto_complete_if true_clss_def by auto end end
Require Import List. Export ListNotations. Require Import PeanoNat. Require Import Ensembles. Require Import K_Syntax. Require Import K_GHC. Require Import K_logics. Lemma extens_diff_sKH : forall (p : V), sKH_prv (Singleton _ (# p), Box (# p)). Proof. intro p. apply sNec with (ps:=[(Singleton _ (# p), #p)]). intros. inversion H. subst. apply Ids. apply IdRule_I. apply In_singleton. inversion H0. apply sNecRule_I. Qed. Theorem sKH_extens_wKH : forall s, (wKH_prv s) -> (sKH_prv s). Proof. intros s D. induction D. (* Id *) - inversion H. subst. apply Ids. apply IdRule_I. auto. (* Ax *) - inversion H. subst. apply Axs. apply AxRule_I. auto. (* MP *) - inversion H1. subst. assert (J1: List.In (Γ, A --> B) [(Γ, A --> B); (Γ, A)]). apply in_eq. pose (H0 (Γ, A --> B) J1). assert (J2: List.In (Γ, A) [(Γ, A --> B); (Γ, A)]). apply in_cons. apply in_eq. pose (H0 (Γ, A) J2). apply MPs with (ps:=[(Γ, A --> B); (Γ, A)]). intros. inversion H2. subst. auto. inversion H3. subst. auto. inversion H4. apply MPRule_I. (* wNec *) - inversion H1. subst. assert (J1: List.In (Empty_set MPropF, A) [(Empty_set MPropF, A)]). apply in_eq. pose (H0 (Empty_set MPropF, A) J1). assert (Included _ (Empty_set _) Γ). intro. intro. inversion H2. pose (@sKH_monot (Empty_set _, A) s Γ H2). apply sNec with (ps:=[(Γ, A)]). intros. inversion H3. subst. assumption. inversion H4. apply sNecRule_I. Qed. Theorem sKH_same_thms_wKH : forall s, (sKH_prv s) -> (forall A, ((Empty_set _, A) = s) -> (wKH_prv s)). Proof. intros s D. induction D. (* Ids *) - intros A id. inversion H. subst. inversion H2. subst. apply Id. apply IdRule_I. auto. (* Axs *) - intros A id. inversion H. subst. inversion H2. subst. apply Ax. apply AxRule_I. auto. (* MPs *) - intros A id. inversion H1. subst. inversion H3. subst. assert (J1: List.In (Empty_set MPropF, A0 --> A) [(Empty_set MPropF, A0 --> A); (Empty_set MPropF, A0)]). apply in_eq. pose (H0 (Empty_set MPropF, A0 --> A) J1). assert (J2: List.In (Empty_set MPropF, A0) [(Empty_set MPropF, A0 --> A); (Empty_set MPropF, A0)]). apply in_cons. apply in_eq. pose (H0 (Empty_set MPropF, A0) J2). apply MP with (ps:=[(Empty_set _, A0 --> A); (Empty_set _, A0)]). intros. inversion H2. subst. apply w with (A1:=A0 --> A). auto. inversion H4. subst. apply w0 with (A:=A0). auto. inversion H5. apply MPRule_I. (* sNec *) - intros A id. inversion H1. subst. inversion H3. subst. assert (J1: List.In (Empty_set MPropF, A0) [(Empty_set MPropF, A0)]). apply in_eq. pose (H0 (Empty_set MPropF, A0) J1). apply wNec with (ps:=[(Empty_set _, A0)]). intros. inversion H2. subst. apply w with (A:=A0). auto. inversion H4. apply wNecRule_I. Qed. Theorem wKH_same_thms_sKH : forall s, (wKH_prv s) -> (forall A, ((Empty_set _, A) = s) -> (sKH_prv s)). Proof. intros. apply sKH_extens_wKH. assumption. Qed. Theorem wKH_sKH_same_thms : forall A, wKH_prv (Empty_set _, A) <-> sKH_prv (Empty_set _, A). Proof. intros. split ; intro. apply wKH_same_thms_sKH with (A:=A) ; auto. apply sKH_same_thms_wKH with (A:=A) ; auto. Qed.
function euler_m = dcm2euler_m(DCMnb_m) % dcm2euler_m: transforms a nav-to-body DCM matrix to an Euler angles matrix. % % INPUT % DCMnb_m: Nx9 matrix with nav-to-body direct cosine matrices (DCM). % Each row of DCMnb_m contains the 9 elements of a particular DCMnb % matrix ordered as [a11 a21 a31 a12 a22 a32 a13 a23 a33]. % % OUTPUT % euler_m: Nx3 Euler angles ordered by column, [roll pitch yaw] (rad, rad, rad). % % Copyright (C) 2014, Rodrigo Gonzalez, all rights reserved. % % This file is part of NaveGo, an open-source MATLAB toolbox for % simulation of integrated navigation systems. % % NaveGo is free software: you can redistribute it and/or modify % it under the terms of the GNU Lesser General Public License (LGPL) % version 3 as published by the Free Software Foundation. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU Lesser General Public License for more details. % % You should have received a copy of the GNU Lesser General Public % License along with this program. If not, see % <http://www.gnu.org/licenses/>. % % References: % Titterton, D.H. and Weston, J.L. (2004). Strapdown % Inertial Navigation Technology (2nd Ed.). Institution % of Engineering and Technology, USA. Eq. 11.4. Eq. 3.66, p. 46. % % R. Gonzalez, J. Giribet, and H.D. Patiño,. An approach to % benchmarking of loosely coupled low-cost navigation systems, % Mathematical and Computer Modelling of Dynamical Systems, vol. 21, % issue 2, pp. 272-287. Eq. 15. % % Version: 001 % Date: 2020/12/17 % Author: Rodrigo Gonzalez <[email protected]> % URL: https://github.com/rodralez/navego [N,~] = size (DCMnb_m); euler_m = zeros(N,3); for i=1:N DCMnb = reshape(DCMnb_m (i,:), 3, 3); DCMbn = DCMnb'; % nav-to-body > body-to-nav euler_m (i,:) = dcm2euler(DCMbn); % phi theta psi end end
#define BOOST_TEST_MODULE "shiguredo::mp4::time test" #include <boost/test/included/unit_test.hpp>
(** * Theory of Sets EIV Structures Copyright INRIA (2009-2013 2108) Apics; Marelle Team (Jose Grimm). *) (* $Id: sset18.v,v 1.8 2018/09/04 07:58:00 grimm Exp $ *) From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat. From gaia Require Export sset10. Set Implicit Arguments. Unset Strict Implicit. Unset Printing Implicit Defensive. (** Example of a group structure *) Module StructureAux. Definition slistp f := fgraph f /\ natp (domain f). Definition slength f := domain f. Definition slistpl f n := slistp f /\ slength f = n. Lemma slist_domain X: slistp X -> domain X = Nint (slength X). Proof. by move => [_ nN]; rewrite /slength (NintE nN). Qed. Lemma slength_nat X: slistp X -> natp (slength X). Proof. by move => [_ nN]. Qed. Lemma slist_domainP X: slistp X -> forall i, (inc i (domain X) <-> i <c (slength X)). Proof. by move=> [_ h] i; apply: iff_sym;apply/(NltP h). Qed. Definition slist_E f E := slistp f /\ sub (range f) E. Definition Vl l x := Vg l (cpred x). Lemma Vl_correct l i: cardinalp i -> Vg l i = Vl l (csucc i). Proof. by move => ic;rewrite /Vl cpred_pr1. Qed. Lemma slist_extent f g : slistp f -> slistp g -> slength f = slength g -> (forall i, \1c <=c i -> i <=c slength f -> (Vl f i = Vl g i)) -> f = g. Proof. move => fl gl eq1 sv. have sd: domain f = domain g by rewrite (slist_domain fl) (slist_domain gl) eq1. have dp:= (slist_domainP fl). have nN:= (slength_nat fl). move: fl gl => [ha _] [ha' _]. apply:fgraph_exten => // i /dp id. have ic:=(proj31_1 id). rewrite (Vl_correct f ic) (Vl_correct g ic). apply: sv; first by rewrite - succ_zero; apply: cleSS; apply:cle0x. by apply /(cleSlt0P ic). Qed. Lemma Vl_p1 f E x : slist_E f E -> \1c <=c x -> x <=c (slength f) -> inc (Vl f x) E. Proof. move => [ha hb] hc hd; move: (ha) => [he _]. apply: hb; apply/(range_gP he). have nN:= (slength_nat ha). case: (equal_or_not x \0c) => xz; first by move: (cltNge clt_01); rewrite - xz. move: (cpred_pr (NS_le_nat hd nN) xz) => [sa sb]. exists (cpred x) => //; apply /(slist_domainP ha). by apply/(cleSlt0P (CS_nat sa) nN); rewrite - sb. Qed. (** Extension of mappings *) Lemma cpred_pr6' k i: natp k -> \1c <=c i -> i <=c k -> [/\ natp (cpred i), i = csucc (cpred i) & cpred i <c k ]. Proof. move => sa sb sc. have w:= clt_01. have knz: k <> \0c by move => kz; move:(cleT sb sc); rewrite kz; apply:cltNge. move: (cpred_pr sa knz) =>[ka kb]; move: sc;rewrite kb => sc. move: (cpred_pr6 ka sb sc) => [pa pb /(cltSleP ka) pc]; split => //. Qed. End StructureAux. Export StructureAux. Module StructureExample. Section Preparation. Definition Law s E := [/\ sub s ((E \times E) \times E), fgraph s & domain s = (E \times E)]. Definition VL s a b := Vg s (J a b). Lemma Law_in s E a b: Law s E -> inc a E -> inc b E -> inc (J (J a b) (VL s a b)) s. Proof. by move => [ha hb hc] aE bE; apply: (fdomain_pr1 hb); rewrite hc; apply:setXp_i. Qed. Lemma Law_range s E a b: Law s E -> inc a E -> inc b E -> inc (VL s a b) E. Proof. move => [ha hb hc] aE bE; rewrite /VL. have pdf: inc (J a b) (domain s) by rewrite hc; apply:setXp_i. by move: (inc_V_range hb pdf) => /funI_P [z /ha /setX_P [ _ _ qb] ->]. Qed. Lemma Law_val s E a b c: Law s E -> inc (J (J a b) c) s -> c = (VL s a b). Proof. by move => [ha hb hc] hd; move: (pr2_V hb hd); aw. Qed. Definition GE_I E := Zo (E\times E) (fun z => P z = Q z). Definition GE_J E := Zo (((E\times E) \times E)\times (E\times (E\times E))) (fun x => [/\ P (P (P x)) = P (Q x), Q (P (P x)) = P (Q (Q x)) & Q (P x) = Q (Q (Q x))]). Lemma GE_I_incP E x: inc x (GE_I E) <-> [/\ pairp x, P x = Q x & inc (P x) E]. Proof. split. by move =>/Zo_P [/setX_P [ha hb hc] hd]; split. by move => [pa pb pc]; apply:Zo_i => //; apply: setX_i => //; rewrite - pb. Qed. Lemma GE_I_fgraph E : fgraph (GE_I E). Proof. split; first by move => x /GE_I_incP []. move => x y /GE_I_incP [ha hb hc] /GE_I_incP [ha' hb' hc'] sp. by rewrite - ha -ha' -hb -hb' sp. Qed. Lemma GE_I_domain E : domain (GE_I E) = E. Proof. apply: extensionality => x. by move /funI_P => [z / GE_I_incP [_ _ h] ->]. move=> xe;apply/funI_P; exists (J x x); aw;trivial; apply/GE_I_incP; aw. split => //; apply: pair_is_pair. Qed. Lemma GE_I_range E : range (GE_I E) = E. Proof. apply: extensionality => x. by move /funI_P => [z / GE_I_incP [_ <- h] ->]. move=> xe;apply/funI_P; exists (J x x); aw; trivial;apply/GE_I_incP; aw. split => //; apply: pair_is_pair. Qed. Lemma GE_I_Ev E x: inc x E -> Vg (GE_I E) x = x. Proof. move => xE. have : inc (J x x) (GE_I E) by apply/GE_I_incP; saw; fprops. by move/(pr2_V (GE_I_fgraph E)); aw. Qed. Lemma GE_J_P E x: inc x (GE_J E) <-> exists a b c, [/\ inc a E, inc b E, inc c E & x = (J (J (J a b) c) (J a (J b c)))]. Proof. split. move /Zo_P => [/setX_P]. move => [h1 /setX_P[h2 /setX_P[h3 h4 h5] h6] /setX_P[h7 h8 /setX_P[h9 _ _]]]. move => [ra rb rc]. exists (P (P (P x))), (Q (P (P x))), (Q (P x)); split => //. by rewrite h3 h2 ra rb rc h9 h7 h1. move=> [a [b [c [ sa sb sc ->]]] ]; apply /Zo_P; split; aw => //. by apply:setXp_i; apply: setXp_i => //; apply: setXp_i. Qed. Lemma GE_J_fgraph E : fgraph (GE_J E). Proof. split; first by move => x /GE_J_P [a [b [c [_ _ _ ->]]]]; fprops. move => x y /GE_J_P [a [b [c [_ _ _ ->]]]]/GE_J_P [a' [b' [c' [_ _ _ ->]]]]. by aw => ea;rewrite (pr2_def ea) (pr1_def (pr1_def ea)) (pr2_def (pr1_def ea)). Qed. Lemma GE_J_domain E : domain (GE_J E) = (E\times E) \times E. Proof. apply: extensionality => x. move /funI_P => [z /GE_J_P [a [b [c [ha hb hc eq]]]] ->]. by rewrite eq pr1_pair; apply: setXp_i => //; apply: setXp_i. move=> /setX_P [pa /setX_P[pb pc pd] pe]; apply/funI_P. exists (J x (J (P (P x)) (J (Q (P x)) (Q x)))); aw; trivial. by rewrite - {1} pa - {1} pb; apply/GE_J_P; exists (P (P x)), (Q (P x)), (Q x). Qed. Lemma GE_J_range E : range (GE_J E) = (E\times (E\times E)). Proof. apply: extensionality => x. move /funI_P => [z /GE_J_P [a [b [c [ha hb hc eq]]]] ->]. by rewrite eq pr2_pair; apply: setXp_i => //; apply: setXp_i. move=> /setX_P [pa pe /setX_P[pb pc pd]]; apply/funI_P. exists (J (J (J (P x) (P (Q x))) (Q (Q x))) x); aw; trivial. by rewrite - {4} pa - {3} pb;apply/GE_J_P; exists (P x),(P (Q x)), (Q (Q x)). Qed. Lemma GE_J_Ev E a b c: inc a E -> inc b E -> inc c E -> Vg (GE_J E) (J (J a b) c) = (J a (J b c)). Proof. move => aE bE cE. have: inc (J (J (J a b) c) (J a (J b c))) (GE_J E). by apply/GE_J_P; exists a,b,c. by move /(pr2_V(GE_J_fgraph E)); aw. Qed. Definition Sprod A B := Zo (((domain A) \times (domain B)) \times (range A \times (range B))) (fun z => inc (J (P (P z)) (P (Q z))) A /\ inc (J (Q (P z)) (Q (Q z))) B). Lemma Sprod_P A B x: inc x (Sprod A B) <-> exists a1 b1 a2 b2, [/\ inc (J a1 a2) A, inc (J b1 b2) B & x = J (J a1 b1) (J a2 b2)]. Proof. split. move => /Zo_P. set a := P (P x); set b := P (Q x); set c := Q (P x); set d := Q (Q x). move => [h1 [h2 h3]]; exists a,c,b,d; split => //. move/setX_P: h1 => [r1 /setX_P[r2 _ _] /setX_P [r3 _ _]]. by rewrite - r1 -r2 - r3. move => [a1 [a2 [b1 [b2 [ha hb ->]]]]]. apply:Zo_i; last by aw. apply: setXp_i; apply:setXp_i; apply/funI_P. - by exists (J a1 b1); aw. - by exists (J a2 b2); aw. - by exists (J a1 b1); aw. - by exists (J a2 b2); aw. Qed. Lemma Sprod_Il E B x: inc x (Sprod (GE_I E) B) <-> [/\ pairp x, pairp (P x), pairp (Q x), P (P x) = P (Q x) & inc (P (P x)) E /\ inc (J (Q (P x)) (Q (Q x))) B]. Proof. split. move/Sprod_P => [a1 [a2 [b1 [b2 [r1 r2 ->]]]]]. move/GE_I_incP: r1; aw; move => [_ r3 r4];split; fprops. move=> [h1 h2 h3 h4 [h5 h6]]; rewrite -h1 - h2 - h3; apply /Sprod_P. exists (P (P x)), (Q (P x)), (P (Q x)), (Q (Q x)); split => //. apply/GE_I_incP; split; aww. Qed. Lemma Sprod_Ir A E x: inc x (Sprod A (GE_I E)) <-> [/\ pairp x, pairp (P x), pairp (Q x), Q (P x) = Q (Q x) & inc (Q (P x)) E /\ inc (J (P (P x)) (P (Q x))) A]. Proof. split. move/Sprod_P => [a1 [a2 [b1 [b2 [r1 r2 ->]]]]]. move/GE_I_incP: r2; aw; move => [_ r3 r4];split; fprops. move=> [h1 h2 h3 h4 [h5 h6]]; rewrite -h1 - h2 - h3; apply/Sprod_P. exists (P (P x)), (Q (P x)), (P (Q x)), (Q (Q x)); split => //. apply/GE_I_incP; split; aww. Qed. Lemma Sprod_fgraph A B: fgraph A -> fgraph B -> fgraph (Sprod A B). Proof. move => [ha hb] [hc hd]; split. by move => x /Sprod_P [a [b [c [d [_ _ ->]]]]]; fprops. move => x y / Sprod_P[a [b [c [d [pa pb ->]]]]] /Sprod_P [a' [b' [c' [d' [pc pd ->]]]]]. aw => eq1; rewrite - eq1. move: (hb _ _ pa pc); aw => ea; rewrite - (pr2_def (ea (pr1_def eq1))). by move: (hd _ _ pb pd); aw => eb; rewrite - (pr2_def (eb (pr2_def eq1))). Qed. Lemma Sprod_domain A B: sgraph A -> sgraph B -> (domain (Sprod A B)) = ((domain A) \times (domain B)). Proof. move => ga gb. apply: extensionality. move => x /funI_P [z /Sprod_P [a [b [c [d [ha hb hc]]]]] ->]. by rewrite hc pr1_pair; apply: setXp_i; apply /funI_P; ex_tac; aw. move => x /setX_P [pp /funI_P[ a hb hc] /funI_P [b he hf]]. apply/funI_P; exists (J x (J (Q a) (Q b))); aw; trivial. rewrite - pp hc hf; apply /Sprod_P. exists (P a), (P b), (Q a), (Q b); split => //. - by rewrite (ga _ hb). - by rewrite (gb _ he). Qed. Lemma Sprod_range A B: sgraph A -> sgraph B -> (range (Sprod A B)) = ((range A) \times (range B)). Proof. move => ga gb. apply: extensionality. move => x /funI_P [z /Sprod_P [a [b [c [d [ha hb hc]]]]] ->]. by rewrite hc pr2_pair; apply: setXp_i; apply /funI_P; ex_tac; aw. move => x /setX_P [pp /funI_P[ a hb hc] /funI_P [b he hf]]. apply/funI_P; exists (J (J (P a) (P b)) x); aw; trivial. rewrite - pp hc hf; apply/Sprod_P. exists (P a), (P b), (Q a), (Q b); split => //. - by rewrite (ga _ hb). - by rewrite (gb _ he). Qed. Lemma Sprod_case1 s E x (f := s \cg (Sprod s (GE_I E))): sub s ((E \times E) \times E) -> (inc x f <-> exists a b c d t, [/\ x = J (J (J a b) c) d, inc (J (J t c) d) s & inc (J (J a b) t) s]). Proof. move => sp. split. move/compg_P => [pa [y ya yb]]. move /Sprod_Ir: ya;aw; move => [_ pb yc yd [ye yf]]. have ppc: pairp (P (P x)) by move:(sp _ yf) => /setXp_P [/setX_P []]. exists (P (P (P x))), (Q (P (P x))), (Q (P x)), (Q x), (P y). by rewrite ppc pb pa yd yc. move => [a [b [c [d [t [ha hb hc]]]]]]. have px: pairp x by rewrite ha;fprops. have ra: inc (J (J t c) (Q x)) s by rewrite ha; aw. have cE: inc c E by move:(sp _ ra) => /setXp_P [/setX_P []]; aw. apply/compg_P; split => //; exists (J t c) => //. apply/Sprod_Ir; rewrite ha;aw; split;fprops. Qed. Lemma Sprod_case_l1 s E x (f := s \cg (Sprod s (GE_I E))): Law s E -> (inc x f <-> exists a b c, [/\ inc a E, inc b E, inc c E & x = J (J (J a b) c) (VL s (VL s a b) c) ]). Proof. move => ll; move: (ll)=> [sE _ _]. split. move /(Sprod_case1 _ sE) => [a [b [c [d [t [ha hb hc]]]]]]. exists a,b,c. move: (sE _ hc) => /setXp_P [/setXp_P [aE bE]] _. move: (sE _ hb) => /setXp_P [ /setXp_P [tE cE] dE]. by split => //; rewrite ha (Law_val ll hb) (Law_val ll hc). move => [a [b [c [aE bE cE ->]]]]. apply/(Sprod_case1 _ sE). exists a,b,c, (VL s (VL s a b) c), (VL s a b); split => //. apply: (Law_in ll (Law_range ll aE bE) cE). apply: (Law_in ll aE bE). Qed. Lemma Sprod_case2 s E : Law s E -> s \cg (Sprod s (GE_I E)) = fun_image ((E\times E) \times E) (fun z=> J z (VL s (VL s (P (P z)) (Q (P z))) (Q z))). Proof. move => h. apply:extensionality => x. move /(Sprod_case_l1 _ h) => [a [b [c [aE bE cE]]] ->]. apply/funI_P; exists (J (J a b) c); aw;trivial. by apply:setXp_i => //; apply:setXp_i. move => /funI_P [z /setX_P[pz /setX_P [ppz ha hb] hc] ->]. apply/(Sprod_case_l1 _ h); exists (P (P z)), (Q (P z)), (Q z). by rewrite ppz pz. Qed. Lemma Sprod_case3 s E x (f := s \cg (Sprod (GE_I E) s)): sub s ((E \times E) \times E) -> (inc x f <-> exists a b c d t, [/\ x = J (J a (J b c)) d, inc (J (J a t) d) s & inc (J (J b c) t) s]). Proof. move => sp;split. move/compg_P => [pa [y ya yb]]. move /Sprod_Il: ya;aw; move => [_ pb yc yd [ye yf]]. have ppc: pairp (Q (P x)) by move:(sp _ yf) => /setXp_P [/setX_P []]. exists (P (P x)), (P (Q (P x))), (Q (Q (P x))), (Q x), (Q y). by rewrite ppc pb pa yd yc. move => [a [b [c [d [t [ha hb hc]]]]]]. have px: pairp x by rewrite ha;fprops. have ra: inc (J (J a t) (Q x)) s by rewrite ha; aw. have aE: inc a E by move:(sp _ ra) => /setXp_P [/setX_P []]; aw. apply/compg_P; split => //; exists (J a t) => //. apply/Sprod_Il; rewrite ha;aw; split;fprops. Qed. Lemma Sprod_case4 s E x (f := (s \cg (Sprod (GE_I E) s)) \cg (GE_J E)): sub s ((E \times E) \times E) -> (inc x f <-> exists a b c d t, [/\ x = J (J (J a b) c) d, inc (J (J a t) d) s & inc (J (J b c) t) s]). Proof. move => h; split. move => /Zo_P [/setX_P [ha hb hc]] [y hd he]. move /GE_J_P: hd => [u [v [w [uE vE wE]]]] => eqa. move:(pr1_def eqa) (pr2_def eqa) => eqb eqc. move/(Sprod_case3 _ h): he => [a [b [c [d [t [eqd ra rb]]]]]]. move:(pr1_def eqd) (pr2_def eqd) => eqe eqf. rewrite eqe in eqc. have av:=(pr1_def eqc). have bv:=(pr1_def (pr2_def eqc)). have cv:=(pr2_def (pr2_def eqc)). by exists a,b,c,d,t; split => //; rewrite av bv cv - eqb - eqf ha. move => [a [b [c [d [t [xv ha hb]]]]]]. move/setXp_P:(h _ hb) => [/setXp_P [bE cE] tE]. move/setXp_P:(h _ ha) => [/setXp_P [aE _] dE]. have ra: inc (J (J a b) c) (domain (GE_J E)). by rewrite GE_J_domain; apply: setXp_i => //; apply:setXp_i. have rb: inc d (range (s \cg Sprod (GE_I E) s)). apply/funI_P; exists (J (J a (J b c)) d); aw;trivial. by apply/(Sprod_case3 _ h); exists a,b,c,d,t. have rc: inc x (domain (GE_J E) \times range (s \cg Sprod (GE_I E) s)). by rewrite xv;apply: setXp_i. apply:(Zo_i rc);exists (J a (J b c)). by rewrite xv; aw; apply /GE_J_P; exists a,b,c. apply/(Sprod_case3 _ h). by exists a,b,c,(Q x),t; split => //; rewrite xv;aw. Qed. Lemma Sprod_case_l2 s E x (f := (s \cg (Sprod (GE_I E) s)) \cg (GE_J E)): Law s E -> (inc x f <-> exists a b c, [/\ inc a E, inc b E, inc c E & x = J (J (J a b) c) (VL s a (VL s b c)) ]). Proof. move => ll; move: (ll)=> [sE _ _]. split. move /(Sprod_case4 _ sE) => [a [b [c [d [t [ha hb hc]]]]]]. exists a,b,c. move: (sE _ hc) => /setXp_P [ /setXp_P [bE cE ] tE]. move: (sE _ hb) => /setXp_P [ /setXp_P [ aE _] dE]. by split => //; rewrite ha (Law_val ll hb) (Law_val ll hc). move => [a [b [c [aE bE cE ->]]]]. apply/(Sprod_case4 _ sE). exists a,b,c, (VL s a (VL s b c)),(VL s b c); split => //. apply: (Law_in ll aE (Law_range ll bE cE)). apply: (Law_in ll bE cE). Qed. Lemma Bourbaki_assoc s E : Law s E -> ( (s \cg (Sprod s (GE_I E))) = ((s \cg (Sprod (GE_I E) s)) \cg (GE_J E)) <-> forall a b c, inc a E -> inc b E -> inc c E -> VL s a (VL s b c) = VL s (VL s a b) c). Proof. move => h; split. move => h1 a b c aE bE cE. have: inc (J (J (J a b) c) (VL s (VL s a b) c)) (s \cg Sprod s (GE_I E)). by apply/(Sprod_case_l1 _ h); exists a,b,c. rewrite h1;move/(Sprod_case_l2 _ h) =>[a' [b' [c' [_ _ _ ea]]]]. rewrite (pr2_def ea); move: (pr1_def ea) => eb. rewrite (pr2_def eb); move: (pr1_def eb) => ec. by rewrite (pr1_def ec) (pr2_def ec). move => h'; apply:extensionality => x. move/(Sprod_case_l1 _ h) => [a [b [c [aE bE cE ->]]]]. by rewrite - h' //; apply/(Sprod_case_l2 _ h); exists a,b,c. move/(Sprod_case_l2 _ h) => [a [b [c [aE bE cE ->]]]]. by rewrite h' //; apply/(Sprod_case_l1 _ h); exists a,b,c. Qed. End Preparation. Section GroupExample. Definition GT E s := inc s (\Po ((E\times E) \times E)). Definition GL E s := (forall a b, inc a E -> inc b E -> exists c, inc (J (J a b) c) s) /\ (forall a b, inc a s -> inc b s -> P a = P b -> a = b). Definition is_law E f := forall x y, inc x E -> inc y E -> inc (f x y) E. Definition Op E f := Lg (E\times E) (fun z => f (P z) (Q z)). Definition Opfun E f := Lf (fun z => (f (P z) (Q z))) (E \times E) E. Lemma GEl_prop1 E f: is_law E f -> function_prop (Opfun E f) (E\times E) E. Proof. rewrite /Opfun => Ho; saw; apply:lf_function => x /setX_P [pa pb pc]. by apply: Ho. Qed. Lemma GEl_prop2 E f: Op E f = graph (Opfun E f). Proof. by rewrite /Opfun /Lf; aw. Qed. Lemma GEl_prop3 E f: is_law E f -> GT E (Op E f). Proof. move => Ho; apply /setP_P => x /funI_P [z zp ->]; apply: setXp_i => //. by move/setX_P: zp => [ha hb hc]; apply:Ho. Qed. Lemma GEl_prop4 E f: is_law E f -> GL E (Op E f). Proof. move => H; split => a b ha hb. exists (f a b). have ->: (f a b) = f (P (J a b)) (Q (J a b)) by aw. rewrite /Op; apply: Lg_i; fprops. move/funI_P:ha => [z ze ->]. by move/funI_P:hb => [z' ze' ->]; aw => ->. Qed. Definition transport s g := fun_image s (fun x => J (J (Vf g (P (P x))) (Vf g (Q (P x)))) (Vf g (Q x))). Lemma transport_p1 E F s g: GT E s -> bijection_prop g E F -> GT F (transport s g). Proof. move => /setP_P sp [[[fg _] _] sg tg]. apply/setP_P => t /funI_P [z zs ->]. move/setX_P: (sp _ zs) => [pz /setX_P[pp pp1 pp2] qz]. apply:setXp_i; [ apply:setXp_i; Wtac | Wtac]. Qed. Lemma transport_p2 E s: GT E s -> (transport s (identity E)) = s. Proof. move => /setP_P sp. set_extens t. move/funI_P => [z zs ->]. move/setX_P: (sp _ zs) => [pz /setX_P[pp pp1 pp2] qz]. by rewrite ! idV // pp pz. move => ts; move/setX_P: (sp _ ts) => [pz /setX_P[pp pp1 pp2] qz]. by apply/funI_P; ex_tac; rewrite ! idV // pp pz. Qed. Lemma transport_p3 E F G s g h: GT E s -> bijection_prop g E F -> bijection_prop h F G-> transport (transport s g) h = transport s (h \co g). Proof. move => /setP_P sp [[[fg _] _] sg tg] [[[fh _] _] sh th]. have xop: h \coP g by split => //; ue. set_extens t. move/funI_P => [z /funI_P [u us ->] ->]; aw. move/setX_P: (sp _ us) => [pz /setX_P[pp pp1 pp2] qz]. apply/funI_P; ex_tac; rewrite !compfV //; ue. move => /funI_P [z zs ->]. move/setX_P: (sp _ zs) => [pz /setX_P[pp pp1 pp2] qz]. rewrite !compfV//; try ue; apply/funI_P. exists (J (J (Vf g (P (P z))) (Vf g (Q (P z)))) (Vf g (Q z))); aw; trivial. apply/funI_P; ex_tac. Qed. Definition transportable R:= forall E F s g, bijection_prop g E F -> GT E s -> (R E s <-> R F (transport s g)). Lemma transportable_GT: transportable GT. Proof. move => E F s g bg te; split => // _; apply:(transport_p1 te bg). Qed. Lemma transportable_GL: transportable GL. Proof. move => E F s g [[[fg gi] [_ gs]] sg tg] /setP_P sp. rewrite sg in gi gs; rewrite tg in gs. split; move =>[ha hb]; split. - move => a b aF bF; move: (gs a aF) (gs b bF) => [a' a'E av] [b' b'E bv]. move:(ha _ _ a'E b'E) => [c' h]. by exists (Vf g c'); apply/funI_P; ex_tac; aw; rewrite - av - bv. - move => a b /funI_P [u us ->] /funI_P [v vs ->]; aw => eq. move/setX_P: (sp _ us) => [pz /setX_P[pp pp1 pp2] qz]. move/setX_P: (sp _ vs) => [pz' /setX_P[pp' pp1' pp2'] qz']. move: (gi _ _ pp1 pp1' (pr1_def eq)) => eq1. move: (gi _ _ pp2 pp2' (pr2_def eq)) => eq2. have eq3: P u = P v by rewrite - pp - pp' eq1 eq2. by rewrite (hb _ _ us vs eq3). - move => a b aE bE. move: (Vf_target fg); rewrite sg tg => H. move: (ha _ _ (H _ aE) (H _ bE)) => [c /funI_P [z zs zv]]. exists (Q z). move/setX_P: (sp _ zs) => [pz /setX_P[pp pp1 pp2] qz]. rewrite (gi _ _ aE pp1 (pr1_def (pr1_def zv))). by rewrite (gi _ _ bE pp2 (pr2_def (pr1_def zv))) pp pz. - move => a b ias ibs spab. set u := (J (J (Vf g (P (P a))) (Vf g (Q (P a)))) (Vf g (Q a))). set v := (J (J (Vf g (P (P b))) (Vf g (Q (P b)))) (Vf g (Q b))). have r1: inc u (transport s g) by apply/funI_P; exists a. have r2: inc v (transport s g) by apply/funI_P; exists b. have puv: P u = P v by rewrite /u/v spab; aw. move:(hb _ _ r1 r2 puv); rewrite /u/v => /pr2_def eq. move/setX_P: (sp _ ias) => [pz /setX_P[pp pp1 pp2] qz]. move/setX_P: (sp _ ibs) => [pz' /setX_P[pp' pp1' pp2'] qz']. apply: pair_exten => //; apply:(gi _ _ qz qz' eq). Qed. Lemma GE_prop1 E s a: GT E s -> inc a s -> [/\ pairp a, pairp (P a), inc (P (P a)) E, inc (Q (P a)) E & inc (Q a) E]. Proof. move /setP_P => ha hb. by move: (ha _ hb) => /setX_P [ra /setX_P[rb rc rd] re]. Qed. Lemma GE_prop2 E s : GT E s -> GL E s -> Law s E. Proof. move => ti [r1a r1b]; split. - by apply /setP_P. - by split => //; move => a /(GE_prop1 ti) []. - apply: extensionality => x. move/funI_P => [z zs ->]; move: (GE_prop1 ti zs) => [_ h2 h3 h4 _]. by rewrite -h2;apply: setXp_i. move/setX_P => [ha hb hc]. apply/funI_P; move: (r1a _ _ hb hc) => [c]; rewrite ha => zz. by exists (J x c) => //; aw. Qed. Lemma GE_prop2_stable E s : GT E s -> GL E s -> forall a b, inc a E -> inc b E -> inc (VL s a b) E. Proof. move => ha hb; move: (GE_prop2 ha hb) => hc. move => a b aE bE. exact:(Law_range hc aE bE). Qed. Lemma GE_prop3 E s (f := VL s) : GT E s -> GL E s -> is_law E f /\ (Op E f) = s. Proof. move => type l1. have ll:= (GE_prop2 type l1). have ha: is_law E f by move => x y xE yE; apply: Law_range. split => //; apply: fgraph_exten. - rewrite/Op; fprops. - by case:ll. - case:ll => _ _ ->; rewrite /Op; aw; trivial. - by rewrite /Op /f /VL Lgd => x xp; rewrite LgV// (setX_pair xp). Qed. Lemma transport_op E F g s: bijection_prop g E F -> GT E s -> GL E s -> forall a b, inc a E -> inc b E -> Vf g (VL s a b) = VL (transport s g) (Vf g a) (Vf g b). Proof. move => bg te law a b aE bE. move:(GE_prop2 te law) => law1. move/(transportable_GT bg te): (te) => typF. move/(transportable_GL bg te): law => lawF. move:(GE_prop2 typF lawF) => law2. apply: (Law_val law2); apply/funI_P. exists (J (J a b) (VL s a b)); [ by apply:(Law_in law1) | by aw ]. Qed. Definition GA E s:= s \cg (Sprod s (GE_I E)) = (s \cg (Sprod (GE_I E) s)) \cg (GE_J E). Lemma GE_prop4 E s (f := VL s): GT E s -> GL E s -> (GA E s <-> forall a b c, inc a E -> inc b E -> inc c E -> f a (f b c) = f (f a b) c). Proof. move => ti la. exact: (Bourbaki_assoc (GE_prop2 ti la)). Qed. Lemma transportable_GA: transportable (fun E s => GL E s /\ GA E s). Proof. move => E F s g bg typ. have ra :=(transportable_GT bg typ). have rb :=(transportable_GL bg typ). move:(bg) => [[[fg gi] [_ gs]] sg tg]. rewrite sg in gi gs; rewrite tg in gs. move/ra:(typ) => typF. split; move => [ha hb]; move/rb: (ha) =>law2; split => //. move:(transport_op bg typ ha) => to. apply /(GE_prop4 typF law2) => a b c aF bF cF. move:(gs _ aF) (gs _ bF) (gs _ cF) => [a' aE av][b' bE bv][c' cE cv]. rewrite av bv cv. move:(GE_prop2_stable typ ha aE bE) => r1. move:(GE_prop2_stable typ ha bE cE) => r2. rewrite - (to _ _ bE cE) -(to _ _ aE bE). rewrite - (to _ _ aE r2) - (to _ _ r1 cE). by move/(GE_prop4 typ ha): hb => H; rewrite H. apply/(GE_prop4 typ law2) => a b c aE bE cE. move:(GE_prop2_stable typ law2 aE bE) => r1. move:(GE_prop2_stable typ law2 bE cE) => r2. move: (Vf_target fg); rewrite sg tg => H. move:(H _ aE) (H _ bE) (H _ cE) => aF bF cF. move /(GE_prop4 typF ha): hb => H'. move:(H' _ _ _ aF bF cF); clear H H'. move:(transport_op bg typ law2) => to. rewrite - (to _ _ bE cE) - (to _ _ aE r2) - (to _ _ aE bE) - (to _ _ r1 cE). by apply: gi; apply: (GE_prop2_stable typ law2). Qed. Definition GU E s:= exists2 z, inc z E & forall z', inc z' E -> inc (J (J z z') z') s /\ inc (J (J z' z) z') s. Definition unit E s e:= forall z, inc z E -> VL s e z = z /\ VL s z e = z. Definition un E s := select (unit E s) E. Lemma GE_prop5 E s : GT E s -> GL E s -> GU E s -> exists2 z, inc z E & unit E s z. Proof. move => type law [z ha hb]; exists z => // a aE. pose w := (GE_prop2 type law). move:(hb _ aE) => [r1 r2]. by rewrite /unit -(Law_val w r1) -(Law_val w r2). Qed. Lemma GE_prop6 E s z z': inc z E -> unit E s z -> inc z' E -> unit E s z' -> z = z'. Proof. by move => sa sb sc sd; rewrite - (proj1 (sb _ sc)) (proj2 (sd _ sa)). Qed. Lemma GE_prop7 E s : GT E s -> GL E s -> GU E s -> inc (un E s) E /\ unit E s (un E s). Proof. move => ha hb hc. by case:(select_pr (GE_prop5 ha hb hc) (@GE_prop6 E s)). Qed. Lemma GE_prop7_rev E s: GT E s -> GL E s -> forall x, inc x E -> unit E s x -> GU E s. Proof. move => typ law x xE ue. move: (GE_prop2 typ law) => ll. exists x => // z zE. move:(ue z zE) => [ha hb]; split. rewrite - {2} ha; apply: (Law_in ll xE zE). rewrite - {2} hb; apply: (Law_in ll zE xE). Qed. Lemma transport_unit E F g s x: bijection_prop g E F -> GT E s -> GL E s -> (inc x E /\ unit E s x) -> (inc (Vf g x) F /\ unit F (transport s g) (Vf g x)). Proof. move => Ha Hb Hc. have tsg:= (transport_op Ha Hb Hc). move:(Ha) => [[[fg gi] [_ gs]] sg tg]. rewrite sg in gi gs; rewrite tg in gs. move => [xE ux]; have yF: inc (Vf g x) F by Wtac. split => // z zF. move:(gs _ zF) => [z' zE ->]. by rewrite -(tsg _ _ xE zE)-(tsg _ _ zE xE); move: (ux _ zE) => [-> ->]. Qed. Lemma transport_un E F g s: bijection_prop g E F -> GT E s -> GL E s -> GU E s -> un F (transport s g) = Vf g (un E s). Proof. move => bg ha hb hd. move: (GE_prop7 ha hb hd) => up. move:(transport_unit bg ha hb up) => [sa sb]. symmetry; apply: select_uniq => // a b aF ua bF ub . apply: (GE_prop6 aF ua bF ub). Qed. Lemma transportable_unit: transportable (fun E s => (GL E s /\ GA E s) /\ GU E s). Proof. move => E F s g bg typ. move: (proj1 (transportable_GT bg typ) typ) => typF. have rc:= (transportable_GA bg typ). move:(bg) => [[[fg gi] [_ gs]] sg tg]. rewrite sg in gi gs; rewrite tg in gs. split; move => [ha hb]; move/rc:(ha) => ha'; split => //. move:(GE_prop7 typ (proj1 ha) hb) => ra. move: (transport_unit bg typ (proj1 ha) ra) => [rb1 rb2]. exact:(GE_prop7_rev typF (proj1 ha') rb1 rb2). have ll := proj1 ha'. move:(GE_prop7 typF (proj1 ha) hb); set u := un _ _; move => [uF uu]. move:(gs _ uF) => [v vE vv]. have tsg:= (transport_op bg typ ll). apply:(GE_prop7_rev typ ll vE) => z zE. have zF: inc (Vf g z) F by Wtac. move: (uu _ zF); rewrite vv - !tsg //. by move => [ea eb]; split; apply: gi => //; apply: (GE_prop2_stable typ ll). Qed. Definition GI E s := forall z z', inc z E -> inc z' E -> (exists2 z'', inc z'' E & inc (J (J z z'') z') s) /\ (exists2 z''', inc z''' E & inc (J (J z''' z) z') s). Definition left_inverse E s (x x': Set) := inc x' E /\ VL s x' x = un E s. Definition right_inverse E s (x x': Set) := inc x' E /\ VL s x x' = un E s. Definition inverse E s x := select (fun x' => VL s x' x = un E s) E. Lemma GE_prop8l E s: GT E s -> GL E s -> GU E s -> GI E s -> forall x, inc x E -> exists a, left_inverse E s x a. Proof. move => type law inv R4 x xE. move: (proj1(GE_prop7 type law inv)) => unp. move: (R4 _ _ xE unp) => [_ [z ha hb]]; exists z => //. by move: (Law_val (GE_prop2 type law) hb). Qed. Lemma GE_prop9 E s : GT E s -> GL E s -> GU E s -> GA E s -> GI E s -> forall x a b, inc x E -> left_inverse E s x a -> right_inverse E s x b -> a = b. Proof. move => pa pb pc ax pd. move: (GE_prop7 pa pb pc)=>[uE up] x a b xE [aE ai] [bE bi]. move/(GE_prop4 pa pb): ax => ac. by move: (ac _ _ _ aE xE bE); rewrite ai bi (proj2 (up _ aE)) (proj1 (up _ bE)). Qed. Lemma GE_prop10l E s: GT E s -> GL E s -> GU E s -> GA E s -> GI E s -> forall x a b, inc x E -> left_inverse E s x a -> left_inverse E s x b -> a = b. Proof. move => pa pb pc pd pe x a b xE ha hb. move:(pe _ _ xE (proj1 (GE_prop7 pa pb pc))) => [[c ha' hb'] _]. have ci: right_inverse E s x c. by split => //;move: (Law_val (GE_prop2 pa pb) hb'). rewrite (GE_prop9 pa pb pc pd pe xE ha ci). by rewrite -(GE_prop9 pa pb pc pd pe xE hb ci). Qed. Lemma GE_prop11l E s: GT E s -> GL E s -> GU E s -> GA E s -> GI E s -> forall x, inc x E -> left_inverse E s x (inverse E s x). Proof. move => pa pb pc pe pd x xE. set p := (fun x' => (VL s) x' x = un E s ). have ha: exists2 x', inc x' E & p x'. move:(GE_prop8l pa pb pc pd xE)=> [a [a1 a2]]; ex_tac. have hb: singl_val2 (inc^~ E) p. move => a b aE pra bE prb. exact:(GE_prop10l pa pb pc pe pd xE (conj aE pra) (conj bE prb)). by move:(select_pr ha hb)=> [hc hd]. Qed. Lemma GE_prop11r E s: GT E s -> GL E s -> GU E s -> GA E s -> GI E s -> forall x, inc x E -> right_inverse E s x (inverse E s x). Proof. move => pa pb pc pd pe x xE. move: (GE_prop11l pa pb pc pd pe xE) => ha. move: (pe _ _ xE (proj1 (GE_prop7 pa pb pc))) => [[c ha' hb'] _]. have ci: right_inverse E s x c. by split => //;move: (Law_val (GE_prop2 pa pb) hb'). by move:(GE_prop9 pa pb pc pd pe xE ha ci) => ->. Qed. Lemma GE_prop12l E s: GT E s -> GL E s -> GU E s -> GA E s -> GI E s -> forall x y, inc x E -> inc y E -> VL s x (VL s (inverse E s x) y) = y. Proof. move => pa pb pc pd pe x y xE yE. move: (GE_prop11r pa pb pc pd pe xE) => [ha hb]. move /(GE_prop4 pa pb): pd => asx. by rewrite (asx _ _ _ xE ha yE) hb (proj1(proj2 (GE_prop7 pa pb pc) _ yE)). Qed. Lemma GE_prop13a E s: GT E s -> GL E s -> GU E s -> GA E s -> (forall x, inc x E -> exists y, left_inverse E s x y /\ right_inverse E s x y) -> GI E s. Proof. move => ha hb hc hd hx a b aE bE. move: (hx _ aE) => [c [[cE cp] [_ dp]]]. have ll:= (GE_prop2 ha hb). have st := (GE_prop2_stable ha hb). move/ (GE_prop4 ha hb): hd => asc. move: (GE_prop7 ha hb hc) => [uE up]. move: (up b bE) => [ul ur]. move: (asc _ _ _ aE cE bE); rewrite dp ul => bv. move:(asc _ _ _ bE cE aE); rewrite cp ur => bv2. move: (st _ _ cE bE) (st _ _ bE cE) => dce bde. split. by exists(VL s c b) => //; rewrite - {2} bv; apply:(Law_in ll). by exists(VL s b c) => //; rewrite {2} bv2; apply:(Law_in ll). Qed. Lemma transport_inv E F g s x y: bijection_prop g E F -> GT E s -> GL E s -> GU E s -> inc x E -> left_inverse E s x y -> left_inverse F (transport s g) (Vf g x) (Vf g y). Proof. move => bg ha hb hc xE [yE xy]. move:(bg) => [[[fg gi] [_ gs]] sg tg]. rewrite sg in gi gs; rewrite tg in gs. have xF: inc (Vf g x) F by Wtac. have yF: inc (Vf g y) F by Wtac. split => //; rewrite(transport_un bg ha hb hc). by rewrite - (transport_op bg ha hb yE xE) xy. Qed. Lemma transport_inverse E F g s x: bijection_prop g E F -> GT E s -> GL E s -> GA E s -> GU E s -> GI E s -> inc x E -> Vf g (inverse E s x) = inverse F (transport s g) (Vf g x). Proof. move => bg ha hb hc hd he xE. move:(bg) => [[[fg gi] [_ gs]] sg tg]. rewrite sg in gi gs; rewrite tg in gs. move: (GE_prop11l ha hb hd hc he xE); set ix := inverse _ _ _. move => [pa pb]. have ixf: inc (Vf g ix) F by Wtac. have t1:= (transport_un bg ha hb hd). have ra: VL (transport s g) (Vf g ix) (Vf g x) = un F (transport s g). by rewrite t1 -(transport_op bg ha hb pa xE) pb. apply: select_uniq => // a b /= aF ap bF bp. move:(gs _ aF) (gs _ bF) => [u uE uv] [v vE vv]. have st := (GE_prop2_stable ha hb). move: (proj1 (GE_prop7 ha hb hd)) => iuE. move: ap bp. rewrite uv vv t1 -(transport_op bg ha hb uE xE) => eq1. move:(gi _ _ (st _ _ uE xE) iuE eq1) => iv1. rewrite -(transport_op bg ha hb vE xE) => eq2. move:(gi _ _ (st _ _ vE xE) iuE eq2) => iv2. by congr (Vf g); apply: (GE_prop10l ha hb hd hc he xE). Qed. Lemma transportable_GI: transportable (fun E s => ((GL E s /\ GA E s) /\ GU E s) /\ GI E s). Proof. move => E F s g bg typ. move: (proj1 (transportable_GT bg typ) typ) => typF. have rc:= (transportable_unit bg typ). move:(bg) => [[[fg gi] [_ gs]] sg tg]. rewrite sg in gi gs; rewrite tg in gs. split; move => [ha hb]; move/rc:(ha) => ha'; split => //. move: ha ha' => [[lE aE] uE] [[lF aF] uF]. apply:(GE_prop13a typF lF uF aF) => x xF. move:(gs _ xF) => [y yE yv]. move:(GE_prop11l typ lE uE aE hb yE) => ll. move:(transport_inv bg typ lE uE yE ll) => hu. move:(GE_prop11r typ lE uE aE hb yE) => lr. have lr1: left_inverse E s (inverse E s y) y by case: lr. move:(transport_inv bg typ lE uE (proj1 ll) lr1) => hv1. have hv: right_inverse F (transport s g) (Vf g y) (Vf g (inverse E s y)) . move: hv1 => [rx ry]; split => //; exact: (proj1 hu). rewrite yv. by exists (Vf g (inverse E s y)). move: ha' ha => [[lE aE] uE] [[lF aF] uF]. apply:(GE_prop13a typ lE uE aE) => x xE. have xF: inc (Vf g x) F by Wtac. move : (GE_prop11l typF lF uF aF hb xF) (GE_prop11r typF lF uF aF hb xF). rewrite/left_inverse/right_inverse (transport_un bg typ lE uE). set y := inverse F _ _; move => [yF]. move:(gs _ yF)=> [z zE ->]. have st := (GE_prop2_stable typ lE). move:(st _ _ zE xE) (st _ _ xE zE) => h1f h2f. rewrite - (transport_op bg typ lE zE xE). rewrite - (transport_op bg typ lE xE zE) => e1 [_ e2]. have unE:= proj1(GE_prop7 typ lE uE). by exists z; split => //; split => //; apply: gi. Qed. End GroupExample. End StructureExample. From mathcomp Require Import seq. Module Structure. Inductive Tree := | Tbase: nat -> Tree | Tpowerset : Tree -> Tree | Tproduct : Tree -> Tree -> Tree. Fixpoint Tdepth e:= match e with | Tbase _ => 0 | Tpowerset e' => (Tdepth e').+1 | Tproduct e' e'' => (maxn (Tdepth e') (Tdepth e'')).+1 end. Fixpoint Tsize e:= match e with | Tbase n => n | Tpowerset e' => Tsize e' | Tproduct e' e'' => maxn (Tsize e') (Tsize e'') end. Section Tree. Definition Tb x := J \0c x. Definition Tp x := J \1c x. Definition Tx x y := J \2c (J x y). Definition tset_base := fun_image Nat Tb. Definition tset_next E := fun_image E Tp \cup fun_image (E \times E) (fun p => J \2c p) \cup E. Lemma tset_baseP x: inc x tset_base <-> exists2 n, natp n & x = Tb n. Proof. exact:funI_P. Qed. Lemma tset_basei n: natp n -> inc (Tb n) tset_base. Proof. by move => nN; apply/(tset_baseP); exists n. Qed. Lemma tset_nextP E x: inc x (tset_next E) <-> [\/ exists2 y, inc y E & x = Tp y, exists y z, [/\ inc y E, inc z E & x = Tx y z] | inc x E]. Proof. split. case/setU2_P; last by move => xe; constructor 3. case /setU2_P; first by move/funI_P => h; constructor 1. move /funI_P => [y /setX_P [ya yb yc] ->]; constructor 2. by exists (P y), (Q y); rewrite /Tx ya. case => h. - by apply /setU2_P;left; apply /setU2_P;left; apply/funI_P. - apply /setU2_P;left; apply /setU2_P;right; apply/funI_P. by move: h => [y [z [yE zE ->]]]; exists (J y z) => //; apply: setXp_i. - by apply /setU2_P;right. Qed. Definition tset_index := induction_term (fun _ x => tset_next x) tset_base. Definition tset := unionf Nat tset_index. Definition treep x := inc x tset. Lemma tset_index0: tset_index \0c = tset_base. Proof. by apply:induction_term0. Qed. Lemma tset_indexS n: natp n -> tset_index (csucc n) = tset_next (tset_index n). Proof. exact: induction_terms. Qed. Lemma tsetP x: treep x <-> exists2 n, natp n & inc x (tset_index n). Proof. exact:setUf_P. Qed. Lemma tset_base_hi x: inc x tset_base -> treep x. Proof. by move => xb; apply/tsetP; exists \0c;[ exact NS0 |rewrite tset_index0 ]. Qed. Lemma tset_min x: treep x -> inc x tset_base \/ exists n, [/\ natp n, inc x (tset_index (csucc n)) & ~inc x (tset_index n)]. Proof. move/tsetP => [n nN ha]. case: (least_int_prop2 nN ha (p := fun t => inc x (tset_index t))). by rewrite tset_index0; left. by set m := cpred _=> j; right; exists m. Qed. Definition tdepth x := intersection (Zo Nat (fun n => inc x (tset_index n))). Lemma tdepth1 x (n:= tdepth x): treep x -> [/\ natp n, inc x (tset_index n) & forall m, natp m -> inc x (tset_index m) -> n <=c m]. Proof. move => sa; rewrite /n/tdepth; set U := Zo _ _. have csu: cardinal_set U by move => t /Zo_P [/CS_nat ]. move/tsetP: (sa) => [k ka kb]. have neu: nonempty U by exists k;apply/Zo_P. move: (cle_wor' csu neu); rewrite -/(tdepth x); move => [/Zo_P[sc sd] se]. by split => // m ma mb; apply:se; apply: (Zo_i ma mb). Qed. Lemma NS_tdepth x: treep x -> natp (tdepth x). Proof. by case /tdepth1. Qed. Lemma tdepth2 x m: treep x -> natp m -> (tdepth x) <=c m -> inc x (tset_index m). Proof. move => /tdepth1 [sa sb _] mn le1. rewrite -(cdiff_pr le1). move:(NS_diff (tdepth x) mn); move: (m -c tdepth x); apply: Nat_induction. by rewrite (csum0r (proj31 le1)). move => n nN xa. rewrite (csum_via_succ _ (CS_nat nN)) (tset_indexS (NS_sum sa nN)). by apply/tset_nextP; constructor 3. Qed. Lemma tdepth3 x m: natp m -> inc x (tset_index m) -> (tdepth x) <=c m. Proof. move => sa sb. have ts: treep x by apply/tsetP; exists m. by move: (tdepth1 ts) => [sc sd se]; exact: (se _ sa sb). Qed. Lemma tdepth4 x: treep x -> tdepth x = \0c -> inc x tset_base. Proof. by move => /tdepth1 [_ sa _] sb; move: sa; rewrite sb tset_index0. Qed. Lemma tdepth_prop x n: treep x -> natp n -> tdepth x = (csucc n) -> (exists y, [/\ treep y, tdepth y <=c n & x = Tp y]) \/ (exists y z, [/\ treep y, treep z, tdepth y <=c n, tdepth z <=c n & x = Tx y z]). Proof. move => xt nN dx. move: (proj32 (tdepth1 xt)); rewrite dx (tset_indexS nN); case/tset_nextP. - move => [y ya yb]; constructor 1; exists y; split => //. by apply /tsetP; exists n. by apply:tdepth3. - move => [y [z [ya za ->]]]; constructor 2; exists y,z; split => //. by apply /tsetP; exists n. by apply /tsetP; exists n. by apply:tdepth3. by apply:tdepth3. - by move => h; move:(tdepth3 nN h); rewrite dx => h';case:(cltNge (cltS nN)). Qed. Lemma tdepth_prop_inv: [/\ forall n, natp n -> treep (Tb n) /\ tdepth (Tb n) = \0c, forall t, treep t -> treep (Tp t) /\ tdepth (Tp t) = csucc (tdepth t) & forall t t', treep t -> treep t' -> treep (Tx t t') /\ tdepth (Tx t t') = csucc (cmax (tdepth t) (tdepth t')) ]. Proof. split. - move =>n nN. have xb0: inc (Tb n) (tset_index \0c). by rewrite tset_index0; apply:tset_basei. move: (tdepth3 NS0 xb0) => /cle0 tz. split => //; apply/tsetP; exists \0c => //; exact: NS0. - move => t tS; move: (tdepth1 tS) => [sa sb sc]. have sd := (NS_succ sa). have tsn: inc (Tp t) (tset_index (csucc (tdepth t))). by rewrite (tset_indexS sa); apply/tset_nextP; constructor 1; exists t. have nts: treep (Tp t) by apply/tsetP; exists (csucc (tdepth t)). split => //; move: (tdepth3 sd tsn) => le1. case: (equal_or_not (tdepth (Tp t)) \0c) => tnz. by move:(tdepth4 nts tnz) => /tset_baseP [n nN /pr1_def e01]; case:card1_nz. move: (cpred_pr (NS_le_nat le1 sd) tnz) => [ma mb]. case: (tdepth_prop nts ma mb). move => [y [ya yb /pr2_def yc]]; apply: cleA => //. by rewrite mb {1} yc; apply: cleSS. by move => [y [z [_ _ _ _ /pr1_def eq12]]]; case: card_12. - move => t t' tS tS'; move: (tdepth1 tS)(tdepth1 tS')=> [sa sb sc][ra rb rc]. case: (Nmax_p1 sa ra). set m := (cmax (tdepth t) (tdepth t')) => mN max1 max2. have smN:= (NS_succ mN). have tsn: inc (Tx t t') (tset_index (csucc m)). rewrite (tset_indexS mN); apply/tset_nextP; constructor 2; exists t, t'. by split=>//; [apply: (tdepth2 tS mN max1) | apply: (tdepth2 tS' mN max2) ]. have nts: treep (Tx t t') by apply/tsetP; exists (csucc m). split => //. move: (tdepth3 smN tsn) => le1. case:(equal_or_not (tdepth (Tx t t')) \0c) => tnz. by move:(tdepth4 nts tnz)=> /tset_baseP [n nN /pr1_def e02]; case: card2_nz. move: (cpred_pr (NS_le_nat le1 smN) tnz) => [ma mb]. case: (tdepth_prop nts ma mb). by move => [y [_ _ /pr1_def eq12]]; case: card_12. move => [y [z [ yT zT dy dz /pr2_def eq1]]]; apply:cleA => //. rewrite mb; apply:cleSS. by move: (cmax_p0 dy dz); rewrite -(pr1_def eq1) - (pr2_def eq1) -/m mb. Qed. Lemma TS_base n: natp n ->treep (Tb n). Proof. by case/(proj31 tdepth_prop_inv). Qed. Lemma TS_powerset t: treep t -> treep (Tp t). Proof. by case/(proj32 tdepth_prop_inv). Qed. Lemma TS_product t t': treep t -> treep t' -> treep (Tx t t'). Proof. by move => ha hb;case:(proj33 tdepth_prop_inv _ _ ha hb). Qed. Lemma tree_ind (p: property): (forall n, natp n -> p (Tb n)) -> (forall x, treep x -> p x -> p (Tp x)) -> (forall x x', treep x -> treep x' -> p x -> p x' -> p(Tx x x')) -> (forall x, treep x -> p x). Proof. move => ha hb hc x xt; move: (NS_tdepth xt) => ns. move: (cleR (CS_nat ns)); move: ns. move: {1 3}(tdepth x) => m mn; move: m mn x xt; apply: Nat_induction. move => x xt /cle0 => dz. by move: (tdepth4 xt dz) => /tset_baseP [n nN ->]; apply: ha. move => n nN Hrec x xt /cle_eqVlt []; last by move/(cltSleP nN); apply: Hrec. case/(tdepth_prop xt nN). by move=>[y [ys dy ->]]; apply: hb => //; apply: Hrec. move => [y [z [ya za hy hz ->]]]. by apply: hc => //; apply: Hrec. Qed. Section StratifiedTheory. Variable h1: Set -> Set. Variable h2: Set -> Set. Variable h3: Set -> Set -> Set. Lemma tree_rec_def_aux1: forall x, treep x -> ordinalp (tdepth x). Proof. by move => x /NS_tdepth /OS_nat. Qed. Definition tree_stratified i E := forall x, inc x E <-> treep x /\ tdepth x <o i. Lemma tree_rec_def_aux2a: tree_stratified \0c emptyset. Proof. by split;[ move/in_set0 | move => [ha /olt0] ]. Qed. Lemma tree_rec_def_aux2b i: omega0 <=o i -> tree_stratified i tset. Proof. move => h x; split; [move => xt; split => // | by case]. move: (NS_tdepth xt) => /(oltP OS_omega) ha. exact: (olt_leT ha h). Qed. Lemma tree_rec_def_aux2c i: i <o omega0 -> i <> \0c -> tree_stratified i (tset_index (cpred i)). Proof. move => ii inz. move/(oltP OS_omega): ii => iN. move: (cpred_pr iN inz) => [ha hb]. move => x; split => xE. split; first by apply/tsetP; exists (cpred i). by apply: oclt; rewrite hb; apply /(cltSleP ha); apply:tdepth3. move: xE =>[ xE dx]. apply:(tdepth2 xE ha); apply /(cltSleP ha); rewrite - hb. by apply: (oclt3 (CS_nat (NS_tdepth xE)) (CS_nat iN)). Qed. Lemma tree_rec_def_aux2: forall i, ordinalp i -> exists E, tree_stratified i E. Proof. move => i oi; case:(oleT_el OS_omega oi) => ii. by exists tset; apply:tree_rec_def_aux2b. case: (equal_or_not i \0c) => inz. exists emptyset; by rewrite inz;apply:tree_rec_def_aux2a. by exists (tset_index (cpred i)); apply: tree_rec_def_aux2c. Qed. Definition tstratified i := Yo (i = \0c) emptyset (Yo (omega0 <=o i) tset (tset_index (cpred i))). Lemma tstratified_val i: ordinalp i -> stratified_set treep tdepth i = tstratified i. Proof. move => oi. have H:= (stratified_setP tree_rec_def_aux2 oi); rewrite /tstratified. case: (equal_or_not i \0c) => iz; Ytac0. apply/set0_P => x; case/(stratified_setP tree_rec_def_aux2 oi) => _. by rewrite iz;move /olt0. case:(oleT_el OS_omega oi) => ii. Ytac0; move:(tree_rec_def_aux2b ii)=> ww. set_extens t; first by move/(stratified_setP tree_rec_def_aux2 oi) => /ww. by move/ww/(stratified_setP tree_rec_def_aux2 oi). rewrite (Y_false (oltNge ii)); move:(tree_rec_def_aux2c ii iz)=> ww. set_extens t; first by move/(stratified_setP tree_rec_def_aux2 oi) => /ww. by move/ww/(stratified_setP tree_rec_def_aux2 oi). Qed. Definition tree_rec_prop x f := Yo (P x = \0c) (h1 (Q x)) (Yo (P x = \1c) (h2 (Vg f (Q x))) (h3 (Vg f (P (Q x))) (Vg f (Q (Q x))))). Definition tree_rec := stratified_fct treep tree_rec_prop tdepth. Lemma tree_recdef_p x: treep x -> tree_rec x = tree_rec_prop x (Lg (tstratified (tdepth x)) tree_rec). Proof. move: (stratified_fct_pr tree_rec_prop tree_rec_def_aux1 tree_rec_def_aux2). rewrite -/tree_rec => h xt. move/OS_nat:(NS_tdepth xt) => oi. by rewrite (h _ xt) (tstratified_val oi). Qed. Lemma tree_recdef_pb' n: natp n -> tree_rec (Tb n) = h1 n. Proof. move => h. have xt:= TS_base h. by rewrite (tree_recdef_p xt) /tree_rec_prop pr1_pair pr2_pair; Ytac0. Qed. Lemma tree_recdef_pb x: inc x tset_base -> tree_rec x = h1 (Q x). Proof. move => ha. have xt:= (tset_base_hi ha). by move/tset_baseP: ha => [n nN ->]; rewrite (tree_recdef_pb' nN) /Tb; aw. Qed. Lemma tree_recdef_pp x: treep x -> tree_rec (Tp x) = h2 (tree_rec x). Proof. move: card1_nz => n01 ha. move: (proj32 (tdepth_prop_inv) _ ha) => [hb hc]. move: (NS_tdepth ha) => iN. rewrite (tree_recdef_p hb) /tree_rec_prop /Tp; aw; Ytac0; Ytac0; rewrite LgV//. rewrite /tstratified hc (Y_false (@succ_nz _)) (cpred_pr2 iN); Ytac w => //. exact:(proj32 (tdepth1 ha)). Qed. Lemma tree_recdef_px x y: treep x -> treep y -> tree_rec (Tx x y) = h3 (tree_rec x) (tree_rec y). Proof. move: card1_nz => n01 ha ha'. move: card_12 card2_nz => c12 c02. move: (proj33 (tdepth_prop_inv) _ _ ha ha') => [hb hc]. move: (NS_tdepth ha) (NS_tdepth ha') => iN iN'. case: (Nmax_p1 iN iN'). set m := (cmax (tdepth x) (tdepth y)) => mN max1 max2. have ra: inc x (tstratified (tdepth (Tx x y))). rewrite /tstratified hc (Y_false (@succ_nz _)); Ytac w => //. by move: (tdepth2 ha mN max1); rewrite (cpred_pr2 mN). have rb: inc y (tstratified (tdepth (Tx x y))). rewrite /tstratified hc (Y_false (@succ_nz _)); Ytac w => //. by move: (tdepth2 ha' mN max2); rewrite (cpred_pr2 mN). rewrite (tree_recdef_p hb) /tree_rec_prop /Tx; aw; Ytac0; Ytac0; rewrite !LgV//. Qed. Lemma tree_recdef_stable E: (forall n, natp n -> inc (h1 n) E) -> (forall x, inc x E -> inc (h2 x) E) -> (forall x x', inc x E -> inc x' E -> inc (h3 x x') E) -> (forall x, treep x -> inc (tree_rec x) E). Proof. move => ha hb hc. apply: tree_ind. - by move => n nN; rewrite tree_recdef_pb' //; apply: ha. - by move => x xt; rewrite tree_recdef_pp //; apply: hb. - move => x y xt yt; rewrite tree_recdef_px //; apply: hc. Qed. End StratifiedTheory. Definition tree_depth_alt := tree_rec (fun _ => \0c) csucc (fun a b => csucc (cmax a b)). Lemma tree_depth_altE x: treep x -> (tree_depth_alt x) = tdepth x. Proof. move: x; rewrite /tree_depth_alt;apply: tree_ind. - move => n nN;move: (proj31 (tdepth_prop_inv) _ nN) => [_ ->]. by rewrite tree_recdef_pb //; apply:tset_basei. - move => x xt h; move: (proj32 (tdepth_prop_inv) _ xt) => [sa sb]. by rewrite sb tree_recdef_pp // h. - move => x y xt yt h1 h2; rewrite tree_recdef_px // h1 h2. by move: (proj33 (tdepth_prop_inv) _ _ xt yt) => [_ ->]. Qed. Fixpoint Tpositive e:= match e with | Tbase n => n != 0 | Tpowerset e' => Tpositive e' | Tproduct e' e'' => (Tpositive e') && (Tpositive e'') end. Lemma tree_rec_bool h1 (f := tree_rec h1 id (fun a b => (cmin a b))): (forall x, natp x -> h1 x <=c \1c) -> (forall x, treep x -> f x <=c \1c). Proof. have Hb v: inc v \2c <-> v <=c \1c. apply: (iff_trans (iff_sym (NltP NS2 v))). rewrite - succ_one; exact:(cltSleP NS1). move => Ha x xT; apply/Hb; apply:tree_recdef_stable => //. by move => n nn; apply/Hb; apply: Ha. by move => u v u1 u2; rewrite /cmin/Gmin; Ytac w. Qed. Definition tree_to_pos := tree_rec (fun n => Yo (n = \0c) \0c \1c) id (fun a b => (cmin a b)). Lemma tree_to_pos_p1: [/\ (forall x, natp x -> tree_to_pos (Tb (csucc x)) = \1c), (tree_to_pos (Tb \0c) = \0c), (forall x, treep x -> tree_to_pos (Tp x) = tree_to_pos x) & (forall x x', treep x -> treep x' -> tree_to_pos (Tx x x') = cmin (tree_to_pos x) (tree_to_pos x'))]. Proof. rewrite /tree_to_pos; split. - move => x xN. have ha:= (tset_basei (NS_succ xN)). by rewrite tree_recdef_pb // pr2_pair Y_false //; exact: succ_nz. - by rewrite (tree_recdef_pb _ _ _ (tset_basei NS0)) pr2_pair Y_true. - by move => x xT; rewrite tree_recdef_pp. - by move => x y xT yT;rewrite tree_recdef_px. Qed. Definition tree_is_pos x := tree_to_pos x = \1c. Lemma tree_to_pos_p2: [/\ (forall x, natp x -> (tree_is_pos (Tb x) <-> x <> \0c)), (forall x, treep x -> (tree_is_pos (Tp x) <-> tree_is_pos x)) & (forall x x', treep x -> treep x' -> (tree_is_pos (Tx x x') <-> ((tree_is_pos x) /\ (tree_is_pos x'))))]. Proof. rewrite /tree_is_pos;split. - move => n nN; case: (equal_or_not n \0c) => nz. rewrite nz; move:(tree_to_pos_p1) => [_ -> _ _]; split => // w. by case:card1_nz. have [sa sb]:= (cpred_pr nN nz); rewrite sb. move:(tree_to_pos_p1) => [sc _ _ _]; rewrite (sc _ sa); split => //. by move => _; apply: succ_nz. - by move => x xT; move:(tree_to_pos_p1) => [_ _ sc _]; rewrite (sc _ xT). - move => x x' xT xT'. move: (tree_to_pos_p1) => [_ _ _ sd]; rewrite (sd _ _ xT xT'). split; last by move => [-> ->]; rewrite /cmin/Gmin; Ytac w. have ha: forall x, natp x -> (fun n => Yo (n = \0c) \0c \1c) x <=c \1c. move => n nN /=; Ytac w; [ exact: cle_01 | exact (cleR CS1)]. move: (tree_rec_bool ha xT) (tree_rec_bool ha xT'). rewrite -/tree_to_pos /cmin/Gmin; move => ra rb. Ytac w => vv; split => //;apply: cleA => //; rewrite - vv //. by move:w;rewrite vv; case. Qed. Definition tree_size := tree_rec id id cmax. Lemma tree_size_p: [/\ (forall x, natp x -> tree_size (Tb x) = x), (forall x, treep x -> tree_size (Tp x) = tree_size x) & (forall x y, treep x ->treep y -> tree_size (Tx x y) = cmax (tree_size x) (tree_size y)) ]. Proof. rewrite /tree_size;split. - by move => n nN; rewrite tree_recdef_pb'. - by move => x xt; rewrite tree_recdef_pp. - by move => x y xt yt; rewrite tree_recdef_px. Qed. Lemma NS_tree_size x: treep x -> natp (tree_size x). Proof. by apply:tree_recdef_stable => // a b aN bN; apply:Gmax_E. Qed. Fixpoint Tree_to_tree e:= match e with | Tbase n => J \0c (nat_to_B n) | Tpowerset e' => J \1c (Tree_to_tree e') | Tproduct e' e'' => J \2c (J (Tree_to_tree e') (Tree_to_tree e'')) end. Lemma Tree_to_tree_prop e (t := Tree_to_tree e): [/\ treep t, tdepth t = nat_to_B (Tdepth e), tree_size t = nat_to_B (Tsize e)& tree_is_pos t <-> Tpositive e]. Proof. rewrite /t {t};elim:e. - move => n /=; move: (nat_to_B_Nat n) => sa;move:(proj31 tdepth_prop_inv _ sa). move => [sc sd];rewrite(proj31 tree_size_p _ sa). move:(proj31 tree_to_pos_p2 _ sa) => h. split => //; apply: (iff_trans h); case: (n); first by split. move => m; split => //= _; exact: succ_nz. - move => e [ha hb hc hd] /=. rewrite (proj32 tree_size_p _ ha). have he:=(iff_trans (proj32 tree_to_pos_p2 _ ha) hd). move:(proj32 tdepth_prop_inv _ ha) => [hf ->]; rewrite hb; split => //. - move => e [ha hb hc hd] e' [ha' hb' hc' hd'] /=. rewrite (proj33 tree_size_p _ _ ha ha'). move:(proj33 tdepth_prop_inv _ _ ha ha') => [he ->]. have hf:= (proj33 tree_to_pos_p2 _ _ ha ha'). rewrite hb hb' hc hc' !(nat_to_B_max); split => //. split; first by move/hf => [/hd -> /hd' ->]. by move/andP => [/hd hd1 /hd' hd2]; apply/hf. Qed. Lemma Tree_to_tree_injective: injective Tree_to_tree. Proof. elim. + move => n [ m | e | e e'] /= => eq. - by move: (pr2_def eq) => eq'; rewrite (nat_to_B_injective eq'). - by case: card1_nz; move: (pr1_def eq). - by case: card2_nz; move: (pr1_def eq). + move => e0 Hr [ m | e | e e'] /= => eq. - by case: card1_nz; move: (pr1_def eq). - by move: (pr2_def eq) => /Hr ->. - by case: (card_12); move: (pr1_def eq). + move => e0 Hr e1 Hr' [ m | e | e e'] /= => eq. - by case: card2_nz; move: (pr1_def eq). - by case: (card_12); move: (pr1_def eq). move: (pr2_def eq) => eq'. move: (pr1_def eq') => /Hr ->. by move: (pr2_def eq') => /Hr' ->. Qed. Lemma Tree_to_tree_surjective x: treep x -> exists e, x = Tree_to_tree e. Proof. move:x;apply: tree_ind. - move => n nN; move:(nat_to_B_surjective nN) => [k ->]. by exists (Tbase k). - by move => x _ [e ->]; exists (Tpowerset e). by move => x x' _ _ [e ->] [e' ->]; exists (Tproduct e e'). Qed. End Tree. (** Inverse Limits and Direct Limits *) (* Echelons *) Definition ech_good x i := \1c <=c x /\ x <=c i. Definition echelon c := slist_E c (Nat \times Nat) /\ forall i, i <c (slength c) -> let a:= P (Vg c i) in let b:= Q (Vg c i) in (b = \0c -> ech_good a i) /\ (b <> \0c -> a <> \0c -> ech_good a i /\ ech_good b i). Definition esize c := \csup(range (Lg (domain c) (fun i=> Yo (P (Vg c i) = \0c) (Q (Vg c i)) \0c))). Lemma echelon_p1 c: echelon c -> \0c <c slength c -> exists b, [/\ natp b, \0c <c b & Vl c \1c = J \0c b]. Proof. move => [pa pb] pc. have nN:= (proj2 (proj1 pa)). move/cge1P: pc => ha. move /setX_P: (Vl_p1 pa (cleR CS1) ha) => [ra rb rc]. have pd: \0c <c slength c by apply/(cleSltP NS0); rewrite succ_zero. move: (pb _ pd); simpl; move /setX_P: (Vl_p1 pa (cleR CS1) ha). rewrite /Vl cpred1; set a:= P _; set b := Q _; move => [sa sb sc] [sd se]. have Ha w: ech_good w \0c -> False. by move => [la lb]; move: (cltNge clt_01) (cleT la lb). case(equal_or_not b \0c) => bz; first by move: (Ha _ (sd bz)). case(equal_or_not a \0c) => az; last by case: (Ha _ (proj1 (se bz az))). have bp:= (card_ne0_pos (CS_nat sc) bz). by exists b; rewrite - sa -/a az. Qed. Lemma echelon_p1' c: echelon c -> \0c <c slength c -> exists b, [/\ natp b, \0c <c b & Vg c \0c = J \0c b]. Proof. move => h1 h2; move: (echelon_p1 h1 h2) => [n [bN bp v]]; exists n; split=> //. by rewrite -v /Vl cpred1. Qed. Lemma esize_empty c : echelon c -> slength c = \0c -> esize c = \0c. Proof. move => [[ec _] _] sz. rewrite /esize (slist_domain ec) sz Nint_co00 /Lg funI_set0 range_set0. by rewrite setU_0. Qed. Lemma esize_prop1 c (n:= esize c) (m:=slength c): echelon c -> \0c <c m -> [/\ natp n, \0c <c n, exists2 j, j <c m & Vg c j = J \0c n & forall j, j <c m -> P (Vg c j) = \0c -> Q (Vg c j) <=c n]. Proof. move => ha hb. move: (echelon_p1 ha hb) => [b0 [b0N b0p cb0]]. have b4: Vg c \0c = J \0c b0 by rewrite - cb0 /Vl cpred1. rewrite /n/esize {n}; set r := range _ . move:ha =>[[pa pb] pc]. have mN := (proj2 pa). have rN: sub r Nat. move => v /Lg_range_P [i idc ->]; Ytac pz; last by apply: NS0. by move:(pb _ (inc_V_range (proj1 pa) idc)) => /setX_P []. have fsr: finite_set r. apply: (finite_range); aww. by rewrite - (NintE mN); apply: finite_Nint. have zd: inc \0c (domain c) by apply /(NltP mN). have b0r: inc b0 r by apply/Lg_range_P;exists \0c => //; rewrite b4; aw; Ytac0. have nr: nonempty r by exists b0. move: (finite_subset_Nat rN fsr nr) => [n nir nmax]. have nN:= (rN _ nir). have ->: union r = n. have csr: cardinal_set r by move => i /rN /CS_nat. apply: (cleA (card_ub_sup (CS_nat nN) nmax) (card_sup_ub csr nir)). have np:=(clt_leT b0p (nmax _ b0r)). split => //. move/Lg_range_P: (nir) => [b1 b1d]. move:(pb _ (inc_V_range (proj1 pa) b1d)) => /setX_P [qa qb qc]. Ytac fs => nn; last by move:(proj2 np); rewrite nn. by exists b1;[ apply /(slist_domainP pa) | rewrite - qa fs - nn ]. move => j ljm pz; apply:nmax; apply/Lg_range_P; exists j. by apply /(slist_domainP pa). by rewrite pz; Ytac0. Qed. Lemma NS_esize c: echelon c -> natp (esize c). Proof. move => h. have sN:=(proj2 (proj1 (proj1 h))). case (equal_or_not (domain c) \0c) => sz. rewrite (esize_empty h sz); apply: NS0. by case:(esize_prop1 h (card_ne0_pos (CS_nat sN) sz)). Qed. Lemma esize_prop2 c n (m:=slength c): echelon c -> (exists2 j, j <c m & Vg c j = J \0c n) -> (forall j, j <c m -> P (Vg c j) = \0c -> Q (Vg c j) <=c n) -> esize c = n. Proof. move => ha [j ja jb] hc. have mp:= (cle_ltT (cle0x (proj31_1 ja)) ja). move:(esize_prop1 ha mp); set k := esize c. move => [kN kp [j2 j2a j2b] hd]. apply: cleA. have pa:P (Vg c j2) = \0c by rewrite j2b; aw. by move: (hc _ j2a pa); rewrite j2b; aw. have pa:P (Vg c j) = \0c by rewrite jb; aw. by move: (hd _ ja pa); rewrite jb; aw. Qed. Definition Ech_base n := Lg \1c (fun z => (J \0c n)). Lemma Ech_base_prop n (c:= Ech_base n): natp n -> \0c <c n -> [/\ echelon c, Vg c \0c = J \0c n, \0c <c slength c & esize c = n]. Proof. move => ha hb. have nz:=(nesym (proj2 hb)). have i01: inc \0c \1c by apply: set1_1. have lt01 := clt_01. have ns1 := NS1. have vz: Vg c \0c = J \0c n by rewrite /c/Ech_base;rewrite LgV. have r0: slength c = \1c by rewrite /c /Ech_base /slength Lgd. have hc: echelon c. split; last by rewrite r0 => i /clt1 ->; rewrite vz; aw; split. rewrite /c/Ech_base; split; first split; aww. move => i /Lg_range_P[_ _ ->]; apply: setXp_i => //; apply: NS0. have sp: \0c <c slength c by rewrite /slength/c /Ech_base Lgd. split => //. apply: (esize_prop2 hc). by exists \0c => //; rewrite r0. move => j; rewrite r0 /c/Ech_base => /(NltP NS1)jz; rewrite ! LgV//; aw. move => _; exact: (cleR (CS_nat ha)). Qed. Definition Ech_powerset c:= c +s1 J (slength c) (J (slength c) \0c). Lemma Ech_powerset_prop c (m := slength c)(c':= Ech_powerset c): echelon c -> \0c <c m -> [/\ echelon c', slength c' = csucc m, esize c' = esize c, Vg c' m = J m \0c & forall k, k <c m -> Vg c' k = Vg c k]. Proof. move => sa sb. move: (esize_prop1 sa sb) => sc. move: sa => [[[qa qb] sa2] sa3]. have ra: sub (range c') (Nat \times Nat). rewrite range_setU1 => i/setU1_P; case; first by apply: sa2. move => ->; apply: setXp_i => //; apply:NS0. have rb: ~ inc (slength c) (domain c). by apply:ordinal_irreflexive; apply: OS_nat. have dc1: domain c' = osucc (domain c) by rewrite domain_setU1. have dc2: domain c' = csucc (domain c) by rewrite (succ_of_nat qb). have lc: slistp c'. split; [ apply:(fgraph_setU1 _ qa rb) | rewrite dc2; fprops]. have ec:echelon c'. split => // i; rewrite /slength dc2; move/(cltSleP qb) => /cle_eqVlt []. move => ->; rewrite (setU1_V_out _ qa rb); saw. move =>_ ; split; [ by apply/cge1P | apply:cleR; fprops]. done. move => li; rewrite (setU1_V_in _ qa rb); first by apply: sa3. by apply /(NltP qb). have dc3: slength c' = csucc m by done. have sep: \0c <c slength c'. by rewrite /slength dc2; apply: succ_positive. have atval: Vg c' m = J m \0c by rewrite (setU1_V_out _ qa rb). have inval: forall k, k <c m -> Vg c' k = Vg c k. by move => k lkm; rewrite (setU1_V_in _ qa rb) //; apply /(NltP qb). move: sc=> [kN kp [j ja jb]] kd. split => //. apply:(esize_prop2 ec). exists j; first by rewrite /slength dc2; exact:(clt_leT ja (cleS qb)). by rewrite inval. move => i; rewrite /slength dc2; move/(cltSleP qb) => /cle_eqVlt []. move => ->; rewrite atval; aw => _; apply: (proj1 kp). by move => idc; rewrite inval //; apply: kd. Qed. Definition ech_shift n v:= Yo (P v = \0c) v (Yo (Q v = \0c) (J (P v +c n) \0c) (J (P v +c n) (Q v +c n))). Definition ech_product1 f g n m i:= Yo (i <c n) (Vg f i) (Yo (i = n +c m) (J n (n +c m)) (ech_shift n (Vg g (i -c n)))). Lemma ech_product_prop1 f g n m i (v:= ech_product1 f g n m): natp n -> natp m -> [/\ i <c n -> v i = (Vg f i), v(n +c m) = (J n (n +c m)) & i <c m -> v (n +c i) = ech_shift n (Vg g i)]. Proof. rewrite /v /ech_product1 => nN mN. have ha k: ~(n +c k <c n) by apply/cleNgt; exact: (Nsum_M0le _ nN). split. - by move => lin; Ytac0. - by rewrite (Y_false (ha m)) Y_true. move => lim. rewrite (Y_false (ha i)); Ytac h. move: lim =>[lim];case; exact: (csum_eq2l nN (NS_le_nat lim mN) mN h). by rewrite csumC (cdiff_pr1 (NS_lt_nat lim mN) nN). Qed. Definition Ech_product f g := let n := (slength f) in let m := (slength g) in Lg (csucc (n +c m))(ech_product1 f g n m). Lemma Ech_product_prop f g (n := slength f) (m:= slength g) (h := Ech_product f g): echelon f -> echelon g -> \0c <c n -> [/\ echelon h, slength h = csucc (n +c m), esize h = cmax (esize f) (esize g) & [/\ forall i, i <c n -> Vg h i = (Vg f i), Vg h (n +c m) = (J n (n +c m)) , forall i, i <c m -> Vg h (n +c i) = ech_shift n (Vg g i) & forall i, n <=c i -> i <c n +c m -> Vg h i = ech_shift n (Vg g (i -c n))]]. Proof. move=> echelon1 echelon2 np. move: (echelon1)(echelon2) =>[[ha1 ha2] ha3] [[hb1 hb2] hb3]. have nz:=(nesym (proj2 np)). have nN: natp n by exact (proj2 ha1). have mN: natp m by exact (proj2 hb1). have nmN := (NS_sum nN mN). have snmN:= (NS_succ nmN). have cp1:= (Nsum_M0le m nN). have cp2 :=(cleR (CS_nat nmN)). have r0 i: i <c n +c m -> inc i (csucc (n +c m)). move => lin; apply/(NltP snmN). exact:(clt_leT lin (cleS nmN)). have r1 i: i <c n -> Vg h i = Vg f i. move => lin. move: (ech_product_prop1 f g i nN mN) => [<- // _ _ ]. rewrite /h /Ech_product LgV//; aw; apply: r0. exact:(clt_leT lin cp1). have r2: Vg h (n +c m) = J n (n +c m). rewrite /h /Ech_product LgV; last by rewrite (succ_of_nat nmN);fprops. by case:(ech_product_prop1 f g n nN mN). have r3 i: i <c m -> Vg h (n +c i) = ech_shift n (Vg g i). move => min; rewrite /h /Ech_product LgV//. by move: (ech_product_prop1 f g i nN mN) => [ _ _ ->]. apply: r0;apply:(csum_Meqlt nN min). have r4 i: n <=c i -> i <c n +c m -> Vg h i = ech_shift n (Vg g (i -c n)). move => i1 i2; move:(NS_lt_nat i2 nmN)(cdiff_pr i1) => iN i3. move: i2; rewrite -{1 2} i3 => i2. by move: (csum_lt2l nN (NS_diff n iN) mN i2) => i4; rewrite r3. have r5: slength h = csucc (n +c m). by rewrite /slength /h /Ech_product Lgd. have r6: sub (range h) (Nat \times Nat). move => t /Lg_range_P [b bs ->]. move: (ech_product_prop1 f g b nN mN) => [sa sb sc]. move/(NltP snmN): bs => /(cltSleP nmN) /cle_eqVlt []. by move => ->; rewrite sb; apply: setXp_i. move => lbnm; case:(cleT_el (CS_nat nN) (proj31_1 lbnm)) => lbn; last first. rewrite (sa lbn); apply: ha2; apply /(range_gP (proj1 ha1)); exists b=> //. by apply /(NltP nN). move: (cdiff_pr lbn) => d1. have bN:= (NS_lt_nat lbnm nmN). rewrite - d1 in lbnm; move: (csum_lt2l nN (NS_diff n bN) mN lbnm) => ha. move: (ech_product_prop1 f g (b -c n) nN mN) => [_ _ sc']. rewrite - d1 (sc' ha); rewrite /ech_shift. have vr : inc (Vg g (b -c n)) (range g). by apply /(range_gP (proj1 hb1)); exists (b-c n) => //;apply /(NltP mN). move: (hb2 _ vr) =>w. move/setX_P: (w)=>[]; set aa := P _; set bb :=Q _ => [qa qb qc]. Ytac h1 => //; Ytac h2. apply:(setXp_i (NS_sum qb nN) NS0). apply:(setXp_i (NS_sum qb nN) (NS_sum qc nN)). have r7: domain h = csucc (n +c m) by rewrite /h/Ech_product; aw. have r8: slist_E h (Nat \times Nat). split => //; split; [ apply:Lg_fgraph | ue]. have r9: echelon h. split => // i; rewrite r5; move => /(cltSleP nmN) /cle_eqVlt []. move => -> /=; rewrite r2; aw;split. by move/csum_nz => [/nz]. move => ha hb; split; split => //; apply/cge1P => //. by apply:(card_ne0_pos (CS_nat nmN)). move => lbnm; case:(cleT_el (CS_nat nN) (proj31_1 lbnm)) => lbn; last first. by rewrite (r1 _ lbn); apply: ha3. move:(NS_lt_nat lbnm nmN)(cdiff_pr lbn) => iN i3. move: lbnm; rewrite -{1 2 3} i3 => i2. move: (csum_lt2l nN (NS_diff n iN) mN i2) => i4. move:(hb3 _ i4); rewrite (r3 _ i4) /ech_shift /=. set a := P _; set b := Q _; move => [ha hb]. case:(equal_or_not a \0c) => az; Ytac0. split; first by move/ha => []; rewrite az => a1; move:(cltNge clt_01 a1). by move => _; case. have h0 c: ech_good c (i -c n) -> ech_good (c +c n) i. move => [hc hd]; split; first exact: (cleT hc (csum_M0le n (proj32 hc))). by rewrite - i3 csumC; apply: csum_Meqle. case:(equal_or_not b \0c) => bz; Ytac0; aw; split. - by move => _; move: (ha bz); apply: h0. - by case. - by move /csum_nz => [_ /nz]. - by move:(hb bz az) => [hc hd] _ _; split; apply: h0. split => //. move: (esize_prop1 echelon1 np); set N := esize f. move => [NN Np [ja ja1 ja2] ja3]. case: (equal_or_not m \0c) => mz. have max0: cmax N \0c = N. by rewrite (cmax_yx (proj1 Np)). rewrite (esize_empty echelon2 mz) max0. have s0: slength h = csucc n. by rewrite /slength r7 mz (csum0r (CS_nat nN)). apply: (esize_prop2 r9); rewrite s0. exists ja; [exact:(clt_leT ja1 (cleS nN)) | by rewrite r1]. move => j /(cltSleP nN) /cle_eqVlt []. move ->. move: r2. rewrite mz (csum0r (CS_nat nN)) => ->; aw => //. move => jn; rewrite (r1 _ jn); exact (ja3 _ jn). have mp:= (card_ne0_pos (CS_nat mN) mz). move: (esize_prop1 echelon2 mp); set M := esize g. move => [MN Mp [ka ka1 ka2] ka3]. move:(cmax_p1 (proj32_1 Np) (proj32_1 Mp)) => [max1 max2]. apply: (esize_prop2 r9). have ja4: ja <c slength h. rewrite r5; exact: (clt_leT (clt_leT ja1 cp1) (cleS nmN)). have ka4: n +c ka <c slength h. rewrite r5; exact: (clt_leT (csum_Meqlt nN ka1) (cleS nmN)). rewrite /cmax/Gmax; case: (p_or_not_p (N <=c M)) => lnm; Ytac0. exists (n +c ka) => //;rewrite (r3 _ ka1). by rewrite /ech_shift ka2 pr1_pair (Y_true (erefl \0c)). by exists ja => //;rewrite r1. move => j; rewrite r5; move => /(cltSleP nmN) /cle_eqVlt []. by move => -> /=; rewrite r2; aw. move => ljnm; case:(cleT_el (CS_nat nN) (proj31_1 ljnm)) => ljn; last first. rewrite (r1 _ ljn) => anz; exact: (cleT (ja3 _ ljn anz) max1). move:(NS_lt_nat ljnm nmN)(cdiff_pr ljn) => iN i3. move: ljnm; rewrite -{1 2 3} i3 => i2. move: (csum_lt2l nN (NS_diff n iN) mN i2) => i4. rewrite (r3 _ i4) /ech_shift; set a:= (P (Vg g _)); set b := Q _. case:(equal_or_not a \0c) => az; Ytac0. move => _; exact: (cleT (ka3 _ i4 az) max2). have anz : a +c n <> \0c by move/csum_nz => []. by case:(equal_or_not b \0c) => bz; Ytac0; aw. Qed. Fixpoint Tree_to_echelon t := match t with | Tbase n => Ech_base (nat_to_B n.+1) | Tpowerset t' => Ech_powerset (Tree_to_echelon t') | Tproduct t' t'' => Ech_product (Tree_to_echelon t') (Tree_to_echelon t'') end. Definition tree_to_echelon x := tree_rec (fun n => Ech_base (csucc n)) (fun t => Ech_powerset t) (fun t t' => Ech_product t t') x. Lemma tree_to_echelon_E (f:=tree_to_echelon) : [/\ forall n, natp n -> f (Tb n) = Ech_base (csucc n), forall t, treep t -> f (Tp t) = Ech_powerset (f t) & forall t t', treep t -> treep t' -> f (Tx t t') = Ech_product (f t) (f t')]. Proof. rewrite /f/tree_to_echelon; split. - by move => n nN;rewrite tree_recdef_pb'. - by move => x tp; rewrite tree_recdef_pp. - by move => t t' tp tp'; rewrite tree_recdef_px. Qed. Lemma tree_to_echelon_prop2 t: tree_to_echelon (Tree_to_tree t) = Tree_to_echelon t. Proof. have H0 x: treep (Tree_to_tree x) by case: (Tree_to_tree_prop x). elim:t. - by move => n; rewrite (proj31 tree_to_echelon_E _ (nat_to_B_Nat n)) /=. - by move => e Hr; rewrite /= (proj32 tree_to_echelon_E _ (H0 e)) Hr. - move => e Hr1 e' Hr2. by rewrite /= (proj33 tree_to_echelon_E _ _ (H0 e) (H0 e')) Hr1 Hr2. Qed. Lemma tree_to_echelon_ok t (c := tree_to_echelon t): treep t -> [/\ echelon c, \0c <c slength c & esize c = csucc (tree_size t)]. Proof. rewrite /c{c}; move:t; apply: tree_ind. - move => n nN. move: (Ech_base_prop (NS_succ nN) (succ_positive n)) => [ea eb ec ed]. rewrite (proj31 tree_to_echelon_E _ nN); split => //. by rewrite ed (proj31 tree_size_p _ nN). - move => x tx [h1 h2 h3]. move:(Ech_powerset_prop h1 h2); rewrite h3; move => [ha hb hc _ _]. rewrite (proj32 tree_to_echelon_E _ tx) hc (proj32 tree_size_p _ tx) hb. split => //; apply: succ_positive. - move => x x' tx tx' [h1 h2 h3] [h1' h2' h3']. rewrite (proj33 tree_to_echelon_E _ _ tx tx') (proj33 tree_size_p _ _ tx tx'). move:(Ech_product_prop h1 h1' h2) => [ra rb rc _]; rewrite rc;split => //. by rewrite rb; apply: succ_positive. by rewrite h3 h3' cmax_succ //;apply: CS_nat; apply:NS_tree_size. Qed. Section EchelonRecdef. Variable h1: Set -> Set. Variable h2: Set -> Set. Variable h3: Set -> Set -> Set. Definition erecdef_combine h1 h2 h3 := fun f a b => Yo (a = \0c) (h1 b) (Yo (b = \0c) (h2 (Vl f a)) (h3 (Vl f a) (Vl f b))). Definition echelon_recdef_prop c (p: Set -> Set -> Set -> Set):= forall g1 g2 i, i <c slength c -> (forall j, j <c i -> Vg g1 j = Vg g2 j) -> p g1 (P (Vg c i)) (Q (Vg c i)) = p g2 (P (Vg c i)) (Q (Vg c i)). Lemma erecdef_prop1 c: echelon c -> echelon_recdef_prop c (erecdef_combine h1 h2 h3). Proof. move => [[ka kb] kc] g1 g2 i lim Hr. rewrite /erecdef_combine. move: (proj2 ka) => mN. have iN:= (NS_lt_nat lim mN). have aux x: ech_good x i -> (Vl g1 x) = (Vl g2 x). move => [/cge1P ra' rb']; apply: Hr. have xN:=(NS_le_nat rb' iN). have [cpN cpv]:= (cpred_pr xN (nesym (proj2 ra'))). by apply/(cleSltP cpN); rewrite - cpv. move:(kc _ lim) => [kc1 kc2]. case: (p_or_not_p (P (Vg c i) = \0c)) => ca; Ytac0; Ytac0; first by done. case: (p_or_not_p (Q (Vg c i) = \0c)) => cb; Ytac0; Ytac0. by rewrite (aux _ (kc1 cb)). by move: (kc2 cb ca) => [ua ub]; rewrite !aux. Qed. Definition echelon_recdef c (p := erecdef_combine h1 h2 h3) := restr (graph (transfinite_defined Nat_order (fun u => (p (graph u) (P (Vg c (source u))) (Q (Vg c (source u))))))) (slength c). Lemma erecdef_prop c (m := slength c)(f := echelon_recdef c) (p := erecdef_combine h1 h2 h3): echelon c -> [/\ fgraph f, domain f = m & forall i, i <c m -> Vg f i = p f (P (Vg c i)) (Q (Vg c i))]. Proof. move => ec; move: (ec)=> [[ka kb] kc]. rewrite /f /echelon_recdef{f}; set g := fun u:Set => _. move: Nat_order_wor => [wor sr]. move: (transfinite_defined_pr g wor). set f1 := (transfinite_defined Nat_order g). rewrite /transfinite_def sr /g; move => [ra rb rc]. have sa i: natp i -> Vf f1 i = p (restr (graph f1) i)(P (Vg c i))(Q (Vg c i)). move => iN; rewrite (rc _ iN) /restriction1. by rewrite (segment_Nat_order iN) (NintE iN); aw. move: (slength_nat ka); rewrite -/m => mN. set f := restr _ _. have ha: fgraph f by apply: restr_fgraph. have hb: domain f = m by rewrite /f restr_d. split => // i lim. have iN:= (NS_lt_nat lim mN). have il: inc i m by apply /(NltP mN). rewrite /f (restr_ev _ il) -/(Vf _ _) (sa _ iN); apply: (erecdef_prop1 ec) => // j ji. have ijm: inc j m by apply /(NltP mN); apply: (clt_ltT ji lim). have iji: inc j i by apply /(NltP iN). by rewrite !LgV. Qed. Lemma erecdef_unique c f (m := slength c) (p := erecdef_combine h1 h2 h3): echelon c -> slistpl f m -> (forall i, i <c m -> Vg f i = p f (P (Vg c i)) (Q (Vg c i))) -> f = echelon_recdef c. Proof. move => pa [pb pc] pd. move: (erecdef_prop pa); set g := (echelon_recdef c). move => [qa qb qc]. have fgf: fgraph f by move: pb => []. have dfdg: domain f = domain g by rewrite qb. have mN := (proj2(proj1 (proj1 pa))). apply: fgraph_exten => // i; rewrite dfdg qb -/m => im. have iN:=(NS_inc_nat mN im). move/(NltP mN):im. move: i iN;apply: Nat_induction1 => n nN Hr lt. rewrite (pd _ lt) (qc _ lt). apply:(erecdef_prop1 pa) => // => j ljn. apply: Hr => //; exact: (clt_ltT ljn lt). Qed. Lemma erecdef_prop2 c (m := slength c)(f := echelon_recdef c) (n:= esize c): echelon c -> forall i, i <c m -> let a:= P (Vg c i) in let b := Q (Vg c i) in [/\ a = \0c -> [/\ \1c <=c b, b <=c n & Vg f i = (h1 b)], b = \0c -> [/\ \1c <=c a, a <=c i & Vg f i = h2 (Vl f a) ] & a <> \0c -> b <> \0c -> [/\ \1c <=c a, a <=c i, \1c <=c b, b <=c i & Vg f i = h3 (Vl f a) (Vl f b)]]. Proof. move => ec i lim ; move: (erecdef_prop ec); rewrite -/f. move => [ha hb hc] /=; rewrite (hc _ lim) /erecdef_combine. move: (esize_prop1 ec (cle_ltT (cle0x (proj31_1 lim)) lim)). rewrite -/n -/m; move=> [na nb nc nd]. move: ((proj2 ec) _ lim); simpl;set a := P _; set b := Q _; move=> [ia ib]. have hu: b = \0c -> a <> \0c. by move => bz az; move:(proj1 (ia bz)); rewrite az=> w; case:(cltNge clt_01). split. - move=> az; rewrite az; Ytac0. by have bn:=(nd _ lim az); split =>//; apply: (cge1 (proj31 bn)) => /hu. - by move => bz; move:(ia bz) (hu bz) => [a1 a2] a3; split => //;Ytac0; Ytac0. - move => az bz; move:(ib bz az) => [[q1 q2][q3 q4]]. by split => //; Ytac0; Ytac0. Qed. Lemma erecdef_unique1 c f (m := slength c): echelon c -> slistpl f m -> (forall i, i <c m -> let a:= P (Vg c i) in let b := Q (Vg c i) in [/\ a = \0c -> Vg f i = h1 b, b = \0c -> Vg f i = h2 (Vl f a) & a <> \0c -> b <> \0c -> Vg f i = h3 (Vl f a) (Vl f b)]) -> f = echelon_recdef c. Proof. move => ha hc hd. have he:= (erecdef_prop ha). apply: erecdef_unique => // i lim. rewrite / erecdef_combine; move:(hd _ lim). set a := P _; set b := Q _; move => [ka kb kc]. case: (p_or_not_p (a = \0c)) => az; Ytac0; first by apply: (ka az). case: (p_or_not_p (b = \0c)) => bz; Ytac0; first by apply: (kb bz). by apply: kc. Qed. Lemma erecdef_restr c n: echelon c -> n <=c slength c -> echelon_recdef (restr c n) = restr (echelon_recdef c) n. Proof. move => ha hb; symmetry. move: (ha) => [[[pa pb] pc] pd]. have dr: domain (restr c n) = n by aw. have sid: sub n (domain c) by exact:(proj33 hb). have nN := NS_le_nat hb pb. have hc: slist_E (restr c n) (Nat \times Nat). split; first by split; fprops; rewrite dr. exact: (sub_trans (restr_range1 pa sid) pc). have hd: echelon (restr c n). split => // i; rewrite /slength dr => lin. have in': inc i n by apply/(NltP nN). by rewrite LgV//; apply: pd; apply: (clt_leT lin hb). have he:slistpl (restr (echelon_recdef c) n) (slength (restr c n)). by rewrite /slistpl /slength !Lgd; split => //; split=> //;fprops; aw. apply: (erecdef_unique hd he); aw => i lin. have in': inc i n by apply/(NltP nN). have iN:= (NS_lt_nat lin nN). have lin': i <c slength c by exact: (clt_leT lin hb). move: (erecdef_prop ha) => [ra rb rc]. rewrite LgV // (rc _ lin'); rewrite LgV //. apply:erecdef_prop1 => // j ji. by move/(NltP nN):(clt_ltT ji lin) => ljn; rewrite [in RHS] LgV//. Qed. Lemma echelon_recdef_extent2 c c' i: echelon c -> echelon c' -> i <=c slength c -> i <=c slength c' -> i <> \0c -> (forall k, k<c i -> Vg c k = Vg c' k) -> Vl (echelon_recdef c) i = Vl (echelon_recdef c') i. Proof. move => ec1 ec2 k1 k2 ip sv. have iN:=(NS_le_nat k1 (proj2 (proj1 (proj1 ec1)))). have lii: inc (cpred i) i by apply/(NltP iN); exact:(cpred_lt iN ip). have: echelon_recdef (restr c i) = echelon_recdef (restr c' i). congr echelon_recdef; apply: fgraph_exten; aww. by move => j ji /=; rewrite ! LgV//; apply: sv; apply/(NltP iN). rewrite (erecdef_restr ec1 k1) (erecdef_restr ec2 k2). by move/(f_equal (fun z => Vl z i)); rewrite /Vl LgV // => ->; rewrite LgV. Qed. Definition echelon_recdef_last c := Vl (echelon_recdef c) (slength c). Lemma erecdef_base n (c := Ech_base n): natp n -> \0c <c n -> echelon_recdef_last c = h1 n. Proof. move => sa sb. move: (Ech_base_prop sa sb) =>[ha hb hc hd]. have slc: slength c = \1c; rewrite /slength /c/Ech_base; aw; trivial. rewrite /echelon_recdef_last /Vl slc cpred1. have sz: \0c <c slength c by rewrite slc; exact : clt_01. move:(proj31 (erecdef_prop2 ha sz)); rewrite hb; aw => h. exact: (proj33 (h (erefl \0c))). Qed. Lemma erecdef_powerset c (c' := Ech_powerset c): echelon c -> \0c <c slength c -> echelon_recdef_last c' = h2 ( echelon_recdef_last c). Proof. rewrite/echelon_recdef_last => ec cp. move:(Ech_powerset_prop ec cp) => [ha hb hc hd he]. rewrite /c' hb /Vl (cpred_pr1 (proj32_1 cp)). have p1: (slength c) <c slength (Ech_powerset c). rewrite hb; apply: cltS; exact: (proj2 (proj1 (proj1 ec))). move: (proj32 (erecdef_prop2 ha p1)); rewrite hd; aw => hh. move: (hh (erefl \0c)) => [ka kb ->]; congr h2. apply:(echelon_recdef_extent2 ha ec (proj1 p1) kb (nesym (proj2 cp)) he). Qed. Lemma erecdef_product c c' (c'' := Ech_product c c'): echelon c -> echelon c' -> \0c <c slength c -> \0c <c slength c' -> echelon_recdef_last c'' = h3 (echelon_recdef_last c) (echelon_recdef_last c'). Proof. rewrite/echelon_recdef_last => ec ec' cp cp'. move:(Ech_product_prop ec ec' cp) => [ra rb rc [rd re rf rg]]. move:(proj2 (proj1 (proj1 ec))) (proj2 (proj1 (proj1 ec'))) => s1N s2N. move: (CS_nat s1N) (CS_nat s2N) => cs1 cs2. set s := (slength c). set s' := (slength c'); move:(nesym (proj2 cp')) => s2nz. move: (cpred_pr s2N s2nz); rewrite -/(slength c');move => [qa qb]. have eqa:cpred (s +c s') = s +c cpred s'. by rewrite /s' {1} qb (csum_via_succ _ (CS_nat qa)) (cpred_pr1 (CS_sum2 _ _)). have qc: s <=c slength c''. by rewrite rb -(csum_via_succ _ cs2);apply:csum_M0le cs1. have qd: (cpred (slength c'')) = s +c s' by rewrite rb cpred_pr1; fprops. have pa: s <> \0c by exact:(nesym (proj2 cp)). have pb: s +c s' <> \0c by case/csum_nz. have sl1: (cpred (slength c'')) <c (slength c''). apply:(cpred_lt (proj2 (proj1(proj1 ra))));rewrite [domain _]rb. apply: succ_nz. move:(proj33 (erecdef_prop2 ra sl1)); rewrite qd re /Vl; aw => h11. move:(h11 pa pb) => [pc pd pe pf pg] {h11};rewrite /Vl qd pg; congr h3. apply:(echelon_recdef_extent2 ra ec qc (cleR cs1) (nesym (proj2 cp))). by move => k kl; rewrite rd. clear pa pb pc pd pe pf pg. rewrite eqa. have: cpred s' <c s' by exact:(cpred_lt s2N s2nz). move: qa; move: (cpred s'); apply: Nat_induction1. move => i iN Hr lis1. move:( erecdef_prop2 ec' lis1) => [ca cb cc]. have lis2: (s +c i) <c slength (Ech_product c c'). rewrite rb -/s - (csum_via_succ _ cs2); apply:(csum_Meqlt s1N). exact: (clt_leT lis1 (cleS s2N)). move:(erecdef_prop2 ra lis2) => []. rewrite (rf _ lis1) /ech_shift. case: (equal_or_not (P (Vg c' i)) \0c) => az; Ytac0. by move => hu _ _; move: (hu az) (ca az) => [_ _ ->] [_ _ ->]. case: (equal_or_not (Q (Vg c' i)) \0c) => bz; Ytac0. move => _ hu _; move: hu; aw => hu. move: (hu (erefl \0c)) (cb bz) => [p1 p2 ->] [p3 p4 ->]. rewrite /Vl. move: (cpred_pr6' iN p3 p4) => [ua ub uc]. have ->: cpred (P (Vg c' i) +c slength c) = s +c cpred (P (Vg c' i)). rewrite {1} ub csumC (csum_via_succ _ (CS_nat ua)) cpred_pr1; fprops. rewrite Hr //; apply: (clt_ltT uc lis1). move => _ _ hu; move: hu; aw => hu. have az': P (Vg c' i) +c slength c <> \0c by case/csum_nz. have bz': Q (Vg c' i) +c slength c <> \0c by case/csum_nz. move: (cc az bz) => [p1 p2 p3 p4 ->]. move: (hu az' bz') => [p1' p2' p3' p4' ->]. rewrite /Vl. move: (cpred_pr6' iN p1 p2) => [ua ub uc]. have ->: cpred (P (Vg c' i) +c slength c) = s +c cpred (P (Vg c' i)). rewrite {1} ub csumC (csum_via_succ _ (CS_nat ua)) cpred_pr1; fprops. move: (cpred_pr6' iN p3 p4) => [ua' ub' uc']. have ->: cpred (Q (Vg c' i) +c slength c) = s +c cpred (Q (Vg c' i)). rewrite {1} ub' csumC (csum_via_succ _ (CS_nat ua')) cpred_pr1; fprops. move: (clt_ltT uc lis1) (clt_ltT uc' lis1) => lt1 lt2. rewrite Hr // Hr //. Qed. End EchelonRecdef. Definition echelon_to_trees := echelon_recdef (fun b => Tb (cpred b)) Tp Tx. Lemma echelon_to_trees_prop c (m := slength c)(f := echelon_to_trees c) (n := esize c): echelon c -> [/\ fgraph f, domain f = m, forall i, i <c m -> treep (Vg f i) & forall i, i <c m -> let a:= P (Vg c i) in let b := Q (Vg c i) in [/\ a = \0c -> [/\ \1c <=c b, b <=c n & Vg f i = Tb (cpred b)], b = \0c -> [/\ \1c <=c a, a <=c i & Vg f i = Tp (Vl f a)] & a <> \0c -> b <> \0c -> [/\ \1c <=c a, a <=c i, \1c <=c b, b <=c i & Vg f i = Tx (Vl f a) (Vl f b)]]]. Proof. move => ha. move: (erecdef_prop (fun b => Tb (cpred b)) Tp Tx ha) => [hc hd _]. move: (erecdef_prop2 (fun b => Tb (cpred b)) Tp Tx ha) => he. split => //. move => i lim; move:(NS_lt_nat lim (proj2 (proj1 (proj1 ha)))) => iN. move: i iN lim; apply: Nat_induction1. move => i iN Hr lim. move:(he _ lim) => [ra rb rc]. case: (equal_or_not (P (Vg c i)) \0c) => az. move:(ra az) => [sa sb ->]. apply: (TS_base (proj31(cpred_pr6' (NS_esize ha) sa sb))). case: (equal_or_not (Q (Vg c i)) \0c) => bz. move:(rb bz) => [sa sb ->]; have sc := (proj33(cpred_pr6' iN sa sb)). apply:TS_powerset; apply: Hr => //; exact:(clt_ltT sc lim). move:(rc az bz) => [sa sb sa' sb' ->]. have sc := (proj33(cpred_pr6' iN sa sb)); have sd:= (clt_ltT sc lim). have sc' := (proj33(cpred_pr6' iN sa' sb')); have sd':= (clt_ltT sc' lim). by apply:TS_product; apply:Hr. Qed. Lemma ET_val1 c i (f := echelon_to_trees c): echelon c -> i <c (slength c) -> P (Vg c i) = \0c -> exists n, Q (Vg c i) = csucc (nat_to_B n) /\ Vg f i = Tree_to_tree (Tbase n). Proof. move => ha hb az. move: (echelon_to_trees_prop ha) => [_ _ hd hc]. move: (hc _ hb) => [he _ _] {hc}; move: (he az). move => [qa qb qc]. have bN:= (NS_le_nat qb (NS_esize ha)). move: (cpred_pr6' (NS_esize ha) qa qb) => [sa sb sc]. move:(nat_to_B_surjective sa) => [n nv]. by exists n; rewrite /f /= qc {1} sb nv. Qed. Lemma ET_val2 c i (f := echelon_to_trees c): echelon c -> i <c (slength c) -> Q (Vg c i) = \0c -> exists2 E, Tree_to_tree E = (Vl f (P (Vg c i))) & Tree_to_tree (Tpowerset E) = Vg f i. Proof. move => ha hb az. move: (echelon_to_trees_prop ha) => [_ _ hd hc]. move: (hc _ hb) => [_ he2 _] {hc}; move: (he2 az) => [qa qb qc] {he2}. have mN:= (proj2 (proj1 (proj1 ha))). have iN:= (NS_lt_nat hb mN). set a := P (Vg c i). move: (cpred_pr6' iN qa qb) => [sa sb sc]. move: (Tree_to_tree_surjective (hd _(clt_ltT sc hb))) => [e ev]. by exists e => //; rewrite /f qc /= /Vl ev. Qed. Lemma ET_val3 c i (f := echelon_to_trees c) (a := (P (Vg c i))) (b := Q (Vg c i)): echelon c -> i <c (slength c) -> a <> \0c -> b <> \0c -> exists E F, [ /\ Tree_to_tree E = Vl f a, Tree_to_tree F = Vl f b& Tree_to_tree (Tproduct E F) = Vg f i ]. Proof. move => ha hb az bz. move: (echelon_to_trees_prop ha) => [_ _ hd hc]. move: (hc _ hb) => [_ _ he3] {hc}; move: (he3 az bz) => []{he3}. rewrite -/a -/b => ha1 ha2 hb1 hb2 hf. have mN:= (proj2 (proj1 (proj1 ha))). have iN:= (NS_lt_nat hb mN). move: (cpred_pr6' iN ha1 ha2) => [sa sb sc]. move: (cpred_pr6' iN hb1 hb2) => [sa' sb' sc']. move: (Tree_to_tree_surjective (hd _(clt_ltT sc hb))) => [e ev]. move: (Tree_to_tree_surjective (hd _(clt_ltT sc' hb))) => [e' ev']. by exists e,e'; rewrite /f hf /Vl ev ev'. Qed. (** Evaluating an echelmon on a set *) Definition echelon_value c E := echelon_recdef (fun b => (Vl E b)) powerset product c. Definition echelon_of_base c E := Vl (echelon_value c E) (slength c). Lemma echelon_of_baseE c E: echelon_of_base c E = echelon_recdef_last (fun b => (Vl E b)) powerset product c. Proof. by []. Qed. Lemma echelon_value_prop c E i (m := slength c)(f := echelon_value c E) (n:= esize c): echelon c -> i <c m -> let a:= P (Vg c i) in let b := Q (Vg c i) in [/\ a = \0c -> [/\ \1c <=c b, b <=c n & Vg f i = (Vl E b)], b = \0c -> [/\ \1c <=c a, a <=c i & Vg f i = \Po (Vl f a) ] & a <> \0c -> b <> \0c -> [/\ \1c <=c a, a <=c i, \1c <=c b, b <=c i & Vg f i = (Vl f a) \times (Vl f b)]]. Proof. by move => h; apply:erecdef_prop2. Qed. Fixpoint Tree_value E e:= match e with | Tbase n => Vg E (nat_to_B n) | Tpowerset e' => \Po (Tree_value E e') | Tproduct e' e'' => (Tree_value E e') \times (Tree_value E e'') end. Definition tree_value E x := tree_rec (fun n => Vg E n) (fun t => \Po t) (fun t t' => t \times t') x. Lemma tree_value_prop E: [/\ (forall n, natp n -> tree_value E (Tb n) = Vg E n), (forall x, treep x -> tree_value E (Tp x) = \Po (tree_value E x))& (forall x y, treep x -> treep y -> tree_value E (Tx x y) = (tree_value E x) \times (tree_value E y))]. Proof. rewrite /tree_value;split. - by move => n nN; rewrite tree_recdef_pb'. - by move => t tp ; rewrite tree_recdef_pp. - by move => t t' tp tp' ; rewrite tree_recdef_px. Qed. Lemma Tree_value_compat E e: tree_value E (Tree_to_tree e) = Tree_value E e. Proof. move:(tree_value_prop E) => [ha hb hc]. have H0 x: treep (Tree_to_tree x) by case: (Tree_to_tree_prop x). elim:e. - by move => n /=; rewrite ha //; apply: nat_to_B_Nat. - by move => t h /=; rewrite -h hb //. - by move => t h t' h' /=; rewrite - h - h' hc //. Qed. Lemma tree_value_extent T E E': treep T -> (forall i, i<=c (tree_size T) -> Vg E i = Vg E' i) -> tree_value E T = tree_value E' T. Proof. set P := (tree_value_prop E) ; set P' := (tree_value_prop E'). move: T; apply:tree_ind. - move => n nN h. rewrite(proj31 P n nN) (proj31 P' n nN); apply: h. rewrite (proj31 tree_size_p _ nN); exact: (cleR (CS_nat nN)). - move => x tp h1; rewrite (proj32 tree_size_p x tp) => h2. by rewrite(proj32 P x tp) (proj32 P' x tp); rewrite (h1 h2). - move => x x' tp tp'. rewrite (proj33 tree_size_p x x' tp tp') => h1 h2 h3. rewrite (proj33 P x x' tp tp') (proj33 P' x x' tp tp'). move:(Nmax_p1 (NS_tree_size tp) (NS_tree_size tp'))=> [ma mb mc]. have q1: forall i, i <=c tree_size x -> Vg E i = Vg E' i. move => i li1; exact: (h3 _ (cleT li1 mb)). have q1': forall i, i <=c tree_size x' -> Vg E i = Vg E' i. move => i li1; exact: (h3 _ (cleT li1 mc)). by rewrite h1 // h2. Qed. Lemma echelon_of_base_of_tree t E: treep t -> echelon_of_base (tree_to_echelon t) E = tree_value E t. Proof. move:(tree_value_prop E) => [ha hb hc]. move: tree_to_echelon_E => [qa qb qc]. move: t;apply: tree_ind. - move => n nN. move:(NS_succ nN) (succ_positive n) => hu hv. rewrite (ha _ nN) (qa _ nN) echelon_of_baseE erecdef_base // /Vl. by rewrite (cpred_pr1 (CS_nat nN)). - move => x tx Hr. move:(tree_to_echelon_ok tx) => [sa sb sc]. by rewrite (qb _ tx) (hb _ tx) echelon_of_baseE erecdef_powerset // - Hr //. - move => x x' tx tx' Hx Hx'. move:(tree_to_echelon_ok tx) => [sa sb sc]. move:(tree_to_echelon_ok tx') => [sa' sb' sc']. rewrite (qc _ _ tx tx') (hc _ _ tx tx'). by rewrite echelon_of_baseE erecdef_product // -Hx// - Hx' //. Qed. Lemma tree_val_ne n E : (forall i, i <c n -> nonempty (Vg E i)) -> forall t, treep t -> tree_size t <c n -> nonempty(tree_value E t). Proof. move => hb. apply:tree_ind. + move => i iN. rewrite (proj31 tree_size_p i iN) (proj31 (tree_value_prop E) i iN). by apply: hb. + move => x tx _ _; rewrite (proj32 (tree_value_prop E) _ tx). by exists emptyset; apply: setP_0i. + move => x x' tx tx' hc hd. rewrite(proj33 tree_size_p _ _ tx tx')(proj33 (tree_value_prop E) _ _ tx tx'). move => he. move: (Nmax_p1 (NS_tree_size tx) (NS_tree_size tx')) => [sa sb sc]. move:(rep_i (hc (cle_ltT sb he))); set u := rep _ => e1. move:(rep_i (hd (cle_ltT sc he))); set v := rep _ => e2. by exists (J u v); apply: setXp_i. Qed. Lemma powerset_injective: injective powerset. Proof. move => x y eq1; apply:extensionality. by move:(setP_Ti x); rewrite eq1 => /setP_P. by move:(setP_Ti y); rewrite - eq1 => /setP_P. Qed. Lemma product_injective A B C D: nonempty (C \times D) -> A\times B = C\times D -> A = C /\ B = D. Proof. move => [x /setX_P [pa pb pc]] eq1. move: (setXp_i pb pc); rewrite - eq1 => /setXp_P [pd pe]. split; set_extens t => h. - by move:(setXp_i h pe); rewrite eq1; case /setXp_P. - by move:(setXp_i h pc); rewrite - eq1; case /setXp_P. - by move:(setXp_i pd h); rewrite eq1; case /setXp_P. - by move:(setXp_i pb h); rewrite - eq1; case /setXp_P. Qed. Lemma not_a_powerset3 x: \3c <> powerset x. Proof. move => h. have i12: inc \1c \2c by exact: set2_2. have: inc \2c \3c by apply/(NltP NS3); exact: (cltS NS2). rewrite h => /setP_P => h'; move: (h' _ i12) => h''. have : inc (singleton \1c) \3c by rewrite h; apply/setP_P => t /set1_P ->. rewrite /card_three (succ_of_nat NS2) => /setU1_P; case. have hx := (set1_1 \1c). case/set2_P => hy; move: hx; rewrite hy; first by move => /in_set0. by move /set1_P => hz; move:(set1_1 \0c); rewrite -/card_one hz => /in_set0. move => hy. move: (set2_1 \0c \1c). rewrite -/card_two -hy => /set1_P bad. by case: card1_nz. Qed. Lemma powerset_not_product x y z: powerset x <> y \times z. Proof. move => eq1. move:(setP_0i x); rewrite eq1 => /setX_pair. rewrite /pairp kpairE /kpair_def;set t := singleton _ => h. have /in_set0 //: inc t emptyset by rewrite - h; apply:set2_1. Qed. Lemma not_a_product1 x y: \1c <> x \times y. Proof. by rewrite /card_one - setP_0; exact:powerset_not_product. Qed. Lemma clt_3: [/\ \0c <c \3c, \1c <c \3c & \2c <c \3c]. Proof. have ha:=(cltS NS2). split; [ exact: (clt_ltT clt_02 ha) | exact: (clt_ltT clt_12 ha) | exact: ha]. Qed. Definition slist_good n m E := [/\ slistp E, slength E = csucc(cmax n m) & forall i, i <c slength E -> (Vg E i) = \1c \/ (Vg E i) = \3c ]. Lemma tree_value_injective t1 t2: treep t1 -> treep t2 -> (forall E, slist_good (tree_size t1) (tree_size t2) E -> tree_value E t1 = tree_value E t2) -> t1 = t2. Proof. move => ha hb hc. move: (Tree_to_tree_surjective ha) => [e ev]. move: (Tree_to_tree_surjective hb) => [e' ev']. rewrite ev ev'; f_equal. have: forall E, slist_good (nat_to_B (Tsize e)) (nat_to_B (Tsize e')) E -> Tree_value E e = Tree_value E e'. move => E; move: (hc E); rewrite ev ev'. move:(Tree_to_tree_prop e) =>[_ _ -> _]. move:(Tree_to_tree_prop e') =>[_ _ -> _]. rewrite !Tree_value_compat //. clear. have Ne1: nonempty \1c by exists \0c; apply:set1_1. move:clt_3 => [lt03 /proj2 ne13 _]. have Ne3: nonempty \3c by exists \0c; apply/(NltP NS3). have H0 n n' f: let m := (nat_to_B n) in let m' := (nat_to_B n') in let k := csucc (cmax m m') in let E := Lg k f in (forall i, i <c k -> (f i) = \1c \/ (f i) =\3c ) -> [/\ slist_good m m' E, Vg E m = f m & Vg E m' = f m']. simpl. move: (nat_to_B_Nat n) (nat_to_B_Nat n'). set m := nat_to_B n; set m' := nat_to_B n' => mN m'N fp. move: (Nmax_p1 mN m'N); set k := cmax _ _; move => [kN le1 le2]. have skN := NS_succ kN. have lt1: m <c csucc k by apply/(cltSleP kN). have lt1': m' <c csucc k by apply/(cltSleP kN). have p3: inc m (csucc k) by apply/(NltP skN). have p4: inc m' (csucc k) by apply/(NltP skN). have p5:slistp (Lg (csucc k) f) by split; aww. rewrite /slist_good /slength Lgd !LgV//; split => //; split => // i iln. move/(NltP skN):(iln) => iin; rewrite (LgV iin); exact: (fp _ iln). have HA n t: (forall E, slist_good (nat_to_B n) (nat_to_B (Tsize (Tpowerset t))) E -> Tree_value E (Tbase n) = Tree_value E (Tpowerset t)) -> False. move => H. set k := csucc (cmax (nat_to_B n) (nat_to_B (Tsize t))). have fp:(forall i, i <c k -> \3c = \1c \/ \3c = \3c) by move => _ _;right. move: (H0 n (Tsize (Tpowerset t)) _ fp) => [ra rb rc]. by move:(H _ ra); rewrite /= rb => /not_a_powerset3. have HB n t t': (forall E, slist_good (nat_to_B n) (nat_to_B (Tsize (Tproduct t t'))) E -> Tree_value E (Tbase n) = Tree_value E (Tproduct t t')) -> False. move => H. set k:=csucc (cmax (nat_to_B n) (nat_to_B (maxn (Tsize t) (Tsize t')))). have fp:(forall i, i <c k -> \1c = \1c \/ \1c = \3c) by move => _ _;left. move:(H0 n (Tsize (Tproduct t t')) _ fp) => [sa sb sc]. by move: (H _ sa); rewrite /= sb => /not_a_product1. have HC t t' t'' : (forall E, slist_good (nat_to_B (Tsize (Tpowerset t))) (nat_to_B (Tsize (Tproduct t' t''))) E -> Tree_value E (Tpowerset t) = Tree_value E (Tproduct t' t'')) -> False. set n := Tsize _; set n' := Tsize _ => H. set k := csucc (cmax (nat_to_B n) (nat_to_B n')). have fp:(forall i, i <c k -> \1c = \1c \/ \1c = \3c) by move => _ _;left. by move:(H0 n n' _ fp) => [/H /powerset_not_product]. have He n m E x: (slist_good n m E) -> nat_to_B (Tsize x) <c slength E -> nonempty (Tree_value E x). move => ha hb; move:(Tree_to_tree_prop x) => [ra _ rb _]. rewrite - rb in hb; rewrite - Tree_value_compat; apply: (tree_val_ne _ ra hb). by move => i ile; case: (proj33 ha _ ile) => ->. have Hf T E E': (forall i, i<=c (nat_to_B (Tsize T)) -> Vg E i = Vg E' i) -> Tree_value E T = Tree_value E' T. move => hi; rewrite - 2!Tree_value_compat. move:(Tree_to_tree_prop T) => [ra _ rb _]. by apply: (tree_value_extent ra); rewrite rb. pose ext E a b := Lg (csucc (cmax a b)) (fun z => Yo (z <c (slength E)) (Vg E z) \1c). have ext_p1 n m a b E: let E' := (ext E a b) in slist_good n m E -> natp a -> natp b -> slength E <=c csucc(cmax a b) -> [/\ slist_good a b E', a <c slength E', b <c slength E' & forall i, i <c (slength E) -> Vg E i = Vg E' i]. move => E' [ha hb hc] aN bN hd. move:(Nmax_p1 aN bN) => [ma mb mc]. set k := (csucc (cmax a b)). have le: slength (ext E a b) = k by rewrite /slength /ext; aw. have sa1: a <c slength (ext E a b) by rewrite le; apply/(cltSleP ma). have sb1: b <c slength (ext E a b) by rewrite le; apply/(cltSleP ma). have lex: slistp (ext E a b) by rewrite /slistp/ext; aw; split;fprops. have he:slist_good a b (ext E a b). split => //. rewrite le => i il. have ii:inc i k by apply /(NltP (NS_succ ma)). rewrite /ext LgV//; Ytac hi;[ by apply:hc | by left ]. split => // i il. have ii:inc i (slength E) by apply /(NltP (proj2 ha)). have ii2:inc i k by apply /(NltP (NS_succ ma)); exact:(clt_leT il hd). by rewrite /E'/ext LgV//; Ytac0; done. have mc n m: cmax (nat_to_B n) (nat_to_B m) = cmax (nat_to_B m) (nat_to_B n). by rewrite - ! nat_to_B_max maxnC. elim: e e'. - move => n e. case:e. + move => n' H. set m := (nat_to_B n). case: (equal_or_not (nat_to_B n') m) => mm. by rewrite (nat_to_B_injective mm). set k := csucc (cmax (nat_to_B n) (nat_to_B n')). have hf:(forall i, i <c k -> variant m \1c \3c i = \1c \/ variant m \1c \3c i = \3c). by move => i _; rewrite/variant; Ytac w; [left | right]. move: (H0 n n' _ hf) => [/H sa sb sc]. move: sa; rewrite /= sb sc. by rewrite (variant_true _ _ (erefl _ )) (variant_false _ _ mm) => /ne13. + move => t h; case: (HA n t h). + move => t t' h; case: (HB n t t' h). - move => t h; case. + move => n /= h1; case: (HA n t) => E [ ea eb ec]; rewrite /= h1 //. by move: eb; rewrite /= mc => eb. + move => t' /= ha; rewrite (h t') // => E ev. exact:(powerset_injective (ha _ ev)). + move => t' t'' h1; case:(HC _ _ _ h1). - move => t ht t' ht'; case. + move => n H; case: (HB n t t') => E [ea eb ec]. by rewrite mc in eb; rewrite H. + move => t'' h; case: (HC t'' t t') => E [ea eb ec]. by rewrite mc in eb; rewrite h. + move => t2 t3 /=. set l1 := maxn _ _; set l2 := maxn _ _; set l3 := maxn l1 l2 => h. move: (nat_to_B_Nat l1)(nat_to_B_Nat l2) => l1N l2N. have ->: t = t2. apply: ht => E ep. move: (ep) => [p0 p1 p2]. have se: slength E <=c csucc (cmax (nat_to_B l1) (nat_to_B l2)). rewrite p1; apply /cleSS; rewrite /l1 /l2 - 2!nat_to_B_max maxnACA. by apply/nat_to_B_le; apply: leq_maxl. have se2: nat_to_B (Tsize t) <c slength E. rewrite p1 -nat_to_B_max nat_to_B_succ; apply/nat_to_B_lt. by rewrite ltnS leq_maxl. have se3: nat_to_B (Tsize t2) <c slength E. rewrite p1 -nat_to_B_max nat_to_B_succ; apply/nat_to_B_lt. by rewrite ltnS leq_maxr. move: (ext_p1 _ _ _ _ _ ep l1N l2N se). set E' := ext _ _ _; move => [sa sb sc sd]. have pa:forall i, i <=c nat_to_B (Tsize t) -> Vg E i = Vg E' i. by move => i lin; apply: sd; exact:(cle_ltT lin se2). have pb:forall i, i <=c nat_to_B (Tsize t2) -> Vg E i = Vg E' i. move => i lin; apply: sd; exact:(cle_ltT lin se3). move: (product_injective (He _ _ _ (Tproduct t2 t3) sa sc) (h _ sa)). by rewrite -/(Tree_value _) (Hf t E E' pa) (Hf t2 E E' pb); case. have -> //: t' = t3. apply: ht' => E ep. move: (ep) => [p0 p1 p2]. have se: slength E <=c csucc (cmax (nat_to_B l1) (nat_to_B l2)). rewrite p1; apply /cleSS; rewrite /l1 /l2 - 2!nat_to_B_max maxnACA. by apply/nat_to_B_le; apply: leq_maxr. have se2: nat_to_B (Tsize t') <c slength E. rewrite p1 -nat_to_B_max nat_to_B_succ; apply/nat_to_B_lt. by rewrite ltnS leq_maxl. have se3: nat_to_B (Tsize t3) <c slength E. rewrite p1 -nat_to_B_max nat_to_B_succ; apply/nat_to_B_lt. by rewrite ltnS leq_maxr. move: (ext_p1 _ _ _ _ _ ep l1N l2N se). set E' := ext _ _ _; move => [sa sb sc sd]. have pa:forall i, i <=c nat_to_B (Tsize t') -> Vg E i = Vg E' i. by move => i lin; apply: sd; move:(cle_ltT lin se2). have pb:forall i, i <=c nat_to_B (Tsize t3) -> Vg E i = Vg E' i. by move => i lin; apply: sd; move:(cle_ltT lin se3). move: (product_injective (He _ _ _ (Tproduct t2 t3) sa sc) (h _ sa)). by rewrite -/(Tree_value _) (Hf t' E E' pa)(Hf t3 E E' pb); case. Qed. Lemma tree_value_commutes E c (f := echelon_value c E) (t :=echelon_to_trees c) (g := Lg (domain c) (fun i => (tree_value E (Vg t i)))): echelon c -> f = g. Proof. move => ec; symmetry. have mN:= (proj2(proj1(proj1 ec))). move:(echelon_to_trees_prop ec); rewrite -/t; move => [ta tb tc td]. have ha: domain g = slength c by rewrite /g; aw. have ndg: natp (domain g) by rewrite ha. have hb: slistpl g (slength c) by split => //; split => //; rewrite /g; fprops. apply: (erecdef_unique1 ec hb). move => i il; move:(td _ il) => /= [ua ub uc]. have idc: inc i (domain c) by apply/(NltP mN). have iN:= (NS_lt_nat il mN). split. - move => w; move:(ua w) =>[sa sb sc]; rewrite /g LgV// sc. rewrite (proj31 (tree_value_prop E)) //. exact: (proj31(cpred_pr6' (NS_esize ec) sa sb)). - move => w; move: (ub w) => [sa sb sc]. move:(cpred_pr6' iN sa sb)=> [pa pb pc]. have lt2:= (clt_ltT pc il). have cpd: inc (cpred (P (Vg c i))) (domain c) by apply/(NltP mN). rewrite /g /Vl LgV// LgV// sc// (proj32 (tree_value_prop E)) //. by apply: tc. - move => w1 w2;move: (uc w1 w2) => [sa sb sa' sb' sc]. move:(cpred_pr6' iN sa sb)=> [pa pb pc]. move:(cpred_pr6' iN sa' sb')=> [pa' pb' pc']. have lt2:= (clt_ltT pc il). have cpd: inc (cpred (P (Vg c i))) (domain c) by apply/(NltP mN). have lt2':= (clt_ltT pc' il). have cpd': inc (cpred (Q (Vg c i))) (domain c) by apply/(NltP mN). rewrite /g /Vl LgV// LgV// LgV//. by rewrite sc// (proj33 (tree_value_prop E) _ _ (tc _ lt2) (tc _ lt2')). Qed. Definition echelon_to_tree c := Vl (echelon_to_trees c) (slength c). Lemma tree_value_commmute_bis E c1 c2: echelon c1 -> echelon c2 -> \0c <c slength c1 -> \0c <c slength c2 -> echelon_to_tree c1 = echelon_to_tree c2 -> echelon_of_base c1 E = echelon_of_base c2 E. Proof. move => ha hb z1 z2. have i1: inc (cpred (slength c1)) (domain c1). move: (proj2 (proj1 (proj1 ha))) => lN. apply/(NltP lN); exact:(cpred_lt lN (nesym (proj2 z1))). have i2: inc (cpred (slength c2)) (domain c2). move: (proj2 (proj1 (proj1 hb))) => lN. apply/(NltP lN); exact:(cpred_lt lN (nesym (proj2 z2))). move: (tree_value_commutes E ha). move: (tree_value_commutes E hb). rewrite /echelon_of_base /echelon_to_tree /Vl. by move => -> ->; rewrite !LgV//; move => -> //. Qed. (* Example *) Lemma cpred2: cpred \2c = \1c. Proof. by rewrite - succ_one (cpred_pr1 CS1). Qed. Lemma cpred3: cpred \3c = \2c. Proof. by rewrite (cpred_pr1 (CS_nat NS2)). Qed. Lemma cpred4: cpred \4c = \3c. Proof. by rewrite (cpred_pr1 (CS_nat NS3)). Qed. Lemma cpred5: cpred \5c = \4c. Proof. by rewrite (cpred_pr1 (CS_nat NS4)). Qed. Lemma cpred6: cpred \6c = \5c. Proof. by rewrite (cpred_pr1 (CS_nat NS5)). Qed. Lemma clt_4: [/\ \0c <c \4c, \1c <c \4c, \2c <c \4c & \3c <c \4c]. Proof. by have hd:=(cltS NS3);move:clt_3 => [ha hb hc]; split => //; apply: clt_ltT hd. Qed. Lemma clt_5: [/\ \0c <c \5c, \1c <c \5c, \2c <c \5c, \3c <c \5c & \4c <c \5c ]. Proof. have he:=(cltS NS4);move:clt_4 => [ha hb hc hd]. by split => //; apply: clt_ltT he. Qed. Lemma clt_6: [/\ \0c <c \6c, \1c <c \6c, \2c <c \6c, \3c <c \6c & \4c <c \6c /\ \5c <c \6c]. Proof. have hf:=(cltS NS5);move:clt_5 => [ha hb hc hd he]. move: (clt_ltT ha hf) (clt_ltT hb hf) (clt_ltT hc hf) => ra rb rc. move: (clt_ltT hd hf) (conj (clt_ltT he hf) hf)=> rd re. done. Qed. Definition slist1 a:= Lg \1c (fun z => a). Lemma slist1_prop a (s := slist1 a): slistpl s \1c /\ Vg s \0c = a. Proof. have i01 := set1_1 \0c. have h: slistp (Lg \1c (fun _ : Set => a)) by split; aw;fprops. by rewrite/s/slistpl/slist1 /slength Lgd !LgV. Qed. Definition slist2 a b := Lg \2c (fun z => Yo (z = \0c) a b). Lemma slist2_prop a b (c:= slist2 a b): [/\ slistpl c \2c, Vg c \0c = a & Vg c \1c = b]. Proof. have fgE: fgraph c by apply: Lg_fgraph. have dE: domain c = \2c by exact: Lgd. have le: slistp c by split; [ exact | rewrite dE; exact NS2 ]. have sa:inc \1c \2c by apply /(NltP NS2); exact: clt_12. have sb:inc \0c \2c by apply /(NltP NS2); exact: clt_02. have sc:=card1_nz. by split => //;rewrite ?(LgV sa) ?(LgV sb); Ytac0. Qed. Definition slist6 a b c d e f:= Lg \6c (fun z => Yo (z = \0c) a (Yo (z = \1c) b (Yo (z = \2c) c (Yo (z = \3c) d (Yo (z = \4c) e f))))). Lemma slist6_prop a b c d e f (E:= slist6 a b c d e f): [/\ slistpl E \6c, Vg E \0c = a, Vg E \1c = b & [/\ Vg E \2c = c, Vg E \3c = d , Vg E \4c = e & Vg E \5c = f ]]. Proof. move: NS0 NS1 NS2 NS3 NS4 NS5 NS6 => ns0 ns1 ns2 ns3 ns4 ns5 ns6. have fgE: fgraph E by apply: Lg_fgraph. have dE: domain E = \6c by exact: Lgd. have lE: slistp E by split => //; rewrite dE. move:(clt_6) => [l06 l16 l26 l36 [l46 l56]]. have i06: inc \0c \6c by apply/(NltP ns6). have i16: inc \1c \6c by apply/(NltP ns6). have i26: inc \2c \6c by apply/(NltP ns6). have i36: inc \3c \6c by apply/(NltP ns6). have i46: inc \4c \6c by apply/(NltP ns6). have i56: inc \5c \6c by apply/(NltP ns6). split => //. - by rewrite (LgV i06); Ytac0. - by rewrite (LgV i16) (Y_false(nesym (proj2 clt_01))); Ytac0. - split. - rewrite (LgV i26) (Y_false(nesym (proj2 clt_02))). by rewrite (Y_false(nesym (proj2 clt_12))); Ytac0. - move:clt_3 => [lt03 lt13 lt23]. rewrite (LgV i36) (Y_false(nesym (proj2 lt03))). rewrite (Y_false(nesym (proj2 lt13))). by rewrite (Y_false(nesym (proj2 lt23))); Ytac0. - move:clt_4 => [lt04 lt14 lt24 lt34]. rewrite (LgV i46) (Y_false(nesym (proj2 lt04))). rewrite (Y_false(nesym (proj2 lt14))). rewrite (Y_false(nesym (proj2 lt24))). by rewrite (Y_false(nesym (proj2 lt34))); Ytac0. - move:clt_5 => [lt05 lt15 lt25 lt35 lt45]. rewrite (LgV i56) (Y_false(nesym (proj2 lt05))). rewrite (Y_false(nesym (proj2 lt15))). rewrite (Y_false(nesym (proj2 lt25))). rewrite (Y_false(nesym (proj2 lt35))). by rewrite (Y_false(nesym (proj2 lt45))). Qed. Definition scheme_ex1 := slist6 (J \0c \1c) (J \0c \2c) (J \1c \0c) (J \3c \0c) (J \2c \0c) (J \4c \5c). Definition scheme_ex2 := slist6 (J \0c \2c) (J \0c \1c) (J \1c \0c) (J \2c \0c) (J \4c \0c) (J \5c \3c). Lemma scheme_ex1_ok1 (E := scheme_ex1): [/\ echelon E, slength E = \6c, esize E = \2c & [/\ Vg E \0c = J \0c \1c, Vg E \1c = J \0c \2c, Vg E \2c = J \1c \0c, Vg E \3c = J \3c \0c& (Vg E \4c =J \2c \0c /\ Vg E \5c =J \4c \5c) ]]. Proof. move: NS0 NS1 NS2 NS3 NS4 NS5 NS6 => ns0 ns1 ns2 ns3 ns4 ns5 ns6. move: (slist6_prop (J \0c \1c) (J \0c \2c) (J \1c \0c) (J \3c \0c) (J \2c \0c) (J \4c \5c)). rewrite /= -/ scheme_ex1 -/E. move => [[ha sE] E0 E1 [E2 E3 E4 E5]]. have rE:slist_E E (Nat \times Nat). split; first exact. move => i /Lg_range_P [b bN ->]; Ytac h1;first by apply:setXp_i. Ytac h2; first by apply:setXp_i. Ytac h3; first by apply:setXp_i. Ytac h4; first by apply:setXp_i. by Ytac h5; apply:setXp_i. move:clt_5 => [lt05 lt15 lt25 lt35 lt45]. move:clt_4 => [lt04 lt14 lt24 lt34]. move:clt_3 => [lt03 lt13 lt23]. move: (proj1 clt_12) => cle_12. have EE: echelon E. split => //; rewrite sE => i /(cltSleP ns5) /cle_eqVlt;case. move: (proj1 lt14) (proj1 lt45) (proj1 lt15) => ua ub uc. have ra: ech_good \4c \5c by split. have rb: ech_good \5c \5c by split; fprops. by move => ->; rewrite E5; simpl; aw. move /(cltSleP ns4) /cle_eqVlt;case. have hb:=(proj1 lt24). by move => ->; rewrite E4 /=; aw; split. move /(cltSleP ns3) /cle_eqVlt;case. move => ->; rewrite E3 /=; saw; last by case. split; [ exact: (proj1 lt13) | fprops]. move /(cltSleP ns2) /cle_eqVlt;case. move => ->; rewrite E2 /=; aw ; split => // _; split; fprops. case /clt2 => ->. by move: (card1_nz) => ra; rewrite E0 /=; saw. by move: (card2_nz) => ra; rewrite E1 /=; saw. split => //. move:(clt_6) => [l06 l16 l26 l36 [l46 l56]]. have sp: \0c <c slength E by rewrite sE. move: (esize_prop1 EE sp); set n := esize E. move => [ra rb rc rd]. apply: cleA; last first. have ww: \1c <c slength E by ue. by move: (rd _ ww); rewrite E1; aw; apply. move: rc =>[j]; rewrite sE;move /(cltSleP ns5) /cle_eqVlt;case. move ->; rewrite E5 => /(f_equal P); aw => e40. by case:(proj2 lt04). move /(cltSleP ns4) /cle_eqVlt;case. by move => ->; rewrite E4 => /(f_equal P); aw => z2; case: (card2_nz). move /(cltSleP ns3) /cle_eqVlt;case. move => ->; rewrite E3 => /(f_equal P); aw => z3. by case:(proj2 lt03). move /(cltSleP ns2) /cle_eqVlt;case. by move => ->; rewrite E2 => /(f_equal P); aw => z3; case: card1_nz. case /clt2 => ->; rewrite ?E0 ? E1; move /(f_equal Q); aw => <-; fprops. Qed. Lemma scheme_ex2_ok1 (E := scheme_ex2): [/\ echelon E, slength E = \6c, esize E = \2c & [/\ Vg E \0c = J \0c \2c, Vg E \1c = J \0c \1c, Vg E \2c = J \1c \0c, Vg E \3c = J \2c \0c& (Vg E \4c =J \4c \0c /\ Vg E \5c =J \5c \3c) ]]. Proof. move: NS0 NS1 NS2 NS3 NS4 NS5 NS6 => ns0 ns1 ns2 ns3 ns4 ns5 ns6. move: (slist6_prop (J \0c \2c) (J \0c \1c) (J \1c \0c) (J \2c \0c) (J \4c \0c) (J \5c \3c)). rewrite /= -/ scheme_ex2 -/E. move => [[ha sE] E0 E1 [E2 E3 E4 E5]]. have rE:slist_E E (Nat \times Nat). split; first exact. move => i /Lg_range_P [b bN ->]; Ytac h1;first by apply:setXp_i. Ytac h2; first by apply:setXp_i. Ytac h3; first by apply:setXp_i. Ytac h4; first by apply:setXp_i. by Ytac h5; apply:setXp_i. move:clt_5 => [lt05 lt15 lt25 lt35 lt45]. move:clt_4 => [lt04 lt14 lt24 lt34]. move:clt_3 => [lt03 lt13 lt23]. move: (proj1 clt_12) => cle_12. have EE: echelon E. split => //; rewrite sE => i /(cltSleP ns5) /cle_eqVlt;case. move: (proj1 lt13) (proj1 lt35) (proj1 lt15) => ua ub uc. have ra:ech_good \3c \5c by split. have rb: ech_good \5c \5c by split; fprops. by move => ->; rewrite E5; simpl; aw. move /(cltSleP ns4) /cle_eqVlt;case. move => ->; rewrite E4 /=; aw; split => // _. split; [ exact: (proj1 lt14) | fprops]. move /(cltSleP ns3) /cle_eqVlt;case. move => ->; rewrite E3 /=; aw; split => //_. split; [ exact | exact: (proj1 lt23)]. move /(cltSleP ns2) /cle_eqVlt;case. move => ->; rewrite E2 /=; aw ; split => //_; split; fprops. case /clt2 => ->. by move: (card2_nz) => ra; rewrite E0 /=; aw; split. by move: (card1_nz) => ra; rewrite E1 /=; aw; split. split => //. move:(clt_6) => [l06 l16 l26 l36 [l46 l56]]. have sp: \0c <c slength E by rewrite sE. move: (esize_prop1 EE sp); set n := esize E. move => [ra rb rc rd]. apply: cleA; last first. have ww: \0c <c slength E by ue. by move: (rd _ ww); rewrite E0; aw; apply. move: rc =>[j]; rewrite sE;move /(cltSleP ns5) /cle_eqVlt;case. move ->; rewrite E5 => /(f_equal P); aw => e50. by case:(proj2 lt05). move /(cltSleP ns4) /cle_eqVlt;case. move => ->; rewrite E4 => /(f_equal P); aw => e40. by case:(proj2 lt04). move /(cltSleP ns3) /cle_eqVlt;case. by move => ->; rewrite E3 => /(f_equal P); aw => /card2_nz. move /(cltSleP ns2) /cle_eqVlt;case. by move => ->; rewrite E2 => /(f_equal P); aw => z3; case: card1_nz. case /clt2 => ->; rewrite ?E0 ? E1; move /(f_equal Q); aw => <-; fprops. Qed. Definition Tree6 := echelon_to_trees scheme_ex1. Definition Tree6' := echelon_to_trees scheme_ex2. Lemma tree6_1: [/\ Vg Tree6 \0c = Tree_to_tree (Tbase 0), Vg Tree6 \1c = Tree_to_tree (Tbase 1), Vg Tree6 \2c = Tree_to_tree (Tpowerset (Tbase 0)), Vg Tree6 \3c = Tree_to_tree (Tpowerset (Tpowerset (Tbase 0))) & Vg Tree6 \4c = Tree_to_tree (Tpowerset (Tbase 1)) /\ Vg Tree6 \5c = Tree_to_tree (Tproduct (Tpowerset (Tpowerset (Tbase 0))) (Tpowerset (Tbase 1)))]. Proof. move: scheme_ex1_ok1 => [ha hb hc [v0 v1 v2 v3 [v4 v5]]]. move:(clt_6) => [lt06 lt16 lt26 lt36 [lt46 lt56]]. have V0: (Vg Tree6 \0c) = Tree_to_tree (Tbase 0). have ra: \0c <c slength (scheme_ex1) by rewrite hb. move: (ET_val1 ha ra); rewrite v0; aw => zz; move: (zz (erefl \0c)). move => [n [na ->]]. have: nat_to_B 1 = nat_to_B n.+1 by rewrite /= succ_zero na. move/nat_to_B_injective => /eqP; rewrite eqSS => /eqP <- //. have V1: Vg Tree6 \1c = Tree_to_tree (Tbase 1). have ra: \1c <c slength (scheme_ex1) by rewrite hb; exact:lt16. move: (ET_val1 ha ra); rewrite v1; aw => zz; move: (zz (erefl \0c)). move => [n [na ->]]. have: nat_to_B 2 = nat_to_B n.+1 by rewrite /= succ_zero succ_one na. by move/nat_to_B_injective => /eqP; rewrite eqSS => /eqP <-. have V2: (Vg Tree6 \2c) = Tree_to_tree (Tpowerset (Tbase 0)). have ra: \2c <c slength (scheme_ex1) by rewrite hb. move: (ET_val2 ha ra); rewrite v2; aw => zz; move: (zz (erefl \0c)). by move => [E]; rewrite /Vl cpred1 V0 => /Tree_to_tree_injective ->. have V3: (Vg Tree6 \3c) = Tree_to_tree (Tpowerset (Tpowerset (Tbase 0))). have ra: \3c <c slength (scheme_ex1) by rewrite hb. move: (ET_val2 ha ra); rewrite v3; aw => zz; move: (zz (erefl \0c)). move => [E ]; rewrite /Vl. by rewrite -/Tree6 /Vl cpred3 V2 => /Tree_to_tree_injective ->. have V4: (Vg Tree6 \4c) = Tree_to_tree (Tpowerset (Tbase 1)). have ra: \4c <c slength (scheme_ex1) by rewrite hb. move: (ET_val2 ha ra); rewrite v4; aw => zz; move: (zz (erefl \0c)). by move => [E]; rewrite /Vl cpred2 V1 => /Tree_to_tree_injective ->. have V5: (Vg Tree6 \5c) = Tree_to_tree (Tproduct(Tpowerset(Tpowerset (Tbase 0))) (Tpowerset (Tbase 1))). have ra: \5c <c slength (scheme_ex1) by rewrite hb. move: (ET_val3 ha ra); rewrite v5; aw => zz. move: (zz (@succ_nz \3c) (@succ_nz \4c)). rewrite -/Tree6 /Vl cpred4 cpred5 V3 V4; move=> [E [F []]]. move=> /Tree_to_tree_injective -> /Tree_to_tree_injective -> //. done. Qed. Lemma tree6_2: echelon_to_tree scheme_ex1 = echelon_to_tree scheme_ex2. Proof. move: scheme_ex2_ok1 => [ha hb hc [v0 v1 v2 v3 [v4 v5]]]. move: scheme_ex1_ok1 => [_ hb' _ _]. suff: (Vg Tree6' \5c) = (Vg Tree6 \5c). by rewrite /echelon_to_tree /Vl hb hb' (cpred_pr1 (CS_nat NS5)). move: tree6_1 => [_ _ _ _ [ _ ->]]. move:(clt_6) => [lt06 lt16 lt26 lt36 [lt46 lt56]]. have V0: (Vg Tree6' \0c) = Tree_to_tree (Tbase 1). have ra: \0c <c slength (scheme_ex2) by rewrite hb. move: (ET_val1 ha ra); rewrite v0; aw => zz; move: (zz (erefl \0c)). move => [n [na ->]]. have: nat_to_B 2 = nat_to_B n.+1 by rewrite /= succ_zero succ_one na. by move/nat_to_B_injective => /eqP; rewrite eqSS => /eqP <- //. have V1: (Vg Tree6' \1c) = Tree_to_tree (Tbase 0). have ra: \1c <c slength (scheme_ex2) by rewrite hb. move: (ET_val1 ha ra); rewrite v1; aw => zz; move: (zz (erefl \0c)). move => [n [na ->]]. have: nat_to_B 1 = nat_to_B n.+1 by rewrite /= succ_zero na. by move/nat_to_B_injective => /eqP; rewrite eqSS => /eqP <- //. have V2: (Vg Tree6' \2c) = Tree_to_tree (Tpowerset (Tbase 1)). have ra: \2c <c slength (scheme_ex2) by rewrite hb. move: (ET_val2 ha ra); rewrite v2; aw => zz; move: (zz (erefl \0c)). by move => [E]; rewrite /Vl cpred1 V0 => /Tree_to_tree_injective ->. have V3: (Vg Tree6' \3c) = Tree_to_tree (Tpowerset (Tbase 0)). have ra: \3c <c slength (scheme_ex2) by rewrite hb. move: (ET_val2 ha ra); rewrite v3; aw => zz; move: (zz (erefl \0c)). move => [E ]; rewrite /Vl. by rewrite -/Tree6 /Vl cpred2 V1 => /Tree_to_tree_injective ->. have V4: (Vg Tree6' \4c) = Tree_to_tree (Tpowerset (Tpowerset (Tbase 0))). have ww: (cpred \4c) = \3c by rewrite (cpred_pr1 (CS_nat NS3)). have ra: \4c <c slength (scheme_ex2) by rewrite hb. move: (ET_val2 ha ra); rewrite v4; aw => zz; move: (zz (erefl \0c)). by move => [E]; rewrite /Vl ww V3 => /Tree_to_tree_injective ->. have ra: \5c <c slength (scheme_ex2) by rewrite hb. move: (ET_val3 ha ra); rewrite v5; aw => zz. move: (zz (@succ_nz \4c) (@succ_nz \2c)). rewrite -/Tree6 /Vl cpred3 cpred5 V2 V4; move=> [E [F []]]. move=> /Tree_to_tree_injective -> /Tree_to_tree_injective -> //. Qed. (* -- *) Definition scheme_val1 U V:= slist6 U V (\Po U) (\Po(\Po U)) (\Po V) ((\Po(\Po U)) \times (\Po V)). Lemma echelon_ex1_value U V: echelon_value scheme_ex1 (slist2 U V) = scheme_val1 U V. Proof. move: scheme_ex1_ok1=> [sa sb sc [E0 E1 E2 E3 [E4 E5]]]. move:(slist2_prop U V) => [[ra rb] rU rV]. move: (slist6_prop U V (\Po U) (\Po(\Po U)) (\Po V) ((\Po(\Po U)) \times (\Po V))). rewrite /= -/(scheme_val1 U V); set F := (scheme_val1 U V). move => [[Fl Fs] F0 F1 [F2 F3 F4 F5]]. have ss: slength F = slength scheme_ex1 by rewrite Fs sb. symmetry;apply: (erecdef_unique1 sa (conj Fl ss)). move: (@succ_nz \2c) (@succ_nz \3c) (@succ_nz \4c) => aa ab ac. have ad:= card2_nz. have ae:= card1_nz. have cp1: (cpred \1c) = \0c by rewrite cpred1. have cp2: (cpred \2c) = \1c by rewrite -(cpred_pr2 NS1) succ_one. have cp3: (cpred \3c) = \2c by apply: (cpred_pr2 NS2). have cp4: (cpred \4c) = \3c by apply: (cpred_pr2 NS3). have cp5: (cpred \5c) = \4c by apply: (cpred_pr2 NS4). rewrite sb => i /(cltSleP NS5) /cle_eqVlt;case. move => -> /=; rewrite E5 F5; aw. by split => //; rewrite /Vl cp4 cp5 F3 F4. move /(cltSleP NS4) /cle_eqVlt;case. move => -> /=; rewrite E4; aw; split => //. by rewrite /Vl cp2 F4 F1. move /(cltSleP NS3) /cle_eqVlt;case. move => -> /=; rewrite E3; aw; split => //. by rewrite /Vl cp3 F3 F2. move /(cltSleP NS2) /cle_eqVlt;case. move: card1_nz => z1;move => -> /=; rewrite E2; aw; split => //. by rewrite /Vl cp1 F2 F0. case /clt2 => -> /=. by rewrite E0; aw; split => //; rewrite F0 /Vl cp1 rU. by rewrite E1; aw; split => //; rewrite F1 /Vl cp2 rV. Qed. Lemma echelon_of_base_ex1 U V: echelon_of_base scheme_ex1 (slist2 U V) = ((\Po(\Po U)) \times (\Po V)). Proof. rewrite /echelon_of_base (echelon_ex1_value U V). move: scheme_ex1_ok1 => [ha hb hc _]. rewrite hb /Vl (cpred_pr2 NS5). move: (slist6_prop U V (\Po U) (\Po(\Po U)) (\Po V) ((\Po(\Po U)) \times (\Po V))) => [ _ _ _ [_ _ _]]. done. Qed. (** Canonical extensions *) Definition echelon_extension c f := echelon_recdef (Vl f) extension_to_parts ext_to_prod c. Definition echelon_can_extension c f := Vl (echelon_extension c f) (slength c). Lemma echelon_can_extensionE c f: echelon_can_extension c f = echelon_recdef_last (Vl f) extension_to_parts ext_to_prod c. Proof. by []. Qed. Lemma Eextension_prop c f i (m := slength c)(g := echelon_extension c f) (n:= esize c): echelon c -> i <c m -> let a:= P (Vg c i) in let b := Q (Vg c i) in [/\ a = \0c -> [/\ \1c <=c b, b <=c n & Vg g i = (Vl f b)], b = \0c -> [/\ \1c <=c a, a <=c i & Vg g i = \Pof (Vl g a) ] & a <> \0c -> b <> \0c -> [/\ \1c <=c a, a <=c i, \1c <=c b, b <=c i & Vg g i = (Vl g a) \ftimes (Vl g b)]]. Proof. by move => h; apply:erecdef_prop2. Qed. Definition tree_extension f x := tree_rec (fun n => Vg f n) (fun t => extension_to_parts t) (fun t t' => ext_to_prod t t') x. Lemma tree_extension_prop f: [/\ (forall n, natp n -> tree_extension f (Tb n) = Vg f n), (forall x, treep x -> tree_extension f (Tp x) = \Pof (tree_extension f x))& (forall x y, treep x -> treep y -> tree_extension f (Tx x y) = (tree_extension f x) \ftimes (tree_extension f y))]. Proof. rewrite /tree_extension;split. - by move => n nN; rewrite tree_recdef_pb'. - by move => t tp ; rewrite tree_recdef_pp. - by move => t t' tp tp' ; rewrite tree_recdef_px. Qed. Lemma tree_extension_commutes f c (t :=echelon_to_trees c) (g := Lg (domain c) (fun i => (tree_extension f (Vg t i)))): echelon c -> (echelon_extension c f) = g. Proof. move => ec; symmetry. have mN:= (proj2(proj1(proj1 ec))). move:(echelon_to_trees_prop ec); rewrite -/t; move => [ta tb tc td]. have ha: domain g = slength c by rewrite /g; aw. have ndg: natp (domain g) by rewrite ha. have hb: slistpl g (slength c) by split => //; split => //; rewrite /g; fprops. apply: (erecdef_unique1 ec hb). move => i il; move:(td _ il) => /= [ua ub uc]. have idc: inc i (domain c) by apply/(NltP mN). have iN:= (NS_lt_nat il mN). split. - move => w; move:(ua w) =>[sa sb sc]; rewrite /g LgV// sc. rewrite (proj31 (tree_extension_prop f)) //. exact: (proj31(cpred_pr6' (NS_esize ec) sa sb)). - move => w; move: (ub w) => [sa sb sc]. move:(cpred_pr6' iN sa sb)=> [pa pb pc]. have lt2:= (clt_ltT pc il). have cpd: inc (cpred (P (Vg c i))) (domain c) by apply/(NltP mN). rewrite /g /Vl LgV// LgV// sc// (proj32 (tree_extension_prop f)) //. by apply: tc. - move => w1 w2;move: (uc w1 w2) => [sa sb sa' sb' sc]. move:(cpred_pr6' iN sa sb)=> [pa pb pc]. move:(cpred_pr6' iN sa' sb')=> [pa' pb' pc']. have lt2:= (clt_ltT pc il). have cpd: inc (cpred (P (Vg c i))) (domain c) by apply/(NltP mN). have lt2':= (clt_ltT pc' il). have cpd': inc (cpred (Q (Vg c i))) (domain c) by apply/(NltP mN). rewrite /g /Vl LgV // LgV// LgV//. by rewrite sc// (proj33 (tree_extension_prop f) _ _ (tc _ lt2) (tc _ lt2')). Qed. Lemma tree_extension_commmute_bis E c1 c2: echelon c1 -> echelon c2 -> \0c <c slength c1 -> \0c <c slength c2 -> echelon_to_tree c1 = echelon_to_tree c2 -> echelon_can_extension c1 E = echelon_can_extension c2 E. Proof. move => ha hb z1 z2. have i1: inc (cpred (slength c1)) (domain c1). move: (proj2 (proj1 (proj1 ha))) => lN. apply/(NltP lN); exact:(cpred_lt lN (nesym (proj2 z1))). have i2: inc (cpred (slength c2)) (domain c2). move: (proj2 (proj1 (proj1 hb))) => lN. apply/(NltP lN); exact:(cpred_lt lN (nesym (proj2 z2))). move: (tree_extension_commutes E ha). move: (tree_extension_commutes E hb). rewrite /echelon_can_extension /echelon_to_tree /Vl. by move => -> ->; rewrite !LgV//; move => -> //. Qed. Lemma can_extension_of_tree t E: treep t -> echelon_can_extension (tree_to_echelon t) E = tree_extension E t. Proof. move:(tree_extension_prop E) => [ha hb hc]. move: tree_to_echelon_E => [qa qb qc]. move: t;apply: tree_ind. - move => n nN. move:(NS_succ nN) (succ_positive n) => hu hv. rewrite (ha _ nN) (qa _ nN) echelon_can_extensionE erecdef_base // /Vl. by rewrite (cpred_pr1 (CS_nat nN)). - move => x tx Hr. move:(tree_to_echelon_ok tx) => [sa sb sc]. by rewrite (qb _ tx)(hb _ tx) echelon_can_extensionE erecdef_powerset// - Hr //. - move => x x' tx tx' Hx Hx'. move:(tree_to_echelon_ok tx) => [sa sb sc]. move:(tree_to_echelon_ok tx') => [sa' sb' sc']. rewrite (qc _ _ tx tx') (hc _ _ tx tx'). by rewrite echelon_can_extensionE erecdef_product // -Hx// - Hx' //. Qed. Lemma cpred_pr0 a b: \0c <c a -> a <=c b -> natp b -> cpred a <c b. Proof. move => ra rb nN. move:(cpred_pr (NS_le_nat rb nN) (nesym (proj2 ra))) => [sa sb]. apply /(cleSlt0P (CS_nat sa) nN); ue. Qed. Lemma Eextension_prop_fct c E E' f (A := echelon_value c E) (A' := echelon_value c E') (g := echelon_extension c f): echelon c -> (forall i, i <c (esize c) -> inc (Vg f i) (functions (Vg E i) (Vg E' i))) -> forall i, i <c (slength c) -> inc (Vg g i) (functions (Vg A i) (Vg A' i)). Proof. move => ha hb i im. move: (slength_nat (proj1 (proj1 ha))) => mN. have iN:= (NS_lt_nat im mN); move: i iN im. apply: Nat_induction1. move => i iN Hr lim. move: (Eextension_prop f ha lim) (echelon_value_prop E ha lim) (echelon_value_prop E' ha lim). simpl;set a := P _; set b := Q _; rewrite -/A -/A' -/g. move => [pa pb pc][pa' pb' pc'][pa'' pb'' pc'']. case (p_or_not_p (a = \0c)) => az. move: (pa az) (pa' az) (pa'' az) => [/cge1P ra rb ->][_ _ ->] [_ _ ->]. apply: (hb _(cpred_pr0 ra rb (NS_esize ha))). case (p_or_not_p (b = \0c)) => bz. move: (pb bz) (pb' bz) (pb'' bz) => [ra rb ->][_ _ ->] [_ _ ->]. move: (cpred_pr6' iN ra rb) =>[qa qb qc]. apply: etp_fun; apply:Hr => //; exact: (clt_ltT qc lim). move:(pc az bz) (pc' az bz)(pc'' az bz) => [ra rb rc rd ->][_ _ _ _ ->] [_ _ _ _ ->]. move: (cpred_pr6' iN ra rb) (cpred_pr6' iN rc rd) =>[qa qb qc][qa' qb' qc']. apply: ext_to_prod_fun; apply: Hr => //. apply: (clt_ltT qc lim). apply: (clt_ltT qc' lim). Qed. Lemma Eextension_prop_inj c f (g := echelon_extension c f): echelon c -> (forall i, i <c (esize c) -> injection (Vg f i)) -> (forall i, i <c (slength c) -> injection (Vg g i)). Proof. move => ha hc i im. move: (slength_nat (proj1 (proj1 ha))) => mN. have iN:= (NS_lt_nat im mN); move: i iN im. apply: Nat_induction1 => k kN Hr lkn. move: (Eextension_prop f ha lkn); simpl;set a := P _; set b := Q _. move => [pa pb pc]. case (p_or_not_p (a = \0c)) => az. move: (pa az) => [/cge1P ra rb ->]. apply: (hc _(cpred_pr0 ra rb (NS_esize ha))). case (p_or_not_p (b = \0c)) => bz. move: (pb bz) => [ra rb ->]. move:(cpred_pr6' kN ra rb) =>[qa qb qc]. apply: etp_fi; apply:Hr => //; apply: (clt_ltT qc lkn). move:(pc az bz) => [ra rb rc rd ->]. move:(cpred_pr6' kN ra rb) (cpred_pr6' kN rc rd)=>[qa qb qc][qa' qb' qc']. apply: ext_to_prod_fi; apply: Hr => //. apply: (clt_ltT qc lkn). apply: (clt_ltT qc' lkn). Qed. Lemma Eextension_prop_surj c f (g := echelon_extension c f): echelon c -> (forall i, i <c (esize c) -> surjection (Vg f i)) -> (forall i, i <c (slength c) -> surjection (Vg g i)). Proof. move => ha hc i im. move: (slength_nat (proj1 (proj1 ha))) => mN. have iN:= (NS_lt_nat im mN); move: i iN im. apply: Nat_induction1 => k kN Hr lkn. move: (Eextension_prop f ha lkn); simpl;set a := P _; set b := Q _. move => [pa pb pc]. case (p_or_not_p (a = \0c)) => az. move: (pa az) => [/cge1P ra rb ->]. apply: (hc _(cpred_pr0 ra rb (NS_esize ha))). case (p_or_not_p (b = \0c)) => bz. move: (pb bz) => [ra rb ->]. move:(cpred_pr6' kN ra rb) =>[qa qb qc]. apply: etp_fs; apply:Hr => //; apply: (clt_ltT qc lkn). move:(pc az bz) => [ra rb rc rd ->]. move:(cpred_pr6' kN ra rb) (cpred_pr6' kN rc rd)=>[qa qb qc][qa' qb' qc']. apply: ext_to_prod_fs; apply: Hr => //. apply: (clt_ltT qc lkn). apply: (clt_ltT qc' lkn). Qed. Lemma Eextension_prop_bij_inv c f (g := echelon_extension c f) (lif := Lg (esize c) (fun z => inverse_fun (Vg f z))) (lig := echelon_extension c lif): echelon c -> (forall i, i <c (esize c) -> bijection (Vg f i)) -> forall i, i <c (slength c) -> bijection (Vg g i) /\ inverse_fun (Vg g i) = Vg lig i. Proof. move => ha hc i im. move: (slength_nat (proj1 (proj1 ha))) => mN. have iN:= (NS_lt_nat im mN); move: i iN im. have nN:=(NS_esize ha). apply: Nat_induction1 => k kN Hr lkn. move: (Eextension_prop f ha lkn) (Eextension_prop lif ha lkn). simpl;set a := P _; set b := Q _. move => [pa pb pc] [pa' pb' pc']. case (p_or_not_p (a = \0c)) => az. move: (pa az) (pa' az)=> [/cge1P ra rb ->] [_ _ ->]. have aux:= (cpred_pr0 ra rb (NS_esize ha)). by split; [ apply: (hc _ aux) | rewrite /Vl /lif LgV//; apply /(NltP nN)]. case (p_or_not_p (b = \0c)) => bz. move: (pb bz)(pb' bz) => [ra rb ->][_ _ ->]. move:(cpred_pr6' kN ra rb) =>[qa qb qc]. move: (Hr _ qc (clt_ltT qc lkn)) => [sa sb]. by move:(etp_inv sa) => [sc sd]; split => //; rewrite /Vl sd sb. move:(pc az bz) (pc' az bz) => [ra rb rc rd ->] [_ _ _ _ ->]. move:(cpred_pr6' kN ra rb) (cpred_pr6' kN rc rd)=>[qa qb qc][qa' qb' qc']. move:(Hr _ qc (clt_ltT qc lkn)) (Hr _ qc' (clt_ltT qc' lkn)). move => [b1 i1][b2 i2];split; first by exact : (ext_to_prod_fb b1 b2). by rewrite (ext_to_prod_inverse b1 b2) // i1 i2. Qed. Lemma Eextension_prop_bijset c E E' f (A := echelon_value c E) (A' := echelon_value c E') (g := echelon_extension c f): echelon c -> (forall i, i <c (esize c) -> inc (Vg f i) (bijections (Vg E i) (Vg E' i))) -> forall i, i <c (slength c) -> inc (Vg g i) (bijections (Vg A i) (Vg A' i)). Proof. move => ha hb i hc. apply: Zo_i; first by apply: (Eextension_prop_fct ha) hc; move => j /hb /Zo_P[]. have ra:(forall i, i <c esize c -> bijection (Vg f i)). by move => j /hb /Zo_P[]. by case:(Eextension_prop_bij_inv ha ra hc). Qed. Lemma Eextension_prop_bijsetL c E E' f: echelon c -> \0c <c slength c -> (forall i, i <c esize c -> inc (Vg f i) (bijections (Vg E i) (Vg E' i))) -> inc (echelon_can_extension c f) (bijections (echelon_of_base c E) (echelon_of_base c E')). Proof. move => sa sb sc. rewrite /echelon_can_extension/echelon_of_base. have mN:= (slength_nat (proj1 (proj1 sa))). have hd:= (cpred_lt mN (nesym (proj2 sb))). exact: (Eextension_prop_bijset sa sc hd). Qed. Lemma Eextension_prop_id c f (g := echelon_extension c f) (is_identity := fun z => z = identity (source z)): echelon c -> (forall i, i <c esize c -> is_identity (Vg f i)) -> forall i, i <c slength c -> is_identity (Vg g i). Proof. move => ha hc i im. move: (slength_nat (proj1 (proj1 ha))) => mN. have iN:= (NS_lt_nat im mN); move: i iN im. have Hb x: is_identity (identity x) by rewrite /is_identity; aw. apply: Nat_induction1 => k kN Hr lkn. move: (Eextension_prop f ha lkn); simpl;set a := P _; set b := Q _. move => [pa pb pc]. case (p_or_not_p (a = \0c)) => az. move: (pa az) => [/cge1P ra rb ->]. apply: (hc _(cpred_pr0 ra rb (NS_esize ha))). case (p_or_not_p (b = \0c)) => bz. move: (pb bz) => [ra rb ->]. move:(cpred_pr6' kN ra rb) =>[qa qb qc]. move: (Hr _ qc (clt_ltT qc lkn)); rewrite /Vl -/g => ->. by rewrite etp_identity; apply: Hb. move:(pc az bz) => [ra rb rc rd ->]. move:(cpred_pr6' kN ra rb) (cpred_pr6' kN rc rd)=>[qa qb qc][qa' qb' qc']. move:(Hr _ qc (clt_ltT qc lkn)) (Hr _ qc' (clt_ltT qc' lkn)) => i1 i2. rewrite -/g /Vl i1 i2 ext_to_prod_identity; apply: Hb. Qed. Lemma Eextension_prop_idL c f E: echelon c -> (forall i, i <c esize c -> (Vg f i) = identity (Vg E i)) -> \0c <c slength c -> (echelon_can_extension c f) = identity (echelon_of_base c E). Proof. set n := esize c; move => ha hb hc. have hd:(forall i, i <c n-> Vg f i = identity (source (Vg f i))). by move => i lin; rewrite (hb _ lin); aw. have hd': (forall i, i <c n -> inc (Vg f i) (functions (Vg E i) (Vg E i))). by move => i lin; rewrite(hb _ lin);apply/functionsP; apply: identity_prop. have mN:= (slength_nat (proj1 (proj1 ha))). have he:= (cpred_lt mN (nesym (proj2 hc))). move: (Eextension_prop_id ha hd he). by move /functionsP: (Eextension_prop_fct ha hd' he)=> [_ -> _]. Qed. Lemma Eextension_prop_comp c f f' E E' E'' (m := slength c) (n:= esize c) (f'' := Lg n (fun z => (Vg f' z) \co (Vg f z))) (g := echelon_extension c f) (g' := echelon_extension c f') (g'':= echelon_extension c f''): echelon c -> (forall i, i <c n -> inc (Vg f i) (functions (Vg E i) (Vg E' i))) -> (forall i, i <c n -> inc (Vg f' i) (functions (Vg E' i) (Vg E'' i))) -> forall i, i <c m -> Vg g'' i = (Vg g' i) \co (Vg g i). Proof. move => ha hb hc. set (A := echelon_value c E). set (A' := echelon_value c E'). set (A'':= echelon_value c E''). have hb': forall i, i <c m -> inc (Vg g i) (functions (Vg A i) (Vg A' i)). by move => i lim; apply: Eextension_prop_fct. have hc': forall i, i <c m -> inc (Vg g' i) (functions (Vg A' i) (Vg A'' i)). by move => i lim; by apply: Eextension_prop_fct. move: (slength_nat (proj1 (proj1 ha))) => mN i lim. have iN:= (NS_lt_nat lim mN); move: i iN lim. have nN:=(NS_esize ha). apply: Nat_induction1. move => k kN Hr lt. move: (Eextension_prop f ha lt) (Eextension_prop f' ha lt) (Eextension_prop f'' ha lt). simpl;set a := P _; set b := Q _. move => [pa pb pc] [pa' pb' pc'] [pa'' pb'' pc'']. case (p_or_not_p (a = \0c)) => az. move: (pa az) (pa' az) (pa'' az) => [/cge1P ra rb ->] [_ _ ->] [_ _ ->]. move: (cpred_pr0 ra rb nN) => w. by rewrite /Vl /f'' LgV//; apply /(NltP nN). case (p_or_not_p (b = \0c)) => bz. move: (pb bz)(pb' bz)(pb'' bz) => [ra rb ->] [ _ _ ->][_ _ ->]. move:(cpred_pr6' kN ra rb) =>[qa qb qc]; have W:= (clt_ltT qc lt). move: (hb' _ W) (hc' _ W) => i1 i2. by rewrite /Vl -/g -/g' - (etp_comp i1 i2) - (Hr _ qc W). move:(pc az bz)(pc' az bz) (pc'' az bz) => [ra rb rc rd ->] [_ _ _ _ ->] [ _ _ _ _ ->]. move:(cpred_pr6' kN ra rb) (cpred_pr6' kN rc rd)=>[qa qb qc][qa' qb' qc']. have W := (clt_ltT qc lt); have W' := (clt_ltT qc' lt). move:(Hr _ qc W) (Hr _ qc' W') => i1 i2. move:(hc' _ W)(hb' _ W)(hc' _ W') (hb' _ W')=> ia ib ic id. by rewrite /Vl (ext_to_prod_comp ib id ia ic) /f'' i1 i2. Qed. Lemma Eextension_prop_composable c f f' (g := echelon_extension c f) (g' := echelon_extension c f'): echelon c -> (forall i, i <c esize c -> (Vg f' i) \coP (Vg f i)) -> forall i,i <c (slength c) -> (Vg g' i) \coP (Vg g i). Proof. move => h ha. have nN:=(NS_esize h); set n := esize c. pose E := Lg n (fun i => source (Vg f i)). pose E' := Lg n (fun i => target (Vg f i)). pose E'' := Lg n (fun i => target (Vg f' i)). have hb: (forall i, i <c n -> inc (Vg f i) (functions (Vg E i) (Vg E' i))). move => i lin; move:(ha _ lin) => [_ fa _];apply/functionsP; split => //. by rewrite /E LgV//; apply /(NltP nN). by rewrite /E' LgV//; apply /(NltP nN). have hc: (forall i, i <c n -> inc (Vg f' i) (functions (Vg E' i) (Vg E'' i))). move => i lin; move:(ha _ lin) => [fa _ fb];apply/functionsP; split => //. by rewrite /E' LgV//; apply /(NltP nN). by rewrite /E'' LgV//; apply /(NltP nN). move => i lim. move: (Eextension_prop_fct h hc lim) => /functionsP [ra rb rc]. move: (Eextension_prop_fct h hb lim) => /functionsP [ra' rb' rc']. by split => //;rewrite rb rc'. Qed. (** Transportability *) Definition slist_append x y := let n := slength x in let m := slength y in Lg (n +c m) (fun z => Yo (z <c n) (Vg x z) (Vg y (z -c n))). Definition Typ_with_id f A := slist_append f (Lg (domain A) (fun z => identity (Vg A z))). Lemma slist_append_list x y: slistp x -> slistp y -> slistp (slist_append x y) /\ slength (slist_append x y) = slength x +c slength y. Proof. move=> ha hb. move:(slength_nat ha)(slength_nat hb) => nN mN. have nmM:=(NS_sum nN mN). have d: (domain (slist_append x y)) = (slength x +c slength y). by rewrite /slist_append; aw. by rewrite /slistp /slength d; split => //; split => //; apply:Lg_fgraph. Qed. Lemma slist_append_val1 x y i: slistp x -> slistp y -> i<c slength x -> Vg (slist_append x y) i = Vg x i. Proof. move => ha hb hc. move:(slength_nat ha)(slength_nat hb) => nN mN. have hi: inc i (slength x +c slength y). by apply /(NltP (NS_sum nN mN)); apply: (clt_leT hc); apply:Nsum_M0le. by rewrite /slist_append LgV //; Ytac0. Qed. Lemma slist_append_val2 x y i: slistp x -> slistp y -> i<c slength y -> Vg (slist_append x y) ((slength x) +c i) = Vg y i. Proof. move => ha hb hc. move:(slength_nat ha)(slength_nat hb) => nN mN. have hi: inc (slength x +c i) (slength x +c slength y). by apply /(NltP (NS_sum nN mN)); apply:csum_Meqlt. have iN:=(NS_lt_nat hc mN). move:(Nsum_M0le i nN); rewrite {1} csumC => /cleNgt bad. by rewrite /slist_append (LgV hi) (csumC _ i) (cdiff_pr1 iN nN); Ytac0. Qed. Lemma slist_emptyp l: slistp l -> slength l = \0c -> l = emptyset. Proof. move => sa sb. move: (slist_domain sa); rewrite sb Nint_co00 => dle. by apply/set0_P => x /domain_i1; rewrite dle => /in_set0. Qed. Lemma Typ_with_id_prop n S f x y A : slistpl x n -> slistpl y n -> slistpl f n -> slistp A -> echelon S -> slength S <> \0c -> esize S <=c n +c slength A -> (forall i, i <c n -> inc (Vg f i) (bijections (Vg x i) (Vg y i))) -> inc (echelon_can_extension S (Typ_with_id f A)) (bijections (echelon_of_base S (slist_append x A)) (echelon_of_base S (slist_append y A)) ). Proof. move => [lx sx][ly sy] [lf sf] lA eS snt sS hd. rewrite /echelon_can_extension /echelon_of_base. have he:=(cpred_lt (proj2 (proj1 (proj1 eS))) snt). apply:(Eextension_prop_bijset eS _ he) => j jle. rewrite /Typ_with_id; set ff := Lg _ _. have nN: natp n by rewrite - sf; exact (proj2 lf). have lAN: natp (domain A) by exact: (proj2 lA). have lff: slistp ff by rewrite /ff; split; aw; fprops. move:(clt_leT jle sS); rewrite csumC => jsa. have jN: natp j by exact: (NS_lt_nat jsa (NS_sum lAN nN)). case:(NleT_el nN jN) => js. move: (cdiff_pr js) => js1; rewrite - js1. have js3:=(cdiff_Mlt lAN jN js jsa). have js2: j -c n <c slength ff by rewrite /ff; aw. have js4: inc (j -c n) (domain A) by apply/(NltP lAN). rewrite -{1} sf (slist_append_val2 lf lff js2). rewrite -{2} sx (slist_append_val2 lx lA js3). rewrite -{3} sy (slist_append_val2 ly lA js3). rewrite /ff LgV//; apply/bijectionsP; rewrite/bijection_prop; aw; split => //. exact: identity_fb. have sl': j <c slength f by rewrite sf. have sx': j <c slength x by rewrite sx. have sy': j <c slength y by rewrite sy. rewrite (slist_append_val1 lf lff sl'). rewrite (slist_append_val1 lx lA sx'). by rewrite (slist_append_val1 ly lA sy'); apply: hd. Qed. Lemma Typ_with_id_prop2 n S f x A: slistpl x n -> slistpl f n -> slistp A -> echelon S -> slength S <> \0c -> esize S <=c n +c slength A -> n = \0c -> echelon_can_extension S (Typ_with_id f A) = identity (echelon_of_base S (slist_append x A)). Proof. move => [xl sx] [lf sf] lA eS snt sS nz. have slAc:= (CS_nat (proj2 lA)). move: sS; rewrite nz (csum0l slAc) => eq1. move: (CS_nat (proj2 (proj1 (proj1 eS)))) => cb. have sp:=(card_ne0_pos cb snt). apply: (Eextension_prop_idL eS _ sp) => k kl. have kp:k <c domain A by apply: (clt_leT kl eq1). have hw:= (csum0l (proj31_1 kl)). have kda: inc k (domain A) by apply/(NltP (proj2 lA)). move: (slist_append_val2 xl lA kp); rewrite sx nz hw => ->. rewrite /Typ_with_id; set ff := Lg _ _. have lff: slistp ff by rewrite /ff;split; fprops; aw; exact (proj2 lA). have sff: slength ff = domain A by rewrite /ff/slength; aw. rewrite - sff in kp. by move: (slist_append_val2 lf lff kp); rewrite sf nz hw /ff LgV. Qed. Definition Typ_auxg n A S := [/\ natp n, slistp A, slistp S & forall i, inc i (domain S) -> echelon (Vg S i) /\ esize (Vg S i) <=c n +c slength A]. Definition Typ_schemeg x A S i:= Yo (slength (Vg S i) = \0c) emptyset (echelon_of_base (Vg S i) (slist_append x A)). Definition Typificationg n A S x s := [/\ Typ_auxg n A S, slistpl x n, slistpl s (slength S) & forall i, i <c slength s -> inc (Vg s i) (Typ_schemeg x A S i)]. Definition Typ_aux n A S := [/\ natp n, slistp A, echelon S & esize S <=c n +c slength A]. Definition Typ_scheme x A S:= Yo (slength S = \0c) emptyset (echelon_of_base S (slist_append x A)). Definition Typification n A S x s := [/\ Typ_aux n A S, slistpl x n & inc s (Typ_scheme x A S)]. Definition Typ_hypg n x A S s y f := [/\ Typificationg n A S x s, slistpl y n, slistpl f n & forall i, i <c n -> inc (Vg f i) (bijections (Vg x i) (Vg y i))]. Definition Typ_concg (x:Set) A S s y f R := let s' := Lg (domain S) (fun i => Vf (echelon_can_extension (Vg S i) (Typ_with_id f A)) (Vg s i)) in R x s <-> R y s'. Definition Transportableg n A S R:= forall x s y f, Typ_hypg n x A S s y f -> Typ_concg x A S s y f R. Definition Typ_hyp n x A S s y f := [/\ Typification n A S x s, slistpl y n, slistpl f n & forall i, i <c n -> inc (Vg f i) (bijections (Vg x i) (Vg y i))]. Definition Typ_conc (x:Set) A S s y f R := let s' := Vf (echelon_can_extension S (Typ_with_id f A)) s in R x s <-> R y s'. Definition Transportable n A S R:= forall x s y f, Typ_hyp n x A S s y f -> Typ_conc x A S s y f R. Lemma transportable_casep1 n A S R (R' := fun x s => R x (Vg s \0c)): Transportable n A S R <-> Transportableg n A (Lg \1c (fun z => S)) R'. Proof. have i01: inc \0c \1c by apply: set1_1. have ww: inc \0c (domain (Lg \1c (fun _ : Set => S))) by aw. rewrite /Transportable /Transportableg; split. move => ha x s' y f [ [q1 q2 q3 q4] qb qc qd]. case: q1; case: q3; rewrite /slength Lgd => ua ub nN lA lsp lv. move:(lv _ i01); rewrite LgV// => - [es1 es2]. have: \0c <c slength s' by rewrite /slength ub; apply:clt_01. move/q4; rewrite /Typ_schemeg. rewrite LgV // => xx. by rewrite /Typ_concg /R' LgV // LgV //; apply: ha. move => ha x s y f [ [[q1a q1b q1c q1d] q2 q3] qb qc qd]. move:(ha x (Lg \1c (fun z => s)) y f). rewrite /Typ_concg /R'. rewrite (LgV i01) (LgV ww) (LgV i01) (LgV i01); apply. split => //; split. - split => //; rewrite /slistp; aw; fprops => i i1; rewrite LgV//. - done. - rewrite/slistpl /slistp; aw; split; fprops. - rewrite /Typ_schemeg /slength; aw; move => i /(NltP NS1) => i1. rewrite ! LgV//. Qed. Lemma transportable_aux1 n x A S s y f ( s' := Lg (domain S) (fun i => Vf (echelon_can_extension (Vg S i) (Typ_with_id f A)) (Vg s i))): Typ_hypg n x A S s y f -> Typificationg n A S y s'. Proof. move =>[[qa qb qc qd] hb hc hd]. set p := slength S; have qv := proj2 qc; rewrite qv in qd. have pN: natp p by rewrite /p;move : qc => [[ _ h] <-]. have ls': slistpl s' (slength S) by rewrite /s'; split; aw; split;aw; fprops. have eq2:= (proj2 qc). split => //; rewrite /s'; aw => i ils. have ids: inc i (domain S) by apply/(NltP pN). rewrite LgV//. move:(qd _ ils); rewrite /Typ_schemeg; Ytac w; first by move/in_set0. Ytac0. set G := (echelon_can_extension (Vg S i) (Typ_with_id f A)). suff: inc G (bijections (echelon_of_base (Vg S i) (slist_append x A)) (echelon_of_base (Vg S i) (slist_append y A)) ). by move /bijectionsP => [[[fg _] _] <- <-]; fprops. move:(qa) => [_ slA _ h]; move: (h _ ids) => [ec ecx]. by apply: (Typ_with_id_prop qb hb hc slA ec w ecx hd). Qed. Lemma transportable_typificationg n A S: Typ_auxg n A S -> Transportableg n A S (Typificationg n A S). Proof. move => h x s y f H; move:(transportable_aux1 H) => h1. by split => //; case:H. Qed. Lemma transportable_typification n A S: Typ_aux n A S -> Transportable n A S (Typification n A S). Proof. move => h; apply/transportable_casep1 => x s y f aux1. move: (aux1) (set1_1 \0c)=> [h2a h2b h2c h2d] i01. set S' := (Lg \1c (fun _ : Set => S)). have ls: slistp S' by rewrite /S';split; aw; fprops. have zds: inc \0c (domain S') by rewrite /S';aw. have ha: Typ_auxg n A S'. by move: h => [h1 h2 h3 h4];split => //; rewrite /S';aw => i li1; rewrite LgV. have hv: inc (Vg s \0c) (Typ_scheme x A S). move: h2a => [_ _ hu hv]; move: (proj2 hu); aw => sll; rewrite sll in hv. by move:(hv _ clt_01); rewrite /Typ_schemeg/S'; rewrite LgV. have slxn: slistpl x n by case: h2a. split => _ ; last by split. have zds': \0c <c domain S' by rewrite /S'; aw; apply:clt_01. have ww: (Typ_schemeg y A S' \0c) = (Typ_scheme y A S). rewrite /Typ_schemeg /Typ_scheme /S' LgV //. move:(@transportable_aux1 n x A S' s y f aux1) => [qa qb qc]; aw => qd. by move: (qd _ zds'); rewrite LgV//; rewrite ww; split. Qed. Lemma transportable_spec1 n A S R: n = \0c -> Typ_auxg n A S -> Transportableg n A S R. Proof. move => nz [ha hb hc hd] x s y f [[pa pb pc pd] hf hg _]. rewrite nz in hf pb. rewrite (slist_emptyp (proj1 pb) (proj2 pb)). rewrite (slist_emptyp (proj1 hf) (proj2 hf)). rewrite /Typ_concg; set s' := Lg _ _. move: pc => [pc1 pc2]. have dd1: domain s = domain S. by rewrite (slist_domain pc1) pc2 (slist_domain hc). have dd: domain s = domain s' by rewrite /s' Lgd. suff: s = s' by move => ->; split. apply: fgraph_exten; [ exact (proj1 pc1) | rewrite /s'; fprops | done | ]. rewrite dd1; move => i ids /=; rewrite /s' LgV//. have lis: i <c slength s. apply /(NintP (slength_nat pc1)). by rewrite - (slist_domain pc1) dd1. move: (pd _ lis); rewrite /Typ_schemeg; Ytac sz; first by move/in_set0. rewrite nz in hg. move: (hd _ ids) => [ua]; rewrite nz => eq1 ww. by rewrite(Typ_with_id_prop2 pb hg hb ua sz eq1 (erefl \0c)) idV. Qed. Definition equipotent_fam n x y := forall i, i<c n -> cardinal (Vg x i) = cardinal (Vg y i). Lemma transportable_spec_p0 n A S R: slength S = \0c -> Typ_auxg n A S -> (Transportableg n A S R <-> (forall x y, slistpl x n -> slistpl y n -> equipotent_fam n x y -> (R x emptyset <-> R y emptyset))). Proof. move => h1 ts; move: (ts)=> [nN _ lS _]. split. move => TT x y [xl xs] [yl ys] eq. set f := Lg n (fun z => (equipotent_ex (Vg x z) (Vg y z))). have lf: slistpl f n. split; last by rewrite /slength /f;aw. split; rewrite/f; aww; by exists n. have s0:domain emptyset = \0c by rewrite domain_set0. have le: slistpl emptyset (slength S). rewrite h1; split =>//;split;try apply:fgraph_set0. by rewrite s0;apply:NS0. have ha: Typificationg n A S x emptyset. by split => // i; rewrite /slength s0 => /clt0. have hb: Typ_hypg n x A S emptyset y f. split => // i lin; move/ (NltP nN): (lin) => lin1. apply/bijectionsP; rewrite /f LgV//; apply: equipotent_ex_pr. by apply/card_eqP; apply: eq. move:(TT x emptyset y f hb); rewrite /Typ_concg (slist_emptyp lS h1). by rewrite domain_set0 /Lg funI_set0. move => Hxy x s y f [ha hb hc hd]. rewrite /Typ_concg (slist_emptyp lS h1) domain_set0 /Lg funI_set0. move:ha => [_ he ls _]; rewrite h1 in ls. rewrite (slist_emptyp (proj1 ls) (proj2 ls)); apply: Hxy => //. by move => i /hd /bijectionsP bp; apply /card_eqP; exists (Vg f i). Qed. Lemma transportable_spec3 n A S R: (forall x s s', Typificationg n A S x s -> Typificationg n A S x s' -> (R x s <-> R x s')) -> Typ_auxg n A S -> (Transportableg n A S R <-> (forall x y, slistpl x n -> slistpl y n -> equipotent_fam n x y -> (forall u v, Typificationg n A S x u -> Typificationg n A S y v -> (R x u <-> R y v)))). Proof. move => h0 ts; move: (ts)=> [nN _ lS _]. split. move => TT x y [xl xs] [yl ys] eq1 s v hu hv. set f := Lg n (fun z => (equipotent_ex (Vg x z) (Vg y z))). have lf: slistpl f n. split; last by rewrite /slength /f;aw. by split; rewrite/f; fprops; aw. have fp: forall i, i <c n -> inc (Vg f i) (bijections (Vg x i) (Vg y i)). move => i lin; rewrite/f LgV//; last by apply/(NltP nN). by apply/bijectionsP/equipotent_ex_pr /card_eqP /eq1. have HA:(Typ_hypg n x A S s y f) by []. move: (transportable_aux1 HA) (TT _ _ _ _ HA) => sa sb. apply:(iff_trans sb); apply:(h0 _ _ _ sa hv). move => H x s y f [Ti ly lf hd]. have ra: slistpl x n by case: Ti. have rb: equipotent_fam n x y. by move => i /hd /bijectionsP bp; apply/card_eqP;exists (Vg f i). have rc: forall i, i <c slength S -> nonempty (Typ_schemeg x A S i). by move: Ti => [_ _ [_ ->]] h i /h hi; exists (Vg s i). apply: H => //. have /transportable_aux1 //: Typ_hypg n x A S s y f by []. Qed. Lemma slistp_0: slistpl emptyset \0c. Proof. move: (fgraph_set0) NS0 => ha hb. by rewrite /slistpl /slistp /slength domain_set0. Qed. Lemma slist_append_empty x: slistp x -> slist_append x emptyset = x. Proof. move => [fgx lx]. rewrite /slist_append /slength; aw; rewrite (csum0r (CS_nat lx)). apply: fgraph_exten; [ fprops | done | by aw | aw] => i idg. by rewrite (LgV idg) Y_true //; apply/(NltP lx). Qed. Lemma Typ_with_id_empty x: slistp x -> Typ_with_id x emptyset = x. Proof. rewrite /Typ_with_id domain_set0 /Lg funI_set0;apply:slist_append_empty. Qed. Section Example1. Lemma echelon_trivial n (S:= slist1 (J \0c n)): natp n -> n <> \0c -> echelon S /\ esize S = n. Proof. move: NS0 clt_01=> ns0 lt01 nN np. move: (slist1_prop (J \0c n)) => [[ha hb] hc]. have es: echelon S. split; first by split => // t /Lg_range_P [_ _ ->]; apply:setXp_i. by rewrite hb => i /clt1 ->; rewrite hc /=; aw; split. split => //; apply: (esize_prop2 es); rewrite hb; first by exists \0c. move => j /clt1->; rewrite hc pr2_pair => _; exact: (cleR (CS_nat nN)). Qed. Lemma echelon_trivial_value n (S:= slist1 (J \0c n)) E: natp n -> n <> \0c -> echelon_of_base S E = (Vl E n). Proof. move => nN np. move: (slist1_prop (J \0c n)) => [[ha hb] hc]. move:(echelon_trivial nN np) => [pa pb]. rewrite /echelon_of_base hb /Vl cpred1. have w1: \0c <c slength S by rewrite hb; exact: clt_01. move: (proj31 (echelon_value_prop E pa w1)); rewrite hc; aw => h1. by case: (h1 (erefl \0c)). Qed. Lemma echelon_trivial_extension n (S:= slist1 (J \0c n)) E: natp n -> n <> \0c -> echelon_can_extension S E = (Vl E n). Proof. move => nN np. move: (slist1_prop (J \0c n)) => [[ha hb] hc]. move:(echelon_trivial nN np) => [pa pb]. rewrite /echelon_can_extension hb /Vl cpred1. have w1: \0c <c slength S by rewrite hb; exact: clt_01. move: (proj31 (Eextension_prop E pa w1)); rewrite hc; aw => h1. by case: (h1 (erefl \0c)). Qed. Definition Ex_scheme1 := slist2 (slist1 (J \0c \1c)) (slist1 (J \0c \1c)). Definition Ex_scheme2 := slist2 (slist1 (J \0c \1c)) (slist1 (J \0c \2c)). Lemma Ex_typ_aux1: Typ_auxg \2c emptyset Ex_scheme1. Proof. move:cle_12 slistp_0 NS2 => cle12 [ha hb] ns2; rewrite /Ex_scheme1. set S1 := (slist1 (J \0c \1c)). move: (slist2_prop S1 S1) => [[hc hd] he hf]. move: (echelon_trivial NS1 card1_nz) => [p1 p2]. split => //; rewrite [domain _]hd hb (csum0r CS2) => i /set2_P [] ->. by rewrite he p2. by rewrite hf p2. Qed. Lemma Ex_typ_aux2: Typ_auxg \2c emptyset Ex_scheme2. Proof. move:(cleR CS2) cle_12 slistp_0 NS2 => c2 l2 [ha hb] ns2; rewrite /Ex_scheme1. set S1 := (slist1 (J \0c \1c)). set S2 := (slist1 (J \0c \2c)). move: (slist2_prop S1 S2) => [[hc hd] he hf]. move: (echelon_trivial NS1 card1_nz) => [p1 p2]. move: (echelon_trivial NS2 card2_nz) => [p1' p2']. split => //; rewrite [domain _]hd hb (csum0r CS2) => i /set2_P [] ->. by rewrite he p2. by rewrite hf p2'. Qed. Lemma Ex_transportable1: Transportableg \2c emptyset Ex_scheme1 (fun _ s => Vg s \0c = Vg s \1c). Proof. move => x s y f [ha hb hc hd]. move: NS1 card1_nz => ns1 c1nz. move: (slist2_prop (slist1 (J \0c \1c)) (slist1 (J \0c \1c))). move => [qa qb qc]. have hw: natp (slength Ex_scheme1) by rewrite/Ex_scheme1; aw; apply: NS2. have hu: inc \1c (domain Ex_scheme1) by rewrite /Ex_scheme1; aww. have hv: inc \0c (domain Ex_scheme1) by rewrite /Ex_scheme1; aww. have hv': \0c <c slength Ex_scheme1 by apply/(NltP). have hu': \1c <c slength Ex_scheme1 by apply/(NltP). rewrite /Typ_concg LgV// LgV//. rewrite (Typ_with_id_empty (proj1 hc)) qb qc echelon_trivial_extension //. rewrite /Vl cpred1; split => h; first by rewrite h. move: ha => [k1 k2 k3 k4]. rewrite (proj2 k3) in k4. move:(k4 _ hv') (k4 _ hu'). rewrite /Typ_schemeg qb qc echelon_trivial_value //. rewrite (slist_append_empty (proj1 k2)); Ytac w2; first by move/in_set0. rewrite /Vl cpred1 => ua ub. move: (hd _ (clt_02)) => /bijectionsP [[fa fb] fc fd]; apply:(proj2 fa). by rewrite fc. by rewrite fc. done. Qed. Lemma Ex_transportable2: ~ Transportableg \2c emptyset Ex_scheme1 (fun x _ => Vg x \0c = Vg x \1c). Proof. move: NS1 card1_nz => qa qb. set x := slist2 (singleton \0c)(singleton \1c). set y := slist2 (singleton \0c)(singleton \0c). set s := slist2 \0c \0c. set f1 := identity (singleton \0c). set f2 := Lf (fun z => \0c) (singleton \1c)(singleton \0c). set f := slist2 f1 f2. move: (slist2_prop (singleton \0c)(singleton \1c)) => [xp1 xp2 xp3]. move: (slist2_prop (singleton \0c)(singleton \0c)) => [yp1 yp2 yp3]. move: (slist2_prop f1 f2) => [fp1 fp2 fp3]. move: (slist2_prop \0c \0c) => [sp1 sp2 sp3]. have hu: (slength Ex_scheme1) = \2c by rewrite /slength /Ex_scheme1; aw. set S := (slist1 (J \0c \1c)). move: (slist2_prop S S); rewrite /= -/Ex_scheme1 => -[Sp1 Sp2 Sp3]. have snz: (slength S <> \0c)by rewrite /S/slength/slist1; aw. have ha: Typificationg \2c emptyset Ex_scheme1 x s. split; [ exact:Ex_typ_aux1 | done | by rewrite hu | ]. rewrite /Typ_schemeg (slist_append_empty (proj1 xp1)) (proj2 sp1). move => i /clt2 [] ->; rewrite ?Sp2 ?Sp3 echelon_trivial_value//;Ytac0. - by rewrite /Vl cpred1 xp2 sp2; fprops. - by rewrite /Vl cpred1 xp2 sp3; fprops. have hb: Typ_hypg \2c x emptyset Ex_scheme1 s y f. split => //i /clt2 [] ->. - rewrite xp2 yp2 fp2/f1; apply/bijectionsP; saw; apply: identity_fb. - rewrite xp3 yp3 fp3 /f2;apply/bijectionsP; saw. apply:lf_bijective. + by move => t _;fprops. + by move => u v /set1_P -> /set1_P ->. + by move => u /set1_P ->; exists \1c; fprops. move => h; move:(h x s y f hb). rewrite /Typ_concg xp2 xp3 yp2 yp3 => bad. move/bad: (erefl (singleton \0c)) => /(f_equal (inc \0c)) hh. by move: (set1_1 \0c); rewrite hh => /set1_P e01; case:qb. Qed. Lemma Ex_transportable3: ~ Transportableg \2c emptyset Ex_scheme2 (fun _ s => Vg s \0c = Vg s \1c). Proof. move: NS1 card1_nz NS2 card2_nz => qa qb qc qd. set x := slist2 (singleton \0c)(singleton \1c). set y := slist2 (singleton \0c)(singleton \0c). set s := slist2 \0c \1c. set f1 := identity (singleton \0c). set f2 := Lf (fun z => \0c) (singleton \1c)(singleton \0c). set f := slist2 f1 f2. move: (slist2_prop (singleton \0c)(singleton \1c)) => [xp1 xp2 xp3]. move: (slist2_prop (singleton \0c)(singleton \0c)) => [yp1 yp2 yp3]. move: (slist2_prop f1 f2) => [fp1 fp2 fp3]. move: (slist2_prop \0c \1c) => [sp1 sp2 sp3]. have hu: (slength Ex_scheme2) = \2c by rewrite /slength /Ex_scheme2; aw. set S1 := (slist1 (J \0c \1c)). set S2 := (slist1 (J \0c \2c)). move: (slist2_prop S1 S2); rewrite /= -/Ex_scheme2 => -[Sp1 Sp2 Sp3]. have snz: (slength S1 <> \0c)by rewrite /S1/slength/slist1; aw. have snz': (slength S2 <> \0c)by rewrite /S2/slength/slist1; aw. have cp2: (cpred \2c) = \1c by rewrite -(cpred_pr2 NS1) succ_one. have ha: Typificationg \2c emptyset Ex_scheme2 x s. split; [ exact:Ex_typ_aux2 | done | by rewrite hu | ]. rewrite /Typ_schemeg (slist_append_empty (proj1 xp1)) (proj2 sp1). move => i /clt2 [] ->; rewrite ?Sp2 ?Sp3 echelon_trivial_value//;Ytac0. - by rewrite /Vl cpred1 xp2 sp2; fprops. - by rewrite /Vl cp2 xp3 sp3; fprops. have ax1: lf_axiom (fun z => \0c) (singleton \1c) (singleton \0c). by move => t _;fprops. have hb: Typ_hypg \2c x emptyset Ex_scheme2 s y f. split => //i /clt2 [] ->. - rewrite xp2 yp2 fp2/f1; apply/bijectionsP; saw; apply: identity_fb. - rewrite xp3 yp3 fp3 /f2;apply/bijectionsP; saw. apply:lf_bijective. + exact: ax1. + by move => u v /set1_P -> /set1_P ->. + by move => u /set1_P ->; exists \1c; fprops. move => h; move:(h x s y f hb). have ra: inc \1c (domain Ex_scheme2) by rewrite /Ex_scheme2; aww. have rb: inc \0c (domain Ex_scheme2) by rewrite /Ex_scheme2; aww. rewrite /Typ_concg LgV// LgV//. rewrite (Typ_with_id_empty (proj1 fp1)) Sp2 Sp3 !echelon_trivial_extension //. rewrite /Vl cpred1 cp2 fp2 fp3 sp2 sp3 /f1 /f2 LfV // ? id_V //; fprops. bw; fprops;move => k;move/k: (erefl \0c);fprops. Qed. End Example1. Definition species_of_structure n A S R:= [/\ Typ_aux n A S, n <> \0c, slength S <> \0c & Transportable n A S R]. Lemma species_of_structure_typification n A S R x s : species_of_structure n A S R -> (Typification n A S x s <-> (slistpl x n /\ inc s (echelon_of_base S (slist_append x A)))). Proof. move => [h1 h2 h3 h4]; split. by move => [u1 u2]; rewrite/Typ_scheme; Ytac0. by move => [qa qb]; rewrite/Typification /Typ_scheme; Ytac0. Qed. Definition structure_of_species n A S R E U:= species_of_structure n A S R /\ Typification n A S E U. Definition set_of_structure_of_species A S R E := Zo (echelon_of_base S (slist_append E A)) (R E). (* noter *) Section Example2. Definition Tree_ex1 := (Tp (Tx (Tb \0c)(Tb \0c))). Definition Tree_ex2 := (Tp (Tx (Tx (Tb \0c)(Tb \0c)) (Tb \0c))). Definition Tree_ex3 := (Tp (Tp (Tb \0c))). Definition Echelon_ex1 := tree_to_echelon Tree_ex1. Definition Echelon_ex2 := tree_to_echelon Tree_ex2. Definition Echelon_ex3 := tree_to_echelon Tree_ex3. Lemma cmax00: cmax \0c \0c = \0c. Proof. by rewrite (cmax_xy (cleR CS0)). Qed. Lemma Tree_ex1_prop : treep Tree_ex1 /\ tree_size Tree_ex1 = \0c. Proof. move:tdepth_prop_inv => [ha hb hc]. move:tree_size_p => [qa qb qc]. move:(proj1 (ha _ NS0)) (qa _ NS0) => r1 r2. move:(proj1 (hc _ _ r1 r1)) (qc _ _ r1 r1); rewrite r2 cmax00 => r3 r4. split; [exact:(proj1 (hb _ r3)) | by move:(qb _ r3); rewrite r4 ]. Qed. Lemma Tree_ex2_prop : treep Tree_ex2 /\ tree_size Tree_ex2 = \0c. Proof. move:tdepth_prop_inv => [ha hb hc]. move:tree_size_p => [qa qb qc]. move:(proj1 (ha _ NS0)) (qa _ NS0) => r1 r2. move:(proj1 (hc _ _ r1 r1)) (qc _ _ r1 r1); rewrite r2 cmax00 => r3 r4. move:(proj1 (hc _ _ r3 r1)) (qc _ _ r3 r1); rewrite r2 r4 cmax00 => r5 r6. split; [exact:(proj1 (hb _ r5)) | by move:(qb _ r5); rewrite r6 ]. Qed. Lemma Tree_ex3_prop : treep Tree_ex3 /\ tree_size Tree_ex3 = \0c. Proof. move:tdepth_prop_inv => [ha hb hc]. move:tree_size_p => [qa qb qc]. move:(proj1 (ha _ NS0)) (qa _ NS0) => r1 r2. move:(proj1 (hb _ r1)) (qb _ r1) => r3 r4. split; [exact:(proj1 (hb _ r3)) | by move:(qb _ r3); rewrite r4 r2]. Qed. Definition echelon_s1 c := [/\ echelon c, slength c <> \0c & esize c = \1c]. Lemma tree_echelon_s1 x: (treep x /\ tree_size x = \0c) -> echelon_s1 (tree_to_echelon x). Proof. move => [ha hb]. by move:(tree_to_echelon_ok ha);rewrite hb succ_zero => - [ra [_ /nesym rb] rc]. Qed. Lemma Echelon_ex1_prop1: echelon_s1 Echelon_ex1. Proof. exact: (tree_echelon_s1 Tree_ex1_prop). Qed. Lemma Echelon_ex2_prop1: echelon_s1 Echelon_ex2. Proof. exact: (tree_echelon_s1 Tree_ex2_prop). Qed. Lemma Echelon_ex3_prop1: echelon_s1 Echelon_ex3. Proof. exact: (tree_echelon_s1 Tree_ex3_prop). Qed. Lemma Echelon_value_ex1 E (A := Vg E \0c): echelon_of_base Echelon_ex1 E = \Po (A \times A) /\ echelon_can_extension Echelon_ex1 E = \Pof (A \ftimes A). Proof. move:(proj1 Tree_ex1_prop ) => xx. move:(tree_value_prop E) => [ha hb hc]. move:(tree_extension_prop E) => [ha' hb' hc']. move: (tdepth_prop_inv) => [qa qb qc]. move: (proj1 (qa _ NS0)) => ta. move: (proj1 (qc _ _ ta ta)) => tb. rewrite /Echelon_ex1 (echelon_of_base_of_tree E xx) /Tree_ex1. rewrite (hb _ tb) (hc _ _ ta ta) (ha _ NS0). rewrite (can_extension_of_tree E xx). by rewrite (hb' _ tb) (hc' _ _ ta ta) (ha' _ NS0). Qed. Lemma Echelon_value_ex2 E (A := Vg E \0c): echelon_of_base Echelon_ex2 E = \Po ((A \times A) \times A) /\ echelon_can_extension Echelon_ex2 E = \Pof ((A \ftimes A) \ftimes A). Proof. move:(proj1 Tree_ex2_prop ) => xx. move:(tree_value_prop E) => [ha hb hc]. move:(tree_extension_prop E) => [ha' hb' hc']. move: (tdepth_prop_inv) => [qa qb qc]. move: (proj1 (qa _ NS0)) => ta. move: (proj1 (qc _ _ ta ta)) => tb. move: (proj1 (qc _ _ tb ta)) => tc. rewrite /Echelon_ex2 (echelon_of_base_of_tree E xx) /Tree_ex2. rewrite (hb _ tc) (hc _ _ tb ta) (hc _ _ ta ta) (ha _ NS0). rewrite (can_extension_of_tree E xx). by rewrite (hb' _ tc) (hc' _ _ tb ta) (hc' _ _ ta ta) (ha' _ NS0). Qed. Lemma Echelon_value_ex3 E (A := Vg E \0c): echelon_of_base Echelon_ex3 E = \Po (\Po A) /\ echelon_can_extension Echelon_ex3 E = \Pof (\Pof A). Proof. move:(proj1 Tree_ex3_prop ) => xx. move:(tree_value_prop E) => [ha hb hc]. move:(tree_extension_prop E) => [ha' hb' hc']. move: (tdepth_prop_inv) => [qa qb qc]. move: (proj1 (qa _ NS0)) => ta. move: (proj1 (qb _ ta)) => tb. rewrite /Echelon_ex2 (echelon_of_base_of_tree E xx) /Tree_ex2. rewrite (can_extension_of_tree E xx). by rewrite (hb _ tb) (hb _ ta) (ha _ NS0) (hb' _ tb) (hb' _ ta) (ha' _ NS0). Qed. End Example2. End Structure. Export Structure.
lemma continuous_on_closure: "continuous_on (closure S) f \<longleftrightarrow> (\<forall>x e. x \<in> closure S \<and> 0 < e \<longrightarrow> (\<exists>d. 0 < d \<and> (\<forall>y. y \<in> S \<and> dist y x < d \<longrightarrow> dist (f y) (f x) < e)))" (is "?lhs = ?rhs")
qsort <- function(v) { if ( length(v) > 1 ) { pivot <- (min(v) + max(v))/2.0 # Could also use pivot <- median(v) c(qsort(v[v < pivot]), v[v == pivot], qsort(v[v > pivot])) } else v } N <- 100 vs <- runif(N) system.time(u <- qsort(vs)) print(u)
# Inference with GPs The dataset needed for this worksheet [can be downloaded](https://northwestern.box.com/s/el0s1imhdxq5qwvzb4hgap90mxpjcfdq). Once you have downloaded [s9_gp_dat.tar.gz](https://northwestern.box.com/s/el0s1imhdxq5qwvzb4hgap90mxpjcfdq), and moved it to this folder, execute the following cell: ```python !tar -zxvf s9_gp_dat.tar.gz !mv *.txt data/ ``` x ./._sample_data.txt x ./sample_data.txt x ./._sample_data_line.txt x ./sample_data_line.txt x ./._sample_data_line_truths.txt x ./sample_data_line_truths.txt Here are the functions we wrote in the previous tutorial to compute and draw from a GP: ```python import numpy as np from scipy.linalg import cho_factor def ExpSquaredKernel(t1, t2=None, A=1.0, l=1.0): """ Return the ``N x M`` exponential squared covariance matrix between time vectors `t1` and `t2`. The kernel has amplitude `A` and lengthscale `l`. """ if t2 is None: t2 = t1 T2, T1 = np.meshgrid(t2, t1) return A ** 2 * np.exp(-0.5 * (T1 - T2) ** 2 / l ** 2) def draw_from_gaussian(mu, S, ndraws=1, eps=1e-12): """ Generate samples from a multivariate gaussian specified by covariance ``S`` and mean ``mu``. (We derived these equations in Day 1, Notebook 01, Exercise 7.) """ npts = S.shape[0] L, _ = cho_factor(S + eps * np.eye(npts), lower=True) L = np.tril(L) u = np.random.randn(npts, ndraws) x = np.dot(L, u) + mu[:, None] return x.T def compute_gp(t_train, y_train, t_test, sigma=0, A=1.0, l=1.0): """ Compute the mean vector and covariance matrix of a GP at times `t_test` given training points `y_train(t_train)`. The training points have uncertainty `sigma` and the kernel is assumed to be an Exponential Squared Kernel with amplitude `A` and lengthscale `l`. """ # Compute the required matrices kernel = ExpSquaredKernel Stt = kernel(t_train, A=1.0, l=1.0) Stt += sigma ** 2 * np.eye(Stt.shape[0]) Spp = kernel(t_test, A=1.0, l=1.0) Spt = kernel(t_test, t_train, A=1.0, l=1.0) # Compute the mean and covariance of the GP mu = np.dot(Spt, np.linalg.solve(Stt, y_train)) S = Spp - np.dot(Spt, np.linalg.solve(Stt, Spt.T)) return mu, S ``` ## The Marginal Likelihood In the previous notebook, we learned how to construct and sample from a simple GP. This is useful for making predictions, i.e., interpolating or extrapolating based on the data you measured. But the true power of GPs comes from their application to *regression* and *inference*: given a dataset $D$ and a model $M(\theta)$, what are the values of the model parameters $\theta$ that are consistent with $D$? The parameters $\theta$ can be the hyperparameters of the GP (the amplitude and time scale), the parameters of some parametric model, or all of the above. A very common use of GPs is to model things you don't have an explicit physical model for, so quite often they are used to model "nuisances" in the dataset. But just because you don't care about these nuisances doesn't mean they don't affect your inference: in fact, unmodelled correlated noise can often lead to strong biases in the parameter values you infer. In this notebook, we'll learn how to compute likelihoods of Gaussian Processes so that we can *marginalize* over the nuisance parameters (given suitable priors) and obtain unbiased estimates for the physical parameters we care about. Given a set of measurements $y$ distributed according to $$ \begin{align} y \sim \mathcal{N}(\mathbf{\mu}(\theta), \mathbf{\Sigma}(\alpha)) \end{align} $$ where $\theta$ are the parameters of the mean model $\mu$ and $\alpha$ are the hyperparameters of the covariance model $\mathbf{\Sigma}$, the *marginal likelihood* of $y$ is $$ \begin{align} \ln P(y | \theta, \alpha) = -\frac{1}{2}(y-\mu)^\top \mathbf{\Sigma}^{-1} (y-\mu) - \frac{1}{2}\ln |\mathbf{\Sigma}| - \frac{N}{2} \ln 2\pi \end{align} $$ where $||$ denotes the determinant and $N$ is the number of measurements. The term *marginal* refers to the fact that this expression implicitly integrates over all possible values of the Gaussian Process; this is not the likelihood of the data given one particular draw from the GP, but given the ensemble of all possible draws from $\mathbf{\Sigma}$. <div style="background-color: #D6EAF8; border-left: 15px solid #2E86C1;"> <h1 style="line-height:2.5em; margin-left:1em;">Exercise 1</h1> </div> Define a function ``ln_gp_likelihood(t, y, sigma, A=1, l=1)`` that returns the log-likelihood defined above for a vector of measurements ``y`` at a set of times ``t`` with uncertainty ``sigma``. As before, ``A`` and ``l`` should get passed direcetly to the kernel function. Note that you're going to want to use [np.linalg.slogdet](https://docs.scipy.org/doc/numpy-1.14.0/reference/generated/numpy.linalg.slogdet.html) to compute the log-determinant of the covariance instead of ``np.log(np.linalg.det)``. (Why?) ```python def ln_gp_likelihood(t, y, sigma=0, A=1.0, l=1.0): """ Docstring """ C = ExpSquaredKernel(t, A=A, l=l) + np.eye(len(y)) * sigma**2 term1 = -0.5 * np.dot(y.T, np.linalg.solve(C, y)) term2 = -0.5 * np.linalg.slogdet(C)[1] term3 = -1.0 * len(y) / 2 * np.log(2 * np.pi) loglike = term1 + term2 + term3 return loglike ``` <div style="background-color: #D6EAF8; border-left: 15px solid #2E86C1;"> <h1 style="line-height:2.5em; margin-left:1em;">Exercise 2</h1> </div> The following dataset was generated from a zero-mean Gaussian Process with a Squared Exponential Kernel of unity amplitude and unknown timescale. Compute the marginal log likelihood of the data over a range of reasonable values of $l$ and find the maximum. Plot the **likelihood** (not log likelihood) versus $l$; it should be pretty Gaussian. How well are you able to constrain the timescale of the GP? ```python import matplotlib.pyplot as plt ``` ```python t, y, sigma = np.loadtxt("data/sample_data.txt", unpack=True) plt.plot(t, y, "k.", alpha=0.5, ms=3) plt.xlabel("time") plt.ylabel("data"); ``` ```python l = np.linspace(0.05, 15, 1000) log_likelihoods = np.array([ln_gp_likelihood(t, y, sigma=sigma, A=1.0, l=l_val) for l_val in l]) likelihoods = np.exp(log_likelihoods - np.max(log_likelihoods)) ``` ```python plt.plot(l, likelihoods) plt.xlim(0,1) plt.show() print(l[np.argmax(likelihoods)]) ``` <div style="background-color: #D6EAF8; border-left: 15px solid #2E86C1;"> <h1 style="line-height:2.5em; margin-left:1em;">Exercise 3a</h1> </div> The timeseries below was generated by a linear function of time, $y(t)= mt + b$. In addition to observational uncertainty $\sigma$ (white noise), there is a fair bit of correlated (red) noise, which we will assume is well described by the squared exponential covariance with a certain (unknown) amplitude $A$ and timescale $l$. Your task is to estimate the values of $m$ and $b$, the slope and intercept of the line, respectively. In this part of the exercise, **assume there is no correlated noise.** Your model for the $n^\mathrm{th}$ datapoint is thus $$ \begin{align} y_n \sim \mathcal{N}(m t_n + b, \sigma_n\mathbf{I}) \end{align} $$ and the probability of the data given the model can be computed by calling your GP likelihood function: ```python def lnprob(params): m, b = params model = m * t + b return ln_gp_likelihood(t, y - model, sigma, A=0, l=1) ``` Note, importantly, that we are passing the **residual vector**, $y - (mt + b)$, to the GP, since above we coded up a zero-mean Gaussian process. We are therefore using the GP to model the **residuals** of the data after applying our physical model (the equation of the line). To estimate the values of $m$ and $b$ we could generate a fine grid in those two parameters and compute the likelihood at every point. But since we'll soon be fitting for four parameters (in the next part), we might as well upgrade our inference scheme and use the ``emcee`` package to do Markov Chain Monte Carlo (MCMC). If you haven't used ``emcee`` before, check out the first few tutorials on the [documentation page](https://emcee.readthedocs.io/en/latest/). The basic setup for the problem is this: ```python import emcee sampler = emcee.EnsembleSampler(nwalkers, ndim, lnprob) initial = [4.0, 15.0] p0 = initial + 1e-3 * np.random.randn(nwalkers, ndim) print("Running burn-in...") p0, _, _ = sampler.run_mcmc(p0, nburn) # nburn = 500 should do sampler.reset() print("Running production...") sampler.run_mcmc(p0, nsteps); # nsteps = 1000 should do ``` where ``nwalkers`` is the number of walkers (something like 20 or 30 is fine), ``ndim`` is the number of dimensions (2 in this case), and ``lnprob`` is the log-probability function for the data given the model. Finally, ``p0`` is a list of starting positions for each of the walkers. Above we picked some fiducial/eyeballed value for $m$ and $b$, then added a small random number to each to generate different initial positions for each walker. This will initialize all walkers in a ball centered on some point, and as the chain progresses they'll diffuse out and begin to explore the posterior. Once you have sampled the posterior, plot several draws from it on top of the data. You can access a random draw from the posterior by doing ```python m, b = sampler.flatchain[np.random.randint(len(sampler.flatchain))] ``` Also plot the **true** line that generated the dataset (given by the variables ``m_true`` and ``b_true`` below). Do they agree, or is there bias in your inferred values? Use the ``corner`` package to plot the joint posterior. How many standard deviations away from the truth are your inferred values? ```python t, y, sigma = np.loadtxt("data/sample_data_line.txt", unpack=True) m_true, b_true, A_true, l_true = np.loadtxt("data/sample_data_line_truths.txt", unpack=True) plt.errorbar(t, y, yerr=sigma, fmt="k.", label="observed") plt.plot(t, m_true * t + b_true, color="C0", label="truth") plt.legend(fontsize=12) plt.xlabel("time") plt.ylabel("data") plt.show() ``` ```python def lnprob(params): m, b = params model = m * t + b return ln_gp_likelihood(t, y - model, sigma, A=0, l=1) ``` ```python #!pip install emcee import emcee ``` ```python nwalkers = 24 ndim = 2 sampler = emcee.EnsembleSampler(nwalkers, ndim, lnprob) ``` ```python nburn = 500 nsteps = 1000 initial = [4.0, 15.0] p0 = initial + 1e-3 * np.random.randn(nwalkers, ndim) print("Running burn-in...") p0, _, _ = sampler.run_mcmc(p0, nburn) # nburn = 500 should do sampler.reset() print("Running production...") sampler.run_mcmc(p0, nsteps); # nsteps = 1000 should do ``` Running burn-in... Running production... ```python draws = [] for i in range(10): m, b = sampler.flatchain[np.random.randint(len(sampler.flatchain))] draws.append(m * t + b) ``` ```python plt.errorbar(t, y, yerr=sigma, fmt="k.", label="observed") plt.plot(t, m_true * t + b_true, color="C0", label="truth", lw=3, ls='--') for i in range(9): plt.plot(t, draws[i], label=None) plt.plot(t, draws[9], label='draws') plt.legend(fontsize=12) plt.xlabel("time") plt.ylabel("data") plt.show() ``` ```python from corner import corner ``` ```python fig = corner(sampler.flatchain, truths=(m_true, b_true), range=((0,6), (10, 20))); ``` <div style="background-color: #D6EAF8; border-left: 15px solid #2E86C1;"> <h1 style="line-height:2.5em; margin-left:1em;">Exercise 3b</h1> </div> This time, let's actually model the correlated noise. Re-define your ``lnprob`` function to accept four parameters (slope, intercept, amplitude, and timescale). If you didn't before, it's a good idea to enforce some priors to keep the parameters within reasonable (and physical) ranges. If any parameter falls outside this range, have ``lnprob`` return negative infinity (i.e., zero probability). You'll probably want to run your chains for a bit longer this time, too. As before, plot some posterior samples for the line, as well as the corner plot. How did you do this time? Is there any bias in your inferred values? How does the variance compare to the previous estimate? ```python def lnprob(params): m, b, a, l = params if m > 6 or m < 2 or b < 15 or b > 20 or a <=0.0 or l <= 0.0: return -np.inf model = m * t + b return ln_gp_likelihood(t, y - model, sigma, A=a, l=l) ``` ```python nwalkers = 50 ndim = 4 sampler = emcee.EnsembleSampler(nwalkers, ndim, lnprob) ``` ```python nburn = 1000 nsteps = 500 initial = [4.0, 15.0, 1.0, 1.0] p0 = initial + 1e-3 * np.random.randn(nwalkers, ndim) print("Running burn-in...") p0, _, _ = sampler.run_mcmc(p0, nburn) # nburn = 500 should do sampler.reset() print("Running production...") sampler.run_mcmc(p0, nsteps); # nsteps = 1000 should do ``` Running burn-in... /Users/rmorgan/anaconda3/lib/python3.7/site-packages/emcee/ensemble.py:335: RuntimeWarning: invalid value encountered in subtract lnpdiff = (self.dim - 1.) * np.log(zz) + newlnprob - lnprob0 /Users/rmorgan/anaconda3/lib/python3.7/site-packages/emcee/ensemble.py:336: RuntimeWarning: invalid value encountered in greater accept = (lnpdiff > np.log(self._random.rand(len(lnpdiff)))) Running production... ```python draws = [] for i in range(10): m, b, a, l = sampler.flatchain[np.random.randint(len(sampler.flatchain))] draws.append(m * t + b) ``` ```python plt.errorbar(t, y, yerr=sigma, fmt="k.", label="observed") plt.plot(t, m_true * t + b_true, color="C0", label="truth", lw=3, ls='--') for i in range(9): plt.plot(t, draws[i], label=None) plt.plot(t, draws[9], label='draws') plt.legend(fontsize=12) plt.xlabel("time") plt.ylabel("data") plt.show() ``` ```python fig = corner(sampler.flatchain, truths=(m_true, b_true, 1.0, 1.0)); ``` ```python ``` <div style="background-color: #D6EAF8; border-left: 15px solid #2E86C1;"> <h1 style="line-height:2.5em; margin-left:1em;">Exercise 3c</h1> </div> If you didn't do this already, re-plot the posterior samples on top of the data, but this time draw them from the GP, *conditioned on the data*. How good is the fit?
import field_theory.ratfunc import data.complex.basic -- ring of integers ℤ example : comm_ring ℤ := by apply_instance -- field of fractions ℚ noncomputable example : ℚ ≃ₐ[ℤ] fraction_ring ℤ := (fraction_ring.alg_equiv ℤ ℚ).symm -- ring of polynomials over the complexes noncomputable example : comm_ring (polynomial ℂ) := by apply_instance -- field of fractions ℂ(X) noncomputable example : ratfunc ℂ ≃ₐ[ℂ] fraction_ring (polynomial ℂ) := (fraction_ring.alg_equiv (polynomial ℂ) (ratfunc ℂ)).symm.restrict_scalars ℂ -- An element of f(X) : ℂ(X) is a “rational function,” i.e., a quotient -- of two polynomials, P(X), Q(X) : ℂ[X], Q(X) ≠ 0; -- we can always require that Q(X) is monic, i.e., its leading coefficient is 1. example (f : ratfunc ℂ) : ∃ (p q : polynomial ℂ) (hq : q ≠ 0) (hm : q.monic), f = ratfunc.mk p q := ⟨f.num, f.denom, f.denom_ne_zero, f.monic_denom, by simp only [ratfunc.mk_eq_div, ratfunc.num_div_denom]⟩ -- Any rational number x : ℚ is a quotient of two integers -- with a, b : ℤ, b ≠ 0, we can always require b > 0 example (x : ℚ) : ∃ (a b : ℤ) (hb : 0 < b), x = a / b := ⟨x.num, x.denom, int.coe_nat_pos.mpr x.pos, x.num_div_denom.symm⟩
import os import unittest import pandas as pd import numpy as np import torch from soc.datasets import utils, soc_data from soc import losses cfd = os.path.dirname(os.path.realpath(__file__)) fixture_dir = os.path.join(cfd, 'fixtures') class TestLosses(unittest.TestCase): @classmethod def setUpClass(cls): data = torch.load(os.path.join(fixture_dir, 'soc_seq_3_raw_df.pt')) def _get_states_from_db_se_f(self, idx: int) -> pd.DataFrame: return data[idx][0] def _get_actions_from_db_se_f(self, idx: int) -> pd.DataFrame: return data[idx][1] cls._get_states_from_db_se_f = _get_states_from_db_se_f cls._get_actions_from_db_se_f = _get_actions_from_db_se_f def test_hexlayout_loss(self): state = self._get_states_from_db_se_f(0) state = utils.preprocess_states(state) state = state.iloc[7] state_t = torch.tensor( np.concatenate([state[col] for col in soc_data.STATE_FIELDS], axis=0), dtype=torch.float32 ) # yapf: ignore state_t = state_t.unsqueeze(0) indexes = [0, 2] loss = losses.hexlayout_loss(indexes, state_t, state_t, 1.0) assert loss == 0 loss = losses.hexlayout_loss(indexes, state_t + 0.2, state_t, 1.0) assert loss != 0
######### Stan program example ########### using StanSample, MCMCChains binorm_model = " transformed data { matrix[2,2] Sigma; vector[2] mu; mu[1] = 0.0; mu[2] = 0.0; Sigma[1,1] = 1.0; Sigma[2,2] = 1.0; Sigma[1,2] = 0.10; Sigma[2,1] = 0.10; } parameters { vector[2] y; } model { y ~ multi_normal(mu, Sigma); } " sm = SampleModel("binormal", binorm_model); rc = stan_sample(sm) if success(rc) chn = read_samples(sm, :mcmcchains) chn |> display end
Formal statement is: lemma of_real_of_nat_eq [simp]: "of_real (of_nat n) = of_nat n" Informal statement is: $\mathbb{R} \ni \mathrm{of\_real}(\mathrm{of\_nat}(n)) = \mathrm{of\_nat}(n) \in \mathbb{R}$.
{-# OPTIONS --without-K --safe --no-sized-types --no-guardedness --no-subtyping #-} module Agda.Builtin.Float where open import Agda.Builtin.Bool open import Agda.Builtin.Int open import Agda.Builtin.Maybe open import Agda.Builtin.Nat open import Agda.Builtin.Sigma open import Agda.Builtin.String open import Agda.Builtin.Word postulate Float : Set {-# BUILTIN FLOAT Float #-} primitive -- Relations primFloatInequality : Float → Float → Bool primFloatEquality : Float → Float → Bool primFloatLess : Float → Float → Bool primFloatIsInfinite : Float → Bool primFloatIsNaN : Float → Bool primFloatIsNegativeZero : Float → Bool primFloatIsSafeInteger : Float → Bool -- Conversions primFloatToWord64 : Float → Word64 primNatToFloat : Nat → Float primIntToFloat : Int → Float primFloatRound : Float → Maybe Int primFloatFloor : Float → Maybe Int primFloatCeiling : Float → Maybe Int primFloatToRatio : Float → (Σ Int λ _ → Int) primRatioToFloat : Int → Int → Float primFloatDecode : Float → Maybe (Σ Int λ _ → Int) primFloatEncode : Int → Int → Maybe Float primShowFloat : Float → String -- Operations primFloatPlus : Float → Float → Float primFloatMinus : Float → Float → Float primFloatTimes : Float → Float → Float primFloatDiv : Float → Float → Float primFloatPow : Float → Float → Float primFloatNegate : Float → Float primFloatSqrt : Float → Float primFloatExp : Float → Float primFloatLog : Float → Float primFloatSin : Float → Float primFloatCos : Float → Float primFloatTan : Float → Float primFloatASin : Float → Float primFloatACos : Float → Float primFloatATan : Float → Float primFloatATan2 : Float → Float → Float primFloatSinh : Float → Float primFloatCosh : Float → Float primFloatTanh : Float → Float primFloatASinh : Float → Float primFloatACosh : Float → Float primFloatATanh : Float → Float {-# COMPILE JS primFloatRound = function(x) { x = agdaRTS._primFloatRound(x); if (x === null) { return z_jAgda_Agda_Builtin_Maybe["Maybe"]["nothing"]; } else { return z_jAgda_Agda_Builtin_Maybe["Maybe"]["just"](x); } }; #-} {-# COMPILE JS primFloatFloor = function(x) { x = agdaRTS._primFloatFloor(x); if (x === null) { return z_jAgda_Agda_Builtin_Maybe["Maybe"]["nothing"]; } else { return z_jAgda_Agda_Builtin_Maybe["Maybe"]["just"](x); } }; #-} {-# COMPILE JS primFloatCeiling = function(x) { x = agdaRTS._primFloatCeiling(x); if (x === null) { return z_jAgda_Agda_Builtin_Maybe["Maybe"]["nothing"]; } else { return z_jAgda_Agda_Builtin_Maybe["Maybe"]["just"](x); } }; #-} {-# COMPILE JS primFloatToRatio = function(x) { x = agdaRTS._primFloatToRatio(x); return z_jAgda_Agda_Builtin_Sigma["_,_"](x.numerator)(x.denominator); }; #-} {-# COMPILE JS primFloatDecode = function(x) { x = agdaRTS._primFloatDecode(x); if (x === null) { return z_jAgda_Agda_Builtin_Maybe["Maybe"]["nothing"]; } else { return z_jAgda_Agda_Builtin_Maybe["Maybe"]["just"]( z_jAgda_Agda_Builtin_Sigma["_,_"](x.mantissa)(x.exponent)); } }; #-} {-# COMPILE JS primFloatEncode = function(x) { return function (y) { x = agdaRTS.uprimFloatEncode(x, y); if (x === null) { return z_jAgda_Agda_Builtin_Maybe["Maybe"]["nothing"]; } else { return z_jAgda_Agda_Builtin_Maybe["Maybe"]["just"](x); } } }; #-} primFloatNumericalEquality = primFloatEquality {-# WARNING_ON_USAGE primFloatNumericalEquality "Warning: primFloatNumericalEquality was deprecated in Agda v2.6.2. Please use primFloatEquality instead." #-} primFloatNumericalLess = primFloatLess {-# WARNING_ON_USAGE primFloatNumericalLess "Warning: primFloatNumericalLess was deprecated in Agda v2.6.2. Please use primFloatLess instead." #-} primRound = primFloatRound {-# WARNING_ON_USAGE primRound "Warning: primRound was deprecated in Agda v2.6.2. Please use primFloatRound instead." #-} primFloor = primFloatFloor {-# WARNING_ON_USAGE primFloor "Warning: primFloor was deprecated in Agda v2.6.2. Please use primFloatFloor instead." #-} primCeiling = primFloatCeiling {-# WARNING_ON_USAGE primCeiling "Warning: primCeiling was deprecated in Agda v2.6.2. Please use primFloatCeiling instead." #-} primExp = primFloatExp {-# WARNING_ON_USAGE primExp "Warning: primExp was deprecated in Agda v2.6.2. Please use primFloatExp instead." #-} primLog = primFloatLog {-# WARNING_ON_USAGE primLog "Warning: primLog was deprecated in Agda v2.6.2. Please use primFloatLog instead." #-} primSin = primFloatSin {-# WARNING_ON_USAGE primSin "Warning: primSin was deprecated in Agda v2.6.2. Please use primFloatSin instead." #-} primCos = primFloatCos {-# WARNING_ON_USAGE primCos "Warning: primCos was deprecated in Agda v2.6.2. Please use primFloatCos instead." #-} primTan = primFloatTan {-# WARNING_ON_USAGE primTan "Warning: primTan was deprecated in Agda v2.6.2. Please use primFloatTan instead." #-} primASin = primFloatASin {-# WARNING_ON_USAGE primASin "Warning: primASin was deprecated in Agda v2.6.2. Please use primFloatASin instead." #-} primACos = primFloatACos {-# WARNING_ON_USAGE primACos "Warning: primACos was deprecated in Agda v2.6.2. Please use primFloatACos instead." #-} primATan = primFloatATan {-# WARNING_ON_USAGE primATan "Warning: primATan was deprecated in Agda v2.6.2. Please use primFloatATan instead." #-} primATan2 = primFloatATan2 {-# WARNING_ON_USAGE primATan2 "Warning: primATan2 was deprecated in Agda v2.6.2. Please use primFloatATan2 instead." #-}
Require Import HoTT.HoTT GenericZipAndTraverse.PolynomialFunctors. Definition zipExtension (p : Polynomial) {A B : Type} : Pullback (pr1 (P := fun i => Direction p i -> A)) (pr1 (P := fun i => Direction p i -> B)) <~> Extension p (A * B). Proof. refine ( equiv_functor_sigma_id (fun i => equiv_prod_coind _ _) oE (equiv_functor_sigma_pb (Q := fun '(i; i'; w) => (Direction p i -> A) * (Direction p i' -> B)) (equiv_pr1 (fun i => {i' : Position p & i = i'}))^-1)^-1 oE _ ). make_equiv. Defined. Definition zip (F : Type -> Type) `{IsPolynomialFunctor F} {A B : Type} : Pullback (pr1 o equivalenceToExtension F A) (pr1 o equivalenceToExtension F B) <~> F (A * B) := (equivalenceToExtension F (A * B))^-1 oE zipExtension (polynomial F) oE (equiv_sigma_prod (fun '(x', y') => pr1 x' = pr1 y'))^-1 oE equiv_functor_sigma_pb (equivalenceToExtension F A *E equivalenceToExtension F B) oE equiv_sigma_prod _. Notation unzip F := (zip F)^-1. Context `{Funext}. Open Scope nat_scope. Eval compute in zip Tree ( node leaf 2 (node leaf 4 leaf) ; node leaf true (node leaf false leaf) ; idpath ). Eval compute in unzip Tree (node leaf (0, false) (node leaf (1, true) leaf)).
#include("src/magpoly.jl") #using .magpoly #using Polynomials #@time begin #beta_temp = 0.5 #spins_coupling = 1.0 #alpha = 1.0 #magpoly.simulation(200, 2, beta_temp, spins_coupling, alpha, "final_config.txt") #magpoly.simulation("input.txt") #magpoly.MMC_simulation(100, 2000, 500) #magpoly.MMC_simulation(150, 6000, 500) #magpoly.MMC_simulation(500, 200, 100) #magpoly.simulation("input.txt") #end include("src/sf_synthetic_likelihood.jl") #synthetic_likelihood_polymer(300, 2, 100, 30000, 0.03, [-0.6,2.2,0.3], "features.txt", "data_file_uncoupled.txt") Qamhi_polymer(200, 2, 100, 10000, 0.05, [-0.60148367, 0.94279556, 0.06326793], "features.txt", "saw_conf_data20.txt")
import numpy as np ################################################################# # Implements the mountain car MDP ################################################################# class MountainCar(): def __init__(self, term_r = 10.0, nonterm_r = -1.0, height_reward = True, discrete = False, discount = 0.95): self.actions = np.array([-1.0, 0.0, 1.0]) self.n_actions = 3 self.state_shape = (1,2) # x and v self.term_r = term_r self.nonterm_r = nonterm_r self.vmin, self.vmax = (-0.07, 0.07) self.xmin, self.xmax = (-1.2, 0.6) self.height_reward = height_reward self.discrete = discrete self.xgrid = 10 self.vgrid = 10 self.discrete_x = np.linspace(self.xmin, self.xmax, self.xgrid) self.discrete_v = np.linspace(self.vmin, self.vmax, self.vgrid) def transition(self, s, a): """ Returns a next state, given a state and an action """ sp = np.zeros(2, dtype=np.float32) #sp = np.zeros(2, dtype=np.float32) sp[1] = s[1] + 0.001 * self.actions[a] - 0.0025 * np.cos(3 * s[0]) sp[1] = self.vclip(sp[1]) sp[0] = self.xclip(s[0] + sp[1]) return sp def reward(self, s, a): """ Rewarded for reaching goal state, penalized for all other states """ r = s[0] if (self.height_reward and s[0] > 0.0) else 0 if s[0] >= self.xmax: r += self.term_r else: r += self.nonterm_r return r def isterminal(self, s): if s[0] >= self.xmax: return True return False def initial_state(self): xi = np.random.uniform(self.xmin, self.xmax*0.9) vi = 0.0 return np.array([xi, vi], dtype=np.float32) ################################################################# ########################## UTILITIES ############################ ################################################################# def clip(self, val, lo, hi): return min(hi, max(val, lo)) def vclip(self, val): return self.clip(val, self.vmin, self.vmax) def xclip(self, val): return self.clip(val, self.xmin, self.xmax) def find_nearest(self, vals, target): idx = (np.abs(vals - target)).argmin() return vals[target]
# # This is a Shiny web application. # # Find out more about building applications with Shiny here: # # http://shiny.rstudio.com/ # library(shiny) library( DT ) # Define UI for application that creates a datatables ui <- fluidPage( # Application title titlePanel("Download Datatable") # Show a plot of the generated distribution , mainPanel( DT::dataTableOutput("fancyTable") ) # end of main panel ) # end of fluid page # Define server logic required to create datatable server <- function(input, output) { output$fancyTable <- DT::renderDataTable( datatable( data = mtcars , extensions = 'Buttons' , options = list( dom = "Blfrtip" , buttons = list("copy", list( extend = "collection" , buttons = c("csv", "excel", "pdf") , text = "Download" ) ) # end of buttons customization # customize the length menu , lengthMenu = list( c(10, 20, -1) # declare values , c(10, 20, "All") # declare titles ) # end of lengthMenu customization , pageLength = 10 ) # end of options ) # end of datatables ) } # end of server # Run the application shinyApp(ui = ui, server = server)
(* File: Pnorm.thy Author: Jose Manuel Rodriguez Caballero, University of Tartu Author: Manuel Eberl, TU München *) section \<open>p-adic valuation and p-adic norm\<close> theory Pnorm imports "HOL-Number_Theory.Number_Theory" begin text \<open> Following ~\cite{koblitz2012p}, we define the p-adic valuation @{text pval}, the p-adic norm @{text pnorm} in a computational way. We prove their basic properties. \<close> subsection \<open>Unsorted\<close> lemma quotient_of_int' [simp]: "quotient_of (of_int a) = (a, 1)" using Rat.of_int_def quotient_of_int by auto lemma snd_quotient_of_nonzero [simp]: "snd (quotient_of x) \<noteq> 0" using quotient_of_denom_pos[of x "fst (quotient_of x)" "snd (quotient_of x)"] by simp lemma fst_quotient_of_eq_0_iff [simp]: "fst (quotient_of x) = 0 \<longleftrightarrow> x = 0" by (metis divide_eq_0_iff fst_conv of_int_0 prod.collapse quotient_of_div quotient_of_int') lemma multiplicity_int_int [simp]: "multiplicity (int a) (int b) = multiplicity a b" by (simp add: multiplicity_def flip: of_nat_power) lemma multiplicity_add_absorb_left: assumes "multiplicity p x < multiplicity p y" "x \<noteq> 0" shows "multiplicity p (x + y) = multiplicity p x" proof (cases "y = 0 \<or> is_unit p") case False show ?thesis proof (rule multiplicity_eqI) from assms show "p ^ multiplicity p x dvd x + y" by (intro dvd_add) (auto intro!: multiplicity_dvd') show "\<not>p ^ Suc (multiplicity p x) dvd x + y" using assms False by (subst dvd_add_left_iff; subst power_dvd_iff_le_multiplicity) auto qed qed (use assms in \<open>auto simp: multiplicity_unit_left\<close>) lemma multiplicity_add_absorb_right: assumes "multiplicity p x > multiplicity p y" "y \<noteq> 0" shows "multiplicity p (x + y) = multiplicity p y" using multiplicity_add_absorb_left[of p y x] assms by (simp add: add.commute) lemma multiplicity_add_ge: assumes "x + y \<noteq> 0" shows "multiplicity p (x + y) \<ge> min (multiplicity p x) (multiplicity p y)" proof (cases "is_unit p \<or> x = 0 \<or> y = 0") case False thus ?thesis using assms by (intro multiplicity_geI dvd_add) (auto intro!: multiplicity_dvd') qed (auto simp: multiplicity_unit_left) lemma multiplicity_minus_right [simp]: "multiplicity a (-b :: 'a :: {factorial_semiring,comm_ring_1}) = multiplicity a b" by (simp add: multiplicity_def) lemma multiplicity_minus_left [simp]: "multiplicity (-a :: 'a :: {factorial_semiring,comm_ring_1}) b = multiplicity a b" using multiplicity_times_unit_left[of "-1" a b] by simp definition intpow :: "'a :: {inverse, power} \<Rightarrow> int \<Rightarrow> 'a" where "intpow x n = (if n \<ge> 0 then x ^ nat n else inverse x ^ (nat (-n)))" (* The option to the user to use the same notation as powr *) notation intpow (infixr "powi" 80) lemma intpow_int [simp]: " x powi (int n) = x ^ n" by (simp add: intpow_def) lemma intpow_minus [simp]: "intpow (x :: 'a :: field) (-int n) = inverse (intpow x n)" by (auto simp: intpow_def power_inverse) lemma intpow_eq_0_iff [simp]: "intpow (x :: 'a :: field) n = 0 \<longleftrightarrow> x = 0 \<and> n \<noteq> 0" by (auto simp: intpow_def) subsection \<open>Definitions\<close> text\<open> The following function is a version of the p-adic valuation as defined in ~\cite{koblitz2012p}, with the exception that for us the valuation of zero will be zero rather than infinity as in done in traditional mathematics. This definition is computational. \<close> definition pval :: \<open>nat \<Rightarrow> rat \<Rightarrow> int\<close> where \<open>pval p x = int (multiplicity p (fst (quotient_of x))) - int (multiplicity p (snd (quotient_of x)))\<close> text\<open> The following function is the p-adic norm as defined in ~\cite{koblitz2012p}. This definition is computational. \<close> definition pnorm :: \<open>nat \<Rightarrow> rat \<Rightarrow> real\<close> where \<open>pnorm p x = (if x = 0 then 0 else p powr -of_int (pval p x))\<close> subsection \<open>Trivial simplifications\<close> lemma pval_eq_imp_norm_eq: \<open>pval p x = pval p y \<Longrightarrow> x \<noteq> 0 \<Longrightarrow> y \<noteq> 0 \<Longrightarrow> pnorm p x = pnorm p y\<close> by (simp add: pnorm_def) lemma pval_0 [simp]: "pval p 0 = 0" and pval_1 [simp]: "pval p 1 = 0" by (simp_all add: pval_def) lemma pnorm_0 [simp]: "pnorm p 0 = 0" and pnorm_1 [simp]: "prime p \<Longrightarrow> pnorm p 1 = 1" by (simp_all add: pnorm_def prime_gt_0_nat) lemma pnorm_nonneg: "pnorm p x \<ge> 0" by (simp add: pnorm_def) lemma pnorm_pos: "x \<noteq> 0 \<Longrightarrow> prime p \<Longrightarrow> pnorm p x > 0" by (auto simp: pnorm_def) lemma pnorm_eq_0_iff [simp]: "pnorm p x = 0 \<longleftrightarrow> p = 0 \<or> x = 0" by (auto simp: pnorm_def) lemma pnorm_le_iff: assumes "prime p" "x \<noteq> 0" "y \<noteq> 0" shows "pnorm p x \<le> pnorm p y \<longleftrightarrow> pval p x \<ge> pval p y" using assms prime_gt_1_nat[of p] by (simp add: pnorm_def) lemma pnorm_less_iff: assumes "prime p" "x \<noteq> 0" "y \<noteq> 0" shows "pnorm p x < pnorm p y \<longleftrightarrow> pval p x > pval p y" using assms prime_gt_1_nat[of p] by (simp add: pnorm_def) lemma pnorm_eq_iff: assumes "prime p" "x \<noteq> 0" "y \<noteq> 0" shows "pnorm p x = pnorm p y \<longleftrightarrow> pval p x = pval p y" using assms prime_gt_1_nat[of p] by (simp add: pnorm_def powr_inj) lemma pnorm_eq_imp_pval_eq: assumes "pnorm p x = pnorm p y" "prime p" shows "pval p x = pval p y" using assms prime_gt_1_nat[of p] by (cases "x = 0 \<or> y = 0") (auto simp: pnorm_def powr_inj split: if_splits) (* Comment by Manuel: his lemma allows to determine a fraction's p-adic valuation even if it is not on lowest terms *) lemma pval_quotient: assumes "prime p" and [simp]: "a \<noteq> 0" "b \<noteq> 0" shows "pval p (of_int a / of_int b) = int (multiplicity p a) - int (multiplicity p b)" proof - define d where "d = sgn b * gcd a b" define a' b' where "a' = a div d" and "b' = b div d" have a'b': "a = a' * d" "b = b' * d" by (simp_all add: d_def a'_def b'_def) from assms have [simp]: "a' \<noteq> 0" "b' \<noteq> 0" "d \<noteq> 0" by (simp_all add: a'b') have "pval p (of_int a / of_int b) = int (multiplicity p a') - int (multiplicity p b')" by (auto simp: pval_def rat_divide_code case_prod_unfold Let_def Rat.normalize_def d_def a'_def b'_def sgn_if) also have "\<dots> = int (multiplicity p a' + multiplicity p d) - int (multiplicity p b' + multiplicity p d)" by simp also have "\<dots> = int (multiplicity p a) - int (multiplicity p b)" unfolding a'b' using \<open>prime p\<close> by (subst (1 2) prime_elem_multiplicity_mult_distrib) auto finally show ?thesis . qed lemma pval_of_int [simp]: "pval p (of_int n) = multiplicity p n" by (simp add: pval_def) lemma pval_of_nat [simp]: "pval p (of_nat n) = multiplicity p n" using pval_of_int[of p "int n"] by (simp del: pval_of_int) lemma pval_numeral [simp]: "pval p (numeral n) = multiplicity p (numeral n)" using pval_of_nat[of p "numeral n"] by (simp del: pval_of_nat) lemma pval_mult [simp]: assumes "prime p" and [simp]: "x \<noteq> 0" "y \<noteq> 0" shows "pval p (x * y) = pval p x + pval p y" proof - define a b where "a = fst (quotient_of x)" and "b = snd (quotient_of x)" define c d where "c = fst (quotient_of y)" and "d = snd (quotient_of y)" have xy: "x = of_int a / of_int b" "y = of_int c / of_int d" by (rule quotient_of_div; simp add: a_def b_def c_def d_def)+ have [simp]: "a \<noteq> 0" "c \<noteq> 0" using xy by auto have [simp]: "b \<noteq> 0" "d \<noteq> 0" by (auto simp: b_def d_def) have "x * y = of_int (a * c) / of_int (b * d)" by (simp add: xy) also have "pval p \<dots> = int (multiplicity p (a * c)) - int (multiplicity p (b * d))" using \<open>prime p\<close> by (subst pval_quotient) auto also have "\<dots> = pval p x + pval p y" using \<open>prime p\<close> by (simp add: xy pval_quotient prime_elem_multiplicity_mult_distrib) finally show ?thesis . qed lemma pnorm_mult [simp]: "prime p \<Longrightarrow> pnorm p (x * y) = pnorm p x * pnorm p y" by (simp add: pnorm_def powr_diff powr_minus field_simps) lemma pval_inverse [simp]: "pval p (inverse x) = -pval p x" proof (cases "x = 0") case [simp]: False define a b where "a = fst (quotient_of x)" and "b = snd (quotient_of x)" have x: "x = of_int a / of_int b" by (rule quotient_of_div; simp add: a_def b_def) have [simp]: "a \<noteq> 0" using x by auto have [simp]: "b \<noteq> 0" by (auto simp: b_def) have "\<bar>a\<bar> = sgn a * a" by (simp add: abs_if sgn_if) thus ?thesis by (auto simp: pval_def rat_inverse_code case_prod_unfold Let_def multiplicity_times_unit_right simp flip: a_def b_def) qed auto lemma pnorm_inverse [simp]: "pnorm p (inverse x) = inverse (pnorm p x)" by (simp add: pnorm_def powr_minus) lemma pval_minus [simp]: "pval p (-x) = pval p x" by (simp add: pval_def rat_uminus_code case_prod_unfold Let_def) lemma pnorm_minus [simp]: "pnorm p (-x) = pnorm p x" by (simp add: pnorm_def) lemma pval_power [simp]: assumes "prime p" shows "pval p (x ^ n) = int n * pval p x" proof (cases "x = 0") case False thus ?thesis by (induction n) (auto simp: \<open>prime p\<close> algebra_simps) qed (auto simp: power_0_left) lemma pnorm_power [simp]: "prime p \<Longrightarrow> pnorm p (x ^ n) = pnorm p x ^ n" by (auto simp: pnorm_def powr_def simp flip: exp_of_nat_mult) lemma pval_primepow: \<open>prime p \<Longrightarrow> pval p (of_int p ^ l) = l\<close> by simp lemma pnorm_primepow: \<open>prime p \<Longrightarrow> pnorm p ((of_int p)^l) = 1/p^l\<close> using prime_gt_1_nat[of p] by (simp add: pval_primepow pnorm_def powr_minus powr_realpow field_simps) lemma pval_eq_0_imp_pnorm_eq_1: "prime p \<Longrightarrow> pval p x = 0 \<Longrightarrow> x \<noteq> 0 \<Longrightarrow> pnorm p x = 1" by (auto simp: pnorm_def) lemma pnorm_eq_1_imp_pval_eq_0: "prime p \<Longrightarrow> pnorm p x = 1 \<Longrightarrow> pval p x = 0" using pnorm_eq_iff[of p x 1] by (cases "x = 0") auto lemma pnorm_eq_1_iff: "x \<noteq> 0 \<Longrightarrow> prime p \<Longrightarrow> pnorm p x = 1 \<longleftrightarrow> pval p x = 0" using pval_eq_0_imp_pnorm_eq_1 pnorm_eq_1_imp_pval_eq_0 by metis lemma pval_coprime_quotient_cases: fixes a b :: int assumes "prime p" "coprime a b" and [simp]: "a \<noteq> 0" "b \<noteq> 0" shows "\<not>p dvd b \<and> pval p (of_int a / of_int b) = int (multiplicity p a) \<or> \<not>p dvd a \<and> pval p (of_int a / of_int b) = -int (multiplicity p b)" proof - have "\<not>p dvd a \<or> \<not>p dvd b" using assms by (meson coprime_common_divisor not_prime_unit prime_nat_int_transfer) thus ?thesis using \<open>prime p\<close> by (auto simp: pval_quotient not_dvd_imp_multiplicity_0) qed lemma pval_cases: fixes a b :: int assumes "prime p" "x \<noteq> 0" shows "\<not>p dvd snd (quotient_of x) \<and> pval p x = int (multiplicity p (fst (quotient_of x))) \<or> \<not>p dvd fst (quotient_of x) \<and> pval p x = -int (multiplicity p (snd (quotient_of x)))" proof - define a b where "a = fst (quotient_of x)" and "b = snd (quotient_of x)" have x: "x = of_int a / of_int b" by (rule quotient_of_div) (simp add: a_def b_def) have [simp]: "a \<noteq> 0" using assms by (simp add: x) have [simp]: "b \<noteq> 0" by (simp add: b_def) have "coprime a b" by (rule quotient_of_coprime) (auto simp: a_def b_def) thus "\<not>p dvd b \<and> pval p x = int (multiplicity p a) \<or> \<not>p dvd a \<and> pval p x = -int (multiplicity p b)" using pval_coprime_quotient_cases[of p a b] x[symmetric] assms by simp qed subsection \<open>Integers\<close> lemma pval_nonneg_imp_in_Ints: assumes "\<And>p. prime p \<Longrightarrow> pval p x \<ge> 0" shows "x \<in> \<int>" proof (cases "x = 0") case False define a b where "a = fst (quotient_of x)" and "b = snd (quotient_of x)" have x: "x = of_int a / of_int b" by (rule quotient_of_div) (simp add: a_def b_def) have [simp]: "a \<noteq> 0" using False by (simp add: x) have [simp]: "b \<noteq> 0" by (simp add: b_def) have "coprime a b" by (rule quotient_of_coprime) (auto simp: a_def b_def) hence *: "multiplicity p b = 0" if "prime p" for p :: nat using assms[of p] pval_coprime_quotient_cases[of p a b] that by (auto simp: x pval_quotient) have "multiplicity p b = 0" if "prime p" for p :: int proof - have "multiplicity (int (nat p)) b = 0" by (rule *) (use that in auto) thus ?thesis using prime_ge_0_int[of p] that by simp qed hence "prime_factors b = {}" by (auto simp: prime_factors_multiplicity) hence "is_unit b" using \<open>b \<noteq> 0\<close> prime_factorization_empty_iff by blast hence [simp]: "b = 1" using quotient_of_denom_pos[of x a b] by (simp add: a_def b_def) thus ?thesis by (simp add: x) qed auto lemma pval_Ints_nonneg: \<open>x \<in> \<int> \<Longrightarrow> prime p \<Longrightarrow> pval p x \<ge> 0\<close> by (auto elim: Ints_cases) lemma in_Ints_iff_pval_nonneg: \<open>x \<in> \<int> \<longleftrightarrow> (\<forall>p. prime p \<longrightarrow> pval p x \<ge> 0)\<close> using pval_nonneg_imp_in_Ints pval_Ints_nonneg by blast lemma pnorm_le_1_imp_in_Ints: \<open>(\<And>p. prime p \<Longrightarrow> pnorm p x \<le> 1) \<Longrightarrow> x \<in> \<int>\<close> using pnorm_le_iff[of _ x 1] in_Ints_iff_pval_nonneg[of x] by (cases "x = 0") auto lemma in_Ints_imp_pnorm_le_1: \<open>x \<in> \<int> \<Longrightarrow> prime p \<Longrightarrow> pnorm p x \<le> 1\<close> using pnorm_le_iff[of _ x 1] in_Ints_iff_pval_nonneg[of x] by (cases "x = 0") auto lemma integers_pnorm: \<open>x \<in> \<int> \<longleftrightarrow> (\<forall>p. prime p \<longrightarrow> pnorm p x \<le> 1)\<close> using pnorm_le_1_imp_in_Ints in_Ints_imp_pnorm_le_1 by blast subsection \<open>Divisibility of the numerator and the denominator\<close> lemma pval_nonneg_iff: assumes "prime p" "x \<noteq> 0" shows "pval p x \<ge> 0 \<longleftrightarrow> \<not>p dvd snd (quotient_of x)" using pval_cases[of p x] assms by (auto simp: prime_elem_multiplicity_eq_zero_iff) lemma pval_nonpos_iff: assumes "prime p" "x \<noteq> 0" shows "pval p x \<le> 0 \<longleftrightarrow> \<not>p dvd fst (quotient_of x)" using pval_cases[of p x] assms by (auto simp: prime_elem_multiplicity_eq_zero_iff) lemma pval_neg_iff: assumes "prime p" "x \<noteq> 0" shows "pval p x < 0 \<longleftrightarrow> p dvd snd (quotient_of x)" using pval_cases[of p x] assms by (auto simp: prime_multiplicity_gt_zero_iff) lemma pval_pos_iff: assumes "prime p" "x \<noteq> 0" shows "pval p x > 0 \<longleftrightarrow> p dvd fst (quotient_of x)" using pval_cases[of p x] assms by (auto simp: prime_multiplicity_gt_zero_iff) lemma pval_eq_0_iff: assumes "prime p" "x \<noteq> 0" shows "pval p x = 0 \<longleftrightarrow> \<not>p dvd fst (quotient_of x) \<and> \<not>p dvd snd (quotient_of x)" using pval_cases[of p x] assms by (auto simp: not_dvd_imp_multiplicity_0 prime_elem_multiplicity_eq_zero_iff) subsection \<open>Existence and uniqueness of decomposition\<close> (* Comment by Manuel: It's really not a good idea to work with the real or complex power operation here. What one really needs here is an integer power operation *) lemma pval_intpow [simp]: "prime p \<Longrightarrow> pval p (intpow x n) = n * pval p x" by (auto simp: intpow_def) lemma pval_decomposition_exists: assumes "prime p" shows "\<exists>y. x = intpow (of_nat p) (pval p x) * y \<and> pval p y = 0" proof (cases "x = 0") case [simp]: False define y where "y = x / intpow (of_nat p) (pval p x)" from assms have [simp]: "y \<noteq> 0" by (auto simp: y_def) from assms have eq: "x = intpow (of_nat p) (pval p x) * y" by (auto simp: y_def) have "pval p x = pval p (intpow (of_nat p) (pval p x) * y)" by (subst eq) auto hence "pval p y = 0" using assms by simp with eq show ?thesis by blast qed auto lemma pval_decomposition_unique: fixes p :: nat and x y :: rat and l :: int shows \<open>prime p \<Longrightarrow> y \<noteq> 0 \<Longrightarrow> x = intpow (of_int p) l * y \<Longrightarrow> pval p y = 0 \<Longrightarrow> pval p x = l\<close> by auto (* Comment by Manuel: This is essentially just a copy of the above. Since pnorm = 1 iff pval = 0, there is really no point in stating this again. *) lemma pnorm_decomposition: \<open>prime p \<Longrightarrow> x \<noteq> 0 \<Longrightarrow> \<exists> y::rat. (x::rat) = (p powr (pval p x)) * y \<and> pnorm p y = 1\<close> oops subsection \<open>Unit ball\<close> (* Comment by Manuel: This is the generalised version of your unit ball properties. pval (x + y) is greater than or equal to the minimum of the pvals of x and y, with equality holding if x and y have distinct pvals. *) lemma pval_add_ge: assumes "prime p" assumes "x + y \<noteq> 0" shows "pval p (x + y) \<ge> min (pval p x) (pval p y)" proof (cases "x = 0 \<or> y = 0") case False hence [simp]: "x \<noteq> 0" "y \<noteq> 0" by auto define a b where "a = fst (quotient_of x)" and "b = snd (quotient_of x)" define c d where "c = fst (quotient_of y)" and "d = snd (quotient_of y)" have xy: "x = of_int a / of_int b" "y = of_int c / of_int d" by (rule quotient_of_div; simp add: a_def b_def c_def d_def)+ have [simp]: "a \<noteq> 0" "c \<noteq> 0" using xy by auto have [simp]: "b \<noteq> 0" "d \<noteq> 0" by (auto simp: b_def d_def) have eq: "x + y = of_int (a * d + b * c) / of_int (b * d)" by (simp add: xy field_simps) have nz: "a * d + b * c \<noteq> 0" proof assume *: "a * d + b * c = 0" have "x + y = 0" unfolding eq * by simp with assms show False by simp qed have "min (pval p x) (pval p y) = int (min (multiplicity (int p) (a * d)) (multiplicity (int p) (b * c))) - int (multiplicity (int p) (b * d))" using \<open>prime p\<close> by (simp add: xy pval_quotient prime_elem_multiplicity_mult_distrib) also have "\<dots> \<le> int (multiplicity (int p) (a * d + b * c)) - int (multiplicity (int p) (b * d))" using multiplicity_add_ge[of "a * d" "b * c" p] nz by (intro diff_right_mono) auto also have "\<dots> = pval p (x + y)" using nz assms by (subst eq, subst pval_quotient) auto finally show ?thesis . qed auto lemma pval_diff_ge: assumes "prime p" assumes "x \<noteq> y" shows "pval p (x - y) \<ge> min (pval p x) (pval p y)" using pval_add_ge[of p x "-y"] assms by auto lemma pnorm_add_le: "prime p \<Longrightarrow> pnorm p (x + y) \<le> max (pnorm p x) (pnorm p y)" using pval_add_ge[of p x y] prime_gt_1_nat[of p] by (cases "x + y = 0") (auto simp: pnorm_def max_def) lemma pnorm_diff_le: "prime p \<Longrightarrow> pnorm p (x - y) \<le> max (pnorm p x) (pnorm p y)" using pnorm_add_le[of p x "-y"] by simp lemma pnorm_sum_le: fixes p::nat and A::\<open>nat set\<close> and x::\<open>nat \<Rightarrow> rat\<close> assumes "finite A" "A \<noteq> {}" \<open>prime p\<close> shows "pnorm p (sum x A) \<le> Max ((\<lambda> i. pnorm p (x i)) ` A)" using assms proof (induction rule: finite_ne_induct) case (singleton y) thus ?case by auto next case (insert y A) have "pnorm p (x y + sum x A) \<le> max (pnorm p (x y)) (pnorm p (sum x A))" by (rule pnorm_add_le) fact also have "\<dots> \<le> max (pnorm p (x y)) (MAX i\<in>A. pnorm p (x i))" by (intro max.mono insert.IH) (auto simp: \<open>prime p\<close>) finally show ?case using insert.hyps by simp qed lemma pval_add_absorb_left [simp]: assumes "prime p" "x \<noteq> 0" "pval p x < pval p y" shows "pval p (x + y) = pval p x" proof (cases "y = 0") case False with assms have [simp]: "x \<noteq> 0" "y \<noteq> 0" by auto from assms have "x \<noteq> -y" by auto hence "x + y \<noteq> 0" by linarith define a b where "a = fst (quotient_of x)" and "b = snd (quotient_of x)" define c d where "c = fst (quotient_of y)" and "d = snd (quotient_of y)" have xy: "x = of_int a / of_int b" "y = of_int c / of_int d" by (rule quotient_of_div; simp add: a_def b_def c_def d_def)+ have [simp]: "a \<noteq> 0" "c \<noteq> 0" using xy by auto have [simp]: "b \<noteq> 0" "d \<noteq> 0" by (auto simp: b_def d_def) have eq: "x + y = of_int (a * d + b * c) / of_int (b * d)" by (simp add: xy field_simps) have nz: "a * d + b * c \<noteq> 0" proof assume *: "a * d + b * c = 0" have "x + y = 0" unfolding eq * by simp with \<open>x + y \<noteq> 0\<close> show False by simp qed have "pval p (x + y) = int (multiplicity (int p) (a * d + b * c)) - int (multiplicity (int p) (b * d))" using nz assms by (subst eq, subst pval_quotient) auto also from assms have "multiplicity (int p) (a * d) < multiplicity (int p) (b * c)" by (auto simp: pval_quotient xy prime_elem_multiplicity_mult_distrib) hence "multiplicity (int p) (a * d + b * c) = multiplicity (int p) (a * d)" by (rule multiplicity_add_absorb_left) auto also have "\<dots> - int (multiplicity (int p) (b * d)) = pval p x" using assms by (simp add: xy pval_quotient prime_elem_multiplicity_mult_distrib) finally show "pval p (x + y) = pval p x" . qed (use assms in auto) lemma pval_add_absorb_right [simp]: assumes "prime p" "y \<noteq> 0" "pval p y < pval p x" shows "pval p (x + y) = pval p y" using pval_add_absorb_left[of p y x] assms by (simp add: add.commute del: pval_add_absorb_left) lemma pnorm_add_absorb_left [simp]: assumes "prime p" "x \<noteq> 0" "pnorm p x > pnorm p y" shows "pnorm p (x + y) = pnorm p x" proof (cases "y = 0") case False with assms have [simp]: "x \<noteq> 0" "y \<noteq> 0" by auto from assms have "x \<noteq> -y" by auto hence [simp]: "x + y \<noteq> 0" by linarith have "pval p (x + y) = pval p x" using assms by (intro pval_add_absorb_left) (auto simp: pnorm_less_iff) thus ?thesis by (simp add: pnorm_def) qed (use assms in auto) lemma pnorm_add_absorb_right [simp]: assumes "prime p" "y \<noteq> 0" "pnorm p x < pnorm p y" shows "pnorm p (x + y) = pnorm p y" using pnorm_add_absorb_left[of p y x] assms by (simp add: add.commute del: pnorm_add_absorb_left) (* Comment by Manuel: this is now a simple corollary *) lemma pnorm_unit_ball: fixes n :: nat assumes \<open>prime p\<close> and \<open>pnorm p x = 1\<close> and \<open>pnorm p y < 1\<close> shows \<open>pnorm p (x + y) = 1\<close> using assms by (subst pnorm_add_absorb_left) auto end
Formal statement is: lemma measure_UNION_AE: assumes I: "finite I" shows "(\<And>i. i \<in> I \<Longrightarrow> F i \<in> fmeasurable M) \<Longrightarrow> pairwise (\<lambda>i j. AE x in M. x \<notin> F i \<or> x \<notin> F j) I \<Longrightarrow> measure M (\<Union>i\<in>I. F i) = (\<Sum>i\<in>I. measure M (F i))" Informal statement is: If $F_1, \ldots, F_n$ are pairwise disjoint measurable sets, then $\mu(\bigcup_{i=1}^n F_i) = \sum_{i=1}^n \mu(F_i)$.
module trees where data Tree (A : Set) : Set where empty : Tree A node : Tree A -> A -> Tree A -> Tree A open import Data.Nat #nodes : {A : Set} -> Tree A -> ℕ #nodes empty = 0 #nodes (node t x t₁) = (#nodes t) + (1 + (#nodes t₁)) #leafs : {A : Set} -> Tree A -> ℕ #leafs empty = zero -- #leafs (node empty x empty) = 1 #leafs (node t x t₁) with t | t₁ ... | empty | empty = 1 ... | _ | _ = (#leafs t) + (#leafs t₁)
theory NBA_Rule imports Scoring_Rules "Compositional_Structures/Basic_Modules/Scoring_Module" "Compositional_Structures/Basic_Modules/NBA_Module" "Compositional_Structures/Elect_Composition" begin lemma mvp_elect: shows "electoral_module (elector mvp)" proof(unfold mvp.simps) show "electoral_module (elector (max_eliminator (scoring vector_A_mvp)))" using scoring_mod_A by blast qed lemma mvp_hom: shows "homogeneity (elector mvp)" unfolding mvp.simps using scoring_rules_homogeneity by blast lemma mvp_reinforcement: shows "reinforcement_complete (elector mvp)" unfolding mvp.simps using scoring_module_rein by blast end
-- Internal error in coverage checker. module Issue505 where data Nat : Set where zero : Nat suc : Nat → Nat _+_ : Nat → Nat → Nat zero + m = m suc n + m = suc (n + m) data Split : Nat → Nat → Set where 1x1 : Split (suc zero) (suc zero) _∣_ : ∀ {a b c} → Split a b → Split a c → Split a (b + c) _/_ : ∀ {a b c} → Split b a → Split c a → Split (b + c) a data ⊤ : Set where tt : ⊤ theorem : ∀ {a b} → (split : Split a b) → ⊤ theorem 1x1 = tt theorem {suc a} .{_} (l ∣ r) = tt theorem {zero } .{_} (l ∣ r) = tt theorem (l / r) = tt
Require Import Lia. Require Import RelationClasses. From sflib Require Import sflib. From Paco Require Import paco. From PromisingLib Require Import Axioms. From PromisingLib Require Import Basic. From PromisingLib Require Import DataStructure. From PromisingLib Require Import DenseOrder. From PromisingLib Require Import Loc. From PromisingLib Require Import Language. From PromisingLib Require Import Event. Require Import Time. Require Import View. Require Import Cell. Require Import Memory. Require Import TView. Require Import Local. Require Import Thread. Require Import FulfillStep. Set Implicit Arguments. Lemma promise_step_promise_consistent lc1 mem1 loc from to msg lc2 mem2 kind (STEP: Local.promise_step lc1 mem1 loc from to msg lc2 mem2 kind) (CONS: Local.promise_consistent lc2): Local.promise_consistent lc1. Proof. inv STEP. ii. destruct (Memory.op_kind_is_cancel kind) eqn:KIND. - destruct kind; ss. inv PROMISE. destruct (Memory.get loc0 ts promises2) as [[]|] eqn:GET2. + dup GET2. revert GET0. erewrite Memory.remove_o; eauto. condtac; ss. i. rewrite PROMISE0 in *. inv GET0. eauto. + revert GET2. erewrite Memory.remove_o; eauto. condtac; ss; i; try congr. des. subst. exploit Memory.remove_get0; eauto. i. des. rewrite GET in *. inv PROMISE0. ss. - exploit Memory.promise_get1_promise; eauto. i. des. inv MSG_LE; ss; eauto. eapply CONS; eauto. ss. Qed. Lemma read_step_promise_consistent lc1 mem1 loc to val released ord lc2 (STEP: Local.read_step lc1 mem1 loc to val released ord lc2) (CONS: Local.promise_consistent lc2): Local.promise_consistent lc1. Proof. inv STEP. ii. exploit CONS; eauto. i. eapply TimeFacts.le_lt_lt; eauto. ss. etrans; [|apply Time.join_l]. etrans; [|apply Time.join_l]. refl. Qed. Lemma fulfill_unset_promises loc from ts msg promises1 promises2 l t f m (FULFILL: Memory.remove promises1 loc from ts msg promises2) (TH1: Memory.get l t promises1 = Some (f, m)) (TH2: Memory.get l t promises2 = None): l = loc /\ t = ts /\ f = from /\ Message.le msg m. Proof. revert TH2. erewrite Memory.remove_o; eauto. condtac; ss; [|congr]. des. subst. exploit Memory.remove_get0; eauto. i. des. rewrite GET in TH1. inv TH1. esplits; eauto. refl. Qed. Lemma fulfill_step_promise_consistent lc1 sc1 loc from to val releasedm released ord lc2 sc2 (STEP: fulfill_step lc1 sc1 loc from to val releasedm released ord lc2 sc2) (CONS: Local.promise_consistent lc2): Local.promise_consistent lc1. Proof. inv STEP. ii. destruct (Memory.get loc0 ts promises2) as [[]|] eqn:X. - dup X. revert X. erewrite Memory.remove_o; eauto. condtac; ss. i. rewrite X in *. inv PROMISE. exploit CONS; eauto. s. i. eapply TimeFacts.le_lt_lt; eauto. unfold TimeMap.join. apply Time.join_l. - exploit fulfill_unset_promises; eauto. i. des. subst. apply WRITABLE. Qed. Lemma write_step_promise_consistent lc1 sc1 mem1 loc from to val releasedm released ord lc2 sc2 mem2 kind (STEP: Local.write_step lc1 sc1 mem1 loc from to val releasedm released ord lc2 sc2 mem2 kind) (CONS: Local.promise_consistent lc2): Local.promise_consistent lc1. Proof. inv STEP. inv WRITE. ii. exploit Memory.promise_get1_promise; eauto. { inv PROMISE; ss. } i. des. destruct (Memory.get loc0 ts promises2) as [[]|] eqn:X. - dup X. revert X0. erewrite Memory.remove_o; eauto. condtac; ss; i. rewrite GET in *. inv X0. apply CONS in X. ss. exploit X; try by (inv MSG_LE; ss). i. eapply TimeFacts.le_lt_lt; eauto. etrans; [|apply Time.join_l]. refl. - exploit fulfill_unset_promises; eauto. i. des. subst. apply WRITABLE. Qed. Lemma memory_write_promise_consistent ts promises1 mem1 loc from to msg promises2 mem2 kind (TO: Time.lt ts to) (STEP: Memory.write promises1 mem1 loc from to msg promises2 mem2 kind) (CONS: forall to' from' msg' (PROMISE: Memory.get loc to' promises2 = Some (from', msg')) (MSG: msg' <> Message.reserve), Time.lt ts to'): forall to' from' msg' (PROMISE: Memory.get loc to' promises1 = Some (from', msg')) (MSG: msg' <> Message.reserve), Time.lt ts to'. Proof. i. inv STEP. exploit Memory.promise_get1_promise; eauto. { inv PROMISE0; ss. exploit Memory.remove_get0; try exact PROMISES. i. des. exploit Memory.remove_get0; try exact REMOVE. i. des. congr. } i. des. destruct (Memory.get loc to' promises2) as [[]|] eqn:X. - dup X. revert X0. erewrite Memory.remove_o; eauto. condtac; ss; i. rewrite GET in *. inv X0. apply CONS in X; ss. ii. subst. inv MSG_LE. ss. - exploit fulfill_unset_promises; eauto. i. des. subst. ss. Qed. Lemma write_na_promise_consistent ts' ts promises1 mem1 loc from to val promises2 mem2 msgs kinds kind (TS: Time.le ts' ts) (STEP: Memory.write_na ts promises1 mem1 loc from to val promises2 mem2 msgs kinds kind) (CONS: forall to' from' msg (PROMISE: Memory.get loc to' promises2 = Some (from', msg)) (MSG: msg <> Message.reserve), Time.lt ts' to'): forall to' from' msg (PROMISE: Memory.get loc to' promises1 = Some (from', msg)) (MSG: msg <> Message.reserve), Time.lt ts' to'. Proof. induction STEP; i. { hexploit memory_write_promise_consistent; try exact CONS; eauto. eapply TimeFacts.le_lt_lt; eauto. } eapply memory_write_promise_consistent; try exact WRITE_EX; eauto. { eapply TimeFacts.le_lt_lt; eauto. } eapply IHSTEP; eauto. econs. eapply TimeFacts.le_lt_lt; eauto. Qed. Lemma write_na_step_promise_consistent lc1 sc1 mem1 loc from to val ord lc2 sc2 mem2 msgs kinds kind (STEP: Local.write_na_step lc1 sc1 mem1 loc from to val ord lc2 sc2 mem2 msgs kinds kind) (CONS: Local.promise_consistent lc2): Local.promise_consistent lc1. Proof. inv STEP. ii. destruct (classic (loc0 = loc)); cycle 1. - hexploit Memory.write_na_get_diff_promise; try exact WRITE; eauto. i. rewrite <- H0 in PROMISE. exploit CONS; eauto. s. unfold TimeMap.join, TimeMap.singleton, LocFun.add, LocFun.init, LocFun.find. condtac; ss. rewrite TimeFacts.le_join_l; try apply Time.bot_spec. ss. - subst. eapply write_na_promise_consistent; try exact WRITE; eauto; try refl. i. eapply TimeFacts.le_lt_lt; cycle 1. { eapply CONS; eauto. } s. unfold TimeMap.join. apply Time.join_l. Qed. Lemma fence_step_promise_consistent lc1 sc1 mem1 ordr ordw lc2 sc2 (STEP: Local.fence_step lc1 sc1 ordr ordw lc2 sc2) (WF: Local.wf lc1 mem1) (CONS: Local.promise_consistent lc2): Local.promise_consistent lc1. Proof. inv STEP. ii. exploit CONS; eauto. i. eapply TimeFacts.le_lt_lt; eauto. cut (TView.le (Local.tview lc1) (TView.write_fence_tview (TView.read_fence_tview (Local.tview lc1) ordr) sc1 ordw)). { i. inv H. apply CUR. } etrans. - eapply TViewFacts.write_fence_tview_incr. apply WF. - eapply TViewFacts.write_fence_tview_mon; try refl; try apply WF. eapply TViewFacts.read_fence_tview_incr. apply WF. Qed. Lemma ordering_relaxed_dec ord: Ordering.le ord Ordering.relaxed \/ Ordering.le Ordering.strong_relaxed ord. Proof. destruct ord; auto. Qed. Lemma step_promise_consistent lang pf e th1 th2 (STEP: @Thread.step lang pf e th1 th2) (CONS: Local.promise_consistent (Thread.local th2)) (WF1: Local.wf (Thread.local th1) (Thread.memory th1)) (SC1: Memory.closed_timemap (Thread.sc th1) (Thread.memory th1)) (MEM1: Memory.closed (Thread.memory th1)): Local.promise_consistent (Thread.local th1). Proof. inv STEP; [inv STEP0|inv STEP0; inv LOCAL]; ss. - eapply promise_step_promise_consistent; eauto. - eapply read_step_promise_consistent; eauto. - eapply write_step_promise_consistent; eauto. - eapply read_step_promise_consistent; eauto. eapply write_step_promise_consistent; eauto. - eapply fence_step_promise_consistent; eauto. - eapply fence_step_promise_consistent; eauto. - eapply write_na_step_promise_consistent; eauto. Qed. Lemma opt_step_promise_consistent lang e th1 th2 (STEP: @Thread.opt_step lang e th1 th2) (CONS: Local.promise_consistent (Thread.local th2)) (WF1: Local.wf (Thread.local th1) (Thread.memory th1)) (SC1: Memory.closed_timemap (Thread.sc th1) (Thread.memory th1)) (MEM1: Memory.closed (Thread.memory th1)): Local.promise_consistent (Thread.local th1). Proof. inv STEP; eauto using step_promise_consistent. Qed. Lemma rtc_all_step_promise_consistent lang th1 th2 (STEP: rtc (@Thread.all_step lang) th1 th2) (CONS: Local.promise_consistent (Thread.local th2)) (WF1: Local.wf (Thread.local th1) (Thread.memory th1)) (SC1: Memory.closed_timemap (Thread.sc th1) (Thread.memory th1)) (MEM1: Memory.closed (Thread.memory th1)): Local.promise_consistent (Thread.local th1). Proof. revert_until STEP. induction STEP; auto. i. inv H. inv USTEP. exploit Thread.step_future; eauto. i. des. eapply step_promise_consistent; eauto. Qed. Lemma rtc_tau_step_promise_consistent lang th1 th2 (STEP: rtc (@Thread.tau_step lang) th1 th2) (CONS: Local.promise_consistent (Thread.local th2)) (WF1: Local.wf (Thread.local th1) (Thread.memory th1)) (SC1: Memory.closed_timemap (Thread.sc th1) (Thread.memory th1)) (MEM1: Memory.closed (Thread.memory th1)): Local.promise_consistent (Thread.local th1). Proof. eapply rtc_all_step_promise_consistent; cycle 1; eauto. eapply rtc_implies; [|eauto]. apply tau_union. Qed. Lemma rtc_reserve_step_promise_consistent lang th1 th2 (STEPS: rtc (@Thread.reserve_step lang) th1 th2) (CONS: Local.promise_consistent (Thread.local th2)): Local.promise_consistent (Thread.local th1). Proof. ginduction STEPS; eauto. i. eapply IHSTEPS in CONS. inv H. inv STEP; inv STEP0; inv LOCAL. inv PROMISE. ss. ii. eapply Memory.add_get1 in PROMISE; eauto. Qed. Lemma rtc_cancel_step_promise_consistent lang th1 th2 (STEPS: rtc (@Thread.cancel_step lang) th1 th2) (CONS: Local.promise_consistent (Thread.local th2)): Local.promise_consistent (Thread.local th1). Proof. ginduction STEPS; eauto. i. eapply IHSTEPS in CONS. inv H. inv STEP; inv STEP0; inv LOCAL. inv PROMISE. ss. ii. dup PROMISE. eapply Memory.remove_get1 in PROMISE; eauto. des; eauto. clarify. eapply Memory.remove_get0 in PROMISES. des. clarify. Qed. Lemma rtc_reserve_step_promise_consistent2 lang (th1 th2: Thread.t lang) (CONS: Local.promise_consistent (Thread.local th1)) (STEPS: rtc (@Thread.reserve_step lang) th1 th2) : Local.promise_consistent (Thread.local th2). Proof. ginduction STEPS; eauto. i. eapply IHSTEPS. inv H. inv STEP; inv STEP0; inv LOCAL. inv PROMISE. ss. ii. erewrite Memory.add_o in PROMISE; eauto. des_ifs. eapply CONS; eauto. Qed. Lemma rtc_cancel_step_promise_consistent2 lang (th1 th2: Thread.t lang) (CONS: Local.promise_consistent (Thread.local th1)) (STEPS: rtc (@Thread.cancel_step lang) th1 th2) : Local.promise_consistent (Thread.local th2). Proof. ginduction STEPS; eauto. i. eapply IHSTEPS. inv H. inv STEP; inv STEP0; inv LOCAL. inv PROMISE. ss. ii. erewrite Memory.remove_o in PROMISE; eauto. des_ifs. eapply CONS; eauto. Qed. Lemma consistent_promise_consistent lang th (CONS: @Thread.consistent lang th) (WF: Local.wf (Thread.local th) (Thread.memory th)) (SC: Memory.closed_timemap (Thread.sc th) (Thread.memory th)) (MEM: Memory.closed (Thread.memory th)): Local.promise_consistent (Thread.local th). Proof. destruct th. ss. exploit Memory.cap_exists; eauto. i. des. exploit Memory.cap_closed; eauto. i. exploit Local.cap_wf; eauto. i. hexploit Memory.cap_closed_timemap; eauto. i. des. exploit CONS; eauto. s. i. des. - inv FAILURE. des. inv STEP_FAILURE; inv STEP; ss. inv LOCAL; ss; inv LOCAL0; hexploit rtc_tau_step_promise_consistent; try exact STEPS; eauto. - hexploit rtc_tau_step_promise_consistent; try exact STEPS; eauto. ii. rewrite PROMISES, Memory.bot_get in *. congr. Qed. Lemma promise_consistent_promise_read lc1 mem1 loc to val ord released lc2 f t v r (STEP: Local.read_step lc1 mem1 loc to val released ord lc2) (PROMISE: Memory.get loc t (Local.promises lc1) = Some (f, Message.concrete v r)) (CONS: Local.promise_consistent lc2): Time.lt to t. Proof. inv STEP. exploit CONS; eauto; ss. intros x. apply TimeFacts.join_lt_des in x. des. apply TimeFacts.join_lt_des in AC. des. revert BC0. unfold View.singleton_ur_if. condtac; ss. - unfold TimeMap.singleton, LocFun.add. condtac; ss. - unfold TimeMap.singleton, LocFun.add. condtac; ss. Qed. Lemma promise_consistent_promise_write lc1 sc1 mem1 loc from to val releasedm released ord lc2 sc2 mem2 kind f t m (STEP: Local.write_step lc1 sc1 mem1 loc from to val releasedm released ord lc2 sc2 mem2 kind) (PROMISE: Memory.get loc t (Local.promises lc1) = Some (f, m)) (MSG: m <> Message.reserve) (CONS: Local.promise_consistent lc2): Time.le to t. Proof. destruct (Memory.get loc t (Local.promises lc2)) as [[]|] eqn:X. - inv STEP. inv WRITE. ss. dup X. revert X0. erewrite Memory.remove_o; eauto. condtac; ss. i. guardH o. exploit Memory.promise_get1_promise; try exact PROMISE; eauto. { inv PROMISE0; ss. } i. des. rewrite X0 in *. inv GET. exploit CONS; eauto; try by (inv MSG_LE; ss). s. intros x. apply TimeFacts.join_lt_des in x. des. revert BC. unfold TimeMap.singleton, LocFun.add. condtac; ss. i. econs. ss. - inv STEP. inv WRITE. exploit Memory.promise_get1_promise; eauto. { inv PROMISE0; ss. } i. des. exploit fulfill_unset_promises; eauto. i. des. subst. refl. Qed.
function [X,Y,vals,labI]=mp_azim(optn,varargin) % MP_AZIM Azimuthal projections % This function should not be used directly; instead it is % is accessed by various high-level functions named M_*. % Rich Pawlowicz ([email protected]) 2/Apr/1997 % % 13/5/97 - Added satellite perspective % 1/6/97 - Another stab at removing some /0 errors. % 10/8/00 - Rotation for projections? % % This software is provided "as is" without warranty of any kind. But % it's mine, so you can't sell it. % % Mathematical formulas for the projections and their inverses are taken from % % Snyder, John P., Map Projections used by the US Geological Survey, % Geol. Surv. Bull. 1532, 2nd Edition, USGPO, Washington D.C., 1983. % % These are azimuthal projections, best suited for circular areas. The % stereographic is commonly used for polar regions. % Stereographic - conformal % Orthographic - neither conformal nor equal-area, but looks like globe % with viewpoint at infinity. % Azimuthal Equal-area - equal area, but not conformal (by Lambert) % Azimuthal Equidistant - distance and direction from center are true % Gnomonic - all great circles are straight lines. % Satellite - a perspective view from a finite distance global MAP_PROJECTION MAP_VAR_LIST name={'Stereographic','Orthographic','Azimuthal Equal-area','Azimuthal Equidistant','Gnomonic','Satellite'}; pi180=pi/180; switch optn case 'name' X=name; case {'usage','set'} X=char({[' ''' varargin{1} ''''],... ' <,''lon<gitude>'',center_long>',... ' <,''lat<itude>'', center_lat>',... ' <,''rad<ius>'', ( degrees | [longitude latitude] ) | ''alt<itude>'', alt_frac >',... ' <,''rec<tbox>'', ( ''on'' | ''off'' | ''circle'' )>',... ' <,''rot<angle>'', degrees CCW>'}); case 'get' X=char([' Projection: ' MAP_PROJECTION.name ' (function: ' MAP_PROJECTION.routine ')'],... [' center longitude: ' num2str(MAP_VAR_LIST.ulong) ],... [' center latitude: ' num2str(MAP_VAR_LIST.ulat) ],... [' radius/altitude : ' num2str(MAP_VAR_LIST.uradius) ],... [' Rectangular border: ' MAP_VAR_LIST.rectbox ],... [' Rotation angle: ' num2str(MAP_VAR_LIST.rotang) ]); case 'initialize' MAP_VAR_LIST=[]; MAP_PROJECTION.name=varargin{1}; MAP_VAR_LIST.ulong=0; MAP_VAR_LIST.ulat=60; MAP_VAR_LIST.rectbox='circle'; MAP_VAR_LIST.uradius=90; MAP_VAR_LIST.rotang=0; MAP_VAR_LIST.ellipsoid='normal'; k=2; while k<length(varargin) switch varargin{k}(1:3) case 'lon' MAP_VAR_LIST.ulong=varargin{k+1}(:)'; case 'lat' MAP_VAR_LIST.ulat=varargin{k+1}(:)'; case {'rad','alt'} MAP_VAR_LIST.uradius=varargin{k+1}; case 'rec' MAP_VAR_LIST.rectbox=varargin{k+1}; case 'rot' MAP_VAR_LIST.rotang=varargin{k+1}; otherwise disp(['Unknown option: ' varargin{k}]); end k=k+2; end if strcmp(MAP_VAR_LIST.rectbox,'off'), MAP_VAR_LIST.rectbox='circle'; end MAP_VAR_LIST.rlong=MAP_VAR_LIST.ulong*pi180; MAP_VAR_LIST.rlat=MAP_VAR_LIST.ulat*pi180; % Compute the various limits % For the perspective viewpoints, we can't go *quite* to the horizon because this causes % problems in the clipping later on - but we can get pretty close (within .995) of it. % This is a fudge factor that can probably be changed if we increase the number of points % in grid lines... if length(MAP_VAR_LIST.uradius)==1 if strcmp(MAP_PROJECTION.name,name{2}) && abs(MAP_VAR_LIST.uradius-90)<.2 MAP_VAR_LIST.radius=89.8; elseif strcmp(MAP_PROJECTION.name,name{5}) MAP_VAR_LIST.radius=min(80,MAP_VAR_LIST.uradius); elseif strcmp(MAP_PROJECTION.name,name{6}) MAP_VAR_LIST.radius=acos(1/(1+MAP_VAR_LIST.uradius))/pi180*.98; % uradius is the height fraction here else MAP_VAR_LIST.radius=MAP_VAR_LIST.uradius; end rradius=MAP_VAR_LIST.radius*pi180; else % do some sperical trig edge=MAP_VAR_LIST.uradius*pi180 - [MAP_VAR_LIST.rlong 0]; cosc=sin(MAP_VAR_LIST.rlat)*sin(edge(2))+cos(MAP_VAR_LIST.rlat)*cos(edge(2))*cos(edge(1)); sinc=sqrt( ( cos(edge(2))*sin(edge(1)))^2 + ... (cos(MAP_VAR_LIST.rlat)*sin(edge(2))-sin(MAP_VAR_LIST.rlat)*cos(edge(2))*cos(edge(1)))^2); rradius=atan2(sinc,cosc); MAP_VAR_LIST.radius=rradius/pi180; end MAP_VAR_LIST.cosradius=cos(rradius); switch MAP_PROJECTION.name case name(1) MAP_VAR_LIST.rhomax=2*tan(rradius/2); case name(2) MAP_VAR_LIST.rhomax=sin(rradius); case name(3) MAP_VAR_LIST.rhomax=2*sin(rradius/2); case name(4) MAP_VAR_LIST.rhomax=rradius; case name(5) MAP_VAR_LIST.rhomax=tan(rradius); case name(6) MAP_VAR_LIST.rhomax=sin(rradius)/(1+(1-cos(rradius))/MAP_VAR_LIST.uradius); end if strcmp(MAP_VAR_LIST.rectbox,'on') if length(MAP_VAR_LIST.uradius)==1 MAP_VAR_LIST.xlims=[-1 1]/sqrt(2)*MAP_VAR_LIST.rhomax; MAP_VAR_LIST.ylims=[-1 1]/sqrt(2)*MAP_VAR_LIST.rhomax; else [X,Y]=mp_azim('ll2xy',MAP_VAR_LIST.uradius(1),MAP_VAR_LIST.uradius(2),'clip','off'); MAP_VAR_LIST.xlims=[-abs(X) abs(X)]; MAP_VAR_LIST.ylims=[-abs(Y) abs(Y)]; end else MAP_VAR_LIST.xlims=[-MAP_VAR_LIST.rhomax MAP_VAR_LIST.rhomax]; MAP_VAR_LIST.ylims=[-MAP_VAR_LIST.rhomax MAP_VAR_LIST.rhomax]; end mu_util('lllimits'); case 'll2xy' long=varargin{1}*pi180-MAP_VAR_LIST.rlong; lat=varargin{2}*pi180; vals=zeros(size(long)); pi180=pi/180; cosc =sin(MAP_VAR_LIST.rlat)*sin(lat)+cos(MAP_VAR_LIST.rlat)*(cos(lat).*cos(long)); sinAzsinc=sin(long).*cos(lat); cosAzsinc=cos(MAP_VAR_LIST.rlat)*sin(lat)-sin(MAP_VAR_LIST.rlat)*(cos(lat).*cos(long)); sinc=sqrt(sinAzsinc.^2+cosAzsinc.^2); switch MAP_PROJECTION.name case name(1) cosc(cosc==-1)=-1+eps; rho=2*sinc./(1+cosc); % = 2*tan(c/2) case name(2) rho=sinc; % = sinc case name(3) cosc(cosc==-1)=-1+eps; rho=sqrt(2)*sinc./sqrt(1+cosc); % = 2*sin(c/2) case name(4) rho=atan2(sinc,cosc); % = c case name(5) rho=sinc./cosc; % = tan(c) case name(6) rho=sinc./(1+(1-cosc)/MAP_VAR_LIST.uradius); % end sinc(sinc==0)=eps; Az=(sinAzsinc+sqrt(-1)*cosAzsinc)./sinc; Az(abs(Az)==0)=-1; % Clip out-of-range values. We test against cos(c) (where c is the angular % distance from map center) rather than directly against rhomax, because % in the orthographic map rho->0 for points on the other side of the % globe whereas c does not! % Also, we clip on rho even if we later clip on X/Y because in some projections (e.g. the % orthographic) the X/Y locations wrap back. if ~strcmp(varargin{4},'off') vals = vals | cosc<=MAP_VAR_LIST.cosradius+eps*10; [rho,Az]=mu_util('clip',varargin{4},rho,MAP_VAR_LIST.rhomax,cosc<MAP_VAR_LIST.cosradius,Az); Az=Az./abs(Az); end X=rho.*real(Az*exp(i*pi180*MAP_VAR_LIST.rotang)); Y=rho.*imag(Az*exp(i*pi180*MAP_VAR_LIST.rotang)); if strcmp(MAP_VAR_LIST.rectbox,'on') && ~strcmp(varargin{4},'off') vals= vals | X<=MAP_VAR_LIST.xlims(1)+eps*10 | X>=MAP_VAR_LIST.xlims(2)-eps*10 | ... Y<=MAP_VAR_LIST.ylims(1)+eps*10 | Y>=MAP_VAR_LIST.ylims(2)-eps*10; [X,Y]=mu_util('clip',varargin{4},X,MAP_VAR_LIST.xlims(1),X<MAP_VAR_LIST.xlims(1) | isnan(X),Y); [X,Y]=mu_util('clip',varargin{4},X,MAP_VAR_LIST.xlims(2),X>MAP_VAR_LIST.xlims(2) | isnan(X),Y); [Y,X]=mu_util('clip',varargin{4},Y,MAP_VAR_LIST.ylims(1),Y<MAP_VAR_LIST.ylims(1) | isnan(Y),X); [Y,X]=mu_util('clip',varargin{4},Y,MAP_VAR_LIST.ylims(2),Y>MAP_VAR_LIST.ylims(2) | isnan(Y),X); end case 'xy2ll' rho=sqrt(varargin{1}.^2+varargin{2}.^2); Z=exp(i*(atan2(varargin{2},varargin{1})-MAP_VAR_LIST.rotang*pi180)); V1=rho.*real(Z); V2=rho.*imag(Z); ir=rho==0; % To prevent /0 warnings when rho is 0 rho(ir)=eps; switch MAP_PROJECTION.name case name(1) c=2*atan(rho/2); case name(2) c=asin(rho); c(abs(rho)>1.0)=NaN; % points outside the map case name(3) c=2*asin(rho/2); c(abs(rho)>2.0)=NaN; % points outside the map case name(4) c=rho; case name(5) c=atan(rho); case name(6) arg1=(MAP_VAR_LIST.uradius+1)./sqrt(1+(MAP_VAR_LIST.uradius./rho).^2); c=asin(arg1) - atan(rho/MAP_VAR_LIST.uradius); c(arg1>1.0)=NaN; end c(ir)=eps; % we offset this slightly so that the correct limit is achieved in the % division below: % Y=(asin(cos(c)*sin(MAP_VAR_LIST.rlat) + ... % cos(MAP_VAR_LIST.rlat)*sin(c).*varargin{2}./rho))/pi180; % % switch MAP_VAR_LIST.ulat, % case 90, % X=(MAP_VAR_LIST.rlong+atan2(varargin{1},-varargin{2}))/pi180; % case -90, % X=(MAP_VAR_LIST.rlong+atan2(varargin{1},varargin{2}))/pi180; % otherwise % X=(MAP_VAR_LIST.rlong+atan2( varargin{1}.*sin(c), ... % cos(MAP_VAR_LIST.rlat)*cos(c).*rho - sin(MAP_VAR_LIST.rlat)*varargin{2}.*sin(c) ) )/pi180; % end; % Can be problem if the argument is slightly larger than 1 - then the asin % returns a complex number. arg=cos(c)*sin(MAP_VAR_LIST.rlat) + ... cos(MAP_VAR_LIST.rlat)*sin(c).*V2./rho; arg=min(max(arg,-1),1); Y=(asin(arg))/pi180; switch MAP_VAR_LIST.ulat case 90 X=(MAP_VAR_LIST.rlong+atan2(V1,-V2))/pi180; case -90 X=(MAP_VAR_LIST.rlong+atan2(V1,V2))/pi180; otherwise X=(MAP_VAR_LIST.rlong+atan2( V1.*sin(c), ... cos(MAP_VAR_LIST.rlat)*cos(c).*rho - sin(MAP_VAR_LIST.rlat)*V2.*sin(c) ) )/pi180; end case 'xgrid' [X,Y,vals,labI]=mu_util('xgrid',MAP_VAR_LIST.longs,MAP_VAR_LIST.lats,varargin{1},31,varargin{2:3}); case 'ygrid' [X,Y,vals,labI]=mu_util('ygrid',MAP_VAR_LIST.lats,MAP_VAR_LIST.longs,varargin{1},91,varargin{2:3}); case 'box' [X,Y]=mu_util('box',31); end
(* * * Copyright 2017, Data61, CSIRO * * This software may be distributed and modified according to the terms of * the GNU General Public License version 2. Note that NO WARRANTY is provided. * See "LICENSE_GPLv2.txt" for details. * * @TAG(DATA61_GPL) *) (* Test proofs for corres methods. Builds on AInvs image. *) theory Corres_Test imports "../proof/refine/ARM/VSpace_R" Corres_Method begin context begin interpretation Arch . (* VSpace_R *) lemma invalidate_asid_entry_corres: notes [where pd=pd, corres] = load_hw_asid_corres invalidate_asid_corres notes [corres] = invalidate_hw_asid_entry_corres shows "corres dc (valid_arch_objs and valid_asid_map and K (asid \<le> mask asid_bits \<and> asid \<noteq> 0) and vspace_at_asid asid pd and valid_vs_lookup and unique_table_refs o caps_of_state and valid_global_objs and valid_arch_state and pspace_aligned and pspace_distinct) (pspace_aligned' and pspace_distinct' and no_0_obj') (invalidate_asid_entry asid) (invalidateASIDEntry asid)" apply (simp add: invalidate_asid_entry_def invalidateASIDEntry_def) apply_debug (trace) (* apply_trace between steps *) (tags "corres") (* break at breakpoints labelled "corres" *) corres (* weaken precondition *) continue (* split *) continue (* solve load_hw_asid *) continue (* split *) continue (* apply corres_when *) continue (* trivial simplification *) continue (* invalidate _hw_asid_entry *) finish (* invalidate_asid *) apply (wp load_hw_asid_wp | simp)+ apply (fastforce simp: pd_at_asid_uniq) done (* Push assumptions into precondition *) lemma set_asid_pool_corres: "corres dc (asid_pool_at p and valid_etcbs and K (a = inv ASIDPool a' o ucast)) (asid_pool_at' p) (set_asid_pool p a) (setObject p a')" apply (rule corres_name_pre) apply simp apply (rule corres_guard_imp) apply (rule set_asid_pool_corres) by simp+ crunch typ_at'[wp]: invalidateASIDEntry, flushSpace "typ_at' T t" crunch pspace_aligned'[wp]: invalidateASIDEntry "pspace_aligned'" crunch pspace_distinct'[wp]: invalidateASIDEntry "pspace_distinct'" crunch ksCurThread[wp]: invalidateASIDEntry, flushSpace "\<lambda>s. P (ksCurThread s)" crunch obj_at'[wp]: invalidateASIDEntry, flushSpace "obj_at' P p" lemma delete_asid_corresb: notes [where pd=pd, corres] = flush_space_corres invalidate_asid_entry_corres notes [corres] = corres_gets_asid get_asid_pool_corres_inv' invalidate_asid_entry_corres set_asid_pool_corres gct_corres set_vm_root_corres notes [wp] = set_asid_pool_asid_map_unmap[unfolded fun_upd_def] set_asid_pool_vs_lookup_unmap' set_asid_pool_arch_objs_unmap' invalidate_asid_entry_invalidates getASID_wp shows "corres dc (invs and valid_etcbs and K (asid \<le> mask asid_bits \<and> asid \<noteq> 0)) (pspace_aligned' and pspace_distinct' and no_0_obj' and valid_arch_state' and cur_tcb') (delete_asid asid pd) (deleteASID asid pd)" apply (simp add: delete_asid_def deleteASID_def) apply_debug (trace) (* apply_trace between steps *) (tags "corres") (* break at breakpoints labelled "corres" *) (corres | (corresc, #break))+ (* weaken precondition *) continue (* split *) continue (* gets rule *) continue (* simplification *) continue (* backtracking (no corres progress after simp) *) continue (* continue backtracking *) continue (* case split with corresc *) continue (* focus on first goal *) continue (* trivially solved *) continue (* split *) continue (* simplification *) continue (* successful corres_once with liftM after simplification *) continue (* get_asid_pool applied *) continue (* simplification *) continue (* when rule *) continue (* split *) continue (* flush_space corres rule *) continue (* split *) continue (* apply invalidate_asid_entry_corres (issue with tracing?) *) continue (* split *) continue (* set_asid_pool (issue with tracing?) *) continue (* split *) continue (* gets rule *) continue (* simplification *) finish (* set_vm_root *) apply (wp | simp add: mask_asid_low_bits_ucast_ucast | fold cur_tcb_def | wps)+ apply (rule conjI) apply (intro impI allI) apply (rule context_conjI) apply (fastforce simp: o_def dest: valid_asid_tableD invs_valid_asid_table) apply (intro allI impI) apply (subgoal_tac "vspace_at_asid asid pd s") prefer 2 apply (simp add: vspace_at_asid_def) apply (rule vs_lookupI) apply (simp add: vs_asid_refs_def) apply (rule image_eqI[OF refl]) apply (rule graph_ofI) apply fastforce apply (rule r_into_rtrancl) apply simp apply (rule vs_lookup1I [OF _ _ refl], assumption) apply (simp add: vs_refs_def) apply (rule image_eqI[rotated], erule graph_ofI) apply (simp add: mask_asid_low_bits_ucast_ucast) apply (simp add: o_def) apply (safe; assumption?) apply (simp add: inv_def mask_asid_low_bits_ucast_ucast) apply (rule ext) apply clarsimp apply (fastforce dest: ucast_ucast_eq) apply (erule ko_at_weakenE) apply (clarsimp simp: graph_of_def) apply (fastforce split: if_split_asm) apply clarsimp apply (frule invs_arch_objs) apply (drule (2) valid_arch_objsD) apply (erule ranE) apply (fastforce split: if_split_asm) apply (erule ko_at_weakenE) apply (clarsimp simp: graph_of_def) apply (fastforce split: if_split_asm) apply clarsimp apply safe apply (simp add: typ_at_to_obj_at_arches) apply (clarsimp simp add: obj_at'_def) apply (simp add: cur_tcb'_def) done lemma getSlotCap_corres: "corres cap_relation (K(cte_ptr' = cte_map cte_ptr ) and cte_wp_at (\<lambda>_. True) cte_ptr) (pspace_distinct' and pspace_aligned') (get_cap cte_ptr) (getSlotCap cte_ptr')" apply (rule corres_name_pre) apply (rule corres_guard_imp) apply (rule getSlotCap_corres) by simp+ lemma cte_wp_at_ex: "cte_wp_at (\<lambda>_. True) p s \<Longrightarrow> (\<exists>cap. cte_wp_at (op = cap) p s)" by (simp add: cte_wp_at_def) lemma set_vm_root_for_flush_corres: notes [corres] = gct_corres getSlotCap_corres shows "corres (op =) (cur_tcb and vspace_at_asid asid pd and K (asid \<noteq> 0 \<and> asid \<le> mask asid_bits) and valid_asid_map and valid_vs_lookup and valid_arch_objs and valid_global_objs and unique_table_refs o caps_of_state and valid_arch_state and pspace_aligned and pspace_distinct) (pspace_aligned' and pspace_distinct' and no_0_obj') (set_vm_root_for_flush pd asid) (setVMRootForFlush pd asid)" apply (simp add: set_vm_root_for_flush_def setVMRootForFlush_def getThreadVSpaceRoot_def locateSlot_conv) apply corres apply_debug (trace) (tags "corres_search") (corres_search search: arm_context_switch_corres) continue (* step left *) continue (* if rule *) continue (* failed corres on first subgoal, trying next *) continue (* fail corres on last subgoal, trying reverse if rule *) continue (* successful goal discharged by corres *) finish (* successful terminal goal discharged by corres_once with given rule *) apply corres+ apply (wp get_cap_wp getSlotCap_wp | wpc| simp)+ apply (rule context_conjI) subgoal by (simp add: cte_map_def objBits_simps tcb_cnode_index_def tcbVTableSlot_def to_bl_1 cte_level_bits_def) apply (rule context_conjI) subgoal by (fastforce simp: cur_tcb_def intro!: tcb_at_cte_at_1[simplified]) apply (rule conjI) subgoal by (auto simp: isCap_simps) apply (drule cte_wp_at_ex) apply clarsimp apply (drule (1) pspace_relation_cte_wp_at[rotated 1]; (assumption | clarsimp)?) apply (drule cte_wp_at_norm') apply clarsimp apply (rule_tac x="cteCap cte" in exI) subgoal premises prems for s s' cap cte apply safe apply (thin_tac _)+ subgoal cte_wp_at' apply (insert prems) apply (rule rsubst[where P="\<lambda>s. cte_wp_at' x s s'" for x]) apply (erule cte_wp_at_weakenE', simp) apply (clarsimp dest!: curthread_relation) done apply (safe intro!: cte_wp_at') done done end end
example : ∃ x : Nat, x = x := by exists 0 example : ∃ x : Nat, ∃ y : Nat, x > y := by exists 1, 0 example : (x : Nat) ×' (y : Nat) ×' x > y := by exists 1, 0 example : { x : Nat // x > 2 } := by exists 3
lemma content_eq_fold_coeffs [code]: "content p = fold_coeffs gcd p 0"
[GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G ⊢ Linear k (Rep k G) [PROOFSTEP] infer_instance [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G V : Rep k G ⊢ AddCommGroup (CoeSort.coe V) [PROOFSTEP] change AddCommGroup ((forget₂ (Rep k G) (ModuleCat k)).obj V) [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G V : Rep k G ⊢ AddCommGroup ↑((forget₂ (Rep k G) (ModuleCat k)).obj V) [PROOFSTEP] infer_instance [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G V : Rep k G ⊢ Module k (CoeSort.coe V) [PROOFSTEP] change Module k ((forget₂ (Rep k G) (ModuleCat k)).obj V) [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G V : Rep k G ⊢ Module k ↑((forget₂ (Rep k G) (ModuleCat k)).obj V) [PROOFSTEP] infer_instance [GOAL] k G✝ : Type u inst✝² : CommRing k inst✝¹ : Monoid G✝ G : Type u inst✝ : Group G A : Rep k G g : G x : CoeSort.coe A ⊢ ↑(↑(ρ A) g⁻¹ * ↑(ρ A) g) x = x [PROOFSTEP] rw [← map_mul, inv_mul_self, map_one, LinearMap.one_apply] [GOAL] k G✝ : Type u inst✝² : CommRing k inst✝¹ : Monoid G✝ G : Type u inst✝ : Group G A : Rep k G g : G x : CoeSort.coe A ⊢ ↑(↑(ρ A) g * ↑(ρ A) g⁻¹) x = x [PROOFSTEP] rw [← map_mul, mul_inv_self, map_one, LinearMap.one_apply] [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G X : Action (Type u) (MonCat.of G) g : G x : X.V ⊢ ↑(↑(ρ ((linearization k G).toLaxMonoidalFunctor.toFunctor.obj X)) g) (Finsupp.single x 1) = Finsupp.single (↑X.ρ g x) 1 [PROOFSTEP] rw [linearization_obj_ρ, Finsupp.lmapDomain_apply, Finsupp.mapDomain_single] [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G X : Action (Type u) (MonCat.of G) g : G x : X.V r : k ⊢ ↑(↑(ρ ((linearization k G).toLaxMonoidalFunctor.toFunctor.obj X)) g) (Finsupp.single x r) = Finsupp.single (↑X.ρ g x) r [PROOFSTEP] rw [linearization_obj_ρ, Finsupp.lmapDomain_apply, Finsupp.mapDomain_single] [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G X✝ Y✝ : Action (Type u) (MonCat.of G) f : X✝ ⟶ Y✝ X Y : Action (Type u) (MonCat.of G) ⊢ (inv (LaxMonoidalFunctor.μ (linearization k G).toLaxMonoidalFunctor X Y)).hom = ↑(LinearEquiv.symm (finsuppTensorFinsupp' k X.V Y.V)) [PROOFSTEP] rw [← Action.forget_map, Functor.map_inv] [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G X✝ Y✝ : Action (Type u) (MonCat.of G) f : X✝ ⟶ Y✝ X Y : Action (Type u) (MonCat.of G) ⊢ inv ((Action.forget (ModuleCat k) (MonCat.of G)).map (LaxMonoidalFunctor.μ (linearization k G).toLaxMonoidalFunctor X Y)) = ↑(LinearEquiv.symm (finsuppTensorFinsupp' k X.V Y.V)) [PROOFSTEP] apply IsIso.inv_eq_of_hom_inv_id [GOAL] case hom_inv_id k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G X✝ Y✝ : Action (Type u) (MonCat.of G) f : X✝ ⟶ Y✝ X Y : Action (Type u) (MonCat.of G) ⊢ (Action.forget (ModuleCat k) (MonCat.of G)).map (LaxMonoidalFunctor.μ (linearization k G).toLaxMonoidalFunctor X Y) ≫ ↑(LinearEquiv.symm (finsuppTensorFinsupp' k X.V Y.V)) = 𝟙 ((Action.forget (ModuleCat k) (MonCat.of G)).obj (MonoidalCategory.tensorObj ((linearization k G).toLaxMonoidalFunctor.toFunctor.obj X) ((linearization k G).toLaxMonoidalFunctor.toFunctor.obj Y))) [PROOFSTEP] exact LinearMap.ext fun x => LinearEquiv.symm_apply_apply (finsuppTensorFinsupp' k X.V Y.V) x [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G X Y : Action (Type u) (MonCat.of G) f : X ⟶ Y A : Rep k G x : CoeSort.coe A g : ↑(MonCat.of G) ⊢ (↑(ofMulAction k G G).ρ g ≫ ↑(Finsupp.lift ((fun x => CoeSort.coe A) x) k G) fun g => ↑(↑(ρ A) g) x) = (↑(Finsupp.lift ((fun x => CoeSort.coe A) x) k G) fun g => ↑(↑(ρ A) g) x) ≫ ↑A.ρ g [PROOFSTEP] refine' Finsupp.lhom_ext' fun y => LinearMap.ext_ring _ /- Porting note: rest of broken proof was simpa only [LinearMap.comp_apply, ModuleCat.comp_def, Finsupp.lsingle_apply, Finsupp.lift_apply, Action_ρ_eq_ρ, of_ρ_apply, Representation.ofMulAction_single, Finsupp.sum_single_index, zero_smul, one_smul, smul_eq_mul, A.ρ.map_mul] -/ [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G X Y : Action (Type u) (MonCat.of G) f : X ⟶ Y A : Rep k G x : CoeSort.coe A g : ↑(MonCat.of G) y : G ⊢ ↑(LinearMap.comp (↑(ofMulAction k G G).ρ g ≫ ↑(Finsupp.lift ((fun x => CoeSort.coe A) x) k G) fun g => ↑(↑(ρ A) g) x) (Finsupp.lsingle y)) 1 = ↑(LinearMap.comp ((↑(Finsupp.lift ((fun x => CoeSort.coe A) x) k G) fun g => ↑(↑(ρ A) g) x) ≫ ↑A.ρ g) (Finsupp.lsingle y)) 1 [PROOFSTEP] simp only [LinearMap.comp_apply, ModuleCat.comp_def, Finsupp.lsingle_apply] [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G X Y : Action (Type u) (MonCat.of G) f : X ⟶ Y A : Rep k G x : CoeSort.coe A g : ↑(MonCat.of G) y : G ⊢ ↑(↑(Finsupp.lift (CoeSort.coe A) k G) fun g => ↑(↑(ρ A) g) x) (↑(↑(ofMulAction k G G).ρ g) (Finsupp.single y 1)) = ↑(↑A.ρ g) (↑(↑(Finsupp.lift (CoeSort.coe A) k G) fun g => ↑(↑(ρ A) g) x) (Finsupp.single y 1)) [PROOFSTEP] erw [Finsupp.lift_apply, Finsupp.lift_apply, Representation.ofMulAction_single (G := G)] [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G X Y : Action (Type u) (MonCat.of G) f : X ⟶ Y A : Rep k G x : CoeSort.coe A g : ↑(MonCat.of G) y : G ⊢ (Finsupp.sum (Finsupp.single (g • y) 1) fun x_1 r => r • ↑(↑(ρ A) x_1) x) = ↑(↑A.ρ g) (Finsupp.sum (Finsupp.single y 1) fun x_1 r => r • ↑(↑(ρ A) x_1) x) [PROOFSTEP] simp only [Finsupp.sum_single_index, zero_smul, one_smul, smul_eq_mul, A.ρ.map_mul, of_ρ] [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G X Y : Action (Type u) (MonCat.of G) f : X ⟶ Y A : Rep k G x : CoeSort.coe A g : ↑(MonCat.of G) y : G ⊢ ↑(↑(ρ A) g * ↑(ρ A) y) x = ↑(↑A.ρ g) (↑(↑(ρ A) y) x) [PROOFSTEP] rfl [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G X Y : Action (Type u) (MonCat.of G) f : X ⟶ Y A : Rep k G x : CoeSort.coe A ⊢ ↑(leftRegularHom A x).hom (Finsupp.single 1 1) = x [PROOFSTEP] rw [leftRegularHom_hom, Finsupp.lift_apply, Finsupp.sum_single_index, one_smul, A.ρ.map_one, LinearMap.one_apply] [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G X Y : Action (Type u) (MonCat.of G) f : X ⟶ Y A : Rep k G x : CoeSort.coe A ⊢ 0 • ↑(↑(ρ A) 1) x = 0 [PROOFSTEP] rw [zero_smul] [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G X Y : Action (Type u) (MonCat.of G) f✝ : X ⟶ Y A : Rep k G f : ofMulAction k G G ⟶ A ⊢ (fun x => leftRegularHom A x) (AddHom.toFun { toAddHom := { toFun := fun f => ↑f.hom (Finsupp.single 1 1), map_add' := (_ : ∀ (x y : ofMulAction k G G ⟶ A), (fun f => ↑f.hom (Finsupp.single 1 1)) (x + y) = (fun f => ↑f.hom (Finsupp.single 1 1)) (x + y)) }, map_smul' := (_ : ∀ (r : k) (x : ofMulAction k G G ⟶ A), AddHom.toFun { toFun := fun f => ↑f.hom (Finsupp.single 1 1), map_add' := (_ : ∀ (x y : ofMulAction k G G ⟶ A), (fun f => ↑f.hom (Finsupp.single 1 1)) (x + y) = (fun f => ↑f.hom (Finsupp.single 1 1)) (x + y)) } (r • x) = AddHom.toFun { toFun := fun f => ↑f.hom (Finsupp.single 1 1), map_add' := (_ : ∀ (x y : ofMulAction k G G ⟶ A), (fun f => ↑f.hom (Finsupp.single 1 1)) (x + y) = (fun f => ↑f.hom (Finsupp.single 1 1)) (x + y)) } (r • x)) }.toAddHom f) = f [PROOFSTEP] refine' Action.Hom.ext _ _ (Finsupp.lhom_ext' fun x : G => LinearMap.ext_ring _) [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G X Y : Action (Type u) (MonCat.of G) f✝ : X ⟶ Y A : Rep k G f : ofMulAction k G G ⟶ A x : G ⊢ ↑(LinearMap.comp ((fun x => leftRegularHom A x) (AddHom.toFun { toAddHom := { toFun := fun f => ↑f.hom (Finsupp.single 1 1), map_add' := (_ : ∀ (x y : ofMulAction k G G ⟶ A), (fun f => ↑f.hom (Finsupp.single 1 1)) (x + y) = (fun f => ↑f.hom (Finsupp.single 1 1)) (x + y)) }, map_smul' := (_ : ∀ (r : k) (x : ofMulAction k G G ⟶ A), AddHom.toFun { toFun := fun f => ↑f.hom (Finsupp.single 1 1), map_add' := (_ : ∀ (x y : ofMulAction k G G ⟶ A), (fun f => ↑f.hom (Finsupp.single 1 1)) (x + y) = (fun f => ↑f.hom (Finsupp.single 1 1)) (x + y)) } (r • x) = AddHom.toFun { toFun := fun f => ↑f.hom (Finsupp.single 1 1), map_add' := (_ : ∀ (x y : ofMulAction k G G ⟶ A), (fun f => ↑f.hom (Finsupp.single 1 1)) (x + y) = (fun f => ↑f.hom (Finsupp.single 1 1)) (x + y)) } (r • x)) }.toAddHom f)).hom (Finsupp.lsingle x)) 1 = ↑(LinearMap.comp f.hom (Finsupp.lsingle x)) 1 [PROOFSTEP] have : f.hom ((ofMulAction k G G).ρ x (Finsupp.single (1 : G) (1 : k))) = A.ρ x (f.hom (Finsupp.single (1 : G) (1 : k))) := LinearMap.ext_iff.1 (f.comm x) (Finsupp.single 1 1) /- Porting note: rest of broken proof was simp only [LinearMap.comp_apply, Finsupp.lsingle_apply, left_regular_hom_hom, Finsupp.lift_apply, Finsupp.sum_single_index, one_smul, ← this, zero_smul, of_ρ_apply, Representation.ofMulAction_single x (1 : G) (1 : k), smul_eq_mul, mul_one] -/ [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G X Y : Action (Type u) (MonCat.of G) f✝ : X ⟶ Y A : Rep k G f : ofMulAction k G G ⟶ A x : G this : ↑f.hom (↑(↑(ρ (ofMulAction k G G)) x) (Finsupp.single 1 1)) = ↑(↑(ρ A) x) (↑f.hom (Finsupp.single 1 1)) ⊢ ↑(LinearMap.comp ((fun x => leftRegularHom A x) (AddHom.toFun { toAddHom := { toFun := fun f => ↑f.hom (Finsupp.single 1 1), map_add' := (_ : ∀ (x y : ofMulAction k G G ⟶ A), (fun f => ↑f.hom (Finsupp.single 1 1)) (x + y) = (fun f => ↑f.hom (Finsupp.single 1 1)) (x + y)) }, map_smul' := (_ : ∀ (r : k) (x : ofMulAction k G G ⟶ A), AddHom.toFun { toFun := fun f => ↑f.hom (Finsupp.single 1 1), map_add' := (_ : ∀ (x y : ofMulAction k G G ⟶ A), (fun f => ↑f.hom (Finsupp.single 1 1)) (x + y) = (fun f => ↑f.hom (Finsupp.single 1 1)) (x + y)) } (r • x) = AddHom.toFun { toFun := fun f => ↑f.hom (Finsupp.single 1 1), map_add' := (_ : ∀ (x y : ofMulAction k G G ⟶ A), (fun f => ↑f.hom (Finsupp.single 1 1)) (x + y) = (fun f => ↑f.hom (Finsupp.single 1 1)) (x + y)) } (r • x)) }.toAddHom f)).hom (Finsupp.lsingle x)) 1 = ↑(LinearMap.comp f.hom (Finsupp.lsingle x)) 1 [PROOFSTEP] simp only [LinearMap.comp_apply, Finsupp.lsingle_apply, leftRegularHom_hom] [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G X Y : Action (Type u) (MonCat.of G) f✝ : X ⟶ Y A : Rep k G f : ofMulAction k G G ⟶ A x : G this : ↑f.hom (↑(↑(ρ (ofMulAction k G G)) x) (Finsupp.single 1 1)) = ↑(↑(ρ A) x) (↑f.hom (Finsupp.single 1 1)) ⊢ ↑(↑(Finsupp.lift (CoeSort.coe A) k G) fun g => ↑(↑(ρ A) g) (↑f.hom (Finsupp.single 1 1))) (Finsupp.single x 1) = ↑f.hom (Finsupp.single x 1) [PROOFSTEP] erw [Finsupp.lift_apply] [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G X Y : Action (Type u) (MonCat.of G) f✝ : X ⟶ Y A : Rep k G f : ofMulAction k G G ⟶ A x : G this : ↑f.hom (↑(↑(ρ (ofMulAction k G G)) x) (Finsupp.single 1 1)) = ↑(↑(ρ A) x) (↑f.hom (Finsupp.single 1 1)) ⊢ (Finsupp.sum (Finsupp.single x 1) fun x r => r • ↑(↑(ρ A) x) (↑f.hom (Finsupp.single 1 1))) = ↑f.hom (Finsupp.single x 1) [PROOFSTEP] rw [Finsupp.sum_single_index, ← this, of_ρ_apply] [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G X Y : Action (Type u) (MonCat.of G) f✝ : X ⟶ Y A : Rep k G f : ofMulAction k G G ⟶ A x : G this : ↑f.hom (↑(↑(ρ (ofMulAction k G G)) x) (Finsupp.single 1 1)) = ↑(↑(ρ A) x) (↑f.hom (Finsupp.single 1 1)) ⊢ 1 • ↑f.hom (↑(↑(Representation.ofMulAction k G G) x) (Finsupp.single 1 1)) = ↑f.hom (Finsupp.single x 1) k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G X Y : Action (Type u) (MonCat.of G) f✝ : X ⟶ Y A : Rep k G f : ofMulAction k G G ⟶ A x : G this : ↑f.hom (↑(↑(ρ (ofMulAction k G G)) x) (Finsupp.single 1 1)) = ↑(↑(ρ A) x) (↑f.hom (Finsupp.single 1 1)) ⊢ 0 • ↑(↑(ρ A) x) (↑f.hom (Finsupp.single 1 1)) = 0 [PROOFSTEP] erw [Representation.ofMulAction_single x (1 : G) (1 : k)] [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G X Y : Action (Type u) (MonCat.of G) f✝ : X ⟶ Y A : Rep k G f : ofMulAction k G G ⟶ A x : G this : ↑f.hom (↑(↑(ρ (ofMulAction k G G)) x) (Finsupp.single 1 1)) = ↑(↑(ρ A) x) (↑f.hom (Finsupp.single 1 1)) ⊢ 1 • ↑f.hom (Finsupp.single (x • 1) 1) = ↑f.hom (Finsupp.single x 1) k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G X Y : Action (Type u) (MonCat.of G) f✝ : X ⟶ Y A : Rep k G f : ofMulAction k G G ⟶ A x : G this : ↑f.hom (↑(↑(ρ (ofMulAction k G G)) x) (Finsupp.single 1 1)) = ↑(↑(ρ A) x) (↑f.hom (Finsupp.single 1 1)) ⊢ 0 • ↑(↑(ρ A) x) (↑f.hom (Finsupp.single 1 1)) = 0 [PROOFSTEP] simp only [one_smul, smul_eq_mul, mul_one] [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G X Y : Action (Type u) (MonCat.of G) f✝ : X ⟶ Y A : Rep k G f : ofMulAction k G G ⟶ A x : G this : ↑f.hom (↑(↑(ρ (ofMulAction k G G)) x) (Finsupp.single 1 1)) = ↑(↑(ρ A) x) (↑f.hom (Finsupp.single 1 1)) ⊢ 0 • ↑(↑(ρ A) x) (↑f.hom (Finsupp.single 1 1)) = 0 [PROOFSTEP] rw [zero_smul] [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G X Y : Action (Type u) (MonCat.of G) f : X ⟶ Y A : Rep k G x : CoeSort.coe A g : G ⊢ ↑(↑(LinearEquiv.symm (leftRegularHomEquiv A)) x).hom (Finsupp.single g 1) = ↑(↑(ρ A) g) x [PROOFSTEP] rw [leftRegularHomEquiv_symm_apply, leftRegularHom_hom, Finsupp.lift_apply, Finsupp.sum_single_index, one_smul] [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G X Y : Action (Type u) (MonCat.of G) f : X ⟶ Y A : Rep k G x : CoeSort.coe A g : G ⊢ 0 • ↑(↑(ρ A) g) x = 0 [PROOFSTEP] rw [zero_smul] [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Group G A✝ B C A X Y : Rep k G f : X ⟶ Y g : ↑(MonCat.of G) x : ↑((fun B => of (Representation.linHom (ρ A) (ρ B))) X).V y : CoeSort.coe A ⊢ ↑(↑(↑((fun B => of (Representation.linHom (ρ A) (ρ B))) X).ρ g ≫ ModuleCat.ofHom (↑(LinearMap.llcomp k (CoeSort.coe A) ↑X.V ↑Y.V) f.hom)) x) y = ↑(↑(ModuleCat.ofHom (↑(LinearMap.llcomp k (CoeSort.coe A) ↑X.V ↑Y.V) f.hom) ≫ ↑((fun B => of (Representation.linHom (ρ A) (ρ B))) Y).ρ g) x) y [PROOFSTEP] show f.hom (X.ρ g _) = _ [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Group G A✝ B C A X Y : Rep k G f : X ⟶ Y g : ↑(MonCat.of G) x : ↑((fun B => of (Representation.linHom (ρ A) (ρ B))) X).V y : CoeSort.coe A ⊢ ↑f.hom (↑(↑(ρ X) g) (↑(LinearMap.comp x (↑(ρ A) g⁻¹)) y)) = ↑(↑(ModuleCat.ofHom (↑(LinearMap.llcomp k (CoeSort.coe A) ↑X.V ↑Y.V) f.hom) ≫ ↑((fun B => of (Representation.linHom (ρ A) (ρ B))) Y).ρ g) x) y [PROOFSTEP] simp only [hom_comm_apply] [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Group G A✝ B C A X Y : Rep k G f : X ⟶ Y g : ↑(MonCat.of G) x : ↑((fun B => of (Representation.linHom (ρ A) (ρ B))) X).V y : CoeSort.coe A ⊢ ↑(↑(ρ Y) g) (↑f.hom (↑(LinearMap.comp x (↑(ρ A) g⁻¹)) y)) = ↑(↑(ModuleCat.ofHom (↑(LinearMap.llcomp k (CoeSort.coe A) ↑X.V ↑Y.V) f.hom) ≫ ↑(of (Representation.linHom (ρ A) (ρ Y))).ρ g) x) y [PROOFSTEP] rfl [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Group G A✝ B C A x✝ : Rep k G ⊢ { obj := fun B => of (Representation.linHom (ρ A) (ρ B)), map := fun {X Y} f => Hom.mk (ModuleCat.ofHom (↑(LinearMap.llcomp k (CoeSort.coe A) ↑X.V ↑Y.V) f.hom)) }.map (𝟙 x✝) = 𝟙 ({ obj := fun B => of (Representation.linHom (ρ A) (ρ B)), map := fun {X Y} f => Hom.mk (ModuleCat.ofHom (↑(LinearMap.llcomp k (CoeSort.coe A) ↑X.V ↑Y.V) f.hom)) }.obj x✝) [PROOFSTEP] ext [GOAL] case h.h k G : Type u inst✝¹ : CommRing k inst✝ : Group G A✝ B C A x✝¹ : Rep k G x✝ : ↑({ obj := fun B => of (Representation.linHom (ρ A) (ρ B)), map := fun {X Y} f => Hom.mk (ModuleCat.ofHom (↑(LinearMap.llcomp k (CoeSort.coe A) ↑X.V ↑Y.V) f.hom)) }.obj x✝¹).V ⊢ ↑({ obj := fun B => of (Representation.linHom (ρ A) (ρ B)), map := fun {X Y} f => Hom.mk (ModuleCat.ofHom (↑(LinearMap.llcomp k (CoeSort.coe A) ↑X.V ↑Y.V) f.hom)) }.map (𝟙 x✝¹)).hom x✝ = ↑(𝟙 ({ obj := fun B => of (Representation.linHom (ρ A) (ρ B)), map := fun {X Y} f => Hom.mk (ModuleCat.ofHom (↑(LinearMap.llcomp k (CoeSort.coe A) ↑X.V ↑Y.V) f.hom)) }.obj x✝¹)).hom x✝ [PROOFSTEP] rfl [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Group G A✝ B C A X✝ Y✝ Z✝ : Rep k G x✝¹ : X✝ ⟶ Y✝ x✝ : Y✝ ⟶ Z✝ ⊢ { obj := fun B => of (Representation.linHom (ρ A) (ρ B)), map := fun {X Y} f => Hom.mk (ModuleCat.ofHom (↑(LinearMap.llcomp k (CoeSort.coe A) ↑X.V ↑Y.V) f.hom)) }.map (x✝¹ ≫ x✝) = { obj := fun B => of (Representation.linHom (ρ A) (ρ B)), map := fun {X Y} f => Hom.mk (ModuleCat.ofHom (↑(LinearMap.llcomp k (CoeSort.coe A) ↑X.V ↑Y.V) f.hom)) }.map x✝¹ ≫ { obj := fun B => of (Representation.linHom (ρ A) (ρ B)), map := fun {X Y} f => Hom.mk (ModuleCat.ofHom (↑(LinearMap.llcomp k (CoeSort.coe A) ↑X.V ↑Y.V) f.hom)) }.map x✝ [PROOFSTEP] ext [GOAL] case h.h k G : Type u inst✝¹ : CommRing k inst✝ : Group G A✝ B C A X✝ Y✝ Z✝ : Rep k G x✝² : X✝ ⟶ Y✝ x✝¹ : Y✝ ⟶ Z✝ x✝ : ↑({ obj := fun B => of (Representation.linHom (ρ A) (ρ B)), map := fun {X Y} f => Hom.mk (ModuleCat.ofHom (↑(LinearMap.llcomp k (CoeSort.coe A) ↑X.V ↑Y.V) f.hom)) }.obj X✝).V ⊢ ↑({ obj := fun B => of (Representation.linHom (ρ A) (ρ B)), map := fun {X Y} f => Hom.mk (ModuleCat.ofHom (↑(LinearMap.llcomp k (CoeSort.coe A) ↑X.V ↑Y.V) f.hom)) }.map (x✝² ≫ x✝¹)).hom x✝ = ↑({ obj := fun B => of (Representation.linHom (ρ A) (ρ B)), map := fun {X Y} f => Hom.mk (ModuleCat.ofHom (↑(LinearMap.llcomp k (CoeSort.coe A) ↑X.V ↑Y.V) f.hom)) }.map x✝² ≫ { obj := fun B => of (Representation.linHom (ρ A) (ρ B)), map := fun {X Y} f => Hom.mk (ModuleCat.ofHom (↑(LinearMap.llcomp k (CoeSort.coe A) ↑X.V ↑Y.V) f.hom)) }.map x✝¹).hom x✝ [PROOFSTEP] rfl [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Group G A✝ B✝ C✝ A B C : Rep k G f : A ⊗ B ⟶ C g : ↑(MonCat.of G) ⊢ ↑B.ρ g ≫ LinearMap.flip (TensorProduct.curry f.hom) = LinearMap.flip (TensorProduct.curry f.hom) ≫ ↑((Rep.ihom A).obj C).ρ g [PROOFSTEP] refine' LinearMap.ext fun x => LinearMap.ext fun y => _ [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Group G A✝ B✝ C✝ A B C : Rep k G f : A ⊗ B ⟶ C g : ↑(MonCat.of G) x : ↑B.V y : CoeSort.coe A ⊢ ↑(↑(↑B.ρ g ≫ LinearMap.flip (TensorProduct.curry f.hom)) x) y = ↑(↑(LinearMap.flip (TensorProduct.curry f.hom) ≫ ↑((Rep.ihom A).obj C).ρ g) x) y [PROOFSTEP] change f.hom (_ ⊗ₜ[k] _) = C.ρ g (f.hom (_ ⊗ₜ[k] _)) [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Group G A✝ B✝ C✝ A B C : Rep k G f : A ⊗ B ⟶ C g : ↑(MonCat.of G) x : ↑B.V y : CoeSort.coe A ⊢ ↑f.hom (y ⊗ₜ[k] ↑(↑B.ρ g) x) = ↑(↑(ρ C) g) (↑f.hom (↑(↑(ρ A) g⁻¹) y ⊗ₜ[k] x)) [PROOFSTEP] rw [← hom_comm_apply] [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Group G A✝ B✝ C✝ A B C : Rep k G f : A ⊗ B ⟶ C g : ↑(MonCat.of G) x : ↑B.V y : CoeSort.coe A ⊢ ↑f.hom (y ⊗ₜ[k] ↑(↑B.ρ g) x) = ↑f.hom (↑(↑(ρ (A ⊗ B)) g) (↑(↑(ρ A) g⁻¹) y ⊗ₜ[k] x)) [PROOFSTEP] change _ = f.hom ((A.ρ g * A.ρ g⁻¹) y ⊗ₜ[k] _) [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Group G A✝ B✝ C✝ A B C : Rep k G f : A ⊗ B ⟶ C g : ↑(MonCat.of G) x : ↑B.V y : CoeSort.coe A ⊢ ↑f.hom (y ⊗ₜ[k] ↑(↑B.ρ g) x) = ↑f.hom (↑(↑(ρ A) g * ↑(ρ A) g⁻¹) y ⊗ₜ[k] ↑(((CategoryTheory.Equivalence.symm (functorCategoryEquivalence (ModuleCat k) (MonCat.of G))).inverse.obj B).map g) (↑(↑(ρ A) g⁻¹) y, x).snd) [PROOFSTEP] simp only [← map_mul, mul_inv_self, map_one] [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Group G A✝ B✝ C✝ A B C : Rep k G f : A ⊗ B ⟶ C g : ↑(MonCat.of G) x : ↑B.V y : CoeSort.coe A ⊢ ↑f.hom (y ⊗ₜ[k] ↑(↑B.ρ g) x) = ↑f.hom (↑1 y ⊗ₜ[k] ↑(((CategoryTheory.Equivalence.symm (functorCategoryEquivalence (ModuleCat k) (MonCat.of G))).inverse.obj B).map g) x) [PROOFSTEP] rfl [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Group G A✝ B✝ C✝ A B C : Rep k G f : B ⟶ (Rep.ihom A).obj C g : ↑(MonCat.of G) x : ↑(((CategoryTheory.Equivalence.symm (functorCategoryEquivalence (ModuleCat k) (MonCat.of G))).inverse.obj A).obj PUnit.unit) y : ↑(((CategoryTheory.Equivalence.symm (functorCategoryEquivalence (ModuleCat k) (MonCat.of G))).inverse.obj B).obj PUnit.unit) ⊢ ↑(↑(A ⊗ B).ρ g ≫ ↑(TensorProduct.uncurry k (CoeSort.coe A) (↑B.V) (CoeSort.coe C)) (LinearMap.flip f.hom)) (x ⊗ₜ[k] y) = ↑(↑(TensorProduct.uncurry k (CoeSort.coe A) (↑B.V) (CoeSort.coe C)) (LinearMap.flip f.hom) ≫ ↑C.ρ g) (x ⊗ₜ[k] y) [PROOFSTEP] change TensorProduct.uncurry k _ _ _ f.hom.flip (A.ρ g x ⊗ₜ[k] B.ρ g y) = C.ρ g (TensorProduct.uncurry k _ _ _ f.hom.flip (x ⊗ₜ[k] y)) [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Group G A✝ B✝ C✝ A B C : Rep k G f : B ⟶ (Rep.ihom A).obj C g : ↑(MonCat.of G) x : ↑(((CategoryTheory.Equivalence.symm (functorCategoryEquivalence (ModuleCat k) (MonCat.of G))).inverse.obj A).obj PUnit.unit) y : ↑(((CategoryTheory.Equivalence.symm (functorCategoryEquivalence (ModuleCat k) (MonCat.of G))).inverse.obj B).obj PUnit.unit) ⊢ ↑(↑(TensorProduct.uncurry k (CoeSort.coe A) (↑B.V) (CoeSort.coe C)) (LinearMap.flip f.hom)) (↑(↑(ρ A) g) x ⊗ₜ[k] ↑(↑(ρ B) g) y) = ↑(↑(ρ C) g) (↑(↑(TensorProduct.uncurry k (CoeSort.coe A) (↑B.V) (CoeSort.coe C)) (LinearMap.flip f.hom)) (x ⊗ₜ[k] y)) [PROOFSTEP] rw [TensorProduct.uncurry_apply, LinearMap.flip_apply, hom_comm_apply, Rep.ihom_obj_ρ_apply, LinearMap.comp_apply, LinearMap.comp_apply, ρ_inv_self_apply] [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Group G A✝ B✝ C✝ A B C : Rep k G f : B ⟶ (Rep.ihom A).obj C g : ↑(MonCat.of G) x : ↑(((CategoryTheory.Equivalence.symm (functorCategoryEquivalence (ModuleCat k) (MonCat.of G))).inverse.obj A).obj PUnit.unit) y : ↑(((CategoryTheory.Equivalence.symm (functorCategoryEquivalence (ModuleCat k) (MonCat.of G))).inverse.obj B).obj PUnit.unit) ⊢ ↑(↑(ρ C) g) (↑(↑f.hom y) x) = ↑(↑(ρ C) g) (↑(↑(TensorProduct.uncurry k (CoeSort.coe A) (↑B.V) (CoeSort.coe C)) (LinearMap.flip f.hom)) (x ⊗ₜ[k] y)) [PROOFSTEP] rfl [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Group G A✝ B✝ C✝ A B C : Rep k G f : B ⟶ (Rep.ihom A).obj C ⊢ (fun f => Hom.mk (LinearMap.flip (TensorProduct.curry f.hom))) ((fun f => Hom.mk (↑(TensorProduct.uncurry k (CoeSort.coe A) (↑B.V) (CoeSort.coe C)) (LinearMap.flip f.hom))) f) = f [PROOFSTEP] ext [GOAL] case h.h k G : Type u inst✝¹ : CommRing k inst✝ : Group G A✝ B✝ C✝ A B C : Rep k G f : B ⟶ (Rep.ihom A).obj C x✝ : ↑B.V ⊢ ↑((fun f => Hom.mk (LinearMap.flip (TensorProduct.curry f.hom))) ((fun f => Hom.mk (↑(TensorProduct.uncurry k (CoeSort.coe A) (↑B.V) (CoeSort.coe C)) (LinearMap.flip f.hom))) f)).hom x✝ = ↑f.hom x✝ [PROOFSTEP] rfl [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Group G A✝ B✝ C A B : Rep k G ⊢ (NatTrans.app (ihom.ev A) B).hom = ↑(TensorProduct.uncurry k (CoeSort.coe A) (CoeSort.coe A →ₗ[k] CoeSort.coe B) (CoeSort.coe B)) (LinearMap.flip LinearMap.id) [PROOFSTEP] ext [GOAL] case h k G : Type u inst✝¹ : CommRing k inst✝ : Group G A✝ B✝ C A B : Rep k G x✝ : ↑((ihom A ⋙ tensorLeft A).obj B).V ⊢ ↑(NatTrans.app (ihom.ev A) B).hom x✝ = ↑(↑(TensorProduct.uncurry k (CoeSort.coe A) (CoeSort.coe A →ₗ[k] CoeSort.coe B) (CoeSort.coe B)) (LinearMap.flip LinearMap.id)) x✝ [PROOFSTEP] rfl [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G ⊢ SymmetricCategory (Rep k G) [PROOFSTEP] infer_instance [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G ⊢ MonoidalPreadditive (Rep k G) [PROOFSTEP] infer_instance [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G ⊢ MonoidalLinear k (Rep k G) [PROOFSTEP] infer_instance [GOAL] k✝ G✝ : Type u inst✝⁷ : CommRing k✝ inst✝⁶ : Monoid G✝ k : Type u_1 G : Type u_2 inst✝⁵ : CommRing k inst✝⁴ : Monoid G V : Type u_3 W : Type u_4 inst✝³ : AddCommGroup V inst✝² : AddCommGroup W inst✝¹ : Module k V inst✝ : Module k W ρ : G →* V →ₗ[k] V σ : G →* W →ₗ[k] W f : V →ₗ[k] W w : ∀ (g : G), LinearMap.comp f (↑ρ g) = LinearMap.comp (↑σ g) f r : MonoidAlgebra k G x : V ⊢ ↑f (↑(↑(↑(MonoidAlgebra.lift k G (V →ₗ[k] V)) ρ) r) x) = ↑(↑(↑(MonoidAlgebra.lift k G (W →ₗ[k] W)) σ) r) (↑f x) [PROOFSTEP] apply MonoidAlgebra.induction_on r [GOAL] case hM k✝ G✝ : Type u inst✝⁷ : CommRing k✝ inst✝⁶ : Monoid G✝ k : Type u_1 G : Type u_2 inst✝⁵ : CommRing k inst✝⁴ : Monoid G V : Type u_3 W : Type u_4 inst✝³ : AddCommGroup V inst✝² : AddCommGroup W inst✝¹ : Module k V inst✝ : Module k W ρ : G →* V →ₗ[k] V σ : G →* W →ₗ[k] W f : V →ₗ[k] W w : ∀ (g : G), LinearMap.comp f (↑ρ g) = LinearMap.comp (↑σ g) f r : MonoidAlgebra k G x : V ⊢ ∀ (g : G), ↑f (↑(↑(↑(MonoidAlgebra.lift k G (V →ₗ[k] V)) ρ) (↑(MonoidAlgebra.of k G) g)) x) = ↑(↑(↑(MonoidAlgebra.lift k G (W →ₗ[k] W)) σ) (↑(MonoidAlgebra.of k G) g)) (↑f x) [PROOFSTEP] intro g [GOAL] case hM k✝ G✝ : Type u inst✝⁷ : CommRing k✝ inst✝⁶ : Monoid G✝ k : Type u_1 G : Type u_2 inst✝⁵ : CommRing k inst✝⁴ : Monoid G V : Type u_3 W : Type u_4 inst✝³ : AddCommGroup V inst✝² : AddCommGroup W inst✝¹ : Module k V inst✝ : Module k W ρ : G →* V →ₗ[k] V σ : G →* W →ₗ[k] W f : V →ₗ[k] W w : ∀ (g : G), LinearMap.comp f (↑ρ g) = LinearMap.comp (↑σ g) f r : MonoidAlgebra k G x : V g : G ⊢ ↑f (↑(↑(↑(MonoidAlgebra.lift k G (V →ₗ[k] V)) ρ) (↑(MonoidAlgebra.of k G) g)) x) = ↑(↑(↑(MonoidAlgebra.lift k G (W →ₗ[k] W)) σ) (↑(MonoidAlgebra.of k G) g)) (↑f x) [PROOFSTEP] simp only [one_smul, MonoidAlgebra.lift_single, MonoidAlgebra.of_apply] [GOAL] case hM k✝ G✝ : Type u inst✝⁷ : CommRing k✝ inst✝⁶ : Monoid G✝ k : Type u_1 G : Type u_2 inst✝⁵ : CommRing k inst✝⁴ : Monoid G V : Type u_3 W : Type u_4 inst✝³ : AddCommGroup V inst✝² : AddCommGroup W inst✝¹ : Module k V inst✝ : Module k W ρ : G →* V →ₗ[k] V σ : G →* W →ₗ[k] W f : V →ₗ[k] W w : ∀ (g : G), LinearMap.comp f (↑ρ g) = LinearMap.comp (↑σ g) f r : MonoidAlgebra k G x : V g : G ⊢ ↑f (↑(↑ρ g) x) = ↑(↑σ g) (↑f x) [PROOFSTEP] exact LinearMap.congr_fun (w g) x [GOAL] case hadd k✝ G✝ : Type u inst✝⁷ : CommRing k✝ inst✝⁶ : Monoid G✝ k : Type u_1 G : Type u_2 inst✝⁵ : CommRing k inst✝⁴ : Monoid G V : Type u_3 W : Type u_4 inst✝³ : AddCommGroup V inst✝² : AddCommGroup W inst✝¹ : Module k V inst✝ : Module k W ρ : G →* V →ₗ[k] V σ : G →* W →ₗ[k] W f : V →ₗ[k] W w : ∀ (g : G), LinearMap.comp f (↑ρ g) = LinearMap.comp (↑σ g) f r : MonoidAlgebra k G x : V ⊢ ∀ (f_1 g : MonoidAlgebra k G), ↑f (↑(↑(↑(MonoidAlgebra.lift k G (V →ₗ[k] V)) ρ) f_1) x) = ↑(↑(↑(MonoidAlgebra.lift k G (W →ₗ[k] W)) σ) f_1) (↑f x) → ↑f (↑(↑(↑(MonoidAlgebra.lift k G (V →ₗ[k] V)) ρ) g) x) = ↑(↑(↑(MonoidAlgebra.lift k G (W →ₗ[k] W)) σ) g) (↑f x) → ↑f (↑(↑(↑(MonoidAlgebra.lift k G (V →ₗ[k] V)) ρ) (f_1 + g)) x) = ↑(↑(↑(MonoidAlgebra.lift k G (W →ₗ[k] W)) σ) (f_1 + g)) (↑f x) [PROOFSTEP] intro g h gw hw [GOAL] case hadd k✝ G✝ : Type u inst✝⁷ : CommRing k✝ inst✝⁶ : Monoid G✝ k : Type u_1 G : Type u_2 inst✝⁵ : CommRing k inst✝⁴ : Monoid G V : Type u_3 W : Type u_4 inst✝³ : AddCommGroup V inst✝² : AddCommGroup W inst✝¹ : Module k V inst✝ : Module k W ρ : G →* V →ₗ[k] V σ : G →* W →ₗ[k] W f : V →ₗ[k] W w : ∀ (g : G), LinearMap.comp f (↑ρ g) = LinearMap.comp (↑σ g) f r : MonoidAlgebra k G x : V g h : MonoidAlgebra k G gw : ↑f (↑(↑(↑(MonoidAlgebra.lift k G (V →ₗ[k] V)) ρ) g) x) = ↑(↑(↑(MonoidAlgebra.lift k G (W →ₗ[k] W)) σ) g) (↑f x) hw : ↑f (↑(↑(↑(MonoidAlgebra.lift k G (V →ₗ[k] V)) ρ) h) x) = ↑(↑(↑(MonoidAlgebra.lift k G (W →ₗ[k] W)) σ) h) (↑f x) ⊢ ↑f (↑(↑(↑(MonoidAlgebra.lift k G (V →ₗ[k] V)) ρ) (g + h)) x) = ↑(↑(↑(MonoidAlgebra.lift k G (W →ₗ[k] W)) σ) (g + h)) (↑f x) [PROOFSTEP] simp only [map_add, add_left_inj, LinearMap.add_apply, hw, gw] [GOAL] case hsmul k✝ G✝ : Type u inst✝⁷ : CommRing k✝ inst✝⁶ : Monoid G✝ k : Type u_1 G : Type u_2 inst✝⁵ : CommRing k inst✝⁴ : Monoid G V : Type u_3 W : Type u_4 inst✝³ : AddCommGroup V inst✝² : AddCommGroup W inst✝¹ : Module k V inst✝ : Module k W ρ : G →* V →ₗ[k] V σ : G →* W →ₗ[k] W f : V →ₗ[k] W w : ∀ (g : G), LinearMap.comp f (↑ρ g) = LinearMap.comp (↑σ g) f r : MonoidAlgebra k G x : V ⊢ ∀ (r : k) (f_1 : MonoidAlgebra k G), ↑f (↑(↑(↑(MonoidAlgebra.lift k G (V →ₗ[k] V)) ρ) f_1) x) = ↑(↑(↑(MonoidAlgebra.lift k G (W →ₗ[k] W)) σ) f_1) (↑f x) → ↑f (↑(↑(↑(MonoidAlgebra.lift k G (V →ₗ[k] V)) ρ) (r • f_1)) x) = ↑(↑(↑(MonoidAlgebra.lift k G (W →ₗ[k] W)) σ) (r • f_1)) (↑f x) [PROOFSTEP] intro r g w [GOAL] case hsmul k✝ G✝ : Type u inst✝⁷ : CommRing k✝ inst✝⁶ : Monoid G✝ k : Type u_1 G : Type u_2 inst✝⁵ : CommRing k inst✝⁴ : Monoid G V : Type u_3 W : Type u_4 inst✝³ : AddCommGroup V inst✝² : AddCommGroup W inst✝¹ : Module k V inst✝ : Module k W ρ : G →* V →ₗ[k] V σ : G →* W →ₗ[k] W f : V →ₗ[k] W w✝ : ∀ (g : G), LinearMap.comp f (↑ρ g) = LinearMap.comp (↑σ g) f r✝ : MonoidAlgebra k G x : V r : k g : MonoidAlgebra k G w : ↑f (↑(↑(↑(MonoidAlgebra.lift k G (V →ₗ[k] V)) ρ) g) x) = ↑(↑(↑(MonoidAlgebra.lift k G (W →ₗ[k] W)) σ) g) (↑f x) ⊢ ↑f (↑(↑(↑(MonoidAlgebra.lift k G (V →ₗ[k] V)) ρ) (r • g)) x) = ↑(↑(↑(MonoidAlgebra.lift k G (W →ₗ[k] W)) σ) (r • g)) (↑f x) [PROOFSTEP] simp only [AlgHom.map_smul, w, RingHom.id_apply, LinearMap.smul_apply, LinearMap.map_smulₛₗ] [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G X✝ Y✝ : ModuleCat (MonoidAlgebra k G) f : X✝ ⟶ Y✝ g : ↑(MonCat.of G) ⊢ ↑((fun M => of (Representation.ofModule ↑M)) X✝).ρ g ≫ { toAddHom := f.toAddHom, map_smul' := (_ : ∀ (r : k) (x : ↑((fun M => of (Representation.ofModule ↑M)) X✝).V), ↑f (↑(algebraMap k (MonoidAlgebra k G)) r • x) = ↑(algebraMap k (MonoidAlgebra k G)) r • ↑f x) } = { toAddHom := f.toAddHom, map_smul' := (_ : ∀ (r : k) (x : ↑((fun M => of (Representation.ofModule ↑M)) X✝).V), ↑f (↑(algebraMap k (MonoidAlgebra k G)) r • x) = ↑(algebraMap k (MonoidAlgebra k G)) r • ↑f x) } ≫ ↑((fun M => of (Representation.ofModule ↑M)) Y✝).ρ g [PROOFSTEP] ext [GOAL] case h k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G X✝ Y✝ : ModuleCat (MonoidAlgebra k G) f : X✝ ⟶ Y✝ g : ↑(MonCat.of G) x✝ : ↑((fun M => of (Representation.ofModule ↑M)) X✝).V ⊢ ↑(↑((fun M => of (Representation.ofModule ↑M)) X✝).ρ g ≫ { toAddHom := f.toAddHom, map_smul' := (_ : ∀ (r : k) (x : ↑((fun M => of (Representation.ofModule ↑M)) X✝).V), ↑f (↑(algebraMap k (MonoidAlgebra k G)) r • x) = ↑(algebraMap k (MonoidAlgebra k G)) r • ↑f x) }) x✝ = ↑({ toAddHom := f.toAddHom, map_smul' := (_ : ∀ (r : k) (x : ↑((fun M => of (Representation.ofModule ↑M)) X✝).V), ↑f (↑(algebraMap k (MonoidAlgebra k G)) r • x) = ↑(algebraMap k (MonoidAlgebra k G)) r • ↑f x) } ≫ ↑((fun M => of (Representation.ofModule ↑M)) Y✝).ρ g) x✝ [PROOFSTEP] apply f.map_smul [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G M : ModuleCat (MonoidAlgebra k G) ⊢ ↑((ofModuleMonoidAlgebra ⋙ toModuleMonoidAlgebra).obj M) ≃+ ↑M [PROOFSTEP] dsimp [ofModuleMonoidAlgebra, toModuleMonoidAlgebra] [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G M : ModuleCat (MonoidAlgebra k G) ⊢ ↑(ModuleCat.of (MonoidAlgebra k G) (Representation.asModule (Representation.ofModule ↑M))) ≃+ ↑M [PROOFSTEP] refine' (Representation.ofModule M).asModuleEquiv.trans (RestrictScalars.addEquiv k (MonoidAlgebra k G) _) [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G V : Rep k G ⊢ CoeSort.coe V ≃+ CoeSort.coe ((toModuleMonoidAlgebra ⋙ ofModuleMonoidAlgebra).obj V) [PROOFSTEP] dsimp [ofModuleMonoidAlgebra, toModuleMonoidAlgebra] [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G V : Rep k G ⊢ CoeSort.coe V ≃+ RestrictScalars k (MonoidAlgebra k G) ↑(ModuleCat.of (MonoidAlgebra k G) (Representation.asModule (ρ V))) [PROOFSTEP] refine' V.ρ.asModuleEquiv.symm.trans _ [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G V : Rep k G ⊢ Representation.asModule (ρ V) ≃+ RestrictScalars k (MonoidAlgebra k G) ↑(ModuleCat.of (MonoidAlgebra k G) (Representation.asModule (ρ V))) [PROOFSTEP] exact (RestrictScalars.addEquiv _ _ _).symm [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G M : ModuleCat (MonoidAlgebra k G) src✝ : ↑((ofModuleMonoidAlgebra ⋙ toModuleMonoidAlgebra).obj M) ≃+ ↑M := counitIsoAddEquiv r : MonoidAlgebra k G x : ↑((ofModuleMonoidAlgebra ⋙ toModuleMonoidAlgebra).obj M) ⊢ AddHom.toFun { toFun := src✝.toFun, map_add' := (_ : ∀ (x y : ↑((ofModuleMonoidAlgebra ⋙ toModuleMonoidAlgebra).obj M)), Equiv.toFun src✝.toEquiv (x + y) = Equiv.toFun src✝.toEquiv x + Equiv.toFun src✝.toEquiv y) } (r • x) = ↑(RingHom.id (MonoidAlgebra k G)) r • AddHom.toFun { toFun := src✝.toFun, map_add' := (_ : ∀ (x y : ↑((ofModuleMonoidAlgebra ⋙ toModuleMonoidAlgebra).obj M)), Equiv.toFun src✝.toEquiv (x + y) = Equiv.toFun src✝.toEquiv x + Equiv.toFun src✝.toEquiv y) } x [PROOFSTEP] dsimp [counitIsoAddEquiv] /- Porting note: rest of broken proof was `simp`. -/ [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G M : ModuleCat (MonoidAlgebra k G) src✝ : ↑((ofModuleMonoidAlgebra ⋙ toModuleMonoidAlgebra).obj M) ≃+ ↑M := counitIsoAddEquiv r : MonoidAlgebra k G x : ↑((ofModuleMonoidAlgebra ⋙ toModuleMonoidAlgebra).obj M) ⊢ ↑↑(AddEquiv.trans (Representation.asModuleEquiv (Representation.ofModule ↑M)) (RestrictScalars.addEquiv k (MonoidAlgebra k G) ↑M)) (r • x) = r • ↑↑(AddEquiv.trans (Representation.asModuleEquiv (Representation.ofModule ↑M)) (RestrictScalars.addEquiv k (MonoidAlgebra k G) ↑M)) x [PROOFSTEP] rw [AddEquiv.coe_toEquiv, AddEquiv.trans_apply] [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G M : ModuleCat (MonoidAlgebra k G) src✝ : ↑((ofModuleMonoidAlgebra ⋙ toModuleMonoidAlgebra).obj M) ≃+ ↑M := counitIsoAddEquiv r : MonoidAlgebra k G x : ↑((ofModuleMonoidAlgebra ⋙ toModuleMonoidAlgebra).obj M) ⊢ ↑(RestrictScalars.addEquiv k (MonoidAlgebra k G) ↑M) (↑(Representation.asModuleEquiv (Representation.ofModule ↑M)) (r • x)) = r • ↑(AddEquiv.trans (Representation.asModuleEquiv (Representation.ofModule ↑M)) (RestrictScalars.addEquiv k (MonoidAlgebra k G) ↑M)) x [PROOFSTEP] erw [Representation.ofModule_asAlgebraHom_apply_apply] [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G M : ModuleCat (MonoidAlgebra k G) src✝ : ↑((ofModuleMonoidAlgebra ⋙ toModuleMonoidAlgebra).obj M) ≃+ ↑M := counitIsoAddEquiv r : MonoidAlgebra k G x : ↑((ofModuleMonoidAlgebra ⋙ toModuleMonoidAlgebra).obj M) ⊢ ↑(AddEquiv.symm (RestrictScalars.addEquiv k (MonoidAlgebra k G) ((fun x => ↑M) x))) (r • ↑(RestrictScalars.addEquiv k (MonoidAlgebra k G) ↑M) x) = r • ↑(AddEquiv.trans (Representation.asModuleEquiv (Representation.ofModule ↑M)) (RestrictScalars.addEquiv k (MonoidAlgebra k G) ↑M)) x [PROOFSTEP] exact AddEquiv.symm_apply_apply _ _ [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G V : Rep k G g : G x : CoeSort.coe V ⊢ ↑unitIsoAddEquiv (AddHom.toFun (↑(ρ V) g).toAddHom x) = AddHom.toFun (↑(ρ (ofModuleMonoidAlgebra.obj (toModuleMonoidAlgebra.obj V))) g).toAddHom (↑unitIsoAddEquiv x) [PROOFSTEP] dsimp [unitIsoAddEquiv, ofModuleMonoidAlgebra, toModuleMonoidAlgebra] /- Porting note: rest of broken proof was simp only [AddEquiv.apply_eq_iff_eq, AddEquiv.apply_symm_apply, Representation.asModuleEquiv_symm_map_rho, Representation.ofModule_asModule_act] -/ [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G V : Rep k G g : G x : CoeSort.coe V ⊢ ↑(AddEquiv.trans (AddEquiv.symm (Representation.asModuleEquiv (ρ V))) (AddEquiv.symm (RestrictScalars.addEquiv k (MonoidAlgebra k G) (Representation.asModule (ρ V))))) (↑(↑(ρ V) g) x) = AddHom.toFun (↑(Representation.ofModule ↑(ModuleCat.of (MonoidAlgebra k G) (Representation.asModule (ρ V)))) g).toAddHom (↑(AddEquiv.trans (AddEquiv.symm (Representation.asModuleEquiv (ρ V))) (AddEquiv.symm (RestrictScalars.addEquiv k (MonoidAlgebra k G) (Representation.asModule (ρ V))))) x) [PROOFSTEP] erw [Representation.asModuleEquiv_symm_map_rho] [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G V : Rep k G g : G x : CoeSort.coe V ⊢ ↑(MonoidAlgebra.of k G) g • ↑(AddEquiv.symm (Representation.asModuleEquiv (ρ V))) x = AddHom.toFun (↑(Representation.ofModule ↑(ModuleCat.of (MonoidAlgebra k G) (Representation.asModule (ρ V)))) g).toAddHom (↑(AddEquiv.trans (AddEquiv.symm (Representation.asModuleEquiv (ρ V))) (AddEquiv.symm (RestrictScalars.addEquiv k (MonoidAlgebra k G) (Representation.asModule (ρ V))))) x) [PROOFSTEP] rfl [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G V : Rep k G src✝ : CoeSort.coe V ≃+ CoeSort.coe ((toModuleMonoidAlgebra ⋙ ofModuleMonoidAlgebra).obj V) := unitIsoAddEquiv r : k x : ↑V.V ⊢ AddHom.toFun { toFun := src✝.toFun, map_add' := (_ : ∀ (x y : CoeSort.coe V), Equiv.toFun src✝.toEquiv (x + y) = Equiv.toFun src✝.toEquiv x + Equiv.toFun src✝.toEquiv y) } (r • x) = ↑(RingHom.id k) r • AddHom.toFun { toFun := src✝.toFun, map_add' := (_ : ∀ (x y : CoeSort.coe V), Equiv.toFun src✝.toEquiv (x + y) = Equiv.toFun src✝.toEquiv x + Equiv.toFun src✝.toEquiv y) } x [PROOFSTEP] dsimp [unitIsoAddEquiv] /- Porting note: rest of broken proof was simp only [Representation.asModuleEquiv_symm_map_smul, RestrictScalars.addEquiv_symm_map_algebraMap_smul] -/ [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G V : Rep k G src✝ : CoeSort.coe V ≃+ CoeSort.coe ((toModuleMonoidAlgebra ⋙ ofModuleMonoidAlgebra).obj V) := unitIsoAddEquiv r : k x : ↑V.V ⊢ ↑↑(AddEquiv.trans (AddEquiv.symm (Representation.asModuleEquiv (ρ V))) (AddEquiv.symm (RestrictScalars.addEquiv k (MonoidAlgebra k G) (Representation.asModule (ρ V))))) (r • x) = r • ↑↑(AddEquiv.trans (AddEquiv.symm (Representation.asModuleEquiv (ρ V))) (AddEquiv.symm (RestrictScalars.addEquiv k (MonoidAlgebra k G) (Representation.asModule (ρ V))))) x [PROOFSTEP] rw [AddEquiv.coe_toEquiv, AddEquiv.trans_apply, Representation.asModuleEquiv_symm_map_smul, RestrictScalars.addEquiv_symm_map_algebraMap_smul] [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G V : Rep k G src✝ : CoeSort.coe V ≃+ CoeSort.coe ((toModuleMonoidAlgebra ⋙ ofModuleMonoidAlgebra).obj V) := unitIsoAddEquiv r : k x : ↑V.V ⊢ r • ↑(AddEquiv.symm (RestrictScalars.addEquiv k (MonoidAlgebra k G) (Representation.asModule (ρ V)))) (↑(AddEquiv.symm (Representation.asModuleEquiv (ρ V))) x) = r • ↑(AddEquiv.trans (AddEquiv.symm (Representation.asModuleEquiv (ρ V))) (AddEquiv.symm (RestrictScalars.addEquiv k (MonoidAlgebra k G) (Representation.asModule (ρ V))))) x [PROOFSTEP] rfl [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G V : Rep k G g : ↑(MonCat.of G) ⊢ ↑V.ρ g ≫ (LinearEquiv.toModuleIso' (let src := unitIsoAddEquiv; { toLinearMap := { toAddHom := { toFun := src.toFun, map_add' := (_ : ∀ (x y : CoeSort.coe V), Equiv.toFun src.toEquiv (x + y) = Equiv.toFun src.toEquiv x + Equiv.toFun src.toEquiv y) }, map_smul' := (_ : ∀ (r : k) (x : ↑V.V), AddHom.toFun { toFun := src.toFun, map_add' := (_ : ∀ (x y : CoeSort.coe V), Equiv.toFun src.toEquiv (x + y) = Equiv.toFun src.toEquiv x + Equiv.toFun src.toEquiv y) } (r • x) = ↑(RingHom.id k) r • AddHom.toFun { toFun := src.toFun, map_add' := (_ : ∀ (x y : CoeSort.coe V), Equiv.toFun src.toEquiv (x + y) = Equiv.toFun src.toEquiv x + Equiv.toFun src.toEquiv y) } x) }, invFun := src.invFun, left_inv := (_ : Function.LeftInverse src.invFun src.toFun), right_inv := (_ : Function.RightInverse src.invFun src.toFun) })).hom = (LinearEquiv.toModuleIso' (let src := unitIsoAddEquiv; { toLinearMap := { toAddHom := { toFun := src.toFun, map_add' := (_ : ∀ (x y : CoeSort.coe V), Equiv.toFun src.toEquiv (x + y) = Equiv.toFun src.toEquiv x + Equiv.toFun src.toEquiv y) }, map_smul' := (_ : ∀ (r : k) (x : ↑V.V), AddHom.toFun { toFun := src.toFun, map_add' := (_ : ∀ (x y : CoeSort.coe V), Equiv.toFun src.toEquiv (x + y) = Equiv.toFun src.toEquiv x + Equiv.toFun src.toEquiv y) } (r • x) = ↑(RingHom.id k) r • AddHom.toFun { toFun := src.toFun, map_add' := (_ : ∀ (x y : CoeSort.coe V), Equiv.toFun src.toEquiv (x + y) = Equiv.toFun src.toEquiv x + Equiv.toFun src.toEquiv y) } x) }, invFun := src.invFun, left_inv := (_ : Function.LeftInverse src.invFun src.toFun), right_inv := (_ : Function.RightInverse src.invFun src.toFun) })).hom ≫ ↑((toModuleMonoidAlgebra ⋙ ofModuleMonoidAlgebra).obj V).ρ g [PROOFSTEP] ext [GOAL] case h k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G V : Rep k G g : ↑(MonCat.of G) x✝ : ↑V.V ⊢ ↑(↑V.ρ g ≫ (LinearEquiv.toModuleIso' (let src := unitIsoAddEquiv; { toLinearMap := { toAddHom := { toFun := src.toFun, map_add' := (_ : ∀ (x y : CoeSort.coe V), Equiv.toFun src.toEquiv (x + y) = Equiv.toFun src.toEquiv x + Equiv.toFun src.toEquiv y) }, map_smul' := (_ : ∀ (r : k) (x : ↑V.V), AddHom.toFun { toFun := src.toFun, map_add' := (_ : ∀ (x y : CoeSort.coe V), Equiv.toFun src.toEquiv (x + y) = Equiv.toFun src.toEquiv x + Equiv.toFun src.toEquiv y) } (r • x) = ↑(RingHom.id k) r • AddHom.toFun { toFun := src.toFun, map_add' := (_ : ∀ (x y : CoeSort.coe V), Equiv.toFun src.toEquiv (x + y) = Equiv.toFun src.toEquiv x + Equiv.toFun src.toEquiv y) } x) }, invFun := src.invFun, left_inv := (_ : Function.LeftInverse src.invFun src.toFun), right_inv := (_ : Function.RightInverse src.invFun src.toFun) })).hom) x✝ = ↑((LinearEquiv.toModuleIso' (let src := unitIsoAddEquiv; { toLinearMap := { toAddHom := { toFun := src.toFun, map_add' := (_ : ∀ (x y : CoeSort.coe V), Equiv.toFun src.toEquiv (x + y) = Equiv.toFun src.toEquiv x + Equiv.toFun src.toEquiv y) }, map_smul' := (_ : ∀ (r : k) (x : ↑V.V), AddHom.toFun { toFun := src.toFun, map_add' := (_ : ∀ (x y : CoeSort.coe V), Equiv.toFun src.toEquiv (x + y) = Equiv.toFun src.toEquiv x + Equiv.toFun src.toEquiv y) } (r • x) = ↑(RingHom.id k) r • AddHom.toFun { toFun := src.toFun, map_add' := (_ : ∀ (x y : CoeSort.coe V), Equiv.toFun src.toEquiv (x + y) = Equiv.toFun src.toEquiv x + Equiv.toFun src.toEquiv y) } x) }, invFun := src.invFun, left_inv := (_ : Function.LeftInverse src.invFun src.toFun), right_inv := (_ : Function.RightInverse src.invFun src.toFun) })).hom ≫ ↑((toModuleMonoidAlgebra ⋙ ofModuleMonoidAlgebra).obj V).ρ g) x✝ [PROOFSTEP] apply unit_iso_comm [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G ⊢ ∀ {X Y : Rep k G} (f : X ⟶ Y), (𝟭 (Rep k G)).map f ≫ ((fun V => unitIso V) Y).hom = ((fun V => unitIso V) X).hom ≫ (toModuleMonoidAlgebra ⋙ ofModuleMonoidAlgebra).map f [PROOFSTEP] aesop_cat [GOAL] k G : Type u inst✝¹ : CommRing k inst✝ : Monoid G ⊢ ∀ {X Y : ModuleCat (MonoidAlgebra k G)} (f : X ⟶ Y), (ofModuleMonoidAlgebra ⋙ toModuleMonoidAlgebra).map f ≫ ((fun M => counitIso M) Y).hom = ((fun M => counitIso M) X).hom ≫ (𝟭 (ModuleCat (MonoidAlgebra k G))).map f [PROOFSTEP] aesop_cat
[GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V h₂ : ¬SimpleGraph.IsUniform G ε U V ⊢ Finset.card (SimpleGraph.nonuniformWitness G ε U V \ Finset.biUnion (star hP G ε hU V) id) ≤ 2 ^ (Finset.card P.parts - 1) * (Fintype.card α / stepBound (Finset.card P.parts)) [PROOFSTEP] have hX : G.nonuniformWitness ε U V ∈ P.nonuniformWitnesses G ε U := nonuniformWitness_mem_nonuniformWitnesses h₂ hV hUV [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V h₂ : ¬SimpleGraph.IsUniform G ε U V hX : SimpleGraph.nonuniformWitness G ε U V ∈ nonuniformWitnesses P G ε U ⊢ Finset.card (SimpleGraph.nonuniformWitness G ε U V \ Finset.biUnion (star hP G ε hU V) id) ≤ 2 ^ (Finset.card P.parts - 1) * (Fintype.card α / stepBound (Finset.card P.parts)) [PROOFSTEP] have q : G.nonuniformWitness ε U V \ (star hP G ε hU V).biUnion id ⊆ ((atomise U <| P.nonuniformWitnesses G ε U).parts.filter fun B => B ⊆ G.nonuniformWitness ε U V ∧ B.Nonempty).biUnion fun B => B \ ((chunk hP G ε hU).parts.filter (· ⊆ B)).biUnion id := by intro x hx rw [← biUnion_filter_atomise hX (G.nonuniformWitness_subset h₂), star, mem_sdiff, mem_biUnion] at hx simp only [not_exists, mem_biUnion, and_imp, exists_prop, mem_filter, not_and, mem_sdiff, id.def, mem_sdiff] at hx ⊢ obtain ⟨⟨B, hB₁, hB₂⟩, hx⟩ := hx exact ⟨B, hB₁, hB₂, fun A hA AB => hx A hA <| AB.trans hB₁.2.1⟩ [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V h₂ : ¬SimpleGraph.IsUniform G ε U V hX : SimpleGraph.nonuniformWitness G ε U V ∈ nonuniformWitnesses P G ε U ⊢ SimpleGraph.nonuniformWitness G ε U V \ Finset.biUnion (star hP G ε hU V) id ⊆ Finset.biUnion (filter (fun B => B ⊆ SimpleGraph.nonuniformWitness G ε U V ∧ Finset.Nonempty B) (atomise U (nonuniformWitnesses P G ε U)).parts) fun B => B \ Finset.biUnion (filter (fun x => x ⊆ B) (chunk hP G ε hU).parts) id [PROOFSTEP] intro x hx [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V h₂ : ¬SimpleGraph.IsUniform G ε U V hX : SimpleGraph.nonuniformWitness G ε U V ∈ nonuniformWitnesses P G ε U x : α hx : x ∈ SimpleGraph.nonuniformWitness G ε U V \ Finset.biUnion (star hP G ε hU V) id ⊢ x ∈ Finset.biUnion (filter (fun B => B ⊆ SimpleGraph.nonuniformWitness G ε U V ∧ Finset.Nonempty B) (atomise U (nonuniformWitnesses P G ε U)).parts) fun B => B \ Finset.biUnion (filter (fun x => x ⊆ B) (chunk hP G ε hU).parts) id [PROOFSTEP] rw [← biUnion_filter_atomise hX (G.nonuniformWitness_subset h₂), star, mem_sdiff, mem_biUnion] at hx [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V h₂ : ¬SimpleGraph.IsUniform G ε U V hX : SimpleGraph.nonuniformWitness G ε U V ∈ nonuniformWitnesses P G ε U x : α hx : (∃ a, a ∈ filter (fun u => u ⊆ SimpleGraph.nonuniformWitness G ε U V ∧ Finset.Nonempty u) (atomise U (nonuniformWitnesses P G ε U)).parts ∧ x ∈ id a) ∧ ¬x ∈ Finset.biUnion (filter (fun x => x ⊆ SimpleGraph.nonuniformWitness G ε U V) (chunk hP G ε hU).parts) id ⊢ x ∈ Finset.biUnion (filter (fun B => B ⊆ SimpleGraph.nonuniformWitness G ε U V ∧ Finset.Nonempty B) (atomise U (nonuniformWitnesses P G ε U)).parts) fun B => B \ Finset.biUnion (filter (fun x => x ⊆ B) (chunk hP G ε hU).parts) id [PROOFSTEP] simp only [not_exists, mem_biUnion, and_imp, exists_prop, mem_filter, not_and, mem_sdiff, id.def, mem_sdiff] at hx ⊢ [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V h₂ : ¬SimpleGraph.IsUniform G ε U V hX : SimpleGraph.nonuniformWitness G ε U V ∈ nonuniformWitnesses P G ε U x : α hx : (∃ a, (a ∈ (atomise U (nonuniformWitnesses P G ε U)).parts ∧ a ⊆ SimpleGraph.nonuniformWitness G ε U V ∧ Finset.Nonempty a) ∧ x ∈ a) ∧ ∀ (x_1 : Finset α), x_1 ∈ (chunk hP G ε hU).parts → x_1 ⊆ SimpleGraph.nonuniformWitness G ε U V → ¬x ∈ x_1 ⊢ ∃ a, (a ∈ (atomise U (nonuniformWitnesses P G ε U)).parts ∧ a ⊆ SimpleGraph.nonuniformWitness G ε U V ∧ Finset.Nonempty a) ∧ x ∈ a ∧ ∀ (x_1 : Finset α), x_1 ∈ (chunk hP G ε hU).parts → x_1 ⊆ a → ¬x ∈ x_1 [PROOFSTEP] obtain ⟨⟨B, hB₁, hB₂⟩, hx⟩ := hx [GOAL] case intro.intro.intro α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V h₂ : ¬SimpleGraph.IsUniform G ε U V hX : SimpleGraph.nonuniformWitness G ε U V ∈ nonuniformWitnesses P G ε U x : α hx : ∀ (x_1 : Finset α), x_1 ∈ (chunk hP G ε hU).parts → x_1 ⊆ SimpleGraph.nonuniformWitness G ε U V → ¬x ∈ x_1 B : Finset α hB₁ : B ∈ (atomise U (nonuniformWitnesses P G ε U)).parts ∧ B ⊆ SimpleGraph.nonuniformWitness G ε U V ∧ Finset.Nonempty B hB₂ : x ∈ B ⊢ ∃ a, (a ∈ (atomise U (nonuniformWitnesses P G ε U)).parts ∧ a ⊆ SimpleGraph.nonuniformWitness G ε U V ∧ Finset.Nonempty a) ∧ x ∈ a ∧ ∀ (x_1 : Finset α), x_1 ∈ (chunk hP G ε hU).parts → x_1 ⊆ a → ¬x ∈ x_1 [PROOFSTEP] exact ⟨B, hB₁, hB₂, fun A hA AB => hx A hA <| AB.trans hB₁.2.1⟩ [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V h₂ : ¬SimpleGraph.IsUniform G ε U V hX : SimpleGraph.nonuniformWitness G ε U V ∈ nonuniformWitnesses P G ε U q : SimpleGraph.nonuniformWitness G ε U V \ Finset.biUnion (star hP G ε hU V) id ⊆ Finset.biUnion (filter (fun B => B ⊆ SimpleGraph.nonuniformWitness G ε U V ∧ Finset.Nonempty B) (atomise U (nonuniformWitnesses P G ε U)).parts) fun B => B \ Finset.biUnion (filter (fun x => x ⊆ B) (chunk hP G ε hU).parts) id ⊢ Finset.card (SimpleGraph.nonuniformWitness G ε U V \ Finset.biUnion (star hP G ε hU V) id) ≤ 2 ^ (Finset.card P.parts - 1) * (Fintype.card α / stepBound (Finset.card P.parts)) [PROOFSTEP] apply (card_le_of_subset q).trans (card_biUnion_le.trans _) [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V h₂ : ¬SimpleGraph.IsUniform G ε U V hX : SimpleGraph.nonuniformWitness G ε U V ∈ nonuniformWitnesses P G ε U q : SimpleGraph.nonuniformWitness G ε U V \ Finset.biUnion (star hP G ε hU V) id ⊆ Finset.biUnion (filter (fun B => B ⊆ SimpleGraph.nonuniformWitness G ε U V ∧ Finset.Nonempty B) (atomise U (nonuniformWitnesses P G ε U)).parts) fun B => B \ Finset.biUnion (filter (fun x => x ⊆ B) (chunk hP G ε hU).parts) id ⊢ ∑ a in filter (fun B => B ⊆ SimpleGraph.nonuniformWitness G ε U V ∧ Finset.Nonempty B) (atomise U (nonuniformWitnesses P G ε U)).parts, Finset.card (a \ Finset.biUnion (filter (fun x => x ⊆ a) (chunk hP G ε hU).parts) id) ≤ 2 ^ (Finset.card P.parts - 1) * (Fintype.card α / stepBound (Finset.card P.parts)) [PROOFSTEP] trans ∑ _i in (atomise U <| P.nonuniformWitnesses G ε U).parts.filter fun B => B ⊆ G.nonuniformWitness ε U V ∧ B.Nonempty, m [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V h₂ : ¬SimpleGraph.IsUniform G ε U V hX : SimpleGraph.nonuniformWitness G ε U V ∈ nonuniformWitnesses P G ε U q : SimpleGraph.nonuniformWitness G ε U V \ Finset.biUnion (star hP G ε hU V) id ⊆ Finset.biUnion (filter (fun B => B ⊆ SimpleGraph.nonuniformWitness G ε U V ∧ Finset.Nonempty B) (atomise U (nonuniformWitnesses P G ε U)).parts) fun B => B \ Finset.biUnion (filter (fun x => x ⊆ B) (chunk hP G ε hU).parts) id ⊢ ∑ a in filter (fun B => B ⊆ SimpleGraph.nonuniformWitness G ε U V ∧ Finset.Nonempty B) (atomise U (nonuniformWitnesses P G ε U)).parts, Finset.card (a \ Finset.biUnion (filter (fun x => x ⊆ a) (chunk hP G ε hU).parts) id) ≤ ∑ _i in filter (fun B => B ⊆ SimpleGraph.nonuniformWitness G ε U V ∧ Finset.Nonempty B) (atomise U (nonuniformWitnesses P G ε U)).parts, Fintype.card α / stepBound (Finset.card P.parts) [PROOFSTEP] suffices ∀ B ∈ (atomise U <| P.nonuniformWitnesses G ε U).parts, (B \ ((chunk hP G ε hU).parts.filter (· ⊆ B)).biUnion id).card ≤ m by exact sum_le_sum fun B hB => this B <| filter_subset _ _ hB [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V h₂ : ¬SimpleGraph.IsUniform G ε U V hX : SimpleGraph.nonuniformWitness G ε U V ∈ nonuniformWitnesses P G ε U q : SimpleGraph.nonuniformWitness G ε U V \ Finset.biUnion (star hP G ε hU V) id ⊆ Finset.biUnion (filter (fun B => B ⊆ SimpleGraph.nonuniformWitness G ε U V ∧ Finset.Nonempty B) (atomise U (nonuniformWitnesses P G ε U)).parts) fun B => B \ Finset.biUnion (filter (fun x => x ⊆ B) (chunk hP G ε hU).parts) id this : ∀ (B : Finset α), B ∈ (atomise U (nonuniformWitnesses P G ε U)).parts → Finset.card (B \ Finset.biUnion (filter (fun x => x ⊆ B) (chunk hP G ε hU).parts) id) ≤ Fintype.card α / stepBound (Finset.card P.parts) ⊢ ∑ a in filter (fun B => B ⊆ SimpleGraph.nonuniformWitness G ε U V ∧ Finset.Nonempty B) (atomise U (nonuniformWitnesses P G ε U)).parts, Finset.card (a \ Finset.biUnion (filter (fun x => x ⊆ a) (chunk hP G ε hU).parts) id) ≤ ∑ _i in filter (fun B => B ⊆ SimpleGraph.nonuniformWitness G ε U V ∧ Finset.Nonempty B) (atomise U (nonuniformWitnesses P G ε U)).parts, Fintype.card α / stepBound (Finset.card P.parts) [PROOFSTEP] exact sum_le_sum fun B hB => this B <| filter_subset _ _ hB [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V h₂ : ¬SimpleGraph.IsUniform G ε U V hX : SimpleGraph.nonuniformWitness G ε U V ∈ nonuniformWitnesses P G ε U q : SimpleGraph.nonuniformWitness G ε U V \ Finset.biUnion (star hP G ε hU V) id ⊆ Finset.biUnion (filter (fun B => B ⊆ SimpleGraph.nonuniformWitness G ε U V ∧ Finset.Nonempty B) (atomise U (nonuniformWitnesses P G ε U)).parts) fun B => B \ Finset.biUnion (filter (fun x => x ⊆ B) (chunk hP G ε hU).parts) id ⊢ ∀ (B : Finset α), B ∈ (atomise U (nonuniformWitnesses P G ε U)).parts → Finset.card (B \ Finset.biUnion (filter (fun x => x ⊆ B) (chunk hP G ε hU).parts) id) ≤ Fintype.card α / stepBound (Finset.card P.parts) [PROOFSTEP] intro B hB [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V h₂ : ¬SimpleGraph.IsUniform G ε U V hX : SimpleGraph.nonuniformWitness G ε U V ∈ nonuniformWitnesses P G ε U q : SimpleGraph.nonuniformWitness G ε U V \ Finset.biUnion (star hP G ε hU V) id ⊆ Finset.biUnion (filter (fun B => B ⊆ SimpleGraph.nonuniformWitness G ε U V ∧ Finset.Nonempty B) (atomise U (nonuniformWitnesses P G ε U)).parts) fun B => B \ Finset.biUnion (filter (fun x => x ⊆ B) (chunk hP G ε hU).parts) id B : Finset α hB : B ∈ (atomise U (nonuniformWitnesses P G ε U)).parts ⊢ Finset.card (B \ Finset.biUnion (filter (fun x => x ⊆ B) (chunk hP G ε hU).parts) id) ≤ Fintype.card α / stepBound (Finset.card P.parts) [PROOFSTEP] unfold chunk [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V h₂ : ¬SimpleGraph.IsUniform G ε U V hX : SimpleGraph.nonuniformWitness G ε U V ∈ nonuniformWitnesses P G ε U q : SimpleGraph.nonuniformWitness G ε U V \ Finset.biUnion (star hP G ε hU V) id ⊆ Finset.biUnion (filter (fun B => B ⊆ SimpleGraph.nonuniformWitness G ε U V ∧ Finset.Nonempty B) (atomise U (nonuniformWitnesses P G ε U)).parts) fun B => B \ Finset.biUnion (filter (fun x => x ⊆ B) (chunk hP G ε hU).parts) id B : Finset α hB : B ∈ (atomise U (nonuniformWitnesses P G ε U)).parts ⊢ Finset.card (B \ Finset.biUnion (filter (fun x => x ⊆ B) (if hUcard : Finset.card U = Fintype.card α / stepBound (Finset.card P.parts) * 4 ^ Finset.card P.parts + (Fintype.card α / Finset.card P.parts - Fintype.card α / stepBound (Finset.card P.parts) * 4 ^ Finset.card P.parts) then equitabilise (_ : (4 ^ Finset.card P.parts - (Fintype.card α / Finset.card P.parts - Fintype.card α / stepBound (Finset.card P.parts) * 4 ^ Finset.card P.parts)) * (Fintype.card α / stepBound (Finset.card P.parts)) + (Fintype.card α / Finset.card P.parts - Fintype.card α / stepBound (Finset.card P.parts) * 4 ^ Finset.card P.parts) * (Fintype.card α / stepBound (Finset.card P.parts) + 1) = Finset.card U) else equitabilise (_ : (4 ^ Finset.card P.parts - (Fintype.card α / Finset.card P.parts - Fintype.card α / stepBound (Finset.card P.parts) * 4 ^ Finset.card P.parts + 1)) * (Fintype.card α / stepBound (Finset.card P.parts)) + (Fintype.card α / Finset.card P.parts - Fintype.card α / stepBound (Finset.card P.parts) * 4 ^ Finset.card P.parts + 1) * (Fintype.card α / stepBound (Finset.card P.parts) + 1) = Finset.card U)).parts) id) ≤ Fintype.card α / stepBound (Finset.card P.parts) [PROOFSTEP] split_ifs with h₁ [GOAL] case pos α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V h₂ : ¬SimpleGraph.IsUniform G ε U V hX : SimpleGraph.nonuniformWitness G ε U V ∈ nonuniformWitnesses P G ε U q : SimpleGraph.nonuniformWitness G ε U V \ Finset.biUnion (star hP G ε hU V) id ⊆ Finset.biUnion (filter (fun B => B ⊆ SimpleGraph.nonuniformWitness G ε U V ∧ Finset.Nonempty B) (atomise U (nonuniformWitnesses P G ε U)).parts) fun B => B \ Finset.biUnion (filter (fun x => x ⊆ B) (chunk hP G ε hU).parts) id B : Finset α hB : B ∈ (atomise U (nonuniformWitnesses P G ε U)).parts h₁ : Finset.card U = Fintype.card α / stepBound (Finset.card P.parts) * 4 ^ Finset.card P.parts + (Fintype.card α / Finset.card P.parts - Fintype.card α / stepBound (Finset.card P.parts) * 4 ^ Finset.card P.parts) ⊢ Finset.card (B \ Finset.biUnion (filter (fun x => x ⊆ B) (equitabilise (_ : (4 ^ Finset.card P.parts - (Fintype.card α / Finset.card P.parts - Fintype.card α / stepBound (Finset.card P.parts) * 4 ^ Finset.card P.parts)) * (Fintype.card α / stepBound (Finset.card P.parts)) + (Fintype.card α / Finset.card P.parts - Fintype.card α / stepBound (Finset.card P.parts) * 4 ^ Finset.card P.parts) * (Fintype.card α / stepBound (Finset.card P.parts) + 1) = Finset.card U)).parts) id) ≤ Fintype.card α / stepBound (Finset.card P.parts) [PROOFSTEP] convert card_parts_equitabilise_subset_le _ (card_aux₁ h₁) hB [GOAL] case neg α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V h₂ : ¬SimpleGraph.IsUniform G ε U V hX : SimpleGraph.nonuniformWitness G ε U V ∈ nonuniformWitnesses P G ε U q : SimpleGraph.nonuniformWitness G ε U V \ Finset.biUnion (star hP G ε hU V) id ⊆ Finset.biUnion (filter (fun B => B ⊆ SimpleGraph.nonuniformWitness G ε U V ∧ Finset.Nonempty B) (atomise U (nonuniformWitnesses P G ε U)).parts) fun B => B \ Finset.biUnion (filter (fun x => x ⊆ B) (chunk hP G ε hU).parts) id B : Finset α hB : B ∈ (atomise U (nonuniformWitnesses P G ε U)).parts h₁ : ¬Finset.card U = Fintype.card α / stepBound (Finset.card P.parts) * 4 ^ Finset.card P.parts + (Fintype.card α / Finset.card P.parts - Fintype.card α / stepBound (Finset.card P.parts) * 4 ^ Finset.card P.parts) ⊢ Finset.card (B \ Finset.biUnion (filter (fun x => x ⊆ B) (equitabilise (_ : (4 ^ Finset.card P.parts - (Fintype.card α / Finset.card P.parts - Fintype.card α / stepBound (Finset.card P.parts) * 4 ^ Finset.card P.parts + 1)) * (Fintype.card α / stepBound (Finset.card P.parts)) + (Fintype.card α / Finset.card P.parts - Fintype.card α / stepBound (Finset.card P.parts) * 4 ^ Finset.card P.parts + 1) * (Fintype.card α / stepBound (Finset.card P.parts) + 1) = Finset.card U)).parts) id) ≤ Fintype.card α / stepBound (Finset.card P.parts) [PROOFSTEP] convert card_parts_equitabilise_subset_le _ (card_aux₂ hP hU h₁) hB [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V h₂ : ¬SimpleGraph.IsUniform G ε U V hX : SimpleGraph.nonuniformWitness G ε U V ∈ nonuniformWitnesses P G ε U q : SimpleGraph.nonuniformWitness G ε U V \ Finset.biUnion (star hP G ε hU V) id ⊆ Finset.biUnion (filter (fun B => B ⊆ SimpleGraph.nonuniformWitness G ε U V ∧ Finset.Nonempty B) (atomise U (nonuniformWitnesses P G ε U)).parts) fun B => B \ Finset.biUnion (filter (fun x => x ⊆ B) (chunk hP G ε hU).parts) id ⊢ ∑ _i in filter (fun B => B ⊆ SimpleGraph.nonuniformWitness G ε U V ∧ Finset.Nonempty B) (atomise U (nonuniformWitnesses P G ε U)).parts, Fintype.card α / stepBound (Finset.card P.parts) ≤ 2 ^ (Finset.card P.parts - 1) * (Fintype.card α / stepBound (Finset.card P.parts)) [PROOFSTEP] rw [sum_const] [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V h₂ : ¬SimpleGraph.IsUniform G ε U V hX : SimpleGraph.nonuniformWitness G ε U V ∈ nonuniformWitnesses P G ε U q : SimpleGraph.nonuniformWitness G ε U V \ Finset.biUnion (star hP G ε hU V) id ⊆ Finset.biUnion (filter (fun B => B ⊆ SimpleGraph.nonuniformWitness G ε U V ∧ Finset.Nonempty B) (atomise U (nonuniformWitnesses P G ε U)).parts) fun B => B \ Finset.biUnion (filter (fun x => x ⊆ B) (chunk hP G ε hU).parts) id ⊢ Finset.card (filter (fun B => B ⊆ SimpleGraph.nonuniformWitness G ε U V ∧ Finset.Nonempty B) (atomise U (nonuniformWitnesses P G ε U)).parts) • (Fintype.card α / stepBound (Finset.card P.parts)) ≤ 2 ^ (Finset.card P.parts - 1) * (Fintype.card α / stepBound (Finset.card P.parts)) [PROOFSTEP] refine' mul_le_mul_right' _ _ [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V h₂ : ¬SimpleGraph.IsUniform G ε U V hX : SimpleGraph.nonuniformWitness G ε U V ∈ nonuniformWitnesses P G ε U q : SimpleGraph.nonuniformWitness G ε U V \ Finset.biUnion (star hP G ε hU V) id ⊆ Finset.biUnion (filter (fun B => B ⊆ SimpleGraph.nonuniformWitness G ε U V ∧ Finset.Nonempty B) (atomise U (nonuniformWitnesses P G ε U)).parts) fun B => B \ Finset.biUnion (filter (fun x => x ⊆ B) (chunk hP G ε hU).parts) id ⊢ Finset.card (filter (fun B => B ⊆ SimpleGraph.nonuniformWitness G ε U V ∧ Finset.Nonempty B) (atomise U (nonuniformWitnesses P G ε U)).parts) ≤ 2 ^ (Finset.card P.parts - 1) [PROOFSTEP] have t := card_filter_atomise_le_two_pow (s := U) hX [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V h₂ : ¬SimpleGraph.IsUniform G ε U V hX : SimpleGraph.nonuniformWitness G ε U V ∈ nonuniformWitnesses P G ε U q : SimpleGraph.nonuniformWitness G ε U V \ Finset.biUnion (star hP G ε hU V) id ⊆ Finset.biUnion (filter (fun B => B ⊆ SimpleGraph.nonuniformWitness G ε U V ∧ Finset.Nonempty B) (atomise U (nonuniformWitnesses P G ε U)).parts) fun B => B \ Finset.biUnion (filter (fun x => x ⊆ B) (chunk hP G ε hU).parts) id t : Finset.card (filter (fun u => u ⊆ SimpleGraph.nonuniformWitness G ε U V ∧ Finset.Nonempty u) (atomise U (nonuniformWitnesses P G ε U)).parts) ≤ 2 ^ (Finset.card (nonuniformWitnesses P G ε U) - 1) ⊢ Finset.card (filter (fun B => B ⊆ SimpleGraph.nonuniformWitness G ε U V ∧ Finset.Nonempty B) (atomise U (nonuniformWitnesses P G ε U)).parts) ≤ 2 ^ (Finset.card P.parts - 1) [PROOFSTEP] refine' t.trans (pow_le_pow (by norm_num) <| tsub_le_tsub_right _ _) [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V h₂ : ¬SimpleGraph.IsUniform G ε U V hX : SimpleGraph.nonuniformWitness G ε U V ∈ nonuniformWitnesses P G ε U q : SimpleGraph.nonuniformWitness G ε U V \ Finset.biUnion (star hP G ε hU V) id ⊆ Finset.biUnion (filter (fun B => B ⊆ SimpleGraph.nonuniformWitness G ε U V ∧ Finset.Nonempty B) (atomise U (nonuniformWitnesses P G ε U)).parts) fun B => B \ Finset.biUnion (filter (fun x => x ⊆ B) (chunk hP G ε hU).parts) id t : Finset.card (filter (fun u => u ⊆ SimpleGraph.nonuniformWitness G ε U V ∧ Finset.Nonempty u) (atomise U (nonuniformWitnesses P G ε U)).parts) ≤ 2 ^ (Finset.card (nonuniformWitnesses P G ε U) - 1) ⊢ 1 ≤ 2 [PROOFSTEP] norm_num [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V h₂ : ¬SimpleGraph.IsUniform G ε U V hX : SimpleGraph.nonuniformWitness G ε U V ∈ nonuniformWitnesses P G ε U q : SimpleGraph.nonuniformWitness G ε U V \ Finset.biUnion (star hP G ε hU V) id ⊆ Finset.biUnion (filter (fun B => B ⊆ SimpleGraph.nonuniformWitness G ε U V ∧ Finset.Nonempty B) (atomise U (nonuniformWitnesses P G ε U)).parts) fun B => B \ Finset.biUnion (filter (fun x => x ⊆ B) (chunk hP G ε hU).parts) id t : Finset.card (filter (fun u => u ⊆ SimpleGraph.nonuniformWitness G ε U V ∧ Finset.Nonempty u) (atomise U (nonuniformWitnesses P G ε U)).parts) ≤ 2 ^ (Finset.card (nonuniformWitnesses P G ε U) - 1) ⊢ Finset.card (nonuniformWitnesses P G ε U) ≤ Finset.card P.parts [PROOFSTEP] exact card_image_le.trans (card_le_of_subset <| filter_subset _ _) [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 ⊢ (1 - ε / 10) * ↑(Finset.card (SimpleGraph.nonuniformWitness G ε U V)) ≤ ↑(Finset.card (Finset.biUnion (star hP G ε hU V) id)) [PROOFSTEP] have hP₁ : 0 < P.parts.card := Finset.card_pos.2 ⟨_, hU⟩ [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hP₁ : 0 < Finset.card P.parts ⊢ (1 - ε / 10) * ↑(Finset.card (SimpleGraph.nonuniformWitness G ε U V)) ≤ ↑(Finset.card (Finset.biUnion (star hP G ε hU V) id)) [PROOFSTEP] have : (↑2 ^ P.parts.card : ℝ) * m / (U.card * ε) ≤ ε / 10 := by rw [← div_div, div_le_iff'] swap sz_positivity refine' le_of_mul_le_mul_left _ (pow_pos zero_lt_two P.parts.card) calc ↑2 ^ P.parts.card * ((↑2 ^ P.parts.card * m : ℝ) / U.card) = ((2 : ℝ) * 2) ^ P.parts.card * m / U.card := by rw [mul_pow, ← mul_div_assoc, mul_assoc] _ = ↑4 ^ P.parts.card * m / U.card := by norm_num _ ≤ 1 := (div_le_one_of_le (pow_mul_m_le_card_part hP hU) (cast_nonneg _)) _ ≤ ↑2 ^ P.parts.card * ε ^ 2 / 10 := by refine' (one_le_sq_iff <| by positivity).1 _ rw [div_pow, mul_pow, pow_right_comm, ← pow_mul ε, one_le_div (sq_pos_of_ne_zero (10 : ℝ) <| by norm_num)] calc (↑10 ^ 2) = 100 := by norm_num _ ≤ ↑4 ^ P.parts.card * ε ^ 5 := hPε _ ≤ ↑4 ^ P.parts.card * ε ^ 4 := (mul_le_mul_of_nonneg_left (pow_le_pow_of_le_one (by sz_positivity) hε₁ <| le_succ _) (by positivity)) _ = (↑2 ^ 2) ^ P.parts.card * ε ^ (2 * 2) := by norm_num _ = ↑2 ^ P.parts.card * (ε * (ε / 10)) := by rw [mul_div_assoc, sq, mul_div_assoc] [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hP₁ : 0 < Finset.card P.parts ⊢ 2 ^ Finset.card P.parts * ↑(Fintype.card α / stepBound (Finset.card P.parts)) / (↑(Finset.card U) * ε) ≤ ε / 10 [PROOFSTEP] rw [← div_div, div_le_iff'] [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hP₁ : 0 < Finset.card P.parts ⊢ 2 ^ Finset.card P.parts * ↑(Fintype.card α / stepBound (Finset.card P.parts)) / ↑(Finset.card U) ≤ ε * (ε / 10) α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hP₁ : 0 < Finset.card P.parts ⊢ 0 < ε [PROOFSTEP] swap [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hP₁ : 0 < Finset.card P.parts ⊢ 0 < ε α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hP₁ : 0 < Finset.card P.parts ⊢ 2 ^ Finset.card P.parts * ↑(Fintype.card α / stepBound (Finset.card P.parts)) / ↑(Finset.card U) ≤ ε * (ε / 10) [PROOFSTEP] sz_positivity [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hP₁ : 0 < Finset.card P.parts ⊢ 2 ^ Finset.card P.parts * ↑(Fintype.card α / stepBound (Finset.card P.parts)) / ↑(Finset.card U) ≤ ε * (ε / 10) [PROOFSTEP] refine' le_of_mul_le_mul_left _ (pow_pos zero_lt_two P.parts.card) [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hP₁ : 0 < Finset.card P.parts ⊢ 2 ^ Finset.card P.parts * (2 ^ Finset.card P.parts * ↑(Fintype.card α / stepBound (Finset.card P.parts)) / ↑(Finset.card U)) ≤ 2 ^ Finset.card P.parts * (ε * (ε / 10)) [PROOFSTEP] calc ↑2 ^ P.parts.card * ((↑2 ^ P.parts.card * m : ℝ) / U.card) = ((2 : ℝ) * 2) ^ P.parts.card * m / U.card := by rw [mul_pow, ← mul_div_assoc, mul_assoc] _ = ↑4 ^ P.parts.card * m / U.card := by norm_num _ ≤ 1 := (div_le_one_of_le (pow_mul_m_le_card_part hP hU) (cast_nonneg _)) _ ≤ ↑2 ^ P.parts.card * ε ^ 2 / 10 := by refine' (one_le_sq_iff <| by positivity).1 _ rw [div_pow, mul_pow, pow_right_comm, ← pow_mul ε, one_le_div (sq_pos_of_ne_zero (10 : ℝ) <| by norm_num)] calc (↑10 ^ 2) = 100 := by norm_num _ ≤ ↑4 ^ P.parts.card * ε ^ 5 := hPε _ ≤ ↑4 ^ P.parts.card * ε ^ 4 := (mul_le_mul_of_nonneg_left (pow_le_pow_of_le_one (by sz_positivity) hε₁ <| le_succ _) (by positivity)) _ = (↑2 ^ 2) ^ P.parts.card * ε ^ (2 * 2) := by norm_num _ = ↑2 ^ P.parts.card * (ε * (ε / 10)) := by rw [mul_div_assoc, sq, mul_div_assoc] [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hP₁ : 0 < Finset.card P.parts ⊢ 2 ^ Finset.card P.parts * (2 ^ Finset.card P.parts * ↑(Fintype.card α / stepBound (Finset.card P.parts)) / ↑(Finset.card U)) = (2 * 2) ^ Finset.card P.parts * ↑(Fintype.card α / stepBound (Finset.card P.parts)) / ↑(Finset.card U) [PROOFSTEP] rw [mul_pow, ← mul_div_assoc, mul_assoc] [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hP₁ : 0 < Finset.card P.parts ⊢ (2 * 2) ^ Finset.card P.parts * ↑(Fintype.card α / stepBound (Finset.card P.parts)) / ↑(Finset.card U) = 4 ^ Finset.card P.parts * ↑(Fintype.card α / stepBound (Finset.card P.parts)) / ↑(Finset.card U) [PROOFSTEP] norm_num [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hP₁ : 0 < Finset.card P.parts ⊢ 1 ≤ 2 ^ Finset.card P.parts * ε ^ 2 / 10 [PROOFSTEP] refine' (one_le_sq_iff <| by positivity).1 _ [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hP₁ : 0 < Finset.card P.parts ⊢ 0 ≤ 2 ^ Finset.card P.parts * ε ^ 2 / 10 [PROOFSTEP] positivity [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hP₁ : 0 < Finset.card P.parts ⊢ 1 ≤ (2 ^ Finset.card P.parts * ε ^ 2 / 10) ^ 2 [PROOFSTEP] rw [div_pow, mul_pow, pow_right_comm, ← pow_mul ε, one_le_div (sq_pos_of_ne_zero (10 : ℝ) <| by norm_num)] [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hP₁ : 0 < Finset.card P.parts ⊢ 10 ≠ 0 [PROOFSTEP] norm_num [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hP₁ : 0 < Finset.card P.parts ⊢ 10 ^ 2 ≤ (2 ^ 2) ^ Finset.card P.parts * ε ^ (2 * 2) [PROOFSTEP] calc (↑10 ^ 2) = 100 := by norm_num _ ≤ ↑4 ^ P.parts.card * ε ^ 5 := hPε _ ≤ ↑4 ^ P.parts.card * ε ^ 4 := (mul_le_mul_of_nonneg_left (pow_le_pow_of_le_one (by sz_positivity) hε₁ <| le_succ _) (by positivity)) _ = (↑2 ^ 2) ^ P.parts.card * ε ^ (2 * 2) := by norm_num [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hP₁ : 0 < Finset.card P.parts ⊢ 10 ^ 2 = 100 [PROOFSTEP] norm_num [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hP₁ : 0 < Finset.card P.parts ⊢ 0 ≤ ε [PROOFSTEP] sz_positivity [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hP₁ : 0 < Finset.card P.parts ⊢ 0 ≤ 4 ^ Finset.card P.parts [PROOFSTEP] positivity [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hP₁ : 0 < Finset.card P.parts ⊢ 4 ^ Finset.card P.parts * ε ^ 4 = (2 ^ 2) ^ Finset.card P.parts * ε ^ (2 * 2) [PROOFSTEP] norm_num [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hP₁ : 0 < Finset.card P.parts ⊢ 2 ^ Finset.card P.parts * ε ^ 2 / 10 = 2 ^ Finset.card P.parts * (ε * (ε / 10)) [PROOFSTEP] rw [mul_div_assoc, sq, mul_div_assoc] [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hP₁ : 0 < Finset.card P.parts this : 2 ^ Finset.card P.parts * ↑(Fintype.card α / stepBound (Finset.card P.parts)) / (↑(Finset.card U) * ε) ≤ ε / 10 ⊢ (1 - ε / 10) * ↑(Finset.card (SimpleGraph.nonuniformWitness G ε U V)) ≤ ↑(Finset.card (Finset.biUnion (star hP G ε hU V) id)) [PROOFSTEP] calc (↑1 - ε / 10) * (G.nonuniformWitness ε U V).card ≤ (↑1 - ↑2 ^ P.parts.card * m / (U.card * ε)) * (G.nonuniformWitness ε U V).card := mul_le_mul_of_nonneg_right (sub_le_sub_left this _) (cast_nonneg _) _ = (G.nonuniformWitness ε U V).card - ↑2 ^ P.parts.card * m / (U.card * ε) * (G.nonuniformWitness ε U V).card := by rw [sub_mul, one_mul] _ ≤ (G.nonuniformWitness ε U V).card - ↑2 ^ (P.parts.card - 1) * m := by refine' sub_le_sub_left _ _ have : (2 : ℝ) ^ P.parts.card = ↑2 ^ (P.parts.card - 1) * 2 := by rw [← _root_.pow_succ', tsub_add_cancel_of_le (succ_le_iff.2 hP₁)] rw [← mul_div_right_comm, this, mul_right_comm _ (2 : ℝ), mul_assoc, le_div_iff] refine' mul_le_mul_of_nonneg_left _ (by positivity) exact (G.le_card_nonuniformWitness hunif).trans (le_mul_of_one_le_left (cast_nonneg _) one_le_two) have := Finset.card_pos.mpr (P.nonempty_of_mem_parts hU) sz_positivity _ ≤ ((star hP G ε hU V).biUnion id).card := by rw [sub_le_comm, ← cast_sub (card_le_of_subset <| biUnion_star_subset_nonuniformWitness hP G ε hU V), ← card_sdiff (biUnion_star_subset_nonuniformWitness hP G ε hU V)] exact_mod_cast card_nonuniformWitness_sdiff_biUnion_star hV hUV hunif [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hP₁ : 0 < Finset.card P.parts this : 2 ^ Finset.card P.parts * ↑(Fintype.card α / stepBound (Finset.card P.parts)) / (↑(Finset.card U) * ε) ≤ ε / 10 ⊢ (1 - 2 ^ Finset.card P.parts * ↑(Fintype.card α / stepBound (Finset.card P.parts)) / (↑(Finset.card U) * ε)) * ↑(Finset.card (SimpleGraph.nonuniformWitness G ε U V)) = ↑(Finset.card (SimpleGraph.nonuniformWitness G ε U V)) - 2 ^ Finset.card P.parts * ↑(Fintype.card α / stepBound (Finset.card P.parts)) / (↑(Finset.card U) * ε) * ↑(Finset.card (SimpleGraph.nonuniformWitness G ε U V)) [PROOFSTEP] rw [sub_mul, one_mul] [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hP₁ : 0 < Finset.card P.parts this : 2 ^ Finset.card P.parts * ↑(Fintype.card α / stepBound (Finset.card P.parts)) / (↑(Finset.card U) * ε) ≤ ε / 10 ⊢ ↑(Finset.card (SimpleGraph.nonuniformWitness G ε U V)) - 2 ^ Finset.card P.parts * ↑(Fintype.card α / stepBound (Finset.card P.parts)) / (↑(Finset.card U) * ε) * ↑(Finset.card (SimpleGraph.nonuniformWitness G ε U V)) ≤ ↑(Finset.card (SimpleGraph.nonuniformWitness G ε U V)) - 2 ^ (Finset.card P.parts - 1) * ↑(Fintype.card α / stepBound (Finset.card P.parts)) [PROOFSTEP] refine' sub_le_sub_left _ _ [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hP₁ : 0 < Finset.card P.parts this : 2 ^ Finset.card P.parts * ↑(Fintype.card α / stepBound (Finset.card P.parts)) / (↑(Finset.card U) * ε) ≤ ε / 10 ⊢ 2 ^ (Finset.card P.parts - 1) * ↑(Fintype.card α / stepBound (Finset.card P.parts)) ≤ 2 ^ Finset.card P.parts * ↑(Fintype.card α / stepBound (Finset.card P.parts)) / (↑(Finset.card U) * ε) * ↑(Finset.card (SimpleGraph.nonuniformWitness G ε U V)) [PROOFSTEP] have : (2 : ℝ) ^ P.parts.card = ↑2 ^ (P.parts.card - 1) * 2 := by rw [← _root_.pow_succ', tsub_add_cancel_of_le (succ_le_iff.2 hP₁)] [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hP₁ : 0 < Finset.card P.parts this : 2 ^ Finset.card P.parts * ↑(Fintype.card α / stepBound (Finset.card P.parts)) / (↑(Finset.card U) * ε) ≤ ε / 10 ⊢ 2 ^ Finset.card P.parts = 2 ^ (Finset.card P.parts - 1) * 2 [PROOFSTEP] rw [← _root_.pow_succ', tsub_add_cancel_of_le (succ_le_iff.2 hP₁)] [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hP₁ : 0 < Finset.card P.parts this✝ : 2 ^ Finset.card P.parts * ↑(Fintype.card α / stepBound (Finset.card P.parts)) / (↑(Finset.card U) * ε) ≤ ε / 10 this : 2 ^ Finset.card P.parts = 2 ^ (Finset.card P.parts - 1) * 2 ⊢ 2 ^ (Finset.card P.parts - 1) * ↑(Fintype.card α / stepBound (Finset.card P.parts)) ≤ 2 ^ Finset.card P.parts * ↑(Fintype.card α / stepBound (Finset.card P.parts)) / (↑(Finset.card U) * ε) * ↑(Finset.card (SimpleGraph.nonuniformWitness G ε U V)) [PROOFSTEP] rw [← mul_div_right_comm, this, mul_right_comm _ (2 : ℝ), mul_assoc, le_div_iff] [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hP₁ : 0 < Finset.card P.parts this✝ : 2 ^ Finset.card P.parts * ↑(Fintype.card α / stepBound (Finset.card P.parts)) / (↑(Finset.card U) * ε) ≤ ε / 10 this : 2 ^ Finset.card P.parts = 2 ^ (Finset.card P.parts - 1) * 2 ⊢ 2 ^ (Finset.card P.parts - 1) * ↑(Fintype.card α / stepBound (Finset.card P.parts)) * (↑(Finset.card U) * ε) ≤ 2 ^ (Finset.card P.parts - 1) * ↑(Fintype.card α / stepBound (Finset.card P.parts)) * (2 * ↑(Finset.card (SimpleGraph.nonuniformWitness G ε U V))) α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hP₁ : 0 < Finset.card P.parts this✝ : 2 ^ Finset.card P.parts * ↑(Fintype.card α / stepBound (Finset.card P.parts)) / (↑(Finset.card U) * ε) ≤ ε / 10 this : 2 ^ Finset.card P.parts = 2 ^ (Finset.card P.parts - 1) * 2 ⊢ 0 < ↑(Finset.card U) * ε [PROOFSTEP] refine' mul_le_mul_of_nonneg_left _ (by positivity) [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hP₁ : 0 < Finset.card P.parts this✝ : 2 ^ Finset.card P.parts * ↑(Fintype.card α / stepBound (Finset.card P.parts)) / (↑(Finset.card U) * ε) ≤ ε / 10 this : 2 ^ Finset.card P.parts = 2 ^ (Finset.card P.parts - 1) * 2 ⊢ 0 ≤ 2 ^ (Finset.card P.parts - 1) * ↑(Fintype.card α / stepBound (Finset.card P.parts)) [PROOFSTEP] positivity [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hP₁ : 0 < Finset.card P.parts this✝ : 2 ^ Finset.card P.parts * ↑(Fintype.card α / stepBound (Finset.card P.parts)) / (↑(Finset.card U) * ε) ≤ ε / 10 this : 2 ^ Finset.card P.parts = 2 ^ (Finset.card P.parts - 1) * 2 ⊢ ↑(Finset.card U) * ε ≤ 2 * ↑(Finset.card (SimpleGraph.nonuniformWitness G ε U V)) α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hP₁ : 0 < Finset.card P.parts this✝ : 2 ^ Finset.card P.parts * ↑(Fintype.card α / stepBound (Finset.card P.parts)) / (↑(Finset.card U) * ε) ≤ ε / 10 this : 2 ^ Finset.card P.parts = 2 ^ (Finset.card P.parts - 1) * 2 ⊢ 0 < ↑(Finset.card U) * ε [PROOFSTEP] exact (G.le_card_nonuniformWitness hunif).trans (le_mul_of_one_le_left (cast_nonneg _) one_le_two) [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hP₁ : 0 < Finset.card P.parts this✝ : 2 ^ Finset.card P.parts * ↑(Fintype.card α / stepBound (Finset.card P.parts)) / (↑(Finset.card U) * ε) ≤ ε / 10 this : 2 ^ Finset.card P.parts = 2 ^ (Finset.card P.parts - 1) * 2 ⊢ 0 < ↑(Finset.card U) * ε [PROOFSTEP] have := Finset.card_pos.mpr (P.nonempty_of_mem_parts hU) [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hP₁ : 0 < Finset.card P.parts this✝¹ : 2 ^ Finset.card P.parts * ↑(Fintype.card α / stepBound (Finset.card P.parts)) / (↑(Finset.card U) * ε) ≤ ε / 10 this✝ : 2 ^ Finset.card P.parts = 2 ^ (Finset.card P.parts - 1) * 2 this : 0 < Finset.card U ⊢ 0 < ↑(Finset.card U) * ε [PROOFSTEP] sz_positivity [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hP₁ : 0 < Finset.card P.parts this : 2 ^ Finset.card P.parts * ↑(Fintype.card α / stepBound (Finset.card P.parts)) / (↑(Finset.card U) * ε) ≤ ε / 10 ⊢ ↑(Finset.card (SimpleGraph.nonuniformWitness G ε U V)) - 2 ^ (Finset.card P.parts - 1) * ↑(Fintype.card α / stepBound (Finset.card P.parts)) ≤ ↑(Finset.card (Finset.biUnion (star hP G ε hU V) id)) [PROOFSTEP] rw [sub_le_comm, ← cast_sub (card_le_of_subset <| biUnion_star_subset_nonuniformWitness hP G ε hU V), ← card_sdiff (biUnion_star_subset_nonuniformWitness hP G ε hU V)] [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hP₁ : 0 < Finset.card P.parts this : 2 ^ Finset.card P.parts * ↑(Fintype.card α / stepBound (Finset.card P.parts)) / (↑(Finset.card U) * ε) ≤ ε / 10 ⊢ ↑(Finset.card (SimpleGraph.nonuniformWitness G ε U V \ Finset.biUnion (star hP G ε hU V) id)) ≤ 2 ^ (Finset.card P.parts - 1) * ↑(Fintype.card α / stepBound (Finset.card P.parts)) [PROOFSTEP] exact_mod_cast card_nonuniformWitness_sdiff_biUnion_star hV hUV hunif [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hm : Fintype.card α / stepBound (Finset.card P.parts) ≠ 0 ⊢ Finset.card (chunk hP G ε hU).parts = 4 ^ Finset.card P.parts [PROOFSTEP] unfold chunk [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hm : Fintype.card α / stepBound (Finset.card P.parts) ≠ 0 ⊢ Finset.card (if hUcard : Finset.card U = Fintype.card α / stepBound (Finset.card P.parts) * 4 ^ Finset.card P.parts + (Fintype.card α / Finset.card P.parts - Fintype.card α / stepBound (Finset.card P.parts) * 4 ^ Finset.card P.parts) then equitabilise (_ : (4 ^ Finset.card P.parts - (Fintype.card α / Finset.card P.parts - Fintype.card α / stepBound (Finset.card P.parts) * 4 ^ Finset.card P.parts)) * (Fintype.card α / stepBound (Finset.card P.parts)) + (Fintype.card α / Finset.card P.parts - Fintype.card α / stepBound (Finset.card P.parts) * 4 ^ Finset.card P.parts) * (Fintype.card α / stepBound (Finset.card P.parts) + 1) = Finset.card U) else equitabilise (_ : (4 ^ Finset.card P.parts - (Fintype.card α / Finset.card P.parts - Fintype.card α / stepBound (Finset.card P.parts) * 4 ^ Finset.card P.parts + 1)) * (Fintype.card α / stepBound (Finset.card P.parts)) + (Fintype.card α / Finset.card P.parts - Fintype.card α / stepBound (Finset.card P.parts) * 4 ^ Finset.card P.parts + 1) * (Fintype.card α / stepBound (Finset.card P.parts) + 1) = Finset.card U)).parts = 4 ^ Finset.card P.parts [PROOFSTEP] split_ifs [GOAL] case pos α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hm : Fintype.card α / stepBound (Finset.card P.parts) ≠ 0 h✝ : Finset.card U = Fintype.card α / stepBound (Finset.card P.parts) * 4 ^ Finset.card P.parts + (Fintype.card α / Finset.card P.parts - Fintype.card α / stepBound (Finset.card P.parts) * 4 ^ Finset.card P.parts) ⊢ Finset.card (equitabilise (_ : (4 ^ Finset.card P.parts - (Fintype.card α / Finset.card P.parts - Fintype.card α / stepBound (Finset.card P.parts) * 4 ^ Finset.card P.parts)) * (Fintype.card α / stepBound (Finset.card P.parts)) + (Fintype.card α / Finset.card P.parts - Fintype.card α / stepBound (Finset.card P.parts) * 4 ^ Finset.card P.parts) * (Fintype.card α / stepBound (Finset.card P.parts) + 1) = Finset.card U)).parts = 4 ^ Finset.card P.parts [PROOFSTEP] rw [card_parts_equitabilise _ _ hm, tsub_add_cancel_of_le] [GOAL] case pos α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hm : Fintype.card α / stepBound (Finset.card P.parts) ≠ 0 h✝ : Finset.card U = Fintype.card α / stepBound (Finset.card P.parts) * 4 ^ Finset.card P.parts + (Fintype.card α / Finset.card P.parts - Fintype.card α / stepBound (Finset.card P.parts) * 4 ^ Finset.card P.parts) ⊢ Fintype.card α / Finset.card P.parts - Fintype.card α / stepBound (Finset.card P.parts) * 4 ^ Finset.card P.parts ≤ 4 ^ Finset.card P.parts [PROOFSTEP] exact le_of_lt a_add_one_le_four_pow_parts_card [GOAL] case neg α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hm : Fintype.card α / stepBound (Finset.card P.parts) ≠ 0 h✝ : ¬Finset.card U = Fintype.card α / stepBound (Finset.card P.parts) * 4 ^ Finset.card P.parts + (Fintype.card α / Finset.card P.parts - Fintype.card α / stepBound (Finset.card P.parts) * 4 ^ Finset.card P.parts) ⊢ Finset.card (equitabilise (_ : (4 ^ Finset.card P.parts - (Fintype.card α / Finset.card P.parts - Fintype.card α / stepBound (Finset.card P.parts) * 4 ^ Finset.card P.parts + 1)) * (Fintype.card α / stepBound (Finset.card P.parts)) + (Fintype.card α / Finset.card P.parts - Fintype.card α / stepBound (Finset.card P.parts) * 4 ^ Finset.card P.parts + 1) * (Fintype.card α / stepBound (Finset.card P.parts) + 1) = Finset.card U)).parts = 4 ^ Finset.card P.parts [PROOFSTEP] rw [card_parts_equitabilise _ _ hm, tsub_add_cancel_of_le a_add_one_le_four_pow_parts_card] [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hs : s ∈ (chunk hP G ε hU).parts ⊢ Finset.card s = Fintype.card α / stepBound (Finset.card P.parts) ∨ Finset.card s = Fintype.card α / stepBound (Finset.card P.parts) + 1 [PROOFSTEP] unfold chunk at hs [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hs : s ∈ (if hUcard : Finset.card U = Fintype.card α / stepBound (Finset.card P.parts) * 4 ^ Finset.card P.parts + (Fintype.card α / Finset.card P.parts - Fintype.card α / stepBound (Finset.card P.parts) * 4 ^ Finset.card P.parts) then equitabilise (_ : (4 ^ Finset.card P.parts - (Fintype.card α / Finset.card P.parts - Fintype.card α / stepBound (Finset.card P.parts) * 4 ^ Finset.card P.parts)) * (Fintype.card α / stepBound (Finset.card P.parts)) + (Fintype.card α / Finset.card P.parts - Fintype.card α / stepBound (Finset.card P.parts) * 4 ^ Finset.card P.parts) * (Fintype.card α / stepBound (Finset.card P.parts) + 1) = Finset.card U) else equitabilise (_ : (4 ^ Finset.card P.parts - (Fintype.card α / Finset.card P.parts - Fintype.card α / stepBound (Finset.card P.parts) * 4 ^ Finset.card P.parts + 1)) * (Fintype.card α / stepBound (Finset.card P.parts)) + (Fintype.card α / Finset.card P.parts - Fintype.card α / stepBound (Finset.card P.parts) * 4 ^ Finset.card P.parts + 1) * (Fintype.card α / stepBound (Finset.card P.parts) + 1) = Finset.card U)).parts ⊢ Finset.card s = Fintype.card α / stepBound (Finset.card P.parts) ∨ Finset.card s = Fintype.card α / stepBound (Finset.card P.parts) + 1 [PROOFSTEP] split_ifs at hs [GOAL] case pos α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α h✝ : Finset.card U = Fintype.card α / stepBound (Finset.card P.parts) * 4 ^ Finset.card P.parts + (Fintype.card α / Finset.card P.parts - Fintype.card α / stepBound (Finset.card P.parts) * 4 ^ Finset.card P.parts) hs : s ∈ (equitabilise (_ : (4 ^ Finset.card P.parts - (Fintype.card α / Finset.card P.parts - Fintype.card α / stepBound (Finset.card P.parts) * 4 ^ Finset.card P.parts)) * (Fintype.card α / stepBound (Finset.card P.parts)) + (Fintype.card α / Finset.card P.parts - Fintype.card α / stepBound (Finset.card P.parts) * 4 ^ Finset.card P.parts) * (Fintype.card α / stepBound (Finset.card P.parts) + 1) = Finset.card U)).parts ⊢ Finset.card s = Fintype.card α / stepBound (Finset.card P.parts) ∨ Finset.card s = Fintype.card α / stepBound (Finset.card P.parts) + 1 [PROOFSTEP] exact card_eq_of_mem_parts_equitabilise hs [GOAL] case neg α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α h✝ : ¬Finset.card U = Fintype.card α / stepBound (Finset.card P.parts) * 4 ^ Finset.card P.parts + (Fintype.card α / Finset.card P.parts - Fintype.card α / stepBound (Finset.card P.parts) * 4 ^ Finset.card P.parts) hs : s ∈ (equitabilise (_ : (4 ^ Finset.card P.parts - (Fintype.card α / Finset.card P.parts - Fintype.card α / stepBound (Finset.card P.parts) * 4 ^ Finset.card P.parts + 1)) * (Fintype.card α / stepBound (Finset.card P.parts)) + (Fintype.card α / Finset.card P.parts - Fintype.card α / stepBound (Finset.card P.parts) * 4 ^ Finset.card P.parts + 1) * (Fintype.card α / stepBound (Finset.card P.parts) + 1) = Finset.card U)).parts ⊢ Finset.card s = Fintype.card α / stepBound (Finset.card P.parts) ∨ Finset.card s = Fintype.card α / stepBound (Finset.card P.parts) + 1 [PROOFSTEP] exact card_eq_of_mem_parts_equitabilise hs [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hs : s ∈ (chunk hP G ε hU).parts i : Finset.card s = Fintype.card α / stepBound (Finset.card P.parts) + 1 ⊢ Fintype.card α / stepBound (Finset.card P.parts) ≤ Finset.card s [PROOFSTEP] simp [i] [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hs : s ∈ (chunk hP G ε hU).parts i : Finset.card s = Fintype.card α / stepBound (Finset.card P.parts) ⊢ Finset.card s ≤ Fintype.card α / stepBound (Finset.card P.parts) + 1 [PROOFSTEP] simp [i] [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α ⊢ ↑(Finset.card (Finset.biUnion (star hP G ε hU V) id)) ≤ ↑(Finset.card (star hP G ε hU V)) * (↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1) [PROOFSTEP] exact_mod_cast card_biUnion_le_card_mul _ _ _ fun s hs => card_le_m_add_one_of_mem_chunk_parts <| star_subset_chunk hs [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α h𝒜 : 𝒜 ⊆ (chunk hP G ε hU).parts hs : s ∈ 𝒜 ⊢ ↑(Finset.card 𝒜) * ↑(Finset.card s) * (↑(Fintype.card α / stepBound (Finset.card P.parts)) / (↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1)) ≤ ↑(Finset.card (sup 𝒜 id)) [PROOFSTEP] rw [mul_div_assoc', div_le_iff coe_m_add_one_pos, mul_right_comm] [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α h𝒜 : 𝒜 ⊆ (chunk hP G ε hU).parts hs : s ∈ 𝒜 ⊢ ↑(Finset.card 𝒜) * ↑(Fintype.card α / stepBound (Finset.card P.parts)) * ↑(Finset.card s) ≤ ↑(Finset.card (sup 𝒜 id)) * (↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1) [PROOFSTEP] refine' mul_le_mul _ _ (cast_nonneg _) (cast_nonneg _) [GOAL] case refine'_1 α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α h𝒜 : 𝒜 ⊆ (chunk hP G ε hU).parts hs : s ∈ 𝒜 ⊢ ↑(Finset.card 𝒜) * ↑(Fintype.card α / stepBound (Finset.card P.parts)) ≤ ↑(Finset.card (sup 𝒜 id)) [PROOFSTEP] rw [← (ofSubset _ h𝒜 rfl).sum_card_parts, ofSubset_parts, ← cast_mul, cast_le] [GOAL] case refine'_1 α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α h𝒜 : 𝒜 ⊆ (chunk hP G ε hU).parts hs : s ∈ 𝒜 ⊢ Finset.card 𝒜 * (Fintype.card α / stepBound (Finset.card P.parts)) ≤ ∑ i in 𝒜, Finset.card i [PROOFSTEP] exact card_nsmul_le_sum _ _ _ fun x hx => m_le_card_of_mem_chunk_parts <| h𝒜 hx [GOAL] case refine'_2 α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α h𝒜 : 𝒜 ⊆ (chunk hP G ε hU).parts hs : s ∈ 𝒜 ⊢ ↑(Finset.card s) ≤ ↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1 [PROOFSTEP] exact_mod_cast card_le_m_add_one_of_mem_chunk_parts (h𝒜 hs) [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α m_pos : 0 < ↑(Fintype.card α / stepBound (Finset.card P.parts)) h𝒜 : 𝒜 ⊆ (chunk hP G ε hU).parts hs : s ∈ 𝒜 ⊢ ↑(Finset.card (sup 𝒜 id)) ≤ ↑(Finset.card 𝒜) * ↑(Finset.card s) * ((↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1) / ↑(Fintype.card α / stepBound (Finset.card P.parts))) [PROOFSTEP] rw [sup_eq_biUnion, mul_div_assoc', le_div_iff m_pos, mul_right_comm] [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α m_pos : 0 < ↑(Fintype.card α / stepBound (Finset.card P.parts)) h𝒜 : 𝒜 ⊆ (chunk hP G ε hU).parts hs : s ∈ 𝒜 ⊢ ↑(Finset.card (Finset.biUnion 𝒜 id)) * ↑(Fintype.card α / stepBound (Finset.card P.parts)) ≤ ↑(Finset.card 𝒜) * (↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1) * ↑(Finset.card s) [PROOFSTEP] refine' mul_le_mul _ _ (cast_nonneg _) (by positivity) [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α m_pos : 0 < ↑(Fintype.card α / stepBound (Finset.card P.parts)) h𝒜 : 𝒜 ⊆ (chunk hP G ε hU).parts hs : s ∈ 𝒜 ⊢ 0 ≤ ↑(Finset.card 𝒜) * (↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1) [PROOFSTEP] positivity [GOAL] case refine'_1 α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α m_pos : 0 < ↑(Fintype.card α / stepBound (Finset.card P.parts)) h𝒜 : 𝒜 ⊆ (chunk hP G ε hU).parts hs : s ∈ 𝒜 ⊢ ↑(Finset.card (Finset.biUnion 𝒜 id)) ≤ ↑(Finset.card 𝒜) * (↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1) [PROOFSTEP] norm_cast [GOAL] case refine'_1 α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α m_pos : 0 < ↑(Fintype.card α / stepBound (Finset.card P.parts)) h𝒜 : 𝒜 ⊆ (chunk hP G ε hU).parts hs : s ∈ 𝒜 ⊢ Finset.card (Finset.biUnion 𝒜 id) ≤ Finset.card 𝒜 * (Fintype.card α / stepBound (Finset.card P.parts) + 1) [PROOFSTEP] refine' card_biUnion_le_card_mul _ _ _ fun x hx => _ [GOAL] case refine'_1 α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α m_pos : 0 < ↑(Fintype.card α / stepBound (Finset.card P.parts)) h𝒜 : 𝒜 ⊆ (chunk hP G ε hU).parts hs : s ∈ 𝒜 x : Finset α hx : x ∈ 𝒜 ⊢ Finset.card (id x) ≤ Fintype.card α / stepBound (Finset.card P.parts) + 1 [PROOFSTEP] apply card_le_m_add_one_of_mem_chunk_parts (h𝒜 hx) [GOAL] case refine'_2 α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α m_pos : 0 < ↑(Fintype.card α / stepBound (Finset.card P.parts)) h𝒜 : 𝒜 ⊆ (chunk hP G ε hU).parts hs : s ∈ 𝒜 ⊢ ↑(Fintype.card α / stepBound (Finset.card P.parts)) ≤ ↑(Finset.card s) [PROOFSTEP] exact_mod_cast m_le_card_of_mem_chunk_parts (h𝒜 hs) [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 ⊢ 1 - ε ^ 5 / 50 ≤ (↑(Fintype.card α / stepBound (Finset.card P.parts)) / (↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1)) ^ 2 [PROOFSTEP] have : (m : ℝ) / (m + 1) = 1 - 1 / (m + 1) := by rw [one_sub_div coe_m_add_one_pos.ne', add_sub_cancel] [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 ⊢ ↑(Fintype.card α / stepBound (Finset.card P.parts)) / (↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1) = 1 - 1 / (↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1) [PROOFSTEP] rw [one_sub_div coe_m_add_one_pos.ne', add_sub_cancel] [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 this : ↑(Fintype.card α / stepBound (Finset.card P.parts)) / (↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1) = 1 - 1 / (↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1) ⊢ 1 - ε ^ 5 / 50 ≤ (↑(Fintype.card α / stepBound (Finset.card P.parts)) / (↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1)) ^ 2 [PROOFSTEP] rw [this, sub_sq, one_pow, mul_one] [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 this : ↑(Fintype.card α / stepBound (Finset.card P.parts)) / (↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1) = 1 - 1 / (↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1) ⊢ 1 - ε ^ 5 / 50 ≤ 1 - 2 * (1 / (↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1)) + (1 / (↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1)) ^ 2 [PROOFSTEP] refine' le_trans _ (le_add_of_nonneg_right <| sq_nonneg _) [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 this : ↑(Fintype.card α / stepBound (Finset.card P.parts)) / (↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1) = 1 - 1 / (↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1) ⊢ 1 - ε ^ 5 / 50 ≤ 1 - 2 * (1 / (↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1)) [PROOFSTEP] rw [sub_le_sub_iff_left, ← le_div_iff' (show (0 : ℝ) < 2 by norm_num), div_div, one_div_le coe_m_add_one_pos, one_div_div] [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 this : ↑(Fintype.card α / stepBound (Finset.card P.parts)) / (↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1) = 1 - 1 / (↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1) ⊢ 0 < 2 [PROOFSTEP] norm_num [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 this : ↑(Fintype.card α / stepBound (Finset.card P.parts)) / (↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1) = 1 - 1 / (↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1) ⊢ 50 * 2 / ε ^ 5 ≤ ↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 this : ↑(Fintype.card α / stepBound (Finset.card P.parts)) / (↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1) = 1 - 1 / (↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1) ⊢ 0 < ε ^ 5 / (50 * 2) [PROOFSTEP] refine' le_trans _ (le_add_of_nonneg_right zero_le_one) [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 this : ↑(Fintype.card α / stepBound (Finset.card P.parts)) / (↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1) = 1 - 1 / (↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1) ⊢ 50 * 2 / ε ^ 5 ≤ ↑(Fintype.card α / stepBound (Finset.card P.parts)) α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 this : ↑(Fintype.card α / stepBound (Finset.card P.parts)) / (↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1) = 1 - 1 / (↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1) ⊢ 0 < ε ^ 5 / (50 * 2) [PROOFSTEP] norm_num [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 this : ↑(Fintype.card α / stepBound (Finset.card P.parts)) / (↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1) = 1 - 1 / (↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1) ⊢ 100 / ε ^ 5 ≤ ↑(Fintype.card α / stepBound (Finset.card P.parts)) α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 this : ↑(Fintype.card α / stepBound (Finset.card P.parts)) / (↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1) = 1 - 1 / (↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1) ⊢ 0 < ε ^ 5 / (50 * 2) [PROOFSTEP] apply hundred_div_ε_pow_five_le_m hPα hPε [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 this : ↑(Fintype.card α / stepBound (Finset.card P.parts)) / (↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1) = 1 - 1 / (↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1) ⊢ 0 < ε ^ 5 / (50 * 2) [PROOFSTEP] sz_positivity [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 ⊢ ((↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1) / ↑(Fintype.card α / stepBound (Finset.card P.parts))) ^ 2 ≤ 1 + ε ^ 5 / 49 [PROOFSTEP] rw [same_add_div] [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 ⊢ (1 + 1 / ↑(Fintype.card α / stepBound (Finset.card P.parts))) ^ 2 ≤ 1 + ε ^ 5 / 49 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 ⊢ ↑(Fintype.card α / stepBound (Finset.card P.parts)) ≠ 0 [PROOFSTEP] swap [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 ⊢ ↑(Fintype.card α / stepBound (Finset.card P.parts)) ≠ 0 [PROOFSTEP] sz_positivity [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 ⊢ (1 + 1 / ↑(Fintype.card α / stepBound (Finset.card P.parts))) ^ 2 ≤ 1 + ε ^ 5 / 49 [PROOFSTEP] have : ↑1 + ↑1 / (m : ℝ) ≤ ↑1 + ε ^ 5 / 100 := by rw [add_le_add_iff_left, ← one_div_div (100 : ℝ)] exact one_div_le_one_div_of_le (by sz_positivity) (hundred_div_ε_pow_five_le_m hPα hPε) [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 ⊢ 1 + 1 / ↑(Fintype.card α / stepBound (Finset.card P.parts)) ≤ 1 + ε ^ 5 / 100 [PROOFSTEP] rw [add_le_add_iff_left, ← one_div_div (100 : ℝ)] [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 ⊢ 1 / ↑(Fintype.card α / stepBound (Finset.card P.parts)) ≤ 1 / (100 / ε ^ 5) [PROOFSTEP] exact one_div_le_one_div_of_le (by sz_positivity) (hundred_div_ε_pow_five_le_m hPα hPε) [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 ⊢ 0 < 100 / ε ^ 5 [PROOFSTEP] sz_positivity [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 this : 1 + 1 / ↑(Fintype.card α / stepBound (Finset.card P.parts)) ≤ 1 + ε ^ 5 / 100 ⊢ (1 + 1 / ↑(Fintype.card α / stepBound (Finset.card P.parts))) ^ 2 ≤ 1 + ε ^ 5 / 49 [PROOFSTEP] refine' (pow_le_pow_of_le_left _ this 2).trans _ [GOAL] case refine'_1 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 this : 1 + 1 / ↑(Fintype.card α / stepBound (Finset.card P.parts)) ≤ 1 + ε ^ 5 / 100 ⊢ 0 ≤ 1 + 1 / ↑(Fintype.card α / stepBound (Finset.card P.parts)) [PROOFSTEP] positivity [GOAL] case refine'_2 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 this : 1 + 1 / ↑(Fintype.card α / stepBound (Finset.card P.parts)) ≤ 1 + ε ^ 5 / 100 ⊢ (1 + ε ^ 5 / 100) ^ 2 ≤ 1 + ε ^ 5 / 49 [PROOFSTEP] rw [add_sq, one_pow, add_assoc, add_le_add_iff_left, mul_one, ← le_sub_iff_add_le', div_eq_mul_one_div _ (49 : ℝ), mul_div_left_comm (2 : ℝ), ← mul_sub_left_distrib, div_pow, div_le_iff (show (0 : ℝ) < ↑100 ^ 2 by norm_num), mul_assoc, sq] [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 this : 1 + 1 / ↑(Fintype.card α / stepBound (Finset.card P.parts)) ≤ 1 + ε ^ 5 / 100 ⊢ 0 < 100 ^ 2 [PROOFSTEP] norm_num [GOAL] case refine'_2 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 this : 1 + 1 / ↑(Fintype.card α / stepBound (Finset.card P.parts)) ≤ 1 + ε ^ 5 / 100 ⊢ ε ^ 5 * ε ^ 5 ≤ ε ^ 5 * ((1 / 49 - 2 / 100) * 100 ^ 2) [PROOFSTEP] refine' mul_le_mul_of_nonneg_left _ (by sz_positivity) [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 this : 1 + 1 / ↑(Fintype.card α / stepBound (Finset.card P.parts)) ≤ 1 + ε ^ 5 / 100 ⊢ 0 ≤ ε ^ 5 [PROOFSTEP] sz_positivity [GOAL] case refine'_2 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 this : 1 + 1 / ↑(Fintype.card α / stepBound (Finset.card P.parts)) ≤ 1 + ε ^ 5 / 100 ⊢ ε ^ 5 ≤ (1 / 49 - 2 / 100) * 100 ^ 2 [PROOFSTEP] exact (pow_le_one 5 (by sz_positivity) hε₁).trans (by norm_num) [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 this : 1 + 1 / ↑(Fintype.card α / stepBound (Finset.card P.parts)) ≤ 1 + ε ^ 5 / 100 ⊢ 0 ≤ ε [PROOFSTEP] sz_positivity [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 this : 1 + 1 / ↑(Fintype.card α / stepBound (Finset.card P.parts)) ≤ 1 + ε ^ 5 / 100 ⊢ 1 ≤ (1 / 49 - 2 / 100) * 100 ^ 2 [PROOFSTEP] norm_num [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts ⊢ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - ε ^ 5 / 50 ≤ (∑ ab in Finset.product A B, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card A) * ↑(Finset.card B)) [PROOFSTEP] have : ↑(G.edgeDensity (A.biUnion id) (B.biUnion id)) - ε ^ 5 / ↑50 ≤ (↑1 - ε ^ 5 / 50) * G.edgeDensity (A.biUnion id) (B.biUnion id) := by rw [sub_mul, one_mul, sub_le_sub_iff_left] refine' mul_le_of_le_one_right (by sz_positivity) _ exact_mod_cast G.edgeDensity_le_one _ _ [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts ⊢ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - ε ^ 5 / 50 ≤ (1 - ε ^ 5 / 50) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) [PROOFSTEP] rw [sub_mul, one_mul, sub_le_sub_iff_left] [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts ⊢ ε ^ 5 / 50 * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ ε ^ 5 / 50 [PROOFSTEP] refine' mul_le_of_le_one_right (by sz_positivity) _ [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts ⊢ 0 ≤ ε ^ 5 / 50 [PROOFSTEP] sz_positivity [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts ⊢ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ 1 [PROOFSTEP] exact_mod_cast G.edgeDensity_le_one _ _ [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - ε ^ 5 / 50 ≤ (1 - ε ^ 5 / 50) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ⊢ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - ε ^ 5 / 50 ≤ (∑ ab in Finset.product A B, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card A) * ↑(Finset.card B)) [PROOFSTEP] refine' this.trans _ [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - ε ^ 5 / 50 ≤ (1 - ε ^ 5 / 50) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ⊢ (1 - ε ^ 5 / 50) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ (∑ ab in Finset.product A B, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card A) * ↑(Finset.card B)) [PROOFSTEP] conv_rhs => -- Porting note: LHS and RHS need separate treatment to get the desired formsimp only [SimpleGraph.edgeDensity_def, sum_div, Rat.cast_div, div_div] [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - ε ^ 5 / 50 ≤ (1 - ε ^ 5 / 50) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) | (∑ ab in Finset.product A B, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card A) * ↑(Finset.card B)) [PROOFSTEP] simp only [SimpleGraph.edgeDensity_def, sum_div, Rat.cast_div, div_div] [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - ε ^ 5 / 50 ≤ (1 - ε ^ 5 / 50) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) | (∑ ab in Finset.product A B, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card A) * ↑(Finset.card B)) [PROOFSTEP] simp only [SimpleGraph.edgeDensity_def, sum_div, Rat.cast_div, div_div] [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - ε ^ 5 / 50 ≤ (1 - ε ^ 5 / 50) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) | (∑ ab in Finset.product A B, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card A) * ↑(Finset.card B)) [PROOFSTEP] simp only [SimpleGraph.edgeDensity_def, sum_div, Rat.cast_div, div_div] [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - ε ^ 5 / 50 ≤ (1 - ε ^ 5 / 50) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ⊢ (1 - ε ^ 5 / 50) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ ∑ x in Finset.product A B, ↑↑(Finset.card (SimpleGraph.interedges G x.fst x.snd)) / (↑(↑(Finset.card x.fst) * ↑(Finset.card x.snd)) * (↑(Finset.card A) * ↑(Finset.card B))) [PROOFSTEP] conv_lhs => rw [SimpleGraph.edgeDensity_def, SimpleGraph.interedges, ← sup_eq_biUnion, ← sup_eq_biUnion, Rel.card_interedges_finpartition _ (ofSubset _ hA rfl) (ofSubset _ hB rfl), ofSubset_parts, ofSubset_parts] simp only [cast_sum, sum_div, mul_sum, Rat.cast_sum, Rat.cast_div, mul_div_left_comm ((1 : ℝ) - _)] [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - ε ^ 5 / 50 ≤ (1 - ε ^ 5 / 50) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) | (1 - ε ^ 5 / 50) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) [PROOFSTEP] rw [SimpleGraph.edgeDensity_def, SimpleGraph.interedges, ← sup_eq_biUnion, ← sup_eq_biUnion, Rel.card_interedges_finpartition _ (ofSubset _ hA rfl) (ofSubset _ hB rfl), ofSubset_parts, ofSubset_parts] simp only [cast_sum, sum_div, mul_sum, Rat.cast_sum, Rat.cast_div, mul_div_left_comm ((1 : ℝ) - _)] [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - ε ^ 5 / 50 ≤ (1 - ε ^ 5 / 50) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) | (1 - ε ^ 5 / 50) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) [PROOFSTEP] rw [SimpleGraph.edgeDensity_def, SimpleGraph.interedges, ← sup_eq_biUnion, ← sup_eq_biUnion, Rel.card_interedges_finpartition _ (ofSubset _ hA rfl) (ofSubset _ hB rfl), ofSubset_parts, ofSubset_parts] simp only [cast_sum, sum_div, mul_sum, Rat.cast_sum, Rat.cast_div, mul_div_left_comm ((1 : ℝ) - _)] [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - ε ^ 5 / 50 ≤ (1 - ε ^ 5 / 50) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) | (1 - ε ^ 5 / 50) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) [PROOFSTEP] rw [SimpleGraph.edgeDensity_def, SimpleGraph.interedges, ← sup_eq_biUnion, ← sup_eq_biUnion, Rel.card_interedges_finpartition _ (ofSubset _ hA rfl) (ofSubset _ hB rfl), ofSubset_parts, ofSubset_parts] [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - ε ^ 5 / 50 ≤ (1 - ε ^ 5 / 50) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) | (1 - ε ^ 5 / 50) * ↑(↑(∑ ab in A ×ˢ B, Finset.card (interedges G.Adj ab.fst ab.snd)) / (↑(Finset.card (sup A id)) * ↑(Finset.card (sup B id)))) [PROOFSTEP] simp only [cast_sum, sum_div, mul_sum, Rat.cast_sum, Rat.cast_div, mul_div_left_comm ((1 : ℝ) - _)] [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - ε ^ 5 / 50 ≤ (1 - ε ^ 5 / 50) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ⊢ ∑ x in A ×ˢ B, ↑↑(Finset.card (interedges G.Adj x.fst x.snd)) * ((1 - ε ^ 5 / 50) / ↑(↑(Finset.card (sup A id)) * ↑(Finset.card (sup B id)))) ≤ ∑ x in Finset.product A B, ↑↑(Finset.card (SimpleGraph.interedges G x.fst x.snd)) / (↑(↑(Finset.card x.fst) * ↑(Finset.card x.snd)) * (↑(Finset.card A) * ↑(Finset.card B))) [PROOFSTEP] push_cast [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - ε ^ 5 / 50 ≤ (1 - ε ^ 5 / 50) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ⊢ ∑ x in A ×ˢ B, ↑(Finset.card (interedges G.Adj x.fst x.snd)) * ((1 - ε ^ 5 / 50) / (↑(Finset.card (sup A id)) * ↑(Finset.card (sup B id)))) ≤ ∑ x in Finset.product A B, ↑(Finset.card (SimpleGraph.interedges G x.fst x.snd)) / (↑(Finset.card x.fst) * ↑(Finset.card x.snd) * (↑(Finset.card A) * ↑(Finset.card B))) [PROOFSTEP] apply sum_le_sum [GOAL] case h α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - ε ^ 5 / 50 ≤ (1 - ε ^ 5 / 50) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ⊢ ∀ (i : Finset α × Finset α), i ∈ A ×ˢ B → ↑(Finset.card (interedges G.Adj i.fst i.snd)) * ((1 - ε ^ 5 / 50) / (↑(Finset.card (sup A id)) * ↑(Finset.card (sup B id)))) ≤ ↑(Finset.card (SimpleGraph.interedges G i.fst i.snd)) / (↑(Finset.card i.fst) * ↑(Finset.card i.snd) * (↑(Finset.card A) * ↑(Finset.card B))) [PROOFSTEP] simp only [and_imp, Prod.forall, mem_product] [GOAL] case h α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - ε ^ 5 / 50 ≤ (1 - ε ^ 5 / 50) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ⊢ ∀ (a b : Finset α), a ∈ A → b ∈ B → ↑(Finset.card (interedges G.Adj a b)) * ((1 - ε ^ 5 / 50) / (↑(Finset.card (sup A id)) * ↑(Finset.card (sup B id)))) ≤ ↑(Finset.card (SimpleGraph.interedges G a b)) / (↑(Finset.card a) * ↑(Finset.card b) * (↑(Finset.card A) * ↑(Finset.card B))) [PROOFSTEP] rintro x y hx hy [GOAL] case h α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - ε ^ 5 / 50 ≤ (1 - ε ^ 5 / 50) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ ↑(Finset.card (interedges G.Adj x y)) * ((1 - ε ^ 5 / 50) / (↑(Finset.card (sup A id)) * ↑(Finset.card (sup B id)))) ≤ ↑(Finset.card (SimpleGraph.interedges G x y)) / (↑(Finset.card x) * ↑(Finset.card y) * (↑(Finset.card A) * ↑(Finset.card B))) [PROOFSTEP] rw [mul_mul_mul_comm, mul_comm (x.card : ℝ), mul_comm (y.card : ℝ), le_div_iff, mul_assoc] [GOAL] case h α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - ε ^ 5 / 50 ≤ (1 - ε ^ 5 / 50) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ ↑(Finset.card (interedges G.Adj x y)) * ((1 - ε ^ 5 / 50) / (↑(Finset.card (sup A id)) * ↑(Finset.card (sup B id))) * (↑(Finset.card A) * ↑(Finset.card x) * (↑(Finset.card B) * ↑(Finset.card y)))) ≤ ↑(Finset.card (SimpleGraph.interedges G x y)) [PROOFSTEP] refine' mul_le_of_le_one_right (cast_nonneg _) _ [GOAL] case h α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - ε ^ 5 / 50 ≤ (1 - ε ^ 5 / 50) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ (1 - ε ^ 5 / 50) / (↑(Finset.card (sup A id)) * ↑(Finset.card (sup B id))) * (↑(Finset.card A) * ↑(Finset.card x) * (↑(Finset.card B) * ↑(Finset.card y))) ≤ 1 [PROOFSTEP] rw [div_mul_eq_mul_div, ← mul_assoc, mul_assoc] [GOAL] case h α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - ε ^ 5 / 50 ≤ (1 - ε ^ 5 / 50) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ (1 - ε ^ 5 / 50) * (↑(Finset.card A) * ↑(Finset.card x) * (↑(Finset.card B) * ↑(Finset.card y))) / (↑(Finset.card (sup A id)) * ↑(Finset.card (sup B id))) ≤ 1 [PROOFSTEP] refine' div_le_one_of_le _ (by positivity) [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - ε ^ 5 / 50 ≤ (1 - ε ^ 5 / 50) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ 0 ≤ ↑(Finset.card (sup A id)) * ↑(Finset.card (sup B id)) [PROOFSTEP] positivity [GOAL] case h α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - ε ^ 5 / 50 ≤ (1 - ε ^ 5 / 50) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ (1 - ε ^ 5 / 50) * (↑(Finset.card A) * ↑(Finset.card x) * (↑(Finset.card B) * ↑(Finset.card y))) ≤ ↑(Finset.card (sup A id)) * ↑(Finset.card (sup B id)) [PROOFSTEP] refine' (mul_le_mul_of_nonneg_right (one_sub_le_m_div_m_add_one_sq hPα hPε) _).trans _ [GOAL] case h.refine'_1 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - ε ^ 5 / 50 ≤ (1 - ε ^ 5 / 50) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ 0 ≤ ↑(Finset.card A) * ↑(Finset.card x) * (↑(Finset.card B) * ↑(Finset.card y)) [PROOFSTEP] exact_mod_cast _root_.zero_le _ [GOAL] case h.refine'_2 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - ε ^ 5 / 50 ≤ (1 - ε ^ 5 / 50) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ (↑(Fintype.card α / stepBound (Finset.card P.parts)) / (↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1)) ^ 2 * (↑(Finset.card A) * ↑(Finset.card x) * (↑(Finset.card B) * ↑(Finset.card y))) ≤ ↑(Finset.card (sup A id)) * ↑(Finset.card (sup B id)) [PROOFSTEP] rw [sq, mul_mul_mul_comm, mul_comm ((m : ℝ) / _), mul_comm ((m : ℝ) / _)] [GOAL] case h.refine'_2 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - ε ^ 5 / 50 ≤ (1 - ε ^ 5 / 50) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ ↑(Finset.card A) * ↑(Finset.card x) * (↑(Fintype.card α / stepBound (Finset.card P.parts)) / (↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1)) * (↑(Finset.card B) * ↑(Finset.card y) * (↑(Fintype.card α / stepBound (Finset.card P.parts)) / (↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1))) ≤ ↑(Finset.card (sup A id)) * ↑(Finset.card (sup B id)) [PROOFSTEP] refine' mul_le_mul _ _ _ (cast_nonneg _) [GOAL] case h.refine'_2.refine'_1 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - ε ^ 5 / 50 ≤ (1 - ε ^ 5 / 50) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ ↑(Finset.card A) * ↑(Finset.card x) * (↑(Fintype.card α / stepBound (Finset.card P.parts)) / (↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1)) ≤ ↑(Finset.card (sup A id)) case h.refine'_2.refine'_2 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - ε ^ 5 / 50 ≤ (1 - ε ^ 5 / 50) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ ↑(Finset.card B) * ↑(Finset.card y) * (↑(Fintype.card α / stepBound (Finset.card P.parts)) / (↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1)) ≤ ↑(Finset.card (sup B id)) case h.refine'_2.refine'_3 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - ε ^ 5 / 50 ≤ (1 - ε ^ 5 / 50) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ 0 ≤ ↑(Finset.card B) * ↑(Finset.card y) * (↑(Fintype.card α / stepBound (Finset.card P.parts)) / (↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1)) [PROOFSTEP] apply le_sum_card_subset_chunk_parts hA hx [GOAL] case h.refine'_2.refine'_2 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - ε ^ 5 / 50 ≤ (1 - ε ^ 5 / 50) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ ↑(Finset.card B) * ↑(Finset.card y) * (↑(Fintype.card α / stepBound (Finset.card P.parts)) / (↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1)) ≤ ↑(Finset.card (sup B id)) case h.refine'_2.refine'_3 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - ε ^ 5 / 50 ≤ (1 - ε ^ 5 / 50) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ 0 ≤ ↑(Finset.card B) * ↑(Finset.card y) * (↑(Fintype.card α / stepBound (Finset.card P.parts)) / (↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1)) [PROOFSTEP] apply le_sum_card_subset_chunk_parts hB hy [GOAL] case h.refine'_2.refine'_3 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - ε ^ 5 / 50 ≤ (1 - ε ^ 5 / 50) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ 0 ≤ ↑(Finset.card B) * ↑(Finset.card y) * (↑(Fintype.card α / stepBound (Finset.card P.parts)) / (↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1)) [PROOFSTEP] positivity [GOAL] case h α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - ε ^ 5 / 50 ≤ (1 - ε ^ 5 / 50) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ 0 < ↑(Finset.card A) * ↑(Finset.card x) * (↑(Finset.card B) * ↑(Finset.card y)) [PROOFSTEP] refine' mul_pos (mul_pos _ _) (mul_pos _ _) [GOAL] case h.refine'_1 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - ε ^ 5 / 50 ≤ (1 - ε ^ 5 / 50) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ 0 < ↑(Finset.card A) [PROOFSTEP] rw [cast_pos, Finset.card_pos] [GOAL] case h.refine'_2 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - ε ^ 5 / 50 ≤ (1 - ε ^ 5 / 50) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ 0 < ↑(Finset.card x) [PROOFSTEP] rw [cast_pos, Finset.card_pos] [GOAL] case h.refine'_3 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - ε ^ 5 / 50 ≤ (1 - ε ^ 5 / 50) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ 0 < ↑(Finset.card B) [PROOFSTEP] rw [cast_pos, Finset.card_pos] [GOAL] case h.refine'_4 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - ε ^ 5 / 50 ≤ (1 - ε ^ 5 / 50) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ 0 < ↑(Finset.card y) [PROOFSTEP] rw [cast_pos, Finset.card_pos] [GOAL] case h.refine'_1 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - ε ^ 5 / 50 ≤ (1 - ε ^ 5 / 50) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ Finset.Nonempty A case h.refine'_2 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - ε ^ 5 / 50 ≤ (1 - ε ^ 5 / 50) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ Finset.Nonempty x case h.refine'_3 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - ε ^ 5 / 50 ≤ (1 - ε ^ 5 / 50) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ Finset.Nonempty B case h.refine'_4 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - ε ^ 5 / 50 ≤ (1 - ε ^ 5 / 50) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ Finset.Nonempty y [PROOFSTEP] exacts [⟨_, hx⟩, nonempty_of_mem_parts _ (hA hx), ⟨_, hy⟩, nonempty_of_mem_parts _ (hB hy)] [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts ⊢ (∑ ab in Finset.product A B, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card A) * ↑(Finset.card B)) ≤ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) + ε ^ 5 / 49 [PROOFSTEP] have : (↑1 + ε ^ 5 / ↑49) * G.edgeDensity (A.biUnion id) (B.biUnion id) ≤ G.edgeDensity (A.biUnion id) (B.biUnion id) + ε ^ 5 / 49 := by rw [add_mul, one_mul, add_le_add_iff_left] refine' mul_le_of_le_one_right (by sz_positivity) _ exact_mod_cast G.edgeDensity_le_one _ _ [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts ⊢ (1 + ε ^ 5 / 49) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) + ε ^ 5 / 49 [PROOFSTEP] rw [add_mul, one_mul, add_le_add_iff_left] [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts ⊢ ε ^ 5 / 49 * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ ε ^ 5 / 49 [PROOFSTEP] refine' mul_le_of_le_one_right (by sz_positivity) _ [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts ⊢ 0 ≤ ε ^ 5 / 49 [PROOFSTEP] sz_positivity [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts ⊢ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ 1 [PROOFSTEP] exact_mod_cast G.edgeDensity_le_one _ _ [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : (1 + ε ^ 5 / 49) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) + ε ^ 5 / 49 ⊢ (∑ ab in Finset.product A B, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card A) * ↑(Finset.card B)) ≤ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) + ε ^ 5 / 49 [PROOFSTEP] refine' le_trans _ this [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : (1 + ε ^ 5 / 49) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) + ε ^ 5 / 49 ⊢ (∑ ab in Finset.product A B, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card A) * ↑(Finset.card B)) ≤ (1 + ε ^ 5 / 49) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) [PROOFSTEP] conv_lhs => -- Porting note: LHS and RHS need separate treatment to get the desired formsimp only [SimpleGraph.edgeDensity, edgeDensity, sum_div, Rat.cast_div, div_div] [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : (1 + ε ^ 5 / 49) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) + ε ^ 5 / 49 | (∑ ab in Finset.product A B, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card A) * ↑(Finset.card B)) [PROOFSTEP] simp only [SimpleGraph.edgeDensity, edgeDensity, sum_div, Rat.cast_div, div_div] [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : (1 + ε ^ 5 / 49) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) + ε ^ 5 / 49 | (∑ ab in Finset.product A B, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card A) * ↑(Finset.card B)) [PROOFSTEP] simp only [SimpleGraph.edgeDensity, edgeDensity, sum_div, Rat.cast_div, div_div] [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : (1 + ε ^ 5 / 49) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) + ε ^ 5 / 49 | (∑ ab in Finset.product A B, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card A) * ↑(Finset.card B)) [PROOFSTEP] simp only [SimpleGraph.edgeDensity, edgeDensity, sum_div, Rat.cast_div, div_div] [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : (1 + ε ^ 5 / 49) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) + ε ^ 5 / 49 ⊢ ∑ x in Finset.product A B, ↑↑(Finset.card (interedges G.Adj x.fst x.snd)) / (↑(↑(Finset.card x.fst) * ↑(Finset.card x.snd)) * (↑(Finset.card A) * ↑(Finset.card B))) ≤ (1 + ε ^ 5 / 49) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) [PROOFSTEP] conv_rhs => rw [SimpleGraph.edgeDensity, edgeDensity, ← sup_eq_biUnion, ← sup_eq_biUnion, Rel.card_interedges_finpartition _ (ofSubset _ hA rfl) (ofSubset _ hB rfl)] simp only [cast_sum, mul_sum, sum_div, Rat.cast_sum, Rat.cast_div, mul_div_left_comm ((1 : ℝ) + _)] [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : (1 + ε ^ 5 / 49) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) + ε ^ 5 / 49 | (1 + ε ^ 5 / 49) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) [PROOFSTEP] rw [SimpleGraph.edgeDensity, edgeDensity, ← sup_eq_biUnion, ← sup_eq_biUnion, Rel.card_interedges_finpartition _ (ofSubset _ hA rfl) (ofSubset _ hB rfl)] simp only [cast_sum, mul_sum, sum_div, Rat.cast_sum, Rat.cast_div, mul_div_left_comm ((1 : ℝ) + _)] [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : (1 + ε ^ 5 / 49) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) + ε ^ 5 / 49 | (1 + ε ^ 5 / 49) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) [PROOFSTEP] rw [SimpleGraph.edgeDensity, edgeDensity, ← sup_eq_biUnion, ← sup_eq_biUnion, Rel.card_interedges_finpartition _ (ofSubset _ hA rfl) (ofSubset _ hB rfl)] simp only [cast_sum, mul_sum, sum_div, Rat.cast_sum, Rat.cast_div, mul_div_left_comm ((1 : ℝ) + _)] [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : (1 + ε ^ 5 / 49) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) + ε ^ 5 / 49 | (1 + ε ^ 5 / 49) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) [PROOFSTEP] rw [SimpleGraph.edgeDensity, edgeDensity, ← sup_eq_biUnion, ← sup_eq_biUnion, Rel.card_interedges_finpartition _ (ofSubset _ hA rfl) (ofSubset _ hB rfl)] [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : (1 + ε ^ 5 / 49) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) + ε ^ 5 / 49 | (1 + ε ^ 5 / 49) * ↑(↑(∑ ab in (ofSubset (chunk hP G ε hU) hA (_ : sup A id = sup A id)).parts ×ˢ (ofSubset (chunk hP G ε hV) hB (_ : sup B id = sup B id)).parts, Finset.card (interedges G.Adj ab.fst ab.snd)) / (↑(Finset.card (sup A id)) * ↑(Finset.card (sup B id)))) [PROOFSTEP] simp only [cast_sum, mul_sum, sum_div, Rat.cast_sum, Rat.cast_div, mul_div_left_comm ((1 : ℝ) + _)] [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : (1 + ε ^ 5 / 49) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) + ε ^ 5 / 49 ⊢ ∑ x in Finset.product A B, ↑↑(Finset.card (interedges G.Adj x.fst x.snd)) / (↑(↑(Finset.card x.fst) * ↑(Finset.card x.snd)) * (↑(Finset.card A) * ↑(Finset.card B))) ≤ ∑ x in (ofSubset (chunk hP G ε hU) hA (_ : sup A id = sup A id)).parts ×ˢ (ofSubset (chunk hP G ε hV) hB (_ : sup B id = sup B id)).parts, ↑↑(Finset.card (interedges G.Adj x.fst x.snd)) * ((1 + ε ^ 5 / 49) / ↑(↑(Finset.card (sup A id)) * ↑(Finset.card (sup B id)))) [PROOFSTEP] push_cast [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : (1 + ε ^ 5 / 49) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) + ε ^ 5 / 49 ⊢ ∑ x in Finset.product A B, ↑(Finset.card (interedges G.Adj x.fst x.snd)) / (↑(Finset.card x.fst) * ↑(Finset.card x.snd) * (↑(Finset.card A) * ↑(Finset.card B))) ≤ ∑ x in (ofSubset (chunk hP G ε hU) hA (_ : sup A id = sup A id)).parts ×ˢ (ofSubset (chunk hP G ε hV) hB (_ : sup B id = sup B id)).parts, ↑(Finset.card (interedges G.Adj x.fst x.snd)) * ((1 + ε ^ 5 / 49) / (↑(Finset.card (sup A id)) * ↑(Finset.card (sup B id)))) [PROOFSTEP] apply sum_le_sum [GOAL] case h α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : (1 + ε ^ 5 / 49) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) + ε ^ 5 / 49 ⊢ ∀ (i : Finset α × Finset α), i ∈ Finset.product A B → ↑(Finset.card (interedges G.Adj i.fst i.snd)) / (↑(Finset.card i.fst) * ↑(Finset.card i.snd) * (↑(Finset.card A) * ↑(Finset.card B))) ≤ ↑(Finset.card (interedges G.Adj i.fst i.snd)) * ((1 + ε ^ 5 / 49) / (↑(Finset.card (sup A id)) * ↑(Finset.card (sup B id)))) [PROOFSTEP] simp only [and_imp, Prod.forall, mem_product, show A.product B = A ×ˢ B by rfl] [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : (1 + ε ^ 5 / 49) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) + ε ^ 5 / 49 ⊢ Finset.product A B = A ×ˢ B [PROOFSTEP] rfl [GOAL] case h α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : (1 + ε ^ 5 / 49) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) + ε ^ 5 / 49 ⊢ ∀ (a b : Finset α), a ∈ A → b ∈ B → ↑(Finset.card (interedges G.Adj a b)) / (↑(Finset.card a) * ↑(Finset.card b) * (↑(Finset.card A) * ↑(Finset.card B))) ≤ ↑(Finset.card (interedges G.Adj a b)) * ((1 + ε ^ 5 / 49) / (↑(Finset.card (sup A id)) * ↑(Finset.card (sup B id)))) [PROOFSTEP] intro x y hx hy [GOAL] case h α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : (1 + ε ^ 5 / 49) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) + ε ^ 5 / 49 x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ ↑(Finset.card (interedges G.Adj x y)) / (↑(Finset.card x) * ↑(Finset.card y) * (↑(Finset.card A) * ↑(Finset.card B))) ≤ ↑(Finset.card (interedges G.Adj x y)) * ((1 + ε ^ 5 / 49) / (↑(Finset.card (sup A id)) * ↑(Finset.card (sup B id)))) [PROOFSTEP] rw [mul_mul_mul_comm, mul_comm (x.card : ℝ), mul_comm (y.card : ℝ), div_le_iff, mul_assoc] [GOAL] case h α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : (1 + ε ^ 5 / 49) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) + ε ^ 5 / 49 x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ ↑(Finset.card (interedges G.Adj x y)) ≤ ↑(Finset.card (interedges G.Adj x y)) * ((1 + ε ^ 5 / 49) / (↑(Finset.card (sup A id)) * ↑(Finset.card (sup B id))) * (↑(Finset.card A) * ↑(Finset.card x) * (↑(Finset.card B) * ↑(Finset.card y)))) [PROOFSTEP] refine' le_mul_of_one_le_right (cast_nonneg _) _ [GOAL] case h α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : (1 + ε ^ 5 / 49) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) + ε ^ 5 / 49 x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ 1 ≤ (1 + ε ^ 5 / 49) / (↑(Finset.card (sup A id)) * ↑(Finset.card (sup B id))) * (↑(Finset.card A) * ↑(Finset.card x) * (↑(Finset.card B) * ↑(Finset.card y))) [PROOFSTEP] rw [div_mul_eq_mul_div, one_le_div] [GOAL] case h α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : (1 + ε ^ 5 / 49) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) + ε ^ 5 / 49 x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ ↑(Finset.card (sup A id)) * ↑(Finset.card (sup B id)) ≤ (1 + ε ^ 5 / 49) * (↑(Finset.card A) * ↑(Finset.card x) * (↑(Finset.card B) * ↑(Finset.card y))) case h α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : (1 + ε ^ 5 / 49) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) + ε ^ 5 / 49 x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ 0 < ↑(Finset.card (sup A id)) * ↑(Finset.card (sup B id)) [PROOFSTEP] refine' le_trans _ (mul_le_mul_of_nonneg_right (m_add_one_div_m_le_one_add hPα hPε hε₁) _) [GOAL] case h.refine'_1 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : (1 + ε ^ 5 / 49) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) + ε ^ 5 / 49 x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ ↑(Finset.card (sup A id)) * ↑(Finset.card (sup B id)) ≤ ((↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1) / ↑(Fintype.card α / stepBound (Finset.card P.parts))) ^ 2 * (↑(Finset.card A) * ↑(Finset.card x) * (↑(Finset.card B) * ↑(Finset.card y))) [PROOFSTEP] rw [sq, mul_mul_mul_comm, mul_comm (_ / (m : ℝ)), mul_comm (_ / (m : ℝ))] [GOAL] case h.refine'_1 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : (1 + ε ^ 5 / 49) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) + ε ^ 5 / 49 x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ ↑(Finset.card (sup A id)) * ↑(Finset.card (sup B id)) ≤ ↑(Finset.card A) * ↑(Finset.card x) * ((↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1) / ↑(Fintype.card α / stepBound (Finset.card P.parts))) * (↑(Finset.card B) * ↑(Finset.card y) * ((↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1) / ↑(Fintype.card α / stepBound (Finset.card P.parts)))) [PROOFSTEP] exact mul_le_mul (sum_card_subset_chunk_parts_le (by sz_positivity) hA hx) (sum_card_subset_chunk_parts_le (by sz_positivity) hB hy) (by positivity) (by positivity) [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : (1 + ε ^ 5 / 49) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) + ε ^ 5 / 49 x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ 0 < ↑(Fintype.card α / stepBound (Finset.card P.parts)) [PROOFSTEP] sz_positivity [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : (1 + ε ^ 5 / 49) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) + ε ^ 5 / 49 x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ 0 < ↑(Fintype.card α / stepBound (Finset.card P.parts)) [PROOFSTEP] sz_positivity [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : (1 + ε ^ 5 / 49) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) + ε ^ 5 / 49 x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ 0 ≤ ↑(Finset.card (sup B id)) [PROOFSTEP] positivity [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : (1 + ε ^ 5 / 49) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) + ε ^ 5 / 49 x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ 0 ≤ ↑(Finset.card A) * ↑(Finset.card x) * ((↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1) / ↑(Fintype.card α / stepBound (Finset.card P.parts))) [PROOFSTEP] positivity [GOAL] case h.refine'_2 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : (1 + ε ^ 5 / 49) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) + ε ^ 5 / 49 x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ 0 ≤ ↑(Finset.card A) * ↑(Finset.card x) * (↑(Finset.card B) * ↑(Finset.card y)) [PROOFSTEP] exact_mod_cast _root_.zero_le _ [GOAL] case h α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : (1 + ε ^ 5 / 49) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) + ε ^ 5 / 49 x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ 0 < ↑(Finset.card (sup A id)) * ↑(Finset.card (sup B id)) [PROOFSTEP] rw [← cast_mul, cast_pos] [GOAL] case h α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : (1 + ε ^ 5 / 49) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) + ε ^ 5 / 49 x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ 0 < Finset.card (sup A id) * Finset.card (sup B id) [PROOFSTEP] apply mul_pos [GOAL] case h.ha α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : (1 + ε ^ 5 / 49) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) + ε ^ 5 / 49 x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ 0 < Finset.card (sup A id) [PROOFSTEP] rw [Finset.card_pos, sup_eq_biUnion, biUnion_nonempty] [GOAL] case h.hb α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : (1 + ε ^ 5 / 49) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) + ε ^ 5 / 49 x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ 0 < Finset.card (sup B id) [PROOFSTEP] rw [Finset.card_pos, sup_eq_biUnion, biUnion_nonempty] [GOAL] case h.ha α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : (1 + ε ^ 5 / 49) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) + ε ^ 5 / 49 x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ ∃ x, x ∈ A ∧ Finset.Nonempty (id x) [PROOFSTEP] exact ⟨_, hx, nonempty_of_mem_parts _ (hA hx)⟩ [GOAL] case h.hb α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : (1 + ε ^ 5 / 49) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) + ε ^ 5 / 49 x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ ∃ x, x ∈ B ∧ Finset.Nonempty (id x) [PROOFSTEP] exact ⟨_, hy, nonempty_of_mem_parts _ (hB hy)⟩ [GOAL] case h α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : (1 + ε ^ 5 / 49) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) + ε ^ 5 / 49 x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ 0 < ↑(Finset.card A) * ↑(Finset.card x) * (↑(Finset.card B) * ↑(Finset.card y)) [PROOFSTEP] refine' mul_pos (mul_pos _ _) (mul_pos _ _) [GOAL] case h.refine'_1 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : (1 + ε ^ 5 / 49) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) + ε ^ 5 / 49 x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ 0 < ↑(Finset.card A) [PROOFSTEP] rw [cast_pos, Finset.card_pos] [GOAL] case h.refine'_2 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : (1 + ε ^ 5 / 49) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) + ε ^ 5 / 49 x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ 0 < ↑(Finset.card x) [PROOFSTEP] rw [cast_pos, Finset.card_pos] [GOAL] case h.refine'_3 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : (1 + ε ^ 5 / 49) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) + ε ^ 5 / 49 x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ 0 < ↑(Finset.card B) [PROOFSTEP] rw [cast_pos, Finset.card_pos] [GOAL] case h.refine'_4 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : (1 + ε ^ 5 / 49) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) + ε ^ 5 / 49 x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ 0 < ↑(Finset.card y) [PROOFSTEP] rw [cast_pos, Finset.card_pos] [GOAL] case h.refine'_1 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : (1 + ε ^ 5 / 49) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) + ε ^ 5 / 49 x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ Finset.Nonempty A case h.refine'_2 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : (1 + ε ^ 5 / 49) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) + ε ^ 5 / 49 x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ Finset.Nonempty x case h.refine'_3 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : (1 + ε ^ 5 / 49) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) + ε ^ 5 / 49 x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ Finset.Nonempty B case h.refine'_4 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : (1 + ε ^ 5 / 49) * ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) + ε ^ 5 / 49 x y : Finset α hx : x ∈ A hy : y ∈ B ⊢ Finset.Nonempty y [PROOFSTEP] exacts [⟨_, hx⟩, nonempty_of_mem_parts _ (hA hx), ⟨_, hy⟩, nonempty_of_mem_parts _ (hB hy)] [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts ⊢ |(∑ ab in Finset.product A B, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card A) * ↑(Finset.card B)) - ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id))| ≤ ε ^ 5 / 49 [PROOFSTEP] rw [abs_sub_le_iff] [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts ⊢ (∑ ab in Finset.product A B, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card A) * ↑(Finset.card B)) - ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ ε ^ 5 / 49 ∧ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - (∑ ab in Finset.product A B, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card A) * ↑(Finset.card B)) ≤ ε ^ 5 / 49 [PROOFSTEP] constructor [GOAL] case left α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts ⊢ (∑ ab in Finset.product A B, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card A) * ↑(Finset.card B)) - ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) ≤ ε ^ 5 / 49 [PROOFSTEP] rw [sub_le_iff_le_add'] [GOAL] case left α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts ⊢ (∑ ab in Finset.product A B, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card A) * ↑(Finset.card B)) ≤ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) + ε ^ 5 / 49 [PROOFSTEP] exact sum_density_div_card_le_density_add_eps hPα hPε hε₁ hA hB [GOAL] case right α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts ⊢ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - (∑ ab in Finset.product A B, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card A) * ↑(Finset.card B)) ≤ ε ^ 5 / 49 [PROOFSTEP] suffices (G.edgeDensity (A.biUnion id) (B.biUnion id) : ℝ) - (∑ ab in A.product B, (G.edgeDensity ab.1 ab.2 : ℝ)) / (A.card * B.card) ≤ ε ^ 5 / 50 by apply this.trans exact div_le_div_of_le_left (by sz_positivity) (by norm_num) (by norm_num) [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - (∑ ab in Finset.product A B, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card A) * ↑(Finset.card B)) ≤ ε ^ 5 / 50 ⊢ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - (∑ ab in Finset.product A B, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card A) * ↑(Finset.card B)) ≤ ε ^ 5 / 49 [PROOFSTEP] apply this.trans [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - (∑ ab in Finset.product A B, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card A) * ↑(Finset.card B)) ≤ ε ^ 5 / 50 ⊢ ε ^ 5 / 50 ≤ ε ^ 5 / 49 [PROOFSTEP] exact div_le_div_of_le_left (by sz_positivity) (by norm_num) (by norm_num) [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - (∑ ab in Finset.product A B, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card A) * ↑(Finset.card B)) ≤ ε ^ 5 / 50 ⊢ 0 ≤ ε ^ 5 [PROOFSTEP] sz_positivity [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - (∑ ab in Finset.product A B, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card A) * ↑(Finset.card B)) ≤ ε ^ 5 / 50 ⊢ 0 < 49 [PROOFSTEP] norm_num [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts this : ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - (∑ ab in Finset.product A B, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card A) * ↑(Finset.card B)) ≤ ε ^ 5 / 50 ⊢ 49 ≤ 50 [PROOFSTEP] norm_num [GOAL] case right α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts ⊢ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - (∑ ab in Finset.product A B, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card A) * ↑(Finset.card B)) ≤ ε ^ 5 / 50 [PROOFSTEP] rw [sub_le_iff_le_add, ← sub_le_iff_le_add'] [GOAL] case right α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts A B : Finset (Finset α) hA : A ⊆ (chunk hP G ε hU).parts hB : B ⊆ (chunk hP G ε hV).parts ⊢ ↑(SimpleGraph.edgeDensity G (Finset.biUnion A id) (Finset.biUnion B id)) - ε ^ 5 / 50 ≤ (∑ ab in Finset.product A B, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card A) * ↑(Finset.card B)) [PROOFSTEP] apply density_sub_eps_le_sum_density_div_card hPα hPε hA hB [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts ⊢ ↑(SimpleGraph.edgeDensity G U V) ^ 2 - ε ^ 5 / 25 ≤ ((∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / 16 ^ Finset.card P.parts) ^ 2 [PROOFSTEP] obtain hGε | hGε := le_total (G.edgeDensity U V : ℝ) (ε ^ 5 / 50) [GOAL] case inl α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts hGε : ↑(SimpleGraph.edgeDensity G U V) ≤ ε ^ 5 / 50 ⊢ ↑(SimpleGraph.edgeDensity G U V) ^ 2 - ε ^ 5 / 25 ≤ ((∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / 16 ^ Finset.card P.parts) ^ 2 [PROOFSTEP] refine' (sub_nonpos_of_le <| (sq_le _ _).trans <| hGε.trans _).trans (sq_nonneg _) [GOAL] case inl.refine'_1 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts hGε : ↑(SimpleGraph.edgeDensity G U V) ≤ ε ^ 5 / 50 ⊢ 0 ≤ ↑(SimpleGraph.edgeDensity G U V) [PROOFSTEP] exact_mod_cast G.edgeDensity_nonneg _ _ [GOAL] case inl.refine'_2 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts hGε : ↑(SimpleGraph.edgeDensity G U V) ≤ ε ^ 5 / 50 ⊢ ↑(SimpleGraph.edgeDensity G U V) ≤ 1 [PROOFSTEP] exact_mod_cast G.edgeDensity_le_one _ _ [GOAL] case inl.refine'_3 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts hGε : ↑(SimpleGraph.edgeDensity G U V) ≤ ε ^ 5 / 50 ⊢ ε ^ 5 / 50 ≤ ε ^ 5 / 25 [PROOFSTEP] exact div_le_div_of_le_left (by sz_positivity) (by norm_num) (by norm_num) [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts hGε : ↑(SimpleGraph.edgeDensity G U V) ≤ ε ^ 5 / 50 ⊢ 0 ≤ ε ^ 5 [PROOFSTEP] sz_positivity [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts hGε : ↑(SimpleGraph.edgeDensity G U V) ≤ ε ^ 5 / 50 ⊢ 0 < 25 [PROOFSTEP] norm_num [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts hGε : ↑(SimpleGraph.edgeDensity G U V) ≤ ε ^ 5 / 50 ⊢ 25 ≤ 50 [PROOFSTEP] norm_num [GOAL] case inr α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts hGε : ε ^ 5 / 50 ≤ ↑(SimpleGraph.edgeDensity G U V) ⊢ ↑(SimpleGraph.edgeDensity G U V) ^ 2 - ε ^ 5 / 25 ≤ ((∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / 16 ^ Finset.card P.parts) ^ 2 [PROOFSTEP] rw [← sub_nonneg] at hGε [GOAL] case inr α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts hGε✝ : ε ^ 5 / 50 ≤ ↑(SimpleGraph.edgeDensity G U V) hGε : 0 ≤ ↑(SimpleGraph.edgeDensity G U V) - ε ^ 5 / 50 ⊢ ↑(SimpleGraph.edgeDensity G U V) ^ 2 - ε ^ 5 / 25 ≤ ((∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / 16 ^ Finset.card P.parts) ^ 2 [PROOFSTEP] have : ↑(G.edgeDensity U V) - ε ^ 5 / ↑50 ≤ (∑ ab in (chunk hP G ε hU).parts.product (chunk hP G ε hV).parts, (G.edgeDensity ab.1 ab.2 : ℝ)) / ↑16 ^ P.parts.card := by have rflU := Set.Subset.refl (chunk hP G ε hU).parts.toSet have rflV := Set.Subset.refl (chunk hP G ε hV).parts.toSet refine' (le_trans _ <| density_sub_eps_le_sum_density_div_card hPα hPε rflU rflV).trans _ · rw [biUnion_parts, biUnion_parts] · rw [card_chunk (m_pos hPα).ne', card_chunk (m_pos hPα).ne', ← cast_mul, ← mul_pow, cast_pow] norm_cast [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts hGε✝ : ε ^ 5 / 50 ≤ ↑(SimpleGraph.edgeDensity G U V) hGε : 0 ≤ ↑(SimpleGraph.edgeDensity G U V) - ε ^ 5 / 50 ⊢ ↑(SimpleGraph.edgeDensity G U V) - ε ^ 5 / 50 ≤ (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / 16 ^ Finset.card P.parts [PROOFSTEP] have rflU := Set.Subset.refl (chunk hP G ε hU).parts.toSet [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts hGε✝ : ε ^ 5 / 50 ≤ ↑(SimpleGraph.edgeDensity G U V) hGε : 0 ≤ ↑(SimpleGraph.edgeDensity G U V) - ε ^ 5 / 50 rflU : ↑(chunk hP G ε hU).parts ⊆ ↑(chunk hP G ε hU).parts ⊢ ↑(SimpleGraph.edgeDensity G U V) - ε ^ 5 / 50 ≤ (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / 16 ^ Finset.card P.parts [PROOFSTEP] have rflV := Set.Subset.refl (chunk hP G ε hV).parts.toSet [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts hGε✝ : ε ^ 5 / 50 ≤ ↑(SimpleGraph.edgeDensity G U V) hGε : 0 ≤ ↑(SimpleGraph.edgeDensity G U V) - ε ^ 5 / 50 rflU : ↑(chunk hP G ε hU).parts ⊆ ↑(chunk hP G ε hU).parts rflV : ↑(chunk hP G ε hV).parts ⊆ ↑(chunk hP G ε hV).parts ⊢ ↑(SimpleGraph.edgeDensity G U V) - ε ^ 5 / 50 ≤ (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / 16 ^ Finset.card P.parts [PROOFSTEP] refine' (le_trans _ <| density_sub_eps_le_sum_density_div_card hPα hPε rflU rflV).trans _ [GOAL] case refine'_1 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts hGε✝ : ε ^ 5 / 50 ≤ ↑(SimpleGraph.edgeDensity G U V) hGε : 0 ≤ ↑(SimpleGraph.edgeDensity G U V) - ε ^ 5 / 50 rflU : ↑(chunk hP G ε hU).parts ⊆ ↑(chunk hP G ε hU).parts rflV : ↑(chunk hP G ε hV).parts ⊆ ↑(chunk hP G ε hV).parts ⊢ ↑(SimpleGraph.edgeDensity G U V) - ε ^ 5 / 50 ≤ ↑(SimpleGraph.edgeDensity G (Finset.biUnion (chunk hP G ε hU).parts id) (Finset.biUnion (chunk hP G ε hV).parts id)) - ε ^ 5 / 50 [PROOFSTEP] rw [biUnion_parts, biUnion_parts] [GOAL] case refine'_2 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts hGε✝ : ε ^ 5 / 50 ≤ ↑(SimpleGraph.edgeDensity G U V) hGε : 0 ≤ ↑(SimpleGraph.edgeDensity G U V) - ε ^ 5 / 50 rflU : ↑(chunk hP G ε hU).parts ⊆ ↑(chunk hP G ε hU).parts rflV : ↑(chunk hP G ε hV).parts ⊆ ↑(chunk hP G ε hV).parts ⊢ (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card (chunk hP G ε hU).parts) * ↑(Finset.card (chunk hP G ε hV).parts)) ≤ (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / 16 ^ Finset.card P.parts [PROOFSTEP] rw [card_chunk (m_pos hPα).ne', card_chunk (m_pos hPα).ne', ← cast_mul, ← mul_pow, cast_pow] [GOAL] case refine'_2 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts hGε✝ : ε ^ 5 / 50 ≤ ↑(SimpleGraph.edgeDensity G U V) hGε : 0 ≤ ↑(SimpleGraph.edgeDensity G U V) - ε ^ 5 / 50 rflU : ↑(chunk hP G ε hU).parts ⊆ ↑(chunk hP G ε hU).parts rflV : ↑(chunk hP G ε hV).parts ⊆ ↑(chunk hP G ε hV).parts ⊢ (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / ↑(4 * 4) ^ Finset.card P.parts ≤ (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / 16 ^ Finset.card P.parts [PROOFSTEP] norm_cast [GOAL] case inr α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts hGε✝ : ε ^ 5 / 50 ≤ ↑(SimpleGraph.edgeDensity G U V) hGε : 0 ≤ ↑(SimpleGraph.edgeDensity G U V) - ε ^ 5 / 50 this : ↑(SimpleGraph.edgeDensity G U V) - ε ^ 5 / 50 ≤ (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / 16 ^ Finset.card P.parts ⊢ ↑(SimpleGraph.edgeDensity G U V) ^ 2 - ε ^ 5 / 25 ≤ ((∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / 16 ^ Finset.card P.parts) ^ 2 [PROOFSTEP] refine' le_trans _ (pow_le_pow_of_le_left hGε this 2) [GOAL] case inr α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts hGε✝ : ε ^ 5 / 50 ≤ ↑(SimpleGraph.edgeDensity G U V) hGε : 0 ≤ ↑(SimpleGraph.edgeDensity G U V) - ε ^ 5 / 50 this : ↑(SimpleGraph.edgeDensity G U V) - ε ^ 5 / 50 ≤ (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / 16 ^ Finset.card P.parts ⊢ ↑(SimpleGraph.edgeDensity G U V) ^ 2 - ε ^ 5 / 25 ≤ (↑(SimpleGraph.edgeDensity G U V) - ε ^ 5 / 50) ^ 2 [PROOFSTEP] rw [sub_sq, sub_add, sub_le_sub_iff_left] [GOAL] case inr α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts hGε✝ : ε ^ 5 / 50 ≤ ↑(SimpleGraph.edgeDensity G U V) hGε : 0 ≤ ↑(SimpleGraph.edgeDensity G U V) - ε ^ 5 / 50 this : ↑(SimpleGraph.edgeDensity G U V) - ε ^ 5 / 50 ≤ (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / 16 ^ Finset.card P.parts ⊢ 2 * ↑(SimpleGraph.edgeDensity G U V) * (ε ^ 5 / 50) - (ε ^ 5 / 50) ^ 2 ≤ ε ^ 5 / 25 [PROOFSTEP] refine' (sub_le_self _ <| sq_nonneg <| ε ^ 5 / 50).trans _ [GOAL] case inr α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts hGε✝ : ε ^ 5 / 50 ≤ ↑(SimpleGraph.edgeDensity G U V) hGε : 0 ≤ ↑(SimpleGraph.edgeDensity G U V) - ε ^ 5 / 50 this : ↑(SimpleGraph.edgeDensity G U V) - ε ^ 5 / 50 ≤ (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / 16 ^ Finset.card P.parts ⊢ 2 * ↑(SimpleGraph.edgeDensity G U V) * (ε ^ 5 / 50) ≤ ε ^ 5 / 25 [PROOFSTEP] rw [mul_right_comm, mul_div_left_comm, div_eq_mul_inv (ε ^ 5), show (2 : ℝ) / 50 = 25⁻¹ by norm_num] [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts hGε✝ : ε ^ 5 / 50 ≤ ↑(SimpleGraph.edgeDensity G U V) hGε : 0 ≤ ↑(SimpleGraph.edgeDensity G U V) - ε ^ 5 / 50 this : ↑(SimpleGraph.edgeDensity G U V) - ε ^ 5 / 50 ≤ (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / 16 ^ Finset.card P.parts ⊢ 2 / 50 = 25⁻¹ [PROOFSTEP] norm_num [GOAL] case inr α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts hGε✝ : ε ^ 5 / 50 ≤ ↑(SimpleGraph.edgeDensity G U V) hGε : 0 ≤ ↑(SimpleGraph.edgeDensity G U V) - ε ^ 5 / 50 this : ↑(SimpleGraph.edgeDensity G U V) - ε ^ 5 / 50 ≤ (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / 16 ^ Finset.card P.parts ⊢ ε ^ 5 * 25⁻¹ * ↑(SimpleGraph.edgeDensity G U V) ≤ ε ^ 5 * 25⁻¹ [PROOFSTEP] exact mul_le_of_le_one_right (by sz_positivity) (by exact_mod_cast G.edgeDensity_le_one _ _) [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts hGε✝ : ε ^ 5 / 50 ≤ ↑(SimpleGraph.edgeDensity G U V) hGε : 0 ≤ ↑(SimpleGraph.edgeDensity G U V) - ε ^ 5 / 50 this : ↑(SimpleGraph.edgeDensity G U V) - ε ^ 5 / 50 ≤ (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / 16 ^ Finset.card P.parts ⊢ 0 ≤ ε ^ 5 * 25⁻¹ [PROOFSTEP] sz_positivity [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts hGε✝ : ε ^ 5 / 50 ≤ ↑(SimpleGraph.edgeDensity G U V) hGε : 0 ≤ ↑(SimpleGraph.edgeDensity G U V) - ε ^ 5 / 50 this : ↑(SimpleGraph.edgeDensity G U V) - ε ^ 5 / 50 ≤ (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / 16 ^ Finset.card P.parts ⊢ ↑(SimpleGraph.edgeDensity G U V) ≤ 1 [PROOFSTEP] exact_mod_cast G.edgeDensity_le_one _ _ [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUV' : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V ⊢ |↑(SimpleGraph.edgeDensity G (Finset.biUnion (star hP G ε hU V) id) (Finset.biUnion (star hP G ε hV U) id)) - ↑(SimpleGraph.edgeDensity G (SimpleGraph.nonuniformWitness G ε U V) (SimpleGraph.nonuniformWitness G ε V U))| ≤ ε / 5 [PROOFSTEP] convert abs_edgeDensity_sub_edgeDensity_le_two_mul G.Adj (biUnion_star_subset_nonuniformWitness hP G ε hU V) (biUnion_star_subset_nonuniformWitness hP G ε hV U) (by sz_positivity) (one_sub_eps_mul_card_nonuniformWitness_le_card_star hV hUV' hUV hPε hε₁) (one_sub_eps_mul_card_nonuniformWitness_le_card_star hU hUV'.symm (fun hVU => hUV hVU.symm) hPε hε₁) using 1 [GOAL] α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUV' : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V ⊢ 0 ≤ ε / 10 [PROOFSTEP] sz_positivity [GOAL] case h.e'_4 α : Type u_1 inst✝ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUV' : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V ⊢ ε / 5 = 2 * (ε / 10) [PROOFSTEP] linarith [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V ⊢ 4 / 5 * ε ≤ ↑(Finset.card (star hP G ε hU V)) / 4 ^ Finset.card P.parts [PROOFSTEP] have hm : (0 : ℝ) ≤ 1 - (↑m)⁻¹ := sub_nonneg_of_le (inv_le_one <| one_le_m_coe hPα) [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hm : 0 ≤ 1 - (↑(Fintype.card α / stepBound (Finset.card P.parts)))⁻¹ ⊢ 4 / 5 * ε ≤ ↑(Finset.card (star hP G ε hU V)) / 4 ^ Finset.card P.parts [PROOFSTEP] have hε : 0 ≤ 1 - ε / 10 := sub_nonneg_of_le (div_le_one_of_le (hε₁.trans <| by norm_num) <| by norm_num) [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hm : 0 ≤ 1 - (↑(Fintype.card α / stepBound (Finset.card P.parts)))⁻¹ ⊢ 1 ≤ 10 [PROOFSTEP] norm_num [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hm : 0 ≤ 1 - (↑(Fintype.card α / stepBound (Finset.card P.parts)))⁻¹ ⊢ 0 ≤ 10 [PROOFSTEP] norm_num [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hm : 0 ≤ 1 - (↑(Fintype.card α / stepBound (Finset.card P.parts)))⁻¹ hε : 0 ≤ 1 - ε / 10 ⊢ 4 / 5 * ε ≤ ↑(Finset.card (star hP G ε hU V)) / 4 ^ Finset.card P.parts [PROOFSTEP] calc 4 / 5 * ε = (1 - 1 / 10) * (1 - 9⁻¹) * ε := by norm_num _ ≤ (1 - ε / 10) * (1 - (↑m)⁻¹) * ((G.nonuniformWitness ε U V).card / U.card) := (mul_le_mul (mul_le_mul (sub_le_sub_left (div_le_div_of_le_of_nonneg hε₁ <| by norm_num) _) (sub_le_sub_left (inv_le_inv_of_le (by norm_num) <| by exact_mod_cast (show 9 ≤ 100 by norm_num).trans (hundred_le_m hPα hPε hε₁)) _) (by norm_num) hε) ((le_div_iff' <| (@cast_pos ℝ _ _ _).2 (P.nonempty_of_mem_parts hU).card_pos).2 <| G.le_card_nonuniformWitness hunif) (by sz_positivity) (by positivity)) _ = (1 - ε / 10) * (G.nonuniformWitness ε U V).card * ((1 - (↑m)⁻¹) / U.card) := by rw [mul_assoc, mul_assoc, mul_div_left_comm] _ ≤ ((star hP G ε hU V).biUnion id).card * ((1 - (↑m)⁻¹) / U.card) := (mul_le_mul_of_nonneg_right (one_sub_eps_mul_card_nonuniformWitness_le_card_star hV hUV hunif hPε hε₁) (by positivity)) _ ≤ (star hP G ε hU V).card * (m + 1) * ((1 - (↑m)⁻¹) / U.card) := (mul_le_mul_of_nonneg_right card_biUnion_star_le_m_add_one_card_star_mul (by positivity)) _ ≤ (star hP G ε hU V).card * (m + ↑1) * ((↑1 - (↑m)⁻¹) / (↑4 ^ P.parts.card * m)) := (mul_le_mul_of_nonneg_left (div_le_div_of_le_left hm (by sz_positivity) <| pow_mul_m_le_card_part hP hU) (by positivity)) _ ≤ (star hP G ε hU V).card / ↑4 ^ P.parts.card := by rw [mul_assoc, mul_comm ((4 : ℝ) ^ P.parts.card), ← div_div, ← mul_div_assoc, ← mul_comm_div] refine' mul_le_of_le_one_right (by positivity) _ have hm : (0 : ℝ) < m := by sz_positivity rw [mul_div_assoc', div_le_one hm, ← one_div, one_sub_div hm.ne', mul_div_assoc', div_le_iff hm] linarith [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hm : 0 ≤ 1 - (↑(Fintype.card α / stepBound (Finset.card P.parts)))⁻¹ hε : 0 ≤ 1 - ε / 10 ⊢ 4 / 5 * ε = (1 - 1 / 10) * (1 - 9⁻¹) * ε [PROOFSTEP] norm_num [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hm : 0 ≤ 1 - (↑(Fintype.card α / stepBound (Finset.card P.parts)))⁻¹ hε : 0 ≤ 1 - ε / 10 ⊢ 0 ≤ 10 [PROOFSTEP] norm_num [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hm : 0 ≤ 1 - (↑(Fintype.card α / stepBound (Finset.card P.parts)))⁻¹ hε : 0 ≤ 1 - ε / 10 ⊢ 0 < 9 [PROOFSTEP] norm_num [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hm : 0 ≤ 1 - (↑(Fintype.card α / stepBound (Finset.card P.parts)))⁻¹ hε : 0 ≤ 1 - ε / 10 ⊢ 9 ≤ ↑(Fintype.card α / stepBound (Finset.card P.parts)) [PROOFSTEP] exact_mod_cast (show 9 ≤ 100 by norm_num).trans (hundred_le_m hPα hPε hε₁) [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hm : 0 ≤ 1 - (↑(Fintype.card α / stepBound (Finset.card P.parts)))⁻¹ hε : 0 ≤ 1 - ε / 10 ⊢ 9 ≤ 100 [PROOFSTEP] norm_num [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hm : 0 ≤ 1 - (↑(Fintype.card α / stepBound (Finset.card P.parts)))⁻¹ hε : 0 ≤ 1 - ε / 10 ⊢ 0 ≤ 1 - 9⁻¹ [PROOFSTEP] norm_num [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hm : 0 ≤ 1 - (↑(Fintype.card α / stepBound (Finset.card P.parts)))⁻¹ hε : 0 ≤ 1 - ε / 10 ⊢ 0 ≤ ε [PROOFSTEP] sz_positivity [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hm : 0 ≤ 1 - (↑(Fintype.card α / stepBound (Finset.card P.parts)))⁻¹ hε : 0 ≤ 1 - ε / 10 ⊢ 0 ≤ (1 - ε / 10) * (1 - (↑(Fintype.card α / stepBound (Finset.card P.parts)))⁻¹) [PROOFSTEP] positivity [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hm : 0 ≤ 1 - (↑(Fintype.card α / stepBound (Finset.card P.parts)))⁻¹ hε : 0 ≤ 1 - ε / 10 ⊢ (1 - ε / 10) * (1 - (↑(Fintype.card α / stepBound (Finset.card P.parts)))⁻¹) * (↑(Finset.card (SimpleGraph.nonuniformWitness G ε U V)) / ↑(Finset.card U)) = (1 - ε / 10) * ↑(Finset.card (SimpleGraph.nonuniformWitness G ε U V)) * ((1 - (↑(Fintype.card α / stepBound (Finset.card P.parts)))⁻¹) / ↑(Finset.card U)) [PROOFSTEP] rw [mul_assoc, mul_assoc, mul_div_left_comm] [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hm : 0 ≤ 1 - (↑(Fintype.card α / stepBound (Finset.card P.parts)))⁻¹ hε : 0 ≤ 1 - ε / 10 ⊢ 0 ≤ (1 - (↑(Fintype.card α / stepBound (Finset.card P.parts)))⁻¹) / ↑(Finset.card U) [PROOFSTEP] positivity [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hm : 0 ≤ 1 - (↑(Fintype.card α / stepBound (Finset.card P.parts)))⁻¹ hε : 0 ≤ 1 - ε / 10 ⊢ 0 ≤ (1 - (↑(Fintype.card α / stepBound (Finset.card P.parts)))⁻¹) / ↑(Finset.card U) [PROOFSTEP] positivity [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hm : 0 ≤ 1 - (↑(Fintype.card α / stepBound (Finset.card P.parts)))⁻¹ hε : 0 ≤ 1 - ε / 10 ⊢ 0 < 4 ^ Finset.card P.parts * ↑(Fintype.card α / stepBound (Finset.card P.parts)) [PROOFSTEP] sz_positivity [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hm : 0 ≤ 1 - (↑(Fintype.card α / stepBound (Finset.card P.parts)))⁻¹ hε : 0 ≤ 1 - ε / 10 ⊢ 0 ≤ ↑(Finset.card (star hP G ε hU V)) * (↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1) [PROOFSTEP] positivity [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hm : 0 ≤ 1 - (↑(Fintype.card α / stepBound (Finset.card P.parts)))⁻¹ hε : 0 ≤ 1 - ε / 10 ⊢ ↑(Finset.card (star hP G ε hU V)) * (↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1) * ((1 - (↑(Fintype.card α / stepBound (Finset.card P.parts)))⁻¹) / (4 ^ Finset.card P.parts * ↑(Fintype.card α / stepBound (Finset.card P.parts)))) ≤ ↑(Finset.card (star hP G ε hU V)) / 4 ^ Finset.card P.parts [PROOFSTEP] rw [mul_assoc, mul_comm ((4 : ℝ) ^ P.parts.card), ← div_div, ← mul_div_assoc, ← mul_comm_div] [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hm : 0 ≤ 1 - (↑(Fintype.card α / stepBound (Finset.card P.parts)))⁻¹ hε : 0 ≤ 1 - ε / 10 ⊢ ↑(Finset.card (star hP G ε hU V)) / 4 ^ Finset.card P.parts * ((↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1) * ((1 - (↑(Fintype.card α / stepBound (Finset.card P.parts)))⁻¹) / ↑(Fintype.card α / stepBound (Finset.card P.parts)))) ≤ ↑(Finset.card (star hP G ε hU V)) / 4 ^ Finset.card P.parts [PROOFSTEP] refine' mul_le_of_le_one_right (by positivity) _ [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hm : 0 ≤ 1 - (↑(Fintype.card α / stepBound (Finset.card P.parts)))⁻¹ hε : 0 ≤ 1 - ε / 10 ⊢ 0 ≤ ↑(Finset.card (star hP G ε hU V)) / 4 ^ Finset.card P.parts [PROOFSTEP] positivity [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hm : 0 ≤ 1 - (↑(Fintype.card α / stepBound (Finset.card P.parts)))⁻¹ hε : 0 ≤ 1 - ε / 10 ⊢ (↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1) * ((1 - (↑(Fintype.card α / stepBound (Finset.card P.parts)))⁻¹) / ↑(Fintype.card α / stepBound (Finset.card P.parts))) ≤ 1 [PROOFSTEP] have hm : (0 : ℝ) < m := by sz_positivity [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hm : 0 ≤ 1 - (↑(Fintype.card α / stepBound (Finset.card P.parts)))⁻¹ hε : 0 ≤ 1 - ε / 10 ⊢ 0 < ↑(Fintype.card α / stepBound (Finset.card P.parts)) [PROOFSTEP] sz_positivity [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hm✝ : 0 ≤ 1 - (↑(Fintype.card α / stepBound (Finset.card P.parts)))⁻¹ hε : 0 ≤ 1 - ε / 10 hm : 0 < ↑(Fintype.card α / stepBound (Finset.card P.parts)) ⊢ (↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1) * ((1 - (↑(Fintype.card α / stepBound (Finset.card P.parts)))⁻¹) / ↑(Fintype.card α / stepBound (Finset.card P.parts))) ≤ 1 [PROOFSTEP] rw [mul_div_assoc', div_le_one hm, ← one_div, one_sub_div hm.ne', mul_div_assoc', div_le_iff hm] [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUV : U ≠ V hunif : ¬SimpleGraph.IsUniform G ε U V hm✝ : 0 ≤ 1 - (↑(Fintype.card α / stepBound (Finset.card P.parts)))⁻¹ hε : 0 ≤ 1 - ε / 10 hm : 0 < ↑(Fintype.card α / stepBound (Finset.card P.parts)) ⊢ (↑(Fintype.card α / stepBound (Finset.card P.parts)) + 1) * (↑(Fintype.card α / stepBound (Finset.card P.parts)) - 1) ≤ ↑(Fintype.card α / stepBound (Finset.card P.parts)) * ↑(Fintype.card α / stepBound (Finset.card P.parts)) [PROOFSTEP] linarith [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V ⊢ 3 / 4 * ε ≤ |(∑ ab in Finset.product (star hP G ε hU V) (star hP G ε hV U), ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card (star hP G ε hU V)) * ↑(Finset.card (star hP G ε hV U))) - (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / 16 ^ Finset.card P.parts| [PROOFSTEP] rw [show (16 : ℝ) = ↑4 ^ 2 by norm_num, pow_right_comm, sq ((4 : ℝ) ^ _)] [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V ⊢ 16 = 4 ^ 2 [PROOFSTEP] norm_num [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V ⊢ 3 / 4 * ε ≤ |(∑ ab in Finset.product (star hP G ε hU V) (star hP G ε hV U), ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card (star hP G ε hU V)) * ↑(Finset.card (star hP G ε hV U))) - (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (4 ^ Finset.card P.parts * 4 ^ Finset.card P.parts)| [PROOFSTEP] set p : ℝ := (∑ ab in (star hP G ε hU V).product (star hP G ε hV U), (G.edgeDensity ab.1 ab.2 : ℝ)) / ((star hP G ε hU V).card * (star hP G ε hV U).card) [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V p : ℝ := (∑ ab in Finset.product (star hP G ε hU V) (star hP G ε hV U), ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card (star hP G ε hU V)) * ↑(Finset.card (star hP G ε hV U))) ⊢ 3 / 4 * ε ≤ |p - (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (4 ^ Finset.card P.parts * 4 ^ Finset.card P.parts)| [PROOFSTEP] set q : ℝ := (∑ ab in (chunk hP G ε hU).parts.product (chunk hP G ε hV).parts, (G.edgeDensity ab.1 ab.2 : ℝ)) / (↑4 ^ P.parts.card * ↑4 ^ P.parts.card) [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V p : ℝ := (∑ ab in Finset.product (star hP G ε hU V) (star hP G ε hV U), ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card (star hP G ε hU V)) * ↑(Finset.card (star hP G ε hV U))) q : ℝ := (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (4 ^ Finset.card P.parts * 4 ^ Finset.card P.parts) ⊢ 3 / 4 * ε ≤ |p - q| [PROOFSTEP] change _ ≤ |p - q| [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V p : ℝ := (∑ ab in Finset.product (star hP G ε hU V) (star hP G ε hV U), ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card (star hP G ε hU V)) * ↑(Finset.card (star hP G ε hV U))) q : ℝ := (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (4 ^ Finset.card P.parts * 4 ^ Finset.card P.parts) ⊢ 3 / 4 * ε ≤ |p - q| [PROOFSTEP] set r : ℝ := ↑(G.edgeDensity ((star hP G ε hU V).biUnion id) ((star hP G ε hV U).biUnion id)) [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V p : ℝ := (∑ ab in Finset.product (star hP G ε hU V) (star hP G ε hV U), ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card (star hP G ε hU V)) * ↑(Finset.card (star hP G ε hV U))) q : ℝ := (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (4 ^ Finset.card P.parts * 4 ^ Finset.card P.parts) r : ℝ := ↑(SimpleGraph.edgeDensity G (Finset.biUnion (star hP G ε hU V) id) (Finset.biUnion (star hP G ε hV U) id)) ⊢ 3 / 4 * ε ≤ |p - q| [PROOFSTEP] set s : ℝ := ↑(G.edgeDensity (G.nonuniformWitness ε U V) (G.nonuniformWitness ε V U)) [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s✝ : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V p : ℝ := (∑ ab in Finset.product (star hP G ε hU V) (star hP G ε hV U), ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card (star hP G ε hU V)) * ↑(Finset.card (star hP G ε hV U))) q : ℝ := (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (4 ^ Finset.card P.parts * 4 ^ Finset.card P.parts) r : ℝ := ↑(SimpleGraph.edgeDensity G (Finset.biUnion (star hP G ε hU V) id) (Finset.biUnion (star hP G ε hV U) id)) s : ℝ := ↑(SimpleGraph.edgeDensity G (SimpleGraph.nonuniformWitness G ε U V) (SimpleGraph.nonuniformWitness G ε V U)) ⊢ 3 / 4 * ε ≤ |p - q| [PROOFSTEP] set t : ℝ := ↑(G.edgeDensity U V) [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s✝ : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V p : ℝ := (∑ ab in Finset.product (star hP G ε hU V) (star hP G ε hV U), ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card (star hP G ε hU V)) * ↑(Finset.card (star hP G ε hV U))) q : ℝ := (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (4 ^ Finset.card P.parts * 4 ^ Finset.card P.parts) r : ℝ := ↑(SimpleGraph.edgeDensity G (Finset.biUnion (star hP G ε hU V) id) (Finset.biUnion (star hP G ε hV U) id)) s : ℝ := ↑(SimpleGraph.edgeDensity G (SimpleGraph.nonuniformWitness G ε U V) (SimpleGraph.nonuniformWitness G ε V U)) t : ℝ := ↑(SimpleGraph.edgeDensity G U V) ⊢ 3 / 4 * ε ≤ |p - q| [PROOFSTEP] have hrs : |r - s| ≤ ε / 5 := abs_density_star_sub_density_le_eps hPε hε₁ hUVne hUV [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s✝ : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V p : ℝ := (∑ ab in Finset.product (star hP G ε hU V) (star hP G ε hV U), ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card (star hP G ε hU V)) * ↑(Finset.card (star hP G ε hV U))) q : ℝ := (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (4 ^ Finset.card P.parts * 4 ^ Finset.card P.parts) r : ℝ := ↑(SimpleGraph.edgeDensity G (Finset.biUnion (star hP G ε hU V) id) (Finset.biUnion (star hP G ε hV U) id)) s : ℝ := ↑(SimpleGraph.edgeDensity G (SimpleGraph.nonuniformWitness G ε U V) (SimpleGraph.nonuniformWitness G ε V U)) t : ℝ := ↑(SimpleGraph.edgeDensity G U V) hrs : |r - s| ≤ ε / 5 ⊢ 3 / 4 * ε ≤ |p - q| [PROOFSTEP] have hst : ε ≤ |s - t| := by exact_mod_cast G.nonuniformWitness_spec hUVne hUV [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s✝ : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V p : ℝ := (∑ ab in Finset.product (star hP G ε hU V) (star hP G ε hV U), ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card (star hP G ε hU V)) * ↑(Finset.card (star hP G ε hV U))) q : ℝ := (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (4 ^ Finset.card P.parts * 4 ^ Finset.card P.parts) r : ℝ := ↑(SimpleGraph.edgeDensity G (Finset.biUnion (star hP G ε hU V) id) (Finset.biUnion (star hP G ε hV U) id)) s : ℝ := ↑(SimpleGraph.edgeDensity G (SimpleGraph.nonuniformWitness G ε U V) (SimpleGraph.nonuniformWitness G ε V U)) t : ℝ := ↑(SimpleGraph.edgeDensity G U V) hrs : |r - s| ≤ ε / 5 ⊢ ε ≤ |s - t| [PROOFSTEP] exact_mod_cast G.nonuniformWitness_spec hUVne hUV [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s✝ : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V p : ℝ := (∑ ab in Finset.product (star hP G ε hU V) (star hP G ε hV U), ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card (star hP G ε hU V)) * ↑(Finset.card (star hP G ε hV U))) q : ℝ := (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (4 ^ Finset.card P.parts * 4 ^ Finset.card P.parts) r : ℝ := ↑(SimpleGraph.edgeDensity G (Finset.biUnion (star hP G ε hU V) id) (Finset.biUnion (star hP G ε hV U) id)) s : ℝ := ↑(SimpleGraph.edgeDensity G (SimpleGraph.nonuniformWitness G ε U V) (SimpleGraph.nonuniformWitness G ε V U)) t : ℝ := ↑(SimpleGraph.edgeDensity G U V) hrs : |r - s| ≤ ε / 5 hst : ε ≤ |s - t| ⊢ 3 / 4 * ε ≤ |p - q| [PROOFSTEP] have hpr : |p - r| ≤ ε ^ 5 / 49 := average_density_near_total_density hPα hPε hε₁ star_subset_chunk star_subset_chunk [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s✝ : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V p : ℝ := (∑ ab in Finset.product (star hP G ε hU V) (star hP G ε hV U), ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card (star hP G ε hU V)) * ↑(Finset.card (star hP G ε hV U))) q : ℝ := (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (4 ^ Finset.card P.parts * 4 ^ Finset.card P.parts) r : ℝ := ↑(SimpleGraph.edgeDensity G (Finset.biUnion (star hP G ε hU V) id) (Finset.biUnion (star hP G ε hV U) id)) s : ℝ := ↑(SimpleGraph.edgeDensity G (SimpleGraph.nonuniformWitness G ε U V) (SimpleGraph.nonuniformWitness G ε V U)) t : ℝ := ↑(SimpleGraph.edgeDensity G U V) hrs : |r - s| ≤ ε / 5 hst : ε ≤ |s - t| hpr : |p - r| ≤ ε ^ 5 / 49 ⊢ 3 / 4 * ε ≤ |p - q| [PROOFSTEP] have hqt : |q - t| ≤ ε ^ 5 / 49 := by have := average_density_near_total_density hPα hPε hε₁ (Subset.refl (chunk hP G ε hU).parts) (Subset.refl (chunk hP G ε hV).parts) simp_rw [← sup_eq_biUnion, supParts, card_chunk (m_pos hPα).ne', cast_pow] at this norm_num at this exact this [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s✝ : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V p : ℝ := (∑ ab in Finset.product (star hP G ε hU V) (star hP G ε hV U), ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card (star hP G ε hU V)) * ↑(Finset.card (star hP G ε hV U))) q : ℝ := (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (4 ^ Finset.card P.parts * 4 ^ Finset.card P.parts) r : ℝ := ↑(SimpleGraph.edgeDensity G (Finset.biUnion (star hP G ε hU V) id) (Finset.biUnion (star hP G ε hV U) id)) s : ℝ := ↑(SimpleGraph.edgeDensity G (SimpleGraph.nonuniformWitness G ε U V) (SimpleGraph.nonuniformWitness G ε V U)) t : ℝ := ↑(SimpleGraph.edgeDensity G U V) hrs : |r - s| ≤ ε / 5 hst : ε ≤ |s - t| hpr : |p - r| ≤ ε ^ 5 / 49 ⊢ |q - t| ≤ ε ^ 5 / 49 [PROOFSTEP] have := average_density_near_total_density hPα hPε hε₁ (Subset.refl (chunk hP G ε hU).parts) (Subset.refl (chunk hP G ε hV).parts) [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s✝ : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V p : ℝ := (∑ ab in Finset.product (star hP G ε hU V) (star hP G ε hV U), ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card (star hP G ε hU V)) * ↑(Finset.card (star hP G ε hV U))) q : ℝ := (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (4 ^ Finset.card P.parts * 4 ^ Finset.card P.parts) r : ℝ := ↑(SimpleGraph.edgeDensity G (Finset.biUnion (star hP G ε hU V) id) (Finset.biUnion (star hP G ε hV U) id)) s : ℝ := ↑(SimpleGraph.edgeDensity G (SimpleGraph.nonuniformWitness G ε U V) (SimpleGraph.nonuniformWitness G ε V U)) t : ℝ := ↑(SimpleGraph.edgeDensity G U V) hrs : |r - s| ≤ ε / 5 hst : ε ≤ |s - t| hpr : |p - r| ≤ ε ^ 5 / 49 this : |(∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card (chunk hP G ε hU).parts) * ↑(Finset.card (chunk hP G ε hV).parts)) - ↑(SimpleGraph.edgeDensity G (Finset.biUnion (chunk hP G ε hU).parts id) (Finset.biUnion (chunk hP G ε hV).parts id))| ≤ ε ^ 5 / 49 ⊢ |q - t| ≤ ε ^ 5 / 49 [PROOFSTEP] simp_rw [← sup_eq_biUnion, supParts, card_chunk (m_pos hPα).ne', cast_pow] at this [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s✝ : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V p : ℝ := (∑ ab in Finset.product (star hP G ε hU V) (star hP G ε hV U), ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card (star hP G ε hU V)) * ↑(Finset.card (star hP G ε hV U))) q : ℝ := (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (4 ^ Finset.card P.parts * 4 ^ Finset.card P.parts) r : ℝ := ↑(SimpleGraph.edgeDensity G (Finset.biUnion (star hP G ε hU V) id) (Finset.biUnion (star hP G ε hV U) id)) s : ℝ := ↑(SimpleGraph.edgeDensity G (SimpleGraph.nonuniformWitness G ε U V) (SimpleGraph.nonuniformWitness G ε V U)) t : ℝ := ↑(SimpleGraph.edgeDensity G U V) hrs : |r - s| ≤ ε / 5 hst : ε ≤ |s - t| hpr : |p - r| ≤ ε ^ 5 / 49 this : |(∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑4 ^ Finset.card P.parts * ↑4 ^ Finset.card P.parts) - ↑(SimpleGraph.edgeDensity G U V)| ≤ ε ^ 5 / 49 ⊢ |q - t| ≤ ε ^ 5 / 49 [PROOFSTEP] norm_num at this [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s✝ : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V p : ℝ := (∑ ab in Finset.product (star hP G ε hU V) (star hP G ε hV U), ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card (star hP G ε hU V)) * ↑(Finset.card (star hP G ε hV U))) q : ℝ := (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (4 ^ Finset.card P.parts * 4 ^ Finset.card P.parts) r : ℝ := ↑(SimpleGraph.edgeDensity G (Finset.biUnion (star hP G ε hU V) id) (Finset.biUnion (star hP G ε hV U) id)) s : ℝ := ↑(SimpleGraph.edgeDensity G (SimpleGraph.nonuniformWitness G ε U V) (SimpleGraph.nonuniformWitness G ε V U)) t : ℝ := ↑(SimpleGraph.edgeDensity G U V) hrs : |r - s| ≤ ε / 5 hst : ε ≤ |s - t| hpr : |p - r| ≤ ε ^ 5 / 49 this : |(∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (4 ^ Finset.card P.parts * 4 ^ Finset.card P.parts) - ↑(SimpleGraph.edgeDensity G U V)| ≤ ε ^ 5 / 49 ⊢ |q - t| ≤ ε ^ 5 / 49 [PROOFSTEP] exact this [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s✝ : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V p : ℝ := (∑ ab in Finset.product (star hP G ε hU V) (star hP G ε hV U), ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card (star hP G ε hU V)) * ↑(Finset.card (star hP G ε hV U))) q : ℝ := (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (4 ^ Finset.card P.parts * 4 ^ Finset.card P.parts) r : ℝ := ↑(SimpleGraph.edgeDensity G (Finset.biUnion (star hP G ε hU V) id) (Finset.biUnion (star hP G ε hV U) id)) s : ℝ := ↑(SimpleGraph.edgeDensity G (SimpleGraph.nonuniformWitness G ε U V) (SimpleGraph.nonuniformWitness G ε V U)) t : ℝ := ↑(SimpleGraph.edgeDensity G U V) hrs : |r - s| ≤ ε / 5 hst : ε ≤ |s - t| hpr : |p - r| ≤ ε ^ 5 / 49 hqt : |q - t| ≤ ε ^ 5 / 49 ⊢ 3 / 4 * ε ≤ |p - q| [PROOFSTEP] have hε' : ε ^ 5 ≤ ε := by simpa using pow_le_pow_of_le_one (by sz_positivity) hε₁ (show 1 ≤ 5 by norm_num) [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s✝ : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V p : ℝ := (∑ ab in Finset.product (star hP G ε hU V) (star hP G ε hV U), ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card (star hP G ε hU V)) * ↑(Finset.card (star hP G ε hV U))) q : ℝ := (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (4 ^ Finset.card P.parts * 4 ^ Finset.card P.parts) r : ℝ := ↑(SimpleGraph.edgeDensity G (Finset.biUnion (star hP G ε hU V) id) (Finset.biUnion (star hP G ε hV U) id)) s : ℝ := ↑(SimpleGraph.edgeDensity G (SimpleGraph.nonuniformWitness G ε U V) (SimpleGraph.nonuniformWitness G ε V U)) t : ℝ := ↑(SimpleGraph.edgeDensity G U V) hrs : |r - s| ≤ ε / 5 hst : ε ≤ |s - t| hpr : |p - r| ≤ ε ^ 5 / 49 hqt : |q - t| ≤ ε ^ 5 / 49 ⊢ ε ^ 5 ≤ ε [PROOFSTEP] simpa using pow_le_pow_of_le_one (by sz_positivity) hε₁ (show 1 ≤ 5 by norm_num) [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s✝ : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V p : ℝ := (∑ ab in Finset.product (star hP G ε hU V) (star hP G ε hV U), ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card (star hP G ε hU V)) * ↑(Finset.card (star hP G ε hV U))) q : ℝ := (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (4 ^ Finset.card P.parts * 4 ^ Finset.card P.parts) r : ℝ := ↑(SimpleGraph.edgeDensity G (Finset.biUnion (star hP G ε hU V) id) (Finset.biUnion (star hP G ε hV U) id)) s : ℝ := ↑(SimpleGraph.edgeDensity G (SimpleGraph.nonuniformWitness G ε U V) (SimpleGraph.nonuniformWitness G ε V U)) t : ℝ := ↑(SimpleGraph.edgeDensity G U V) hrs : |r - s| ≤ ε / 5 hst : ε ≤ |s - t| hpr : |p - r| ≤ ε ^ 5 / 49 hqt : |q - t| ≤ ε ^ 5 / 49 ⊢ 0 ≤ ε [PROOFSTEP] sz_positivity [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s✝ : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V p : ℝ := (∑ ab in Finset.product (star hP G ε hU V) (star hP G ε hV U), ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card (star hP G ε hU V)) * ↑(Finset.card (star hP G ε hV U))) q : ℝ := (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (4 ^ Finset.card P.parts * 4 ^ Finset.card P.parts) r : ℝ := ↑(SimpleGraph.edgeDensity G (Finset.biUnion (star hP G ε hU V) id) (Finset.biUnion (star hP G ε hV U) id)) s : ℝ := ↑(SimpleGraph.edgeDensity G (SimpleGraph.nonuniformWitness G ε U V) (SimpleGraph.nonuniformWitness G ε V U)) t : ℝ := ↑(SimpleGraph.edgeDensity G U V) hrs : |r - s| ≤ ε / 5 hst : ε ≤ |s - t| hpr : |p - r| ≤ ε ^ 5 / 49 hqt : |q - t| ≤ ε ^ 5 / 49 ⊢ 1 ≤ 5 [PROOFSTEP] norm_num [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s✝ : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V p : ℝ := (∑ ab in Finset.product (star hP G ε hU V) (star hP G ε hV U), ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card (star hP G ε hU V)) * ↑(Finset.card (star hP G ε hV U))) q : ℝ := (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (4 ^ Finset.card P.parts * 4 ^ Finset.card P.parts) r : ℝ := ↑(SimpleGraph.edgeDensity G (Finset.biUnion (star hP G ε hU V) id) (Finset.biUnion (star hP G ε hV U) id)) s : ℝ := ↑(SimpleGraph.edgeDensity G (SimpleGraph.nonuniformWitness G ε U V) (SimpleGraph.nonuniformWitness G ε V U)) t : ℝ := ↑(SimpleGraph.edgeDensity G U V) hrs : |r - s| ≤ ε / 5 hst : ε ≤ |s - t| hpr : |p - r| ≤ ε ^ 5 / 49 hqt : |q - t| ≤ ε ^ 5 / 49 hε' : ε ^ 5 ≤ ε ⊢ 3 / 4 * ε ≤ |p - q| [PROOFSTEP] have hpr' : |p - r| ≤ ε / 49 := hpr.trans (div_le_div_of_le_of_nonneg hε' <| by norm_num) [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s✝ : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V p : ℝ := (∑ ab in Finset.product (star hP G ε hU V) (star hP G ε hV U), ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card (star hP G ε hU V)) * ↑(Finset.card (star hP G ε hV U))) q : ℝ := (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (4 ^ Finset.card P.parts * 4 ^ Finset.card P.parts) r : ℝ := ↑(SimpleGraph.edgeDensity G (Finset.biUnion (star hP G ε hU V) id) (Finset.biUnion (star hP G ε hV U) id)) s : ℝ := ↑(SimpleGraph.edgeDensity G (SimpleGraph.nonuniformWitness G ε U V) (SimpleGraph.nonuniformWitness G ε V U)) t : ℝ := ↑(SimpleGraph.edgeDensity G U V) hrs : |r - s| ≤ ε / 5 hst : ε ≤ |s - t| hpr : |p - r| ≤ ε ^ 5 / 49 hqt : |q - t| ≤ ε ^ 5 / 49 hε' : ε ^ 5 ≤ ε ⊢ 0 ≤ 49 [PROOFSTEP] norm_num [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s✝ : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V p : ℝ := (∑ ab in Finset.product (star hP G ε hU V) (star hP G ε hV U), ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card (star hP G ε hU V)) * ↑(Finset.card (star hP G ε hV U))) q : ℝ := (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (4 ^ Finset.card P.parts * 4 ^ Finset.card P.parts) r : ℝ := ↑(SimpleGraph.edgeDensity G (Finset.biUnion (star hP G ε hU V) id) (Finset.biUnion (star hP G ε hV U) id)) s : ℝ := ↑(SimpleGraph.edgeDensity G (SimpleGraph.nonuniformWitness G ε U V) (SimpleGraph.nonuniformWitness G ε V U)) t : ℝ := ↑(SimpleGraph.edgeDensity G U V) hrs : |r - s| ≤ ε / 5 hst : ε ≤ |s - t| hpr : |p - r| ≤ ε ^ 5 / 49 hqt : |q - t| ≤ ε ^ 5 / 49 hε' : ε ^ 5 ≤ ε hpr' : |p - r| ≤ ε / 49 ⊢ 3 / 4 * ε ≤ |p - q| [PROOFSTEP] have hqt' : |q - t| ≤ ε / 49 := hqt.trans (div_le_div_of_le_of_nonneg hε' <| by norm_num) [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s✝ : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V p : ℝ := (∑ ab in Finset.product (star hP G ε hU V) (star hP G ε hV U), ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card (star hP G ε hU V)) * ↑(Finset.card (star hP G ε hV U))) q : ℝ := (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (4 ^ Finset.card P.parts * 4 ^ Finset.card P.parts) r : ℝ := ↑(SimpleGraph.edgeDensity G (Finset.biUnion (star hP G ε hU V) id) (Finset.biUnion (star hP G ε hV U) id)) s : ℝ := ↑(SimpleGraph.edgeDensity G (SimpleGraph.nonuniformWitness G ε U V) (SimpleGraph.nonuniformWitness G ε V U)) t : ℝ := ↑(SimpleGraph.edgeDensity G U V) hrs : |r - s| ≤ ε / 5 hst : ε ≤ |s - t| hpr : |p - r| ≤ ε ^ 5 / 49 hqt : |q - t| ≤ ε ^ 5 / 49 hε' : ε ^ 5 ≤ ε hpr' : |p - r| ≤ ε / 49 ⊢ 0 ≤ 49 [PROOFSTEP] norm_num [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s✝ : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V p : ℝ := (∑ ab in Finset.product (star hP G ε hU V) (star hP G ε hV U), ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card (star hP G ε hU V)) * ↑(Finset.card (star hP G ε hV U))) q : ℝ := (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (4 ^ Finset.card P.parts * 4 ^ Finset.card P.parts) r : ℝ := ↑(SimpleGraph.edgeDensity G (Finset.biUnion (star hP G ε hU V) id) (Finset.biUnion (star hP G ε hV U) id)) s : ℝ := ↑(SimpleGraph.edgeDensity G (SimpleGraph.nonuniformWitness G ε U V) (SimpleGraph.nonuniformWitness G ε V U)) t : ℝ := ↑(SimpleGraph.edgeDensity G U V) hrs : |r - s| ≤ ε / 5 hst : ε ≤ |s - t| hpr : |p - r| ≤ ε ^ 5 / 49 hqt : |q - t| ≤ ε ^ 5 / 49 hε' : ε ^ 5 ≤ ε hpr' : |p - r| ≤ ε / 49 hqt' : |q - t| ≤ ε / 49 ⊢ 3 / 4 * ε ≤ |p - q| [PROOFSTEP] rw [abs_sub_le_iff] at hrs hpr' hqt' [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s✝ : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V p : ℝ := (∑ ab in Finset.product (star hP G ε hU V) (star hP G ε hV U), ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card (star hP G ε hU V)) * ↑(Finset.card (star hP G ε hV U))) q : ℝ := (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (4 ^ Finset.card P.parts * 4 ^ Finset.card P.parts) r : ℝ := ↑(SimpleGraph.edgeDensity G (Finset.biUnion (star hP G ε hU V) id) (Finset.biUnion (star hP G ε hV U) id)) s : ℝ := ↑(SimpleGraph.edgeDensity G (SimpleGraph.nonuniformWitness G ε U V) (SimpleGraph.nonuniformWitness G ε V U)) t : ℝ := ↑(SimpleGraph.edgeDensity G U V) hrs : r - s ≤ ε / 5 ∧ s - r ≤ ε / 5 hst : ε ≤ |s - t| hpr : |p - r| ≤ ε ^ 5 / 49 hqt : |q - t| ≤ ε ^ 5 / 49 hε' : ε ^ 5 ≤ ε hpr' : p - r ≤ ε / 49 ∧ r - p ≤ ε / 49 hqt' : q - t ≤ ε / 49 ∧ t - q ≤ ε / 49 ⊢ 3 / 4 * ε ≤ |p - q| [PROOFSTEP] rw [le_abs] at hst ⊢ [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s✝ : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V p : ℝ := (∑ ab in Finset.product (star hP G ε hU V) (star hP G ε hV U), ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card (star hP G ε hU V)) * ↑(Finset.card (star hP G ε hV U))) q : ℝ := (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (4 ^ Finset.card P.parts * 4 ^ Finset.card P.parts) r : ℝ := ↑(SimpleGraph.edgeDensity G (Finset.biUnion (star hP G ε hU V) id) (Finset.biUnion (star hP G ε hV U) id)) s : ℝ := ↑(SimpleGraph.edgeDensity G (SimpleGraph.nonuniformWitness G ε U V) (SimpleGraph.nonuniformWitness G ε V U)) t : ℝ := ↑(SimpleGraph.edgeDensity G U V) hrs : r - s ≤ ε / 5 ∧ s - r ≤ ε / 5 hst : ε ≤ s - t ∨ ε ≤ -(s - t) hpr : |p - r| ≤ ε ^ 5 / 49 hqt : |q - t| ≤ ε ^ 5 / 49 hε' : ε ^ 5 ≤ ε hpr' : p - r ≤ ε / 49 ∧ r - p ≤ ε / 49 hqt' : q - t ≤ ε / 49 ∧ t - q ≤ ε / 49 ⊢ 3 / 4 * ε ≤ p - q ∨ 3 / 4 * ε ≤ -(p - q) [PROOFSTEP] cases hst [GOAL] case inl α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s✝ : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V p : ℝ := (∑ ab in Finset.product (star hP G ε hU V) (star hP G ε hV U), ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card (star hP G ε hU V)) * ↑(Finset.card (star hP G ε hV U))) q : ℝ := (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (4 ^ Finset.card P.parts * 4 ^ Finset.card P.parts) r : ℝ := ↑(SimpleGraph.edgeDensity G (Finset.biUnion (star hP G ε hU V) id) (Finset.biUnion (star hP G ε hV U) id)) s : ℝ := ↑(SimpleGraph.edgeDensity G (SimpleGraph.nonuniformWitness G ε U V) (SimpleGraph.nonuniformWitness G ε V U)) t : ℝ := ↑(SimpleGraph.edgeDensity G U V) hrs : r - s ≤ ε / 5 ∧ s - r ≤ ε / 5 hpr : |p - r| ≤ ε ^ 5 / 49 hqt : |q - t| ≤ ε ^ 5 / 49 hε' : ε ^ 5 ≤ ε hpr' : p - r ≤ ε / 49 ∧ r - p ≤ ε / 49 hqt' : q - t ≤ ε / 49 ∧ t - q ≤ ε / 49 h✝ : ε ≤ s - t ⊢ 3 / 4 * ε ≤ p - q ∨ 3 / 4 * ε ≤ -(p - q) case inr α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s✝ : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V p : ℝ := (∑ ab in Finset.product (star hP G ε hU V) (star hP G ε hV U), ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card (star hP G ε hU V)) * ↑(Finset.card (star hP G ε hV U))) q : ℝ := (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (4 ^ Finset.card P.parts * 4 ^ Finset.card P.parts) r : ℝ := ↑(SimpleGraph.edgeDensity G (Finset.biUnion (star hP G ε hU V) id) (Finset.biUnion (star hP G ε hV U) id)) s : ℝ := ↑(SimpleGraph.edgeDensity G (SimpleGraph.nonuniformWitness G ε U V) (SimpleGraph.nonuniformWitness G ε V U)) t : ℝ := ↑(SimpleGraph.edgeDensity G U V) hrs : r - s ≤ ε / 5 ∧ s - r ≤ ε / 5 hpr : |p - r| ≤ ε ^ 5 / 49 hqt : |q - t| ≤ ε ^ 5 / 49 hε' : ε ^ 5 ≤ ε hpr' : p - r ≤ ε / 49 ∧ r - p ≤ ε / 49 hqt' : q - t ≤ ε / 49 ∧ t - q ≤ ε / 49 h✝ : ε ≤ -(s - t) ⊢ 3 / 4 * ε ≤ p - q ∨ 3 / 4 * ε ≤ -(p - q) [PROOFSTEP] left [GOAL] case inl.h α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s✝ : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V p : ℝ := (∑ ab in Finset.product (star hP G ε hU V) (star hP G ε hV U), ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card (star hP G ε hU V)) * ↑(Finset.card (star hP G ε hV U))) q : ℝ := (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (4 ^ Finset.card P.parts * 4 ^ Finset.card P.parts) r : ℝ := ↑(SimpleGraph.edgeDensity G (Finset.biUnion (star hP G ε hU V) id) (Finset.biUnion (star hP G ε hV U) id)) s : ℝ := ↑(SimpleGraph.edgeDensity G (SimpleGraph.nonuniformWitness G ε U V) (SimpleGraph.nonuniformWitness G ε V U)) t : ℝ := ↑(SimpleGraph.edgeDensity G U V) hrs : r - s ≤ ε / 5 ∧ s - r ≤ ε / 5 hpr : |p - r| ≤ ε ^ 5 / 49 hqt : |q - t| ≤ ε ^ 5 / 49 hε' : ε ^ 5 ≤ ε hpr' : p - r ≤ ε / 49 ∧ r - p ≤ ε / 49 hqt' : q - t ≤ ε / 49 ∧ t - q ≤ ε / 49 h✝ : ε ≤ s - t ⊢ 3 / 4 * ε ≤ p - q case inr α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s✝ : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V p : ℝ := (∑ ab in Finset.product (star hP G ε hU V) (star hP G ε hV U), ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card (star hP G ε hU V)) * ↑(Finset.card (star hP G ε hV U))) q : ℝ := (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (4 ^ Finset.card P.parts * 4 ^ Finset.card P.parts) r : ℝ := ↑(SimpleGraph.edgeDensity G (Finset.biUnion (star hP G ε hU V) id) (Finset.biUnion (star hP G ε hV U) id)) s : ℝ := ↑(SimpleGraph.edgeDensity G (SimpleGraph.nonuniformWitness G ε U V) (SimpleGraph.nonuniformWitness G ε V U)) t : ℝ := ↑(SimpleGraph.edgeDensity G U V) hrs : r - s ≤ ε / 5 ∧ s - r ≤ ε / 5 hpr : |p - r| ≤ ε ^ 5 / 49 hqt : |q - t| ≤ ε ^ 5 / 49 hε' : ε ^ 5 ≤ ε hpr' : p - r ≤ ε / 49 ∧ r - p ≤ ε / 49 hqt' : q - t ≤ ε / 49 ∧ t - q ≤ ε / 49 h✝ : ε ≤ -(s - t) ⊢ 3 / 4 * ε ≤ p - q ∨ 3 / 4 * ε ≤ -(p - q) [PROOFSTEP] linarith [GOAL] case inr α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s✝ : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V p : ℝ := (∑ ab in Finset.product (star hP G ε hU V) (star hP G ε hV U), ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card (star hP G ε hU V)) * ↑(Finset.card (star hP G ε hV U))) q : ℝ := (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (4 ^ Finset.card P.parts * 4 ^ Finset.card P.parts) r : ℝ := ↑(SimpleGraph.edgeDensity G (Finset.biUnion (star hP G ε hU V) id) (Finset.biUnion (star hP G ε hV U) id)) s : ℝ := ↑(SimpleGraph.edgeDensity G (SimpleGraph.nonuniformWitness G ε U V) (SimpleGraph.nonuniformWitness G ε V U)) t : ℝ := ↑(SimpleGraph.edgeDensity G U V) hrs : r - s ≤ ε / 5 ∧ s - r ≤ ε / 5 hpr : |p - r| ≤ ε ^ 5 / 49 hqt : |q - t| ≤ ε ^ 5 / 49 hε' : ε ^ 5 ≤ ε hpr' : p - r ≤ ε / 49 ∧ r - p ≤ ε / 49 hqt' : q - t ≤ ε / 49 ∧ t - q ≤ ε / 49 h✝ : ε ≤ -(s - t) ⊢ 3 / 4 * ε ≤ p - q ∨ 3 / 4 * ε ≤ -(p - q) [PROOFSTEP] right [GOAL] case inr.h α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s✝ : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V p : ℝ := (∑ ab in Finset.product (star hP G ε hU V) (star hP G ε hV U), ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (↑(Finset.card (star hP G ε hU V)) * ↑(Finset.card (star hP G ε hV U))) q : ℝ := (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / (4 ^ Finset.card P.parts * 4 ^ Finset.card P.parts) r : ℝ := ↑(SimpleGraph.edgeDensity G (Finset.biUnion (star hP G ε hU V) id) (Finset.biUnion (star hP G ε hV U) id)) s : ℝ := ↑(SimpleGraph.edgeDensity G (SimpleGraph.nonuniformWitness G ε U V) (SimpleGraph.nonuniformWitness G ε V U)) t : ℝ := ↑(SimpleGraph.edgeDensity G U V) hrs : r - s ≤ ε / 5 ∧ s - r ≤ ε / 5 hpr : |p - r| ≤ ε ^ 5 / 49 hqt : |q - t| ≤ ε ^ 5 / 49 hε' : ε ^ 5 ≤ ε hpr' : p - r ≤ ε / 49 ∧ r - p ≤ ε / 49 hqt' : q - t ≤ ε / 49 ∧ t - q ≤ ε / 49 h✝ : ε ≤ -(s - t) ⊢ 3 / 4 * ε ≤ -(p - q) [PROOFSTEP] linarith [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V ⊢ ↑(SimpleGraph.edgeDensity G U V) ^ 2 - ε ^ 5 / ↑25 + ε ^ 4 / 3 ≤ ↑(SimpleGraph.edgeDensity G U V) ^ 2 - ε ^ 5 / 25 + ↑(Finset.card (star hP G ε hU V)) * ↑(Finset.card (star hP G ε hV U)) / 16 ^ Finset.card P.parts * (9 / 16) * ε ^ 2 [PROOFSTEP] apply add_le_add_left [GOAL] case bc α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V ⊢ ε ^ 4 / 3 ≤ ↑(Finset.card (star hP G ε hU V)) * ↑(Finset.card (star hP G ε hV U)) / 16 ^ Finset.card P.parts * (9 / 16) * ε ^ 2 [PROOFSTEP] have Ul : 4 / 5 * ε ≤ (star hP G ε hU V).card / _ := eps_le_card_star_div hPα hPε hε₁ hU hV hUVne hUV [GOAL] case bc α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V Ul : 4 / 5 * ε ≤ ↑(Finset.card (star hP G ε hU V)) / 4 ^ Finset.card P.parts ⊢ ε ^ 4 / 3 ≤ ↑(Finset.card (star hP G ε hU V)) * ↑(Finset.card (star hP G ε hV U)) / 16 ^ Finset.card P.parts * (9 / 16) * ε ^ 2 [PROOFSTEP] have Vl : 4 / 5 * ε ≤ (star hP G ε hV U).card / _ := eps_le_card_star_div hPα hPε hε₁ hV hU hUVne.symm fun h => hUV h.symm [GOAL] case bc α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V Ul : 4 / 5 * ε ≤ ↑(Finset.card (star hP G ε hU V)) / 4 ^ Finset.card P.parts Vl : 4 / 5 * ε ≤ ↑(Finset.card (star hP G ε hV U)) / 4 ^ Finset.card P.parts ⊢ ε ^ 4 / 3 ≤ ↑(Finset.card (star hP G ε hU V)) * ↑(Finset.card (star hP G ε hV U)) / 16 ^ Finset.card P.parts * (9 / 16) * ε ^ 2 [PROOFSTEP] rw [show (16 : ℝ) = ↑4 ^ 2 by norm_num, pow_right_comm, sq ((4 : ℝ) ^ _), ← _root_.div_mul_div_comm, mul_assoc] [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V Ul : 4 / 5 * ε ≤ ↑(Finset.card (star hP G ε hU V)) / 4 ^ Finset.card P.parts Vl : 4 / 5 * ε ≤ ↑(Finset.card (star hP G ε hV U)) / 4 ^ Finset.card P.parts ⊢ 16 = 4 ^ 2 [PROOFSTEP] norm_num [GOAL] case bc α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V Ul : 4 / 5 * ε ≤ ↑(Finset.card (star hP G ε hU V)) / 4 ^ Finset.card P.parts Vl : 4 / 5 * ε ≤ ↑(Finset.card (star hP G ε hV U)) / 4 ^ Finset.card P.parts ⊢ ε ^ 4 / 3 ≤ ↑(Finset.card (star hP G ε hU V)) / 4 ^ Finset.card P.parts * (↑(Finset.card (star hP G ε hV U)) / 4 ^ Finset.card P.parts) * (9 / 4 ^ 2 * ε ^ 2) [PROOFSTEP] have : 0 < ε := by sz_positivity [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V Ul : 4 / 5 * ε ≤ ↑(Finset.card (star hP G ε hU V)) / 4 ^ Finset.card P.parts Vl : 4 / 5 * ε ≤ ↑(Finset.card (star hP G ε hV U)) / 4 ^ Finset.card P.parts ⊢ 0 < ε [PROOFSTEP] sz_positivity [GOAL] case bc α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V Ul : 4 / 5 * ε ≤ ↑(Finset.card (star hP G ε hU V)) / 4 ^ Finset.card P.parts Vl : 4 / 5 * ε ≤ ↑(Finset.card (star hP G ε hV U)) / 4 ^ Finset.card P.parts this : 0 < ε ⊢ ε ^ 4 / 3 ≤ ↑(Finset.card (star hP G ε hU V)) / 4 ^ Finset.card P.parts * (↑(Finset.card (star hP G ε hV U)) / 4 ^ Finset.card P.parts) * (9 / 4 ^ 2 * ε ^ 2) [PROOFSTEP] have UVl := mul_le_mul Ul Vl (by positivity) (by positivity) [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V Ul : 4 / 5 * ε ≤ ↑(Finset.card (star hP G ε hU V)) / 4 ^ Finset.card P.parts Vl : 4 / 5 * ε ≤ ↑(Finset.card (star hP G ε hV U)) / 4 ^ Finset.card P.parts this : 0 < ε ⊢ 0 ≤ 4 / 5 * ε [PROOFSTEP] positivity [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V Ul : 4 / 5 * ε ≤ ↑(Finset.card (star hP G ε hU V)) / 4 ^ Finset.card P.parts Vl : 4 / 5 * ε ≤ ↑(Finset.card (star hP G ε hV U)) / 4 ^ Finset.card P.parts this : 0 < ε ⊢ 0 ≤ ↑(Finset.card (star hP G ε hU V)) / 4 ^ Finset.card P.parts [PROOFSTEP] positivity [GOAL] case bc α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V Ul : 4 / 5 * ε ≤ ↑(Finset.card (star hP G ε hU V)) / 4 ^ Finset.card P.parts Vl : 4 / 5 * ε ≤ ↑(Finset.card (star hP G ε hV U)) / 4 ^ Finset.card P.parts this : 0 < ε UVl : 4 / 5 * ε * (4 / 5 * ε) ≤ ↑(Finset.card (star hP G ε hU V)) / 4 ^ Finset.card P.parts * (↑(Finset.card (star hP G ε hV U)) / 4 ^ Finset.card P.parts) ⊢ ε ^ 4 / 3 ≤ ↑(Finset.card (star hP G ε hU V)) / 4 ^ Finset.card P.parts * (↑(Finset.card (star hP G ε hV U)) / 4 ^ Finset.card P.parts) * (9 / 4 ^ 2 * ε ^ 2) [PROOFSTEP] refine' le_trans _ (mul_le_mul_of_nonneg_right UVl _) [GOAL] case bc.refine'_1 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V Ul : 4 / 5 * ε ≤ ↑(Finset.card (star hP G ε hU V)) / 4 ^ Finset.card P.parts Vl : 4 / 5 * ε ≤ ↑(Finset.card (star hP G ε hV U)) / 4 ^ Finset.card P.parts this : 0 < ε UVl : 4 / 5 * ε * (4 / 5 * ε) ≤ ↑(Finset.card (star hP G ε hU V)) / 4 ^ Finset.card P.parts * (↑(Finset.card (star hP G ε hV U)) / 4 ^ Finset.card P.parts) ⊢ ε ^ 4 / 3 ≤ 4 / 5 * ε * (4 / 5 * ε) * (9 / 4 ^ 2 * ε ^ 2) [PROOFSTEP] norm_num [GOAL] case bc.refine'_1 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V Ul : 4 / 5 * ε ≤ ↑(Finset.card (star hP G ε hU V)) / 4 ^ Finset.card P.parts Vl : 4 / 5 * ε ≤ ↑(Finset.card (star hP G ε hV U)) / 4 ^ Finset.card P.parts this : 0 < ε UVl : 4 / 5 * ε * (4 / 5 * ε) ≤ ↑(Finset.card (star hP G ε hU V)) / 4 ^ Finset.card P.parts * (↑(Finset.card (star hP G ε hV U)) / 4 ^ Finset.card P.parts) ⊢ ε ^ 4 / 3 ≤ 4 / 5 * ε * (4 / 5 * ε) * (9 / 16 * ε ^ 2) [PROOFSTEP] nlinarith [GOAL] case bc.refine'_2 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V Ul : 4 / 5 * ε ≤ ↑(Finset.card (star hP G ε hU V)) / 4 ^ Finset.card P.parts Vl : 4 / 5 * ε ≤ ↑(Finset.card (star hP G ε hV U)) / 4 ^ Finset.card P.parts this : 0 < ε UVl : 4 / 5 * ε * (4 / 5 * ε) ≤ ↑(Finset.card (star hP G ε hU V)) / 4 ^ Finset.card P.parts * (↑(Finset.card (star hP G ε hV U)) / 4 ^ Finset.card P.parts) ⊢ 0 ≤ 9 / 4 ^ 2 * ε ^ 2 [PROOFSTEP] norm_num [GOAL] case bc.refine'_2 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V Ul : 4 / 5 * ε ≤ ↑(Finset.card (star hP G ε hU V)) / 4 ^ Finset.card P.parts Vl : 4 / 5 * ε ≤ ↑(Finset.card (star hP G ε hV U)) / 4 ^ Finset.card P.parts this : 0 < ε UVl : 4 / 5 * ε * (4 / 5 * ε) ≤ ↑(Finset.card (star hP G ε hU V)) / 4 ^ Finset.card P.parts * (↑(Finset.card (star hP G ε hV U)) / 4 ^ Finset.card P.parts) ⊢ 0 ≤ ε ^ 2 [PROOFSTEP] positivity [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V ⊢ ↑(SimpleGraph.edgeDensity G U V) ^ 2 - ε ^ 5 / 25 + ↑(Finset.card (star hP G ε hU V)) * ↑(Finset.card (star hP G ε hV U)) / 16 ^ Finset.card P.parts * (9 / 16) * ε ^ 2 ≤ (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd) ^ 2) / 16 ^ Finset.card P.parts [PROOFSTEP] have t : (star hP G ε hU V).product (star hP G ε hV U) ⊆ (chunk hP G ε hU).parts.product (chunk hP G ε hV).parts := product_subset_product star_subset_chunk star_subset_chunk [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V t : Finset.product (star hP G ε hU V) (star hP G ε hV U) ⊆ Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts ⊢ ↑(SimpleGraph.edgeDensity G U V) ^ 2 - ε ^ 5 / 25 + ↑(Finset.card (star hP G ε hU V)) * ↑(Finset.card (star hP G ε hV U)) / 16 ^ Finset.card P.parts * (9 / 16) * ε ^ 2 ≤ (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd) ^ 2) / 16 ^ Finset.card P.parts [PROOFSTEP] have hε : 0 ≤ ε := by sz_positivity [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V t : Finset.product (star hP G ε hU V) (star hP G ε hV U) ⊆ Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts ⊢ 0 ≤ ε [PROOFSTEP] sz_positivity [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V t : Finset.product (star hP G ε hU V) (star hP G ε hV U) ⊆ Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts hε : 0 ≤ ε ⊢ ↑(SimpleGraph.edgeDensity G U V) ^ 2 - ε ^ 5 / 25 + ↑(Finset.card (star hP G ε hU V)) * ↑(Finset.card (star hP G ε hV U)) / 16 ^ Finset.card P.parts * (9 / 16) * ε ^ 2 ≤ (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd) ^ 2) / 16 ^ Finset.card P.parts [PROOFSTEP] have sp : ∀ (a b : Finset (Finset α)), a.product b = a ×ˢ b := fun a b => rfl [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V t : Finset.product (star hP G ε hU V) (star hP G ε hV U) ⊆ Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts hε : 0 ≤ ε sp : ∀ (a b : Finset (Finset α)), Finset.product a b = a ×ˢ b ⊢ ↑(SimpleGraph.edgeDensity G U V) ^ 2 - ε ^ 5 / 25 + ↑(Finset.card (star hP G ε hU V)) * ↑(Finset.card (star hP G ε hV U)) / 16 ^ Finset.card P.parts * (9 / 16) * ε ^ 2 ≤ (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd) ^ 2) / 16 ^ Finset.card P.parts [PROOFSTEP] have := add_div_le_sum_sq_div_card t (fun x => (G.edgeDensity x.1 x.2 : ℝ)) ((G.edgeDensity U V : ℝ) ^ 2 - ε ^ 5 / ↑25) (show 0 ≤ 3 / 4 * ε by linarith) ?_ ?_ [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V t : Finset.product (star hP G ε hU V) (star hP G ε hV U) ⊆ Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts hε : 0 ≤ ε sp : ∀ (a b : Finset (Finset α)), Finset.product a b = a ×ˢ b ⊢ 0 ≤ 3 / 4 * ε [PROOFSTEP] linarith [GOAL] case refine_3 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V t : Finset.product (star hP G ε hU V) (star hP G ε hV U) ⊆ Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts hε : 0 ≤ ε sp : ∀ (a b : Finset (Finset α)), Finset.product a b = a ×ˢ b this : ↑(SimpleGraph.edgeDensity G U V) ^ 2 - ε ^ 5 / 25 + ↑(Finset.card (Finset.product (star hP G ε hU V) (star hP G ε hV U))) / ↑(Finset.card (Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts)) * (3 / 4 * ε) ^ 2 ≤ (∑ i in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, (fun x => ↑(SimpleGraph.edgeDensity G x.fst x.snd)) i ^ 2) / ↑(Finset.card (Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts)) ⊢ ↑(SimpleGraph.edgeDensity G U V) ^ 2 - ε ^ 5 / 25 + ↑(Finset.card (star hP G ε hU V)) * ↑(Finset.card (star hP G ε hV U)) / 16 ^ Finset.card P.parts * (9 / 16) * ε ^ 2 ≤ (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd) ^ 2) / 16 ^ Finset.card P.parts [PROOFSTEP] simp_rw [sp, card_product, card_chunk (m_pos hPα).ne', ← mul_pow, cast_pow, mul_pow, div_pow, ← mul_assoc] at this [GOAL] case refine_3 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V t : Finset.product (star hP G ε hU V) (star hP G ε hV U) ⊆ Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts hε : 0 ≤ ε sp : ∀ (a b : Finset (Finset α)), Finset.product a b = a ×ˢ b this : ↑(SimpleGraph.edgeDensity G U V) ^ 2 - ε ^ 5 / 25 + ↑(Finset.card (star hP G ε hU V) * Finset.card (star hP G ε hV U)) / ↑(4 * 4) ^ Finset.card P.parts * (3 ^ 2 / 4 ^ 2) * ε ^ 2 ≤ (∑ x in (chunk hP G ε hU).parts ×ˢ (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G x.fst x.snd) ^ 2) / ↑(4 * 4) ^ Finset.card P.parts ⊢ ↑(SimpleGraph.edgeDensity G U V) ^ 2 - ε ^ 5 / 25 + ↑(Finset.card (star hP G ε hU V)) * ↑(Finset.card (star hP G ε hV U)) / 16 ^ Finset.card P.parts * (9 / 16) * ε ^ 2 ≤ (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd) ^ 2) / 16 ^ Finset.card P.parts [PROOFSTEP] norm_num at this [GOAL] case refine_3 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V t : Finset.product (star hP G ε hU V) (star hP G ε hV U) ⊆ Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts hε : 0 ≤ ε sp : ∀ (a b : Finset (Finset α)), Finset.product a b = a ×ˢ b this : ↑(SimpleGraph.edgeDensity G U V) ^ 2 - ε ^ 5 / 25 + ↑(Finset.card (star hP G ε hU V)) * ↑(Finset.card (star hP G ε hV U)) / 16 ^ Finset.card P.parts * (9 / 16) * ε ^ 2 ≤ (∑ x in (chunk hP G ε hU).parts ×ˢ (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G x.fst x.snd) ^ 2) / 16 ^ Finset.card P.parts ⊢ ↑(SimpleGraph.edgeDensity G U V) ^ 2 - ε ^ 5 / 25 + ↑(Finset.card (star hP G ε hU V)) * ↑(Finset.card (star hP G ε hV U)) / 16 ^ Finset.card P.parts * (9 / 16) * ε ^ 2 ≤ (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd) ^ 2) / 16 ^ Finset.card P.parts [PROOFSTEP] exact this [GOAL] case refine_1 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V t : Finset.product (star hP G ε hU V) (star hP G ε hV U) ⊆ Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts hε : 0 ≤ ε sp : ∀ (a b : Finset (Finset α)), Finset.product a b = a ×ˢ b ⊢ 3 / 4 * ε ≤ |(∑ i in Finset.product (star hP G ε hU V) (star hP G ε hV U), (fun x => ↑(SimpleGraph.edgeDensity G x.fst x.snd)) i) / ↑(Finset.card (Finset.product (star hP G ε hU V) (star hP G ε hV U))) - (∑ i in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, (fun x => ↑(SimpleGraph.edgeDensity G x.fst x.snd)) i) / ↑(Finset.card (Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts))| [PROOFSTEP] simp_rw [sp, card_product, card_chunk (m_pos hPα).ne', ← mul_pow] [GOAL] case refine_1 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V t : Finset.product (star hP G ε hU V) (star hP G ε hV U) ⊆ Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts hε : 0 ≤ ε sp : ∀ (a b : Finset (Finset α)), Finset.product a b = a ×ˢ b ⊢ 3 / 4 * ε ≤ |(∑ x in star hP G ε hU V ×ˢ star hP G ε hV U, ↑(SimpleGraph.edgeDensity G x.fst x.snd)) / ↑(Finset.card (star hP G ε hU V) * Finset.card (star hP G ε hV U)) - (∑ x in (chunk hP G ε hU).parts ×ˢ (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G x.fst x.snd)) / ↑((4 * 4) ^ Finset.card P.parts)| [PROOFSTEP] norm_num [GOAL] case refine_1 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V t : Finset.product (star hP G ε hU V) (star hP G ε hV U) ⊆ Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts hε : 0 ≤ ε sp : ∀ (a b : Finset (Finset α)), Finset.product a b = a ×ˢ b ⊢ 3 / 4 * ε ≤ |(∑ x in star hP G ε hU V ×ˢ star hP G ε hV U, ↑(SimpleGraph.edgeDensity G x.fst x.snd)) / (↑(Finset.card (star hP G ε hU V)) * ↑(Finset.card (star hP G ε hV U))) - (∑ x in (chunk hP G ε hU).parts ×ˢ (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G x.fst x.snd)) / 16 ^ Finset.card P.parts| [PROOFSTEP] exact edgeDensity_star_not_uniform hPα hPε hε₁ hUVne hUV [GOAL] case refine_2 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V t : Finset.product (star hP G ε hU V) (star hP G ε hV U) ⊆ Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts hε : 0 ≤ ε sp : ∀ (a b : Finset (Finset α)), Finset.product a b = a ×ˢ b ⊢ ↑(SimpleGraph.edgeDensity G U V) ^ 2 - ε ^ 5 / 25 ≤ ((∑ i in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, (fun x => ↑(SimpleGraph.edgeDensity G x.fst x.snd)) i) / ↑(Finset.card (Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts))) ^ 2 [PROOFSTEP] rw [sp, card_product] [GOAL] case refine_2 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V t : Finset.product (star hP G ε hU V) (star hP G ε hV U) ⊆ Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts hε : 0 ≤ ε sp : ∀ (a b : Finset (Finset α)), Finset.product a b = a ×ˢ b ⊢ ↑(SimpleGraph.edgeDensity G U V) ^ 2 - ε ^ 5 / 25 ≤ ((∑ i in (chunk hP G ε hU).parts ×ˢ (chunk hP G ε hV).parts, (fun x => ↑(SimpleGraph.edgeDensity G x.fst x.snd)) i) / ↑(Finset.card (chunk hP G ε hU).parts * Finset.card (chunk hP G ε hV).parts)) ^ 2 [PROOFSTEP] apply (edgeDensity_chunk_aux hPα hPε hU hV).trans [GOAL] case refine_2 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V t : Finset.product (star hP G ε hU V) (star hP G ε hV U) ⊆ Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts hε : 0 ≤ ε sp : ∀ (a b : Finset (Finset α)), Finset.product a b = a ×ˢ b ⊢ ((∑ ab in Finset.product (chunk ?m.2764430 G ε hU).parts (chunk ?m.2764430 G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / 16 ^ Finset.card P.parts) ^ 2 ≤ ((∑ i in (chunk hP G ε hU).parts ×ˢ (chunk hP G ε hV).parts, (fun x => ↑(SimpleGraph.edgeDensity G x.fst x.snd)) i) / ↑(Finset.card (chunk hP G ε hU).parts * Finset.card (chunk hP G ε hV).parts)) ^ 2 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V t : Finset.product (star hP G ε hU V) (star hP G ε hV U) ⊆ Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts hε : 0 ≤ ε sp : ∀ (a b : Finset (Finset α)), Finset.product a b = a ×ˢ b ⊢ IsEquipartition P [PROOFSTEP] rw [card_chunk (m_pos hPα).ne', card_chunk (m_pos hPα).ne', ← mul_pow] [GOAL] case refine_2 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V t : Finset.product (star hP G ε hU V) (star hP G ε hV U) ⊆ Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts hε : 0 ≤ ε sp : ∀ (a b : Finset (Finset α)), Finset.product a b = a ×ˢ b ⊢ ((∑ ab in Finset.product (chunk ?m.2764430 G ε hU).parts (chunk ?m.2764430 G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / 16 ^ Finset.card P.parts) ^ 2 ≤ ((∑ i in (chunk hP G ε hU).parts ×ˢ (chunk hP G ε hV).parts, (fun x => ↑(SimpleGraph.edgeDensity G x.fst x.snd)) i) / ↑((4 * 4) ^ Finset.card P.parts)) ^ 2 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V t : Finset.product (star hP G ε hU V) (star hP G ε hV U) ⊆ Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts hε : 0 ≤ ε sp : ∀ (a b : Finset (Finset α)), Finset.product a b = a ×ˢ b ⊢ IsEquipartition P α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V t : Finset.product (star hP G ε hU V) (star hP G ε hV U) ⊆ Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts hε : 0 ≤ ε sp : ∀ (a b : Finset (Finset α)), Finset.product a b = a ×ˢ b ⊢ IsEquipartition P α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V t : Finset.product (star hP G ε hU V) (star hP G ε hV U) ⊆ Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts hε : 0 ≤ ε sp : ∀ (a b : Finset (Finset α)), Finset.product a b = a ×ˢ b ⊢ IsEquipartition P α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V t : Finset.product (star hP G ε hU V) (star hP G ε hV U) ⊆ Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts hε : 0 ≤ ε sp : ∀ (a b : Finset (Finset α)), Finset.product a b = a ×ˢ b ⊢ IsEquipartition P [PROOFSTEP] norm_num [GOAL] case refine_2 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V t : Finset.product (star hP G ε hU V) (star hP G ε hV U) ⊆ Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts hε : 0 ≤ ε sp : ∀ (a b : Finset (Finset α)), Finset.product a b = a ×ˢ b ⊢ (∑ ab in Finset.product (chunk ?m.2764430 G ε hU).parts (chunk ?m.2764430 G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) ^ 2 / (16 ^ Finset.card P.parts) ^ 2 ≤ (∑ ab in (chunk hP G ε hU).parts ×ˢ (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) ^ 2 / (16 ^ Finset.card P.parts) ^ 2 α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V t : Finset.product (star hP G ε hU V) (star hP G ε hV U) ⊆ Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts hε : 0 ≤ ε sp : ∀ (a b : Finset (Finset α)), Finset.product a b = a ×ˢ b ⊢ IsEquipartition P α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V t : Finset.product (star hP G ε hU V) (star hP G ε hV U) ⊆ Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts hε : 0 ≤ ε sp : ∀ (a b : Finset (Finset α)), Finset.product a b = a ×ˢ b ⊢ IsEquipartition P α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V t : Finset.product (star hP G ε hU V) (star hP G ε hV U) ⊆ Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts hε : 0 ≤ ε sp : ∀ (a b : Finset (Finset α)), Finset.product a b = a ×ˢ b ⊢ IsEquipartition P α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hε₁ : ε ≤ 1 hU : U ∈ P.parts hV : V ∈ P.parts hUVne : U ≠ V hUV : ¬SimpleGraph.IsUniform G ε U V t : Finset.product (star hP G ε hU V) (star hP G ε hV U) ⊆ Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts hε : 0 ≤ ε sp : ∀ (a b : Finset (Finset α)), Finset.product a b = a ×ˢ b ⊢ IsEquipartition P [PROOFSTEP] rfl [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts ⊢ ↑(SimpleGraph.edgeDensity G U V) ^ 2 - ε ^ 5 / 25 ≤ (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd) ^ 2) / 16 ^ Finset.card P.parts [PROOFSTEP] apply (edgeDensity_chunk_aux (hP := hP) hPα hPε hU hV).trans [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts ⊢ ((∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / 16 ^ Finset.card P.parts) ^ 2 ≤ (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd) ^ 2) / 16 ^ Finset.card P.parts [PROOFSTEP] have key : ↑16 ^ P.parts.card = (((chunk hP G ε hU).parts ×ˢ (chunk hP G ε hV).parts).card : ℝ) := by rw [card_product, cast_mul, card_chunk (m_pos hPα).ne', card_chunk (m_pos hPα).ne', ← cast_mul, ← mul_pow]; norm_cast [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts ⊢ 16 ^ Finset.card P.parts = ↑(Finset.card ((chunk hP G ε hU).parts ×ˢ (chunk hP G ε hV).parts)) [PROOFSTEP] rw [card_product, cast_mul, card_chunk (m_pos hPα).ne', card_chunk (m_pos hPα).ne', ← cast_mul, ← mul_pow] [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts ⊢ 16 ^ Finset.card P.parts = ↑((4 * 4) ^ Finset.card P.parts) [PROOFSTEP] norm_cast [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts key : 16 ^ Finset.card P.parts = ↑(Finset.card ((chunk hP G ε hU).parts ×ˢ (chunk hP G ε hV).parts)) ⊢ ((∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / 16 ^ Finset.card P.parts) ^ 2 ≤ (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd) ^ 2) / 16 ^ Finset.card P.parts [PROOFSTEP] simp_rw [key] [GOAL] α : Type u_1 inst✝¹ : Fintype α P : Finpartition univ hP : IsEquipartition P G : SimpleGraph α ε : ℝ U : Finset α hU✝ : U ∈ P.parts V : Finset α 𝒜 : Finset (Finset α) s : Finset α inst✝ : Nonempty α hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5 hU : U ∈ P.parts hV : V ∈ P.parts key : 16 ^ Finset.card P.parts = ↑(Finset.card ((chunk hP G ε hU).parts ×ˢ (chunk hP G ε hV).parts)) ⊢ ((∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd)) / ↑(Finset.card ((chunk hP G ε hU).parts ×ˢ (chunk hP G ε hV).parts))) ^ 2 ≤ (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.fst ab.snd) ^ 2) / ↑(Finset.card ((chunk hP G ε hU).parts ×ˢ (chunk hP G ε hV).parts)) [PROOFSTEP] convert sum_div_card_sq_le_sum_sq_div_card (α := ℝ)
Whether you live in West Des Moines, Clive, Urbandale, or any other suburb of Des Moines, you will find a Traditions Children’s Center nearby. We currently have ten locations spread across the metro area for your convenience. Many of our centers have an open floor plan with private rooms used for the younger children and the open area used for the older kids. Contact us to schedule a tour today! Other holiday closures may occur. We will let you know ahead of time when to expect these. We have three child care centers in West Des Moines, one in Urbandale, three in Clive, two in Johnston, and one in Waukee. Check out one of our ten daycare centers and find a location that fits your family’s needs and/or enroll today!